Update to C shar (shell archiver)

sources-request at genrad.UUCP sources-request at genrad.UUCP
Tue Jul 16 00:20:09 AEST 1985


Mod.sources:  Volume 2, Issue 13
Submitted by: harvard!seismo!mcvax!datlog!mark (Mark Smith)

[ moderators note:  I have edited both the introduction, and deleted most
  of the files from the submitted shell archive - nearly all the files were
  the same as the original distribution.  All that had changed was the
  Makefile and the man page.  Contact me if you need a copy of the original
  C shar distribution.
  
  John P. Nelson (decvax!genrad!john) [moderator, mod.sources]
]

	My firm runs UNIX System V release 2 version 1 on a VAX 11/750. 
	The shar that was acquired when we joined the net is ok but makes 
	a real mess when source files have to be taken from more than one
	directory and no manual page was provided.

		I decided to use the version of shar that I found on
	mod.sources but unfortunately using the getopt.c supplied with
	the package caused an undefined symbol at load time which
	prevented shar being built.  As SVr2 comes with getopt.o as
	part of /lib/libc.a and the parameter list is compatible I built
	my shar with the SVr2 getopt.o and it seems to work fine.

		Below is a shell archive of the files I used to build the 
	new version of shar. [Actually, only the files that have been
	modified from the original are in the archive below - mod.]  The
	Makefile is greatly improved and will now install the binaries and
	the manual pages and clean up the mess afterwards.  I have also
	modified the manual pages because as they stood man(1) on my
	system was producing sentences with words missed out.


			All the best,
				Mark Smith


UUCP: ...!mcvax!ukc!stc!datlog!mark

--------------------------- cut here -----------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Makefile
#	shar.1
# This archive created: Mon Jul 15 09:55:53 1985
export PATH; PATH=/bin:$PATH
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X
X# make this getopt.o if on a BSD or other non system V
XGETOPT=
X
XCFLAGS=-O
X
Xall:	traverse shar
X
Xshar:	shar.o traverse.o $(GETOPT)
X	$(CC) -o shar shar.o traverse.o $(GETOPT)
X
Xtraverse:
X	$(CC) $(CFLAGS) -o traverse -DSTANDALONE traverse.c
X
Xinstall:	all
X	/etc/install -f /usr/bin shar
X	/etc/install -f /usr/bin traverse
X	strip /usr/bin/shar /usr/bin/traverse
X	cp shar.1 /usr/man/u_man/man1/shar.1
X	cp traverse.3 /usr/man/p_man/man3/traverse.3
X
Xclean:
X	rm -f shar traverse *.o
X
Xshar.shar: Makefile shar.c traverse.c shar.1 traverse.3
X	shar -a -d EOF_SHAR Makefile shar.c traverse.c shar.1 traverse.3 > shar.shar
SHAR_EOF
fi # end of overwriting check
if test -f 'shar.1'
then
	echo shar: will not over-write existing file "'shar.1'"
else
sed 's/^X//' << \SHAR_EOF > 'shar.1'
X
X.TH SHAR 1net "June 3, 1985" "UNIX User's Manual" "Wang Institute"
X.SH NAME
Xshar \- create file storage archive for extraction by /bin/sh
X.SH SYNOPSIS
X.B shar
X[-abcsv] [-d delim] [-p prefix] files
X.SH DESCRIPTION
X.I shar
Xprints its input files with special command lines around them
Xto be used by the shell,
X.I /bin/sh ,
Xto extract them later.
XThe output can be filtered through the shell to
Xrecreate copies of the original files.
X.PP
X.I shar
Xallows directories to be named, and
X.I shar
Xprints the necessary commands
X.ul
X(mkdir & cd)
Xto create new directories and fill them.
X.I shar
Xwill emit commands to make executable plain files executable.
X.I shar will not allow existing files to be
X.I over-written;
Xsuch files must be removed by the file extractor.
X.SH OPTIONS
X.de OP
X.TP
X.B -\\$1
X..
X.OP a
XAll the options.
XThe options:
X.B "-v -c -b -p <tab>X"
Xare implied.
X.OP s
XSilent running.
XAll checking and extra output is inhibited.
X.OP v
XPrint verbose feedback messages about what
X.I shar
Xis doing to be printed during extraction.
XSizes of plain files are echoed to allow a simple validity check.
X.OP c
XCheck file size on extraction by counting characters.
XAn error message is reported to the person doing the
Xextraction if the sizes don't match.
XOne reason why the sizes may not match is that
X.I shar
Xwill append a newline to complete incomplete last lines;
X.I shar
Xprints a message that mentions added newlines.
XAnother reason why the sizes may not match is that some
Xnetwork mail programs remove non-whitespace control characters.
X.I shar
Xprints a message that mentions control characters to the extractor.
X.OP b
XExtract files into basenames so that files with absolute path names
Xare put into the current directory.
XThis option has strange effects when directories are archived.
X.OP d delim
XUse this as the ``end of file'' delimiter instead of the default.
XThe only reason to change it is if you suspect a file
Xcontains the default delimiter:
X.B SHAR_EOF.
X.OP p prefix
XUse this as the prefix to each line of the archived files.
XThis is to make sure that special characters at the start of lines are not
Xeaten up by programs like mailers.
XIf this option is used,
Xthe files will be extracted with the stream editor
X.B sed
Xrather than
X.B cat
Xso it is more efficient and portable to avoid setting the prefix,
Xthough perhaps less safe if you don't know what is in the files.
X.SH "SEE ALSO
Xtar(1), cpio(1), tp(1), sh(1)
X.SH AUTHOR
XGary Perlman
X(based on a shell version by James Gosling,
Xwith additions motivated by
XDerek Zahn,
XMichael Thompson,
XH. Morrow Long,
XFred Avolio,
XGran Uddeborg,
X&
XChuck Wegrzyn)
X.SH LIMITATIONS
X.I shar
Xdoes not know anything about
Xlinks between files
Xor binary files.
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0



More information about the Mod.sources mailing list