9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man1 / pack.1
blob08e885a3ddec479d3c720f3292749486a179396c
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
46 .\"
47 .TH PACK 1 "Mar 13, 2008"
48 .SH NAME
49 pack, pcat, unpack \- compress and expand files
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fBpack\fR [\fB-f/\fR] [\fB-\fR] \fIfile\fR...
54 .fi
56 .LP
57 .nf
58 \fBpcat\fR \fIfile\fR...
59 .fi
61 .LP
62 .nf
63 \fBunpack\fR [\fB-/\fR] \fIfile\fR...
64 .fi
66 .SH DESCRIPTION
67 .SS "pack"
68 .sp
69 .LP
70 The \fBpack\fR command attempts to store the specified files in a compressed
71 form. Wherever possible (and useful), each input file \fBfile\fR is replaced by
72 a packed file \fBfile\fR\fB\&.z\fR with the same access modes, access and
73 modified dates, and owner as those of \fBfile\fR. If \fBpack\fR is successful,
74 \fBfile\fR is removed.
75 .sp
76 .LP
77 The amount of compression obtained depends on the size of the input file and
78 the character frequency distribution. Because a decoding tree forms the first
79 part of each \fB\&.z\fR file, it is usually not worthwhile to pack files
80 smaller than three blocks, unless the character frequency distribution is very
81 skewed, which can occur with printer plots or pictures.
82 .sp
83 .LP
84 Typically, text files are reduced to 60-75% of their original size. Load
85 modules, which use a larger character set and have a more uniform distribution
86 of characters, show little compression, the packed versions being about 90% of
87 the original size.
88 .sp
89 .LP
90 The \fBpack\fR utility returns a value that is the number of files that it
91 failed to compress. If that number exceeds \fB255\fR, \fB255\fR is returned.
92 .sp
93 .LP
94 No packing occurs if:
95 .RS +4
96 .TP
97 .ie t \(bu
98 .el o
99 the file appears to be already packed
101 .RS +4
103 .ie t \(bu
104 .el o
105 the file name is too long to add the \fB\&.z\fR suffix
107 .RS +4
109 .ie t \(bu
110 .el o
111 the file has links
113 .RS +4
115 .ie t \(bu
116 .el o
117 the file is a directory
119 .RS +4
121 .ie t \(bu
122 .el o
123 the file cannot be opened
125 .RS +4
127 .ie t \(bu
128 .el o
129 the file is empty
131 .RS +4
133 .ie t \(bu
134 .el o
135 no disk storage blocks are saved by packing
137 .RS +4
139 .ie t \(bu
140 .el o
141 a file called \fBfile\fR\fB\&.z\fR already exists
143 .RS +4
145 .ie t \(bu
146 .el o
147 the \fB\&.z\fR file cannot be created
149 .RS +4
151 .ie t \(bu
152 .el o
153 an I/O error occurred during processing.
157 The last segment of the file name must be short enough to allow space for the
158 appended \fB\&.z\fRextension. Directories cannot be compressed.
159 .SS "pcat"
162 The \fBpcat\fR command does for packed files what \fBcat\fR(1) does for
163 ordinary files, except that \fBpcat\fR cannot be used as a filter. The
164 specified files are unpacked and written to the standard output.
167 \fBpcat\fR returns the number of files it was unable to unpack. Failure can
168 occur if:
169 .RS +4
171 .ie t \(bu
172 .el o
173 the file cannot be opened;
175 .RS +4
177 .ie t \(bu
178 .el o
179 the file does not appear to be the output of \fBpack\fR.
181 .SS "unpack"
184 The \fBunpack\fR command expands files created by \fBpack\fR. For each
185 \fBfile\fR specified in the command, a search is made for a file called
186 \fBfile\fR\fB\&.z\fR (or just \fBfile\fR, if \fBfile\fR ends in \fB\&.z\fR). If
187 this file appears to be a packed file, it is replaced by its expanded version.
188 The new file has the \fB\&.z\fR suffix stripped from its name, and has the same
189 access modes, access and modification dates, and owner as those of the packed
190 file.
193 \fBunpack\fR returns a value that is the number of files it was unable to
194 unpack. Failure can occur for the same reasons that it can in \fBpcat\fR, as
195 well as for the following:
196 .RS +4
198 .ie t \(bu
199 .el o
200 a file with the unpacked name already exists;
202 .RS +4
204 .ie t \(bu
205 .el o
206 the unpacked file cannot be created.
208 .SH OPTIONS
211 The following options are supported by \fBpack\fR:
213 .ne 2
215 \fB\fB-f\fR\fR
217 .RS 6n
218 Forces packing of \fBfile\fR. This is useful for causing an entire directory to
219 be packed even if some of the files do not benefit. Packed files can be
220 restored to their original form using \fBunpack\fR or \fBpcat\fR.
225 The following options are supported by \fBpack\fR and \fBunpack\fR:
227 .ne 2
229 \fB\fB-/\fR\fR
231 .RS 6n
232 When packing or unpacking, copies any ACL and extended system attributes
233 associated with the source file to the target file. If an ACL or extended
234 system attributes cannot be copied, the original file is retained, a diagnostic
235 message is written to \fBstderr\fR, and the final exit status is
236 \fBnon-zero\fR.
239 .SH OPERANDS
242 The following operands are supported:
244 .ne 2
246 \fB\fBfile\fR\fR
248 .RS 8n
249 A path name of a file to be packed, unpacked, or pcated; \fBfile\fR can include
250 or omit the \fB\&.z\fR suffix.
254 .ne 2
256 \fB\fB\(mi\fR\fR
258 .RS 8n
259 \fBpack\fR uses Huffman (minimum redundancy) codes on a byte-by-byte basis. If
260 the \fB\(mi\fR argument is used, an internal flag is set that causes the number
261 of times each byte is used, its relative frequency, and the code for the byte
262 to be printed on the standard output. Additional occurrences of \fB\(mi\fR in
263 place of \fBfile\fR causes the internal flag to be set and reset.
266 .SH USAGE
269 See \fBlargefile\fR(5) for the description of the behavior of \fBpack\fR,
270 \fBpcat\fR, and \fBunpack\fR when encountering files greater than or equal to 2
271 Gbyte ( 2^31 bytes).
272 .SH EXAMPLES
274 \fBExample 1 \fRViewing a Packed File
277 To view a packed file named \fBfile.z\fR use:
281 \fBexample%\fR \fBpcat\fR \fBfile.z\fR
285 or just:
289 \fBexample%\fR \fBpcat\fR \fBfile\fR
292 \fBExample 2 \fRMaking and Unpacked Copy:
295 To make an unpacked copy, say \fBnnn\fR, of a packed file named \fBfile.z\fR
296 (without destroying \fBfile.z\fR) use the command:
300 \fBexample%\fR \fBpcat\fR \fBfile\fR \fB>nnn\fR
302 .SH ENVIRONMENT VARIABLES
305 See \fBenviron\fR(5) for descriptions of the following environment variables
306 that affect the execution of \fBpack\fR, \fBpcat\fR, and \fBunpack\fR:
307 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
308 .SH EXIT STATUS
311 The following exit values are returned:
313 .ne 2
315 \fB\fB0\fR\fR
317 .RS 6n
318 Successful completion.
322 .ne 2
324 \fB\fB>0\fR\fR
326 .RS 6n
327 An error occurred. The number of files the command failed to pack/unpack is
328 returned. If the number of failures exceeds \fB255\fR, then \fB255\fR is
329 returned.
332 .SH ATTRIBUTES
335 See \fBattributes\fR(5) for descriptions of the following attributes:
340 box;
341 c | c
342 l | l .
343 ATTRIBUTE TYPE  ATTRIBUTE VALUE
345 CSI     Enabled
348 .SH SEE ALSO
351 \fBcat\fR(1), \fBcompress\fR(1), \fBzcat\fR(1), \fBfgetattr\fR(3C),
352 \fBfsetattr\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5)