home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / 3b1 / 78 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  11.7 KB

  1. Path: sparky!uunet!comp-sources-3b1
  2. From: dave@galaxia.network23.com (David H. Brierley)
  3. Newsgroups: comp.sources.3b1
  4. Subject: v02i025:  A few miscellaneous shell scripts for the 3b1, Part01/01
  5. Date: 21 Jul 1992 22:28:07 -0400
  6. Organization: UUNET Communications
  7. Lines: 392
  8. Sender: dhb@ftp.UU.NET
  9. Approved: dave@galaxia.network23.com
  10. Message-ID: <14ih3nINNd7g@ftp.UU.NET>
  11. NNTP-Posting-Host: ftp.uu.net
  12. X-Checksum-Snefru: 41b625fd 19ff1b4c dad498ca 439650f1
  13.  
  14. Submitted-by: dave@galaxia.network23.com (David H. Brierley)
  15. Posting-number: Volume 2, Issue 25
  16. Archive-name: misc-sh/part01
  17.  
  18. This is the README file for the Dave Brierley collection of miscellaneous
  19. source programs.  The collection is posted in seven separate pieces but
  20. all of the source came from the "misc" directory on my machine.  As a result
  21. of this, there is only one README file and only one Makefile, although each
  22. of the seven postings will contain a copy of these two files.  I suggest
  23. that you obtain (or save) as many of these postings as you are interested
  24. in, unpack them all in a single directory, and then compile the sources.
  25. Note that some of the programs are actually shell scripts and therefore do
  26. not need compilation.
  27.  
  28. install.sh
  29.  A shell script version of the BSD install command.
  30.  
  31. null.sh
  32.  Zero out one or more files.
  33.  
  34. tolower.sh
  35.  Convert file names to lower case.  Requires ksh.
  36.  
  37. toupper.sh
  38.  Convert file names to upper case.  Requires ksh.
  39.  
  40. #! /bin/sh
  41. # This is a shell archive.  Remove anything before this line, then unpack
  42. # it by saving it into a file and typing "sh file".  To overwrite existing
  43. # files, type "sh file -c".  You can also feed this as standard input via
  44. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  45. # will see the following message at the end:
  46. #        "End of archive 1 (of 1)."
  47. # Contents:  MANIFEST Makefile README install.sh null.sh tolower.sh
  48. #   toupper.sh
  49. # Wrapped by dave@galaxia on Tue Jul 21 10:33:17 1992
  50. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  51. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  52.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  53. else
  54. echo shar: Extracting \"'MANIFEST'\" \(313 characters\)
  55. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  56. X   File Name        Archive #    Description
  57. X-----------------------------------------------------------
  58. X MANIFEST                   1    
  59. X Makefile                   1    
  60. X README                     1    
  61. X install.sh                 1    
  62. X null.sh                    1    
  63. X tolower.sh                 1    
  64. X toupper.sh                 1    
  65. END_OF_FILE
  66. if test 313 -ne `wc -c <'MANIFEST'`; then
  67.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  68. fi
  69. # end of 'MANIFEST'
  70. fi
  71. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  72.   echo shar: Will not clobber existing file \"'Makefile'\"
  73. else
  74. echo shar: Extracting \"'Makefile'\" \(374 characters\)
  75. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  76. XCFLAGS    = -O
  77. X
  78. Xall:        bsdln disktest email ndf techo wclipper
  79. X
  80. Xbsdln:        bsdln.o
  81. X        $(CC) bsdln.o
  82. X        mv a.out bsdln
  83. X
  84. Xdisktest:    disktest.o
  85. X        $(CC) disktest.o
  86. X        mv a.out disktest
  87. X
  88. Xemail:        email.o
  89. X        $(CC) email.o
  90. X        mv a.out email
  91. X
  92. Xndf:        ndf.o
  93. X        $(CC) ndf.o
  94. X        mv a.out ndf
  95. X
  96. Xtecho:        techo.o
  97. X        $(CC) techo.o
  98. X        mv a.out techo
  99. X
  100. Xwclipper:    wclipper.o
  101. X        $(CC) wclipper.o
  102. X        mv a.out wclipper
  103. X
  104. END_OF_FILE
  105. if test 374 -ne `wc -c <'Makefile'`; then
  106.     echo shar: \"'Makefile'\" unpacked with wrong size!
  107. fi
  108. # end of 'Makefile'
  109. fi
  110. if test -f 'README' -a "${1}" != "-c" ; then 
  111.   echo shar: Will not clobber existing file \"'README'\"
  112. else
  113. echo shar: Extracting \"'README'\" \(4280 characters\)
  114. sed "s/^X//" >'README' <<'END_OF_FILE'
  115. XThis is the README file for the Dave Brierley collection of miscellaneous
  116. Xsource programs.  The collection is posted in seven separate pieces but
  117. Xall of the source came from the "misc" directory on my machine.  As a result
  118. Xof this, there is only one README file and only one Makefile, although each
  119. Xof the seven postings will contain a copy of these two files.  I suggest
  120. Xthat you obtain (or save) as many of these postings as you are interested
  121. Xin, unpack them all in a single directory, and then compile the sources.
  122. XNote that some of the programs are actually shell scripts and therefore do
  123. Xnot need compilation.
  124. X
  125. XINSTALLATION INSTRUCTIONS:
  126. X1. Compile all the source programs by typing "make all".  Edit the Makefile
  127. X   if you did not unpack all seven of the pieces.  Note that the Makefile
  128. X   does not contain explicit commands for using the shared library.  I always
  129. X   depend on "ccc" to do this for me.
  130. X2. Copy the resultant executables to your favorite bin directory.  I always
  131. X   use "/usr/local/bin".
  132. X3. Copy the various shell scripts to the bin directory and make then executable
  133. X   using the chmod command.  The shell scripts are all distributed with a
  134. X   suffix of ".sh".  I suggest you remove this suffix when you install it, but
  135. X   that is entirely up to you.
  136. X
  137. X
  138. XDescription of programs included in this package.  There is a line of dashes
  139. Xseparating each of the seven pieces.
  140. X
  141. Xbsdln.c
  142. X A version of the ln command that follows the BSD behaviour.  I.e. if the
  143. X target file exists, the command will fail.  The standard 3b1 version will
  144. X remove the target.
  145. X
  146. X--------------------------------------------------------------------------
  147. X
  148. Xinstall.sh
  149. X A shell script version of the BSD install command.
  150. X
  151. Xnull.sh
  152. X Zero out one or more files.
  153. X
  154. Xtolower.sh
  155. X Convert file names to lower case.  Requires ksh.
  156. X
  157. Xtoupper.sh
  158. X Convert file names to upper case.  Requires ksh.
  159. X
  160. X--------------------------------------------------------------------------
  161. X
  162. Xndf.c
  163. X Almost emulates the BSD df command.  I say "almost" because I chose to
  164. X display the numbers in terms of blocks instead of kbytes since everything
  165. X else on the machine displays sizes in blocks.  Supports the "-i" option
  166. X to displays inode information.  Also supports specifying any random
  167. X directory as an argument and it will figure out what file system it is.
  168. X
  169. X--------------------------------------------------------------------------
  170. X
  171. Xdisktest.c
  172. X A program used by the format script to test the floppy disk to be doubly
  173. X sure that it is usable.
  174. X
  175. Xformat.sh
  176. X Format a floppy disk.  Asks questions to determine desired parameters, such
  177. X as number of cylinders and number of sectors.  Will optionally run an
  178. X intensive surface test of the floppy (see disktest.c), build a file system
  179. X structure, and make the floppy bootable.  The main processing is done in a
  180. X loop so you can format multiple floppies easily.
  181. X
  182. Xnewfs.sh
  183. X Reads the VHB from the floppy and then builds a file system structure on it.
  184. X
  185. X--------------------------------------------------------------------------
  186. X
  187. Xtecho.c
  188. X A version of echo that allows direct access to termcap capabilities.  A lot
  189. X easier to use than intermixing calls to echo with calls to tput.
  190. X
  191. Xtecho.1
  192. X Hey, I actually wrote a man page for this one!
  193. X
  194. X--------------------------------------------------------------------------
  195. X
  196. Xwclipper.c
  197. X A program to read in the wtmp file and output the tail end of it.  Useful
  198. X if you want to maintain an N-day history of who has been using your system.
  199. X The output size can be specified in terms of days or kbytes.
  200. X
  201. Xwtmp.fix.sh
  202. X A shell script to control the operation of wclipper.
  203. X
  204. X--------------------------------------------------------------------------
  205. X
  206. Xemail.c
  207. X A version of the "email" program.  This program should be installed as
  208. X /usr/bin/email and it will be used by pcmgr (or by smgr) when you click
  209. X on the envelope icon.  It provides a safe interface to the mail program
  210. X by making sure the uid is set correctly and by doing a chdir to the
  211. X users home directory (both of which are already being done by pcmgr).
  212. X This version also provides a unique feature of reading an "rc" file
  213. X from the users home directory (~/.email.rc), which can be used to specify
  214. X what mail program to use.  See the sample provided.
  215. X
  216. Xemail.rc
  217. X Sample .email.rc file.
  218. END_OF_FILE
  219. if test 4280 -ne `wc -c <'README'`; then
  220.     echo shar: \"'README'\" unpacked with wrong size!
  221. fi
  222. # end of 'README'
  223. fi
  224. if test -f 'install.sh' -a "${1}" != "-c" ; then 
  225.   echo shar: Will not clobber existing file \"'install.sh'\"
  226. else
  227. echo shar: Extracting \"'install.sh'\" \(1307 characters\)
  228. sed "s/^X//" >'install.sh' <<'END_OF_FILE'
  229. X: 'sh or ksh'
  230. X#
  231. X#    '@(#)installit    2.4    10/15/87'
  232. X#    From install.sh    4.8    (Berkeley)    3/6/86
  233. X#    on the 4.3 BSD distribution (with permission)
  234. X#
  235. XPATH=/bin:/etc:/usr/bin:/usr/ucb
  236. Xexport PATH
  237. Xcmd=""
  238. Xstripbefore=""
  239. Xstripafter=""
  240. Xchmod="chmod 755"
  241. Xchown="#"
  242. Xchgrp="#"
  243. Xwhile true ; do
  244. X    case $1 in
  245. X        -s )    if test $cmd 
  246. X            then    stripafter="strip"
  247. X            else    stripbefore="strip"
  248. X            fi
  249. X            shift
  250. X            ;;
  251. X        -c )    if test $cmd 
  252. X            then    echo "install: multiple specifications of -c"
  253. X                exit 1
  254. X            fi
  255. X            cmd="cp"
  256. X            stripafter=$stripbefore
  257. X            stripbefore=""
  258. X            shift
  259. X            ;;
  260. X        -m )    chmod="chmod $2"
  261. X            shift
  262. X            shift
  263. X            ;;
  264. X        -o )    chown="chown $2"
  265. X            shift
  266. X            shift
  267. X            ;;
  268. X        -g )    chgrp="chgrp $2"
  269. X            shift
  270. X            shift
  271. X            ;;
  272. X        * )    break
  273. X            ;;
  274. X    esac
  275. Xdone
  276. Xif test $cmd 
  277. Xthen true
  278. Xelse cmd="mv"
  279. Xfi
  280. X
  281. Xif test ! ${2-""} 
  282. Xthen    echo "install: no destination specified"
  283. X    exit 1
  284. Xfi
  285. Xif test ${3-""} 
  286. Xthen    echo "install: too many files specified -> $*"
  287. X    exit 1
  288. Xfi
  289. Xif test $1 = $2 -o $2 = . 
  290. Xthen    echo "install: can't move $1 onto itself"
  291. X    exit 1
  292. Xfi
  293. Xif test '!' -f $1 
  294. Xthen    echo "install: can't open $1"
  295. X    exit 1
  296. Xfi
  297. Xif test -d $2 
  298. Xthen    file=$2/`basename $1`
  299. Xelse    file=$2
  300. Xfi
  301. X/bin/rm -f $file
  302. Xif test $stripbefore 
  303. Xthen    $stripbefore $1
  304. Xfi
  305. Xeval $cmd $1 $file
  306. Xif test $stripafter 
  307. Xthen    $stripafter $file
  308. Xfi
  309. Xeval $chown $file
  310. Xeval $chgrp $file
  311. Xeval $chmod $file
  312. END_OF_FILE
  313. if test 1307 -ne `wc -c <'install.sh'`; then
  314.     echo shar: \"'install.sh'\" unpacked with wrong size!
  315. fi
  316. chmod +x 'install.sh'
  317. # end of 'install.sh'
  318. fi
  319. if test -f 'null.sh' -a "${1}" != "-c" ; then 
  320.   echo shar: Will not clobber existing file \"'null.sh'\"
  321. else
  322. echo shar: Extracting \"'null.sh'\" \(51 characters\)
  323. sed "s/^X//" >'null.sh' <<'END_OF_FILE'
  324. X: 'sh or ksh'
  325. Xfor i
  326. Xdo
  327. X    cat /dev/null > $i
  328. Xdone
  329. END_OF_FILE
  330. if test 51 -ne `wc -c <'null.sh'`; then
  331.     echo shar: \"'null.sh'\" unpacked with wrong size!
  332. fi
  333. chmod +x 'null.sh'
  334. # end of 'null.sh'
  335. fi
  336. if test -f 'tolower.sh' -a "${1}" != "-c" ; then 
  337.   echo shar: Will not clobber existing file \"'tolower.sh'\"
  338. else
  339. echo shar: Extracting \"'tolower.sh'\" \(167 characters\)
  340. sed "s/^X//" >'tolower.sh' <<'END_OF_FILE'
  341. X#! /bin/ksh
  342. Xtypeset -l lower
  343. Xfor file
  344. Xdo
  345. X    lower=$file
  346. X    if test "${lower}" != "${file}"
  347. X    then
  348. X        echo "Renaming $file to $lower"
  349. X        mv $file $lower
  350. X    fi
  351. Xdone
  352. Xexit 0
  353. END_OF_FILE
  354. if test 167 -ne `wc -c <'tolower.sh'`; then
  355.     echo shar: \"'tolower.sh'\" unpacked with wrong size!
  356. fi
  357. chmod +x 'tolower.sh'
  358. # end of 'tolower.sh'
  359. fi
  360. if test -f 'toupper.sh' -a "${1}" != "-c" ; then 
  361.   echo shar: Will not clobber existing file \"'toupper.sh'\"
  362. else
  363. echo shar: Extracting \"'toupper.sh'\" \(167 characters\)
  364. sed "s/^X//" >'toupper.sh' <<'END_OF_FILE'
  365. X#! /bin/ksh
  366. Xtypeset -u upper
  367. Xfor file
  368. Xdo
  369. X    upper=$file
  370. X    if test "${upper}" != "${file}"
  371. X    then
  372. X        echo "Renaming $file to $upper"
  373. X        mv $file $upper
  374. X    fi
  375. Xdone
  376. Xexit 0
  377. END_OF_FILE
  378. if test 167 -ne `wc -c <'toupper.sh'`; then
  379.     echo shar: \"'toupper.sh'\" unpacked with wrong size!
  380. fi
  381. chmod +x 'toupper.sh'
  382. # end of 'toupper.sh'
  383. fi
  384. echo shar: End of archive 1 \(of 1\).
  385. cp /dev/null ark1isdone
  386. MISSING=""
  387. for I in 1 ; do
  388.     if test ! -f ark${I}isdone ; then
  389.     MISSING="${MISSING} ${I}"
  390.     fi
  391. done
  392. if test "${MISSING}" = "" ; then
  393.     echo You have the archive.
  394.     rm -f ark[1-9]isdone
  395. else
  396.     echo You still need to unpack the following archives:
  397.     echo "        " ${MISSING}
  398. fi
  399. ##  End of shell archive.
  400. exit 0
  401. -- 
  402. David H. Brierley
  403. Home: dave@galaxia.network23.com; Work: dhb@quahog.ssd.ray.com
  404. Send comp.sources.3b1 submissions to comp-sources-3b1@galaxia.network23.com
  405. %% Can I be excused, my brain is full. **
  406.