[alt.sources] sharmail

bleckmd@jacobs.cs.orst.edu (David "The SPACE PIG" Bleckmann) (07/13/89)

Following  is a little thing I found use for as more and more people
began asking me for sources/binaries.

It uses the feature of "shar2" (available by ftp to uunet.uu.net) to
create shars not greater than xxK bytes, so mailers don't get upset.
"shar2" also handles binaries by uuencoding them, so you can send 
you favorite tar files to your friends.

Use as :

sharmail address file1 [file2 ...]

If you want to send to more than one person:

sharmail "address [address2 ...]" file1 [file2 ...]

BUGS:  It makes a new set of shars each time it is run, and deletes them
when done.  Thus, each time it is run, it reinvents the wheel using
your computing time.

Enjoy,
Dave

---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#	Packed Wed Jul 12 19:23:54 PDT 1989 by bleckmd
#	from directory /u1/bleckmd/empire
#
#	Run the following text with /bin/sh to create:
#	  sharmail
#
echo "x - extracting sharmail (Text)"
sed 's/^X//' << 'SHAR_EOF' > sharmail &&
X#!/bin/sh
Xcase $# in
X0) echo "Usage: $0 address file ..." 1>&2; exit 1
Xesac
X
Xmailto=$1; shift
Xsharargs="-v -s -M -D -c -l49 -o/tmp/shup$$.SH  $* "
X
Xecho 'Starting shar2...'
Xecho "shar2 $sharargs"
Xshar2 $sharargs
X
XNum=`ls /tmp/shup$$.SH?? | wc -w`
Xif test $Num = 0
Xthen
X    echo 'No files created'
X    exit 2
Xfi
X
Xfor i in /tmp/shup$$.SH?? 
Xdo
X    PART=`echo $i | awk -FH '{ print substr($0,length($0)-1) }'`
X    echo mail -s \"\'$*\' part $PART \" $mailto \< $i
X    mail -s "'$*' part $PART " $mailto < $i
X    rm $i
Xdone
Xexit 0
SHAR_EOF
chmod 0750 sharmail || echo "restore of sharmail fails"
set `wc -c sharmail`;Sum=$1
if test "$Sum" != "527"
then echo original size 527, current size $Sum;fi
exit 0