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