Contents of the SHIP.DOC file
Ship is a program for sending binary files through email. It is designed
to supplant uuencode and uudecode. Ship encodes approximately 6.32 bits
per character mailed, compared to uuencode's 5.81 bits per character.
Ship also has these features: a 32-bit CRC check on each file; automatic
splitting of the ship output into multiple, smaller files for speedier
mailing; automatic mailing of ship's output, with subject lines for
multiple parts; and a check on the sequence of parts when unshipping.
ship [-nnn] [-m address] [-s subject] file ...
where nnn is the maximum number of K bytes for each output file, address
is the address to send mail to, subject is a Subject" line prefix, and
file ... is a list of files to ship. If no options are given, ship
outputs to stdout. The simplest use is:
ship foo > x
where foo is converted into the mailable file, x.
When -nnn is specified, but -m is not, ship writes to the files
part0001, part0002, etc., where each file has nnn or less K bytes. For
ship -25 bigfoo
will write however many 25K byte or less ship files is needed to contain
bigfoo. If, say, six files are needed, then the files part0001 to part0006
will be written.
When using -m, nothing is written, either to files or to stdout; rather,
the output is mailed to the specified address. If -nnn is also specified,
then the parts are mailed separately with the subject lines part0001, etc.
If -nnn is not specified, then only one part (the whole thing) is mailed
with the subject line "part0001". For example:
ship -25 -m fred bigfoo
will mail the six parts of bigfoo to fred.
Any number of files can be shipped at once. They become part of one long
ship stream, so if, for example -25 is specified, all but the last part
will have about 25K bytes. For example:
ship -25 -m fred fee fi fo fum
will send the files fee, fi, fo, and fum to fred.
Fred will get several mail messages with the subject lines part0001, etc.
He can then save those messages as the files, say, p1, p2, p3, ...
Then he can use the command:
ship -u p?
to recreate bigfoo, or fee fi fo and fum, depending on what he was sent.
If Fred saved the wrong numbers, ship will detect this and report a
Note: there is enough information in the shipped parts to determine the
correct sequence. A future version of ship will prescan the files to
determine the sequence, and then process them in the correct order.
If a file being received already exists, ship -u will report an error
and exit. The -o option avoids this and allows ship to overwrite existing
files. The -o option must follow the -u option:
ship -u -o p?
In addition to the -u option, ship will unship if it sees that its name is
unship. On Unix systems, this can be done simply by linking the executable
ln ship unship
Ship can also be used as a filter. The special file name "-" means stdin.
tar covf - foodir | compress | ship -25 -m fred -
will tar the directory foodir, compress it, and ship it to fred in 25K byte
pieces. Then, after Fred saves the files as p01, etc. at the other, end,
ship -u p? | zcat | tar xovf -
which will recreate the directory foobar and its contents. ship -u knows
to write to stdout, since the original ship put the special file name "-"
in the first part.
Ship uses a base 85 coding that needs 32-bit multiplication and division.
This can be slow on 16-bit machines, so ship provides a fast encoding
method by specifying the -f option. This method is somewhat faster even
on 32-bit machines, and has approximately a 1% penalty in the size of the
encoded result (-f gives 6.26 bits per character, on the average). The -f
option need only be used when shipping--unshipping (ship -u) automatically
detects the encoding used. For example:
ship -f -25 -m fred foo
will send foo to fred in 25K byte pieces using the fast encoding method.
You don't need to tell Fred, since ship -u will figure that out for him.
The fast encoding method is probabilistic, so it's possible for the size
penalty to be worse than 1%, and it's also possible for the fast encoding
to produce a smaller result than base 85 encoding would, all depending on
The -q option can be used with either ship or unship (ship -u) for quiet
operation--informational messages are inhibited.
You can find out the version of ship and get the command usage by using
"ship -h" or "ship -?". The version number and date and help will be
printed, and ship will exit (the rest of the command line is ignored).
The hard-arithmetic coding algorithm was blatantly stolen from Peter
Gutmann's pgencode/pgdecode programs posted on comp.compression, with
modifications to use 86 instead of 94 characters, and to make zeros encode
better than, rather than worse than other bytes. (As Stravinsky once said:
"Mediocre composers plagiarize. Great composers steal.")