pack

compress files by Huffman encoding

Command


SYNOPSIS

pack [[-] [-f] [-o file] file] ...


DESCRIPTION

pack compresses argument files using a Huffman minimal redundancy code on a byte basis. By default, compressed files have a .z extension appended to the file name, but keep the same owner, permissions, last access time, and last modification time. For example, abc is compressed into abc.z. pack appends the .z to the end of files even if they already have suffixes. For example abc.txt is compressed into abc.txt.z.

Packed files can be identified by file and uncompressed by unpack (which unpacks the file in place) or pcat (which unpacks to the standard output).

Normally pack reports the degree of compression achieved in each file (the report is printed on the standard output). This number can be negative for small files with little redundancy if the -f option is used.

pack refuses to pack a file for the following reasons:

Options

-

displays more detail on size, overhead and entropy (information rate). If this option is used several times on the command line it acts as a toggle, inverting the detailed-report flag at each mention.

-f

forces compression when it normally would not occur. Without this option, pack does not compress a file if its size is not reduced by compression, the file is already compressed, or the file has more than one link.

-o file

specifies a different output file so that compressed output is written to file rather than overwriting the original input file. Several input and output files may be specified. For example,

pack -o out1 in1 -o out2 in2

packs file in1 into out1 and file in2 into out2. The input files are not changed.


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

1

An error occurred related to manipulating (opening, closing, renaming) the file, or a single file could not be packed properly (see n).

n

Indicates that n files could not be packed properly. For example, if three out of six files could not be packed properly, the exit status is 3. Possible reasons for failure include:

— unknown command line option
— inability to open a file for reading or writing
— file is not a regular file
— file has more than one link
— file is already packed
— packed file is not smaller than unpacked one
— file is too large to pack in place
— seek on a file failed
— read or write error occurred
— truncate operation failed
pack could not set the modified time of a packed file

file: no saving

The file is too small or uniform to benefit from packing. The file can be packed anyway using the -f option.

file: already packed

The file appears to be a packed file. It can be packed nonetheless by specifying the -f option.

file: has links

The file has more than one link. Override with the -f option.

file: directory

pack refuses to modify directories.

file: empty

The file is empty.

file: can't pack in place

The file is too large to pack in place. You must specify an output file using the -o option.

Interrupt

If you press BREAK while pack is in operation, it does not stop immediately; if it did, it would leave you with a corrupted file. Thus pack just displays this message to show that the BREAK has been received and it stops as soon as it is safe to do so.

Other messages, about inaccessibility of files and so on, are self-explanatory. The exit status is the number of file arguments which could not be processed.


PORTABILITY

x/OPEN Portability Guide 4.0.

The -o option is an extension to x/OPEN.


SEE ALSO

Commands:
file, pcat, unpack


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]