Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!nike!ucbcad!ucbvax!decvax!mcnc!ecsvax!alford From: alford@ecsvax.UUCP (Ross Alford) Newsgroups: net.micro.cpm Subject: uuencode source, com, and discussion Message-ID: <1811@ecsvax.UUCP> Date: Mon, 14-Jul-86 21:01:42 EDT Article-I.D.: ecsvax.1811 Posted: Mon Jul 14 21:01:42 1986 Date-Received: Wed, 16-Jul-86 03:26:20 EDT Distribution: net Organization: Duke University Zoology Lines: 556 I apologize for the delay. This message and the one that follows contain the Turbo Pascal source and uuencoded binaries for uuencode and uudecode to run under CP/M 2.2 (and probably 3.0). I know that posting software to net.micro.cpm is not very usual, but I received a number of requests for the source and/or binaries, and rather than try to send to individuals, I decided to post. Re my suggestion that CP/Mers exchange software via the net: I have a couple of responses to mail and news followups. First, what I would suggest is that software exchange take one of two forms--either posting articles containing only source and documentation, which would best be applied to programs written for ASM and maybe Turbo, both of which are almost universally accessible (or MBASIC, I suppose); or for software written in less universal languages, posting files with a short header describing the contents, followed by a uuencoded library file containing source, documentation, and object code. I've noticed lately that most newer software on RCPM systems is packaged this way, and it does seem sensible. If the .LBR file is squeezed before uuencoding, on average the uuencoded version will be no larger than the unsqueezed original. We might want to establish either a net.micro.cpm.sources or something similar if there was a lot of traffic, but perhaps at first could just use net.micro.cpm, since the volume is now low anyway. I do agree that source should always be included when it is available (and perhaps not too huge. 240k .ASM files would probably be stretching things). To start things off, then, in response to popular request, here follow uuencode.pas and uuencode.uue (the encoded binary, which can be decoded with UN*X uudecode before downloading to your system). The files are separated by ---------------CUT HERE-----------lines, since I've never figured out how to package shar files. Ross Alford ...mcnc!ecsvax!alford ----------------------CUT HERE----------for uuencode.pas--------- Program uuencode; CONST header = 'begin'; trailer = 'end'; defaultMode = '644'; defaultExtension = '.uue'; offset = 32; charsPerLine = 60; bytesPerHunk = 3; sixBitMask = $3F; endofinfile : boolean = FALSE; TYPE string80 = string[80]; VAR inf : file; outfile: text; infilename, outfilename, mode: string80; lineLength, numbytes, bytesInLine: integer; line: array [0..59] of char; hunk: array [0..2] of byte; chars: array [0..3] of byte; { procedure debug; var i: integer; procedure writebin(x: byte); var i: integer; begin for i := 1 to 8 do begin write ((x and $80) shr 7); x := x shl 1 end; write (' ') end; begin for i := 0 to 2 do writebin(hunk[i]); writeln; for i := 0 to 3 do writebin(chars[i]); writeln; for i := 0 to 3 do writebin(chars[i] and sixBitMask); writeln end; } {Binary file read added by Ross Alford, ...!mcnc!ecsvax!alford. The original MSDOS versions of uuencode/decode just use read/write on a FILE OF BYTE. CP/M Turbo expects some file info to be stored in the first 4 bytes of files of any type other than TEXT. Getbyte (below) and Putbyte (in UUDECODE) bypass this 'feature' by using blockread and blockwrite. The only global variables either use are 'infilename' and 'inf' or 'outfilename' and 'outf'} function getbyte(var b : byte) : boolean; type bufptr = ^bufrec; bufrec = record next : bufptr; buffer : array[1..128] of byte end; const sectstobuf = 8; {max number of sectors to buffer} sectsread : integer = 0; {constants are essentially statics} bytptr : integer = 129; notopen : boolean = TRUE; j : integer = 0; infsize : integer = 0; listsave : integer = 0; var list,temp,temp2 : bufptr; begin if notopen then begin notopen := FALSE; assign(inf,infilename); {$i-} reset(inf); {$i+} if ioresult <> 0 then begin writeln('File ',infilename,' not found. Aborting'); halt end; infsize := filesize(inf); new(list); list^.next := NIL; listsave := ord(list); sectsread := 0 end; list := ptr(listsave); if bytptr > 128 then begin if list^.next <> NIL then begin temp := list^.next; dispose(list); list := temp; bytptr := 1 end else begin dispose(list); list := NIL; j := 0; while (sectsread NIL then begin b := list^.buffer[bytptr]; bytptr := succ(bytptr); getbyte := TRUE end else begin b := 0; getbyte := FALSE end end; procedure Abort (message: string80); begin {abort} writeln(message); close(inf); close(outfile); halt end; {abort} procedure Init; procedure GetFiles; VAR i: integer; temp: string80; ch: char; begin {GetFiles} if ParamCount < 1 then abort ('No input file specified.'); infilename := ParamStr(1); {$I-} assign (inf, infilename); reset (inf); {$i+} if IOResult > 0 then abort (concat ('Can''t open file ', infilename)); write('Uuencoding file ', infilename); i := pos('.', infilename); if i = 0 then outfilename := infilename else outfilename := copy (infilename, 1, pred(i)); mode := defaultMode; if ParamCount > 1 then for i := 2 to ParamCount do begin temp := Paramstr(i); if temp[1] in ['0'..'9'] then mode := temp else outfilename := temp end; if pos ('.', outfilename) = 0 then outfilename := concat(outfilename, defaultExtension); assign (outfile, outfilename); writeln (' to file ', outfilename, '.'); {$i-} reset(outfile); {$i+} if IOresult = 0 then begin Write ('Overwrite current ', outfilename, '? [Y/N] '); repeat read (kbd, ch); ch := Upcase(ch) until ch in ['Y', 'N']; writeln (ch); if ch = 'N' then abort(concat (outfilename, ' not overwritten.')) end; close(outfile); {$i-} rewrite(outfile); {$i+} if ioresult > 0 then abort(concat('Can''t open ', outfilename)); end; {getfiles} begin {Init} GetFiles; bytesInLine := 0; lineLength := 0; numbytes := 0; writeln (outfile, header, ' ', mode, ' ', infilename); end; {init} procedure FlushLine; VAR i: integer; procedure writeout(ch: char); begin {writeout} if ch = ' ' then write(outfile, '`') else write(outfile, ch) end; {writeout} begin {FlushLine} write ('.'); writeout(chr(bytesInLine + offset)); for i := 0 to pred(lineLength) do writeout(line[i]); writeln (outfile); lineLength := 0; bytesInLine := 0 end; {FlushLine} procedure FlushHunk; VAR i: integer; begin {FlushHunk} if lineLength = charsPerLine then FlushLine; chars[0] := hunk[0] shr 2; chars[1] := (hunk[0] shl 4) + (hunk[1] shr 4); chars[2] := (hunk[1] shl 2) + (hunk[2] shr 6); chars[3] := hunk[2] and sixBitMask; {debug;} for i := 0 to 3 do begin line[lineLength] := chr((chars[i] and sixBitMask) + offset); {write(line[linelength]:2);} lineLength := succ(lineLength) end; {writeln;} bytesInLine := bytesInLine + numbytes; numbytes := 0 end; {FlushHunk} procedure encode1; begin {encode1}; if numbytes = bytesperhunk then flushhunk; endofinfile := not (getbyte(hunk[numbytes])); numbytes := succ(numbytes) end; {encode1} procedure terminate; begin {terminate} if numbytes > 0 then flushhunk; if lineLength > 0 then begin flushLine; flushLine; end else flushline; writeln (outfile, trailer); close (outfile); close (inf); end; {terminate} begin {uuencode} init; while not endofinfile do encode1; terminate end. {uuencode} ----------------------CUT HERE----------for uuencode.uue---------- begin 644 UUENCODE.COM MP^(@S:M#;W!Y5^S>@!X?$]R!CS MS0`"#0H`R6_ES:8`R?Z`W&L"U(0"YG\8[N4A[@$8!.4AZ`$B$P+AX_7%U7XC MMR@'Y$8]-'!\>/)?;3(.B0!AX>'X^/CX\4!T@3!/2#T*QCHS=`!V"K. M`1C?]<75Y2&H`4AO`$8VO7%U>7E$?``(8L!`1``[;#1.IX!3SJ<`8+5S=P"T3J? M`4\ZG0&#S=P"(?``S=`!*J`!S1T"X='!\4ZW0"W*!K5Q$#_@/*U"#!T2H!`!GI(M(`>#+=`'FW*`L^PS(X`"'[ M'R(Y`"&E`Q&@``$8`.VP(;T#$;@``0P`[;"O;V7=Y?WE M]6\F`.7-I@#Q_>'=X>'1P7=Y?WES:,`?1CK#O\8#`X`[5O2`!,:_B`H M^B%E``8#S7L$&LVF!/Y!.!+^43`.1Q,:_CH@!GC60!,8`ANO(5P`=R,,#2@9 M&LV"!"`3_C\H#_XJ*`O^+B@'!@O-=P08$`8(S5X$&OXN(`83!@/-7@0A:``& M`(Q#[R1H,#2@(_C\H"?XJ*`O-@@0H"W')O\D@+BP[.CT_*EM=/#Y[??YAV/Y[T-8@R7S- MM`1]]1\?'Q_-O03QY@_&D"?.0"?#R0.O-\M\P'RW?<@^_\DRV`#%S:\>P2H& M`+?M0MJH(.O1^0$`_`DBQ@"O;V("+:`.LBS`#IY2K& M`+?M0B+&`.U;Q`"W[5(9Z^':=1WML,DJQ@#ML"+&`-G)7B-6(]5>(U8C3B-& MXL:3P8`+V\F_SGYZP/ML-WIT1I/!@`O;R;_.?GK`^VPZ=WAZR'@_SGY MZ\4$!2@%KQ(3$/SML,$^()"1*`9'KQ(3$/S=Z=WA(>#_.?D&(*]W(Q#\W>G= MX47-N@6V=]W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