[comp.sys.next] uuencoded files and Mail

rob@lighthouse.com (07/07/90)

This reply is to a message on the next-prog mailing list.  I felt it might be
of general interest so I'm cross-posting it here:

John N. Alegre  (jdev@andante.mn.org)  writes:
> There is no way to save it out to a file that we have found short of
> selecting the text, and using copy/paste to EDIT.

I don't know of any way around this.  If anyone else does, I'd love to hear 
about it :-)

> Subsequent attemtps to uudecode the file ALWAYS give either a "short file" or
> "unexpected EOF" error message.  This sometimes, but not always, will also 
> result in checksum errors when attemting un untar the file.

This seems to be caused by Mail deleting the character pair <space,
carriage-return> at the end of lines.  The script at the end of this
message will replace the deleted character pairs.

I have also had problems that seem to indicate that copying and
pasting from Edit or Shell into Mail converts TAB characters to
spaces.  This isn't a problem unless you are attempting to ship a
"shar" archived file which compares file lengths.

Rob Kedoin				rob@lighthouse.com
Lighthouse Design, Ltd
6516 Western Avenue Chevy Chase, MD 20815

--- cut here ---
#!/bin/sh
# FIXUU
#
# Usage: fixuu <bad-uuencoded-file>
#
# Fixes uuencoded files which have had (space,return) pairs eaten by
# NeXT-mail. 
#
# The corrected file is printed to standard out
#
# Rob Kedoin rob@lighthouse.com 27-Jun-90

if [ $# -ne 1 ]
then
        echo "Usage: fixuu <bad-uuencoded-file>"
        echo "\tNew file printed to standard out."
        exit 1
fi

awk 'length($0) > 61 {printf("%s\n%s\n",substr($0,0,60), substr($0,61))} \
        length($0) <= 61 && $0 !~ /^end$/ {print $0} \
        /^end$/ {printf("`\nend\n")}' $1