Hamilton LaboratoriesHamilton C shell 2012User guideExternal utilities

uuencode

Oregon Coast

uuencode
Previous | Next

        Uuencode Binary Data

Usage:  uuencode [-h-] [-m <mode>] [ file ] decode_pathname
          [-ca- source1 [ source2 ... ] destination ]

   Uuencode and Uudecode are used to encode arbitrary binary
   data into a sequence consisting solely of printable ASCII
   characters, thus allowing the data to be sent over mail
   systems, etc., that cannot handle binary data.

   Uuencode reads from the source file (or stdin if no source
   file is specified), writing the encoded version to stdout.

   Uudecode reads the encoded file (or stdin), strips off any
   leading and trailing lines and recreates the original file,
   giving it the name that had been specified to uuencode as
   the decode_pathname parameter.

Uuencode format:

   The encoded form consists of a header line followed by a
   number of body lines and a trailer line.  The header is
   of the form:

       begin <mode> <decode_pathname>

   where the <mode> field indicates the read/write permissions
   to be given to the file.  The file ends with a line of the
   form:

       end

   Both these lines shall have no preceding or trailing
   text or white space.

   The POSIX standard specifies that the "end" line should
   be the only indicator of the end of data.  Most existing
   uudecode implementations do not adhere to this specification,
   however.  Instead, they require that there be an immediately
   preceding line marked as containing 0 bytes of data.  To
   ensure compatibility with these flawed uudecodes, this
   uuencode/uudecode pair will write that dummy line when
   encoding and ignore it when decoding.

   Data is encoded three bytes at a time into four printable
   ASCII characters by splitting the input at 6 bit intervals
   into 4 bytes, each containing data in only the lower 6 bits.
   The hex value 0x20 is then added to each byte, producing
   a value in the range 0x20 to 0x5f, which are all printable
   ASCII characters.  Thus, three bytes A, B and C of raw data
   are converted to the four ASCII characters:

      0x20 + (( A >> 2                    ) & 0x3f)
      0x20 + (((A << 4) | ((B >> 4) & 0xf)) & 0x3f)
      0x20 + (((B << 2) | ((C >> 6) & 0x3)) & 0x3f)
      0x20 + (( C                         ) & 0x3f)

   The encoded data is arranged into lines of no more than
   60 characters (representing at most 45 bytes of raw data)
   preceded by a length character, equal to the number of
   raw characters encoded plus 0x20.


Options:

   -m <mode>    Mode to be specified for the file.  Default
                is to simply fill in 666, meaning read/write
                access by everyone for normal files or 444,
                meaning read-only access by everyone for
                files marked as read-only.
   -c           Alternate cp-style syntax.  Instead of using
                stdout to write the output and having to
                explicitly specify the name to be given to
                each file in the uuencoded form, this option
                allows one to simply copy any number of files
                or directories into the uuencoded output file.
                The name that will be written into the header
                will be just the tail of the filename, just as
                cp would do.
   -a           Like -c, but appending.  If the output file
                already exists, this will append onto the end.
   -h           Help.  (This screen.)
   --           End of options.

Previous | Next