File: unzip.1

package info (click to toggle)
unzip 5.40-1
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 4,120 kB
  • ctags: 5,900
  • sloc: ansic: 40,977; cpp: 3,778; makefile: 1,384; asm: 1,228; sh: 133
file content (790 lines) | stat: -rw-r--r-- 38,338 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
.\" Info-ZIP grants permission to any individual or institution to use, copy,
.\" or redistribute this software, so long as:  (1) all of the original files
.\" are included; (2) it is not sold for profit; and (3) this notice is re-
.\" tained.  See the UnZip COPYING file for details.
.\"
.\" unzip.1 by Greg Roelofs, Fulvio Marino, Jim van Zandt and others.
.\"
.\" =========================================================================
.\" define .Y macro (for user-command examples; normal Courier font):
.de Y
.ft CW
.in +4n
.nf
\&\\$1
.ft
.in
.fi
..
.\" =========================================================================
.TH UNZIP 1L "28 November 1998 (v5.4)" "Info-ZIP"
.SH NAME
unzip \- list, test and extract compressed files in a ZIP archive
.PD
.SH SYNOPSIS
\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptuvz\fP[\fBabjnoqsCLMVX$\fP]]
\fIfile\fP[\fI.zip\fP] [\fIfile(s)\fP\ .\|.\|.]
[\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.] [\fB\-d\fP\ \fIexdir\fP]
.PD
.\" =========================================================================
.SH DESCRIPTION
\fIunzip\fP will list, test, or extract files from a ZIP archive, commonly
found on MS-DOS systems.  The default behavior (with no options) is to extract
into the current directory (and subdirectories below it) all files from the
specified ZIP archive.  A companion program, \fIzip\fP(1L), creates ZIP
archives; both programs are compatible with archives created by PKWARE's
\fIPKZIP\fP and \fIPKUNZIP\fP for MS-DOS, but in many cases the program
options or default behaviors differ.
.PD
.\" =========================================================================
.SH ARGUMENTS
.TP
.IR file [ .zip ]
Path of the ZIP archive(s).  If the file specification is a wildcard,
each matching file is processed in an order determined by the operating
system (or file system).  Only the filename can be a wildcard; the path
itself cannot.  Wildcard expressions are similar to Unix \fIegrep\fP(1)
(regular) expressions and may contain:
.RS
.IP *
matches a sequence of 0 or more characters
.IP ?
matches exactly 1 character
.IP [.\|.\|.]
matches any single character found inside the brackets; ranges are specified
by a beginning character, a hyphen, and an ending character.  If an exclamation
point or a caret (`!' or `^') follows the left bracket, then the range of
characters within the brackets is complemented (that is, anything \fIexcept\fP
the characters inside the brackets is considered a match).
.RE
.IP
(Be sure to quote any character that might otherwise be interpreted or
modified by the operating system, particularly under Unix and VMS.)  If no
matches are found, the specification is assumed to be a literal filename;
and if that also fails, the suffix \fC.zip\fR is appended.  Note that
self-extracting ZIP files are supported, as with any other ZIP archive;
just specify the \fC.exe\fR suffix (if any) explicitly.
.IP [\fIfile(s)\fP]
An optional list of archive members to be processed, separated by spaces.
(VMS versions compiled with VMSCLI defined must delimit files with commas
instead.  See \fB\-v\fP in \fBOPTIONS\fP below.)
Regular expressions (wildcards) may be used to match multiple members; see
above.  Again, be sure to quote expressions that would otherwise be expanded
or modified by the operating system.
.IP [\fB\-x\fP\ \fIxfile(s)\fP]
An optional list of archive members to be excluded from processing.
Since wildcard characters match directory separators (`/'), this option
may be used to exclude any files that are in subdirectories.  For
example, ``\fCunzip foo *.[ch] -x */*\fR'' would extract all C source files
in the main directory, but none in any subdirectories.  Without the \fB\-x\fP
option, all C source files in all directories within the zipfile would be
extracted.
.IP [\fB\-d\fP\ \fIexdir\fP]
An optional directory to which to extract files.  By default, all files
and subdirectories are recreated in the current directory; the \fB\-d\fP
option allows extraction in an arbitrary directory (always assuming one
has permission to write to the directory).  This option need not appear
at the end of the command line; it is also accepted before the zipfile
specification (with the normal options), immediately after the zipfile
specification, or between the \fIfile(s)\fP and the \fB\-x\fP option.
The option and directory may be concatenated without any white space
between them, but note that this may cause normal shell behavior to be
suppressed.  In particular, ``\fC\-d\ ~\fR'' (tilde) is expanded by Unix
C shells into the name of the user's home directory, but ``\fC\-d~\fR''
is treated as a literal subdirectory ``\fB~\fP'' of the current directory.
.\" =========================================================================
.SH OPTIONS
Note that, in order to support obsolescent hardware, \fIunzip\fP's usage
screen is limited to 22 or 23 lines and should therefore be considered
only a reminder of the basic \fIunzip\fP syntax rather than an exhaustive
list of all possible flags.  The exhaustive list follows:
.TP
.B \-Z
\fIzipinfo\fP(1L) mode.  If the first option on the command line is \fB\-Z\fP,
the remaining options are taken to be \fIzipinfo\fP(1L) options.  See the
appropriate manual page for a description of these options.
.TP
.B \-A
[OS/2, Unix DLL] print extended help for the DLL's programming interface (API).
.TP
.B \-c
extract files to stdout/screen (``CRT'').  This option is similar to the
\fB\-p\fP option except that the name of each file is printed as it is
extracted, the \fB\-a\fP option is allowed, and ASCII-EBCDIC conversion
is automatically performed if appropriate.  This option is not listed in
the \fIunzip\fP usage screen.
.TP
.B \-f
freshen existing files, i.e., extract only those files that
already exist on disk and that are newer than the disk copies.  By
default \fIunzip\fP queries before overwriting, but the \fB\-o\fP option
may be used to suppress the queries.  Note that under many operating systems,
the TZ (timezone) environment variable must be set correctly in order for
\fB\-f\fP and \fB\-u\fP to work properly (under Unix the variable is usually
set automatically).  The reasons for this are somewhat subtle but
have to do with the differences between DOS-format file times (always local
time) and Unix-format times (always in GMT/UTC) and the necessity to compare
the two.  A typical TZ value is ``PST8PDT'' (US Pacific time with automatic
adjustment for Daylight Savings Time or ``summer time'').
.TP
.B \-l
list archive files (short format).  The names, uncompressed file sizes and
modification dates and times of the specified files are printed, along
with totals for all files specified.  If UnZip was compiled with OS2_EAS
defined, the \fB\-l\fP option also lists columns for the sizes of stored
OS/2 extended attributes (EAs) and OS/2 access control lists (ACLs).  In
addition, the zipfile comment and individual file comments (if any) are
displayed.  If a file was archived from a single-case file system (for
example, the old MS-DOS FAT file system) and the \fB\-L\fP option was given,
the filename is converted to lowercase and is prefixed with a caret (^).
.TP
.B \-p
extract files to pipe (stdout).  Nothing but the file data is sent to
stdout, and the files are always extracted in binary format, just as they
are stored (no conversions).
.TP
.B \-t
test archive files.  This option extracts each specified file in memory
and compares the CRC (cyclic redundancy check, an enhanced checksum) of
the expanded file with the original file's stored CRC value.
.TP
.B \-T
[most OSes] set the timestamp on the archive(s) to that of the newest file
in each one.  This corresponds to \fIzip\fP's \fB\-go\fP option except that
it can be used on wildcard zipfiles (e.g., ``\fCunzip \-T \e*.zip\fR'') and
is much faster.
.TP
.B \-u
update existing files and create new ones if needed.  This option performs
the same function as the \fB\-f\fP option, extracting (with query) files
that are newer than those with the same name on disk, and in addition it
extracts those files that do not already exist on disk.  See \fB\-f\fP
above for information on setting the timezone properly.
.TP
.B \-v
be verbose or print diagnostic version info.  This option has evolved and
now behaves as both an option and a modifier.  As an option it has two
purposes:  when a zipfile is specified with no other options, \fB\-v\fP lists
archive files verbosely, adding to the basic \fB\-l\fP info the compression
method, compressed size, compression ratio and 32-bit CRC.  When no zipfile
is specified (that is, the complete command is simply ``\fCunzip \-v\fR''), a
diagnostic screen is printed.  In addition to the normal header with release
date and version, \fIunzip\fP lists the home Info-ZIP ftp site and where to
find a list of other ftp and non-ftp sites; the target operating system for
which it was compiled, as well as (possibly) the hardware on which it was
compiled, the compiler and version used, and the compilation date; any special
compilation options that might affect the program's operation (see also
\fBDECRYPTION\fP below); and any options stored in environment variables
that might do the same (see \fBENVIRONMENT OPTIONS\fP below).  As a
modifier it works in conjunction with other options (e.g., \fB\-t\fP) to
produce more verbose or debugging output; this is not yet fully implemented
but will be in future releases.
.TP
.B \-z
display only the archive comment.
.PD
.\" =========================================================================
.SH MODIFIERS
.TP
.B \-a
convert text files.  Ordinarily all files are extracted exactly as they
are stored (as ``binary'' files).  The \fB\-a\fP option causes files identified
by \fIzip\fP as text files (those with the `t' label in \fIzipinfo\fP
listings, rather than `b') to be automatically extracted as such, converting
line endings, end-of-file characters and the character set itself as necessary.
(For example, Unix files use line feeds (LFs) for end-of-line (EOL) and
have no end-of-file (EOF) marker; Macintoshes use carriage returns (CRs)
for EOLs; and most PC operating systems use CR+LF for EOLs and control-Z for
EOF.  In addition, IBM mainframes and the Michigan Terminal System use EBCDIC
rather than the more common ASCII character set, and NT supports Unicode.)
Note that \fIzip\fP's identification of text files is by no means perfect; some
``text'' files may actually be binary and vice versa.  \fIunzip\fP therefore
prints ``\fC[text]\fR'' or ``\fC[binary]\fR'' as a visual check for each file
it extracts when using the \fB\-a\fP option.  The \fB\-aa\fP option forces
all files to be extracted as text, regardless of the supposed file type.
.TP
.B \-b
[non-VMS] treat all files as binary (no text conversions).  This is a shortcut
for \fB\-\-\-a\fP.
.TP
.B \-b
[VMS] auto-convert binary files (see \fB\-a\fP above) to fixed-length,
512-byte record format.  Doubling the option (\fB\-bb\fP) forces all files
to be extracted in this format.
.TP
.B \-B
[Unix only, and only if compiled with UNIXBACKUP defined] save a backup copy
of each overwritten file with a tilde appended (e.g., the old copy of
``\fCfoo\fR'' is renamed to ``\fCfoo~\fR'').  This is similar to the default
behavior of \fIemacs\fP(1) in many locations.
.TP
.B \-C
match filenames case-insensitively.  \fIunzip\fP's philosophy is ``you get
what you ask for'' (this is also responsible for the \fB\-L\fP/\fB\-U\fP
change; see the relevant options below).  Because some file systems are fully
case-sensitive (notably those under the Unix operating system) and because
both ZIP archives and \fIunzip\fP itself are portable across platforms,
\fIunzip\fP's default behavior is to match both wildcard and literal filenames
case-sensitively.  That is, specifying ``\fCmakefile\fR'' on the command line
will \fIonly\fP match ``makefile'' in the archive, not ``Makefile'' or
``MAKEFILE'' (and similarly for wildcard specifications).  Since this does
not correspond to the behavior of many other operating/file systems (for
example, OS/2 HPFS, which preserves mixed case but is not sensitive to it),
the \fB\-C\fP option may be used to force all filename matches to be
case-insensitive.  In the example above, all three files would then match
``\fCmakefile\fR'' (or ``\fCmake*\fR'', or similar).  The \fB\-C\fP option
affects files in both the normal file list and the excluded-file list (xlist).
.TP
.B \-E
[MacOS only] display contents of MacOS extra field during restore operation.
.TP
.B \-F
[Acorn only] suppress removal of NFS filetype extension from stored filenames.
.TP
.B \-F
[Unix only, and only if compiled with ACORN_FTYPE_NFS defined] translate
filetype information from ACORN RISC OS extra field blocks into a
NFS filetype extension and append it to the names of the extracted files.
(When the stored filename appears to already have an appended NFS filetype
extension, it is replaced by the info from the extra field.)
.TP
.B \-i
[MacOS only] ignore filenames stored in MacOS extra fields. Instead, the
most compatible filename stored in the generic part of the entry's header
is used.
.TP
.B \-j
junk paths.  The archive's directory structure is not recreated; all files
are deposited in the extraction directory (by default, the current one).
.TP
.B \-J
[BeOS only] junk file attributes.  The file's BeOS file attributes are not
restored, just the file's data.
.TP
.B \-J
[MacOS only] ignore MacOS extra fields.  All Macintosh specific info
is skipped. Data-fork and resource-fork are restored as separate files.
.TP
.B \-L
convert to lowercase any filename originating on an uppercase-only operating
system or file system.  (This was \fIunzip\fP's default behavior in releases
prior to 5.11; the new default behavior is identical to the old behavior with
the \fB\-U\fP option, which is now obsolete and will be removed in a future
release.)  Depending on the archiver, files archived under single-case
file systems (VMS, old MS-DOS FAT, etc.) may be stored as all-uppercase names;
this can be ugly or inconvenient when extracting to a case-preserving
file system such as OS/2 HPFS or a case-sensitive one such as under
Unix.  By default \fIunzip\fP lists and extracts such filenames exactly as
they're stored (excepting truncation, conversion of unsupported characters,
etc.); this option causes the names of all files from certain systems to be
converted to lowercase.
.TP
.B \-M
pipe all output through an internal pager similar to the Unix\fImore\fP(1)
command.  At the end of a screenful of output, \fIunzip\fP pauses with a
``\-\-More\-\-'' prompt; the next screenful may be viewed by pressing the
Enter (Return) key or the space bar.  \fIunzip\fP can be terminated by
pressing the ``q'' key and, on some systems, the Enter/Return key.  Unlike
Unix \fImore\fP(1), there is no forward-searching or editing capability.
Also, \fIunzip\fP doesn't notice if long lines wrap at the edge of the screen,
effectively resulting in the printing of two or more lines and the likelihood
that some text will scroll off the top of the screen before being viewed.
On some systems the number of available lines on the screen is not detected,
in which case \fIunzip\fP assumes the height is 24 lines.
.TP
.B \-n
never overwrite existing files.  If a file already exists, skip the extraction
of that file without prompting.  By default \fIunzip\fP queries before
extracting any file that already exists; the user may choose to overwrite
only the current file, overwrite all files, skip extraction of the current
file, skip extraction of all existing files, or rename the current file.
.TP
.B \-N
[Amiga] extract file comments as Amiga filenotes.  File comments are created
with the \-c option of \fIzip\fP(1L), or with the \-N option of the Amiga port
of \fIzip\fP(1L), which stores filenotes as comments.
.TP
.B \-o
overwrite existing files without prompting.  This is a dangerous option, so
use it with care.  (It is often used with \fB\-f\fP, however, and is the only
way to overwrite directory EAs under OS/2.)
.TP
.IP \fB\-P\fP\ \fIpassword\fP
use \fIpassword\fP to decrypt encrypted zipfile entries (if any).  \fBTHIS IS
INSECURE!\fP  Many multi-user operating systems provide ways for any user to
see the current command line of any other user; even on stand-alone systems
there is always the threat of over-the-shoulder peeking.  Storing the plaintext
password as part of a command line in an automated script is even worse.
Whenever possible, use the non-echoing, interactive prompt to enter passwords.
(And where security is truly important, use strong encryption such as Pretty
Good Privacy instead of the relatively weak encryption provided by standard
zipfile utilities.)
.TP
.B \-q
perform operations quietly (\fB\-qq\fP = even quieter).  Ordinarily \fIunzip\fP
prints the names of the files it's extracting or testing, the extraction
methods, any file or zipfile comments that may be stored in the archive,
and possibly a summary when finished with each archive.  The \fB\-q\fP[\fBq\fP]
options suppress the printing of some or all of these messages.
.TP
.B \-s
[OS/2, NT, MS-DOS] convert spaces in filenames to underscores.  Since all PC
operating systems allow spaces in filenames, \fIunzip\fP by default extracts
filenames with spaces intact (e.g., ``\fCEA\ DATA.\ SF\fR'').  This can be
awkward, however, since MS-DOS in particular does not gracefully support
spaces in filenames.  Conversion of spaces to underscores can eliminate the
awkwardness in some cases.
.TP
.B \-U
(obsolete; to be removed in a future release) leave filenames uppercase if
created under MS-DOS, VMS, etc.  See \fB\-L\fP above.
.TP
.B \-V
retain (VMS) file version numbers.  VMS files can be stored with a version
number, in the format \fCfile.ext;##\fR.  By default the ``\fC;##\fR'' version
numbers are stripped, but this option allows them to be retained.  (On
file systems that limit filenames to particularly short lengths, the version
numbers may be truncated or stripped regardless of this option.)
.TP
.B \-X
[VMS, Unix, OS/2, NT] restore owner/protection info (UICs) under VMS, or user
and group info (UID/GID) under Unix, or access control lists (ACLs) under
certain network-enabled versions of OS/2 (Warp Server with IBM LAN
Server/Requester 3.0 to 5.0; Warp Connect with IBM Peer 1.0), or security ACLs
under Windows NT.  In most cases this will require special system privileges,
and doubling the option (\fB\-XX\fP) under NT instructs \fIunzip\fP to use
privileges for extraction; but under Unix, for example, a user who belongs to
several groups can restore files owned by any of those groups, as long as the
user IDs match his or her own.  Note that ordinary file attributes are always
restored--this option applies only to optional, extra ownership info available
on some operating systems.  [NT's access control lists do not appear to be
especially compatible with OS/2's, so no attempt is made at cross-platform
portability of access privileges.  It is not clear under what conditions this
would ever be useful anyway.]
.TP
.B \-$
.\" Amiga support possible eventually, but not yet
[MS-DOS, OS/2, NT] restore the volume label if the extraction medium is
removable (e.g., a diskette).  Doubling the option (\fB\-$$\fP) allows fixed
media (hard disks) to be labelled as well.  By default, volume labels are
ignored.
.PD
.\" =========================================================================
.SH "ENVIRONMENT OPTIONS"
\fIunzip\fP's default behavior may be modified via options placed in
an environment variable.  This can be done with any option, but it
is probably most useful with the \fB\-a\fP, \fB\-L\fP, \fB\-C\fP, \fB\-q\fP,
\fB\-o\fP, or \fB\-n\fP modifiers:  make \fIunzip\fP auto-convert text
files by default, make it convert filenames from uppercase systems to
lowercase, make it match names case-insensitively, make it quieter,
or make it always overwrite or never overwrite files as it extracts
them.  For example, to make \fIunzip\fP act as quietly as possible, only
reporting errors, one would use one of the following commands:
.PP
.DT
.ft CW
.in +4n
.ta \w'UNZIP=\-qq; export UNZIP'u+4n
.in
.ft
.PD 0
.Y "UNZIP=\-qq; export UNZIP\t\fRUnix Bourne shell"
.Y "setenv UNZIP \-qq\t\fRUnix C shell"
.Y "set UNZIP=\-qq\t\fROS/2 or MS-DOS"
.Y "define UNZIP_OPTS ""\-qq""\t\fRVMS (quotes for \fIlowercase\fP)"
.PD
.PP
Environment options are, in effect, considered to be just like any other
command-line options, except that they are effectively the first options
on the command line.  To override an environment option, one may use the
``minus operator'' to remove it.  For instance, to override one of the
quiet-flags in the example above, use the command
.PP
.Y "unzip \-\-q[\fIother options\fC] zipfile"
.PP
The first hyphen is the normal
switch character, and the second is a minus sign, acting on the q option.
Thus the effect here is to cancel one quantum of quietness.  To cancel
both quiet flags, two (or more) minuses may be used:
.PP
.PD 0
.Y "unzip \-t\-\-q zipfile"
.Y "unzip \-\-\-qt zipfile"
.PD
.PP
(the two are equivalent).  This may seem awkward
or confusing, but it is reasonably intuitive:  just ignore the first
hyphen and go from there.  It is also consistent with the behavior of
Unix \fInice\fP(1).
.PP
As suggested by the examples above, the default variable names are UNZIP_OPTS
for VMS (where the symbol used to install \fIunzip\fP as a foreign command
would otherwise be confused with the environment variable), and UNZIP
for all other operating systems.  For compatibility with \fIzip\fP(1L),
UNZIPOPT is also accepted (don't ask).  If both UNZIP and UNZIPOPT
are defined, however, UNZIP takes precedence.  \fIunzip\fP's diagnostic
option (\fB\-v\fP with no zipfile name) can be used to check the values
of all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
.PP
The timezone variable (TZ) should be set according to the local timezone
in order for the \fB\-f\fP and \fB\-u\fP to operate correctly.  See the
description of \fB\-f\fP above for details.  This variable may also be
necessary in order for timestamps on extracted files to be set correctly.
Under Windows 95/NT \fIunzip\fP should know the correct timezone even if
TZ is unset, assuming the timezone is correctly set in the Control Panel.
.PD
.\" =========================================================================
.SH DECRYPTION
Encrypted archives are fully supported by Info-ZIP software, but due to
United States export restrictions, the encryption and decryption sources
are not packaged with the regular \fIunzip\fP and \fIzip\fP distributions.
Since the crypt sources were written by Europeans, however, they are
freely available at sites throughout the world; see the file ``WHERE'' in
any Info-ZIP source or binary distribution for locations both inside and
outside the US.
.PP
Because of the separate distribution, not all compiled versions of \fIunzip\fP
support decryption.  To check a version for crypt support, either attempt to
test or extract an encrypted archive, or else check \fIunzip\fP's diagnostic
screen (see the \fB\-v\fP option above) for ``\fC[decryption]\fR'' as one of
the special compilation options.
.PP
As noted above, the \fB\-P\fP option may be used to supply a password on
the command line, but at a cost in security.  The preferred decryption
method is simply to extract normally; if a zipfile member is encrypted,
\fIunzip\fP will prompt for the password without echoing what is typed.
\fIunzip\fP continues to use the same password as long as it appears to be
valid, by testing a 12-byte header on each file.  The correct password will
always check out against the header, but there is a 1-in-256 chance that an
incorrect password will as well.  (This is a security feature of the PKWARE
zipfile format; it helps prevent brute-force attacks that might otherwise
gain a large speed advantage by testing only the header.)  In the case that
an incorrect password is given but it passes the header test anyway, either
an incorrect CRC will be generated for the extracted data or else \fIunzip\fP
will fail during the extraction because the ``decrypted'' bytes do not
constitute a valid compressed data stream.
.PP
If the first password fails the header check on some file, \fIunzip\fP will
prompt for another password, and so on until all files are extracted.  If
a password is not known, entering a null password (that is, just a carriage
return or ``Enter'') is taken as a signal to skip all further prompting.
Only unencrypted files in the archive(s) will thereafter be extracted.  (In
fact, that's not quite true; older versions of \fIzip\fP(1L) and
\fIzipcloak\fP(1L) allowed null passwords, so \fIunzip\fP checks each encrypted
file to see if the null password works.  This may result in ``false positives''
and extraction errors, as noted above.)
.PP
Archives encrypted with 8-bit passwords (for example, passwords with accented
European characters) may not be portable across systems and/or other
archivers.  This problem stems from the use of multiple encoding methods for
such characters, including Latin-1 (ISO 8859-1) and OEM code page 850.  DOS
\fIPKZIP\fP 2.04g uses the OEM code page; Windows \fIPKZIP\fP 2.50 uses
Latin-1 (and is therefore incompatible with DOS \fIPKZIP\fP); Info-ZIP uses
the OEM code page on DOS, OS/2 and Win3.x ports but Latin-1 everywhere
else; and Nico Mak's \fIWinZip\fP 6.x does not allow 8-bit passwords at all.
\fIUnZip\fP 5.3 attempts to use the default character set first (e.g.,
Latin-1), followed by the alternate one (e.g., OEM code page) to test
passwords.  On EBCDIC systems, if both of these fail, EBCDIC encoding will
be tested as a last resort.  (Since there are no known archivers that encrypt
using EBCDIC encoding, EBCDIC is not tested on non-EBCDIC systems.)  ISO
character encodings other than Latin-1 are not supported.
.PD
.\" =========================================================================
.SH EXAMPLES
To use \fIunzip\fP to extract all members of the archive \fIletters.zip\fP
into the current directory and subdirectories below it, creating any
subdirectories as necessary:
.PP
.Y "unzip letters"
.PP
To extract all members of \fIletters.zip\fP into the current directory only:
.PP
.Y "unzip -j letters"
.PP
To test \fIletters.zip\fP, printing only a summary message indicating
whether the archive is OK or not:
.PP
.Y "unzip -tq letters"
.PP
To test \fIall\fP zipfiles in the current directory, printing only the
summaries:
.PP
.Y "unzip -tq \e*.zip"
.PP
(The backslash before the asterisk is only required if the shell expands
wildcards, as in Unix; double quotes could have been used instead, as in
the source examples below.)\ \ To extract to standard output all members of
\fIletters.zip\fP whose names end in \fI.tex\fP, auto-converting to the
local end-of-line convention and piping the output into \fImore\fP(1):
.PP
.Y "unzip \-ca letters \e*.tex | more"
.PP
To extract the binary file \fIpaper1.dvi\fP to standard output and pipe it
to a printing program:
.PP
.Y "unzip \-p articles paper1.dvi | dvips"
.PP
To extract all FORTRAN and C source files--*.f, *.c, *.h, and Makefile--into
the /tmp directory:
.PP
.Y "unzip source.zip ""*.[fch]"" Makefile -d /tmp"
.PP
(the double quotes are necessary only in Unix and only if globbing is turned
on).  To extract all FORTRAN and C source files, regardless of case (e.g.,
both *.c and *.C, and any makefile, Makefile, MAKEFILE or similar):
.PP
.Y "unzip \-C source.zip ""*.[fch]"" makefile -d /tmp"
.PP
To extract any such files but convert any uppercase MS-DOS or VMS names to
lowercase and convert the line-endings of all of the files to the local
standard (without respect to any files that might be marked ``binary''):
.PP
.Y "unzip \-aaCL source.zip ""*.[fch]"" makefile -d /tmp"
.PP
To extract only newer versions of the files already in the current
directory, without querying (NOTE:  be careful of unzipping in one timezone a
zipfile created in another--ZIP archives other than those created by Zip 2.1
or later contain no timezone information, and a ``newer'' file from an eastern
timezone may, in fact, be older):
.PP
.Y "unzip \-fo sources"
.PP
To extract newer versions of the files already in the current directory and
to create any files not already there (same caveat as previous example):
.PP
.Y "unzip \-uo sources"
.PP
To display a diagnostic screen showing which \fIunzip\fP and \fIzipinfo\fP
options are stored in environment variables, whether decryption support was
compiled in, the compiler with which \fIunzip\fP was compiled, etc.:
.PP
.Y "unzip \-v"
.PP
In the last five examples, assume that UNZIP or UNZIP_OPTS is set to -q.
To do a singly quiet listing:
.PP
.Y "unzip \-l file.zip"
.PP
To do a doubly quiet listing:
.PP
.Y "unzip \-ql file.zip"
.PP
(Note that the ``\fC.zip\fR'' is generally not necessary.)  To do a standard
listing:
.PP
.PD 0
.Y "unzip \-\-ql file.zip"
.PP
or
.Y "unzip \-l\-q file.zip"
.PP
or
.Y "unzip \-l\-\-q file.zip\t\fR(extra minuses don't hurt)"
.PD
.\" =========================================================================
.SH TIPS
The current maintainer, being a lazy sort, finds it very useful to define
a pair of aliases:  \fCtt\fR for ``\fCunzip \-tq\fR'' and \fCii\fR for
``\fCunzip \-Z\fR'' (or ``\fCzipinfo\fR'').  One may then simply type
``\fCtt zipfile\fR'' to test an archive, something that is worth making a
habit of doing.  With luck \fIunzip\fP will report ``\fCNo errors detected
in compressed data of zipfile.zip\fR,'' after which one may breathe a sigh
of relief.
.PP
The maintainer also finds it useful to set the UNZIP environment variable
to ``\fC\-aL\fR'' and is tempted to add ``\fC\-C\fR'' as well.  His ZIPINFO
variable is set to ``\fC\-z\fR''.
.PD
.\" =========================================================================
.SH DIAGNOSTICS
The exit status (or error level) approximates the exit codes defined by PKWARE
and takes on the following values, except under VMS:
.RS
.IP 0
normal; no errors or warnings detected.
.IP 1
one or more warning errors were encountered, but processing completed
successfully anyway.  This includes zipfiles where one or more files
was skipped due to unsupported compression method or encryption with an
unknown password.
.IP 2
a generic error in the zipfile format was detected.  Processing may have
completed successfully anyway; some broken zipfiles created by other
archivers have simple work-arounds.
.IP 3
a severe error in the zipfile format was detected.  Processing probably
failed immediately.
.IP 4
\fIunzip\fP was unable to allocate memory for one or more buffers during
program initialization.
.IP 5
\fIunzip\fP was unable to allocate memory or unable to obtain a tty to read
the decryption password(s).
.IP 6
\fIunzip\fP was unable to allocate memory during decompression to disk.
.IP 7
\fIunzip\fP was unable to allocate memory during in-memory decompression.
.IP 8
[currently not used]
.IP 9
the specified zipfiles were not found.
.IP 10
invalid options were specified on the command line.
.IP 11
no matching files were found.
.IP 50
the disk is (or was) full during extraction.
.IP 51
the end of the ZIP archive was encountered prematurely.
.IP 80
the user aborted \fIunzip\fP prematurely with control-C (or similar)
.IP 81
testing or extraction of one or more files failed due to unsupported
compression methods or unsupported decryption.
.IP 82
no files were found due to bad decryption password(s).  (If even one file is
successfully processed, however, the exit status is 1.)
.RE
.PP
VMS interprets standard Unix (or PC) return values as other, scarier-looking
things, so \fIunzip\fP instead maps them into VMS-style status codes.  The
current mapping is as follows:   1 (success) for normal exit, 0x7fff0001
for warning errors, and (0x7fff000? + 16*normal_unzip_exit_status) for all
other errors, where the `?' is 2 (error) for \fIunzip\fP values 2, 9-11 and
80-82, and 4 (fatal error) for the remaining ones (3-8, 50, 51).  In addition,
there is a compilation option to expand upon this behavior:  defining
RETURN_CODES results in a human-readable explanation of what the error
status means.
.PD
.\" =========================================================================
.SH BUGS
Multi-part archives are not yet supported, except in conjunction with
\fIzip\fP.  (All parts must be concatenated together in order, and then
``\fCzip \-F\fR'' must be performed on the concatenated archive in order
to ``fix'' it.)  This will definitely be corrected in the next major release.
.PP
Archives read from standard input are not yet supported, except with
\fIfunzip\fP (and then only the first member of the archive can be extracted).
.PP
Archives encrypted with 8-bit passwords (e.g., passwords with accented
European characters) may not be portable across systems and/or other
archivers.  See the discussion in \fBDECRYPTION\fP above.
.PP
\fIunzip\fP's \fB\-M\fP (``more'') option is overly simplistic in its handling
of screen output; as noted above, it fails to detect the wrapping of long lines
and may thereby cause lines at the top of the screen to be scrolled off before
being read.  \fIunzip\fP should detect and treat each occurrence of line-wrap
as one additional line printed.  This requires knowledge of the screen's width
as well as its height.  In addition, \fIunzip\fP should detect the true screen
geometry on all systems.
.PP
Dates, times and permissions of stored directories are not restored except
under Unix.
.PP
[MS-DOS] When extracting or testing files from an archive on a defective
floppy diskette, if the ``Fail'' option is chosen from DOS's ``Abort, Retry,
Fail?'' message, older versions of \fIunzip\fP may hang the system, requiring
a reboot.  This problem appears to be fixed, but control-C (or control-Break)
can still be used to terminate \fIunzip\fP.
.PP
Under DEC Ultrix, \fIunzip\fP would sometimes fail on long zipfiles (bad CRC,
not always reproducible).  This was apparently due either to a hardware bug
(cache memory) or an operating system bug (improper handling of page faults?).
Since Ultrix has been abandoned in favor of Digital Unix (OSF/1), this may not
be an issue anymore.
.PP
[Unix] Unix special files such as FIFO buffers (named pipes), block devices
and character devices are not restored even if they are somehow represented
in the zipfile, nor are hard-linked files relinked.  Basically the only file
types restored by \fIunzip\fP are regular files, directories and symbolic
(soft) links.
.PP
[OS/2] Extended attributes for existing directories are only updated if the
\fB\-o\fP (``overwrite all'') option is given.  This is a limitation of the
operating system; because directories only have a creation time associated
with them, \fIunzip\fP has no way to determine whether the stored attributes
are newer or older than those on disk.  In practice this may mean a two-pass
approach is required:  first unpack the archive normally (with or without
freshening/updating existing files), then overwrite just the directory entries
(e.g., ``\fCunzip -o foo */\fR'').
.PP
[VMS] When extracting to another directory, only the \fI[.foo]\fP syntax is
accepted for the \fB\-d\fP option; the simple Unix \fIfoo\fP syntax is
silently ignored (as is the less common VMS \fIfoo.dir\fP syntax).
.PP
[VMS] When the file being extracted already exists, \fIunzip\fP's query only
allows skipping, overwriting or renaming; there should additionally be a
choice for creating a new version of the file.  In fact, the ``overwrite''
choice does create a new version; the old version is not overwritten or
deleted.
.PD
.\" =========================================================================
.SH "SEE ALSO"
\fIfunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipgrep\fP(1L),
\fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
.PD
.\" =========================================================================
.SH URL
The Info-ZIP home page is currently at \fChttp://www.cdrom.com/pub/infozip/\fR .
.PD
.\" =========================================================================
.SH AUTHORS
The primary Info-ZIP authors (current semi-active members of the Zip-Bugs
workgroup) are:  Greg ``Cave Newt'' Roelofs (UnZip); Onno van der Linden (Zip);
Jean-loup Gailly (compression); Mark Adler (decompression, fUnZip); Christian
Spieler (UnZip maintance coordination, VMS, MS-DOS, Windows 95, NT,
shared code, general Zip and UnZip integration and optimization);
Mike White (Windows GUI, Windows DLLs); Kai Uwe Rommel (OS/2);
Paul Kienitz (Amiga, Windows 95); Chris Herborth (BeOS, QNX, Atari);
Jonathan Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald
Denker (Atari, MVS); John Bush (Solaris, Amiga); Hunter Goatley (VMS); Steve
Salisbury (Windows 95, NT); Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS,
Windows 95, NT); and Dave Smith (Tandem NSK).
The author of the original unzip code upon which Info-ZIP's was based
is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
Kirschbaum organized and led Info-ZIP in its early days with Keith Petersen
hosting the original mailing list at WSMR-SimTel20.  The full list of
contributors to UnZip has grown quite large; please refer to the CONTRIBS
file in the UnZip source distribution for a relatively complete version.
.PD
.\" =========================================================================
.SH VERSIONS
.ta \w'vx.xxnn'u +\w'fall 1989'u+3n
.PD 0
.IP "v1.2\t15 Mar 89" \w'\t\t'u
Samuel H. Smith
.IP "v2.0\t\ 9 Sep 89"
Samuel H. Smith
.IP "v2.x\tfall 1989"
many Usenet contributors
.IP "v3.0\t\ 1 May 90"
Info-ZIP (DPK, consolidator)
.IP "v3.1\t15 Aug 90"
Info-ZIP (DPK, consolidator)
.IP "v4.0\t\ 1 Dec 90"
Info-ZIP (GRR, maintainer)
.IP "v4.1\t12 May 91"
Info-ZIP
.IP "v4.2\t20 Mar 92"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.0\t21 Aug 92"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.01\t15 Jan 93"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.1\t\ 7 Feb 94"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.11\t\ 2 Aug 94"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.12\t28 Aug 94"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.2\t30 Apr 96"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.3\t22 Apr 97"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.31\t31 May 97"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.32\t\ 3 Nov 97"
Info-ZIP (Zip-Bugs subgroup, GRR)
.IP "v5.4\t\28 Nov 98"
Info-ZIP (Zip-Bugs subgroup, SPC)
.PD