home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume44
/
unzip
/
part14
< prev
next >
Wrap
Internet Message Format
|
1994-09-19
|
72KB
From: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
Newsgroups: comp.sources.misc
Subject: v44i079: unzip - Info-ZIP portable UnZip, version 5.12, Part14/20
Date: 18 Sep 1994 23:16:27 -0500
Organization: Sterling Software
Sender: kent@sparky.sterling.com
Approved: kent@sparky.sterling.com
Message-ID: <35j3ar$qq8@sparky.sterling.com>
X-Md4-Signature: a2bca81071d659ef7dcaa2d245746e08
Submitted-by: zip-bugs@wkuvx1.wku.edu (Info-ZIP group)
Posting-number: Volume 44, Issue 79
Archive-name: unzip/part14
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, COHERENT, AMIGA?, ATARI TOS, SGI, DEC, Cray, Convex, Amdahl, Sun
Supersedes: unzip50: Volume 31, Issue 104-117
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: unzip-5.12/INSTALL unzip-5.12/human68k/human68k.c
# unzip-5.12/mac/macstat.c unzip-5.12/unix/zipinfo.1
# Wrapped by kent@sparky on Sat Sep 17 23:33:43 1994
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 14 (of 20)."'
if test -f 'unzip-5.12/INSTALL' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'unzip-5.12/INSTALL'\"
else
echo shar: Extracting \"'unzip-5.12/INSTALL'\" \(20087 characters\)
sed "s/^X//" >'unzip-5.12/INSTALL' <<'END_OF_FILE'
X__________________________________________________________________________
X
X This is the Info-ZIP file INSTALL (for UnZip), last updated 23 Aug 94.
X__________________________________________________________________________
X
X Yes, this is a rather long file, but don't be intimidated: much of its
X length is due to coverage of multiple operating systems and of optional
X customization features, large portions of which may be skipped. --GRR
X__________________________________________________________________________
X
X
X
XTo compile UnZip, UnZipSFX and/or fUnZip:
X=========================================
X
X(1) Unpack *.c and *.h (the actual source files), preserving the directory
X structure (e.g., ./unix/unix.c). The sole exception is TOPS-20, where
X tops20/* should be unpacked into the current directory, but TOPS-20
X is no longer fully supported in this version.
X
X If you wish to compile with decryption enabled, you must get the zcrypt
X package (see "Where"). Unpack crypt.c and crypt.h from the zcrypt ar-
X chive, overwriting the dummy versions supplied with UnZip. If you don't
X have any sort of unzipper available, you'll have to compile the non-
X crypt version first and use that to unpack the full crypt sources, then
X recompile. (The included zipcloak.c file is for use only with the Zip
X 2.0.x sources, so don't bother unpacking it.)
X
X
X(2) Choose the appropriate makefile based on the description in the Con-
X tents file for your OS (that is, there's only one for Unix or OS/2, but
X MS-DOS and several other OSes have several, depending on the compiler).
X Copy it into the current directory and rename if necessary or desired.
X (Some makefiles can be invoked in place; see (5) below.)
X
X Special point of confusion: some MS-DOS targets are in non-MSDOS
X makefiles. In particular, for DOS emx+gcc use the gccdos target of
X the OS/2 makefile (os2/makefile.os2), and for djgpp use the gcc_dos
X target of the Unix makefile (unix/Makefile). In addition, OS/2 users
X of MSC can cross-compile to MS-DOS with makefile.os2's mscdos target.
X
X
X(3) If you want a non-standard version of UnZip, define one or more of the
X following optional macros, either by adding them to the LOCAL_UNZIP
X environment variable or by editing your makefile as appropriate. The
X syntax differs from compiler to compiler, but macros are often defined
X via "-DMACRO_NAME" or similar (for one called MACRO_NAME). Note that
X some of these may not be fully supported in future releases (or even
X in the current release). Note also that very short command lines in
X MS-DOS (128 characters) may place severe limits on how many of these
X can be used; if need be, the definitions can be placed at the top of
X unzip.h instead (it is included in all source files).
X
X CHECK_EOF (recommended!)
X Corrupt zipfiles and zipfiles stored on damaged media (e.g., bad
X floppies) may cause UnZip to go into an infinite loop and either
X fill the disk(!) or, in some cases (notably under MS-DOS), hang the
X system. (This only applies to testing or extraction of *damaged*
X archives, however.) Defining CHECK_EOF enables special code which
X corrects the problem on most systems; DEC Ultrix may be one excep-
X tion. The only reason this option is not defined by default is that
X it was introduced too late in the testing process.
X
X DOSWILD (MS-DOS only)
X Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
X trailing "*." as match for files without a dot (i.e., matches any-
X thing, as long as no dots in name). Special treatment only occurs
X if patterns are at end of arguments; i.e., "a*.*" matches all files
X starting with "a", but "*.*c" matches all files ending in "c" *only*
X if they have a dot somewhere before the "c". Thus "*.*.*" could be
X used (albeit awkwardly) to specify all filenames with at least one
X dot in them, and "*." matches all filenames with no dots in them.
X [The default method of specifying these would be "*.*" and "* -x *.*",
X respectively, where the second example makes use of UnZip's exclude-
X files option.] All other regular expressions (including "?" and
X "[range_of_chars]") retain their Unix-like behavior.
X
X VMSWILD (VMS only)
X Use parentheses rather than brackets to delimit sets (ranges), and
X use '%' instead of '?' as the single-character wildcard for internal
X filename matching. (External matching of zipfile names always uses
X the standard VMS wildcard facilities; character sets are disallowed.)
X
X VMSCLI (VMS only)
X Use VMS-style "slash options" (/FOOBAR) instead of the default Unix-
X style hyphenated options (-f). This capability was added quite late
X in the beta cycle and isn't fully tested, so some features may not
X work as expected. Also, it doesn't affect options stored in environ-
X ment variables (UNZIP_OPTS or ZIPINFO_OPTS); those use the Unix style
X regardless.
X
X CHECK_VERSIONS (VMS only)
X UnZip "extra fields" are used to store VMS (RMS) filesystem info,
X and the format of this information may differ in various versions
X of VMS. Defining this option will enable UnZip warnings when the
X stored extra-field VMS version(s) do(es) not match the version of
X VMS currently being used. This is a common occurrence in zipfiles
X received from other sites, but since the format of the filesystem
X does not seem to have changed in years (including on Alpha and Open-
X VMS systems), the warnings are not enabled by default.
X
X RETURN_SEVERITY (VMS only)
X Return a VMS-style value in the range 0x7fff0001 to 0x7fff0332 for
X warnings or errors, or 1 for successful completion. See unzip.doc
X for an explanation of the encoding of the normal UnZip return value.
X This option was added late in the beta cycle and hasn't been tested
X much yet, but it will likely become the default in future versions
X (assuming no collisions with official VMS error codes).
X
X RETURN_CODES (VMS only)
X VMS interprets return codes according to a rigid set of guidelines,
X which means it misinterprets normal UnZip return codes as all sorts
X of really nasty errors. Therefore by default VMS UnZip always returns
X zero regardless of whether any warnings or errors occurred (but see
X RETURN_SEVERITY above). Define RETURN_CODES for a human-readable ex-
X planation of UnZip's return codes. Note that this is often annoying.
X
X ASM_CRC (Amiga/Aztec C only, for now)
X Use an assembler routine to calculate the CRC for each file (speed).
X
X ASM_INFLATECODES (Amiga/Aztec C only, for now)
X Use an assembler version of inflate_codes() for speed.
X
X OLD_EXDIR (not VMS or TOPS-20)
X Use old behavior regarding the directory to which to extract: the
X argument immediately after the zipfile name is the extraction dir;
X if the directory doesn't exist, create it if it was specified as
X "dir/" (i.e., with trailing path separator), else treat it as a
X stored file; if -d is used, treat the argument as a stored file re-
X gardless of trailing '/'. For example:
X unzip foo bar if bar is a dir, extract everything into it;
X otherwise extract bar as stored file
X unzip foo bar/ extract everything into bar, creating if nec.
X unzip -d foo bar/ treat bar/ as a stored directory and extract it
X
X SFX_EXDIR
X Enable the "-d <extract_dir>" option for UnZipSFX. By default it is
X disabled so as to generate the smallest possible executable stub, but
X for use with automated installation scripts and the like it may be
X useful to enable -d. Be sure to read unzipsfx.doc for restrictions
X on the use of this option and of -x; these restrictions should be
X lifted in a later release.
X
X NO_ZIPINFO
X Compile without zipinfo mode (-Z) enabled; makes a smaller executable
X because many text strings are left out. Automatically enabled for
X some small-model compiles under MS-DOS and OS/2, so ordinarily there
X is no need to specify this explicitly. (Note that even with this
X defined, the resulting executable may still be too big to extract
X some zipfiles correctly.)
X
X DEBUG
X Used for debugging purposes; enables Trace() statements. Generally
X it's best to compile only one or two modules this way.
X
X DEBUG_TIME
X Used for debugging the timezone code in file_io.c; enables TTrace()
X statements. This code is only used for the freshen/update options
X (-f and -u), and non-Unix compilers often get it wrong.
X
X
X(4) If you regularly compile new versions of UnZip and always want the same
X non-standard option(s), you may wish to add it (them) to the LOCAL_UNZIP
X environment variable (assuming it's supported in your makefile). Under
X MS-DOS, for example, add this to AUTOEXEC.BAT:
X
X set LOCAL_UNZIP -DDOSWILD -DOLD_EXDIR
X
X You can also use the variable to hold special compiler options (e.g.,
X -FPi87 for Microsoft C, if the x87 libraries are the only ones on your
X disk and they follow Microsoft's default naming conventions; MSC also
X supports the CL environment variable, however).
X
X
X(5) Run the make utility on your chosen makefile:
X
X Unix
X For most systems it's possible to invoke the makefile in place, at
X the possible cost of an ignorable warning; do "make -f unix/Makefile
X list" to get a list of possible system targets, and then "make -f
X unix/Makefile target" for your chosen target. The "generic" target
X works for most systems, but if it fails with a message about ftime()
X unresolved or timezone redefined, do "make clean", "make help", and
X then either "make generic2" or "make generic3" as instructed. If all
X else fails, read the makefile itself; it contains numerous comments.
X
X VMS
X For a one-time build of the default UnZip, simply run the supplied
X command file MAKE.COM. To use either DEC C on an Alpha or VAX C on
X a VAX, type "@make" (after copying make.com into the current direc-
X tory; otherwise do "@[.vms]make" to invoke it in place). To use GNU
X C (gcc) on either platform, do "@make gcc".
X
X For repeated makes or other hacker-like tinkering with the sources,
X or to create a custom version of UnZip (especially with VMSCLI), use
X the included "MMS" makefile, DESCRIP.MMS. Copy it into the current
X directory, read the comments at the top of it and run MadGoat's free
X MMS clone "MMK" on it. DEC's MMS is no longer supported due to the
X use of MMK-specific extensions in DESCRIP.MMS.
X
X MS-DOS
X See the msdos\Contents file for notes regarding which makefile(s) to
X use with which compiler. In summary: pick one of msdos\makefile.*
X as appropriate, or (as noted above) use the OS/2 gccdos target for
X emx+gcc or the Unix gcc_dos target for djgpp. There is also an
X mscdos cross-compilation target in os2\makefile.os2, an sco_dos
X cross-compilation target in unix\Makefile and bcc_dos and msc_dos
X targets in unix\Makefile as well. The latter may disappear soon.
X For Watcom 16-bit or 32-bit versions, see the comments in the OS/2
X section below.
X
X After choosing the appropriate makefile and editing as necessary or
X desired, invoke the corresponding make utility. Microsoft's NMAKE
X and the free dmake and GNU make utilities are generally the most
X versatile. Unfortunately, all current ports of GNU make 3.71 (djgpp,
X emx and gnuish flavors) have bugs which prevent their use with the
X Unix makefile; the older djgpp port of make 3.69 still works and for
X now is distributed with the MS-DOS executables on the primary Info-
X ZIP mirror site (see the Where file). The makefiles in the msdos dir-
X ectory can be invoked in place (e.g., "nmake -f msdos\makefile.msc"),
X but the MS-DOS targets in the Unix makefile (gcc_dos, bcc_dos and
X msc_dos) cannot.
X
X OS/2
X Either GNU make, nmake or dmake may be used with the OS/2 makefile;
X all are freely available on the net. Do "nmake -f os2\makefile.os2",
X for example, to get a list of supported targets. For Watcom C/386 it
X is necessary to edit makefile.os2 and change the os2$(OBJ) target so
X it uses backslashes (i.e., "os2/os2.c" -> "os2\os2.c"). For Watcom
X 16-bit OS/2 versions or any Watcom DOS version (cross-compilation),
X or for Metaware High C++ (OS/2 32-bit), it is necessary to apply the
X patch in os2\wat_met.dif. (This patch arrived too late to be fully
X tested.)
X
X More generally, read the comments at the top of the makefile for an
X explanation of the differences between some of the same-compiler tar-
X gets.
X
X NT (also applies to Chicago/Windows 4)
X You will need the Windows NT SDK or Visual C++ for NT, both from
X Microsoft; or DEC C/C++ for DECpc AXP and NT. Use the command line
X to compile. For the DEC compiler edit out the "cdebug" line in
X nt\makefile as noted in the comments at the top of the makefile.
X From the main source directory do "nmake -F nt\makefile".
X
X If you are using VC++ you will get warnings about CL386 invoking CL,
X etc. Don't worry, this is for compatibility with the SDK. Microsoft
X should have changed the definition of $(cc) in ntwin32.mak for VC++.
X
X If you have VC++ 1.5 (16-bit) installed together with VC++ 1.0 (32-
X bit), make sure that you don't run the 16-bit compiler when you run
X nmake.
X
X At least with MSC 8.x (VC++ 1.x), it is possible to make a dual-mode
X self-extractor (DOS and NT/Chicago). This is not built by default,
X but for those who don't care too much about the size, here's how:
X
X From: Steve Salisbury <stevesa@microsoft.com>
X Date: Fri, 22 Jul 94 17:18:06 PDT
X
X Did y'all know that you can build a dual mode (MS-DOS and Win32
X (NT + Chicago)) unzipsfx.exe by just making a 16-bit unzipsfx.exe
X and then specifying that as the 16-bit stub for the 32-bit unzip-
X sfx.exe? You also have to specify the /Knoweas flag to the 16-bit
X linker. I suspect that this won't work with C 6.0 and earlier,
X maybe not even with MS C/C++ 7.0. Anyway, I use C 8.0 (a.k.a.
X Visual C 1.X), which has been shipping for 15+ months now.
X
X Make a little change to MSDOS\MAKEFILE.MSC to add the /KNOWEAS
X flag:
X
X LDFLAGS = /KNOWEAS /nologo/noi/e/st:0x0c00
X
X rename the output file
X
X ren UNZIPSFX.EXE UNZIPSFX.E16
X
X and then make a little change to NT\MAKEFILE to add the -STUB
X directive:
X
X .obj.exe:
X $(link) $(ldebug) $(conflags) $(conflibs) $** \
X -out:$@ -STUB:$*.e16
X
X This is pretty useful. It's nice to have dual-mode self-extracting
X files.
X
X I do notice that they are pretty huge files (41K for 16-bit
X unzipsfx.exe, 69k for the 32-bit version, 110k for the dual). Oh
X well.
X
X AmigaDOS
X SAS/Lattice C and Manx Aztec C are supported. For SAS C 6.x do "lmk
X -f amiga/SMakeFile all"; for Aztec C do "make -f amiga/makefile.azt
X all". The Aztec C version supports assembly-language versions of two
X routines; these are enabled by default.
X
X Atari TOS
X Turbo C is no longer supported; use gcc (tested with 2.4.5 and 2.5.8)
X and the MiNT libraries, and do "make". Note that all versions of gcc
X prior to 2.5.8 have a bug affecting 68000-based machines (optimizer
X adds 68020 instructions). See atari\README for comments on using
X other compilers.
X
X Macintosh
X Think C is the only currently supported compiler, although the Mac
X Programmer's Workbench (MPW) was supported at one time and still has
X hooks in unzip.h. For Think C, un-BinHex the Think C project file
X and UnZip resource file (using BinHex 4.0 or later), then click on
X something or other... :-) (I'm just making this up, since I haven't
X the faintest idea how Mac programming works.)
X
X Human68K
X [This is a Japanese machine and OS.] It appears that GNU make and
X gcc are required; presumably just do "gmake -f human68k/Makefile.gcc"
X to build everything.
X
X TOPS-20
X [No longer fully supported due to new, unported features, although
X patches always accepted.] Unpack all files into the current directory
X only (including those in the zipfile's tops20 directory), then use
X make.mic and "do make".
X
X Running the appropriate make utility should produce three executables on
X most systems, one for UnZip/ZipInfo, one for UnZipSFX, and one for fUnZip.
X (VMS is one prominent exception: fUnZip makes no sense on it.) Read any
X OS-specific README files for notes on setting things up for normal use
X (especially for VMS) and for warnings about known quirks and bugs in var-
X ious compilers (especially for MS-DOS).
X
X Also note that many OSes require a timezone variable to be set correctly
X (often "TZ"); Unix and VMS generally do so by default, but PC-based OSes
X generally do not. See the discussion of the -f and -u options in the
X unzip man page (or unzip.doc).
X
X Then test your new UnZip on a few archives and let us know if there are
X problems (but *please* first make certain that the archives aren't actu-
X ally corrupted and that you didn't make one of the silly mistakes dis-
X cussed in the documentation). If possible, test with PKUNZIP or with a
X previous version of UnZip, if you have one.
X
X
X
XTo install:
X===========
X
XUnix
X The default prefix for the installation location is /usr/local (things
X go into the bin and man/man1 subdirectories beneath the prefix), and
X the default man-page extension is "1" (corresponding to man/man1, above).
X To install as per the defaults, do "make install"; otherwise do "make
X prefix=/your/path manext=your_extension install". For example, to install
X in your home directory with "l" as the man-page extension (for "local"),
X do "make prefix=$HOME manext=l install". Permissions will be 755 for the
X executables and 644 for the man pages. In general root must perform in-
X stallation into a public directory. Do "rehash" if your shell requires
X it in order to find the new executables.
X
XVMS
X Install UnZip as foreign symbol by adding this to login.com:
X
X $ unzip == "$disk:[dir]unzip.exe"
X $ zipinfo == "$disk:[dir]unzip.exe ""-Z"""
X
X where "disk" and "dir" are the location of the UnZip executable; the "$"
X before the disk name is important, as are the double-double-quotes around
X the -Z. Some people, including the author, prefer a short alias such as
X "ii" instead of "zipinfo"; edit to taste. Optionally also install unzipsfx
X for use with the MAKESFX.COM command file. See vms/README (or [.VMS]README.)
X for details on this and for notes/warnings about zipfiles and UnZip under
X VMS.
X
XOS/2, MS-DOS, NT, Atari, Amiga
X Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to a direc-
X tory in your path; also possibly copy the UnZip executable to zipinfo.exe
X (or ii.exe), or else create an alias or a batch or command file for zipinfo
X ("@unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9" under MS-DOS). The latter is only
X relevant if NO_ZIPINFO was not defined, obviously...
X
XMacintosh, Human68K, TOPS-20
X Dunno...
END_OF_FILE
if test 20087 -ne `wc -c <'unzip-5.12/INSTALL'`; then
echo shar: \"'unzip-5.12/INSTALL'\" unpacked with wrong size!
fi
# end of 'unzip-5.12/INSTALL'
fi
if test -f 'unzip-5.12/human68k/human68k.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'unzip-5.12/human68k/human68k.c'\"
else
echo shar: Extracting \"'unzip-5.12/human68k/human68k.c'\" \(20529 characters\)
sed "s/^X//" >'unzip-5.12/human68k/human68k.c' <<'END_OF_FILE'
X/*---------------------------------------------------------------------------
X
X human68k.c
X
X Human68K-specific routines for use with Info-ZIP's UnZip 5.1 and later.
X
X Contains: do_wild()
X mapattr()
X mapname()
X checkdir()
X close_outfile()
X version()
X TwentyOne()
X normalize_name()
X
X ---------------------------------------------------------------------------*/
X
X
X#include <dirent.h>
X#include <sys/dos.h>
X#include <sys/xunistd.h>
X#include <jstring.h>
X#include "unzip.h"
X
X
Xstatic void normalize_name(char *);
X
Xstatic int created_dir; /* used in mapname(), checkdir() */
Xstatic int renamed_fullpath; /* ditto */
X
X/**********************/
X/* Function do_wild() */
X/**********************/
X
Xchar *do_wild(wildspec)
X char *wildspec; /* only used first time on a given dir */
X{
X static DIR *dir = NULL;
X static char *dirname, *wildname, matchname[FILNAMSIZ];
X static int firstcall=TRUE, have_dirname, dirnamelen;
X struct dirent *file;
X
X
X /* Even when we're just returning wildspec, we *always* do so in
X * matchname[]--calling routine is allowed to append four characters
X * to the returned string, and wildspec may be a pointer to argv[].
X */
X if (firstcall) { /* first call: must initialize everything */
X firstcall = FALSE;
X
X /* break the wildspec into a directory part and a wildcard filename */
X if ((wildname = strrchr(wildspec, '/')) == NULL) {
X dirname = ".";
X dirnamelen = 1;
X have_dirname = FALSE;
X wildname = wildspec;
X } else {
X ++wildname; /* point at character after '/' */
X dirnamelen = wildname - wildspec;
X if ((dirname = (char *)malloc(dirnamelen+1)) == NULL) {
X fprintf(stderr, "warning: can't allocate wildcard buffers\n");
X strcpy(matchname, wildspec);
X return matchname; /* but maybe filespec was not a wildcard */
X }
X strncpy(dirname, wildspec, dirnamelen);
X dirname[dirnamelen] = '\0'; /* terminate for strcpy below */
X have_dirname = TRUE;
X }
X
X if ((dir = opendir(dirname)) != NULL) {
X while ((file = readdir(dir)) != NULL) {
X if (file->d_name[0] == '.' && wildname[0] != '.')
X continue; /* Unix: '*' and '?' do not match leading dot */
X if (match(file->d_name, wildname, 0)) { /* 0 == case sens. */
X if (have_dirname) {
X strcpy(matchname, dirname);
X strcpy(matchname+dirnamelen, file->d_name);
X } else
X strcpy(matchname, file->d_name);
X return matchname;
X }
X }
X /* if we get to here directory is exhausted, so close it */
X closedir(dir);
X dir = NULL;
X }
X
X /* return the raw wildspec in case that works (e.g., directory not
X * searchable, but filespec was not wild and file is readable) */
X strcpy(matchname, wildspec);
X return matchname;
X }
X
X /* last time through, might have failed opendir but returned raw wildspec */
X if (dir == NULL) {
X firstcall = TRUE; /* nothing left to try--reset for new wildspec */
X if (have_dirname)
X free(dirname);
X return (char *)NULL;
X }
X
X /* If we've gotten this far, we've read and matched at least one entry
X * successfully (in a previous call), so dirname has been copied into
X * matchname already.
X */
X while ((file = readdir(dir)) != NULL)
X if (match(file->d_name, wildname, 0)) { /* 0 == don't ignore case */
X if (have_dirname) {
X /* strcpy(matchname, dirname); */
X strcpy(matchname+dirnamelen, file->d_name);
X } else
X strcpy(matchname, file->d_name);
X return matchname;
X }
X
X closedir(dir); /* have read at least one dir entry; nothing left */
X dir = NULL;
X firstcall = TRUE; /* reset for new wildspec */
X if (have_dirname)
X free(dirname);
X return (char *)NULL;
X
X} /* end function do_wild() */
X
X
X
X
X
X/**********************/
X/* Function mapattr() */
X/**********************/
X
Xint mapattr()
X{
X ulg tmp = crec.external_file_attributes;
X
X if (pInfo->hostnum == UNIX_ || pInfo->hostnum == VMS_)
X pInfo->file_attr = _mode2dos(tmp >> 16);
X else
X /* set archive bit (file is not backed up): */
X pInfo->file_attr = (unsigned)(crec.external_file_attributes|32) & 0xff;
X return 0;
X
X} /* end function mapattr() */
X
X
X
X
X
X/**********************/
X/* Function mapname() */
X/**********************/
X
Xint mapname(renamed) /* return 0 if no error, 1 if caution (filename trunc), */
X int renamed; /* 2 if warning (skip file because dir doesn't exist), */
X{ /* 3 if error (skip file), 10 if no memory (skip file) */
X char pathcomp[FILNAMSIZ]; /* path-component buffer */
X char *pp, *cp=NULL; /* character pointers */
X char *lastsemi = NULL; /* pointer to last semi-colon in pathcomp */
X int quote = FALSE; /* flags */
X int error = 0;
X register unsigned workch; /* hold the character being tested */
X
X
X/*---------------------------------------------------------------------------
X Initialize various pointers and counters and stuff.
X ---------------------------------------------------------------------------*/
X
X if (pInfo->vollabel)
X return IZ_VOL_LABEL; /* can't set disk volume labels in Unix */
X
X /* can create path as long as not just freshening, or if user told us */
X create_dirs = (!fflag || renamed);
X
X created_dir = FALSE; /* not yet */
X
X /* user gave full pathname: don't prepend rootpath */
X renamed_fullpath = (renamed && (*filename == '/'));
X
X if (checkdir((char *)NULL, INIT) == 10)
X return 10; /* initialize path buffer, unless no memory */
X
X *pathcomp = '\0'; /* initialize translation buffer */
X pp = pathcomp; /* point to translation buffer */
X if (jflag) /* junking directories */
X cp = (char *)strrchr(filename, '/');
X if (cp == NULL) /* no '/' or not junking dirs */
X cp = filename; /* point to internal zipfile-member pathname */
X else
X ++cp; /* point to start of last component of path */
X
X/*---------------------------------------------------------------------------
X Begin main loop through characters in filename.
X ---------------------------------------------------------------------------*/
X
X while ((workch = (uch)*cp++) != 0) {
X if (iskanji(workch)) {
X *pp++ = (char)workch;
X quote = TRUE;
X } else if (quote) { /* if character quoted, */
X *pp++ = (char)workch; /* include it literally */
X quote = FALSE;
X } else
X switch (workch) {
X case '/': /* can assume -j flag not given */
X *pp = '\0';
X if ((error = checkdir(pathcomp, APPEND_DIR)) > 1)
X return error;
X pp = pathcomp; /* reset conversion buffer for next piece */
X lastsemi = NULL; /* leave directory semi-colons alone */
X break;
X
X case ';': /* VMS version (or DEC-20 attrib?) */
X lastsemi = pp; /* keep for now; remove VMS ";##" */
X *pp++ = (char)workch; /* later, if requested */
X break;
X
X case '\026': /* control-V quote for special chars */
X quote = TRUE; /* set flag for next character */
X break;
X
X case ' ': /* change spaces to underscore under */
X *pp++ = '_'; /* MTS; leave as spaces under Unix */
X break;
X
X default:
X /* allow European characters in filenames: */
X if (isprint(workch) || (128 <= workch && workch <= 254))
X *pp++ = (char)workch;
X } /* end switch */
X
X } /* end while loop */
X
X *pp = '\0'; /* done with pathcomp: terminate it */
X
X /* if not saving them, remove VMS version numbers (appended ";###") */
X if (!V_flag && lastsemi) {
X pp = lastsemi + 1;
X while (isdigit((uch)(*pp)))
X ++pp;
X if (*pp == '\0') /* only digits between ';' and end: nuke */
X *lastsemi = '\0';
X }
X
X/*---------------------------------------------------------------------------
X Report if directory was created (and no file to create: filename ended
X in '/'), check name to be sure it exists, and combine path and name be-
X fore exiting.
X ---------------------------------------------------------------------------*/
X
X if (filename[strlen(filename) - 1] == '/') {
X checkdir(filename, GETPATH);
X if (created_dir && QCOND2) {
X fprintf(stdout, " creating: %s\n", filename);
X return IZ_CREATED_DIR; /* set dir time (note trailing '/') */
X }
X return 2; /* dir existed already; don't look for data to extract */
X }
X
X if (*pathcomp == '\0') {
X fprintf(stderr, "mapname: conversion of %s failed\n", filename);
X return 3;
X }
X
X checkdir(pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
X checkdir(filename, GETPATH);
X
X return error;
X
X} /* end function mapname() */
X
X
X
X
X
X/***********************/
X/* Function checkdir() */
X/***********************/
X
Xint checkdir(pathcomp, flag)
X char *pathcomp;
X int flag;
X/*
X * returns: 1 - (on APPEND_NAME) truncated filename
X * 2 - path doesn't exist, not allowed to create
X * 3 - path doesn't exist, tried to create and failed; or
X * path exists and is not a directory, but is supposed to be
X * 4 - path is too long
X * 10 - can't allocate memory for filename buffers
X */
X{
X static int rootlen = 0; /* length of rootpath */
X static char *rootpath; /* user's "extract-to" directory */
X static char *buildpath; /* full path (so far) to extracted file */
X static char *end; /* pointer to end of buildpath ('\0') */
X
X# define FN_MASK 7
X# define FUNCTION (flag & FN_MASK)
X
X
X
X/*---------------------------------------------------------------------------
X APPEND_DIR: append the path component to the path being built and check
X for its existence. If doesn't exist and we are creating directories, do
X so for this one; else signal success or error as appropriate.
X ---------------------------------------------------------------------------*/
X
X if (FUNCTION == APPEND_DIR) {
X int too_long = FALSE;
X char *old_end = end;
X
X Trace((stderr, "appending dir segment [%s]\n", pathcomp));
X while ((*end = *pathcomp++) != '\0')
X ++end;
X normalize_name(old_end);
X
X /* GRR: could do better check, see if overrunning buffer as we go:
X * check end-buildpath after each append, set warning variable if
X * within 20 of FILNAMSIZ; then if var set, do careful check when
X * appending. Clear variable when begin new path. */
X
X if ((end-buildpath) > FILNAMSIZ-3) /* need '/', one-char name, '\0' */
X too_long = TRUE; /* check if extracting directory? */
X if (stat(buildpath, &statbuf)) { /* path doesn't exist */
X if (!create_dirs) { /* told not to create (freshening) */
X free(buildpath);
X return 2; /* path doesn't exist: nothing to do */
X }
X if (too_long) {
X fprintf(stderr, "checkdir error: path too long: %s\n",
X buildpath);
X fflush(stderr);
X free(buildpath);
X return 4; /* no room for filenames: fatal */
X }
X if (mkdir(buildpath, 0666) == -1) { /* create the directory */
X fprintf(stderr, "checkdir error: can't create %s\n\
X unable to process %s.\n", buildpath, filename);
X fflush(stderr);
X free(buildpath);
X return 3; /* path didn't exist, tried to create, failed */
X }
X created_dir = TRUE;
X } else if (!S_ISDIR(statbuf.st_mode)) {
X fprintf(stderr, "checkdir error: %s exists but is not directory\n\
X unable to process %s.\n", buildpath, filename);
X fflush(stderr);
X free(buildpath);
X return 3; /* path existed but wasn't dir */
X }
X if (too_long) {
X fprintf(stderr, "checkdir error: path too long: %s\n", buildpath);
X fflush(stderr);
X free(buildpath);
X return 4; /* no room for filenames: fatal */
X }
X *end++ = '/';
X *end = '\0';
X Trace((stderr, "buildpath now = [%s]\n", buildpath));
X return 0;
X
X } /* end if (FUNCTION == APPEND_DIR) */
X
X/*---------------------------------------------------------------------------
X GETPATH: copy full path to the string pointed at by pathcomp, and free
X buildpath.
X ---------------------------------------------------------------------------*/
X
X if (FUNCTION == GETPATH) {
X strcpy(pathcomp, buildpath);
X Trace((stderr, "getting and freeing path [%s]\n", pathcomp));
X free(buildpath);
X buildpath = end = NULL;
X return 0;
X }
X
X/*---------------------------------------------------------------------------
X APPEND_NAME: assume the path component is the filename; append it and
X return without checking for existence.
X ---------------------------------------------------------------------------*/
X
X if (FUNCTION == APPEND_NAME) {
X char *old_end = end;
X
X Trace((stderr, "appending filename [%s]\n", pathcomp));
X while ((*end = *pathcomp++) != '\0') {
X ++end;
X normalize_name(old_end);
X if ((end-buildpath) >= FILNAMSIZ) {
X *--end = '\0';
X fprintf(stderr, "checkdir warning: path too long; truncating\n\
Xcheckdir warning: path too long; truncating\n\
X %s\n -> %s\n", filename, buildpath);
X fflush(stderr);
X return 1; /* filename truncated */
X }
X }
X Trace((stderr, "buildpath now = [%s]\n", buildpath));
X return 0; /* could check for existence here, prompt for new name... */
X }
X
X/*---------------------------------------------------------------------------
X INIT: allocate and initialize buffer space for the file currently being
X extracted. If file was renamed with an absolute path, don't prepend the
X extract-to path.
X ---------------------------------------------------------------------------*/
X
X/* GRR: for VMS and TOPS-20, add up to 13 to strlen */
X
X if (FUNCTION == INIT) {
X Trace((stderr, "initializing buildpath to "));
X if ((buildpath = (char *)malloc(strlen(filename)+rootlen+1)) == NULL)
X return 10;
X if ((rootlen > 0) && !renamed_fullpath) {
X strcpy(buildpath, rootpath);
X end = buildpath + rootlen;
X } else {
X *buildpath = '\0';
X end = buildpath;
X }
X Trace((stderr, "[%s]\n", buildpath));
X return 0;
X }
X
X/*---------------------------------------------------------------------------
X ROOT: if appropriate, store the path in rootpath and create it if neces-
X sary; else assume it's a zipfile member and return. This path segment
X gets used in extracting all members from every zipfile specified on the
X command line.
X ---------------------------------------------------------------------------*/
X
X#if (!defined(SFX) || defined(SFX_EXDIR))
X if (FUNCTION == ROOT) {
X Trace((stderr, "initializing root path to [%s]\n", pathcomp));
X if (pathcomp == NULL) {
X rootlen = 0;
X return 0;
X }
X if ((rootlen = strlen(pathcomp)) > 0) {
X int had_trailing_pathsep=FALSE;
X
X if (pathcomp[rootlen-1] == '/') {
X pathcomp[--rootlen] = '\0';
X had_trailing_pathsep = TRUE;
X }
X if (rootlen > 0 && (stat(pathcomp, &statbuf) ||
X !S_ISDIR(statbuf.st_mode))) /* path does not exist */
X {
X if (!create_dirs /* || iswild(pathcomp) */
X#ifdef OLD_EXDIR
X || !had_trailing_pathsep
X#endif
X ) {
X rootlen = 0;
X return 2; /* skip (or treat as stored file) */
X }
X /* create the directory (could add loop here to scan pathcomp
X * and create more than one level, but why really necessary?) */
X if (mkdir(pathcomp, 0777) == -1) {
X fprintf(stderr,
X "checkdir: can't create extraction directory: %s\n",
X pathcomp);
X fflush(stderr);
X rootlen = 0; /* path didn't exist, tried to create, and */
X return 3; /* failed: file exists, or 2+ levels required */
X }
X }
X if ((rootpath = (char *)malloc(rootlen+2)) == NULL) {
X rootlen = 0;
X return 10;
X }
X strcpy(rootpath, pathcomp);
X rootpath[rootlen++] = '/';
X rootpath[rootlen] = '\0';
X }
X Trace((stderr, "rootpath now = [%s]\n", rootpath));
X return 0;
X }
X#endif /* !SFX || SFX_EXDIR */
X
X/*---------------------------------------------------------------------------
X END: free rootpath, immediately prior to program exit.
X ---------------------------------------------------------------------------*/
X
X if (FUNCTION == END) {
X Trace((stderr, "freeing rootpath\n"));
X if (rootlen > 0)
X free(rootpath);
X return 0;
X }
X
X return 99; /* should never reach */
X
X} /* end function checkdir() */
X
X
X
X
X
X/****************************/
X/* Function close_outfile() */
X/****************************/
X
Xvoid close_outfile()
X{
X if (cflag) {
X fclose(outfile);
X return;
X }
X
X _dos_filedate(fileno(outfile),
X (ulg)lrec.last_mod_file_date << 16 | lrec.last_mod_file_time);
X fclose(outfile);
X _dos_chmod(filename, pInfo->file_attr);
X
X} /* end function close_outfile() */
X
X
X
X
X#ifndef SFX
X
X/************************/
X/* Function version() */
X/************************/
X
Xvoid version()
X{
X extern char Far CompiledWith[];
X#if 0
X char buf[40];
X#endif
X
X printf(LoadFarString(CompiledWith),
X
X#ifdef __GNUC__
X "gcc ", __VERSION__,
X#else
X# if 0
X "cc ", (sprintf(buf, " version %d", _RELEASE), buf),
X# else
X "unknown compiler", "",
X# endif
X#endif
X
X "Human68k", " (X68000)",
X
X#ifdef __DATE__
X " on ", __DATE__
X#else
X "", ""
X#endif
X );
X
X} /* end function version() */
X
X#endif /* !SFX */
X
X
X
X
X
X/* Human68K-specific routines */
X
X#define VALID_CHAR "()@_^{}!"
X
Xextern ulg TwentyOneOptions(void);
X
Xstatic int multi_period = 0;
Xstatic int special_char = 0;
X
Xvoid
XInitTwentyOne(void)
X{
X ulg stat;
X
X stat = TwentyOneOptions();
X if (stat == 0 || stat == (unsigned long) -1) {
X special_char = 0;
X multi_period = 0;
X return;
X }
X if (stat & (1UL << 29))
X special_char = 1;
X if (stat & (1UL << 28))
X multi_period = 1;
X}
X
Xstatic void
Xnormalize_name(char *name)
X{
X char *dot;
X char *p;
X
X if (strlen(name) > 18) { /* too long */
X char base[18 + 1];
X char ext[4 + 1];
X
X if ((dot = jstrrchr(name, '.')) != NULL)
X *dot = '\0';
X strncpy(base, name, 18);
X base[18] = '\0';
X if (dot) {
X *dot = '.';
X strncpy(ext, dot, 4);
X ext[4] = '\0';
X } else
X *ext = '\0';
X strcpy(name, base);
X strcat(name, ext);
X }
X dot = NULL;
X for (p = name; *p; p++) {
X if (iskanji((unsigned char)*p) && p[1] != '\0')
X p++;
X else if (*p == '.') {
X if (!multi_period) {
X dot = p;
X *p = '_';
X }
X } else if (!special_char && !isalnum (*p)
X && strchr(VALID_CHAR, *p) == NULL)
X *p = '_';
X }
X if (dot != NULL) {
X *dot = '.';
X if (strlen(dot) > 4)
X dot[4] = '\0';
X }
X}
END_OF_FILE
if test 20529 -ne `wc -c <'unzip-5.12/human68k/human68k.c'`; then
echo shar: \"'unzip-5.12/human68k/human68k.c'\" unpacked with wrong size!
fi
# end of 'unzip-5.12/human68k/human68k.c'
fi
if test -f 'unzip-5.12/mac/macstat.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'unzip-5.12/mac/macstat.c'\"
else
echo shar: Extracting \"'unzip-5.12/mac/macstat.c'\" \(5803 characters\)
sed "s/^X//" >'unzip-5.12/mac/macstat.c' <<'END_OF_FILE'
X#ifdef THINK_C
X#define MACOS
X#include <pascal.h>
X#endif
X#ifdef MPW
X#define MACOS
X#include <Files.h>
X#include <Errors.h>
X#define FSFCBLen (*(short *)0x3F6)
X#endif
X
X#ifdef MACOS
X#include <string.h>
X#include "macstat.h"
Xint macstat(char *path, struct stat *buf, short nVRefNum, long lDirID );
X
X#define unixTime(t) ((t) = ((t) < (time_t)0x7c25b080) ? 0 : (t) - (time_t)0x7c25b080)
X
X/* assume that the path will contain a Mac-type pathname, i.e. ':'s, etc. */
Xint macstat(char *path, struct stat *buf, short nVRefNum, long lDirID )
X{
X char temp[256];
X short nVRefNumT;
X long lDirIDT;
X short fIsHFS = false;
X OSErr err;
X short fUseDefault = ((nVRefNum == 0) && (lDirID == 0));
X
X if (buf == (struct stat *)0L || path == (char *)0L) {
X SysBeep(1);
X return -1;
X }
X
X if (path[0] == '\0' || strlen(path)>255) {
X return -1;
X }
X
X if ( fUseDefault )
X {
X if (GetVol((StringPtr)&temp[0], &nVRefNumT) != noErr) {
X SysBeep(1);
X return -1;
X }
X }
X
X /* get info about the specified volume */
X if (FSFCBLen > 0) /* HFS Disk? */
X {
X HParamBlockRec hpbr;
X
X if ( fUseDefault )
X {
X WDPBRec wdpb;
X
X wdpb.ioCompletion = 0;
X wdpb.ioNamePtr = (StringPtr)temp;
X err = PBHGetVol(&wdpb, 0);
X nVRefNumT = wdpb.ioWDVRefNum;
X lDirIDT = wdpb.ioWDDirID;
X }
X else
X {
X nVRefNumT = nVRefNum;
X lDirIDT = lDirID;
X err = noErr;
X }
X if (err == noErr)
X {
X hpbr.volumeParam.ioCompletion = 0;
X hpbr.volumeParam.ioNamePtr = (StringPtr)temp;
X hpbr.volumeParam.ioVRefNum = nVRefNumT;
X hpbr.volumeParam.ioVolIndex = 0;
X err = PBHGetVInfo(&hpbr, 0);
X
X if (err == noErr && hpbr.volumeParam.ioVFSID == 0
X && hpbr.volumeParam.ioVSigWord == 0x4244) {
X fIsHFS = true;
X }
X }
X }
X
X
X /* number of links, at least in System 6.0x, 0 */
X buf->st_nlink = 0;
X /* user id */
X buf->st_uid = 0;
X /* group id */
X buf->st_gid = 0;
X
X if (fIsHFS == true) /* HFS? */
X {
X CInfoPBRec cPB;
X HParamBlockRec hPB;
X
X /* get information about file */
X cPB.hFileInfo.ioCompletion = (ProcPtr)0L;
X c2pstr(path);
X strncpy(temp,path, path[0]+1);
X p2cstr(path);
X cPB.hFileInfo.ioNamePtr = (StringPtr)temp;
X cPB.hFileInfo.ioVRefNum = nVRefNumT;
X cPB.hFileInfo.ioDirID = lDirIDT;
X cPB.hFileInfo.ioFDirIndex = 0;
X
X err = PBGetCatInfo(&cPB, false);
X
X if (err != noErr) {
X if ((err != fnfErr) && (err != dirNFErr)) {
X SysBeep(1);
X }
X return -1;
X }
X
X /* Type of file: directory or regular file + access */
X buf->st_mode = (cPB.hFileInfo.ioFlAttrib & ioDirMask) ? S_IFDIR : S_IFREG |
X (cPB.hFileInfo.ioFlAttrib & 0x01) ? S_IREAD : (S_IREAD | S_IWRITE);
X
X /* last access time, modification time and creation time(?) */
X buf->st_atime = buf->st_mtime = cPB.hFileInfo.ioFlMdDat;
X buf->st_ctime = cPB.hFileInfo.ioFlCrDat;
X /* dev number */
X buf->st_dev = (long)cPB.hFileInfo.ioVRefNum;
X /* inode number */
X buf->st_ino = cPB.hFileInfo.ioDirID;
X /* size of file - use only the data fork */
X buf->st_size = cPB.hFileInfo.ioFlLgLen;
X
X /* size of disk block */
X hPB.volumeParam.ioCompletion = (ProcPtr)0L;
X hPB.volumeParam.ioNamePtr = (StringPtr)temp;
X hPB.volumeParam.ioVRefNum = nVRefNumT;
X hPB.volumeParam.ioVolIndex = 0;
X
X err = PBHGetVInfo(&hPB, false);
X
X if (err != noErr) {
X SysBeep(1);
X return -1;
X }
X
X buf->st_blksize = cPB.hFileInfo.ioFlPyLen / hPB.volumeParam.ioVAlBlkSiz;
X }
X else /* MFS? */
X {
X ParamBlockRec pPB;
X ParamBlockRec hPB;
X
X c2pstr(path);
X strncpy(temp, path, path[0]+1);
X p2cstr(path);
X pPB.fileParam.ioCompletion = (ProcPtr)0;
X pPB.fileParam.ioNamePtr = (StringPtr)temp;
X pPB.fileParam.ioVRefNum = nVRefNumT;
X pPB.fileParam.ioFVersNum = 0;
X pPB.fileParam.ioFDirIndex = 0;
X
X err = PBGetFInfo(&pPB, false);
X
X if (err != noErr) {
X SysBeep(1);
X return -1;
X }
X
X /* Type of file: either directory or regular file + access */
X buf->st_mode = (pPB.fileParam.ioFlAttrib & ioDirMask) ? S_IFDIR : S_IFREG;
X (pPB.fileParam.ioFlAttrib & 0x01) ? S_IREAD : (S_IREAD | S_IWRITE);
X
X /* last access time, modification time and creation time(?) */
X buf->st_atime = buf->st_mtime = pPB.fileParam.ioFlMdDat;
X buf->st_ctime = pPB.fileParam.ioFlCrDat;
X /* dev number */
X buf->st_dev = (long)pPB.fileParam.ioVRefNum;
X /* inode number */
X buf->st_ino = pPB.fileParam.ioFlNum;
X /* size of file - use only the data fork */
X buf->st_size = pPB.fileParam.ioFlLgLen;
X
X /* size of disk block */
X hPB.volumeParam.ioCompletion = (ProcPtr)0;
X hPB.volumeParam.ioNamePtr = (StringPtr)temp;
X hPB.volumeParam.ioVRefNum = nVRefNumT;
X hPB.volumeParam.ioVolIndex = 0;
X
X err = PBGetVInfo(&hPB, false);
X
X if (err != noErr) {
X SysBeep(1);
X return -1;
X }
X
X buf->st_blksize = pPB.fileParam.ioFlPyLen / hPB.volumeParam.ioVAlBlkSiz;
X }
X
X /* Convert from Macintosh time format to Unix time format. */
X
X unixTime(buf->st_atime);
X unixTime(buf->st_mtime);
X unixTime(buf->st_ctime);
X
X return 0;
X}
X#else
X#error 1
X#endif
END_OF_FILE
if test 5803 -ne `wc -c <'unzip-5.12/mac/macstat.c'`; then
echo shar: \"'unzip-5.12/mac/macstat.c'\" unpacked with wrong size!
fi
# end of 'unzip-5.12/mac/macstat.c'
fi
if test -f 'unzip-5.12/unix/zipinfo.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'unzip-5.12/unix/zipinfo.1'\"
else
echo shar: Extracting \"'unzip-5.12/unix/zipinfo.1'\" \(20438 characters\)
sed "s/^X//" >'unzip-5.12/unix/zipinfo.1' <<'END_OF_FILE'
X.\" Info-ZIP grants permission to any individual or institution to use, copy,
X.\" or redistribute this software, so long as: (1) all of the original files
X.\" are included; (2) it is not sold for profit; and (3) this notice is re-
X.\" tained.
X.\"
X.\" zipinfo.1 by Greg Roelofs and others.
X.\"
X.\" =========================================================================
X.\" define .X macro (for long-line ZipInfo output examples; small Courier):
X.de X
X.ft CW
X.nf
X.ie n .ti -5
X.el \{ .ti +2m
X.ps -1 \}
X\&\\$1
X.ie n .ti +5
X.el \{ .ti -2m
X.ps +1 \}
X.ft
X.fi
X..
X.\" define .Y macro (for user-command examples; normal Courier font):
X.de Y
X.ft CW
X.in +4n
X.nf
X\&\\$1
X.ft
X.in
X.fi
X..
X.\" =========================================================================
X.TH ZIPINFO 1L "28 Aug 94 (v2.02)"
X.SH NAME
Xzipinfo \- list detailed information about a ZIP archive
X.PD
X.\" =========================================================================
X.SH SYNOPSIS
X\fBzipinfo\fP [\fB\-12smlvhtTz\fP] \fIfile\fP[\fI.zip\fP]
X[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
X.LP
X\fBunzip\fP \fB\-Z\fP [\fB\-12smlvhtTz\fP] \fIfile\fP[\fI.zip\fP]
X[\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
X.PD
X.\" =========================================================================
X.SH DESCRIPTION
X\fIzipinfo\fP lists technical information about files in a ZIP archive, most
Xcommonly found on MS-DOS systems. Such information includes file access
Xpermissions, encryption status, type of compression, version and operating
Xsystem or file system of compressing program, and the like. The default
Xbehavior (with no options) is
Xto list single-line entries for each file in the archive, with header and
Xtrailer lines providing summary information for the entire archive. The
Xformat is a cross between Unix ``\fCls \-l\fR'' and ``\fCunzip \-v\fR''
Xoutput. See
X.B DETAILED DESCRIPTION
Xbelow. Note that \fIzipinfo\fP is the same program as \fIunzip\fP (under
XUnix, a link to it); on some systems, however, \fIzipinfo\fP support may
Xhave been omitted when \fIunzip\fP was compiled.
X.PD
X.\" =========================================================================
X.SH ARGUMENTS
X.TP
X.IR file [ .zip ]
XPath of the ZIP archive(s). If the file specification is a wildcard,
Xeach matching file is processed in an order determined by the operating
Xsystem (or file system). Only the filename can be a wildcard; the path
Xitself cannot. Wildcard expressions are similar to Unix \fIegrep\fP(1)
X(regular) expressions and may contain:
X.RS
X.IP *
Xmatches a sequence of 0 or more characters
X.IP ?
Xmatches exactly 1 character
X.IP [.\|.\|.]
Xmatches any single character found inside the brackets; ranges are specified
Xby a beginning character, a hyphen, and an ending character. If an exclamation
Xpoint or a caret (`!' or `^') follows the left bracket, then the range of
Xcharacters within the brackets is complemented (that is, anything \fIexcept\fP
Xthe characters inside the brackets is considered a match).
X.RE
X.IP
X(Be sure to quote any character which might otherwise be interpreted or
Xmodified by the operating system, particularly under Unix and VMS.) If no
Xmatches are found, the specification is assumed to be a literal filename;
Xand if that also fails, the suffix \fC.zip\fP is appended. Note that
Xself-extracting ZIP files are supported; just specify the \fC.exe\fP suffix
X(if any) explicitly.
X.IP [\fIfile(s)\fP]
XAn optional list of archive members to be processed.
XRegular expressions (wildcards) may be used to match multiple members; see
Xabove. Again, be sure to quote expressions that would otherwise be expanded
Xor modified by the operating system.
X.IP [\fB\-x\fP\ \fIxfile(s)\fP]
XAn optional list of archive members to be excluded from processing.
X.\" =========================================================================
X.SH OPTIONS
X.TP
X.B \-1
Xlist filenames only, one per line. This option excludes all others; headers,
Xtrailers and zipfile comments are never printed. It is intended for use in
XUnix shell scripts.
X.TP
X.B \-2
Xlist filenames only, one per line, but allow headers (\fB\-h\fP), trailers
X(\fB\-t\fP) and zipfile comments (\fB\-z\fP), as well. This option may be
Xuseful in cases where the stored filenames are particularly long.
X.TP
X.B \-s
Xlist zipfile info in short Unix ``\fCls \-l\fR'' format. This is the default
Xbehavior; see below.
X.TP
X.B \-m
Xlist zipfile info in medium Unix ``\fCls \-l\fR'' format. Identical to the
X\fB\-s\fP output, except that the compression factor, expressed as a
Xpercentage, is also listed.
X.TP
X.B \-l
Xlist zipfile info in long Unix ``\fCls \-l\fR'' format. As with \fB\-m\fP
Xexcept that the compressed size (in bytes) is printed instead of the
Xcompression ratio.
X.TP
X.B \-v
Xlist zipfile information in verbose, multi-page format.
X.TP
X.B \-h
Xlist header line. The archive name, actual size (in bytes) and total number
Xof files is printed.
X.TP
X.B \-t
Xlist totals for files listed or for all files. The number of files listed,
Xtheir uncompressed and compressed total sizes, and their overall compression
Xfactor is printed; or, if only the totals line is being printed, the values
Xfor the entire archive are given. Note that the total compressed (data)
Xsize will never match the actual zipfile size, since the latter includes all
Xof the internal zipfile headers in addition to the compressed data.
X.TP
X.B \-T
Xprint the file dates and times in a sortable decimal format (yymmdd.hhmmss).
XThe default date format is a more standard, human-readable version with
Xabbreviated month names (see examples below).
X.TP
X.B \-z
Xinclude the archive comment (if any) in the listing.
X.PD
X.\" =========================================================================
X.SH DETAILED DESCRIPTION
X.I zipinfo
Xhas a number of modes, and its behavior can be rather difficult to fathom
Xif one isn't familiar with Unix \fIls\fP(1) (or even if one is). The default
Xbehavior is to list files in the following format:
X.LP
X.X "-rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660"
X.LP
XThe last three fields are the modification date and time of
Xthe file, and its name. The case of the filename is respected; thus
Xfiles which come from MS-DOS PKZIP are always capitalized. If the file
Xwas zipped with a stored directory name, that is also displayed as part
Xof the filename.
X.LP
XThe second and third fields indicate that the file was zipped under
XUnix with version 1.9 of \fIzip\fP. Since it comes from Unix, the file
Xpermissions at the beginning of the line are printed in Unix format.
XThe uncompressed file-size (2802 in this example) is the fourth field.
X.LP
XThe fifth field consists of two characters, either of which may take
Xon several values. The first character may be either `t' or `b', indicating
Xthat \fIzip\fP believes the file to be text or binary, respectively;
Xbut if the file is encrypted, \fIzipinfo\fP
Xnotes this fact by capitalizing the character (`T' or `B'). The second
Xcharacter may also take on four values, depending on whether there is
Xan extended local header and/or an ``extra field'' associated with the
Xfile (fully explained in PKWare's APPNOTE.TXT, but basically analogous to
Xpragmas in ANSI C--i.e., they provide a standard way to include non-standard
Xinformation in the archive). If neither exists, the character
Xwill be a hyphen (`\-'); if there is an extended local header but no extra
Xfield, `l'; if the reverse, `x'; and if both exist, `X'. Thus the
Xfile in this example is (probably) a text file, is not encrypted, and
Xhas neither an extra field nor an extended local header associated with it.
XThe example below, on the other hand, is an encrypted binary file with an
Xextra field:
X.LP
X.X "RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644"
X.LP
XExtra fields are used for various purposes (see discussion of the \fB\-v\fP
Xoption below) including the storage of VMS file attributes, which is
Xpresumably the case here. Note that the file attributes are listed in
XVMS format. Some other possibilities for the host operating system (which
Xis actually a misnomer--host file system is more correct) include
XOS/2 or NT with High Performance File System (HPFS), MS-DOS, OS/2 or NT
Xwith File Allocation Table (FAT) file system, and Macintosh. These are
Xdenoted as follows:
X.LP
X.X "-rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs"
X.X "-r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF"
X.X "--w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macr"
X.LP
XFile attributes in the first two cases are indicated in a Unix-like format,
Xwhere the seven subfields indicate whether the file: (1) is a directory,
X(2) is readable (always true), (3) is writable, (4) is executable (guessed
Xon the basis of the extension--\fI.exe\fP, \fI.com\fP, \fI.bat\fP, \fI.cmd\fP
Xand \fI.btm\fP files are assumed to be so), (5) has its archive bit set,
X(6) is hidden, and (7) is a system file. Interpretation of Macintosh file
Xattributes is unreliable because some Macintosh archivers don't store any
Xattributes in the archive.
X.LP
XFinally, the sixth field indicates
Xthe compression method and possible sub-method used. There are six methods
Xknown at present: storing (no compression), reducing, shrinking, imploding,
Xtokenizing (never publicly released), and deflating. In addition, there are
Xfour levels of reducing (1 through 4); four types of imploding (4K or 8K
Xsliding dictionary, and 2 or 3 Shannon-Fano trees); and four levels of
Xdeflating (superfast, fast, normal, maximum compression). \fIzipinfo\fP
Xrepresents these methods and their sub-methods as follows: \fIstor\fP;
X\fIre:1\fP, \fIre:2\fP, etc.; \fIshrk\fP; \fIi4:2\fP, \fIi8:3\fP, etc.;
X\fItokn\fP; and \fIdefS\fP, \fIdefF\fP, \fIdefN\fP, and \fIdefX\fP.
X.LP
XThe medium and long listings are almost identical to the short format except
Xthat they add information on the file's compression. The medium format lists
Xthe file's compression factor as a percentage indicating the amount of space
Xwhich has been ``removed'':
X.LP
X.X "-rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660"
X.LP
XIn this example, the file has been compressed by more than a factor of
Xfive; the compressed data are only 19% of the original size. The long
Xformat gives the compressed file's size in bytes, instead:
X.LP
X.X "-rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660"
X.LP
XAdding the \fB\-T\fP option changes the file date and time to decimal
Xformat:
X.LP
X.X "-rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660"
X.LP
XNote that because of limitations in the MS-DOS format used to store file
Xtimes, the seconds field is always rounded to the nearest even second.
XFor Unix files this is expected to change in the next major releases of
X\fIzip\fP(1L) and \fIunzip\fP.
X.LP
XIn addition to individual file information, a default zipfile listing
Xalso includes header and trailer lines:
X.LP
X.X "Archive: OS2.zip 5453 bytes 5 files"
X.X ",,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents"
X.X ",,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2"
X.X ",,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c"
X.X ",,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def"
X.X ",,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def"
X.X "5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%"
X.LP
XThe header line gives the name of the archive, its total size, and the
Xtotal number of files; the trailer gives the number of files listed,
Xtheir total uncompressed size, and their total compressed size (not
Xincluding any of \fIzip\fP's internal overhead). If, however, one or
Xmore \fIfile(s)\fP are provided, the header and trailer lines are
Xnot listed. This behavior is also similar to that of Unix's ``\fCls \-l\fR'';
Xit may be overridden by specifying the \fB\-h\fP and \fB\-t\fP options
Xexplicitly.
XIn such a case the listing format must also be specified explicitly,
Xsince \fB\-h\fP or \fB\-t\fP (or both) in the absence of other options implies
Xthat ONLY the header or trailer line (or both) is listed. See the
X\fBEXAMPLES\fP section below for a semi-intelligible translation of this
Xnonsense.
X.LP
XThe verbose listing is mostly self-explanatory. It also lists file
Xcomments and the zipfile comment, if any, and the type and number of bytes
Xin any stored extra fields. Currently known types of extra fields include
XPKWARE's authentication (``AV'') info; OS/2 extended attributes; VMS
Xfilesystem info, both PKWARE and Info-ZIP versions; Macintosh resource
Xforks; Acorn/Archimedes SparkFS info; and so on. (Note
Xthat in the case of OS/2 extended attributes--perhaps the most common
Xuse of zipfile extra fields--the size of the stored EAs as reported by
X\fIzipinfo\fP may not match the number given by OS/2's \fIdir\fP command:
XOS/2 always reports the number of bytes required in 16-bit format, whereas
X\fIzipinfo\fP always reports the 32-bit storage.)
X.PD
X.\" =========================================================================
X.SH ENVIRONMENT OPTIONS
XModifying \fIzipinfo\fP's default behavior via options placed in
Xan environment variable can be a bit complicated to explain, due to
X\fIzipinfo\fP's attempts to handle various defaults in an intuitive,
Xyet Unix-like, manner. (Try not to laugh.) Nevertheless, there is some
Xunderlying logic. In brief,
Xthere are three ``priority levels'' of options: the default options;
Xenvironment options, which can override or add to the defaults; and
Xexplicit options given by the user, which can override or add to
Xeither of the above.
X.LP
XThe default listing format, as noted above, corresponds roughly
Xto the "\fCzipinfo \-hst\fP" command (except when individual zipfile members
Xare specified).
XA user who prefers the long-listing format (\fB\-l\fP) can make use of the
X\fIzipinfo\fP's environment variable to change this default:
X.LP
X.DT
X.ft CW
X.in +4n
X.ta \w'ZIPINFO=\-l; export ZIPINFO'u+4n
X.in
X.ft
X.PD 0
X.Y "ZIPINFO=\-l; export ZIPINFO\t\fRUnix Bourne shell"
X.Y "setenv ZIPINFO \-l\t\fRUnix C shell"
X.Y "set ZIPINFO=\-l\t\fROS/2 or MS-DOS"
X.Y "define ZIPINFO_OPTS ""\-l""\t\fRVMS (quotes for \fIlowercase\fP)"
X.PD
X.LP
XIf, in addition, the user dislikes the trailer line, \fIzipinfo\fP's
Xconcept of ``negative options'' may be used to override the default
Xinclusion of the line. This is accomplished by preceding the undesired
Xoption with one or more minuses: e.g., ``\fC\-l\-t\fR'' or ``\fC\-\-tl\fR'',
Xin this example. The first hyphen is the regular switch character, but the
Xone before the `t' is a minus sign. The dual use of hyphens may seem a
Xlittle awkward, but it's reasonably intuitive nonetheless: simply ignore
Xthe first hyphen and go from there. It is also consistent with the behavior
Xof the Unix command \fInice\fP(1).
X.LP
XAs suggested above, the default variable names are ZIPINFO_OPTS for VMS
X(where the symbol used to install \fIzipinfo\fP as a foreign command
Xwould otherwise be confused with the environment variable), and ZIPINFO
Xfor all other operating systems. For compatibility with \fIzip\fP(1L),
XZIPINFOOPT is also accepted (don't ask). If both ZIPINFO and ZIPINFOOPT
Xare defined, however, ZIPINFO takes precedence. \fIunzip\fP's diagnostic
Xoption (\fB\-v\fP with no zipfile name) can be used to check the values
Xof all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
X.PD
X.\" =========================================================================
X.SH EXAMPLES
XTo get a basic, short-format listing of the complete contents of a ZIP
Xarchive \fIstorage.zip\fP, with both header and totals lines, use only
Xthe archive name as an argument to zipinfo:
X.LP
X.Y "zipinfo storage"
X.LP
XTo produce a basic, long-format listing (not verbose), including header and
Xtotals lines, use \fB\-l\fP:
X.LP
X.Y "zipinfo \-l storage"
X.LP
XTo list the complete contents of the archive without header and totals
Xlines, either negate the \fB\-h\fP and \fB\-t\fP options or else specify the
Xcontents explicitly:
X.LP
X.PD 0
X.Y "zipinfo \-\-h\-t storage"
X.Y "zipinfo storage \e*"
X.PD
X.LP
X(where the backslash is required only if the shell would otherwise expand
Xthe `*' wildcard, as in Unix when globbing is turned on--double quotes around
Xthe asterisk would have worked as well). To turn off the totals line by
Xdefault, use the environment variable (C shell is assumed here):
X.LP
X.PD 0
X.Y "setenv ZIPINFO \-\-t"
X.Y "zipinfo storage"
X.PD
X.LP
XTo get the full, short-format listing of the first example again, given
Xthat the environment variable is set as in the previous example, it is
Xnecessary to specify the \fB\-s\fP option explicitly, since the \fB\-t\fP
Xoption by itself implies that ONLY the footer line is to be printed:
X.LP
X.PD 0
X.Y "setenv ZIPINFO \-\-t"
X.Y "zipinfo \-t storage\t\fR[only totals line]"
X.Y "zipinfo \-st storage\t\fR[full listing]"
X.PD
X.LP
XThe \fB\-s\fP option, like \fB\-m\fP and \fB\-l\fP, includes headers and
Xfooters by default, unless otherwise specified. Since the environment
Xvariable specified no footers and that has a higher precedence than the
Xdefault behavior of \fB\-s\fP, an explicit \fB\-t\fP option was necessary
Xto produce the full listing. Nothing was indicated about the header,
Xhowever, so the \fB\-s\fP option was sufficient. Note that both the
X\fB\-h\fP and \fB\-t\fP options, when used by themselves or with
Xeach other, override any default listing of member files; only the header
Xand/or footer are printed. This behavior is useful when \fIzipinfo\fP is
Xused with a wildcard zipfile specification; the contents of all zipfiles
Xare then summarized with a single command.
X.LP
XTo list information on a single file within the archive, in medium format,
Xspecify the filename explicitly:
X.LP
X.Y "zipinfo \-m storage unshrink.c"
X.LP
XThe specification of any member file, as in this example, will override
Xthe default header and totals lines; only the single line of information
Xabout the requested file will be printed. This is intuitively what one
Xwould expect when requesting information about a single file. For multiple
Xfiles, it is often useful to know the total compressed and uncompressed
Xsize; in such cases \fB\-t\fP may be specified explicitly:
X.LP
X.Y "zipinfo \-mt storage ""*.[ch]"" Mak\e*"
X.LP
XTo get maximal information about the ZIP archive, use the verbose
Xoption. It is usually wise to pipe the output into a filter such as
XUnix \fImore\fP(1) if the operating system allows it:
X.LP
X.Y "zipinfo \-v storage | more"
X.LP
XFinally, to see the most recently modified files in the archive, use
Xthe \fB\-T\fP option in conjunction with an external sorting utility
Xsuch as Unix \fIsort\fP(1) (and \fItail\fP(1) as well, in this example):
X.LP
X.Y "zipinfo \-T storage | sort -n +6 | tail -15"
X.LP
XThe \fB\-n\fP option to \fIsort\fP(1) tells it to sort numerically
Xrather than in ASCII order, and the \fB\+6\fP option tells it to sort
Xon the sixth field after the first one (i.e., the seventh field). This
Xassumes the default short-listing format; if \fB\-m\fP or \fB\-l\fP is
Xused, the proper \fIsort\fP(1) option would be \fB\+7\fP. The \fItail\fP(1)
Xcommand filters out all but the last 15 lines of the listing. Future
Xreleases of \fIzipinfo\fP may incorporate date/time and filename sorting
Xas built-in options.
X.PD
X.\" =========================================================================
X.SH TIPS
XThe author finds it convenient to define an alias \fIii\fP for \fIzipinfo\fP
Xon systems which allow aliases (or, on other systems, copy/rename the
Xexecutable, create a link or create a command file with the name \fIii\fP).
XThe \fIii\fP usage parallels the common \fIll\fP alias for long listings in
XUnix, and the similarity between the outputs of the two commands was
Xintentional.
X.PD
X.\" =========================================================================
X.SH BUGS
XNone known at this time, but we're always delighted to find a good one.
X.LP
X.\" =========================================================================
X.SH SEE ALSO
X\fIls\fP(1), \fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L),
X\fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
X.PD
X.\" =========================================================================
X.SH AUTHOR
XGreg Roelofs (a.k.a.\ Cave Newt). ZipInfo contains pattern-matching code
Xby Mark Adler and fixes/improvements by many others. Please refer to the
XCONTRIBS file in the UnZip source distribution for a more complete list.
END_OF_FILE
if test 20438 -ne `wc -c <'unzip-5.12/unix/zipinfo.1'`; then
echo shar: \"'unzip-5.12/unix/zipinfo.1'\" unpacked with wrong size!
fi
# end of 'unzip-5.12/unix/zipinfo.1'
fi
echo shar: End of archive 14 \(of 20\).
cp /dev/null ark14isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 20 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...