version 1.7, 1999/06/05 01:21:22 |
version 1.8, 1999/07/04 11:53:52 |
|
|
.Os |
.Os |
.Sh NAME |
.Sh NAME |
.Nm compress , |
.Nm compress , |
.\".Nm uncompress , |
|
.Nm uncompress |
.Nm uncompress |
.\".Nm zcat |
|
.Nd compress and expand data |
.Nd compress and expand data |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm compress |
.Nm compress |
|
|
.Op Fl cftoqv |
.Op Fl cftoqv |
.Op Fl o Ar filename |
.Op Fl o Ar filename |
.Op Ar |
.Op Ar |
.\".Nm zcat |
|
.\".Op Ar |
|
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm compress |
.Nm |
reduces the size of the named files using adaptive Lempel-Ziv coding. |
reduces the size of the named files using adaptive Lempel-Ziv coding. |
Each |
Each |
.Ar file |
.Ar file |
|
|
files by deleting the |
files by deleting the |
.Dq .Z |
.Dq .Z |
extension. |
extension. |
.\".Pp |
|
.\".Nm Zcat |
|
.\"is an alias for |
|
.\".Dq "uncompress -c" . |
|
.Pp |
.Pp |
If renaming the files would cause files to be overwritten and the standard |
If renaming the files would cause files to be overwritten and the standard |
input device is a terminal, the user is prompted (on the standard error |
input device is a terminal, the user is prompted (on the standard error |
|
|
Print the percentage reduction of each file. |
Print the percentage reduction of each file. |
.El |
.El |
.Pp |
.Pp |
.Nm compress |
.Nm |
uses a modified Lempel-Ziv algorithm. |
uses a modified Lempel-Ziv algorithm. |
Common substrings in the file are first replaced by 9-bit codes 257 and up. |
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 |
When code 512 is reached, the algorithm switches to 10-bit codes and |
|
|
After the |
After the |
.Ar bits |
.Ar bits |
limit is reached, |
limit is reached, |
.Nm compress |
.Nm |
periodically checks the compression ratio. |
periodically checks the compression ratio. |
If it is increasing, |
If it is increasing, |
.Nm compress |
.Nm |
continues to use the existing code dictionary. |
continues to use the existing code dictionary. |
However, if the compression ratio decreases, |
However, if the compression ratio decreases, |
.Nm compress |
.Nm |
discards the table of substrings and rebuilds it from scratch. This allows |
discards the table of substrings and rebuilds it from scratch. This allows |
the algorithm to adapt to the next "block" of the file. |
the algorithm to adapt to the next |
|
.Dq block |
|
of the file. |
.Pp |
.Pp |
The |
The |
.Fl b |
.Fl b |
|
|
time to compute. |
time to compute. |
.Pp |
.Pp |
The |
The |
.Nm compress |
.Nm |
utility exits 0 on success, 1 if an error occurred, or 2 if one or |
utility exits 0 on success, 1 if an error occurred, or 2 if one or |
more files were not compressed because they would have grown in |
more files were not compressed because they would have grown in |
size (and |
size (and |
|
|
.Re |
.Re |
.Sh STANDARDS |
.Sh STANDARDS |
The |
The |
.Nm compress |
.Nm |
utility is compliant with the |
utility is compliant with the |
.St -p1003.2-92 |
.St -p1003.2-92 |
specification. |
specification. |