[net.micro.atari16] The last line of UUENCODEd files

moews@husc4.harvard.edu (david moews) (10/13/86)

In article <1346@lsuc.UUCP> jimomura@lsuc.UUCP (Jim Omura) writes:
>
>  ...I decoded it [UNITERM] last night and it didn't run.  The ending of the
>encode looks a bit funny to me.  The last line didn't start with
>an 'M' like the rest....

    The last (nonblank) line of UUENCODEd files doesn't have to start with an
'M'; the ASCII code of the first character in each line is 32 + the number of
bytes that the line will decode to (so 'M' = 45 bytes, after decoding).  Thus,
if the total number of bytes in the original file is not a multiple of 45,
the last nonblank line will be shorter than normal and will start with some
character other than an 'M'.  Here's an example:  I took the following 2 lines
(93 bytes)

This is a test file to demonstrate UUENCODE.
This is the second, and last, line of the file.

and UUENCODEd them; the result is

begin 644 file
M5&AI<R!I<R!A('1E<W0@9FEL92!T;R!D96UO;G-T<F%T92!5545.0T]$12X*
M5&AI<R!I<R!T:&4@<V5C;VYD+"!A;F0@;&%S="P@;&EN92!O9B!T:&4@9FEL
#92X*
 
end


.  The '#' in the last line indicates that after the 90 bytes contained in the
first two lines, there are 3 bytes left over.
--
David Moews     moews@husc4.harvard.edu    ...!seismo!harvard!husc4!moews