freeze

Compress and uncompress files (UNIX)

Syntax:

freeze [-cdfvVz] [[+n1,...,n8] [filename]]...

Runs on:

QNX Neutrino

Options:

-c
Write the results of the freeze/melt operation to standard output. No files are changed.
-d
Uncompress the files from the archive (melt).
-f
Force creation of the .F file. This option creates the .F file, even if one already existed, without prompting you for confirmation. The .F file is created even if the compressed file is larger than the original.
-V
Display the program's version number and compilation options.
-v
Display a counter. For each file being frozen, display a kilobytes counter, and, after the file is frozen, print a message giving the percentage of the input file's size that has been saved by compression.
-z
If the output of a melt (option -d) is to a tty, allocate a larger output buffer so screen output is in fullscreen chunks.
+n1,...,n8
A list of 8 numbers separated by commas, specifying the values for the static Huffman table.

Description:

The freeze utility compresses the specified files or the standard input. If a file becomes smaller, it's replaced by a file with the extension .F (you can use the -f option to force the creation of the .F file, even if the compressed file is larger). If no files are specified, the compression is applied to the standard input and is written to the standard output.

If you don't specify the -f option, and you run freeze in the foreground, you're prompted as to whether the file should be overwritten.

CAUTION:
When a .F file is created, the original file is removed.

Normally there are several links set up to the freeze utility. Freeze behaves differently when invoked under these command names:

This link: Is equivalent to:
melt freeze -d
fcat freeze -cd

You can restore compressed files to their original form by:

When you specify filenames, freeze maintains the ownership, modes, access times, and modification times between the file and its .F version. As a result, you can use freeze for archival purposes, yet you can still use it with make after melting.

The freeze utility uses the Lempel-Ziv algorithm on the first pass and the dynamic Huffman algorithm on the second pass. The size of "sliding window" is 8K and the maximum length of "matched string" is 256. The positions on the window are coded using a static Huffman table.

A two-byte magic number is prepended to the file to ensure that neither melting of random text nor refreezing of already frozen text is attempted. In addition, the characteristics of the static Huffman table being used during the freeze are written to the file so that these characteristics may be adapted to concrete conditions.

The amount of compression you obtain depends on the size of the input file and the distribution of character substrings and their probabilities. Typically, text files (e.g. C programs) are reduced by 60% to 75%, while executable files are reduced by 50%. Compression is generally much better than that achieved by LZW coding or by Huffman coding, although it takes more time to compute.

An argument preceded by a + defines the values to use for the Huffman table. You may want to explicitly state these values in order to modify the compression algorithm.

Note: The freeze compression utility will eventually become deprecated in favor of the GNU zip suite, gzip/gunzip/zcat. The freeze suite of utilities will continue to be provided for quite some time before being eliminated completely.

Examples:

Freeze all files in the current directory:

freeze *

Extract all C source and header files:

melt *.[ch].F

Or:

freeze -d *.[ch].F

View the concatenated contents of all compressed files in the current directory:

fcat *.F | more

Exit status:

0
Normal exit.
1
An error occurred.
2
The last file grew after freezing.

Contributing author:

Leonid A. Broukhis