home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!comp-sources-3b1
- From: dave@galaxia.network23.com (David H. Brierley)
- Newsgroups: comp.sources.3b1
- Subject: v02i025: A few miscellaneous shell scripts for the 3b1, Part01/01
- Date: 21 Jul 1992 22:28:07 -0400
- Organization: UUNET Communications
- Lines: 392
- Sender: dhb@ftp.UU.NET
- Approved: dave@galaxia.network23.com
- Message-ID: <14ih3nINNd7g@ftp.UU.NET>
- NNTP-Posting-Host: ftp.uu.net
- X-Checksum-Snefru: 41b625fd 19ff1b4c dad498ca 439650f1
-
- Submitted-by: dave@galaxia.network23.com (David H. Brierley)
- Posting-number: Volume 2, Issue 25
- Archive-name: misc-sh/part01
-
- This is the README file for the Dave Brierley collection of miscellaneous
- source programs. The collection is posted in seven separate pieces but
- all of the source came from the "misc" directory on my machine. As a result
- of this, there is only one README file and only one Makefile, although each
- of the seven postings will contain a copy of these two files. I suggest
- that you obtain (or save) as many of these postings as you are interested
- in, unpack them all in a single directory, and then compile the sources.
- Note that some of the programs are actually shell scripts and therefore do
- not need compilation.
-
- install.sh
- A shell script version of the BSD install command.
-
- null.sh
- Zero out one or more files.
-
- tolower.sh
- Convert file names to lower case. Requires ksh.
-
- toupper.sh
- Convert file names to upper case. Requires ksh.
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: MANIFEST Makefile README install.sh null.sh tolower.sh
- # toupper.sh
- # Wrapped by dave@galaxia on Tue Jul 21 10:33:17 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(313 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X MANIFEST 1
- X Makefile 1
- X README 1
- X install.sh 1
- X null.sh 1
- X tolower.sh 1
- X toupper.sh 1
- END_OF_FILE
- if test 313 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(374 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- XCFLAGS = -O
- X
- Xall: bsdln disktest email ndf techo wclipper
- X
- Xbsdln: bsdln.o
- X $(CC) bsdln.o
- X mv a.out bsdln
- X
- Xdisktest: disktest.o
- X $(CC) disktest.o
- X mv a.out disktest
- X
- Xemail: email.o
- X $(CC) email.o
- X mv a.out email
- X
- Xndf: ndf.o
- X $(CC) ndf.o
- X mv a.out ndf
- X
- Xtecho: techo.o
- X $(CC) techo.o
- X mv a.out techo
- X
- Xwclipper: wclipper.o
- X $(CC) wclipper.o
- X mv a.out wclipper
- X
- END_OF_FILE
- if test 374 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(4280 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis is the README file for the Dave Brierley collection of miscellaneous
- Xsource programs. The collection is posted in seven separate pieces but
- Xall of the source came from the "misc" directory on my machine. As a result
- Xof this, there is only one README file and only one Makefile, although each
- Xof the seven postings will contain a copy of these two files. I suggest
- Xthat you obtain (or save) as many of these postings as you are interested
- Xin, unpack them all in a single directory, and then compile the sources.
- XNote that some of the programs are actually shell scripts and therefore do
- Xnot need compilation.
- X
- XINSTALLATION INSTRUCTIONS:
- X1. Compile all the source programs by typing "make all". Edit the Makefile
- X if you did not unpack all seven of the pieces. Note that the Makefile
- X does not contain explicit commands for using the shared library. I always
- X depend on "ccc" to do this for me.
- X2. Copy the resultant executables to your favorite bin directory. I always
- X use "/usr/local/bin".
- X3. Copy the various shell scripts to the bin directory and make then executable
- X using the chmod command. The shell scripts are all distributed with a
- X suffix of ".sh". I suggest you remove this suffix when you install it, but
- X that is entirely up to you.
- X
- X
- XDescription of programs included in this package. There is a line of dashes
- Xseparating each of the seven pieces.
- X
- Xbsdln.c
- X A version of the ln command that follows the BSD behaviour. I.e. if the
- X target file exists, the command will fail. The standard 3b1 version will
- X remove the target.
- X
- X--------------------------------------------------------------------------
- X
- Xinstall.sh
- X A shell script version of the BSD install command.
- X
- Xnull.sh
- X Zero out one or more files.
- X
- Xtolower.sh
- X Convert file names to lower case. Requires ksh.
- X
- Xtoupper.sh
- X Convert file names to upper case. Requires ksh.
- X
- X--------------------------------------------------------------------------
- X
- Xndf.c
- X Almost emulates the BSD df command. I say "almost" because I chose to
- X display the numbers in terms of blocks instead of kbytes since everything
- X else on the machine displays sizes in blocks. Supports the "-i" option
- X to displays inode information. Also supports specifying any random
- X directory as an argument and it will figure out what file system it is.
- X
- X--------------------------------------------------------------------------
- X
- Xdisktest.c
- X A program used by the format script to test the floppy disk to be doubly
- X sure that it is usable.
- X
- Xformat.sh
- X Format a floppy disk. Asks questions to determine desired parameters, such
- X as number of cylinders and number of sectors. Will optionally run an
- X intensive surface test of the floppy (see disktest.c), build a file system
- X structure, and make the floppy bootable. The main processing is done in a
- X loop so you can format multiple floppies easily.
- X
- Xnewfs.sh
- X Reads the VHB from the floppy and then builds a file system structure on it.
- X
- X--------------------------------------------------------------------------
- X
- Xtecho.c
- X A version of echo that allows direct access to termcap capabilities. A lot
- X easier to use than intermixing calls to echo with calls to tput.
- X
- Xtecho.1
- X Hey, I actually wrote a man page for this one!
- X
- X--------------------------------------------------------------------------
- X
- Xwclipper.c
- X A program to read in the wtmp file and output the tail end of it. Useful
- X if you want to maintain an N-day history of who has been using your system.
- X The output size can be specified in terms of days or kbytes.
- X
- Xwtmp.fix.sh
- X A shell script to control the operation of wclipper.
- X
- X--------------------------------------------------------------------------
- X
- Xemail.c
- X A version of the "email" program. This program should be installed as
- X /usr/bin/email and it will be used by pcmgr (or by smgr) when you click
- X on the envelope icon. It provides a safe interface to the mail program
- X by making sure the uid is set correctly and by doing a chdir to the
- X users home directory (both of which are already being done by pcmgr).
- X This version also provides a unique feature of reading an "rc" file
- X from the users home directory (~/.email.rc), which can be used to specify
- X what mail program to use. See the sample provided.
- X
- Xemail.rc
- X Sample .email.rc file.
- END_OF_FILE
- if test 4280 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'install.sh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'install.sh'\"
- else
- echo shar: Extracting \"'install.sh'\" \(1307 characters\)
- sed "s/^X//" >'install.sh' <<'END_OF_FILE'
- X: 'sh or ksh'
- X#
- X# '@(#)installit 2.4 10/15/87'
- X# From install.sh 4.8 (Berkeley) 3/6/86
- X# on the 4.3 BSD distribution (with permission)
- X#
- XPATH=/bin:/etc:/usr/bin:/usr/ucb
- Xexport PATH
- Xcmd=""
- Xstripbefore=""
- Xstripafter=""
- Xchmod="chmod 755"
- Xchown="#"
- Xchgrp="#"
- Xwhile true ; do
- X case $1 in
- X -s ) if test $cmd
- X then stripafter="strip"
- X else stripbefore="strip"
- X fi
- X shift
- X ;;
- X -c ) if test $cmd
- X then echo "install: multiple specifications of -c"
- X exit 1
- X fi
- X cmd="cp"
- X stripafter=$stripbefore
- X stripbefore=""
- X shift
- X ;;
- X -m ) chmod="chmod $2"
- X shift
- X shift
- X ;;
- X -o ) chown="chown $2"
- X shift
- X shift
- X ;;
- X -g ) chgrp="chgrp $2"
- X shift
- X shift
- X ;;
- X * ) break
- X ;;
- X esac
- Xdone
- Xif test $cmd
- Xthen true
- Xelse cmd="mv"
- Xfi
- X
- Xif test ! ${2-""}
- Xthen echo "install: no destination specified"
- X exit 1
- Xfi
- Xif test ${3-""}
- Xthen echo "install: too many files specified -> $*"
- X exit 1
- Xfi
- Xif test $1 = $2 -o $2 = .
- Xthen echo "install: can't move $1 onto itself"
- X exit 1
- Xfi
- Xif test '!' -f $1
- Xthen echo "install: can't open $1"
- X exit 1
- Xfi
- Xif test -d $2
- Xthen file=$2/`basename $1`
- Xelse file=$2
- Xfi
- X/bin/rm -f $file
- Xif test $stripbefore
- Xthen $stripbefore $1
- Xfi
- Xeval $cmd $1 $file
- Xif test $stripafter
- Xthen $stripafter $file
- Xfi
- Xeval $chown $file
- Xeval $chgrp $file
- Xeval $chmod $file
- END_OF_FILE
- if test 1307 -ne `wc -c <'install.sh'`; then
- echo shar: \"'install.sh'\" unpacked with wrong size!
- fi
- chmod +x 'install.sh'
- # end of 'install.sh'
- fi
- if test -f 'null.sh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'null.sh'\"
- else
- echo shar: Extracting \"'null.sh'\" \(51 characters\)
- sed "s/^X//" >'null.sh' <<'END_OF_FILE'
- X: 'sh or ksh'
- Xfor i
- Xdo
- X cat /dev/null > $i
- Xdone
- END_OF_FILE
- if test 51 -ne `wc -c <'null.sh'`; then
- echo shar: \"'null.sh'\" unpacked with wrong size!
- fi
- chmod +x 'null.sh'
- # end of 'null.sh'
- fi
- if test -f 'tolower.sh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tolower.sh'\"
- else
- echo shar: Extracting \"'tolower.sh'\" \(167 characters\)
- sed "s/^X//" >'tolower.sh' <<'END_OF_FILE'
- X#! /bin/ksh
- Xtypeset -l lower
- Xfor file
- Xdo
- X lower=$file
- X if test "${lower}" != "${file}"
- X then
- X echo "Renaming $file to $lower"
- X mv $file $lower
- X fi
- Xdone
- Xexit 0
- END_OF_FILE
- if test 167 -ne `wc -c <'tolower.sh'`; then
- echo shar: \"'tolower.sh'\" unpacked with wrong size!
- fi
- chmod +x 'tolower.sh'
- # end of 'tolower.sh'
- fi
- if test -f 'toupper.sh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'toupper.sh'\"
- else
- echo shar: Extracting \"'toupper.sh'\" \(167 characters\)
- sed "s/^X//" >'toupper.sh' <<'END_OF_FILE'
- X#! /bin/ksh
- Xtypeset -u upper
- Xfor file
- Xdo
- X upper=$file
- X if test "${upper}" != "${file}"
- X then
- X echo "Renaming $file to $upper"
- X mv $file $upper
- X fi
- Xdone
- Xexit 0
- END_OF_FILE
- if test 167 -ne `wc -c <'toupper.sh'`; then
- echo shar: \"'toupper.sh'\" unpacked with wrong size!
- fi
- chmod +x 'toupper.sh'
- # end of 'toupper.sh'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- David H. Brierley
- Home: dave@galaxia.network23.com; Work: dhb@quahog.ssd.ray.com
- Send comp.sources.3b1 submissions to comp-sources-3b1@galaxia.network23.com
- %% Can I be excused, my brain is full. **
-