Z4648252@SFAUSTIN.BITNET (Z4648252) (04/29/89)
The following file was received from John M. Logajan and was given
to me so that I and other St'ers out there could decode/encode their
files easily. It is a little slow as he indicated to me, but it was
tested by me on Desktop.INF and does indeed work.
Larry Rymal <Z4648252@SFAUSTIN.BITNET>
---------------------------------------------------------------------
I think you asked for a way to decode ascii encoded binaries.
Here is a version I wrote in GFA Basic. It is slow, but it seems to
work. I also included a copy of a program that encodes, in case you
want to do the opposite operation.
- John M. Logajan @ Network Systems; 7600 Boone Ave; Brooklyn Park, MN 55428 -
- logajan@ns.network.com / ...rutgers!umn-cs!ns!logajan / john@logajan.mn.org -
* uudecode in gfa basic
Line Input "Name of file to decode";F$
Line Input "Name of file to receive decoded data";D$
Open "I",#1,F$
Open "O",#2,D$
Fl%=Lof(#1)
Dim A%(Fl%/4+1),B%(100/4)
Ap%=Varptr(A%(0))
Flt%=Fl%+Ap%
Bp%=Varptr(B%(0))
Bget #1,Ap%,Fl%
App%=Ap%
N$=""
Repeat
While Peek(App%)<>Asc("b")
Inc App%
Wend
N$=""
For N%=0 To 4
N$=N$+Chr$(Peek(App%+N%))
Next N%
Inc App%
Until N$="begin"
Do
While Peek(App%)<>&HD And Peek(App%)<>&HA
Inc App%
Exit If App%>Flt%
Wend
While Peek(App%)=&HD Or Peek(App%)=&HA
Inc App%
Wend
Exit If Peek(App%)=Asc("e")
Exit If App%>Flt%
Bl%=Peek(App%)-32
Exit If Bl%<=0
Inc App%
For J%=0 To Bl%-1 Step 3
Poke Bp%+J%,(Peek(App%)-32)*4 Or (Peek(App%+1)-32)/16
Poke Bp%+J%+1,(Peek(App%+1)-32)*16 Or (Peek(App%+2)-32)/4
Poke Bp%+J%+2,(Peek(App%+2)-32)*64 Or (Peek(App%+3)-32)
App%=App%+4
Next J%
Bput #2,Bp%,Bl%
Loop
End
* uuencode in gfa basic
Line Input "Name of file to encode";A$
Line Input "Name to put in header";C$
Line Input "Name of file to receive encoded file";B$
Open "I",#1,A$
Open "O",#2,B$
Fl%=Lof(#1)
Dim B%(Fl%/4+1),A%(70/4)
Bp%=Varptr(B%(0))
Ap%=Varptr(A%(0))
Bget #1,Bp%,Fl%
Print #2,"begin 644 ";C$
Bc%=0
While Bc%<Fl%
Rm%=Fl%-Bc%
If Rm%>=45
Poke Ap%,45+32
Al%=60
Else
Poke Ap%,Rm%+32
Al%=Int((Rm%+2)*4/3)
Endif
For J%=1 To Al% Step 4
Poke Ap%+J%,Peek(Bp%+Bc%)/4+32
Poke Ap%+J%+1,(((Peek(Bp%+Bc%)*16) Or (Peek(Bp%+Bc%+1)/16)) And &H3F)+32
Poke Ap%+J%+2,(((Peek(Bp%+Bc%+1)*4) Or (Peek(Bp%+Bc%+2)/64)) And &H3F)+32
Poke Ap%+J%+3,(Peek(Bp%+Bc%+2) And &H3F)+32
Bc%=Bc%+3
Next J%
Poke Ap%+Al%+1,&HD
Poke Ap%+Al%+2,&HA
Bput #2,Ap%,Al%+3
Wend
Print #2
Print #2,"end"
End