mark@ems.UUCP (Mark H. Colburn) (10/24/86)
Since there has been some discussions in this news group about shar programs
I decided that I would post the shar that I wrote.
Taking the advice of the people in this group, I started out with K&P bundle.
I then looked at the shar files that I have seen on the net and modified the
script until it produced a shell archive file that looked about the same as
those that are posted to the net. It has features to check files for damage
in transit, has a table of contents, will not overwrite a file with the same
name as the file that is about to be extracted et cetera.
Please note that I am not claiming that this is the 'official' shar program.
I am just sharing one that I have that seems to provide similar features to
that of other shar programs that are used on the net.
Comments, suggestions, modifications and flames will be appreciated.
----------------------------- CUT HERE AND SAVE ----------------------------
:
#
# shar: Shell Archive creator
#
# Author: Mark H. Colburn
#
echo "#! /bin/sh"
echo "# This is a shell archive, meaning:"
echo "# 1. Remove everything above the #! /bin/sh line."
echo "# 2. Save the resulting test in a file"
echo "# 3. Execute the file with /bin/sh (not csh) to create the files:"
echo "#"
for file in $*
do
echo "#\t\t$file"
done
echo "#"
echo "# Created by $LOGNAME (`grep $LOGNAME /etc/passwd | cut -f5 -d:`) \c"
echo "on `date`"
echo "#"
for file in $*
do
echo "if test -f '$file'\nthen"
echo "\techo shar: will not over-write existing file \"'$file'\"\nelse"
echo "echo extracting \"'$file'\""
echo "sed 's/^X//' >$file <<'SHAR_EOF'"
awk '{ printf "X%s\n", $0 }' $file
echo "SHAR_EOF"
count=`wc -c $file | cut -c-7 | tr -d " "`
echo "if test $count -ne \"\`wc -c < '$file'\`\"\nthen"
echo "\techo shar: error transmitting \"'$file'\" '(should have been $count characters)'"
echo "fi\nfi"
done
echo "# end of shell archive"
echo "exit 0"
--
Mark H. Colburn UUCP: ihnp4!rosevax!ems!mark
EMS/McGraw-Hill ATT: (612) 829-8200
9855 West 78th Street
Eden Prairie, MN 55344