Convert-UUlib
view release on metacpan or search on metacpan
UUFILE_READ Read in, but not further processed
The following state codes are or'ed together:
FILE_MISPART Missing Part(s) detected
FILE_NOBEGIN No 'begin' found
FILE_NOEND No 'end' found
FILE_NODATA File does not contain valid uudata
FILE_OK All Parts found, ready to decode
FILE_ERROR Error while decoding
FILE_DECODED Successfully decoded
FILE_TMPFILE Temporary decoded file exists
Encoding types
UU_ENCODED UUencoded data
B64_ENCODED Mime-Base64 data
XX_ENCODED XXencoded data
BH_ENCODED Binhex encoded
PT_ENCODED Plain-Text encoded (MIME)
QP_ENCODED Quoted-Printable (MIME)
YENC_ENCODED yEnc encoded (non-MIME)
This function has to walk the linear list of fils on each access, so
if you want to iterate over all items, it is usually faster to use
"GetFileList".
@items = GetFileList
Similar to "GetFileListItem", but returns all files in one go.
Decoding files
$retval = $item->rename ($newname)
Change the ondisk filename where the decoded file will be saved.
$retval = $item->decode_temp
Decode the file into a temporary location, use "$item->infile" to
retrieve the temporary filename.
$retval = $item->remove_temp
Remove the temporarily decoded file again.
$retval = $item->decode ([$target_path])
Decode the file to its destination, or the given target path.
$retval = $item->info (callback-function)
Querying (and setting) item attributes
$state = $item->state
$mode = $item->mode ([newmode])
$uudet = $item->uudet
Information about source parts
$parts = $item->parts
Return information about all parts (source files) used to decode the
file as a list of hashrefs with the following structure:
{
partno => <integer describing the part number, starting with 1>,
# the following member sonly exist when they contain useful information
sfname => <local pathname of the file where this part is from>,
filename => <the ondisk filename of the decoded file>,
subfname => <used to cluster postings, possibly the posting filename>,
subject => <the subject of the posting/mail>,
origin => <the possible source (From) address>,
mimetype => <the possible mimetype of the decoded file>,
mimeid => <the id part of the Content-Type>,
}
Usually you are interested mostly the "sfname" and possibly the
"partno" and "filename" members.
Functions below are not documented and not very well tested - feedback welcome
QuickDecode
EncodeMulti
EncodePartial
UUFILE_READ Read in, but not further processed
The following state codes are or'ed together:
FILE_MISPART Missing Part(s) detected
FILE_NOBEGIN No 'begin' found
FILE_NOEND No 'end' found
FILE_NODATA File does not contain valid uudata
FILE_OK All Parts found, ready to decode
FILE_ERROR Error while decoding
FILE_DECODED Successfully decoded
FILE_TMPFILE Temporary decoded file exists
=head2 Encoding types
UU_ENCODED UUencoded data
B64_ENCODED Mime-Base64 data
XX_ENCODED XXencoded data
BH_ENCODED Binhex encoded
PT_ENCODED Plain-Text encoded (MIME)
QP_ENCODED Quoted-Printable (MIME)
YENC_ENCODED yEnc encoded (non-MIME)
Similar to C<GetFileListItem>, but returns all files in one go.
=back
=head2 Decoding files
=over
=item $retval = $item->rename ($newname)
Change the ondisk filename where the decoded file will be saved.
=item $retval = $item->decode_temp
Decode the file into a temporary location, use C<< $item->infile >> to
retrieve the temporary filename.
=item $retval = $item->remove_temp
Remove the temporarily decoded file again.
=item $retval = $item->decode ([$target_path])
Decode the file to its destination, or the given target path.
=item $retval = $item->info (callback-function)
=back
=head2 Querying (and setting) item attributes
=item $parts = $item->parts
Return information about all parts (source files) used to decode the file
as a list of hashrefs with the following structure:
{
partno => <integer describing the part number, starting with 1>,
# the following member sonly exist when they contain useful information
sfname => <local pathname of the file where this part is from>,
filename => <the ondisk filename of the decoded file>,
subfname => <used to cluster postings, possibly the posting filename>,
subject => <the subject of the posting/mail>,
origin => <the possible source (From) address>,
mimetype => <the possible mimetype of the decoded file>,
mimeid => <the id part of the Content-Type>,
}
Usually you are interested mostly the C<sfname> and possibly the C<partno>
and C<filename> members.
=back
=head2 Functions below are not documented and not very well tested - feedback welcome
doc/HISTORY view on Meta::CPAN
#
PROGRAM HISTORY
---------------
(remember that all _dates_ are dd.mm.yyyy)
0.1 (15.06.1994)
-----
First release. Took less than a week of coding. Most features should work now.
All files I encountered can be decoded properly. Some special cases, however,
are still untested. This version was updated two or three times without
upgrading the version number because that were just minor changes.
0.2 (23.06.1994)
-----
DOS support! After getting some requests for a DOS version, many portions of
the code have been completely rewritten so that the file data is not loaded
into memory. Instead, just an index is saved. Added +e option to select file
extensions. Added +i option to disable user questioning.
Some special cases to evaluate the part no. of the subject line added
doc/HISTORY view on Meta::CPAN
anything with them (you can enter "xv $") to watch the file.
Installed a signal handler for SIGINT (Ctrl-C). If the program was interrupted
by the user, it left LOTS of temporary files in /usr/tmp. They will now be
cleaned.
Again, the user interface was changed. I did that in 0.2, so why not again
in 0.3. I hope you'll agree it's a bit better now.
The program now checks if gunzip has failed (it tests if the resulting file
has less than 2 bytes).
Fixed a bug with filenames that contained spaces at the end.
Linked files in tar archives are now ignored.
In 0.2 each file was decoded before the user was prompted what to do. This
was quite slow on some machines. Now the files are only decoded on request.
0.3.42
--------
I'm quite lazy with documenting all the changes I made to the source code.
I hope I will keep online this time. To do this, I have invented the patch-
level number. Since I have made a lot of changes to the original 0.3 release,
I start with patchlevel 42.
0.3.43
--------
doc/HISTORY view on Meta::CPAN
0.4.9 (07.06.1995)
-------
- allows an 'end' after the encoded data with only an _empty_ line
inbetween. Previously, I expected a valid encoded line with zero
data, meaning that the single character on that line is '`' (UUE)
or '+' (XXE)
0.4.10 (14.06.1995)
--------
- funny bug fixed: if the decoder found a valid UUencoded line in a
supposed MIME-data file, it decoded the single line and exited. In
my case, a MIME header triggered this.
- fixed bug with more than one MIME-encoded file in a single message.
- serious bug fixed when overwriting an existing file: I had forgot-
ten O_TRUNC when opening the file, causing some undefined behavior.
0.4.11 (16.06.1995)
--------
- renamed all variables 'this' and 'new', as some C++ compilers don't
like using these keywords as names
- renamed the variable 'inpfile' in uudeview.c:more(); I had a type
doc/HISTORY view on Meta::CPAN
- Oops, the Netscape repair code was partially broken and needed some repair
itself.
- xxdecoding was broken because of over-tolerant uudecoding
- uudecoding was broken because of over-tolerant uudecoding :(
0.4.15 (20.01.1996)
--------
- Implemented my own version of fgets() that allows to transparently read
lines terminated either with LF (Unix), CRLF (DOS) or CR (Mac). Sadly,
it's slower than the original.
- in previous versions, I have very much relaxed the checking for uudecoded
lines (valid_data()). Now I only allow the less strong code (meaning,
allow the data look more weird, more off the specs) if I'm sure it actually
_is_ uuencoded data. This should work in all cases because it was usually
only the last line with was "erroneous"
- included option '-b' to let part numbers in [] take precedence over ()
this only affects the kind of brackets uudeview looks to find a part
number _first_
- fixed problems with multiple MIME attachments
- got rid of the 'Ignore Replies' switch. It caused lots of confusion and
didn't really help anything.
doc/HISTORY view on Meta::CPAN
0.5.11 (03.10.1996)
--------
- Added workaround for broken uuencoded files sent from MS Exchange.
0.5.12 (23.12.1996)
--------
- Fixed bug with aborted decoding runs that the tempfile was deleted,
but UUFILE_TMPFILE was still set.
- Make uudeview return a more or less sensible return value: 0 if all
files were decoded successfully, 99 for miscellaneous errors, 2 if
all files failed to decode, or 3 if some files were decoded okay
and others failed.
- Added -n option to uudeview to not print progress bars.
- You can now set global options for UUDeview in the UUDEVIEW environ-
ment variable. Options set there may be overrridden on the command
line.
- Some tweaking to make some troublesome input files (for example with
interleaved blank lines) decode.
- Fixed bug that caused erroneously decoded data when UUencoded data
looked like Base64 (because of the overlapping alphabet)
0.5.13 (09.01.1997)
--------
- Fixed bug in uuscan.c.
- Fixed another bug in uuscan.c which happened when a filename
on the Content-Type line happened to contain a header keyword.
- Fixed infinite loop when trying to descramble Netscape data;
in one place we were looking for <a href=, but we would only
be unscrambling this if a double-quote was following.
doc/HISTORY view on Meta::CPAN
- Hopefully fix some Base64 false detections by ignoring seemingly
Base64-encoded lines that are shorter than 40 characters
- Added -a option to uudeview to auto-rename a file if the target file
exists (i.e. foo.gif would become foo.gif.1).
- Make xdeview compile and run with Tcl&Tk > 8.0
- Do not use "dangerous" gets in minews, replace by fgets
- If the file looks like MIME, be more strict when scanning "text/*"
parts for encoded data.
- Add +o option to never overwrite files (useful in non-interactive
mode)
- Add -c option to autoclear input files from which anything was decoded.
Use with care - UUDeview does not care about anything else in that file.
- Add -z option for improved MIME compliance on MIME messages.
- Improved encoding detection, it should now be less sensitive to data
that looks both like uu and Base 64.
- Add -r (Reply-To:) and -f (From:) options to uuenview
- Support encoding as quoted-printable
- Support "encoding" as plain text
- Add -t and -q options to uuenview for that
- Make the encoding to be used depend on the last -ubxtq option, so that
you can send plain text and binary attachments on the same command line.
uulib/uudeview.h view on Meta::CPAN
* File states, may be OR'ed
*/
#define UUFILE_READ (0) /* Read in, but not further processed */
#define UUFILE_MISPART (1) /* Missing Part(s) detected */
#define UUFILE_NOBEGIN (2) /* No 'begin' found */
#define UUFILE_NOEND (4) /* No 'end' found */
#define UUFILE_NODATA (8) /* File does not contain valid uudata */
#define UUFILE_OK (16) /* All Parts found, ready to decode */
#define UUFILE_ERROR (32) /* Error while decoding */
#define UUFILE_DECODED (64) /* Successfully decoded */
#define UUFILE_TMPFILE (128) /* Temporary decoded file exists */
/*
* Encoding Types
*/
#define UU_ENCODED (1) /* UUencoded data */
#define B64ENCODED (2) /* Mime-Base64 data */
#define XX_ENCODED (3) /* XXencoded data */
#define BH_ENCODED (4) /* Binhex encoded */
#define PT_ENCODED (5) /* Plain-Text encoded (MIME) */
uulib/uudeview.h view on Meta::CPAN
short uudet; /* Encoding type (see macros above) */
int flags; /* flags, especially for single-part files */
long size; /* approximate size of resulting file */
char *filename; /* malloc'ed file name */
char *subfname; /* malloc'ed ID from subject line */
char *mimeid; /* malloc'ed MIME-ID, if available */
char *mimetype; /* malloc'ed Content-Type, if available */
char *binfile; /* name of temp file, if already decoded */
struct _uufile *thisfile; /* linked list of this file's parts */
int *haveparts; /* the parts we have (max. 256 are listed) */
int *misparts; /* list of missing parts (max. 256) */
struct _uulist *NEXT; /* next item of the list */
struct _uulist *PREV; /* previous item of the list */
} uulist;
uulib/uustring.c view on Meta::CPAN
{ S_ENCODE_CANCEL, "Encode operation canceled" },
{ S_SCAN_CANCEL, "Scanning canceled" },
{ S_SIZE_MISMATCH, "%s: Decoded size (%ld) does not match expected size (%ld)" },
{ S_PSIZE_MISMATCH, "%s part %d: Decoded size (%ld) does not match expected size (%ld)" },
{ S_CRC_MISMATCH, "CRC32 mismatch in %s. Decoded file probably corrupt." },
{ S_PCRC_MISMATCH, "PCRC32 mismatch in %s part %d. Decoded file probably corrupt." },
/* informational messages */
{ S_LOADED_PART, "Loaded from %s: '%s' (%s): %s part %d %s %s %s" },
{ S_NO_DATA_FOUND, "No encoded data found in %s" },
{ S_NO_BIN_FILE, "Oops, could not find decoded file?" },
{ S_STRIPPED_SETUID, "Stripped setuid/setgid bits from target file %s mode %d" },
{ S_DATA_SUSPICIOUS, "Data looks suspicious. Decoded file might be corrupt." },
{ S_NO_TEMP_NAME, "Could not get name for temporary file" },
{ S_BINHEX_SIZES, "BinHex file: data/resource fork sizes %ld/%ld" },
{ S_BINHEX_BOTH, "BinHex file: both forks non-empty, decoding data fork" },
{ S_SMERGE_MERGED, "Parts of '%s' merged with parts of '%s' (%d)" },
/* MIME-related messages */
{ S_MIME_NO_BOUNDARY, "Multipart message without boundary ignored" },
{ S_MIME_B_NOT_FOUND, "Boundary expected on Multipart message but found EOF" },
( run in 0.503 second using v1.01-cache-2.11-cpan-26ccb49234f )