=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/compress/compress.1,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- src/usr.bin/compress/compress.1 2003/06/22 22:17:46 1.18 +++ src/usr.bin/compress/compress.1 2003/06/23 20:51:02 1.19 @@ -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 @@ .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 @@ 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 @@ .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 @@ 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 @@ 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 @@ .%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