home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume12 / unboo.bas < prev    next >
Encoding:
BASIC Source File  |  1990-04-23  |  2.9 KB  |  91 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v12i013: unboo.bas - decode Kermit boo format
  3. from: nghiem@ut-emx.UUCP
  4. organization: UTexas Computation Center, Austin, Texas
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 12, Issue 13
  8. Submitted-by: nghiem@ut-emx.UUCP
  9. Archive-name: unboo.bas
  10.  
  11. [Forwarded from comp.binaries.ibm.pc; I'm not certain it belongs here, but then
  12. where else can it go?  ++bsa]
  13.  
  14. #! /bin/sh
  15. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  16. # Contents:  UNBOO.BAS
  17. echo extracting 'UNBOO.BAS'
  18. if test -f 'UNBOO.BAS' -a -z "$1"; then echo Not overwriting 'UNBOO.BAS'; else
  19. sed 's/^X//' << \EOF > 'UNBOO.BAS'
  20. X1    'Use this BASIC program on the PC if you have the printable file 
  21. X2    'MSVIBM.BOO already on the PC to convert it to an executable
  22. X3    'file.  This program takes about 30 minutes to run on a PC with
  23. X4    'floppy disks.
  24. X5    ' Bill Catchings, June 1984
  25. X6    ' Columbia University Center for Computing Activities, New York
  26. X
  27. X10   t$ = time$                ' Save the time.
  28. X20   defint a-z                ' Integer to gain some speed.
  29. X25   b$ = "MSVIBM.BOO"                  ' Name of input .BOO file.
  30. X30   n$ = chr$(0)
  31. X40   z = asc("0")
  32. X50   t = asc("~")-z
  33. X60   def fnuchr%(a$)=asc(a$)-z
  34. X70   open b$ for input as #1
  35. X
  36. X100  input#1,f$                ' Is this the right file?
  37. X110  if len(f$) > 20 then goto 900
  38. X120  open f$ for output as #2
  39. X130  print "Outputting to "+f$
  40. X
  41. X200  if eof(1) then goto 800        ' Exit nicely on end of file.
  42. X210  input#1,x$                ' Get a line.
  43. X220  y$ = ""                ' Clear the output buffer.
  44. X230  goto 400
  45. X
  46. X300  print#2,y$;            ' Print output buffer to file.
  47. X310  goto 200                ' Get another line.
  48. X
  49. X400  if len(x$) < 2 goto 300        ' Is the input buffer empty?
  50. X410  a = fnuchr%(x$)
  51. X420  if a = t then goto 700        ' Null repeat character?
  52. X430  if len(x$) < 3 goto 300        ' Is the input buffer empty?
  53. X440  q$=mid$(x$,2,3)            ' Get the quadruplet to decode.
  54. X450  x$=mid$(x$,5)
  55. X460  b = fnuchr%(q$)
  56. X470  q$ = mid$(q$,2)
  57. X480  c = fnuchr%(q$)
  58. X490  q$ = mid$(q$,2)
  59. X500  d = fnuchr%(q$)
  60. X
  61. X600  y$ = y$ + chr$(((a * 4) + (b \ 16)) and 255) ' Decode the quad.
  62. X610  y$ = y$ + chr$(((b * 16) + (c \ 4)) and 255)
  63. X620  y$ = y$ + chr$(((c * 64) + d) and 255)
  64. X630  goto 400                ' Get another quad.
  65. X
  66. X700  x$ = mid$(x$,2)            ' Expand the nulls.
  67. X710  r = fnuchr%(x$)            ' Get the number of nulls.
  68. X715 print " Null: ",r
  69. X720  x$ = mid$(x$,2)
  70. X730   for i=1 to r            ' Loop, adding nulls to string.
  71. X740   y$ = y$ + n$
  72. X750   next
  73. X760  print#2,y$;            ' Output the nulls to the file.
  74. X770  y$ = ""                ' Clear the output buffer.
  75. X780  goto 400
  76. X
  77. X800  print "Processing complete, elapsed time: "+t$+" to "+time$
  78. X810  print "Output in "+f$
  79. X820  close #1,#2
  80. X830  goto 9999
  81. X
  82. X900  print b$ " does not seem to be in .BOO format."
  83. X910  goto 820
  84. X
  85. X9999 end
  86. EOF
  87. chars=`wc -c < 'UNBOO.BAS'`
  88. if test $chars !=     2083; then echo 'UNBOO.BAS' is $chars characters, should be     2083 characters!; fi
  89. fi
  90. exit 0
  91.