Path: utzoo!utgpu!watmath!clyde!att!rutgers!ucsd!orion.cf.uci.edu!paris.ics.uci.edu!bonnie.ics.uci.edu!posert From: posert@bonnie.ics.uci.edu (Bob Posert) Newsgroups: comp.binaries.ibm.pc.d Subject: A unix packing script (was Re: A unix unpacking script) Message-ID: <1034@paris.ics.uci.edu> Date: 2 Dec 88 19:59:00 GMT References: <371@oucsace.cs.OHIOU.EDU> Sender: news@paris.ics.uci.edu Reply-To: posert@bonnie.ics.uci.edu (Bob Posert) Organization: University of California, Irvine - Dept of ICS Lines: 68 In article <371@oucsace.cs.OHIOU.EDU> Jeff Norden writes: >Below is a shell script which unix users may find helpful for unpacking the >offerings from comp.binaries.ibm.pc The script depends upon the uuencoded >info being bracketed between "BEGIN--cut here" and "END--cut here" lines. This seems like the right time to post my program to create such files. I wrote it originally in the c-shell to send a bunch of files to a friend, and just converted it to the Bourne shell for posting - so please excuse the hacks. cut here------------------------------------- #! /bin/sh # Bourne shell script to encode and split .arc files for mailing # changes all files on command line into.uaa .uab ... # and creates a .hdr file with checksum and blockcount info # the checksum for the parts does *not* include the BEGIN/END lines. # # renames the original files to , # # Author: Bob Posert # Version 1.0 for the Bourne shell # #set ``size'' to be the desired size, in bytes, of the pieces. # # size=32768 beginline="BEGIN--cut here--cut here" endline="END--cut here--cut here" #charsLine is chars per line from uuencode charsLine=61 extratext=`echo $beginline$endline | wc -c` lines=`expr \( $size - $extratext \) / $charsLine` tmppath=/tmp/ #print message and exit if not invoked correctly if [ $# -eq 0 ] then echo "Usage:" $0 "file1 file2 ..."; exit; fi # for basefile in $* do echo Uuencoding and splitting $basefile uuencode $basefile $basefile | split - -$lines $basefile.u #make header file with checksum and block count header=$basefile$.hdr echo "Header file for $basefile" > $header echo " Checksum Blockcount" >> $header echo -n $basefile " " >> $header sum $basefile >> $header #add begin-end pairs to each part of uuencoded file #and add checksum of each part to header file for partfile in $basefile.u* do echo Adding begin/end to $partfile echo -n $partfile " " >> $header sum $partfile >> $header tmppart=$tmppath$partfile echo $beginline > $tmppart cat $partfile >> $tmppart echo $endline >> $tmppart mv $tmppart $partfile done mv $basefile ,$basefile done cut here------------------------------------- -- Bob Posert I'm: posert@bonnie.ics.uci.edu or {sdcsvax|ucbvax}!ucivax!bonnie!posert