jhs@MITRE-BEDFORD.ARPA.UUCP (02/08/87)
Oops! I said OBUF$ and should have said IBUF$, of course... If you want to modify my uudecode so it terminates on "end" rather than on the line containing just a space, or in addition to it, then you should test with IF IBUF$(1,3)="end" THEN GOTO (wherever) instead of or in addtion to IF M=0 THEN GOTO ... The two tests could of course be combined, e.g. IF M=0 OR IBUF$(1,3)="end" THEN GOTO ... I used the simple test for M=0 because I thought it would be the fastest thing to do. -John Sangster / jhs@mitre-bedford.arpa
hans@umd5.UUCP (02/11/87)
In article <8702080547.AA21962@mitre-bedford.ARPA> jhs@MITRE-BEDFORD.ARPA writes: >If you want to modify my uudecode so it terminates on "end" rather than on >the line containing just a space, or in addition to it, then you should test >with > IF IBUF$(1,3)="end" THEN GOTO (wherever) >instead of or in addtion to > IF M=0 THEN GOTO ... >The two tests could of course be combined, e.g. > IF M=0 OR IBUF$(1,3)="end" THEN GOTO ... > >I used the simple test for M=0 because I thought it would be the fastest thing >to do. > >-John Sangster / jhs@mitre-bedford.arpa Please do not do this. As I posted before, it is the uuencode and not the uudecode which is broken. The line with the zero byte count (i.e. ' ' or '`' as first character) is necessary for uudecode. Since the uu in uuencode stands for 'unix to unix' we really should take the unix way of doing it as the standard. It seems only marginally useful to have uuencode/decode for the atari if they are not compatible with the commonly available programs of the same name. If I try to uudecode the uuencoded version of uuencode under unix it fails with the error message 'Short file' (or something similar). This can be alleviated quite simply by using your favorite editor to insert a line starting with blank or '`' before the 'end' line. Note that the blank has to be there, an empty line will not have the desired effect. At this point the file will decode correctly, although it will produce the error message 'Missing end line'. This is caused by the fact that the unix uudecode checks for end followed by new-line, and the file has end followed by three spaces followed by new-line. This seems a bit picky, but if the atari uuencode could be modified to produce this line exactly it would add to the compatibility. Again you can use your favorite editor to rectify the problem, and then the file will uudecode correctly and without error message. I did a bit of experimenting with uudecode and found the following behaviour: If end is encountered unexpectedly, the 'e' will be decoded to a byte count of 5, and the characters 'n', 'd', new-line, and some additional ones (whose origin I could not determine) are used for decoding. If there is more text, decoding will continue. Only a line with a count of zero will terminate decoding. I also noticed that the new-line character and assorted junk will be used if the trailing part of an image (including trailing blanks) is missing. I would like to commend Brad Banko for using trailing characters to avoid the problem of having trailing blanks truncated. Another alternative would be to generate '`' instead of blank. Most new versions of uuencode do this. While it takes a little more processing when generating the file, it results in slightly shorter files. I would urge Brad to produce a revised version of uuencode which produces the extra line, and maybe fixes the 'end' line too. Meanwhile I urge everyone else to edit their uuencoded versions of uuencode if they want to decode them, and not to hack the uudecode program. Forgive me if some of the preceding sounds a bit harsh. I did not mean to offend anyone, I just hate to see people spending effort in the wrong direction.
jhs@MITRE-BEDFORD.ARPA.UUCP (02/12/87)
Meanwhile, I should modify the BASIC uudecode to treat "`" as the same as a space and perhaps to terminate on encountering "end" just because it seems better than continuing to uudecode! Also, how about uudecode checking the length of the input buffer to make sure there are enough characters there and padding with blanks if not? -John S.