.de X .nf .ien .ti -5 .el \{ .ti +2m .ps -1 \} \&\\$1 .ien .ti +5 .el \{ .ti -2m .ps +1 \} .fi .. .TH ZIPINFO 1 "19 Aug 92 (v1.0)" .SH NAME zipinfo \- list detailed information about a ZIP archive file .SH SYNOPSIS \fBzipinfo\fP [\-\fB1smlvht\fP] \fRfile\fP[\fR.zip\fP] [\fRfilespec\fP\ ...] .SH ARGUMENTS .IP \fIfile\fP[\fI.zip\fP] \w'[\fIfilespec\fP]'u+2m Path of the ZIP archive. The suffix ``\fR.zip\fP'' is applied if the \fRfile\fP specified does not exist. Note that self-extracting ZIP files are supported; just specify the ``\fR.exe\fP'' suffix yourself. .IP [\fIfilespec\fP] An optional list of archive members to be processed. Expressions may be used to match multiple members; be sure to quote expressions that contain characters interpreted by the Unix shell. See PATTERN MATCHING (below) for more details. .SH OPTIONS .PD 0 .IP \-1 \w'\-1'u+2m list filenames only, one per line (useful for pipes) .IP \-s list zipfile info in short Unix ``ls \-l'' format: default .IP \-m list zipfile info in medium Unix ``ls \-l'' format .IP \-l list zipfile info in long Unix ``ls \-l'' format .IP \-v list zipfile information in verbose, multi-page format .IP \-h list header line .IP \-t list totals for files listed or for all files .PD .SH PATTERN MATCHING All archive members are listed unless a \fIfilespec\fP is provided to specify a subset of the archive members. The \fIfilespec\fP is similar to an \fRegrep\fP expression, and may contain: .PP .ta \w'[...]'u+2m * matches a sequence of 0 or more characters .br ? matches exactly 1 character .br \\nnn matches the character having octal code nnn .PD 0 .IP [...] \w'[...]'u+2m 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 carat (`!' or `^') follows the left bracket, then the range of characters matched is complemented with respect to the ASCII character set (that is, anything except the characters inside the brackets is considered a match). .PD .SH DESCRIPTION .I ZipInfo lists technical information about a ZIP archive, including information file access permissions, encryption status, type of compression, version and operating system of compressing program, and the like. The default option is to list files in the following format: .PP .X "-rw-rwl--- 1.5 unx 2802 t- defX 11-Aug-91 13:48 perms.2660" .PP The last three fields are clearly the modification date and time of the file, and its name. The case of the filename is respected; thus files which come from MS-DOS PKZIP are always capitalized. If the file was zipped with a stored directory name, that is also displayed as part of the filename. .PP The second and third fields indicate that the file was zipped under Unix with version 1.5 of \fRZip\fP (a beta version). Since it comes from Unix, the file permissions at the beginning of the line are printed in Unix format. The uncompressed file-size (2802 in this example) is the fourth field. .PP The fifth field consists of two characters, either of which may take on several values. The first character may be either `t' or `b', indicating that \fRZip\fP believes the file to be text or binary, respectively; but if the file is encrypted, \fIZipInfo\fP notes this fact by capitalizing the character (`T' or `B'). The second character may also take on four values, depending on whether there is an extended local header and/or an ``extra field'' associated with the file (explained in PKWare's APPNOTE.TXT). If neither exists, the character will be a hyphen (`\-'); if there is an extended local header but no extra field, `l'; if the reverse, `x'; and if both exist, `X'. Thus the file in this example is (apparently) a text file, is not encrypted, and has neither an extra field nor an extended local header associated with it. The example below, on the other hand, is an encrypted binary file with an extra field: .PP .X "RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644" .PP Extra fields are used by PKWare for authenticity verification(?) and possibly other purposes, and by Info-ZIP's \fRZip\fP 1.6 and later to store OS/2, Macintosh and VMS file attributes. This example presumably falls into the latter class, then. Note that the file attributes are listed in VMS format. Other possibilities for the host operating system include OS/2 with High Performance File System (HPFS), DOS or OS/2 with File Allocation Table (FAT) file system, and Macintosh, denoted as follows: .PP .X "arc,,rw, 1.0 os2 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs" .X "arc,hid,rdo,sys dos 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF" .X "--w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macr" .PP File attributes in the first two cases are indicated in a DOS-like format, where the file may or may not have its archive bit set; may be hidden or not; may be read-write or read-only; and may be a system file or not. If the attributes are too long, the version number of the encoding software is omitted. (The information is still available in the verbose listing, however.) Interpretation of Macintosh file attributes needs some work yet. .PP Finally, the sixth field indicates the compression method and possible sub-method used. There are six methods known at present: storing (no compression), reducing, shrinking, imploding, tokenizing, and deflating. In addition, there are four levels of reducing (1 through 4); four types of imploding (4K or 8K sliding dictionary, and 2 or 3 Shannon-Fano trees); and three levels of deflating (fast, normal, maximum compression). \fIZipInfo\fP represents these methods and their sub-methods as follows: ``stor''; ``re:1,'' ``re:2,'' etc.; ``shrk''; ``i4:2,'' ``i8:3,'' etc.; ``tokn''; and ``defF,'' ``defN,'' and ``defX.'' .PP The medium and long listings are almost identical to the short format except that they add information on the file's compression. The medium format indicates the file's compression factor as a percentage: .PP .X "-rw-rwl--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660" .PP In this example, the file has been compressed by more than a factor of five; the compressed data are only 19% of the original size. The long format gives the compressed file's size in bytes, instead: .PP .X "-rw-rwl--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660" .PP In addition to individual file information, a default zipfile listing also includes header and trailer lines: .PP .X "Archive: OS2.zip 5453 bytes 5 files" .X ",,rw, 1.0 os2 730 b- i4:3 26-Jun-92 23:40 Contents" .X ",,rw, 1.0 os2 3710 b- i4:3 26-Jun-92 23:33 makefile.os2" .X ",,rw, 1.0 os2 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c" .X ",,rw, 1.0 os2 98 b- stor 21-Aug-91 15:34 unzip.def" .X ",,rw, 1.0 os2 95 b- stor 21-Aug-91 17:51 zipinfo.def" .X "5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63%" .PP The header line gives the name of the archive, its total size, and the total number of files; the trailer gives the number of files listed, their total uncompressed size, and their total compressed size (not including any of \fRZip\fP's internal overhead). If, however, one or more \fIfilespec\fPs are provided, the header and trailer lines are not listed. This behavior is also similar to that of Unix's ``ls \-l''; it may be overridden by specifying the \-h and \-t options explicitly. In such a case the listing format must also be specified explicitly, since \-h or \-t (or both) in the absence of other options implies that ONLY the header or trailer line (or both) is listed. See the EXAMPLES section below for a semi-intelligible translation of this nonsense. .PP The verbose listing is self-explanatory. It also lists file comments and the zipfile comment, if any, and the number of bytes of OS/2 extended attributes stored. Note that the latter number will in general NOT match the number given by OS/2's ``dir'' command; OS/2 always reports the number of bytes required in 16-bit format, whereas \fIZipInfo\fP always reports the 32-bit storage. .PD .SH ENVIRONMENT OPTIONS Modifying \fIZipInfo\fP's default behavior via options placed in an environment variable can be a bit complicated to explain, due to \fIZipInfo\fP's attempts to handle various defaults in an intuitive, yet Unix-like, manner. Nevertheless, there is some underlying logic. In brief, there are three ``priority levels'' of options: the default options; environment options, which can override or add to the defaults; and explicit options given by the user, which can override or add to either of the above. .PP The default listing format, as noted above, corresponds roughly to the "zipinfo \-hst" command (except when individual zipfile members are specified). A user who prefers the long-listing format (\-l) can make use of the \fIZIPINFO\fP environment variable to change this default: .ta \w'tabset'u +\w'ZIPINFO=\-l; export ZIPINFO'u+3m .PP .IP "\tsetenv ZIPINFO \-l\tUnix C shell" .br .IP "\tZIPINFO=\-l; export ZIPINFO\tUnix Bourne shell" .PP .IP "\tset ZIPINFO=\-l\tOS/2 or MS-DOS" .PP .IP "\tdefine ZIPINFO_OPTS ""\-l""\tVMS (quotes for LOWERCASE)" .PP If, in addition, the user dislikes the trailer line, \fIZipInfo\fP's concept of ``negative options'' may be used to override the default inclusion of the line. This is accomplished by preceding the undesired option with one or more minuses: e.g., ``\-l\-t'' or ``\-\-tl'', in this example. The first hyphen is the regular switch character, but the one before the `t' is a minus sign. The dual use of hyphens may seem a little awkward, but it's reasonably intuitive nonetheless: simply ignore the first hyphen and go from there. It is also consistent with the behavior of the Unix command \fRnice\fP(1). .PD .SH EXAMPLES To get a basic, short-format listing of the complete contents of a ZIP archive ``storage.zip,'' with both header and totals lines, use only the archive name as an argument to zipinfo: .PP .IP "\t\fIzipinfo\fP storage" .PP To produce a basic, long-format listing (not verbose), including header and totals lines, use \-l: .PP .IP "\t\fIzipinfo\fP \-l storage" .PP To list the complete contents of the archive without header and totals lines, either negate the \-h and \-t options or else specify the contents explicitly: .PP .IP "\t\fIzipinfo\fP \-\-h\-t storage" .IP "\t\fIzipinfo\fP storage \e*" .PP (where the backslash is required only if the shell would otherwise expand the `*' wildcard, as in Unix when globbing is turned on--double quotes around the asterisk would have worked as well). To turn off the totals line by default, use the environment variable (C shell is assumed here): .PP .IP "\tsetenv ZIPINFO \-\-t" .IP "\t\fIzipinfo\fP storage" .PP To get the full, short-format listing of the first example again, given that the environment variable is set as in the previous example, it is necessary to specify the \-s option explicitly, since the \-t option by itself implies that ONLY the footer line is to be printed: .PP .IP "\tsetenv ZIPINFO \-\-t" .IP "\t\fIzipinfo\fP \-t storage\t[only totals line]" .IP "\t\fIzipinfo\fP \-st storage\t[full listing]" .PP The \-s option, like \-m and \-l, includes headers and footers by default, unless otherwise specified. Since the environment variable specified no footers and that has a higher precedence than the default behavior of \-s, an explicit \-t option was necessary to produce the full listing. Nothing was indicated about the header, however, so the \-s option was sufficient. Note that both the \-h and \-t options, when used by themselves or with each other, override any default listing of member files; only the header and/or footer are printed. This behavior will be more useful when \fIZipInfo\fP accepts wildcards for the zipfile name; one may then summarize the contents of all zipfiles with a single command. .PP To list information on a single file within the archive, in medium format, specify the filename explicitly: .PP .IP "\t\fIzipinfo\fP \-m storage unshrink.c" .PP The specification of any member file, as in this example, will override the default header and totals lines; only the single line of information about the requested file will be printed. This is intuitively what one would expect when requesting information about a single file. For multiple files, it is often useful to know the total compressed and uncompressed size; in such cases \-t may be specified explicitly: .PP .IP "\t\fIzipinfo\fP \-mt storage ""*.[ch] Mak\e*" .PP Finally, to get maximal information about the ZIP archive, use the verbose option. It is usually wise to pipe the output into a filter such as \fRmore\fP(1): .PP .IP "\t\fIzipinfo\fP \-v storage | more" .PD .SH TIPS The author finds it convenient to set up an alias ``ii'' for \fIZipInfo\fP on systems which allow aliases, or else to set up a batch file ``ii.bat'' or to rename the executable to ``ii.exe'' on systems such as MS-DOS which have no provision for aliases. The ``ii'' usage parallels the common ``ll'' alias for long listings in Unix, and the similarity between the outputs of the two commands was intentional. .PD .SH SEE ALSO funzip(1), unzip(1), zip(1), zipcloak(1), zipnote(1), zipsplit(1) .PD .SH AUTHOR Greg Roelofs (also known as Cave Newt). \fIZipInfo\fP is partly based on S. H. Smith's \fRunzip\fP and contains pattern-matching code by J. Kercheval, but mostly it was written from scratch. The OS/2 extra-field code is by Kai Uwe Rommel.