Table of Contents
uuexplode - decode multiple and/or multipart uuencoded files to their
uuexplode [-hqslcfw] [-t dirname] [filename, filename...]
uuexplode is a "smart", fast uudecoder that will decode one
or more files consisting of complete uuencoded files. The target files can
be written in any user specified directory or in current. It is upward compatible
provided that the encoder program used to create the input
to uuexplode has more or less followed the format described in uuencode(5)
See Technical Notes below.
If no filename(s) is supplied, input is read
from stdin. It can also write to stdout and hence act as a proper filter.
uuexplode automatically ignores lines that do not appear to be part of
the uuencoded file. This is particularly useful in uudecoding files that
have been concatenated from several email or news postings without stripping
off the headers or otherwise editing extraneous content. A lot of effort
was put into ensuring that erroneous target files are not written, several
error and warning messages are written to stdout when uuexplode finds something
in the input it doesn’t accept or just finds strange. The messages are meant
to be self explanatory and contain line numbers in the input file. Note
that when warnings are issued, the output is still most likely correct.
This is for advanced users who know the uucode format well
and want to know more about what uuexplode accepts as valid uucode. A number
of constraints are put on it:
- Print usage message stdout.
- Quiet. Do not print any diagnostics,
errors or warning messages - no matter what goes wrong.
- Write data to stdout
instead of to the target file. Only the very first target file found in
the input will be written, then uuexplode exits. By the "first" file is
meant the first file actually containing any decodable uucode at all. This
file may not be in the first input file if there are more than one. All
warning/error messages go to stderr so there is no need to use -q with -s.
- Lenient mode. This allows for the short data line, the one not beginning
with an "M"at the end of a uucode block, to have a non-standard length. Use
this as a second attempt if a target file seems to come out corrupted even
if no warnings were printed during decoding. Note: -l causes the security
of uucode recognition to drop quite considerably, do not use casually.
- Careless mode. This stops the checks for illegal characters in the short
data line. Its main use is in conjunction with -f when it allows decoding
of uucode in the character range [>..}] that some non-standard encoders produce.
This kind of code is transparent to a "dumb" uudecode program. Never use
this option unless you know you have non-standard uucode.
- Fast mode. This
stops the checks for illegal characters in the normal uucode data lines.
It makes the decoding go faster, but not significantly (in fact probably
not even noticably). Normally this would only be used with -c if you know
you have uucode with a non-standard character range. The sequrity of uucode
recognition with -f -c is much lower than normal.
- Overwite. Without this,
uuexplode will refuse to overwrite a target file that already exists.
- Target directory. The named directory does not have to exist, it
will be created. Should this fail, uuexplode exits and no target files will
be written. Without -t, the target files always end up in current directory.
- The first line after the ’begin’-line is a uucode
line if all characters are valid, it begins with [SPC..M,’] and the length
is not totally absurd with respect to what the first char was.
- There is
at least a \n behind each uucode line. There may be a \r also.
- If there are
extra chars at the end of the data lines it is present in all lines, even
the last ‘-line. And always the same number of chars.
- There are no extra chars
behind the ’end’-line except \n or \r\n
- The normal uucode lines are always 45
bytes (60 chars) and have ’M’ as length indicator. A "standard" uudecode program
does not care about this at all.
- No valid uucode contains ASCII > ’a’. Note
that one can also use the range [>..}] since bit 6 of the chars are unused.
Again a "standard" uudecode program will happily decode such data, uuexplode
will only do this with -f -cc. There are uuencoders (e.g. on the Macintosh)
that produce such uucode.
- The end of a uucode block resides in the same
input file (or stdin) as the corresponding ’begin’-line.
- All parts belonging
to the same target file(s) are in correct order in the input.
- The input
contains no characers with ASCII code less than 32.
A small list of capabilities
concerning garbage lines:
all decoding went well, the returncode is 0. Otherwise it is the logical
OR of the following values:
No assumptions whatsoever are made about the format of a garbage line.
Handles garbage between all the last three lines of a uucode block.
Handles bogus SPACE/‘ lines between parts (and at the end) of the same block.
Handles bogus short data lines in the middle of a uucode block.
Handles short or even empty uucode blocks correctly.
Tolerates optional checksum/"guard" character(s) at the end of data lines.
Tolerates SPACE or ‘ as zero-code. The empty-line can be SPACE, ‘ or ‘‘.
1 At least one warning was issued
2 At least one error occurred, possibly casuing a target file not to be
4 A target file already existed (only if -w was not actice)
the warnings and errors are not quite as self explanatory as one would
wish. A user that does not know the uucode format and does not want to know,
may not be able to understand why the file he tried to decode failed.
options -c and -l require at least rudimentary knowledge of the uucode format
to be really useful.
There is no proper standard formally specifying the
format of uucode or what a uudecode algorithm shall accept as valid input.
This program tries to be lenient enough to accept all the common variants
while still being as pedantic as possible. There are variants of uuencoders
out there producing (at least capable of producing) uucode that uuexplode
does not accept. A present no such commonly used uuencoders are known to
The algorithms used to detect valid uucode are not based on proper statistical
analysis of uuencoded data with garabage lines in it. Instead, some fairly
rigid theoretical analysis, partly based on what kind of garbage normally
occur in Email and News postings (but not limited to those) was done. It
may not work as well with totally random garbage interleaved with the uucode.
Michael Bergman (firstname.lastname@example.org)
Uuexplode was originally based on a program called "kiss", written by
Kevin Young. This program was part of a collection of uucode tools called
uuxfer. The actual decoding function that decodes one line of uucode is
also written by Kevin and altough all the other code has been almost completely
rewritten this remains unaltered.
Table of Contents