david@ukma.UUCP (David Herron, NPR Lover) (12/19/84)
#! /bin/sh # ------------------------>Cut Here<-------------------------- # This is a shell archive. To extract the files, save the # following text to a seperate file and type "sh filename" # # DO NOT RUN CSH ON THIS! # echo x - README ' ' '-rw-r--r-- 1 david 1327 Dec 18 16:47 README' sed 's/^X//' > README <<'EOF-OF-THIS-FILE' XThis is Yet Another Shar Program (YASP). X XThis is better than the last posted shar program because: X X 1: I provide a manual page. X 2: I provide versions of the program which work with X both csh and sh. X 3: There is more feedback about whether the created X archive is good. And when the user extracts the X files as well. (An "ls -l" of each file is encoded X specially in the archive. When the archive is X extracted the original "ls -l" is displayed, along X with the new one.) X 4: There is better control over the files included X in the archive. X XSo, Win Friends and Influence Enemies. Use YASP today! X X (This has been a public service announcement of X The Committee to Stamp out People who Want to Stamp out Basic, X and your local Better Business Bureau). X X X----------------------------------------- XDavid Herron; ARPA-> "ukma!david"@ANL-MCS X(Try the arpa address w/ and w/o the quotes, I have had much trouble with both.) XUUCP-> unmvax -----------\ XUUCP-> research ----------\_______ {anlams,anl-mcs} --\ XUUCP-> boulder -----------/ >-!ukma!david XUUCP-> decvax!ucbvax ----/ cbosgd!hasmed!qusavx --/ X(The usual warning about having no opinions). "I read banned books." X XLets see how long it takes for the NSA boys to start chasing me: X X "The NSA is the CIA is the FBI is the KGB". EOF-OF-THIS-FILE echo -n ' ' ; ls -l README echo x - shar.1 ' ' '-rw-r--r-- 1 david 1873 Dec 18 16:39 shar.1' sed 's/^X//' > shar.1 <<'EOF-OF-THIS-FILE' X.TH SHAR 1 X.SH NAME Xshar \- create shar archives for dispersal on the net. X.SH SYNOPSIS X\fBshar\fP archive [\|file1 file2 ...] X.SH DESCRIPTION X.I Shar Xis like X.I ar Xor X.I tar Xin that it creates a Xfile containing other files. X.I Shar Xis different in that the created file is a shell script Xwhich, when run, recreates its' member files. XThe file created by X.I shar Xis an ASCII file suitable for sending Xthrough a mail program (i.e. the usenet programs). XThe normal case is to name files on the command line. XIf no files are named on the command line, then the archive Xonly contains one file whose contents are taken from the standard input. X.PP XWhile creating the archive, shar prints information about the member files. XThis consists of lines like: X.nf X Xc - flpf.c -rw-r--r-- 1 root 6939 Dec 6 19:54 flpf.c Xc - lpd.c.diff -rw-r--r-- 1 root 1512 Dec 6 19:51 lpd.c.diff Xc - lpf.c.diff -rw-r--r-- 1 root 25158 Dec 6 19:52 lpf.c.diff Xc - lpr.c.diff -rw-r--r-- 1 root 19930 Dec 6 19:49 lpr.c.diff Xc - nrpf.c -rw-r--r-- 1 root 11939 Dec 6 19:54 nrpf.c Xc - scanargs.c -rw-r--r-- 1 root 5107 Dec 6 19:55 scanargs.c Xc - stringop.c -rw-r--r-- 1 root 2855 Dec 6 19:54 stringop.c X X.fi XWhen the resulting archive is run, a similar display is created, but Xwith an added "ls -l" of the output files. X.SH SEE ALSO Xreadnews(1), Xpostnews(1). X.SH AUTHOR XDavid Herron X.br XUniversity of Kentucky X.br XDepartment of Computer Science X.br XPatterson Office Tower, Room 915 X.br XLexington, KY 40506 X.br X(ukma!david) X.SH BUGS X.I Shar Xshould handle binary files by encoding them (via uuencode) before Xincluding them into the archive. X.PP X.I Shar Xshould include checksum checking into the process. X.PP XDirectories are not created when the files are extracted if Xthe original files are spread out over a number of directories. EOF-OF-THIS-FILE echo -n ' ' ; ls -l shar.1 echo x - shar.csh ' ' '-rw-r--r-- 1 david 905 Dec 18 16:50 shar.csh' sed 's/^X//' > shar.csh <<'EOF-OF-THIS-FILE' X#! /bin/csh Xif ( ${#argv} == "0" ) then X echo "Shar: usage: shar archive files" X exit 1 Xendif Xset out=$argv[1] Xrm -f $out Xecho '#! /bin/sh' >>$out Xecho '#---------------------------->Cut Here<---------------------------' >>$out Xecho '# This is a shell archive. To extract the files, save the ' >>$out Xecho '# following text to a seperate file and type "sh filename" ' >>$out Xecho '#' >>$out Xecho '# DO NOT RUN CSH ON THIS! ' >>$out Xecho '#' >>$out Xif ( ${#argv} == "1" ) then X echo c - stdin X echo "echo x - stdin" >>$out X echo "sed 's/^X//' >file <<'EOF-OF-THIS-FILE' " >>$out X sed 's/^/X/' >>$out X echo "EOF-OF-THIS-FILE" >>$out Xelse Xforeach f ( ${argv[2-]} ) X set a="`ls -l $f`" X echo c - $f " " "$a" X echo "echo x - $f ' ' '$a'" >>$out X echo "sed 's/^X//' > $f <<'EOF-OF-THIS-FILE'" >>$out X sed 's/^/X/' <$f >>$out X echo "EOF-OF-THIS-FILE" >>$out X echo "echo -n ' ' ; ls -l $f" >>$out Xend Xendif EOF-OF-THIS-FILE echo -n ' ' ; ls -l shar.csh echo x - shar.sh ' ' '-rwxr-xr-x 1 david 883 Dec 18 16:51 shar.sh' sed 's/^X//' > shar.sh <<'EOF-OF-THIS-FILE' X#! /bin/sh Xset -k Xif test $# = "0" ; then X echo "Shar: usage: shar archive files" ; X exit 1 ; Xfi Xout=$1 Xrm -f $out Xecho '#! /bin/sh' >>$out Xecho '# ------------------------>Cut Here<--------------------------' >>$out Xecho '# This is a shell archive. To extract the files, save the ' >>$out Xecho '# following text to a seperate file and type "sh filename" ' >>$out Xecho '#' >>$out Xecho '# DO NOT RUN CSH ON THIS! ' >>$out Xecho '#' >>$out Xif test $# = "1" ; then X echo c - stdin ; X echo "echo x - stdin" >>$out ; X echo "sed 's/^X//' >file <<'EOF-OF-THIS-FILE' " >>$out ; X sed 's/^/X/' >>$out ; X echo "EOF-OF-THIS-FILE" >>$out ; Xelse Xshift ; Xfor f Xdo Xa=`ls -l $f` X echo c - $f " " "$a" X echo "echo x - $f ' ' '$a'" >>$out X echo "sed 's/^X//' > $f <<'EOF-OF-THIS-FILE'" >>$out X sed 's/^/X/' <$f >>$out X echo "EOF-OF-THIS-FILE" >>$out X echo "echo -n ' ' ; ls -l $f" >>$out Xdone Xfi EOF-OF-THIS-FILE echo -n ' ' ; ls -l shar.sh