COHERENT manpages

This page displays the COHERENT manpage for uuencode [Encode a binary file for transmission].

List of available manpages
Index


uuencode -- Command

Encode a binary file for transmission
uuencode [ source ] file_label [ < source ] > output

uuencode prepares a file for transmission to a remote destination via uucp.
It  takes  binary input  and  produces an  encoded  version, consisting  of
printable ASCII characters, on  standard output, which may be redirected or
piped to uucp.

If source is not specified, uuencode reads the standard input and writes to
the  standard  output.   If, however,  source  is  specified, uuencode  its
permissions into the uuencode'd file.  file_label is the name that uudecode
gives to the file when it is decoded.

uuencode is chiefly used for mail.   You cannot mail a binary file, but you
can mail  a uuencode'd  binary.  The  standard way to  mail a binary  is to
compress it, uunecode it, split it into pieces less than 50 kilobytes each,
then mail each piece.

The format of the encoded file is as follows:

1. A header  line starting with  the characters begin followed  by a space.
   This is  followed by the mode  of the file in octal and  the name of the
   output  file  specified on  the  command line.   (For  details, see  the
   Lexicon entry for chmod). These last  two fields are also separated by a
   space.  The  mode and the  system name can  be changed by  directing the
   output into a file and editing it.

2. The body of the file, consisting of a number of lines, each no more than
   62  characters long,  including a newline  character.  Each  line starts
   with a character count written as a single ASCII character, representing
   an integer value  from 0 (octal 40) to 63  (octal 135) giving the number
   of characters in the rest of  the line.  This is followed by the encoded
   characters  and  a  newline.  The  last  line  of  the  body is  a  line
   consisting of an ASCII space (octal 40).

3. A trailer, which consists of the string end on a line by itself.

The  encoding is  done  by taking  three  bytes and  storing  them in  four
characters,  six bits  per  character.  Each  six  bits is  converted to  a
printable character by adding 0x20 to it.

Example

Consider the file tmp, which consists of the line:

    The quick brown fox jumps over the lazy dog.

To record it in file tmp.send, type:

    uuencode tmp < tmp > tmp.send

The output is:

    begin 644 tmp
    M5&AE('%U:6-K(&)R;W=N(&9O>"!J=6UP<R!O=F5R('1H92!L87IY(&1O9RX*

    end

Note that the third line consists of a space followed by a newline.

See Also

commands,
UUCP,
uucp,
uudecode

Notes

uuencode  expands a  file  by more  than  one third,  which thus  increases
transmission time.  This can be a factor when sending large files.