home *** CD-ROM | disk | FTP | other *** search
- From decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery Wed Apr 25 08:12:16 PDT 1990
- Article 1493 of comp.sources.misc:
- Path: decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery
- From: nghiem@ut-emx.UUCP
- Newsgroups: comp.sources.misc
- Subject: v12i013: unboo.bas - decode Kermit boo format
- Message-ID: <85950@uunet.UU.NET>
- Date: 24 Apr 90 01:21:21 GMT
- Sender: allbery@uunet.UU.NET
- Organization: UTexas Computation Center, Austin, Texas
- Lines: 84
- Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 12, Issue 13
- Submitted-by: nghiem@ut-emx.UUCP
- Archive-name: unboo.bas
-
- [Forwarded from comp.binaries.ibm.pc; I'm not certain it belongs here, but then
- where else can it go? ++bsa]
-
- #! /bin/sh
- # This file was wrapped with "dummyshar". "sh" this file to extract.
- # Contents: UNBOO.BAS
- echo extracting 'UNBOO.BAS'
- if test -f 'UNBOO.BAS' -a -z "$1"; then echo Not overwriting 'UNBOO.BAS'; else
- sed 's/^X//' << \EOF > 'UNBOO.BAS'
- X1 'Use this BASIC program on the PC if you have the printable file
- X2 'MSVIBM.BOO already on the PC to convert it to an executable
- X3 'file. This program takes about 30 minutes to run on a PC with
- X4 'floppy disks.
- X5 ' Bill Catchings, June 1984
- X6 ' Columbia University Center for Computing Activities, New York
- X
- X10 t$ = time$ ' Save the time.
- X20 defint a-z ' Integer to gain some speed.
- X25 b$ = "MSVIBM.BOO" ' Name of input .BOO file.
- X30 n$ = chr$(0)
- X40 z = asc("0")
- X50 t = asc("~")-z
- X60 def fnuchr%(a$)=asc(a$)-z
- X70 open b$ for input as #1
- X
- X100 input#1,f$ ' Is this the right file?
- X110 if len(f$) > 20 then goto 900
- X120 open f$ for output as #2
- X130 print "Outputting to "+f$
- X
- X200 if eof(1) then goto 800 ' Exit nicely on end of file.
- X210 input#1,x$ ' Get a line.
- X220 y$ = "" ' Clear the output buffer.
- X230 goto 400
- X
- X300 print#2,y$; ' Print output buffer to file.
- X310 goto 200 ' Get another line.
- X
- X400 if len(x$) < 2 goto 300 ' Is the input buffer empty?
- X410 a = fnuchr%(x$)
- X420 if a = t then goto 700 ' Null repeat character?
- X430 if len(x$) < 3 goto 300 ' Is the input buffer empty?
- X440 q$=mid$(x$,2,3) ' Get the quadruplet to decode.
- X450 x$=mid$(x$,5)
- X460 b = fnuchr%(q$)
- X470 q$ = mid$(q$,2)
- X480 c = fnuchr%(q$)
- X490 q$ = mid$(q$,2)
- X500 d = fnuchr%(q$)
- X
- X600 y$ = y$ + chr$(((a * 4) + (b \ 16)) and 255) ' Decode the quad.
- X610 y$ = y$ + chr$(((b * 16) + (c \ 4)) and 255)
- X620 y$ = y$ + chr$(((c * 64) + d) and 255)
- X630 goto 400 ' Get another quad.
- X
- X700 x$ = mid$(x$,2) ' Expand the nulls.
- X710 r = fnuchr%(x$) ' Get the number of nulls.
- X715 print " Null: ",r
- X720 x$ = mid$(x$,2)
- X730 for i=1 to r ' Loop, adding nulls to string.
- X740 y$ = y$ + n$
- X750 next
- X760 print#2,y$; ' Output the nulls to the file.
- X770 y$ = "" ' Clear the output buffer.
- X780 goto 400
- X
- X800 print "Processing complete, elapsed time: "+t$+" to "+time$
- X810 print "Output in "+f$
- X820 close #1,#2
- X830 goto 9999
- X
- X900 print b$ " does not seem to be in .BOO format."
- X910 goto 820
- X
- X9999 end
- EOF
- chars=`wc -c < 'UNBOO.BAS'`
- if test $chars != 2083; then echo 'UNBOO.BAS' is $chars characters, should be 2083 characters!; fi
- fi
- exit 0
-
-
-