[BACK]Return to compress.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / compress

Annotation of src/usr.bin/compress/compress.1, Revision 1.1

1.1     ! deraadt     1: .\"    $NetBSD: compress.1,v 1.5 1995/03/26 09:44:34 glass Exp $
        !             2: .\"
        !             3: .\" Copyright (c) 1986, 1990, 1993
        !             4: .\"    The Regents of the University of California.  All rights reserved.
        !             5: .\"
        !             6: .\" This code is derived from software contributed to Berkeley by
        !             7: .\" James A. Woods, derived from original work by Spencer Thomas
        !             8: .\" and Joseph Orost.
        !             9: .\"
        !            10: .\" Redistribution and use in source and binary forms, with or without
        !            11: .\" modification, are permitted provided that the following conditions
        !            12: .\" are met:
        !            13: .\" 1. Redistributions of source code must retain the above copyright
        !            14: .\"    notice, this list of conditions and the following disclaimer.
        !            15: .\" 2. Redistributions in binary form must reproduce the above copyright
        !            16: .\"    notice, this list of conditions and the following disclaimer in the
        !            17: .\"    documentation and/or other materials provided with the distribution.
        !            18: .\" 3. All advertising materials mentioning features or use of this software
        !            19: .\"    must display the following acknowledgement:
        !            20: .\"    This product includes software developed by the University of
        !            21: .\"    California, Berkeley and its contributors.
        !            22: .\" 4. Neither the name of the University nor the names of its contributors
        !            23: .\"    may be used to endorse or promote products derived from this software
        !            24: .\"    without specific prior written permission.
        !            25: .\"
        !            26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            29: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            36: .\" SUCH DAMAGE.
        !            37: .\"
        !            38: .\"     @(#)compress.1 8.2 (Berkeley) 4/18/94
        !            39: .\"
        !            40: .Dd April 18, 1994
        !            41: .Dt COMPRESS 1
        !            42: .Os BSD 4.3
        !            43: .Sh NAME
        !            44: .Nm compress ,
        !            45: .\".Nm uncompress ,
        !            46: .Nm uncompress
        !            47: .\".Nm zcat
        !            48: .Nd compress and expand data
        !            49: .Sh SYNOPSIS
        !            50: .Nm compress
        !            51: .Op Fl cfv
        !            52: .Op Fl b Ar bits
        !            53: .Op Ar
        !            54: .Nm uncompress
        !            55: .Op Fl cfv
        !            56: .Op Ar
        !            57: .\".Nm zcat
        !            58: .\".Op Ar
        !            59: .Sh DESCRIPTION
        !            60: .Nm Compress
        !            61: reduces the size of the named files using adaptive Lempel-Ziv coding.
        !            62: Each
        !            63: .Ar file
        !            64: is renamed to the same name plus the extension
        !            65: .Dq .Z .
        !            66: As many of the modification time, access time, file flags, file mode,
        !            67: user ID, and group ID as allowed by permissions are retained in the
        !            68: new file.
        !            69: If compression would not reduce the size of a
        !            70: .Ar file ,
        !            71: the file is ignored.
        !            72: .Pp
        !            73: .Nm Uncompress
        !            74: restores the compressed files to their original form, renaming the
        !            75: files by deleting the
        !            76: .Dq .Z
        !            77: extension.
        !            78: .\".Pp
        !            79: .\".Nm Zcat
        !            80: .\"is an alias for
        !            81: .\".Dq "uncompress -c" .
        !            82: .Pp
        !            83: If renaming the files would cause files to be overwritten and the standard
        !            84: input device is a terminal, the user is prompted (on the standard error
        !            85: output) for confirmation.
        !            86: If prompting is not possible or confirmation is not received, the files
        !            87: are not overwritten.
        !            88: .Pp
        !            89: If no files are specified, the standard input is compressed or uncompressed
        !            90: to the standard output.
        !            91: If either the input and output files are not regular files, the checks for
        !            92: reduction in size and file overwriting are not performed, the input file is
        !            93: not removed, and the attributes of the input file are not retained.
        !            94: .Pp
        !            95: The options are as follows:
        !            96: .Bl -tag -width Ds
        !            97: .It Fl b
        !            98: Specify the
        !            99: .Ar bits
        !           100: code limit (see below).
        !           101: .It Fl c
        !           102: Compressed or uncompressed output is written to the standard output.
        !           103: No files are modified.
        !           104: .It Fl f
        !           105: Force compression of
        !           106: .Ar file ,
        !           107: even if it is not actually reduced in size.
        !           108: Additionally, files are overwritten without prompting for confirmation.
        !           109: .It Fl v
        !           110: Print the percentage reduction of each file.
        !           111: .El
        !           112: .Pp
        !           113: .Nm Compress
        !           114: uses a modified Lempel-Ziv algorithm.
        !           115: Common substrings in the file are first replaced by 9-bit codes 257 and up.
        !           116: When code 512 is reached, the algorithm switches to 10-bit codes and
        !           117: continues to use more bits until the
        !           118: limit specified by the
        !           119: .Fl b
        !           120: flag is reached (the default is 16).
        !           121: .Ar Bits
        !           122: must be between 9 and 16.
        !           123: .Pp
        !           124: After the
        !           125: .Ar bits
        !           126: limit is reached,
        !           127: .Nm compress
        !           128: periodically checks the compression ratio.
        !           129: If it is increasing,
        !           130: .Nm compress
        !           131: continues to use the existing code dictionary.
        !           132: However, if the compression ratio decreases,
        !           133: .Nm compress
        !           134: discards the table of substrings and rebuilds it from scratch.  This allows
        !           135: the algorithm to adapt to the next "block" of the file.
        !           136: .Pp
        !           137: The
        !           138: .Fl b
        !           139: flag is omitted for
        !           140: .Ar uncompress
        !           141: since the
        !           142: .Ar bits
        !           143: parameter specified during compression
        !           144: is encoded within the output, along with
        !           145: a magic number to ensure that neither decompression of random data nor
        !           146: recompression of compressed data is attempted.
        !           147: .Pp
        !           148: .ne 8
        !           149: The amount of compression obtained depends on the size of the
        !           150: input, the number of
        !           151: .Ar bits
        !           152: per code, and the distribution of common substrings.
        !           153: Typically, text such as source code or English is reduced by 50\-60%.
        !           154: Compression is generally much better than that achieved by Huffman
        !           155: coding (as used in the historical command pack), or adaptive Huffman
        !           156: coding (as used in the historical command compact), and takes less
        !           157: time to compute.
        !           158: .Pp
        !           159: The
        !           160: .Nm compress
        !           161: utility exits 0 on success, and >0 if an error occurs.
        !           162: .Sh SEE ALSO
        !           163: .Xr zcat 1
        !           164: .Rs
        !           165: .%A Welch, Terry A.
        !           166: .%D June, 1984
        !           167: .%T "A Technique for High Performance Data Compression"
        !           168: .%J "IEEE Computer"
        !           169: .%V 17:6
        !           170: .%P pp. 8-19
        !           171: .Re
        !           172: .Sh HISTORY
        !           173: The
        !           174: .Nm
        !           175: command appeared in
        !           176: .Bx 4.3 .