home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / compre.zip / compress.man < prev    next >
Text File  |  1990-01-09  |  6KB  |  136 lines

  1. NAME
  2.      compress, uncompress, zcat  -  compress and uncompress files
  3.  
  4. SYNOPSIS
  5.      compress [ -c ] [ -C ] [ -d ] [ -f ] [ -v ] [ -b bits ] [ filename
  6.      ... ]
  7.      uncompress [ -c ] [ -f ] [ -v ] [ -V ] [ filename ... ]
  8.      zcat [ filename ... ]
  9.  
  10. DESCRIPTION
  11.      Compresses the specified files or standard input.  Each file
  12.      is replaced by a file with the extension .Z, but only if the
  13.      file got smaller.  If no files are specified, the compres-
  14.      sion is applied to the standard input and is written to
  15.      standard output regardless of the results.  Compressed files
  16.      can be restored to their original form by specifying the -d
  17.      option, or by running uncompress (linked to compress), on
  18.      the .Z files or the standard input.
  19.  
  20.      If the output file exists, it will not be overwritten unless
  21.      the -f flag is given.  If -f is not specified and compress
  22.      is run in the foreground, the user is prompted as to whether
  23.      the file should be overwritten.
  24.  
  25.      If the -f flag is given, all files specified are replaced
  26.      with .Z files - even if the file didn't get smaller.
  27.  
  28.      When file names are given, the ownership (if run by root),
  29.      modes, accessed and modified times are maintained between
  30.      the file and its .Z version.  In this respect, compress can
  31.      be used for archival purposes, yet can still be used with
  32.      make(1) after uncompression.
  33.  
  34.      The -c option causes the results of the compress/uncompress
  35.      operation to be written to stdout; no files are changed.
  36.      The zcat program is the same as specifying -c to uncompress
  37.      (all files are unpacked and written to stdout).
  38.  
  39.      Compress uses the modified Lempel-Ziv algorithm described in
  40.      "A Technique for High Performance Data Compression", Terry
  41.      A. Welch, IEEE Computer Vol 17, No 6 (June 1984), pp 8-19.
  42.      Common substrings in the file are first replaced by 9-bit
  43.      codes 257 and up.  When code 512 is reached, the algorithm
  44.      switches to 10-bit codes and continues to use more bits
  45.      until the bits limit as specified by the -b flag is reached
  46.      (default 16).  Bits must be between 9 and 16.  The default
  47.      can be changed in the source to allow compress to be run on
  48.      a smaller machine.
  49.  
  50.      After the bits limit is reached, compress periodically
  51.      checks the compression ratio.  If it is increasing, compress
  52.      continues to use the codes that were previously found in the
  53.      file.  However, if the compression ratio decreases, compress
  54.      discards the table of substrings and rebuilds it from
  55.      scratch.  This allows the algorithm to adapt to the next
  56.      "block" of the file.  The -C (compatibility) flag prevents
  57.      subdivision of the file into blocks; this produces an output
  58.      file that old versions of compress can read.
  59.  
  60.      A two byte magic number is prepended to the file to ensure
  61.      that neither uncompression of random text nor recompression
  62.      of compressed text are attempted.  In addition, the bits
  63.      specified during compress is written to the file so that the
  64.      -b flag can be omitted for uncompress.
  65.  
  66.      The amount of compression obtained depends on the size of
  67.      the input file, the amount of bits per code, and the distri-
  68.      bution of character substrings.  Typically, text files, such
  69.      as C programs, are reduced by 50-60%.  Compression is gen-
  70.      erally much better than that achieved by Huffman coding (as
  71.      used in pack), or adaptive Huffman coding (compact), and
  72.      takes less time to compute.
  73.  
  74.      If the -v (verbose) flag is given, then after each file is
  75.      compressed, a message is printed giving the percentage of
  76.      the input file that has been saved by compression.
  77.  
  78.      If the -V (version) flag is given, the program's version
  79.      number is printed.
  80.  
  81.      The exit status is normally 0; if the last file gets bigger
  82.      after compression, the exit status is 2; if an error occurs,
  83.      the exit status is 1.
  84.  
  85. SEE ALSO
  86.      compact(1), pack(1)
  87.  
  88. DIAGNOSTICS
  89.      Usage: compress [-cCdfvV] [-b maxbits] [file ...]
  90.              Invalid options were specified on the command line.
  91.      Missing maxbits
  92.              Maxbits must follow -b.
  93.      Unknown flag: 'x';
  94.              Invalid flags were specified on the command line.
  95.      file: not in compressed format
  96.              The specified file has not been compressed.
  97.      file: compressed with xx bits, can only handle yy bits
  98.              The specified file was compressed by a compress pro-
  99.              gram that could handle more bits than the current
  100.              compress program.  Recompress the file with a
  101.              smaller bits.
  102.      file: already has .Z suffix -- no change
  103.              Cannot compress a file that has a ".Z" suffix.
  104.              mv(1) the file to a different name and try again.
  105.  
  106.      file: filename too long to tack on .Z
  107.              The specified file cannot be compressed because its
  108.              filename is longer than 12 characters.  mv(1) the
  109.              file to a different name and try again.  This mes-
  110.              sage does not occur on 4.2BSD systems.
  111.      file already exists; do you wish to overwrite (y or n)?
  112.              Respond "y" if you want the output file to be
  113.              replaced; "n" if you want it to be left alone.
  114.      file:
  115.              This message fragment is written during the process-
  116.              ing of a file.
  117.      Compression: xx.xx%
  118.              This message fragment gives the percentage of the
  119.              input file that has been saved by compression.
  120.      -- not a regular file: unchanged
  121.              This message fragment is written when the input file
  122.              is not a regular file.  The input file is left
  123.              unchanged.
  124.      -- has xx other links: unchanged
  125.              This message fragment is written when the input file
  126.              has links.  The input file is left unchanged.  See
  127.              ln(1) for more information.
  128.      -- file unchanged
  129.              This message fragment is written when no savings are
  130.              achieved by compression.  The input file is left
  131.              unchanged.
  132.      -- replaced with file
  133.              This message fragment is written when a file has
  134.              been sucessfully compressed/uncompressed.
  135.  
  136.