BSD 3 development
[unix-history] / usr / man / man1 / compact.1
CommitLineData
4df0b004
CMM
1.TH COMPACT 1 3/15/79
2.UC
3.SH NAME
4compact \- compress files
5.SH SYNOPSIS
6.B compact
7[ name ... ]
8.SH DESCRIPTION
9.I Compact
10compresses the named files using an adaptive
11Huffman code. If no file names are given,
12then the standard input is compacted to
13the standard output.
14Unlike
15.I pack,
16.I compact
17operates as an on-line algorithm.
18Each time a byte is read,
19it is encoded immediately
20according to the current prefix
21code.
22This code is an optimal Huffman code
23for the set of frequencies seen so far.
24It is unnecessary to prepend a decoding
25tree to the compressed file (as in
26.I pack
27\b), since the encoder (\b
28.I compact
29\b) and the decoder (\b
30.I uncompact
31\b) start in the same state and stay
32synchronized.
33Furthermore,
34.I compact
35and
36.I uncompact
37can operate as filters.
38In particular,
39.sp
40 ... | compact | uncompact | ...
41.br
42.sp
43operates as a (very slow) no-op.
44When an argument
45.I file
46is given,
47it is compacted
48and the resulting file is placed in
49.I file.C;
50.I file
51is unlinked.
52The first two bytes of the
53compacted file code the
54fact that the file is compacted.
55This code is used to prohibit
56recompaction.
57.sp
58The amount of compression
59to be expected depends
60on the type of file being compressed.
61Typical values of compression are:
62Text (38%), Pascal Source (43%),
63C Source (36%) and Binary (19%).
64These values are the percentages
65of file bytes reduced.
66.SH RESTRICTIONS
67The last segment of the filename must
68contain fewer than thirteen characters
69to allow space for the appended '.C'.
70Directories cannot (and should not)
71be compressed.
72.SH DIAGNOSTICS
73Compact will not compress directories.
74Also messages about unopenable files, etc.
75No attempt will be made to compress files
76which have already been compressed by
77either compact or pack.
78.SH FILES
79 .C files created
80.br
81Input files unlinked (unless protected)
82.SH "SEE ALSO"
83uncompact (1),
84ccat (1)
85.sp
86Gallager, Robert G., "Variations on a Theme by Huffman",
87.I I.E.E.E.
88.I Transactions
89.I on
90.I Information
91.I Theory,
92vol. IT-24, no. 6, November 1978, pp. 668 - 674.
93.SH AUTHOR
94Colin L. Mc Master
95.SH BUGS