diff options
author | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-06-23 20:51:03 +0000 |
---|---|---|
committer | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-06-23 20:51:03 +0000 |
commit | 7ef4a3952c819e3f6e4bfa7e1d25b6044fb871ff (patch) | |
tree | 20bb87a630c1d128019fd9761e1c3415eb7cdb21 /usr.bin/compress/compress.1 | |
parent | 7eaa27a723b6ac27891dde011699bd8228c8846c (diff) |
- further document differences between compress and gzip
- document -[1-9] mode for gzip
- add relevant RFCs to SEE ALSO
ok mickey@ deraadt@ millert@
Diffstat (limited to 'usr.bin/compress/compress.1')
-rw-r--r-- | usr.bin/compress/compress.1 | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/usr.bin/compress/compress.1 b/usr.bin/compress/compress.1 index 4bc390956c4..b5cc638f0a9 100644 --- a/usr.bin/compress/compress.1 +++ b/usr.bin/compress/compress.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: compress.1,v 1.18 2003/06/22 22:17:46 deraadt Exp $ +.\" $OpenBSD: compress.1,v 1.19 2003/06/23 20:51:02 jmc Exp $ .\" $NetBSD: compress.1,v 1.5 1995/03/26 09:44:34 glass Exp $ .\" .\" Copyright (c) 1986, 1990, 1993 @@ -80,11 +80,16 @@ and .Nm gzip utilities reduce the size of the named files using adaptive Lempel-Ziv coding. -They are functionally identical, except that if invoked as +They are functionally identical, but use different algorithms for compression. +If invoked as .Nm gzip -the deflate mode of compression is chosen by default (see the -.Fl g -flag). +or +.Nm compress Fl g +the deflate mode of compression is chosen by default; +otherwise the older method of compression +.Pq compress mode +is used. +.Pp Each .Ar file is renamed to the same name plus the extension @@ -159,7 +164,20 @@ mode). This flag need not be specified when invoked as .Nm gzip . .It Fl 1...9 -Use deflate scheme with compression factor of one to nine. +Use deflate scheme with compression factor of +.Fl 1 +to +.Fl 9 . +Compression factor +.Fl 1 +is the fastest, but provides a poorer level of compression. +Compression factor +.Fl 9 +provides the best level of compression, but is relatively slow. +The default is +.Fl 6 . +This option implies +.Fl g . .It Fl O Use old compression method. .It Fl o Ar filename @@ -180,7 +198,8 @@ Print the percentage reduction of each file and other information. .Pp In normal mode, .Nm -uses a modified Lempel-Ziv algorithm. +uses a modified Lempel-Ziv algorithm +.Pq LZW . Common substrings in the file are first replaced by 9-bit codes 257 and up. When code 512 is reached, the algorithm switches to 10-bit codes and continues to use more bits until the @@ -208,8 +227,12 @@ This allows the algorithm to adapt to the next of the file. .Pp .Nm gzip -uses a slightly different version of the Lempel-Ziv algorithm, -which can achieve even better compression. +uses a slightly different version of the Lempel-Ziv algorithm +.Pq LZ77 . +Common substrings are replaced by pointers to previous strings, +and are found using a hash table. +Unique substrings are emitted as a string of literal bytes, +and compressed as Huffman trees. .Pp The .Fl b @@ -228,7 +251,10 @@ The amount of compression obtained depends on the size of the input, the number of .Ar bits per code, and the distribution of common substrings. -Typically, text such as source code or English is reduced by 50\-60%. +Typically, text such as source code or English is reduced by 50\-60% using +.Nm +and by 60\-70% using +.Nm gzip . Compression is generally much better than that achieved by Huffman coding (as used in the historical command pack), or adaptive Huffman coding (as used in the historical command compact), and takes less @@ -252,12 +278,27 @@ was not specified). .%V 17:6 .%P pp. 8-19 .Re +.Pp +.Bl -tag -width 12n -compact +.It RFC1950 +ZLIB Compressed Data Format Specification +.It RFC1951 +DEFLATE Compressed Data Format Specification +.It RFC1952 +GZIP File Format Specification +.El .Sh STANDARDS The .Nm utility is compliant with the .St -p1003.2-92 specification. +.Pp +The +.Nm gzip +and +.Nm gunzip +utilities are extensions. .Sh HISTORY The .Nm |