Dec 122017
Compatible w/unix compress/uncompress. source for msc, unix, etc.
File COMPRESS.ZIP from The Programmer’s Corner in
Category C Source Code
Compatible w/unix compress/uncompress. source for msc, unix, etc.
File Name File Size Zip Size Zip Type
COMPRESS.C 54541 14216 deflated
COMPRESS.DOC 8071 2666 deflated
COMPRESS.EXE 19068 11833 deflated
COMPRESS.MAK 852 177 deflated

Download File COMPRESS.ZIP Here

Contents of the COMPRESS.DOC file

COMPRESS(1) MS-DOS Programmer's Manual COMPRESS(1)

compress, uncompress, zcat - compress or expand data

compress [-cdfivV] [-b bits] [name ...]
uncompress [-cfivV] [name ...]
zcat [-iV] [name ...]

Compress reduces the size of the named files using
adaptive Lempel-Ziv coding. Whenever possible, each
file is replaced by one with the extension .Z or XZ,
while keeping the same modification times. If no
files are specified, the standard input is
compressed to the standard output. Compressed files
can be restored to their original form using
uncompress or zcat.

The -c option makes compress/uncompress write to the
standard output; no files are changed. The
nondestructive behavior of zcat is identical to that
of uncompress -c.

The -d (decompress) option makes compress restore
its input files to their normal form. Uncompress is
identical to compress with the -d option specified.

The -f option will force compression of "name". This
is useful for compressing an entire directory, even
if some of the files do not actually shrink. If -f
is not given, the user is prompted as to whether an
existing file should be overwritten.

The -i (image mode) option suppresses the
transformation of text lines from MS-DOS (CR-LF
delimited) form to UNIX (LF delimited) form during
compression, and suppresses the reverse
transformation during decompression.

The -v (verbose) option causes a message to be
printed, yielding the percentage of reduction for
each file compressed.

COMPRESS(1) MS-DOS Programmer's Manual COMPRESS(1)

The -V option causes the current version and compile
options to be printed on stderr.

Compress uses the modified Lempel-Ziv algorithm
popularized in "A Technique for High Performance
Data Compression", Terry A. Welch, IEEE Computer,
vol. 17, no. 6 (June 1984), pp. 8-19. Common
substrings in the file are first replaced by 9-bit
codes 257 and up. When code 512 is reached, the
algorithm switches to 10-bit codes and continues to
use more bits until the limit specified by the -b
flag is reached (default is the maximum for which
the program was built).

"Bits" must be between 9 and the lesser of 16, and
the limit imposed at compile-time. The MS-DOS
version of compress comes in two sizes. One has a
12-bit limit, and will run in a machine with 128K
bytes of available user memory. The other has a
16-bit limit, and requires about 450K bytes to run.

After the "bits" limit is attained, compress
periodically checks the compression ratio. If it is
increasing, compress continues to use the existing
code dictionary. However, if the compression ratio
decreases, compress discards the table of substrings
and rebuilds it from scratch. This allows the
algorithm to adapt to the next "block" of the file.

Note that the -b flag is omitted for uncompress,
since the "bits" parameter specified during
compression is encoded within the output, along with
a magic number to ensure that neither decompression
of random data nor recompression of compressed data
is attempted.

The amount of compression obtained depends on the
size of the input, the number of "bits" per code,
and the distribution of common substrings.
Typically, text such as source code or English is
reduced by 50-60%. Compression is generally much

COMPRESS(1) MS-DOS Programmer's Manual COMPRESS(1)

better than that achieved by Huffman coding (as used
in SQ), and takes less time to compute.

Exit status is normally 0; if the last file is
larger after (attempted) compression, the status is
2; if an error occurs, exit status is 1.


Usage: compress [-cdfivV] [-b maxbits] [file ...]
Invalid options were specified on the command
Missing maxbits
Maxbits must follow -b.
file: not in compressed format
The file specified to UNCOMPRESS has not been
file: compressed with xx bits, can only handle yy bits
"File" was compressed by a program that could
deal with more "bits" than the compress code on
this machine. Recompress the file with smaller
file: already has xx suffix -- no change
The file is assumed to be already compressed
because the last two characters of its extension
are ".Z" or "XZ". Rename the file and try
fn: part of filename extension will be replaced by XZ
File name, fn, contains at least two characters
in the "extension" field. The second and third
will be replaced by "XZ" in the compressed
file's name.
fn already exists; do you wish to overwrite fn?
Respond "y" if you want the output file, fn, to
be replaced; "n" if not.
Compression: xx.xx%
Percentage of the input saved by compression.
(Relevant only for -v.)
-- file unchanged
No savings is achieved by compression. The

COMPRESS(1) MS-DOS Programmer's Manual COMPRESS(1)

input remains virgin.

Although compressed files are compatible between
machines with large memory, -b12 should be used for
file transfer to architectures with a small process
data space (64KB or less, as exhibited by the DEC
PDP series, or the small MS-DOS version, for

MS-DOS version 2 does not permit a program to
determine the name used to call it. As a result,
the aliases, uncompress and zcat, cannot be used.
They can be used under MS-DOS version 3, though the
actual file name for uncompress will be

MS-DOS does not support UNIX-style file links. As a
result, even though compress, uncompress and zcat
are all the same program, it (they) will have to be
stored three times, once under each of the three
names, in order to use them under MS-DOS version 3.
As explained in the previous paragraph, this is not
an option under MS-DOS version 2.


 December 12, 2017  Add comments

Leave a Reply