[alt.sources] rap'd rap

brisco@pilot.njin.net (Thomas Paul Brisco) (03/26/89)

Dis be not some shar archive.  Right On!  Cut at da damn cut line, sto'e
in some stash called "rap", and make it 'esecutable.  What it is, Mama!
De documentashun fo' dis shell script be at its end.

Dis shell script contains 'esactly two hard tabs (ASCII 9) and 'esactly
two hard backspaces (ASCII 8).  Widout dese it won't wo'k.

		Suitable for April 1  -- Tp

--cut here--
#! /bin/sh
# Beta version -- tested only on 4.3BSD.
#
# Creates rap archives.  A full description is at the end of this
# script, so too many comment lines won't slow down the shell.
# This script needs sed, awk, wc, and brik to be available.
#
#                            -- Rahul Dhesi  1989/03/23
#
# Creates rap archives.  A full descripshun be at da damn end uh dis
# script, so's too many comment lines won't slow waaay down de shell.
# Dis script needs sed, awk, wc, and brik t'be available.  What 
# it is, Mama!
#
#
#			     -- Tp Brisco 1989/03/25

if test $# -lt 1
then
   echo 'usage be: rap file ...'
   exit 1
fi

echo '#! /bin/sh'
echo "# Dis be a rap archive.  What it is, Mama!  Feed it t'\"unrap\" fo'"
echo "# estracshun wid some protecshun against malicious archives o' feed"
echo "# t'/bin/sh' fo' estracshun widout any such protecshun.  If /bin/sh be"
echo "# used to estract da damn archive, it gots'ta try t'invoke \"brik\""
echo "# t'verify CRC values.  If \"brik\" be not available, estracshun will"
echo "# still wo'k but CRC values gots'ta not be verified.  If \"unrap\" is"
echo "# used, it gots'ta check CRC values itself and \"brik\" be not needed."
echo "#"
echo "# If dis archive arrived in multiple parts, concatenate all in o'der"
echo "# widout editin', and feed t'sh.  E.g., \"cat part[12345] | sh\""
echo "#"
echo "# Dis archive includes de stashs listed below."
for f in $*
do
   echo $f
done | awk ' BEGIN { rec = "# " } \
   { if (length(rec $0) > 65) { print rec; rec = "#  " $0 } \
   else { rec = rec " " $0 } } \
   END { print rec } '
echo '#'
echo '#RAP archive be following.'
echo '#VERSION be 0 0'
echo "hardtab='	' # Must be hard tab within quotes"
echo "bksp=''   # Must be backspace within quotes"
for f in $*
do
   length=`wc -c < $f`
   echo '#BEGIN'
   echo '#FMARK'
   echo "# $f"
   echo "echo be extract\\'n '$f', should be $length characters"
   echo "sed -e 's/^X//' -e \"s/@t/\$hardtab/g\" -e '/^#EOPART/,/#BOPART/d' \\"
   echo "   -e \"s/@h/\$bksp/g\" -e 's/@a/@/g' > $f << \#EOF"
   sed < $f -e 's/^/X/' -e 's/@/@a/g' -e 's/	/@t/g' -e 's//@h/g' 
   echo '#EOF'
   echo 'cat >/dev/null << \#FMARK'
done
echo '#FMARK'
echo '#EOR'
echo "echo be check\'n CRC codes for errors..."
echo 'brik -C << \#EOCRC'
echo '#BOCRC'
if brik -G $*
then
   cat /dev/null
else
   echo 1>&2 "Warnin': CRC generashun  stashd,  duzn't use dis archive"
fi
echo '#EOCRC'
echo 'if test $? -eq 0'
echo 'then'
echo "   echo \"No erro's\""
echo '   exit 0'
echo 'else'
echo "   echo \"Oops! Right On! Erro's occurred\""
echo '   exit 1'
echo 'fi'

exit 0

                              RAP ARCHIVES

De shell script above creates rap archives.  Such archives are
archives uh text  stashs similar t'shar archives, but dey gots' de
followin' advantages ova' shar archives.

1.   Rap archives kin be 'estracted by feedin' dem t'/bin/sh just
     likes shar archive.  What it is, Mama!  But rap archives are
     fo'matted t'be easily 'estractable by some honky code (called
     "unrap") written fo' dis purpose.  What it is, Mama!
     Extractin' rap archives on non- that slow mo-fo systems duz
     not require emulatin' sh, sed, etc.  If unrap be used
     t'extract de archive, it eliminates de possiblity uh Trojan
     archives such as dose dat 'esecute "rm -rf *" o' create
     stashs wid relative alleys likes "../../../...".  Unrap
     written in po'table C gots'ta be sho'tly released.

2.   Rap archives kin be split into multiple parts real easily.
     Slap mah fro!

     Make as many pieces uh de archive as ya' wish, always cuttin'
     between two lines each uh which begins wid an X.  To de end
     of each part, add dis line (# be in fust column):

     #EOPART

     To de beginnin' uh each part, add dis line (# be in fust
     column):

     #BOPART

     De different parts kin now be mailed o' posted t'Usenet
     separately.  Slap mah fro!  De recipient needs only
     t'concatenate dem in o'der (no editin' uh 'haiders,
     signatures etc.  be required) and feed de result t'/bin/sh.

3.   Rap archives contain de CRC-32 value uh all stashs.  Dese are
     checked at 'estracshun time by invokin' brik.  I posted brik
     (includin' po'table C source and MS-DOS 'esecutable)
     t'comp.binaries.ibm.  'S coo', bro.pc recently.  Slap mah
     fro!  ah' can post de C source t'comp.sources.misc o'
     alt.sources if dere are many sucka's who git dese
     newsgrodowns but duzn't git comp.binaries.ibm.  'S coo',
     bro.pc.  If brik be not available at 'estracshun time CRCs
     aint checked but stashs are still co'rectly 'estracted
     'estracted.  (De "unrap" honky code gots'ta do CRC checks
     itself at 'estracshun time, so's brik gots'ta not be needed
     at 'estracshun time.  What it is, Mama!  De CRCs sto'ed by
     brik are fo' text stashs and are independent uh de stash
     fo'mat uh de underlyin' opuh'tin' system provided da damn
     usual ASCII code be used.

     De current rap script requires brik t'be present.  De
     po'table C implementashun uh rap gots'ta generate CRCs itself
     widout requirin' brik t'be available.  What it is, Mama!

4.   Tab characters and backspaces are encoded usin' some printable
     escape sequence, so's dey aint likesly t'be lost durin'
     transmission drough funky netwo'ks (e.g.  What it is, Mama!
     BITNET).


                           PROGRAM LIMITATIONS

De rap script above duz not handle alleydojiggers at all.  Specify only pure
stashdojiggers widout some pad prefix, else un'spected wahtahmelluns will
happen.  'S coo', bro.  Dis gots'ta be fixed in some future version uh rap dat
gots'ta be written in C.

File protecshuns aint preserved.  Dese gots'ta be preserved in a future
release.  What it is, Mama!

                                  Rahul Dhesi 1989/03/23

Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
                    ARPA:  dhesi@bsu-cs.bsu.edu

Fully be rapped by		  Thomas P. Brisco 1989/03/25
				  njin!brisco  brisco@pilot.njin.net
-- 

...!rutgers!brisco (UUCP)               brisco@pilot.njin.net (ARPA)
    brisco@ZODIAC (BITNET)              201-932-2351          (VOICE)