home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip51.zip / zipinfo.doc < prev    next >
Text File  |  1994-02-06  |  17KB  |  366 lines

  1.  
  2. ZIPINFO(1L)            LOCAL USER COMMANDS            ZIPINFO(1L)
  3.  
  4. NAME
  5.      zipinfo - list detailed information about a ZIP archive
  6.  
  7. SYNOPSIS
  8.      zipinfo      [-12smlvhtz]      file[.zip]      [file(s) ...]
  9.      [-x xfile(s) ...]
  10.  
  11.      unzip    -Z    [-12smlvhtz]     file[.zip]     [file(s) ...]
  12.      [-x xfile(s) ...]
  13.  
  14. DESCRIPTION
  15.      zipinfo lists technical information about  files  in  a  ZIP
  16.      archive, most commonly found on MS-DOS systems.  Such infor-
  17.      mation includes file access permissions, encryption  status,
  18.      type  of  compression,  version and operating system or file
  19.      system of compressing program, and the  like.   The  default
  20.      behavior  (with  no  options) is to list single-line entries
  21.      for each file in the archive, with header and trailer  lines
  22.      providing  summary  information for the entire archive.  The
  23.      format is a cross between Unix ``ls -l''  and  ``unzip  -v''
  24.      output.   See DETAILED DESCRIPTION below.  Note that zipinfo
  25.      is the same program as unzip (under Unix, a link to it);  on
  26.      some systems, zipinfo support may not have been compiled in.
  27.  
  28. ARGUMENTS
  29.      file[.zip]
  30.           Path of the ZIP archive(s).  If the file  specification
  31.           is  a  wildcard,  each matching file is processed in an
  32.           order determined by the operating system (or file  sys-
  33.           tem).   Only  the  filename can be a wildcard; the path
  34.           itself cannot.  Wildcard  expressions  are  similar  to
  35.           Unix egrep(1) (regular) expressions and may contain:
  36.  
  37.           *    matches a sequence of 0 or more characters
  38.  
  39.           ?    matches exactly 1 character
  40.  
  41.           [...]
  42.                matches any  single  character  found  inside  the
  43.                brackets;  ranges  are  specified  by  a beginning
  44.                character, a hyphen, and an ending character.   If
  45.                an  exclamation point or a caret (`!' or `^') fol-
  46.                lows the left bracket, then the range  of  charac-
  47.                ters within the brackets is complemented (that is,
  48.                anything except the characters inside the brackets
  49.                is considered a match).
  50.  
  51.           (Be sure to quote any character which  might  otherwise
  52.           be  interpreted  or  modified  by the operating system,
  53.           particularly under Unix and VMS.)  If  no  matches  are
  54.           found,  the  specification  is  assumed to be a literal
  55.           filename; and if that also fails, the  suffix  .zip  is
  56.           appended.  Note that self-extracting ZIP files are sup-
  57.           ported; just specify the .exe suffix  (if  any)  expli-
  58.           citly.
  59.  
  60.      [file(s)]
  61.           An optional list of archive members  to  be  processed.
  62.           Regular  expressions  (wildcards)  may be used to match
  63.           multiple members; see above.  Again, be sure  to  quote
  64.           expressions  that  would otherwise be expanded or modi-
  65.           fied by the operating system.
  66.  
  67.      [-x xfile(s)]
  68.           An optional list of archive members to be excluded from
  69.           processing.
  70.  
  71. OPTIONS
  72.      -1   list  filenames  only,  one  per  line.   This   option
  73.           excludes all others; headers, trailers and zipfile com-
  74.           ments are never printed.  It is  intended  for  use  in
  75.           Unix shell scripts.
  76.  
  77.      -2   list filenames only, one per line,  but  allow  headers
  78.           (-h), trailers (-t) and zipfile comments (-z), as well.
  79.           This option may be useful in  cases  where  the  stored
  80.           filenames are particularly long.
  81.  
  82.      -s   list zipfile info in short Unix ``ls -l'' format.  This
  83.           is the default behavior; see below.
  84.  
  85.      -m   list zipfile info in  medium  Unix  ``ls  -l''  format.
  86.           Identical to the -s output, except that the compression
  87.           factor, expressed as a percentage, is also listed.
  88.  
  89.      -l   list zipfile info in long Unix ``ls  -l''  format.   As
  90.           with  -m  except that the compressed size (in bytes) is
  91.           printed instead of the compression ratio.
  92.  
  93.      -v   list zipfile information in verbose, multi-page format.
  94.  
  95.      -h   list header line.  The archive name,  actual  size  (in
  96.           bytes) and total number of files is printed.
  97.  
  98.      -t   list totals for files listed or  for  all  files.   The
  99.           number   of   files   listed,  their  uncompressed  and
  100.           compressed total sizes, and their  overall  compression
  101.           factor is printed; or, if only the totals line is being
  102.           printed, the values for the entire archive  are  given.
  103.           Note  that  the total compressed (data) size will never
  104.           match  the  actual  zipfile  size,  since  the   latter
  105.           includes  all  of the internal zipfile headers in addi-
  106.           tion to the compressed data.
  107.  
  108. DETAILED DESCRIPTION
  109.      zipinfo has a number of  modes,  and  its  behavior  can  be
  110.      rather  difficult  to fathom if one isn't familiar with Unix
  111.      ls(1) (or even if one is).  The default behavior is to  list
  112.      files in the following format:
  113.  
  114. -rw-rws---  1.9 unx    2802 t- defX 11-Aug-91 13:48 perms.2660
  115.  
  116.      The last three fields are the modification date and time  of
  117.      the  file,  and  its  name.   The  case  of  the filename is
  118.      respected; thus files  which  come  from  MS-DOS  PKZIP  are
  119.      always  capitalized.   If  the file was zipped with a stored
  120.      directory name, that  is  also  displayed  as  part  of  the
  121.      filename.
  122.  
  123.      The second and third  fields  indicate  that  the  file  was
  124.      zipped  under  Unix with version 1.9 of zip.  Since it comes
  125.      from Unix, the file permissions at the beginning of the line
  126.      are  printed  in  Unix  format.   The uncompressed file-size
  127.      (2802 in this example) is the fourth field.
  128.  
  129.      The fifth field consists of two characters, either of  which
  130.      may  take  on  several  values.   The first character may be
  131.      either `t' or `b', indicating that zip believes the file  to
  132.      be  text  or  binary,  respectively;  but  if  the  file  is
  133.      encrypted, zipinfo notes this fact by capitalizing the char-
  134.      acter  (`T'  or `B').  The second character may also take on
  135.      four values, depending on whether there is an extended local
  136.      header  and/or  an  ``extra field'' associated with the file
  137.      (explained in PKWare's APPNOTE.TXT).  If neither exists, the
  138.      character  will  be  a hyphen (`-'); if there is an extended
  139.      local header but no extra field, `l'; if the  reverse,  `x';
  140.      and  if  both  exist, `X'.  Thus the file in this example is
  141.      (probably) a text file, is not encrypted, and has neither an
  142.      extra field nor an extended local header associated with it.
  143.      The example below, on the other hand, is an encrypted binary
  144.      file with an extra field:
  145.  
  146. RWD,R,R     0.9 vms     168 Bx shrk  9-Aug-91 19:15 perms.0644
  147.  
  148.      Extra fields are used by PKWARE for  authenticity  verifica-
  149.      tion  and possibly other purposes, and by Info-ZIP's zip 1.6
  150.      and later to store OS/2, Macintosh and VMS file  attributes.
  151.      This  example  presumably falls into the latter class, then.
  152.      Note that the file attributes  are  listed  in  VMS  format.
  153.      Some  other  possibilities  for  the  host  operating system
  154.      (which is actually a misnomer;  host  file  system  is  more
  155.      correct)  include OS/2 or NT with High Performance File Sys-
  156.      tem (HPFS), MS-DOS, OS/2 or NT with  File  Allocation  Table
  157.      (FAT) file system, and Macintosh.  These are denoted as fol-
  158.      lows:
  159.  
  160. -rw-a--     1.0 hpf    5358 Tl i4:3  4-Dec-91 11:33 longfilename.hpfs
  161. -r--ahs     1.1 fat    4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF
  162. --w-------  1.0 mac   17357 bx i8:2  4-May-92 04:02 unzip.macr
  163.  
  164.      File attributes in the first two cases are  indicated  in  a
  165.      Unix-like format, where the seven subfields indicate whether
  166.      the file:  (1) is  a  directory,  (2)  is  readable  (always
  167.      true),  (3)  is  writable, (4) is executable (guessed on the
  168.      basis of the extension--.exe,  .com,  .bat,  .cmd  and  .btm
  169.      files  are  assumed  to be so), (5) has its archive bit set,
  170.      (6) is hidden, and (7) is a system file.  Interpretation  of
  171.      Macintosh  file attributes is unreliable because some Macin-
  172.      tosh archivers don't store any attributes in the archive.
  173.  
  174.      Finally, the sixth field indicates  the  compression  method
  175.      and  possible  sub-method used.  There are six methods known
  176.      at present:  storing (no compression), reducing,  shrinking,
  177.      imploding, tokenizing (never publicly released), and deflat-
  178.      ing.  In addition, there are  four  levels  of  reducing  (1
  179.      through  4);  four types of imploding (4K or 8K sliding dic-
  180.      tionary, and 2 or 3 Shannon-Fano trees); and four levels  of
  181.      deflating  (superfast,  fast,  normal, maximum compression).
  182.      zipinfo represents these methods and  their  sub-methods  as
  183.      follows:   stor;  re:1,  re:2, etc.; shrk; i4:2, i8:3, etc.;
  184.      tokn; and defS, defF, defN, and defX.
  185.  
  186.      The medium and long listings are  almost  identical  to  the
  187.      short  format except that they add information on the file's
  188.      compression.  The medium format lists the file's compression
  189.      factor  as a percentage indicating the amount of space which
  190.      has been ``removed'':
  191.  
  192. -rw-rws---  1.5 unx    2802 t- 81% defX 11-Aug-91 13:48 perms.2660
  193.  
  194.      In this example, the file has been compressed by more than a
  195.      factor of five; the compressed data are only 19% of the ori-
  196.      ginal size.  The long format  gives  the  compressed  file's
  197.      size in bytes, instead:
  198.  
  199. -rw-rws---  1.5 unx    2802 t-     538 defX 11-Aug-91 13:48 perms.2660
  200.  
  201.      In addition to individual file information, a  default  zip-
  202.      file listing also includes header and trailer lines:
  203.  
  204. Archive:  OS2.zip   5453 bytes   5 files
  205. ,,rw,       1.0 hpf     730 b- i4:3 26-Jun-92 23:40 Contents
  206. ,,rw,       1.0 hpf    3710 b- i4:3 26-Jun-92 23:33 makefile.os2
  207. ,,rw,       1.0 hpf    8753 b- i8:3 26-Jun-92 15:29 os2unzip.c
  208. ,,rw,       1.0 hpf      98 b- stor 21-Aug-91 15:34 unzip.def
  209. ,,rw,       1.0 hpf      95 b- stor 21-Aug-91 17:51 zipinfo.def
  210. 5 files, 13386 bytes uncompressed, 4951 bytes compressed:  63.0%
  211.  
  212.      The header line gives the name of  the  archive,  its  total
  213.      size,  and  the total number of files; the trailer gives the
  214.      number of files listed, their total uncompressed  size,  and
  215.      their  total  compressed  size  (not  including any of zip's
  216.      internal overhead).  If, however, one or  more  file(s)  are
  217.      provided, the header and trailer lines are not listed.  This
  218.      behavior is also similar to that of Unix's ``ls -l''; it may
  219.      be  overridden  by  specifying  the -h and -t options expli-
  220.      citly.  In such a case  the  listing  format  must  also  be
  221.      specified  explicitly,  since  -h  or  -t  (or  both) in the
  222.      absence of other options implies that  ONLY  the  header  or
  223.      trailer  line (or both) is listed.  See the EXAMPLES section
  224.      below for a semi-intelligible translation of this nonsense.
  225.  
  226.      The verbose listing is self-explanatory.  It also lists file
  227.      comments  and the zipfile comment, if any, and the number of
  228.      bytes of OS/2 extended attributes  stored.   Note  that  the
  229.      latter  number will in general NOT match the number given by
  230.      OS/2's ``dir'' command; OS/2 always reports  the  number  of
  231.      bytes  required  in  16-bit  format,  whereas zipinfo always
  232.      reports the 32-bit storage.
  233.  
  234. ENVIRONMENT OPTIONS
  235.      Modifying zipinfo's default behavior via options  placed  in
  236.      an environment variable can be a bit complicated to explain,
  237.      due to zipinfo's attempts to handle various defaults  in  an
  238.      intuitive,  yet  Unix-like,  manner.   (Try  not  to laugh.)
  239.      Nevertheless, there is some  underlying  logic.   In  brief,
  240.      there are three ``priority levels'' of options:  the default
  241.      options; environment options, which can override or  add  to
  242.      the  defaults; and explicit options given by the user, which
  243.      can override or add to either of the above.
  244.  
  245.      The default listing  format,  as  noted  above,  corresponds
  246.      roughly  to  the "zipinfo -hst" command (except when indivi-
  247.      dual zipfile members are specified).  A user who prefers the
  248.      long-listing  format  (-l)  can  make  use  of the zipinfo's
  249.      environment variable to change this default:
  250.  
  251.         ZIPINFO=-l; export ZIPINFO   Unix Bourne shell
  252.         setenv ZIPINFO -l            Unix C shell
  253.         set ZIPINFO=-l               OS/2 or MS-DOS
  254.         define ZIPINFO_OPTS "-l"     VMS (quotes for lowercase)
  255.  
  256.      If,  in  addition,  the  user  dislikes  the  trailer  line,
  257.      zipinfo's  concept  of  ``negative  options'' may be used to
  258.      override the default inclusion of the line.  This is  accom-
  259.      plished  by  preceding the undesired option with one or more
  260.      minuses:  e.g., ``-l-t'' or ``--tl'', in this example.   The
  261.      first  hyphen  is  the regular switch character, but the one
  262.      before the `t' is a minus sign.  The dual use of hyphens may
  263.      seem   a  little  awkward,  but  it's  reasonably  intuitive
  264.      nonetheless:  simply ignore the first  hyphen  and  go  from
  265.      there.   It is also consistent with the behavior of the Unix
  266.      command nice(1).
  267.  
  268. EXAMPLES
  269.      To get a basic, short-format listing of  the  complete  con-
  270.      tents  of  a  ZIP  archive storage.zip, with both header and
  271.      totals lines, use only the archive name as  an  argument  to
  272.      zipinfo:
  273.  
  274.         zipinfo storage
  275.  
  276.      To produce  a  basic,  long-format  listing  (not  verbose),
  277.      including header and totals lines, use -l:
  278.  
  279.         zipinfo -l storage
  280.  
  281.      To list the complete contents of the archive without  header
  282.      and  totals  lines,  either  negate the -h and -t options or
  283.      else specify the contents explicitly:
  284.  
  285.         zipinfo --h-t storage
  286.         zipinfo storage \*
  287.  
  288.      (where the backslash is required only  if  the  shell  would
  289.      otherwise  expand the `*' wildcard, as in Unix when globbing
  290.      is turned on--double quotes around the asterisk  would  have
  291.      worked  as  well).   To turn off the totals line by default,
  292.      use the environment variable (C shell is assumed here):
  293.  
  294.         setenv ZIPINFO --t
  295.         zipinfo storage
  296.  
  297.      To get the full, short-format listing of the  first  example
  298.      again,  given that the environment variable is set as in the
  299.      previous example, it is necessary to specify the  -s  option
  300.      explicitly,  since the -t option by itself implies that ONLY
  301.      the footer line is to be printed:
  302.  
  303.         setenv ZIPINFO --t
  304.         zipinfo -t storage           [only totals line]
  305.         zipinfo -st storage          [full listing]
  306.  
  307.      The -s option, like -m and -l, includes headers and  footers
  308.      by  default, unless otherwise specified.  Since the environ-
  309.      ment variable specified no footers and  that  has  a  higher
  310.      precedence  than  the default behavior of -s, an explicit -t
  311.      option was necessary to produce the full  listing.   Nothing
  312.      was  indicated  about  the header, however, so the -s option
  313.      was sufficient.  Note that both the -h and -t options,  when
  314.      used  by themselves or with each other, override any default
  315.      listing of member files; only the header and/or  footer  are
  316.      printed.   This behavior is useful when zipinfo is used with
  317.      a wildcard zipfile specification; the contents of  all  zip-
  318.      files are then summarized with a single command.
  319.  
  320.      To list information on a single file within the archive,  in
  321.      medium format, specify the filename explicitly:
  322.  
  323.         zipinfo -m storage unshrink.c
  324.  
  325.      The specification of any member file, as  in  this  example,
  326.      will  override the default header and totals lines; only the
  327.      single line of information about the requested file will  be
  328.      printed.   This  is  intuitively  what one would expect when
  329.      requesting information about a single  file.   For  multiple
  330.      files,  it  is often useful to know the total compressed and
  331.      uncompressed size; in such cases -t may be specified  expli-
  332.      citly:
  333.  
  334.         zipinfo -mt storage "*.[ch]" Mak\*
  335.  
  336.      Finally, to get maximal information about the  ZIP  archive,
  337.      use the verbose option.  It is usually wise to pipe the out-
  338.      put into a filter such as more(1):
  339.  
  340.         zipinfo -v storage | more
  341.  
  342. TIPS
  343.      The author finds it convenient to define  an  alias  ii  for
  344.      zipinfo  on  systems  which allow aliases (or, on other sys-
  345.      tems, copy/rename the executable, create a link or create  a
  346.      command  file with the name ii).  The ii usage parallels the
  347.      common ll alias for long listings in Unix, and the  similar-
  348.      ity between the outputs of the two commands was intentional.
  349.  
  350. BUGS
  351.      None known at this time, but we're always delighted to  find
  352.      a good one.
  353.  
  354. SEE ALSO
  355.      ls(1), funzip(1), unzip(1), zip(1), zipcloak(1), zipnote(1),
  356.      zipsplit(1)
  357.  
  358. AUTHOR
  359.      Greg Roelofs (a.k.a. Cave Newt).  ZipInfo contains  pattern-
  360.      matching  code  by Mark Adler, and the OS/2 extra-field code
  361.      is by Kai Uwe Rommel; many other have contributed fixes  and
  362.      improvements.   Please  refer  to  the  CONTRIBS file in the
  363.      UnZip source distribution for a more complete list.
  364.  
  365. Info-ZIP             Last change:  7 Feb 94                  v2.0
  366.