[comp.sys.amiga] Want UUDecode Bootstrap Was: Re: Help for downloading

etxtomp@eos.ericsson.se (Tommy Petersson) (12/25/90)

In article <39943@nigel.ee.udel.edu> PBEAUJEANT%BNANDP51.BITNET@cunyvm.cuny.edu writes:
-Could you help to know how and where I can download softwares.
-I'm working on VMS cluster and access the network from EARN via bitnet.
-This help could be very interesting for me to promote the amiga in my University
-   .
-Thanks to you.
-Pascal Beaujeant. FNDP. Belgium.

The very first things You normally need are: a machine with the programs,
a way to get them to You, and programs to receive them :-)

I can get files using a BITFTP server. I send mail with commands to this
server, it contacts the specified machine and ftp's the files and then forwards
them to me in email (uuencoded). PROBLEM: I have lost my UUDECODE! Can someone
email me the simple BASIC uudecode and the compiled (uuencoded) program!

Thanks in advance,
Tommy Petersson
etxtomp@eos.ericsson.se

bscott@isis.cs.du.edu (Ben Scott) (12/29/90)

In article <1990Dec25.131730.29534@ericsson.se> etxtomp@eos.ericsson.se writes:
>them to me in email (uuencoded). PROBLEM: I have lost my UUDECODE! Can someone
>email me the simple BASIC uudecode and the compiled (uuencoded) program!

Posted below, because it could be helpful for a lot of people, is the source
for a very simple version of uudecode in both AmigaBASIC and C.  I've tested
the C version on a Unix machine (it's so simple it ought to compile almost
anywhere), but haven't actually tested the BASIC one yet.  It should work...

------------------------ uudecode.bas ---------------------------------

'This Amiga Basic program uudecodes files.
'It may not be fast, but it works!
'I have an analogous uuencode program if anyone wants it.
'    Michael Creutz
'    creutz@bnlux0.bnl.gov
'
WINDOW 1,,(20,20)-(400,150)
DEFINT a-z
INPUT "File to decode:",f1$
INPUT "Decoded file name:",f2$
OPEN f1$ FOR INPUT AS #1
OPEN f2$ FOR OUTPUT AS #2
length!=LOF(1)
leftlength!=length!
PRINT "Looking for 'begin.'"
findbegin:
  IF EOF(1) THEN PRINT "begin not found":CLOSE:END
  LINE INPUT #1, a$:leftlength!=leftlength!-LEN(a$)-1
  IF LEFT$(a$,6)<>"begin " THEN GOTO findbegin
  PRINT
  PRINT "'begin' found"
  PRINT "decoding ";f1$;" to file ";f2$
newline:
  LOCATE 10,10
  partdone=100*(1!-leftlength!/length!)
  PRINT partdone;"% finished"
inline:  LINE INPUT #1,a$ :leftlength!=leftlength!-LEN(a$)-1
  IF a$="" THEN GOTO inline
  IF a$="end" THEN GOTO done
  count=(ASC(LEFT$(a$,1))-32) AND 63
  IF count=0 THEN GOTO done
  pointer=2
  out$=""
loop:
  a1=(ASC(MID$(a$,pointer  ,1))-32) AND 63
  a2=(ASC(MID$(a$,pointer+1,1))-32) AND 63
  a3=(ASC(MID$(a$,pointer+2,1))-32) AND 63
  a4=(ASC(MID$(a$,pointer+3,1))-32) AND 63
pointer=pointer+4
count=count-3
  out$=out$+CHR$((a1* 4+a2\16) AND 255)
  out$=out$+CHR$((a2*16+a3\ 4) AND 255)
  out$=out$+CHR$((a3*64+a4   ) AND 255)
IF count>0 THEN GOTO loop
  PRINT #2, out$;
IF NOT EOF(1) THEN GOTO newline
  PRINT "end not found"
done:
  PRINT "all done"
  CLOSE
---------------------------------------------------------------

And now:

----------------------  uudecode.c ----------------------------

#include <stdio.h>
#define DEC(c)  (((c) - ' ') & 077)
main()
{
        int n;
        char dest[128], a,b,c,d;

        scanf("begin %o ", &n);
        gets(dest);

        if (freopen(dest, "w", stdout) == NULL) {
                perror(dest);
                exit(1);
        }

        while ((n=getchar()) != EOF && (n=DEC(n))!=0)  {
                while (n>0) {
                        a = DEC(getchar());
                        b = DEC(getchar());
                        c = DEC(getchar());
                        d = DEC(getchar());
                        if (n-- > 0) putchar(a << 2 | b >> 4);
                        if (n-- > 0) putchar(b << 4 | c >> 2);
                        if (n-- > 0) putchar(c << 6 | d);
                }
                n=getchar();
        }
        exit(0);
}
-----------------------------------------------------------

Hope this helps some people.

.                            <<<<Infinite K>>>>

-- 
|Ben Scott, professional goof-off and consultant at The Raster Image, Denver|
|FIDO point address 1:104/421.2, bscott@isis.cs.du.edu, or BBS (303)424-9831| 
|"Spent 4 hours burying the cat!"  "Four || The Raster Image IS responsible |
| hours?!?"  "It wouldn't keep still..." || for everything I say! | *Amiga* |