BSD 4_3_Tahoe development
[unix-history] / usr / man / cat.old / compact.0
COMPACT(1) UNIX Programmer's Manual COMPACT(1)
NAME
compact, uncompact, ccat - compress and uncompress files,
and cat them
SYNOPSIS
compact [ -v ] [ name ... ]
uncompact [ -v ] [ name ... ]
ccat [ -v ] [ file ... ]
DESCRIPTION
_\bC_\bo_\bm_\bp_\ba_\bc_\bt compresses the named files using an adaptive Huffman
code. If no file names are given, the standard input is
compacted to the standard output. _\bC_\bo_\bm_\bp_\ba_\bc_\bt operates as an
on-line algorithm. Each time a byte is read, it is encoded
immediately according to the current prefix code. This code
is an optimal Huffman code for the set of frequencies seen
so far. It is unnecessary to prepend a decoding tree to the
compressed file since the encoder and the decoder start in
the same state and stay synchronized. Furthermore, _\bc_\bo_\bm_\bp_\ba_\bc_\bt
and _\bu_\bn_\bc_\bo_\bm_\bp_\ba_\bc_\bt can operate as filters. In particular,
... | compact | uncompact | ...
operates as a (very slow) no-op.
When an argument _\bf_\bi_\bl_\be is given, it is compacted and the
resulting file is placed in _\bf_\bi_\bl_\be._\bC; _\bf_\bi_\bl_\be is unlinked. The
first two bytes of the compacted file code the fact that the
file is compacted. This code is used to prohibit recompac-
tion.
The amount of compression to be expected depends on the type
of file being compressed. Typical values of compression
are: Text (38%), Pascal Source (43%), C Source (36%) and
Binary (19%). These values are the percentages of file
bytes reduced.
_\bU_\bn_\bc_\bo_\bm_\bp_\ba_\bc_\bt restores the original file from a file compressed
by _\bc_\bo_\bm_\bp_\ba_\bc_\bt. If no file names are given, the standard input
is uncompacted to the standard output.
_\bC_\bc_\ba_\bt cats the original file from a file compressed by _\bc_\bo_\bm_\b-
_\bp_\ba_\bc_\bt, without uncompressing the file (it is just a shell
script which directs the uncompacted output to the standard
output).
_\bC_\bo_\bm_\bp_\ba_\bc_\bt, _\bu_\bn_\bc_\bo_\bm_\bp_\ba_\bc_\bt, and _\bc_\bc_\ba_\bt normally do their work
silently. If a -v flag is supplied, _\bc_\bo_\bm_\bp_\ba_\bc_\bt will report the
compression percentage for each compacted file while _\bu_\bn_\bc_\bo_\bm_\b-
_\bp_\ba_\bc_\bt and _\bc_\bc_\ba_\bt will print out the name of each file as
they're uncompacted.
Printed 12/6/87 April 29, 1985 1
COMPACT(1) UNIX Programmer's Manual COMPACT(1)
RESTRICTION
The last segment of the filename must be short enough to
allow space for the appended '.C'.
FILES
*.C compacted file created by compact, removed by
uncompact
SEE ALSO
Gallager, Robert G., `Variations on a Theme of Huffman',
_\bI._\bE._\bE._\bE. _\bT_\br_\ba_\bn_\bs_\ba_\bc_\bt_\bi_\bo_\bn_\bs _\bo_\bn _\bI_\bn_\bf_\bo_\br_\bm_\ba_\bt_\bi_\bo_\bn _\bT_\bh_\be_\bo_\br_\by, vol. IT-24,
no. 6, November 1978, pp. 668 - 674.
AUTHOR
Colin L. Mc Master
Printed 12/6/87 April 29, 1985 2