pack(1) CLIX pack(1)
NAME
pack, pcat, unpack - Compresses/expands files
SYNOPSIS
pack [-] [-f] name ...
pcat name ...
unpack name ...
FLAGS
- Sets an internal flag that determines the number of times each byte
is used, its relative frequency, and the code for the byte that is
displayed on stdout. Additional occurrences of - in place of name
will cause the internal flag to be set and reset.
-f Forces the packing of name. This is useful for packing an entire
directory even if some of the files will not benefit.
DESCRIPTION
The pack command attempts to store the specified files in a compressed
form. Wherever possible (and useful), each input file name is replaced by
a packed file name.z with the same access modes, access and modified
dates, and owner as those of name. If pack is successful, name will be
removed. Packed files can be restored to their original form using unpack
or pcat
The pack command uses Huffman (minimum redundancy) codes on a byte-by-byte
basis. 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 .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.
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.
The pack command returns a value that is the number of files that it
failed to compress.
The last segment of the filename must contain no more than 12 characters
to allow space for the appended .z extension. Directories cannot be
compressed.
2/94 - Intergraph Corporation 1
pack(1) CLIX pack(1)
The pcat command does for packed files what cat does for ordinary files,
except that pcat cannot be used as a filter. The specified files are
unpacked and written to stdout. Thus to view a packed file named name.z
use:
pcat name.z
or just:
pcat name
To make an unpacked copy, say nnn of a packed file named name.z (without
destroying name.z), use the command:
pcat name >nnn
The pcat command returns the number of files it was unable to unpack.
Failure may occur if:
⊕ The filename (exclusive of the .z) has more than 12 characters;
⊕ The file cannot be opened;
⊕ The file does not appear to be the output of pack.
The unpack command expands files created by pack. For each filename
specified in the command, a search is made for a file called name.z (or
just name, if name ends in .z). If this file appears to be a packed file,
it is replaced by its expanded version. The new file has the .z suffix
stripped from its name, and has the same access modes, access and
modification dates, and owner as those of the packed file.
The unpack command 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
pcat. In addition, if a file with the ``unpacked'' name already exists
then the unpacked file cannot be created.
DIAGNOSTICS
.z: write error
An error was encountered trying to write the output file.
: trivial file
The file consisted of only one character repeated.
: Huffman tree has too many levels
This file cannot be packed.
: no saving
No disk storage blocks will be saved by packing.
2 Intergraph Corporation - 2/94
pack(1) CLIX pack(1)
: filename too long
A filename cannot be longer than 12 bytes
: cannot open
The file does not exist or has incorrect permissions.
: cannot pack a directory
A directory cannot be packed.
: cannot pack a zero length file.
This message is self-explanatory.
: has links
A file that has links cannot be packed.
.z: already exists
A file exists in this directory with the filename created by
packing this file.
.z: cannot create
Either there is no space available or there is a permission
problem.
: can't change mode to mode
This message is self-explanatory.
: file unchanged
No packing was done.
EXIT VALUES
The pack command exits with a value of 0 if successful and reports error
numbers if not successful.
RELATED INFORMATION
Commands: cat(1)
2/94 - Intergraph Corporation 3