209 lines
4.1 KiB
Groff
209 lines
4.1 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g1.pack @(#)pack 30.3 of 3/22/86
|
|
.nr X
|
|
.if \nX=0 .ds x} PACK 1 "Directory and File Management Utilities" "\&"
|
|
.if \nX=1 .ds x} PACK 1 "Directory and File Management Utilities"
|
|
.if \nX=2 .ds x} PACK 1 "" "\&"
|
|
.if \nX=3 .ds x} PACK "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
pack, pcat, unpack \- compress and expand files
|
|
.SH SYNOPSIS
|
|
.B pack
|
|
[
|
|
.B \-
|
|
]
|
|
[
|
|
.B \-f
|
|
]
|
|
name .\|.\|.
|
|
.PP
|
|
.B pcat
|
|
name .\|.\|.
|
|
.PP
|
|
.B unpack
|
|
name .\|.\|.
|
|
.SH DESCRIPTION
|
|
.I pack\^
|
|
attempts to store the specified files in a compressed form.
|
|
Wherever possible (and useful), each input file
|
|
.I name\^
|
|
is replaced by a packed file
|
|
.IB name .z
|
|
with the same access modes, access and modified dates, and owner as those of
|
|
.IR name .
|
|
The
|
|
.B -f
|
|
option will force packing of
|
|
.IR name\^ .
|
|
This is useful for causing an entire directory to be packed
|
|
even if some of the files will not benefit.
|
|
If
|
|
.I pack\^
|
|
is successful,
|
|
.I name\^
|
|
will be removed.
|
|
Packed files
|
|
can be restored to their original form using
|
|
.I unpack\^
|
|
or
|
|
.IR pcat .
|
|
.PP
|
|
.I pack\^
|
|
uses Huffman (minimum redundancy) codes on a byte-by-byte
|
|
basis.
|
|
If the
|
|
.B \-
|
|
argument is used,
|
|
an internal flag is set that causes the number of times each
|
|
byte is used, its relative frequency, and the code for the byte
|
|
to be printed on the standard output.
|
|
Additional occurrences of
|
|
.B \-
|
|
in place of
|
|
.I name\^
|
|
will cause the internal flag to be set and reset.
|
|
.PP
|
|
The amount of compression obtained depends on the size of the
|
|
input file and the character frequency distribution.
|
|
Because a decoding
|
|
tree forms the first part of each
|
|
.B .z
|
|
file, it is usually not worthwhile
|
|
to pack files smaller than three blocks, unless the character frequency
|
|
distribution is very skewed, which may occur with printer plots or pictures.
|
|
.PP
|
|
Typically, text files are reduced to 60-75% of their original size.
|
|
Load modules, which use a larger character set and have a more
|
|
uniform distribution of characters, show little compression, the
|
|
packed versions being about 90% of the original size.
|
|
.PP
|
|
.I pack\^
|
|
returns a value that is the number of files that it failed to
|
|
compress.
|
|
.PP
|
|
No packing will occur if:
|
|
.PP
|
|
.RS
|
|
the file appears to be already packed;
|
|
.br
|
|
the file has links;
|
|
.br
|
|
the file is a directory;
|
|
.br
|
|
the file cannot be opened;
|
|
.br
|
|
no disk storage blocks will be saved by packing;
|
|
.br
|
|
a file called
|
|
.IB name .z
|
|
already exists;
|
|
.br
|
|
the
|
|
.B .z
|
|
file cannot be created;
|
|
.br
|
|
an I/O error occurred during processing.
|
|
.PP
|
|
.RE
|
|
Directories cannot be compressed.
|
|
.br
|
|
.ne 10
|
|
.PP
|
|
.I Pcat\^
|
|
does for packed files what
|
|
.IR cat (1)
|
|
does for ordinary files,
|
|
except that
|
|
.I pcat\^
|
|
cannot be used as a filter.
|
|
The specified files are unpacked and written to the standard output.
|
|
Thus to view a packed file named
|
|
.IB name .z
|
|
use:
|
|
.PP
|
|
.RS
|
|
pcat name.z
|
|
.RE
|
|
or just:
|
|
.RS
|
|
pcat name
|
|
.PP
|
|
.RE
|
|
To make an unpacked copy, say
|
|
.IR nnn ,
|
|
of a packed file named
|
|
.IB name .z
|
|
(without destroying
|
|
\f2name\^\fP\f3.z\fP)
|
|
use the command:
|
|
.PP
|
|
.RS
|
|
pcat name >nnn
|
|
.PP
|
|
.RE
|
|
.I Pcat\^
|
|
returns the number of files it was unable
|
|
to unpack.
|
|
Failure may occur if:
|
|
.PP
|
|
.RS
|
|
.br
|
|
the file cannot be opened;
|
|
.br
|
|
the file does not appear to be the output of
|
|
.IR pack .
|
|
.RE
|
|
.PP
|
|
.I Unpack\^
|
|
expands files created by
|
|
.IR pack .
|
|
For each file
|
|
.I name\^
|
|
specified in the command, a search is made for a file called
|
|
.IB name .z
|
|
(or just
|
|
.IR name ,
|
|
if
|
|
.I name\^
|
|
ends in
|
|
.BR .z ).
|
|
If this file appears to be a packed file, it is replaced by
|
|
its expanded version.
|
|
The new file has the
|
|
.B .z
|
|
suffix stripped from its name, and has the same access modes,
|
|
access and modification dates, and owner as those of the packed file.
|
|
.PP
|
|
.I Unpack\^
|
|
returns a value that is the number of files it was unable
|
|
to unpack.
|
|
Failure may occur for the same reasons that it may in
|
|
.IR pcat ,
|
|
as well as for the following:
|
|
.PP
|
|
.RS
|
|
a file with the ``unpacked'' name already exists;
|
|
.br
|
|
if the unpacked file cannot be created.
|
|
.PP
|
|
.RE
|
|
.SH "NOTES"
|
|
The suffix
|
|
.B "\&.z"
|
|
is used by the commands
|
|
.I pack/unpack.
|
|
The suffix
|
|
.B "\&.Z"
|
|
is used by the commands
|
|
.I compress/uncompress.
|
|
The suffix
|
|
.B "\&.gz"
|
|
is used by the commands
|
|
.I gzip/gunzip.
|
|
.SH "SEE ALSO"
|
|
compress(1), uncompress(1), cat(1), gzip(1), gunzip(1).
|
|
.\" @(#)pack.1 6.2 of 9/2/83
|
|
.Ee
|
|
'\".so /pubs/tools/origin.att
|