296 lines
10 KiB
HTML
296 lines
10 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>compress</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="compress"></a> <a name="tag_04_25"></a><!-- compress -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_25_01"></a>NAME</h4>
|
|
|
|
<blockquote>compress - compress data</blockquote>
|
|
|
|
<h4><a name="tag_04_25_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> compress</tt> <b>[</b><tt>-fv</tt><b>][</b><tt>-b</tt> <i>bits</i><b>][</b><i>file</i>
|
|
<tt>...</tt><b>]</b><tt><br>
|
|
<br>
|
|
compress</tt> <b>[</b><tt>-cfv</tt><b>][</b><tt>-b</tt> <i>bits</i><b>][</b><i>file</i><b>]</b><tt><img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_04_25_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>compress</i> utility shall attempt to reduce the size of the named files by using adaptive Lempel-Ziv coding algorithm.
|
|
<basefont size="2"></p>
|
|
|
|
<dl>
|
|
<dt><b>Note:</b></dt>
|
|
|
|
<dd>Lempel-Ziv is US Patent 4464650, issued to William Eastman, Abraham Lempel, Jacob Ziv, Martin Cohn on August 7th, 1984, and
|
|
assigned to Sperry Corporation.
|
|
|
|
<p>Lempel-Ziv-Welch compression is covered by US Patent 4558302, issued to Terry A. Welch on December 10th, 1985, and assigned to
|
|
Sperry Corporation.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<basefont size="3"> On systems not supporting adaptive Lempel-Ziv coding algorithm, the input files shall not be changed and an
|
|
error value greater than two shall be returned. Except when the output is to the standard output, each file shall be replaced by
|
|
one with the extension <b>.Z</b>. If the invoking process has appropriate privileges, the ownership, modes, access time, and
|
|
modification time of the original file are preserved. If appending the <b>.Z</b> to the filename would make the name exceed
|
|
{NAME_MAX} bytes, the command shall fail. If no files are specified, the standard input shall be compressed to the standard
|
|
output.</blockquote>
|
|
|
|
<h4><a name="tag_04_25_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>compress</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
|
|
|
|
<p>The following options shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-b </b> <i>bits</i></dt>
|
|
|
|
<dd>Specify the maximum number of bits to use in a code. For a conforming application, the <i>bits</i> argument shall be:
|
|
|
|
<pre>
|
|
<tt>9 <=</tt> <i>bits</i> <tt><= 14
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The implementation may allow <i>bits</i> values of greater than 14. The default is 14, 15, or 16.</p>
|
|
</dd>
|
|
|
|
<dt><b>-c</b></dt>
|
|
|
|
<dd>Cause <i>compress</i> to write to the standard output; the input file is not changed, and no <b>.Z</b> files are created.</dd>
|
|
|
|
<dt><b>-f</b></dt>
|
|
|
|
<dd>Force compression of <i>file</i>, even if it does not actually reduce the size of the file, or if the corresponding <i>file</i>
|
|
<b>.Z</b> file already exists. If the <b>-f</b> option is not given, and the process is not running in the background, the user is
|
|
prompted as to whether an existing <i>file</i> <b>.Z</b> file should be overwritten.</dd>
|
|
|
|
<dt><b>-v</b></dt>
|
|
|
|
<dd>Write the percentage reduction of each file to standard error.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following operand shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>file</i></dt>
|
|
|
|
<dd>A pathname of a file to be compressed.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard input shall be used only if no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt>
|
|
.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>If <i>file</i> operands are specified, the input files contain the data to be compressed.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>compress</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard
|
|
error.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd>Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>If no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt> , or if the <b>-c</b> option is specified,
|
|
the standard output contains the compressed output.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic and prompt messages and the output from <b>-v</b>.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>The output files shall contain the compressed output. The format of compressed files is unspecified and interchange of such
|
|
files between implementations (including access via unspecified file sharing mechanisms) is not required by
|
|
IEEE Std 1003.1-2001.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>Successful completion.</dd>
|
|
|
|
<dt> 1</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
|
|
<dt> 2</dt>
|
|
|
|
<dd>One or more files were not compressed because they would have increased in size (and the <b>-f</b> option was not
|
|
specified).</dd>
|
|
|
|
<dt>>2</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The input file shall remain unmodified.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_25_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The amount of compression obtained depends on the size of the input, the number of <i>bits</i> 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 better than
|
|
that achieved by Huffman coding or adaptive Huffman coding ( <i>compact</i>), and takes less time to compute.</p>
|
|
|
|
<p>Although <i>compress</i> strictly follows the default actions upon receipt of a signal or when an error occurs, some unexpected
|
|
results may occur. In some implementations it is likely that a partially compressed file is left in place, alongside its
|
|
uncompressed input file. Since the general operation of <i>compress</i> is to delete the uncompressed file only after the <b>.Z</b>
|
|
file has been successfully filled, an application should always carefully check the exit status of <i>compress</i> before
|
|
arbitrarily deleting files that have like-named neighbors with <b>.Z</b> suffixes.</p>
|
|
|
|
<p>The limit of 14 on the <i>bits</i> option-argument is to achieve portability to all systems (within the restrictions imposed by
|
|
the lack of an explicit published file format). Some implementations based on 16-bit architectures cannot support 15 or 16-bit
|
|
uncompression.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="uncompress.html"><i>uncompress</i></a> , <a href="zcat.html"><i>zcat</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_25_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The normative text is reworded to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>An error case is added for systems not supporting adaptive Lempel-Ziv coding.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|