|
Lines 54-70
Link Here
|
| 54 |
.Sh DESCRIPTION |
54 |
.Sh DESCRIPTION |
| 55 |
The |
55 |
The |
| 56 |
.Nm |
56 |
.Nm |
| 57 |
utility reduces the size of the named files using adaptive Lempel-Ziv coding. |
57 |
utility attempts to reduce the size of the |
|
|
58 |
named files using adaptive Lempel-Ziv coding. |
| 58 |
Each |
59 |
Each |
| 59 |
.Ar file |
60 |
.Ar file |
| 60 |
is renamed to the same name plus the extension |
61 |
is renamed to the same name plus the extension |
| 61 |
.Dq .Z . |
62 |
.Dq .Z . |
| 62 |
As many of the modification time, access time, file flags, file mode, |
63 |
If attempted compression would not reduce the size of a |
| 63 |
user ID, and group ID as allowed by permissions are retained in the |
|
|
| 64 |
new file. |
| 65 |
If compression would not reduce the size of a |
| 66 |
.Ar file , |
64 |
.Ar file , |
| 67 |
the file is ignored. |
65 |
or if the filename ends with |
|
|
66 |
.Dq .Z , |
| 67 |
the file is not compressed. Exceptions are discussed below. |
| 68 |
.Pp |
68 |
.Pp |
| 69 |
The |
69 |
The |
| 70 |
.Nm uncompress |
70 |
.Nm uncompress |
|
Lines 72-109
Link Here
|
| 72 |
files by deleting the |
72 |
files by deleting the |
| 73 |
.Dq .Z |
73 |
.Dq .Z |
| 74 |
extension. |
74 |
extension. |
|
|
75 |
If a specified filename doesn't end with |
| 76 |
.Dq .Z , |
| 77 |
one will be assumed unless a file with the extended filename does not |
| 78 |
exist, in which case the named file will be removed (because of a bug). |
| 75 |
.Pp |
79 |
.Pp |
| 76 |
If renaming the files would cause files to be overwritten and the standard |
80 |
If renaming the files would cause files to be overwritten and the standard |
| 77 |
input device is a terminal, the user is prompted (on the standard error |
81 |
input device is a terminal, the user is prompted (on the standard error |
| 78 |
output) for confirmation. |
82 |
output) for confirmation. |
| 79 |
If prompting is not possible or confirmation is not received, the files |
83 |
If prompting is not possible or confirmation is not received, the files |
| 80 |
are not overwritten. |
84 |
are not overwritten. |
|
|
85 |
As many of the file attributes (modification time, access time, |
| 86 |
file flags, file mode, user ID, and group ID) as allowed by |
| 87 |
file permissions are retained in the new file. |
| 81 |
.Pp |
88 |
.Pp |
| 82 |
If no files are specified or a |
89 |
If no files are specified or a |
| 83 |
.Ar file |
90 |
.Ar file |
| 84 |
argument is a single dash |
91 |
argument is a single dash |
| 85 |
.Pq Sq Fl , |
92 |
.Pq Sq Fl , |
| 86 |
the standard input is compressed or uncompressed to the standard output. |
93 |
the standard input is compressed or uncompressed to the standard output. |
| 87 |
If either the input and output files are not regular files, the checks for |
94 |
If either the input and output are not regular files, the checks for |
| 88 |
reduction in size and file overwriting are not performed, the input file is |
95 |
reduction in size and file overwriting are not performed, the input file is |
| 89 |
not removed, and the attributes of the input file are not retained. |
96 |
not removed, and the attributes of the input file |
|
|
97 |
are not retained in the output. |
| 90 |
.Pp |
98 |
.Pp |
| 91 |
The options are as follows: |
99 |
The options are as follows: |
| 92 |
.Bl -tag -width indent |
100 |
.Bl -tag -width ".Fl b Ar bits" |
| 93 |
.It Fl b |
101 |
.It Fl b Ar bits |
| 94 |
Specify the |
102 |
The code size (see below) is limited to |
| 95 |
.Ar bits |
103 |
.Ar bits , |
| 96 |
code limit (see below). |
104 |
which must be in the range 9..16. |
|
|
105 |
The default is 16. |
| 97 |
.It Fl c |
106 |
.It Fl c |
| 98 |
Compressed or uncompressed output is written to the standard output. |
107 |
Compressed or uncompressed output is written to the standard output. |
| 99 |
No files are modified. |
108 |
Compression is attempted even if the results will be larger than the |
|
|
109 |
original. |
| 110 |
No files are modified. The |
| 111 |
.Fl v |
| 112 |
flag is ignored. |
| 100 |
.It Fl f |
113 |
.It Fl f |
| 101 |
Force compression of |
114 |
Files are overwritten without prompting for confirmation. |
| 102 |
.Ar file , |
115 |
For compression, proceed even if the |
| 103 |
even if it is not actually reduced in size. |
116 |
results will be larger than the original. |
| 104 |
Additionally, files are overwritten without prompting for confirmation. |
|
|
| 105 |
.It Fl v |
117 |
.It Fl v |
| 106 |
Print the percentage reduction of each file. |
118 |
The size reduction of each file is printed as a percentage to |
|
|
119 |
the standard output. Ignored for uncompressiong or if the |
| 120 |
.Fl c |
| 121 |
flag is also used. |
| 107 |
.El |
122 |
.El |
| 108 |
.Pp |
123 |
.Pp |
| 109 |
The |
124 |
The |
|
Lines 112-132
Link Here
|
| 112 |
Common substrings in the file are first replaced by 9-bit codes 257 and up. |
127 |
Common substrings in the file are first replaced by 9-bit codes 257 and up. |
| 113 |
When code 512 is reached, the algorithm switches to 10-bit codes and |
128 |
When code 512 is reached, the algorithm switches to 10-bit codes and |
| 114 |
continues to use more bits until the |
129 |
continues to use more bits until the |
| 115 |
limit specified by the |
130 |
code size limit (see |
| 116 |
.Fl b |
131 |
.Fl b ) |
| 117 |
flag is reached (the default is 16). |
132 |
is reached. |
| 118 |
.Ar Bits |
133 |
Then the compression ratio is periodically checked. |
| 119 |
must be between 9 and 16. |
|
|
| 120 |
.Pp |
| 121 |
After the |
| 122 |
.Ar bits |
| 123 |
limit is reached, |
| 124 |
.Nm |
| 125 |
periodically checks the compression ratio. |
| 126 |
If it is increasing, |
134 |
If it is increasing, |
| 127 |
.Nm |
135 |
.Nm |
| 128 |
continues to use the existing code dictionary. |
136 |
continues to use the existing code dictionary; |
| 129 |
However, if the compression ratio decreases, |
137 |
but if the compression ratio is decreasing, |
| 130 |
.Nm |
138 |
.Nm |
| 131 |
discards the table of substrings and rebuilds it from scratch. This allows |
139 |
discards the table of substrings and rebuilds it from scratch. This allows |
| 132 |
the algorithm to adapt to the next "block" of the file. |
140 |
the algorithm to adapt to the next "block" of the file. |
|
Lines 187-189
Link Here
|
| 187 |
.Nm |
195 |
.Nm |
| 188 |
command appeared in |
196 |
command appeared in |
| 189 |
.Bx 4.3 . |
197 |
.Bx 4.3 . |
|
|
198 |
.Sh BUGS |
| 199 |
For uncompression, if a specified filename doesn't end with |
| 200 |
.Dq .Z |
| 201 |
and a file with the filename extended with |
| 202 |
.Dq .Z |
| 203 |
does not exist, the named file will be removed. |