Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

v31i093: zip19 - Info-ZIP portable Zip, version 1.9, Part01/11

33 views
Skip to first unread message

Info-ZIP group

unread,
Aug 23, 1992, 2:44:52 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 93
Archive-name: zip19/part01
Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

______________________________________________________________________

Zip 1.9 is a compression and file packaging utility. It is analogous
NOTE: Info-ZIP's mailing addresses and ftp site will be changing
within the next month. The current e-mail addresses should hold for
a while via mail-forwarding, but watch for the new addresses in our
next release.
______________________________________________________________________

Zip 1.9 is a compression and file packaging utility. It is analogous
to a combination of tar and compress and is compatible with PKZIP 1.93a
(Phil Katz ZIP) for MSDOS systems. There is a companion to Zip called
UnZip (of course) which is being posted concurrently, as are the encryp-
tion/decryption routines for Zip and UnZip, and a Microsoft Windows add-
on to UnZip called WizUnZip.

This version of Zip has been ported to a wide array of Unix and other
mainframes, minis, and micros including VMS, OS/2, Minix, MSDOS, Windows-
NT, Atari, and Macintosh (the latter two have not been tested recently).
Although highly compatible with PKware's PKZIP and PKUNZIP utilities of
MSDOS fame, our primary objective has been one of portability and other-
than-MSDOS functionality. Features not found in the PKWare version in-
clude creation of zip files in a pipe or on a device; VMS and OS/2 ex-
tended file attributes; conversion from Unix to MSDOS text file format;
the ZipSplit and ZipNote utilities; and, of course, the ability to run
on most of your favorite operating systems. Plus it's free. :-)

------------
#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.
# Contents: atari history mac msdos nt os2 tailor.h vms
# Wrapped by kent@sparky on Sun Aug 23 01:00:42 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 1 (of 11)."'
if test ! -d 'atari' ; then
echo shar: Creating directory \"'atari'\"
mkdir 'atari'
fi
if test -f 'history' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'history'\"
else
echo shar: Extracting \"'history'\" \(49244 characters\)
sed "s/^X//" >'history' <<'END_OF_FILE'
XNote, this history contains mail addresses and ftp locations that no longer
Xexist, such as addresses at wsmr-simtel20 and directory names containing
Xw8sdz, among others. For problems, the correct email address is
Xzip...@cs.ucla.edu.
X
X------------------------ Nov 7 1990 version 0.0 ------------------------
X------------------------ Nov 8 1990 version 0.1 ------------------------
X------------------------ Nov 12 1990 version 0.2 ------------------------
X------------------------ Nov 14 1990 version 0.3 ------------------------
XThank you for your comments. Here is Zip 0.3 with almost all of that fixed.
XThe changes include:
X
X1. Put \n\ for newlines in long strings (everyone had this problem).
X2. Wrote my own bsearch (called search---different args).
X3. Wrote my own timelocal (called invlocal), used whether STDC or not.
X (Note to Greg: look at the code---I found a simple way to do it.)
X4. -m now deletes empty directories also.
X5. Changed crc.c to util.c and put search() in util.c.
X6. Changed "void *" to "voidp *" and made voidp void for STDC, else char.
X7. Removed -a option.
X8. Some minor changes to zip.doc.
X
XI did not do anything about Cliff Manis's problem with DIR not being
Xdefined. DIR should have been defined in sys/dir.h. If it wasn't, then
Xthere's something wrong with dir.h, or it is missing, or the opendir, etc.
Xfunctions are missing. I don't really want to think about what to do for
Xthe latter possibility.
X
XNUnzip 3.99 does not appear to be Unix-ready. It fails for file names longer
Xthan 12 characters (Segmentation fault), cannot find explicit names that
Xdo not contain a dot, and does not notice the Unix identifier (which should
Xswitch off name to lower-case mapping).
X
X------------------------ Nov 20 1990 version 0.4 ------------------------
XYo Zippers,
X
XHere is a first attempt at a Zip intended to work on System V. Try using
X"make sysv" for such systems. I also included replacements for memset()
Xand memcmp() by Bill Davidsen and James Dugal for systems without those.
XUse "make old" to include those routines. Sun's use getdents() like Sys V,
Xeven though it's BSD, so use "make sun". For others, try just "make".
X
XWhen using "make" a second time with a different request, it's best to erase
Xall the .o files to force recompiling everything.
X
XWhat follows are the changes I made and some things to try if you get it
Xcompiled. Have fun.
X
XMark
X
X
XChanges from Zip 0.3 to Zip 0.4:
X
X1. Changed third arg of search() to size_t to make lint happier.
X2. Replaced zip.doc with a man page, zip.1 (raw) and zip.man (formatted).
X3. rename() replaced with link() and unlink().
X4. Fixed vem in central header and added REVISION and REVDATE #define's
X to zip.h. (Didn't read Phil's appnote.txt carefully enough there.)
X5. Removed prototypes except for development host (NeXT). (They're only
X there for my benefit anyway---they should not affect the resulting
X code. Consider them some meager documentation.)
X6. Changed rindex() to strrchr().
X7. Improved behavior on a write failure when -b is used.
X8. Added Bill Davidsen's and James Dugal's memset(), memcpy(), and
X memcmp() routines under the trusty ZMEM #define.
X9. Check that zip file is writeable before doing any real work.
X10. Added #ifdef REGEX to use regcmp(), regex() instead of re_comp(),
X re_exec(). (We'll see if this works.)
X11. Replaced opendir(), readdir(), closedir() with my own opend(), readd(),
X and closed() routines that use getdirentries() on BSD and getdents() on
X System V (I hope) and Sun's. An #ifdef DIRENT selects getdents().
X12. zip.h no longer #includes string.h, instead defining the string
X functions used explicitly.
X
X
XIf you get Zip 0.4 to compile, here are some things to test:
X
X1. Try zipping up some stuff, of course. Use all the options that are
X implemented. Especially try -rp and -rpm on a directory tree (use
X *test* files and directories, of course).
X2. Naturally check with unzip -t, but also check with "zip xxx" where
X xxx.zip is the zip file. This should say "nothing to do", but if it
X says "error in zip file structure", there's a problem.
X3. After zipping, check that there are no $Z* files leftover.
X4. Try using -b, specifying a path on another device. Check for $Z*'s.
X5. Try -d and a regular expression (like \*.o) on a zip file.
X6. And I'm interested in timing---try it on a 500K or so text file.
X
X------------------------ Nov 27 1990 version 0.5 ------------------------
XHail fellow zippers,
X
XHere's Zip 0.5. The biggie is it now includes implosion, courtesy of Rich
XWales. Even as we speak, he is working on new algorithms for implode that
Xpromise to be significantly faster. He might even get a paper out of it ...
X
XYou can use the -s option (shrink only) when testing to save a little time,
Xbut also try it normally to test implosion (if you test with text files
Xof reasonable length, implosion will be chosen for most of them). Also, for
Xspeed testing of implosion, use -i to not waste time trying to shrink.
X
XIncluding implosion about doubles the size of zipnn.tar.Z, so I would like
Xsome input on distributing subsequent versions. Would y'all like to keep
Xon getting the uuencoded version via mail, or would you prefer a notice
Xabout availability via anonymous ftp on simtel20.army.mil in <w8sdz.zip>?
X(I have been sending the previous versions to Keith to put there, and will
Xcontinue to do so. I do not know what the lag time is for him to move it
Xthere.)
X
XThe other important change is that this is another attempt at getting the
Xdirectory access routines working on all systems. Read the installation
Xpart of the manual page (zip.man). And if you feel like, read the whole
Xthing. I'm also taking suggestions for and bugs in the documentation.
X
XThe differences from Zip 0.4 include:
X
X1. Changed all occurences of "size_t" to "extent" and typedef'ed extent
X to size_t (after an #include <stddef.h>) for ANSI C, or unsigned int
X otherwise. If anyone finds that they have a non ANSI C, that size_t
X is defined, and that it is not the size of the compiler's int, then
X please let me know.
X2. Changed help() to put the help text in a static array of strings and
X then printf() for each line. Some compilers barfed on the long
X string. Suggested by davi...@crdos1.crd.ge.com.
X3. Added Rich Wales' implode routines, made their inclusion the default
X (changed #ifdef IMPLODE to #ifndef NOIMPLODE).
X4. Put "extern int errno;" in unixfile.c (redundant extern's should be ok).
X5. Minor changes to the man page (zip.1 and zip.man).
X6. Added warnings for names given on the command line that are not matched.
X Lack pointed out by gri...@sj.ATE.SLB.COM (George).
X7. Changed back to opendir(), etc. on BSD systems.
X8. Added NDIR #define for HPUX to #include <ndir.h> instead of <sys/dir.h>.
X9. Redid Makefile, adding next (use shared library), sysvpw (System V's
X that require linking the libPW library for regex routines), and hpux
X (see #8 above).
X
XAs usual, report problems to info...@wsmr-simtel20.army.mil. If you wish,
Xyou can, in addition, send the same report to me (mad...@piglet.caltech.edu)
Xor Rich (wa...@cs.ucla.edu) if the problem is with implosion (i* files) for
Xquicker reponse.
X
Xyour humble servant,
XMark Adler
X------------------------ Dec 7 1990 version 0.6 ------------------------
XGreetings and Felicitations Honorable Zip Compatriots,
X
XI have uploaded Zip 0.6, which incorporates most of your helpful comments,
Xto Simtel20.Army.Mil, and it should evenually end up in <W8SDZ.ZIP> as
XZIP06.TAR-Z. The most significant change is the addition of encryption
Xboth as the -e option in Zip, and a new program, ZipCloak, that encrypts
Xand decrypts zip entries. This surely adds some new portability problems,
Xdue to the getp() routine which reads a password from the terminal with no
Xechoing. We'll see how well this flies ...
X
XIf someone wants to PKZIP up the tar.Z file, please do so. I didn't zip
Xit up myself because a) I'm lazy, and b) PKZIP can compress it better
Xanyhow, and I don't have a PC.
X
XAlso, there is an EXPORT symbol used to remove encryption, so I can make
Xan export version that does not have -e or ZipCloak. This version will
Xsimply be missing a few source files and have a different Makefile.
X
XI also added a few systems to the Makefile, and made some other changes to
Xit based on all your detailed comments. If it still works after all that,
XI'll be amazed.
X
XThose and other changes from 0.5 to 0.6 are detailed at the end of this note.
X
XI have not addressed the portability problem with the implode routines,
Xsince that is Rich's domain. I have no idea what is causing it. (For those
Xwho don't know, one system produced remarkable 90% compression rates with
Ximplode, but alas, it is a bug.)
X
XOne fellow complained that zipping up the README file results in a zip file
Xthat is larger than the original, even though Zip claims it compressed it.
XWell, it did compress it, but the ZIP file format has an overhead of
X76+2*N bytes per file+22 bytes, where N is the length of the file name.
XAnd that's without comments or "extra" information. So, a zip file with a
Xsingle file whose name has six characters has an overhead of 110 bytes.
XREADME gets shrunk by 16% from 274 bytes to 230 bytes, resulting in a total
Xzip file size of 340 bytes---larger than the original file (274 bytes).
XThe moral is don't expect zip to compress a single small file. The other
Xmoral is use unzip -v to see the compression.
X
XSomeone else asked about multi-disk zip files. I'm not sure I believe in
Xthose, since PKZIP and PKUNZIP do not appear to suppport them (though it is
Xpart of the ZIP file definition in APPNOTE.TXT). What I was planning on
Xdoing for that case was to write a ZipSplit program that would take a large
Xzip file and try to optimally split it into the fewest number of zip files
Xthat are all less than the specified size. Each would be a complete, stand
Xalone zip file---not part of a single, multi-disk zip file. There would
Xalso be a ZipMerge program.
X
XThis is the version of Zip that will live in infamy (note the revision date).
XOf course, some current Presidents of the United States think that should be
XSeptember 7th, but I won't name any names.
X
XI am going on vacation for about two weeks, so I expect to find many new
Xproblems reported upon my return.
X
XAnd lastly, for my Holiday Greetings: Party On Dudes.
X
XMark Adler
Xma...@piglet.caltech.edu
X
X
XHere are the changes from Zip 0.5 to Zip 0.6:
X
X1. Minor documentation changes (zip.1 and zip.man).
X2. Fixed an embarrasing lack of recursion in opend/readd/closed functions
X that only existed in 0.5.
X3. Moved $(LDFLAGS) to end of the linking command line in Makefile.
X4. Added make dnix for DNIX 5.2, 5.3 not using optimization (no -O).
X5. Wrote ZipCloak for encryption and decryption.
X6. Rich changed the output routines of implode to use zfwrite and zputc to
X provide hooks for encryption (defined in crypt.h). Also removed
X function prototypes unless PROTO defined.
X7. Added encryption (-e) to Zip.
X8. Added make pyramid (use rindex() instead of strrchr()).
X9. Changed make to $(MAKE) and cc to $(CC) in Makefile.
X10. Took out strip in Makefile.
X11. Changed year from 1991 to 1990. (How'd *that* get in there? Of course,
X it's not as bad as when I wrote a check the other day and dated it 1977.
X I think my brain cell isn't working as well as it used to.)
X12. Added make cray (use scc instead of cc).
X13. Added make amdahl (use system() instead of rmdir()).
X14. Added entry of one-line comments for added files (-c).
X15. Put comment delimiters around name following #endif's in Rich's code.
X
X------------------------ Feb 13 1991 version 0.7 ------------------------
XFellow stuck zippers,
X
XWell folks, it's been a while since 0.6. so there have been a lot of
Xchanges on the way to 0.7. The exhaustive listing is below, but here are
Xsome highlights ...
X
XImplode now (appears) to be PKUNZIP compatible. There were many odd
Xlittle requirements implosed by the coding of PKUNZIP that were obtained
Xfrom Phil Katz and associates. Now that Rich has that working, he will
Xlikely be working on much faster string matching routines to speed up
Ximplode.
X
XUser interrupts (control-C or kill) are now caught and the temporary files
Xare deleted, making for a clean getaway.
X
XSelf-extracting zip files for MSDOS can now be processed, with the
Xextensions zip, ZIP, exe, or EXE. This allows you to make self-extracting
Xzip files for MSDOS by taking an existing one (like PKZ110.EXE) and
Xdeleting all the entries to get a prototype self-extracting zip file that
Xcan be copied and added to. Of course, you should only do this if you are
Xa registered user of PKZIP. Note that if the file does not end in .zip,
Xyou have to give the full name.
X
XI have relaxed some of the restrictions on zip files to allow processing
Xones with "authenticity verification" (applied by the PUTAV program that
Xcomes with PKZIP). Of course, the authenticity no longer checks out if
Xyou muck with the file, but at least you can muck with it now.
X
XThe Makefile has been considerably simplified, thanks to suggestions from
XJean-Loup Gailly. Also, I wrote my own sh expression matcher, eliminating
Xthe regular expression hassles, and the REGEX symbol and -lPW options in
Xthe Makefile.
X
XMany, many cosmetic changes, the most dangerous of which was turning on
Xprototypes again in the hopes we can get them to work. If they cause you
Xproblems, record the problems (for me), and then add a -DNOPROTO to the
Xappropriate line in the Makefile and try again.
X
XThis version now compiles under Microsoft C 5.1 and Turbo C++ 1.0, with
Xmuch thanks to Jean-Loup Gailly. I say "compiles" and not "works" because
XI have not thoroughly tested it. It does work, but there may be errors in
Xthe port as well as errors in the design. By the latter I mean that there
Xmay be some disagreement over what you expect it to do and what it does,
Xespecially with regards to upper and lower case names and wildcard
Xpatterns. Also, the implode routines do not yet work under MSDOS, so the
Xcompilations are done using NOIMPLODE. There are two dumb batch files to
Xdo the compile: doturboc.bat and domsc.bat. If someone would like to
Xwrite make files for the make utilities that come with those languages,
Xplease be my guest. I'm just too lazy. However, I would probably resist
Xincluding make files that require a make utility that does not come with
Xthose languages, be it commercial, shareware, or free.
X
XThere are two new programs: ZipSplit and Ship. ZipSplit tries to split a
Xbig zip file into the smallest number of zip files less than a specified
Xsize. This is to aid in using zip to backup to floppies. It has the
Xlimitation that it cannot break up an entry in a zip file, since it makes
Xcomplete, standalone zip files. This means if any entry is larger than
Xthe specified size (plus some overhead), zipsplit will give up and not do
Xthe split. It does *not* implement the multi-disk zip file format implied
Xin APPNOTE.TXT. ZipSplit will optionally write an index file and deduct
Xthe size of that file from the first zip file so both will fit on the
Xfirst disk.
X
XShip is a fixed-up version of a program I have been using myself for some
Xtime in place of uuencode/uudecode. It's purpose is to facilitate sending
Xzip files through the mail. It uses a more efficient coding scheme than
Xuuencode (four bytes per five characters instead of three bytes per four
Xcharacters) and includes a crc at the end of each file to check the
Xveracity what was received. It can split its output to a specified size
Xand recombine it automatically at the other end, verifying the sequence.
XIt can also mail the parts to a specified address, with subject lines
Xidentifying the parts, instead of making a bunch of files that you're just
Xgoing to mail and delete anyway. Example:
X
X % ship -500 -m sad...@pickle.iq README zip07.zip
X README shipped
X zip07.zip shipped
X files part0001..part0004 mailed
X
Xwill mail README and zip07.zip together in four chunks of 500 or fewer
Xlines each. At the other end, Saddam can save the parts into the files
Xnamed in the subject lines (part0001..part0004), and then do:
X
X % ship -u part*
X README received
X zip07.zip received
X
XFor now, zip.1 (and zip.doc) are incomplete as far as MSDOS goes. I'll
Xput off doing that until the MSDOS version has stabilized. Likewise, I
Xhave put off writing zipcloak.1, zipsplit.1, and ship.1 for the same
Xreason.
X
XThere are, of course, all the little changes that fix bugs (what are
Xthose?), make the Makefile work on more systems, documentation, and,
Xfor the alert reader, an undocumented option ...
X
XAs usual, send reports to info...@wsmr-simtel20.army.mil, so everyone
Xcan get a chuckle out of whatever new bugs I've introduced.
X
XMark Adler
Xma...@pooh.caltech.edu
X
X
XChanges from release 0.6 to release 0.7:
X
X1. Changed Makefile to use mv instead of -o on compiles.
X2. Added MAKE = make to Makefile.
X3. Catch user interrupt or termination and delete temporary files.
X4. Allow general purpose flags in local and central headers to differ in
X the "reserved" bits. Keep both for copying zip entries verbatim.
X5. Removed prototype for closedir--return value not used and inconsistent
X across systems.
X6. Wrote ZipSplit to break a large zip file into the smallest number of
X zip files less than a specified size. Run zipsplit with no arguments
X to see the command help.
X7. Put error messages in globals.c to be common across zip, zipcloak, and
X zipsplit. Use #define's in zip.h for error numbers.
X8. Changed getp() to open a new file for the terminal device, and added
X the echon() function to turn echoing back on when interrupted at
X password prompt.
X9. Added warn()'s to distinguish various zip file structure errors.
X10. Allow "extra" fields in local and central headers to differ.
X11. Fixed percent compression calculation to work for very large files.
X12. Included the program (makecrc.c) that generates the CRC table.
X makecrc.c is not compiled or run by the Makefile, but is present for
X completeness.
X13. Added an undocumented (except for here) option, -v, to zip that checks
X for "oddities" in the zip file structure and points them out if found
X (but continues processing).
X14. Put prototypes in crypt.h inside #ifdef NeXT to avoid redefinition
X problems with other compilers.
X15. Added "make zilog" for Zilog S8000 running Zeus 3.21.
X16. Minor changes to the manual page (zip.1 and zip.doc).
X17. Fixed bug in replace() (manifested by -b option).
X18. readzipfile() now also checks the central directory start and size in
X the end of central directory header.
X19. Allow modification of self-extracting zip files (exe instead of zip).
X20. Allow .ZIP as valid suffix as well as .zip (also .EXE and .exe).
X21. Cleaned up malloc usage, free'd everything malloc'ed.
X22. fclose'd all fopen'ed files explicitly.
X23. Corrected assignment of one ftell() result from an int to a long.
X24. Considerably simplified Makefile, based on Jean-Loup Gailly's
X suggestions.
X25. Renamed unixfile.c to fileio.c in anticipation of non-unix support.
X26. Removed const's (pesky little buggers caused too many problems).
X27. Wrote my own shell expression compare routine, took REGEX and -lPW's
X out of Makefile, which removed the sysvpw make option.
X28. Added tempname() prototype to crypt.h for the implode routines to use.
X29. Trying string.h for prototypes of string functions if __STDC__
X defined, which is what unzip.h does.
X30. Turned prototypes on if __STDC__ defined (we'll try this one more
X time). They can be turned off using NOPROTO.
X31. Improved source documentation.
X32. Changed prototype of open in fileio.c to OF((char *, int, ...)).
X33. Removed "local" from prototypes of main() (after all, it's *not*
X local).
X34. Wrote Ship program to supplant uuencode--slightly more efficient, has
X error checking, file splitting, automatic mailing, other features.
X Ship currently uses the command:
X /usr/ucb/mail -s subject < tempfile
X to send mail. Please let me know what works for your system. Note
X that I want to be able to specify a subject line.
X35. Ported to MSDOS Microsoft C 5.1, based on Jean-Loup Gailly's work.
X36. Fixed add/update bug when -p not used.
X37. Handle lower case conversion and devices (e.g. C:) for MSDOS.
X38. Indented the #ifdef/#ifndef constructs that do not contain function
X definitions, to improve the readability somewhat.
X39. Cleaned up error handling. Now use perror() for i/o errors. Put the
X errors and messages in ziperr.h.
X40. Ported to MSDOS Turbo C++ 1.0.
X41. Implemented wild card expansion on the command line for MSDOS and
X handle MSDOS matching (*.* == all, not *).
X42. Changed version required to unzip to 11 (1.10) since the implode
X routines can procude an overlapping match one away from the end of the
X window (PKUNZIP 1.00 requires two away from the end).
X43. Changed old next make option to next10 (for version 1.0) and added a
X new next make option for 2.0 (just called next) that uses the -object
X linking option for smaller executables.
X44. Added -z option to take a multi-line zip file comment from stdin.
X45. Changed temporary names from $ZXXXXXX to _ZXXXXXX, where XXXXXX is
X filled in by mktemp(). This avoids problems with "rm $Z*" in sh.
X46. Got new implode routines from Rich that are (hopefully) PKUNZIP
X compatible.
X47. When -b is not specified, put the temporary files in the same
X directory (i.e. the same device) that the zip file is (or will be) in.
X48. Added doturboc.bat and domsc.bat files to compile for Turbo C++ 1.0
X and Microsoft C 5.1. I am interested in successes and failures with
X other versions of those compilers. In this version, the implode
X routines do not work under MSDOS.
X------------------------ May 6 1991 version 0.8 ------------------------
XBuenos Dias Amigos,
X
XHeer ees dee Cinco de Mayo reeleese of seep, aka Zip 0.8. The changes
Xfrom 0.7 are in the (long) list below, but here are some highlights:
Xfaster implode, faster shrink, first attempt at a VMS version (thanks
Xto Cave Newt), and a new program, ZipNote, to aid in editing zip file
Xcomments. To compile under VMS, do an "@makevms.com". To compile using
XMircosoft C do a "make makefile.msc". To compile using Borland (Turbo)
XC, do a "make -fmakefile.bor". Please try to break any or all of these
Xprograms in every conceivable way--we're getting close a public release.
XThank yew fer your support.
X
XMark Adler
Xma...@pooh.caltech.edu
X
XChanges from 0.7 to 0.8:
X
X1. Added the -n option to prevent compressing already compressed files.
X Documented -n in zip.1.
X2. Check the length of the compressed data in zipup() in case implode or
X shrink has a bug.
X3. Fixed -v option to not complain about needing PKUNZIP 1.1.
X4. Added report of store/shrink/implode sizes when -v (verbose) used.
X5. Put in Rich's patch to fix 100% implosion bug.
X6. Fixed -i bug.
X7. Made changes to im_ctree.c and implode.c to (hopefully) make it work
X under MSDOS. (Jean-Loup said declare topmaxvals and botmaxvals as
X U_INT in im_ctree.c, and use MSDOS, not __MSDOS__ in implode.c.)
X8 Added implode routine compilation to domsc.bat and doturboc.bat.
X9. Replaced FILENAME_MAX with FNMAX, which is now always 1024. (It seems
X FILENAME_MAX is incorrectly set to 14 on some System V Unixii.)
X10. Changed BEST to -1 so it is different from STORE (=0). Redid some of
X the method logic in zipup().
X11. Changed wb+ to w+b in implode.c.
X12. Removed "nothing to do" error for -u and -f.
X13. Zip source distributions will now have tabs removed, except for
X Makefile and Makefile.exp (no feelthy tabs rule).
X14. Changed zip error on open failure to a warning. This accounts for
X files that do not have read permission or are locked, and files
X deleted during the zip. For entries being updated, the old entry is
X copied over instead. This change had the side effect of removing the
X zipskip() routine.
X15. Removed OBJC dependencies in Makefile.exp (didn't belong).
X16. Removed strip from Makefile, instead using the -s link option.
X17. Fixed -um and -fm to delete files whose entry's times were checked in
X the archive.
X18. Put portability stuff common to zip.h and crypt.h into tailor.h.
X19. Added mark tracing to -v (for debugging).
X20. Changed name and zname logic--an external name is always converted
X into an internal zname, and vice-versa. zname is now always
X malloc'ed.
X21. Fixed -z to use CRLF between lines (for PKZIP) and have no newline
X after the last (or only) line.
X22. Added clean to Makefile (deletes *.o, zip, zipcloak, zipsplit, ship).
X23. Replaced LDFLAGS with LFLAGS1 and LFLAGS2 in Makefile (splits link
X options before and after object files as in unzip).
X24. Added scodos to Makefile (from Bill Davidsen).
X25. Included stdio.h in tailor.h--removed stdio.h from zip.h and
X implode.h.
X26. Do not include stddef.h if M_XENIX defined.
X27. Cast the arguments of all free() calls to (voidp *).
X28. Added casts to char * for memset() and qsort() args in zipsplit.c.
X29. Changed implode.h to define malloc and str* properly.
X30. Fixed invlocal() to handle integer overflow correctly, as well as
X reliably across compilers.
X31. Got new implode.h from Rich with fix #29 above. Removed stdio.h
X include.
X32. Commented out the abort() calls in im_ctree.c.
X33. -ee requests a verification of the encryption password.
X34. malloc and free tempath.
X35. Documented -, SCO, and scodos in zip.1, and - in help().
X36. Added revision.h for Zip revision number and date.
X37. -u and -f with no arguments now (both) freshen the entire archive.
X38. Use /Oait instead of /Ox for MSC to avoid loop optimization (buggy on
X 5.1, and sometimes even crashes compiler!).
X39. Added ! (reverse) range matching to shmatch(), and early abort on '*'
X failures (speeds up pathological patterns). Cleaned up '\' (escape)
X handling.
X40. Changed '!' in ship to '{' (some EBCDIC translations do not include
X !). However, unship (ship -u) still understands '!'. Also added the
X -v option of ship to print out the version and revision date. Also
X now refuse to overwrite an existing file when unshipping (ship -u),
X but there is a -o option to overwrite anyway.
X41. Added a "fast" mode to ship using hard-arithmetic coding that is
X nearly as efficient as base 85 coding, but much faster on 16-bit
X machines (base 85 coding uses 32 bit multiplication and division).
X42. Put tailor.h back in ship.c, so that ship.c can stand on its own.
X43. Made -p the default, and added a new option, -j to do the opposite
X (junk directory names). -p is still there but does nothing, so as to
X avoid annoying PKZIP users. Changed documentation and help()
X accordingly.
X44. If -j is used, and two files are to be added with the same name, then
X zip exits with an error.
X45. Wrote ZipNote for editing zipfile comments. Just do zipnote for
X usage.
X46. Replaced Rich's im_lmat.c with a new one from Jean-Loup. Improves the
X speed of implode by a factor of two, and even more for very large
X files.
X47. Reduced the execution time of shrink by 33% simply by moving the code
X around (eliminated some unnecessary calls, moved some tests).
X Shrink's execution time is now about 50% more than compress (it used
X to take over twice as long). Hash tables for shrink are still
X intended for a future release.
X48. VMS mods from Greg: replace() unlinks only after copy, changed
X delete() to destroy(), added code for deletedir(), use creation time
X instead of modification time, warn if stamp() attempted, changed
X includes, make link rename and unlink delete, added findfirst,
X findnext stuff, added wild() for VMS, modified newname(), procname().
X49. Implemented internal<-->external name conversions for MSDOS and VMS.
X50. For VMS matching, changed ? to %, removed bracketed ranges.
X51. Added makevms.com, stolen from Unzip (vms_make.com).
X52. Implemented -k (force the zip file to look like it was made by PKZIP).
X53. Removed implode for VMS (it crashes--haven't tracked down where).
X54. Got Jean-Loup's makefile.dos working for MSC 5.1 (makefile.msc) and
X Turbo C++ 1.0 (makefile.bor).
X------------------------ Jul 11 1991 version 0.9 ------------------------
XHey gang,
X
XHere is our very-nearly-ready-to-release version of Zip. There will be no
Xfeatures added or changed from 0.9 to 1.0--only bugs fixed. I hope that
Xwe can get 1.0 out pretty quickly then. This is really your last chance to
Xfind bugs before it goes out, so please, please test all the programs as
Xmuch as you can. Try all the features, if possible, and perhaps try to
Xthink of ways to break the programs. Also, and this is very important, read
Xthe documentation in zip.doc and "debug" that too. I already know that it
Xis not complete in 0.9, but please send any comments about errors, omissions,
Xformat, or whatever to Info-ZIP, even if they seem obvious.
X
XThe highlights of the changes from 0.8 to 0.9 are: faster, slicker implode;
Xoperation in small model on MSDOS for speed; a new temporary file interface
Xfor faster operation on small files; some shrink improvements; and some new
Xoptions (-y, -g, -q). Also, ship has been enhanced in several ways, not the
Xleast of which is a help option (-h).
X
XHave fun.
X
XMark Adler
Xma...@tybalt.caltech.edu
X
X
XChanges from 0.8 to 0.9:
X
X1. Removed the "not implemented yet" note in help() for -k (it *is*
X implemented now). Removed from bug list in zip.1 too.
X2. Fixed Turbo C implode bug.
X3. Added /link /e in makefile.msc for ship.c.
X4. Made handler() in zipnote.c the same as handler() in zipsplit.c.
X5. Added -y option in Unix to store symbolic links as such. (We need
X Unzip to be aware of symbolic links and use symlink() to recreate them.)
X6. Ignore control characters in unship input.
X7. Use prototypes and ANSI libraries if MSDOS. (Used to check for Turbo C,
X but Microsoft C 6.0 also does not define __STDC__ unless strict ANSI
X is requested.)
X8. Added mod to ct_fsort() from Rich that should remove any qsort()
X dependencies in implode output.
X9. Removed some 32/16-bit prejudices in util.c and crypt.c that affect
X 64-bit integer (short, int, and long) machines (Cray).
X10. Added System V MAILX option to ship.c to use the mailx command. This
X is automatically activated by DIRENT if ship is compiled by the zip
X makefile.
X11. Added patches from Greg Roelofs for echo control on Cray and Amdahl.
X The patch uses termio.h and ioctl(), and is assumed for all System V,
X not just those (we'll see how this flies).
X12. Changed -Ox to -Oacegit -FPi87 in makefile.msc. Added /nologo to link.
X13. Applied J-L's 082 mods (Sinatra style): select 4K window for < 5.5K,
X 8K window for >= 5.5K files (just like PK does); various im_ctree.c
X mods verbatim (except for the treename warning, which I did differently);
X various im_lmat.c mods verbatim (except macros are done the ugly portable
X way); farmalloc'ed in shrink.c; changed makefile.msc and makefile.bor to
X use small model; added J-L to zip.1 acknowledgements (oops).
X14. Moved struct zlist's and struct flist's to far storage (needed by above
X mods). Unfortunately, I can't move the names and other things pointed to
X by those structures into the far space, since they are arguments to
X library functions like strcmp() and fwrite().
X15. Changed zipup() to both shrink and implode only on files smaller than
X BSZ. Also in that case, free up shrink data structures before allocating
X the implode data structures. Changed from fopen() to open() except for
X VMS.
X16. Fixed bug in dosmatch() to free malloc'ed space.
X17. MINIX mods (do not need minix make option): call tempname() with a unique
X character (MINIX mktemp() flawed); defined S_IWRITE as S_IWUSR if S_IWUSR
X defined; removed explicit signal dereference.
X18. Fixed bug in unship when used as a filter with no args.
X19. Changed getnam() to not use static storage.
X20. Copy permissions from old to new zip file (zip, zipcloak, zipnote).
X21. Added patches for AT&T 3B1, added 3b1 target to makefile, added to zip.1.
X22. Made FNMAX 256 for MSDOS (is 1024 otherwise).
X23. Used the "pyr" predefined symbol for Pyramid systems in tailor.h.
X24. Added Greg's VMS mods to ship.c. Added help to ship.c (-h or -?).
X Changed meaning of -nnn arg from lines to K.
X25. Moved ZMEM routines to fileio.c to properly include them in zipnote and
X zipsplit.
X26. Added -s option to ship to specify a subject line prefix.
X27. Fixed -z in zip to not trash leading blank lines in the comment.
X28. Made ship recognize "unship" in argv[0] a little more flexibly.
X29. Made sure temporary zip files are closed before being deleted by an
X error or interrupt.
X30. Added a new temporary file interface and new source files tempf.c and
X tempf.h. This avoids making temporary files for small (<16k) output.
X Both shrink and implode use this.
X31. Added OS/2 patches, files. However, left zip case-sensitive for OS/2
X names, as in Unix.
X32. Removed amdahl target in makefile, using UTS symbol instead.
X33. Changed -y to depend on definition of S_IFLNK.
X34. Avoid leading periods on lines in ship output by inserting a space.
X35. Ship is now extensible: added a warning for "unsupported keyword".
X Such keywords can appear before the "ship" line, for example.
X36. Added -g option to allow "growing" the zip file. If just adding new
X entries to a zip file, -g will write over the old zip file without
X creating a temporary. The danger is that if there is an error, the
X old zip file will be lost. If not just adding, then -g is ignored.
X37. Added aux (A/UX) target to makefile.
X38. In shrink.c, removed unnecessary FreeList and ClearList arrays, and
X the recursive Prune() routine. This also resulted in a speedup in
X shrink of about 15%. It is now only about 30% slower than Unix compress.
X39. Added -q option for quiet operation.
X------------------------ Sep 21 1991 version 1.0 ------------------------
XHello world!
X
XThis is the first public release version of Zip and its cohort utilities.
XWe hope you enjoy using it much much more than we enjoyed writing it and
Xtrying to get it to work on every fritzing raffing bliffing nobbin Unix
Xsystem in the galaxy.
X
XPlease feel free to send any problems, complaints, suggestions, kudos,
Xridicule, or whatever to zip-...@cs.ucla.edu. If there were a way to
Xsend cookies over the net, we'd accept those too.
X
XThank yew fer yur support.
X
XMark Adler
Xma...@tybalt.caltech.edu
X
X
XChanges from 0.9 to 1.0:
X
X1. Removed some pesky carriage returns masquerading as spaces in fileio.c
X and zipup.c.
X2. Removed #include memory.h in tempf.c (string.h good enough).
X3. Compile ship in doturboc.bat.
X4. Miscellaneous zip.1 (zip.doc) changes.
X5. Fixed mistake in stamp() in fileio.c (didn't double seconds).
X6. Applied Jean-Loup's mods for Cray's (do not assume 16-bit shorts).
X7. Removed pyramid make option, since #ifdef pyr seems to work.
X8. Added some casts to tempf.c to clean up some warnings.
X9. Added comment to makefile.exp saying what it is.
X10. Removed length checks in zipup.c to fix problem with using Vax variable
X record length formats.
X11. Fixed VMS replace-across-devices problem.
X12. Changed order of include's in implode.h to make tailor.h show up first.
X13. Added Convex mods and make target.
X14. Fixed path delimiter under VMS for unship.
X15. Added ship to makevms.com.
X16. Put in new copyright messages.
X17. Added aix make target.
X18. Fixed zipsplit.idx to start counting at one like the file names.
X19. Changed -a (append VMS version number) to -w to leave -a open for a
X possible future option.
X20. Back to separate makefiles for Microsoft and Borland (.msc and .bor).
X21. Workaround in fileio.c for Borland stat() bug: stat() succeeds for wild
X card names that match existing files.
X22. Added "(did you remember to use binary mode when you transferred it?)"
X to the "probably not a zip file" warning.
X23. Changed utilities to append .zip only when the zip file name does not
X contain a dot.
X24. At least mentioned the other utilities in zip.doc (zipcloak, ship, etc.),
X and documented upper case matching of names when using -d under MSDOS.
X25. Fixed bug in MSDOS version: zip foo c:autoexec.bat wouldn't work.
X26. Added hidden/system attribute bug to BUGS in zip.1
X27. Fixed recognition of unship in ship when unship is in a path.
X28. Added non-stream-LF VMS bug to zip.1 bug list.
X29. Fixed bug in #23 above when path has dots. Documented #23 in zip.1.
X30. Show disclaimer only for -l, add -h and -l to zip utilities.
X31. Applied Minix patches.
X------------------------ ??? ?? 1992 version 1.1 ------------------------
X??? To be done. Should be the last version supporting shrink and implode.
X
X------------------------ Feb 17 1992 version 1.5 ------------------------
X1. pkzip 2.0 format (deflation) now supported
X Shrink and Implode left in zip 1.1 only for backward compatibility
X
X------------------------ Mar 25 1992 version 1.6 ------------------------
X1. zip can now be used as a filter in a pipe
X2. Optimized assembler code for MSDOS and OS/2
X3. encryption is now supported
X4. Better VMS support for various file formats other than Stream-LF
X5. Better OS/2 support
X------------------------ Apr 24 1992 version 1.7a ------------------------
X1. On VMS, create new zip files in fixed length 512 format
X2. Call VMSmunch only if the zip file existed previously
X3. Avoid mktemp() and use simpler name for temporary file.
X4. Rename dir_os2.[ch] -> os2zip.[ch]
X5. On MSDOS, use fdopen() after setmode() in zip.c
X Added setmode() for stdin in zipup.c
X6. Do not split #if on two lines (some compilers don't like this)
X7. __MSDOS__ instead of __BORLANDC__ in crypt.c
X8. Added (char*) cast in deflate.c to avoid warning
X9. OS/2 support for storing file attributes in an extra field.
X
X------------------------ June 6 1992 version 1.8a ------------------------
X1. Fixed bug in tempname() for VMS
X2. Fixed type problems in zipup.c for gcc under VMS
X3. Added VMSmunch in vms subdirectory and updated makefile (descrip.mms)
X4. The extra field for OS/2 is now compressed (Kai Uwe Rommel)
X5. Added various fixes for djgcc (Onno van der Linden)
X6. Fixed long standing bug in wild() for MSDOS (Jon Saxton)
X7. Added support for ZIPOPT environment variable (Bill Davidsen
X and Antoine Verheijen).
X8. Fixed zipsplit bug for VMS (Greg Roelofs)
X9. Added fix for DEC OSF/1 (Kjetil W. J{\o}rgensen)
X10. Added fix for ultrix on DECstation (Jonathan Kamens)
X10. Added sysnopis for zipsplit, etc... in zip.1 (Jonathan Kamens)
X11. Fixed MAILX problem for SysV in ship.c (Greg Roelofs)
X12. Added Linux support (Humberto Ortiz-Zuazaga)
X13. In makefile.os2, support for $(FP), masm 5.x, match.s (Greg & Kai)
X14. Added -w-cln in makefile.bor to avoid warning (David Kirschbaum)
X15. VMS echo suppression code incorporated (Greg Roelofs)
X16. Added fix to match.asm if WSIZE != 32768
X17. Create .exe files directly for target scodos (Bill Davidsen)
X18. Fixed the -0 bug (compressed size was doubled)
X19. Changed -- (read names from stdin) to -@ to reserve -- for undoing
X the effects of ZIPOPT
X20. Create zip entries for directories with the -r option, so that
X directory attributes can be saved. (Kai Uwe Rommel)
X
X------------------------ June 17 1992 version 1.8b ------------------------
X1. Changed -s (Software license) to -L (license) to avoid clash
X with the old shrink option.
X2. read_buf declared as extern only in zip.h
X3. avoid warnings in zip.c for Turbo C: while ((ch = *s) != '\0'
X4. suppressed unused variables mem_inbuf and mem_outbuf in bits.c
X5. Speed up the search for start of zip structures (pksfx files)
X6. Allow updates of an empty pksfx file (original file was destroyed)
X7. Keep correct offsets for pksfx files
X8. On MSDOS, in2ex() was updating the input argument. Also, do not
X force upper case: keep the name as it was in the old zip file.
X This is important for -f. Similarly, force lower case in ex2in()
X on MSDOS, except when dosify (-k) is imposed. I kept however the
X old code under the flag FORCE_UPPER in case I goofed.
X9. When growing a zip file with -g and interrupting it, the whole file was
X lost. We now attempt to restore the previous state of the file.
X10. "zip -fo jjj", where jjj is a non-existent zipfile, used to dump core.
X We now emit a warning.
X11. More generally, we emit a warning for all options assuming the presence
X of a zip file (-d,-f,-u,-g) if the zip file did not exist or was empty.
X Idem for "zip -o jjj" on non-existent or empty zip file.
X12. Copy also the extended local entry in zipcopy().
X13. Updated zip.1 and vms/vms_zip.rnh to describe the new features.
X14. Fixed bug in zipsplit (wrong offsets for all files but first)
X15. Added match.s, optimized 386 version of longest_match() for Unix and
X 32 bit OS/2 (with gas).
X16. Added os2/match32.asm, optimized 386 version of longest_match() for
X 32 bit OS/2 (for assemblers using Intel syntax). NOT TESTED YET.
X17. Added "assume DS: DGROUP" in match.asm to allow SS_NEQ_DS even with MSC.
X18. Added include <malloc.h> in tailor.h for Unix. This is required on
X 16-bit Unix.
X19. Use init_upper() in os2zip.[ch]
X20. Switched back to old tempname(): the new one could overwrite an existing
X file, it ignored tempath, and it caused problems on VMS for files with a
X '.' in the name. Kept however the old code if NO_MKTEMP is defined.
X21. Use 0x1 instead of (unsigned)1 in definition of HSIZE (one compiler
X does not like the cast in an array definition).
X22. Include VMSmunch.h in zip.c
X23. On VMS, zip -o screwed up all offsets in pksfx files
X
X------------------------ June 18 1992 version 1.8c ------------------------
X1. Added missing comma in revision.h
X2. invlocal doesn't work on Cray, use mktime instead (Greg Roelofs)
X3. On VMS, use ctx=stm only to read zipfiles, not input files.
X4. Undo change 21 above, which breaks even more compilers
X5. Include dos.h in util.c and fix trivial compilation errors
X6. Undo change 1 of 1.8b: -L already used for OS/2 (Steve Salisbury)
X7. Do not create a zip entry for directory "." (Greg Roelofs)
X8. Avoid core dump when -@ is given before the zip file (and do
X the right thing).
X
X------------------------ June 19 1992 version 1.8d ------------------------
X1. Force calloc to take unsigned values. (Problem with one 16 bit
X compiler on AT&T 6300).
X2. Fixed fileio.c for Convex (Bill Davidsen)
X3. util_ was missing for zipnote and zipsplit in make_vaxc.com (Glenn Andrews)
X4. Added warning in zip.1 and below (do not update encrypted files
X with pkzip 1.10).
X5. Fixed fix 12 of 1.8b. I drink too much. (Confused bit 1 with bit 8).
X6. Updated install.doc
X7. Fixed result type of os2 version of init_upper().
X8. Added makefile entry for AT&T 6300 (Peter Mauzey)
X9. Fixed typo in descrip.mms
X10. Removed zipfile.c warning: shift count exceeds width of value shifted
X11. Fix enormous bug in init_upper for VMS (upper stayed as zero)
X
X------------------------ June 23 1992 version 1.8e ------------------------
X1. Don't include malloc.h by default (does not exist on VMS)
X2. Define calloc for 16 bit systems (required for AT&T 6300)
X3. Simpler make_vaxc.com (Greg Roelofs)
X4. New vms/descrip.mms and fixes in zipfile.c (Igor)
X5. seekable() must be true for in-memory compression.
X6. Undefine S_IFLNK if NO_SYMLINK (problems with VMS and SCO)
X7. Include descrip.h only once in fileio.c (Mike Freeman)
X8. New os2/match32.asm (untested) and makefile.os2.
X9. Added dosflag in zlist and flist entries, to force MSDOS file
X attributes. It is set if dosify is set, or (under OS/2) for a file
X on a FAT file system which does not have a long name (Kai-Uwe).
X10. Added GetFileTime on OS/2 to avoid core dump on bad dates (Kai-Uwe)
X11. New vms.c supporting deflation of extra headers
X
X------------------------ June 24 1992 version 1.8f ------------------------
X1. Incorporated (finally!) Mac support. *Untested*. (James E. O'Dell)
X2. Another long awaited change: Atari ST. Also *untested*.
X (mar...@atlantic.cs.unb.ca)
X3. New makefile.os2, as usual. (Kai-Uwe)
X4. Support for Watcom C in os2zip.c. *Not yet working*. (Kai-Uwe).
X5. I forgot to output the length for stored blocks...
X
X------------------------ June 29 1992 version 1.8g ------------------------
X1. New os2zip.c and makefile.os2 as usual.
X2. In the VMS makefiles, define the symbols systematically so that
X people won't forget to update them. (Fed up with the reports that
X zip does not accept parameters).
X3. Use -L for software License and -E for Extended attributes
X4. Added -F 1000 in makefile entry for scodos (Bill Davidsen)
X5. Replaced strcmp with namecmp in zip.c for check of zipfile name.
X6. New os2/match32.asm (still not working)
X7. Do not close stdin (check for null ifile in zipup.c).
X8. signal handlers for zip and zipcloak fixed to restore echo for VMS
X9. slightly cleaner VMS echo calls in fileio.c
X10. stricmp missing from VMS zipsplit, zipnote: since UTIL was unused for
X util.c, I used it to specify stricmp only; then I had to change some of
X the makefiles which previously used util_.* to use util.*, and I added
X util_.obj to OBJS and OBJN in all of the VMS makefiles. (Greg)
X11. ifdef'd out the debugging commentary in vms.c (Greg)
X12. new VMS makefile for use with (free) MAKE/VMS (Greg)
X13. Eliminate some compiler warnings from BCC, MSC, gcc (Onno van der Linden)
X14. Do not use MSDOS version of init_upper for djgpp (Onno van der Linden)
X15. In msdos/makefile.gcc, added util_.o to OBJN and OBJS, and used asm version
X match.o (Onno van der Linden)
X16. Added install target in makefile (Alvin Koh)
X17. Default makefile entry is named 'all'.
X18. fixes to vms.c for gcc (Igor)
X19. Define S_IWRITE as S_IWUSR for Minix only (problem on X/OS) (Fulvio Marino)
X20. Added xos makefile entry (Fulvio Marino)
X21. In VMS, files without an extension are now stored without the dot (Greg
X and Igor).
X22. Save/restore ebx in match.s and match32.asm
X23. Fixed MAX_DIST in match.s (the asm code produced different results
X than the C code)
X24. Fixed the -b option: allow ENOTSAM instead of EXDEV (used by Turbo C).
X25. Do not complain about zip files created on MSDOS with versions of zip
X above 1.0.
X
X------------------------ Aug 14 1992 version 1.9a ------------------------
X1. Changed -S to -L in help screen
X2. Do not declare chmod for aegis (George Grimes)
X3. Cleaner vms/make_gcc.com (Mike Freeman)
X4. Disabled built-in functions for Linux (Arnt Gulbrandsen)
X5. Added a description of the deflation algorithm in algorith.doc.
X6. Removed ship, now distributed separately.
X7. Added the CRC for in-memory compression. The extra-field format is now
X the official PKWare format (Kai-Uwe)
X8. On OS/2, force lower case names for FAT files if -k is not given. (Kai-Uwe)
X9. Allow coutry dependent mapping for upper to lower case. (Kai-Uwe)
X10. Use namecmp instead of stricmp which was confusing. (Onno van der Linden)
X11. Avoid some warnings in deflate.c (Onno van der Linden)
X12. Avoid one warning in crypt.c, and distribute it separately.
X13. Call init_upper() for all utilities and add util_.o in makefiles (Kai-Uwe)
X
X------------------------ Aug 18 1992 version 1.9b ------------------------
X1. Fixes for Windows NT (Dave Feinleib)
X2. Avoid two warnings for Ultrix (makefile and fileio.c)
X3. Finally removed the declaration of chmod(), which causes endless
X new patches for each new target.
X4. Allow -L for license in the utilities (zipsplit, zipnote, zipcloak).
X5. Mention funzip in zip.1.
X6. Untabify all sources files (for more reliable context diffs)
X7. Fix bug in trees.c dealing with bit length overflow.
X8. Fix bug in zipup.c when reading from stdin: if (ifile) does not
X produce the expected result.
X9. Avoid duplication of bug list in zip.1 and history.
X10. Removed ship from zip.1.
X
X------------------------ Aug 20 1992 version 1.9 ------------------------
X1. Renamed the atari files to avoid name conflicts (for unzip -j).
X2. Don't tell 'use zip -L' in zipnote and zipsplit.
X3. Add a rule for util_.ojb in the msdos and atari makefiles
X4. Fixed compilation option for util_.obj in makefile.msc (msc 5.1 bug)
X5. Added the 'Where' file.
X6. More information about zip in Readme.
X7. Fixed install.doc.
X8. Fixed vms/vms_zip.rnh
X9. Fixed init_upper() in util.c and os2zip.c (Kai-Uwe)
X
X
XThings to check or to be done (see also BUGS section in zip.1):
X
X- zip should not create 'stored' files with extended local headers
X
X- There is not (yet) a way to undo the effect of ZIPOPT
X
X- Under MSDOS, zip will find hidden and system files, but not set the
X attributes appropriately in the zip file so that unzip can restore them.
X
X- it is possible in weird cases to add a zipfile to itself
X
X- On OS/2, zip refuses to match some names, such as those beginning with an
X exclamation mark. Same for names starting with #, possibly more.
END_OF_FILE
if test 49244 -ne `wc -c <'history'`; then
echo shar: \"'history'\" unpacked with wrong size!
fi
# end of 'history'
fi
if test ! -d 'mac' ; then
echo shar: Creating directory \"'mac'\"
mkdir 'mac'
fi
if test ! -d 'msdos' ; then
echo shar: Creating directory \"'msdos'\"
mkdir 'msdos'
fi
if test ! -d 'nt' ; then
echo shar: Creating directory \"'nt'\"
mkdir 'nt'
fi
if test ! -d 'os2' ; then
echo shar: Creating directory \"'os2'\"
mkdir 'os2'
fi
if test -f 'tailor.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tailor.h'\"
else
echo shar: Extracting \"'tailor.h'\" \(6875 characters\)
sed "s/^X//" >'tailor.h' <<'END_OF_FILE'
X/* tailor.h -- Not copyrighted 1992 Mark Adler */
X
X/* const's are inconsistently used across ANSI libraries--kill for all
X header files. */
X#ifndef __GO32__
X# define const
X#endif
X
X
X/* Define MSDOS for Turbo C as well as Microsoft C */
X#ifdef __POWERC /* For Power C too */
X# define __TURBOC__
X#endif /* __POWERC */
X#if (defined(__TURBOC__) && !defined(MSDOS))
X# define MSDOS
X#endif
X
X#ifdef ATARI_ST
X# undef MSDOS /* avoid the MS-DOS specific includes */
X#endif
X
X/* Use prototypes and ANSI libraries if _STDC__, or Microsoft or Borland C,
X * or Silicon Graphics, or IBM C Set/2, or GNU gcc under emx.
X */
X#if (defined(__STDC__) || defined(MSDOS) || defined(sgi))
X# ifndef PROTO
X# define PROTO
X# endif /* !PROTO */
X# define MODERN
X#endif /* MSDOS */
X
X#if (defined(__IBMC__) || defined(__EMX__) || defined(ATARI_ST))
X# ifndef PROTO
X# define PROTO
X# endif /* !PROTO */
X# define MODERN
X#endif
X
X
X#ifdef __IBMC__
X# define S_IFMT 0xF000
X#endif /* __IBMC__ */
X
X#ifdef __EMX__
X# define __32BIT__
X#endif /* __EMX__ */
X
X#ifdef __WATCOMC__
X# define __32BIT__
X#endif
X
X#if (defined(__OS2__) && !defined(OS2))
X# define OS2
X#endif
X
X
X/* Turn off prototypes if requested */
X#if (defined(NOPROTO) && defined(PROTO))
X# undef PROTO
X#endif
X
X
X/* Used to remove arguments in function prototypes for non-ANSI C */
X#ifdef PROTO
X# define OF(a) a
X#else /* !PROTO */
X# define OF(a) ()
X#endif /* ?PROTO */
X
X
X/* Memory allocation. */
X#ifdef MACOS
X# define DYN_ALLOC
X#endif
X#if (defined(MSDOS) && !defined(__GO32__) && !defined(WIN32))
X# ifdef __TURBOC__
X# include <alloc.h>
X# define DYN_ALLOC
X /* Turbo C 2.0 does not accept far static allocations in small model */
X void far * fcalloc OF((unsigned items, unsigned size));
X# else /* !__TURBOC__ */
X# include <malloc.h>
X# define farmalloc _fmalloc
X# define farfree _ffree
X# define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
X# endif /* ?__TURBOC__ */
X#else /* !MSDOS */
X# if defined(WIN32)
X# include <malloc.h>
X# endif
X# ifdef far
X# undef huge
X# undef far
X# undef near
X# endif
X# define huge
X# define far
X# define near
X# define farmalloc malloc
X# define farfree free
X# define fcalloc(items,size) calloc((unsigned)(items), (unsigned)(size))
X# ifndef PROTO
X extern char *calloc(); /* essential for 16 bit systems (AT&T 6300) */
X# endif
X#endif /* ?MSDOS */
X
X
X#if (defined(OS2) && !defined(MSDOS))
X/* MSDOS is defined anyway with MS C 16-bit. So the block above works.
X * For the 32-bit compilers, MSDOS must not be defined in the block above. */
X# define MSDOS
X/* inherit MS-DOS file system etc. stuff */
X#endif
X
X
X/* Define MSVMS if either MSDOS or VMS defined */
X#if defined(MSDOS) || defined(VMS)
X# define MSVMS
X#endif
X
X/* case mapping functions. case_map is used to ignore case in comparisons,
X * to_up is used to force upper case even on Unix (for dosify option).
X */
X#if defined(OS2) || defined(MSDOS) || defined(VMS)
X# define case_map(c) upper[c]
X# define to_up(c) upper[c]
X#else
X# define case_map(c) (c)
X# define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
X#endif
X
X/* Define void, voidp, and extent (size_t) */
X#include <stdio.h>
X#ifdef MODERN
X# if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
X# include <stddef.h>
X# endif /* !M_XENIX */
X# include <stdlib.h>
X typedef size_t extent;
X typedef void voidp;
X#else /* !MODERN */
X typedef unsigned int extent;
X# define void int
X typedef char voidp;
X#endif /* ?MODERN */
X
X/* Get types and stat */
X#ifdef VMS
X# include <types.h>
X# include <stat.h>
X#else /* !VMS */
X# ifdef MACOS
X# include <types.h>
X# include <stddef.h>
X# include <Files.h>
X# include <StandardFile.h>
X# include <Think.h>
X# include <LoMem.h>
X# include <Pascal.h>
X# include "macstat.h"
X# else
X# ifdef ATARI_ST
X# include <ext.h>
X# include <tos.h>
X# else
X# include <sys/types.h>
X# include <sys/stat.h>
X# endif
X# endif
X#endif /* ?VMS */
X
X/* Some systems define S_IFLNK but do not support symbolic links */
X#if defined (S_IFLNK) && (defined(NO_SYMLINK) || defined(MACOS))
X# undef S_IFLNK
X#endif
X
X/* Cheap fix for unlink on VMS */
X#ifdef VMS
X# define unlink delete
X#endif /* VMS */
X
X
X/* For Pyramid */
X#ifdef pyr
X# define strrchr rindex
X# define ZMEM
X#endif /* pyr */
X
X
X/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */
X#ifdef VMS
X# define FOPR "r","ctx=stm"
X# define FOPM "r+","ctx=stm","rfm=fix","mrs=512"
X# define FOPW "w","ctx=stm","rfm=fix","mrs=512"
X#else /* !VMS */
X# ifdef MODERN
X# define FOPR "rb"
X# define FOPM "r+b"
X# define FOPW "wb"
X# else /* !MODERN */
X# define FOPR "r"
X# define FOPM "r+"
X# define FOPW "w"
X# endif /* ?MODERN */
X#endif /* VMS */
X
X/* Open the old zip file in exclusive mode if possible (to avoid adding
X * zip file to itself).
X */
X#ifdef OS2
X# define FOPR_EX FOPM
X#else
X# define FOPR_EX FOPR
X#endif
X
X/* Define this symbol if your target allows access to unaligned data.
X * This is not mandatory, just a speed optimization. The compressed
X * output is strictly identical.
X */
X#if defined(MSDOS) || defined(i386) || defined(mc68020) || defined(vax)
X# define UNALIGNED_OK
X#endif
X
X
X/* Under MSDOS we may run out of memory when processing a large number
X * of files. Compile with MEDIUM_MEM to reduce the memory requirements or
X * with SMALL_MEM to use as little memory as possible.
X */
X#ifdef SMALL_MEM
X# define CBSZ 2048 /* buffer size for copying files */
X# define ZBSZ 2048 /* buffer size for temporary zip file */
X#else
X# ifdef MEDIUM_MEM
X# define CBSZ 8192
X# define ZBSZ 8192
X# else
X# if defined(OS2) && !defined(M_I86SM)
X# define CBSZ 0xE000
X# define ZBSZ 0x7F00
X /* The C library of some compilers does not allow a buffer size > 32K */
X# else
X# define CBSZ 16384
X# define ZBSZ 16384
X# endif
X# endif
X#endif
X
X#ifdef ATARI_ST
X# define MSDOS
X# define MSVMS
X# ifndef O_BINARY
X# define O_BINARY 0
X# endif
X# ifndef S_IFMT
X# define S_IFMT (S_IFCHR|S_IFREG|S_IFDIR)
X# endif
X
X/* a whole bunch of functions needs Tos '\\' filnames
X * instead of '/', the translation functions are in fileio.c:
X */
X# define unlink st_unlink
X# define chmod st_chmod
X# define mktemp st_mktemp
X# define fopen st_fopen
X# define open st_open
X# define SSTAT st_stat
X# define findfirst st_findfirst
X# define link st_rename
X# define rmdir st_rmdir
X
X int st_unlink OF((char *));
X int st_chmod OF((char *, int));
X char *st_mktemp OF((char *));
X FILE *st_fopen OF((char *, char *));
X int st_open OF((char *, int));
X int st_stat OF((char *, struct stat *));
X int st_findfirst OF((char *, struct ffblk *, int));
X int st_rename OF((char *, char *));
X int st_rmdir OF((char *));
X#else
X# define SSTAT stat
X#endif
X
X/* end of tailor.h */
END_OF_FILE
if test 6875 -ne `wc -c <'tailor.h'`; then
echo shar: \"'tailor.h'\" unpacked with wrong size!
fi
# end of 'tailor.h'
fi
if test ! -d 'vms' ; then
echo shar: Creating directory \"'vms'\"
mkdir 'vms'
fi
echo shar: End of archive 1 \(of 11\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 11 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...

Info-ZIP group

unread,
Aug 23, 1992, 2:45:13 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 94
Archive-name: zip19/part02

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: atari/stzip.lnk fileio.c


# Wrapped by kent@sparky on Sun Aug 23 01:00:42 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 2 (of 11)."'
if test -f 'atari/stzip.lnk' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/stzip.lnk'\"
else
echo shar: Extracting \"'atari/stzip.lnk'\" \(180 characters\)
sed "s/^X//" >'atari/stzip.lnk' <<'END_OF_FILE'
X\TC\lib\c0.o
Xzip.o
X\TC\lib\tcstdlib.lib
Xatari.o
Xzipfile.o
Xzipup.o
Xfileio.o
Xutil.o
Xglobals.o
Xdeflate.o
Xtrees.o
Xbits.o
X\TC\lib\tcstdlib.lib
X\TC\lib\tcextlib.lib
X\TC\lib\tctoslib.lib
END_OF_FILE
if test 180 -ne `wc -c <'atari/stzip.lnk'`; then
echo shar: \"'atari/stzip.lnk'\" unpacked with wrong size!
fi
# end of 'atari/stzip.lnk'
fi
if test -f 'fileio.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fileio.c'\"
else
echo shar: Extracting \"'fileio.c'\" \(57097 characters\)
sed "s/^X//" >'fileio.c' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * fileio.c by Mark Adler.
X */
X
X#include "zip.h"
X
X#include <time.h>
X
X#ifdef WIN32
X# include <sys/utime.h>
X# include <windows.h> /* for findfirst/findnext */
X#endif
X
X#ifdef MACOS
X# define EXDEV 1
X#endif
X
X#ifdef OSF
X# define EXDEV 18 /* avoid a bug in the DEC OSF/1 header files. */
X#else
X# include <errno.h>
X#endif
X
X#ifdef MINIX
X# ifdef S_IWRITE
X# undef S_IWRITE
X# endif /* S_IWRITE */
X# define S_IWRITE S_IWUSR
X#endif /* S_IWUSR */


X
X#ifdef ATARI_ST
X# undef MSDOS

X#endif
X
X#ifdef MSDOS
X# include <io.h>
X# if (defined(__TURBOC__) || defined(__GO32__))
X# include <dir.h>


X# else /* !__TURBOC__ */

X# if !defined(__EMX__) && !defined(__WATCOMC__)
X# include <direct.h>
X# endif


X# endif /* ?__TURBOC__ */

X# define link rename
X# ifdef OS2
X# define MATCH shmatch
X# else /* !OS2 */
X# define MATCH dosmatch
X# endif /* ?OS2 */
X#else /* !MSDOS */
X extern int errno; /* error number from system functions */
X# ifdef VMS
X# define RMDIR
X# define link rename
X# include "VMSmunch.h"
X# endif /* VMS */
X# ifdef MACOS
X# define link rename
X# define mktemp tmpnam
X# endif
X# define MATCH shmatch


X#endif /* ?MSDOS */
X

X#ifdef ATARI_ST
X# define MSDOS 1
X#endif
X
X#ifdef UTS
X# define RMDIR
X#endif /* UTS */
X
X
X/* Extra malloc() space in names for cutpath() */
X#ifdef VMS
X# define PAD 3 /* may have to change .FOO] to ]FOO.DIR */
X#else /* !VMS */
X# define PAD 0


X#endif /* ?VMS */
X
X

X/* For now, assume DIRENT implies System V implies TERMIO */
X#if defined(DIRENT) && !defined(MINIX) && !defined(TERMIO)
X# define TERMIO
X#endif
X
X
X#ifdef CRYPT
X# ifdef MSVMS
X# ifdef MSDOS
X# ifdef __EMX__
X# define getch() _read_kbd(0, 1, 0)
X# else
X# ifdef __GO32__
X# include <pc.h>
X# define getch() getkey()
X# else
X# include <conio.h>
X# endif
X# endif
X# else /* !MSDOS */
X# define getch() getc(stderr)
X# define echoff(f) echo(0) /* for echo control */
X# define echon() echo(1)
X# include <iodef.h>
X# include <ttdef.h>
X# if !defined(SS$_NORMAL)
X# define SS$_NORMAL 1 /* only thing we need from <ssdef.h> */
X# endif
X# endif /* ?MSDOS */
X# else /* !MSVMS */
X# ifdef TERMIO /* Amdahl, Cray, all SysV? */
X# ifdef CONVEX
X# include <sys/termios.h>
X# include <sgtty.h>
X# define O_BINARY 0
X# else /* !CONVEX */
X# ifdef LINUX
X# include <termios.h>
X# else /* !LINUX */
X# include <sys/termio.h>
X# endif /* ?LINUX */
X# define sgttyb termio
X# define sg_flags c_lflag
X int ioctl OF((int, int, voidp *));
X# endif /* ?CONVEX */
X# define GTTY(f,s) ioctl(f,TCGETA,s)
X# define STTY(f,s) ioctl(f,TCSETAW,s)
X# else /* !TERMIO */
X# ifndef MINIX
X# include <sys/ioctl.h>
X# endif /* !MINIX */
X# include <sgtty.h>
X int gtty OF((int, struct sgttyb *));
X int stty OF((int, struct sgttyb *));
X# define GTTY gtty
X# define STTY stty
X# endif /* ?TERMIO */
X int isatty OF((int));
X char *ttyname OF((int));
X int open OF((char *, int, ...));
X int close OF((int));
X int read OF((int, voidp *, int));
X# endif /* ?MSVMS */
X#endif /* ?CRYPT */
X
X#ifdef VMS
X# include <descrip.h>
X# include <rms.h>
X#endif
X
X/* For directory access. (This is getting rather messy. Cleanup
X * scheduled for version 17.9.)
X */
X#ifndef UTIL
X
X#ifdef SYSV /* use readdir() */
X# include <dirent.h>
X# define dstrm DIR
X# define direct dirent
X#else
X
X#ifdef DIRENT /* use getdents() */
X# if defined(MINIX) || defined(OSF)
X# include <dirent.h>
X# else /* !MINIX */
X# include <sys/dirent.h>
X# endif /* ?MINIX */
X# define direct dirent
X# ifdef MINIX
X int getdents OF((int, char *, unsigned));
X# else /* !MINIX */
X int getdents OF((int, char *, int));
X# endif /* ?MINIX */
X# define DBSZ 4096 /* This has to be bigger than a directory block */
X typedef struct { /* directory stream buffer */
X int f; /* file descriptor for the directory "file" */
X char *p; /* pointer to next entry in buffer */
X char *q; /* pointer after end of buffer contents */
X char b[DBSZ]; /* buffer */
X } dstrm;
X
X#else /* !DIRENT */ /* use opendir(), etc. */
X# if defined(CONVEX) || defined(ultrix)
X# include <dirent.h>
X# ifdef direct
X# undef direct /* ultrix 4.2, at least if !__POSIX */
X# endif
X# define direct dirent
X# endif /* CONVEX || ultrix */
X# ifdef NDIR
X# include "ndir.h" /* for HPUX */
X# else /* !NDIR */
X# ifdef MSDOS
X# ifdef OS2
X# include "os2zip.h"
X# else /* !OS2 */
X# ifndef ATARI_ST
X# include <dos.h>
X# endif
X# if (defined(__TURBOC__) || defined(__GO32__))
X# define FATTR FA_HIDDEN+FA_SYSTEM+FA_DIREC
X# define FFIRST(n,d) findfirst(n,(struct ffblk *)d,FATTR)
X# define FNEXT(d) findnext((struct ffblk *)d)


X# else /* !__TURBOC__ */

X# define FATTR _A_HIDDEN+_A_SYSTEM+_A_SUBDIR
X# define FFIRST(n,d) _dos_findfirst(n,FATTR,(struct find_t *)d)
X# define FNEXT(d) _dos_findnext((struct find_t *)d)


X# endif /* ?__TURBOC__ */

X typedef struct direct {
X char d_reserved[30];
X char d_name[13];
X int d_first;
X#ifdef WIN32
X HANDLE d_hFindFile;
X#endif
X } DIR;
X# endif /* ?OS2 */
X# else /* !MSDOS */
X# ifdef VMS
X# include <ssdef.h>
X typedef struct direct {
X int d_wild; /* flag for wildcard vs. non-wild */
X struct FAB fab;
X struct NAM nam;
X char d_qualwildname[NAM$C_MAXRSS + 1];
X char d_name[NAM$C_MAXRSS + 1];
X } DIR;
X# else /* !VMS */
X# ifdef MACOS
X typedef struct direct {
X int d_wild; /* flag for wildcard vs. non-wild */
X char *d_name;
X } DIR;
X# endif
X# ifdef M_XENIX
X# include <sys/ndir.h>
X# else /* !M_XENIX */
X# include <sys/dir.h>
X# endif /* ?M_XENIX */
X# ifdef NODIR /* for AT&T 3B1 */
X# define dirent direct
X typedef FILE DIR;
X# define dstrm DIR
X# endif /* NODIR */
X# endif /* ?VMS */
X# endif /* ?MSDOS */
X# endif /* ?NDIR */
X# define dstrm DIR
X# ifndef NODIR
X DIR *opendir OF((char *));
X# endif /* !NODIR */
X# ifndef CONVEX
X struct direct *readdir OF((DIR *));
X# endif /* !CONVEX */
X#endif /* ?DIRENT */
X#endif /* ?SYSV */
X#endif /* !UTIL */
X
X
X/* Library functions not in (most) header files */
X
X#if defined(__IBMC__) || defined(__WATCOMC__)
X# define NO_MKTEMP
X#endif
Xchar *mktemp OF((char *));
X
X#ifdef __GO32__
X char *strlwr OF((char *));
X#else
X int link OF((char *, char *));
X int unlink OF((char *));
X# if defined(MSDOS)
X int chmod OF((char *, int));
X /* For many targets, chmod is already defined by sys/stat.h, and second
X * parameter is an unsigned long.
X */
X# endif
X#endif
X
X
X#ifndef UTIL /* the companion #endif is a bit of ways down ... */
X
X#ifndef __TURBOC__
X int utime OF((char *, time_t *));
X#endif /* !__TURBOC__ */
X#ifndef MSDOS
X int open OF((char *, int, ...));
X int close OF((int));
X# ifndef RMDIR
X int rmdir OF((char *));
X# endif /* !RMDIR */
X#endif /* !MSDOS */
X
X
X/* Local globals (kinda like "military intelligence" or "broadcast quality") */
Xlocal int exflag = 0; /* Exclude flag */
X
X#ifdef VMS
X typedef int statime;
X#else /* !VMS */
X typedef time_t statime;


X#endif /* ?VMS */
X

X/* Local functions */
X#ifdef PROTO
X# ifdef VMS
X local void vms_wild(char *, dstrm *);
X# endif /* VMS */
X# ifdef DIRENT
X local dstrm *opend(char *);
X local void closed(dstrm *);
X# endif /* DIRENT */
X local char *readd(dstrm *);
X local int fqcmp(voidp *, voidp *);
X local int fqcmpz(voidp *, voidp *);
X local char *last(char *);
X local char *msname(char *);
X# ifdef VMS
X local char *strlower(char *);
X local char *strupper(char *);
X# endif /* VMS */
X local char *ex2in(char *, int *);
X local int newname(char *);
X local void inctime(struct tm *);
X local ulg unix2dostime(statime *);
X# if !defined(__TURBOC__) && !defined(OS2) && !defined(__GO32__)
X local int cmptime(struct tm *, struct tm *);
X local time_t invlocal(struct tm *);
X# endif /* !__TURBOC__ */
X#endif /* PROTO */
X
X
X#if defined(MSDOS) && !defined(OS2)
Xdstrm *opendir(n)
Xchar *n; /* directory to open */
X/* Start searching for files in the MSDOS directory n */
X{
X dstrm *d; /* malloc'd return value */
X char *p; /* malloc'd temporary string */
X
X if ((d = (dstrm *)malloc(sizeof(dstrm))) == NULL ||
X (p = malloc(strlen(n) + 5)) == NULL)
X return NULL;
X strcat(strcpy(p, n), "/*.*");
X#ifdef WIN32
X {
X WIN32_FIND_DATA fd;
X DWORD dwAttr;
X BOOL bAttr;
X
X if ((HANDLE)0xFFFFFFFF == (d->d_hFindFile = FindFirstFile(p, &fd)))
X {
X free((voidp *)p);
X return NULL;
X }
X else
X strcpy(d->d_name, fd.cFileName);
X if (-1 != (dwAttr = GetFileAttributes(fd.cFileName)))
X {
X bAttr = FALSE;
X if (FILE_ATTRIBUTE_SYSTEM == (dwAttr & FILE_ATTRIBUTE_SYSTEM))
X bAttr = TRUE;
X if (FILE_ATTRIBUTE_HIDDEN == (dwAttr & FILE_ATTRIBUTE_HIDDEN))
X bAttr = TRUE;
X if (FILE_ATTRIBUTE_DIRECTORY == (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
X bAttr = TRUE;
X if (!bAttr)
X {
X free ((voidp *)p);
X free ((void *) d);
X return NULL;
X }
X }
X
X }
X#else
X if (FFIRST(p, d))
X {
X free((voidp *)p);
X return NULL;
X }
X free((voidp *)p);
X#endif
X d->d_first = 1;
X return d;
X}
X
Xstruct direct *readdir(d)
Xdstrm *d; /* directory stream to read from */
X/* Return pointer to first or next directory entry, or NULL if end. */
X{
X if (d->d_first)
X d->d_first = 0;
X else
X#ifdef WIN32
X {
X WIN32_FIND_DATA fd;
X
X if (!FindNextFile(d->d_hFindFile, &fd))
X return NULL;
X else
X strcpy(d->d_name, fd.cFileName);
X }
X#else /* !WIN32 */
X if (FNEXT(d))
X return NULL;
X#endif
X return (struct direct *)d;
X}
X# define closedir free
X
X#endif /* MSDOS && !OS2 */
X
X
X#ifdef VMS
X
X/*---------------------------------------------------------------------------
X
X _vms_findfirst() and _vms_findnext(), based on public-domain DECUS C
X fwild() and fnext() routines (originally written by Martin Minow, poss-
X ibly modified by Jerry Leichter for bintnxvms.c), were written by Greg
X Roelofs and are still in the public domain. Routines approximate the
X behavior of MS-DOS (MSC and Turbo C) findfirst and findnext functions.
X
X ---------------------------------------------------------------------------*/
Xlocal void vms_wild(p, d)
Xchar *p;
Xdstrm *d;
X{
X /*
X * Do wildcard setup
X */
X /* set up the FAB and NAM blocks. */
X d->fab = cc$rms_fab; /* initialize fab */
X d->nam = cc$rms_nam; /* initialize nam */
X
X d->fab.fab$l_nam = &d->nam; /* fab -> nam */
X d->fab.fab$l_fna = p; /* argument wild name */
X d->fab.fab$b_fns = strlen(p); /* length */
X
X d->nam.nam$l_esa = d->d_qualwildname; /* qualified wild name */
X d->nam.nam$b_ess = NAM$C_MAXRSS; /* max length */
X d->nam.nam$l_rsa = d->d_name; /* matching file name */
X d->nam.nam$b_rss = NAM$C_MAXRSS; /* max length */
X
X /* parse the file name */
X if (sys$parse(&d->fab) != RMS$_NORMAL)
X return;
X /* Does this replace d->fab.fab$l_fna with a new string in its own space?
X I sure hope so, since p is free'ed before this routine returns. */
X
X /* have qualified wild name (i.e., disk:[dir.subdir]*.*); null-terminate
X * and set wild-flag */
X d->d_qualwildname[d->nam.nam$b_esl] = '\0';
X d->d_wild = (d->nam.nam$l_fnb & NAM$M_WILDCARD)? 1 : 0; /* not used... */
X#ifdef DEBUG
X printf(" incoming wildname: %s\n", p);
X printf(" qualified wildname: %s\n", d->d_qualwildname);
X#endif /* DEBUG */
X}
X
Xdstrm *opendir(n)
Xchar *n; /* directory to open */
X/* Start searching for files in the VMS directory n */
X{
X char *c; /* scans VMS path */
X dstrm *d; /* malloc'd return value */
X int m; /* length of name */
X char *p; /* malloc'd temporary string */
X
X if ((d = (dstrm *)malloc(sizeof(dstrm))) == NULL ||
X (p = malloc((m = strlen(n)) + 4)) == NULL)
X return NULL;
X /* Directory may be in form "[DIR.SUB1.SUB2]" or "[DIR.SUB1]SUB2.DIR;1".
X If latter, convert to former. */
X if (m > 0 && *(c = strcpy(p,n)+m-1) != ']')
X {
X while (--c > p && *c != ';')
X ;
X if (c-p < 5 || strncmp(c-4, ".DIR", 4))
X {
X free((voidp *)d); free((voidp *)p);
X return NULL;
X }
X c -= 3;
X *c-- = '\0'; /* terminate at "DIR;#" */
X *c = ']'; /* "." --> "]" */
X while (c > p && *--c != ']')
X ;
X *c = '.'; /* "]" --> "." */
X }
X strcat(p, "*.*");
X vms_wild(p, d); /* set up wildcard */
X free((voidp *)p);
X return d;
X}
X
Xstruct direct *readdir(d)
Xdstrm *d; /* directory stream to read from */
X/* Return pointer to first or next directory entry, or NULL if end. */
X{
X int r; /* return code */
X
X do {
X d->fab.fab$w_ifi = 0; /* internal file index: what does this do? */
X
X /* get next match to possible wildcard */
X if ((r = sys$search(&d->fab)) == RMS$_NORMAL)
X {
X d->d_name[d->nam.nam$b_rsl] = '\0'; /* null terminate */
X return (struct direct *)d; /* OK */
X }
X } while (r == RMS$_PRV);
X return NULL;
X}
X# define closedir free


X#endif /* VMS */
X
X

X#ifdef NODIR /* for AT&T 3B1 */
X/*
X** Apparently originally by Rich Salz.
X** Cleaned up and modified by James W. Birdsall.
X*/
X
X# define opendir(path) fopen(path, "r")
X
Xstruct direct *readdir(dirp)
XDIR *dirp;
X{
X static struct direct entry;
X
X if (dirp == NULL)
X return NULL;
X for (;;)
X if (fread (&entry, sizeof (struct direct), 1, dirp) == 0)
X return NULL;
X else if (entry.d_ino)
X return (&entry);
X} /* end of readdir() */
X
X# define closedir(dirp) fclose(dirp)
X#endif /* NODIR */
X
X
X#ifdef DIRENT
Xlocal dstrm *opend(n)
Xchar *n; /* directory name to open */
X/* Open the directory *n, returning a pointer to an allocated dstrm, or
X NULL if error. */
X{
X dstrm *d; /* pointer to malloc'ed directory stream */
X
X if ((d = (dstrm *)malloc(sizeof(dstrm))) == NULL)
X return NULL;
X if ((d->f = open(n, 0, 0)) < 0) /* open directory */
X return NULL;
X d->p = d->q = d->b; /* buffer is empty */
X return d;
X}
X#else /* !DIRENT */
X# define opend opendir /* just use opendir() */
X#endif /* ?DIRENT */
X
X
Xlocal char *readd(d)
Xdstrm *d; /* directory stream to read from */
X/* Return a pointer to the next name in the directory stream d, or NULL if
X no more entries or an error occurs. */
X{
X struct direct *e; /* directory entry read */
X
X#ifdef DIRENT
X int n; /* number of entries read by getdents */
X
X if (d->p >= d->q) /* if empty, fill buffer */
X if ((n = getdents(d->f, d->b, DBSZ)) <= 0)
X return NULL;
X else
X d->q = n + (d->p = d->b);
X e = (struct direct *)(d->p); /* point to entry */
X d->p += ((struct direct *)(d->p))->d_reclen; /* advance */
X return e->d_name; /* return name */
X#else /* !DIRENT */
X return (e = readdir(d)) == NULL ? (char *)NULL : e->d_name;
X#endif /* ?DIRENT */
X}
X
X
X#ifdef DIRENT
Xlocal void closed(d)
Xdstrm *d; /* directory stream to close */
X/* Close the directory stream */
X{
X close(d->f);
X free((voidp *)d);
X}
X#else /* !DIRENT */
X# define closed closedir
X#endif /* ?DIRENT */
X
X
X#ifdef MSDOS
X
Xint wild(w)
Xchar *w; /* path/pattern to match */
X/* If not in exclude mode, expand the pattern based on the contents of the
X file system. Return an error code in the ZE_ class. */
X{
X char *a; /* alloc'ed space for name */
X dstrm *d; /* stream for reading directory */
X char *e; /* name found in directory */
X int f; /* true if there was a match */
X char *n; /* constructed name from directory */
X char *p; /* path */
X char *q; /* name */
X int r; /* temporary variable */
X char v[5]; /* space for device current directory */
X
X /* Allocate and copy pattern */
X if ((p = a = malloc(strlen(w) + 1)) == NULL)
X return ZE_MEM;
X strcpy(p, w);
X
X /* Normalize pattern to upper case, path delimiter as '/'. */
X#if defined(FORCE_UPPER)
X#ifndef OS2
X strupr(p); /* convert to upper case */
X#else /* OS2 */
X if (IsFileSystemFAT(p)) strupr(p);
X#endif /* !OS2 */
X#endif
X for (q = p; *q; q++) /* use / consistently */
X if (*q == '\\')
X *q = '/';
X
X /* If excluding, don't bother with file system */
X if (exflag)
X {
X r = procname(p);
X free((voidp *)a);
X return r;
X }
X
X /* Only name can have special matching characters */
X if ((q = isshexp(p)) != NULL &&
X (strrchr(q, '/') != NULL || strrchr(q, ':') != NULL))
X {
X free((voidp *)a);
X return ZE_PARMS;
X }
X
X /* Separate path and name into p and q */
X if ((q = strrchr(p, '/')) != NULL && (q == p || q[-1] != ':'))
X {
X *q++ = 0; /* path/name -> path, name */
X if (*p == 0) /* path is just / */
X p = strcpy(v, "/.");
X }
X else if ((q = strrchr(p, ':')) != NULL)
X { /* has device and no or root path */
X *q++ = 0;
X p = strcat(strcpy(v, p), ":"); /* copy device as path */
X if (*q == '/') /* -> device:/., name */
X {
X strcat(p, "/");
X q++;
X }
X strcat(p, ".");
X }
X else /* no path or device */
X {
X q = p;
X p = strcpy(v, ".");
X }
X
X /* Search that level for matching names */
X if ((d = opend(p)) == NULL)
X {
X free((voidp *)a);
X return ZE_MISS;
X }
X if ((r = strlen(p)) > 1 &&
X (strcmp(p + r - 2, ":.") == 0 || strcmp(p + r - 2, "/.") == 0))
X *(p + r - 1) = 0;
X f = 0;
X while ((e = readd(d)) != NULL)
X if (strcmp(e, ".") && strcmp(e, "..") && MATCH(q, e))
X {
X f = 1;
X if (strcmp(p, ".") == 0) /* path is . */
X procname(e); /* name is name */
X else
X {
X if ((n = malloc(strlen(p) + strlen(e) + 2)) == NULL)
X {
X free((voidp *)a);
X return ZE_MEM;
X }
X n = strcpy(n, p);
X if (n[r = strlen(n) - 1] != '/' && n[r] != ':')
X strcat(n, "/");
X r = procname(strcat(n, e)); /* name is path/name */
X free((voidp *)n);
X if (r)
X {
X free((voidp *)a);
X return r;
X }
X }
X }
X closed(d);
X
X /* Done */
X free((voidp *)a);
X return f ? ZE_OK : ZE_MISS;
X}
X


X#endif /* MSDOS */
X
X

X#ifdef VMS
Xint wild(p)
Xchar *p; /* path/pattern to match */
X/* Expand the pattern based on the contents of the file system. Return an
X error code in the ZE_ class. */
X{
X dstrm *d; /* stream for reading directory */
X char *e; /* name found in directory */
X int f; /* true if there was a match */
X
X /* Search given pattern for matching names */
X if ((d = (dstrm *)malloc(sizeof(dstrm))) == NULL)
X return ZE_MEM;
X vms_wild(p, d); /* pattern may be more than just directory name */
X f = 0;
X while ((e = readd(d)) != NULL) /* "dosmatch" is already built in */
X if (procname(e) == ZE_OK)
X f = 1;
X closed(d);
X
X /* Done */
X return f ? ZE_OK : ZE_MISS;
X}


X#endif /* VMS */
X
X

Xchar *getnam(n)
Xchar *n; /* where to put name (must have >=FNMAX+1 bytes) */
X/* Read a space, \n, \r, or \t delimited name from stdin into n, and return
X n. If EOF, then return NULL. Also, if the name read is too big, return
X NULL. */
X{
X int c; /* last character read */
X char *p; /* pointer into name area */
X
X p = n;
X while ((c = getchar()) == ' ' || c == '\n' || c == '\r' || c == '\t')
X ;
X if (c == EOF)
X return NULL;
X do {
X if (p - n >= FNMAX)
X return NULL;
X *p++ = (char)c;
X c = getchar();
X } while (c != EOF && c != ' ' && c != '\n' && c != '\r' && c != '\t');
X *p = 0;
X return n;
X}
X
X
Xstruct flist far *fexpel(f)
Xstruct flist far *f; /* entry to delete */
X/* Delete the entry *f in the doubly-linked found list. Return pointer to
X next entry to allow stepping through list. */
X{
X struct flist far *t; /* temporary variable */
X
X t = f->nxt;
X *(f->lst) = t; /* point last to next, */
X if (t != NULL)
X t->lst = f->lst; /* and next to last */
X if (f->name != NULL) /* free memory used */
X free((voidp *)(f->name));
X if (f->zname != NULL)
X free((voidp *)(f->zname));
X farfree((voidp far *)f);
X fcount--; /* decrement count */
X return t; /* return pointer to next */
X}
X
X
Xlocal int fqcmp(a, b)
Xvoidp *a, *b; /* pointers to pointers to found entries */
X/* Used by qsort() to compare entries in the found list by name. */
X{
X return strcmp((*(struct flist far **)a)->name,
X (*(struct flist far **)b)->name);
X}
X
X
Xlocal int fqcmpz(a, b)
Xvoidp *a, *b; /* pointers to pointers to found entries */
X/* Used by qsort() to compare entries in the found list by zname. */
X{
X return strcmp((*(struct flist far **)a)->zname,
X (*(struct flist far **)b)->zname);
X}
X
X
Xlocal char *last(p)
Xchar *p; /* sequence of / delimited path components */
X/* Return a pointer to the start of the last path component. */
X{
X char *t; /* temporary variable */
X
X#ifdef VMS
X if ((t = strrchr(p, ']')) != NULL)
X#else /* !VMS */
X if ((t = strrchr(p, '/')) != NULL)
X#endif /* ?VMS */
X return t + 1;
X else
X return p;
X}
X
X
Xlocal char *msname(n)
Xchar *n;
X/* Reduce all path components to MSDOS upper case 8.3 style names. Probably
X should also check for invalid characters, but I don't know which ones
X those are. */
X{
X int c; /* current character */
X int f; /* characters in current component */
X char *p; /* source pointer */
X char *q; /* destination pointer */
X
X p = q = n;
X f = 0;
X while ((c = *p++) != 0)
X if (c == '/')
X {
X *q++ = (char)c;
X f = 0; /* new component */
X }
X else if (c == '.')
X if (f < 9)
X {
X *q++ = (char)c;
X f = 9; /* now in file type */
X }
X else
X f = 12; /* now just excess characters */
X else
X if (f < 12 && f != 8)
X {
X *q++ = (char)(to_up(c));
X f++; /* do until end of name or type */
X }
X *q = 0;
X return n;
X}
X
X
X#ifdef VMS
Xlocal char *strlower(s)
Xchar *s; /* string to convert */
X/* Convert all uppercase letters to lowercase in string s */
X{
X char *p; /* scans string */
X
X for (p = s; *p; p++)
X if (*p >= 'A' && *p <= 'Z')
X *p += 'a' - 'A';
X return s;
X}
X
Xlocal char *strupper(s)
Xchar *s; /* string to convert */
X/* Convert all lowercase letters to uppercase in string s */
X{
X char *p; /* scans string */
X
X for (p = s; *p; p++)
X if (*p >= 'a' && *p <= 'z')
X *p -= 'a' - 'A';
X return s;
X}


X#endif /* VMS */
X

Xlocal char *ex2in(x, pdosflag)
Xchar *x; /* external file name */
Xint *pdosflag; /* output: force MSDOS file attributes? */
X/* Convert the external file name to a zip file name, returning the malloc'ed
X string or NULL if not enough memory. */
X{
X char *n; /* internal file name (malloc'ed) */
X char *t; /* shortened name */
X int dosflag;
X
X#ifdef OS2
X dosflag = dosify || IsFileSystemFAT(x);
X if ( !dosify && use_longname_ea && (t = GetLongPathEA(x)) != NULL )
X {
X x = t;
X dosflag = 0;
X }
X#else
X# ifdef MSDOS
X dosflag = 1;
X# else /* !MSDOS */
X dosflag = dosify; /* default for non-DOS and non-OS/2 */
X# endif /* MSDOS */
X#endif /* OS2 */
X
X /* Find starting point in name before doing malloc */
X#ifdef MSDOS /* msdos */
X t = *x && *(x + 1) == ':' ? x + 2 : x;
X while (*t == '/' || *t == '\\')
X t++;
X#else /* !MSDOS */
X# ifdef VMS /* vms */
X t = x;
X if ((n = strrchr(t, ':')) != NULL)
X t = n + 1;
X if (*t == '[' && (n = strrchr(t, ']')) != NULL)
X if ((x = strchr(t, '.')) != NULL && x < n)
X t = x + 1;
X else
X t = n + 1;
X# else /* !VMS */ /* unix */
X for (t = x; *t == '/'; t++)
X ;
X# endif /* ?VMS */


X#endif /* ?MSDOS */
X

X /* Make changes, if any, to the copied name (leave original intact) */
X#ifdef MSDOS
X for (n = t; *n; n++)
X if (*n == '\\')
X *n = '/';


X#endif /* MSDOS */
X

X if (!pathput)
X t = last(t);
X
X /* Malloc space for internal name and copy it */
X if ((n = malloc(strlen(t) + 1)) == NULL)
X return NULL;
X strcpy(n, t);
X
X#ifdef VMS
X if ((t = strrchr(n, ']')) != NULL)
X {
X *t = '/';
X while (--t > n)
X if (*t == '.')
X *t = '/';
X }
X
X /* Fix from Greg Roelofs: */
X /* Get current working directory and strip from n (t now = n) */
X {
X char cwd[256], *p, *q;
X int c;
X
X if (getcwd(cwd, 256) && ((p = strchr(cwd, '.')) != NULL))
X {
X ++p;
X if ((q = strrchr(p, ']')) != NULL)
X {
X *q = '/';
X while (--q > p)
X if (*q == '.')
X *q = '/';
X /* strip bogus path parts from n */
X if (strncmp(n, p, (c=strlen(p))) == 0)
X {
X q = n + c;
X while (*t++ = *q++)
X ;
X }
X }
X }
X }
X strlower(n);
X if (!vmsver)
X if ((t = strrchr(n, ';')) != NULL)
X *t = 0;
X
X if( (t = strrchr(n, '.')) != NULL )
X {
X if( t[1] == 0 ) /* "filename." -> "filename" */
X *t = 0;
X else if( t[1] == ';' ) /* "filename.;vvv" -> "filename;vvv" */
X {
X char *f;
X for( f=t+1; *t++ = *f++; )
X ;
X }
X }
X#endif /* VMS */
X if (dosify)
X msname(n);
X#if defined(MSDOS) && !defined(OS2) && !defined(FORCE_UPPER)
X else
X strlwr(n);
X#endif
X /* Returned malloc'ed name */
X if (pdosflag)
X *pdosflag = dosflag;
X return n;
X}
X
X
Xchar *in2ex(n)
Xchar *n; /* internal file name */
X/* Convert the zip file name to an external file name, returning the malloc'ed
X string or NULL if not enough memory. */
X{
X char *x; /* external file name */
X#ifdef VMS
X char *t; /* scans name */
X
X if ((t = strrchr(n, '/')) == NULL)


X#endif /* VMS */
X {

X if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
X return NULL;
X strcpy(x, n);
X }
X#ifdef VMS
X else
X {
X if ((x = malloc(strlen(n) + 3 + PAD)) == NULL)
X return NULL;
X strcpy(x, "[.");
X strcpy(x + 2, n);
X *(t = x + 2 + (t - n)) = ']';
X while (--t > x)
X if (*t == '/')
X *t = '.';
X }
X strupper(x);
X#endif /* VMS */
X#ifdef OS2
X if ( !IsFileNameValid(x) )
X ChangeNameForFAT(x);
X#endif /* !OS2 */
X#if defined(FORCE_UPPER) && defined(MSDOS)
X /* Don't convert to upper case, causes wrong warnings. Keep the
X * name as it was before in the old zip file.
X */
X strupr(x);
X#endif
X return x;
X}
X
X
Xint exclude()
X/* Change from including to excluding names when procname() called. Return
X an error code in the ZE_ class. */
X{
X struct flist far *f; /* steps through found linked list */
X extent j; /* index for s */
X struct flist far **s; /* sorted table */
X
X /* sort found list, remove duplicates */
X if (fcount)
X {
X if ((s = (struct flist far **)malloc(
X fcount * sizeof(struct flist far *))) == NULL)
X return ZE_MEM;
X for (j = 0, f = found; f != NULL; f = f->nxt)
X s[j++] = f;
X qsort((char *)s, fcount, sizeof(struct flist far *), fqcmp);
X for (j = fcount - 1; j > 0; j--)
X if (strcmp(s[j - 1]->name, s[j]->name) == 0)
X fexpel(s[j]); /* fexpel() changes fcount */
X qsort((char *)s, fcount, sizeof(struct flist far *), fqcmpz);
X for (j = 1; j < fcount; j++)
X if (strcmp(s[j - 1]->zname, s[j]->zname) == 0)
X {
X warn("name in zip file repeated: ", s[j]->zname);
X warn(" first full name: ", s[j - 1]->name);
X warn(" second full name: ", s[j]->name);
X return ZE_PARMS;
X }
X free((voidp *)s);
X }
X exflag = 1;
X return ZE_OK;
X}
X
X
Xlocal int newname(n)
Xchar *n; /* name to add (or exclude) */
X/* Add (or exclude) a name that is not in the zip file. Return an error
X code in the ZE_ class. */
X{
X char *m;
X struct flist far *f; /* where in found, or new found entry */
X struct zlist far *z; /* where in zfiles (if found) */
X int dosflag;
X
X /* Search for name in zip file. If there, mark it, else add to
X list of new names to do (or remove from that list). */
X if ((m = ex2in(n, &dosflag)) == NULL)
X return ZE_MEM;
X if ((z = zsearch(m)) != NULL)
X if (exflag)
X {
X z->mark = 0;
X free((voidp *)m);
X if (verbose)
X printf("zip diagnostic: excluding %s\n", z->name);
X }
X else
X {
X free((voidp *)(z->name));
X free((voidp *)(z->zname));
X if ((z->name = malloc(strlen(n) + 1 + PAD)) == NULL)
X return ZE_MEM;
X strcpy(z->name, n);
X z->zname = m;
X z->mark = 1;
X z->dosflag = dosflag;
X if (verbose)
X printf("zip diagnostic: including %s\n", z->name);
X }
X else
X if (exflag)
X {
X /* search list for name--if there, remove it */
X for (f = found; f != NULL; f = f->nxt)
X if (namecmp(n, f->name) == 0)
X {
X fexpel(f);
X break;
X }
X free((voidp *)m);
X }
X else
X {
X /* allocate space and add to list */
X if ((f = (struct flist far *)farmalloc(sizeof(struct flist))) == NULL ||
X (f->name = malloc(strlen(n) + 1 + PAD)) == NULL)
X {
X if (f != NULL)
X farfree((voidp far *)f);
X return ZE_MEM;
X }
X strcpy(f->name, n);
X f->zname = m;
X f->dosflag = dosflag;
X *fnxt = f;
X f->lst = fnxt;
X f->nxt = NULL;
X fnxt = &f->nxt;
X fcount++;
X }
X return ZE_OK;
X}
X
X
Xint procname(n)
Xchar *n; /* name to process */
X/* Process a name or sh expression to operate on (or exclude). Return
X an error code in the ZE_ class. */
X{
X char *a; /* path and name for recursion */
X dstrm *d; /* directory stream from opend() */
X char *e; /* pointer to name from readd() */
X struct flist far *f; /* steps through found list */
X int m; /* matched flag */
X char *p; /* path for recursion */
X struct stat s; /* result of stat() */
X struct zlist far *z; /* steps through zfiles list */
X
X if (strcmp(n, "-") == 0) /* if compressing stdin */
X return newname(n);
X else if (
X#ifdef S_IFLNK /* if symbolic links exist ... */
X linkput ? lstat(n, &s) :
X#endif /* S_IFLNK */
X SSTAT(n, &s)
X#if defined(__TURBOC__) || defined(VMS)
X /* Borland and VMS C bug: stat() succeeds on wild card names! */
X || isshexp(n)
X#endif
X )
X {
X /* Not a file or directory--search for shell expression in zip file */
X p = ex2in(n, NULL); /* shouldn't affect matching chars */
X m = 1;
X for (z = zfiles; z != NULL; z = z->nxt)
X if (MATCH(p, z->zname))
X {
X z->mark = !exflag;
X if (verbose)
X printf("zip diagnostic: %scluding %s\n",
X exflag ? "ex" : "in", z->name);
X m = 0;
X }
X /* If excluding, also search for expression in found list */
X if (exflag)
X {
X for (f = found; f != NULL;)
X if (MATCH(p, f->zname))
X {
X f = fexpel(f);
X m = 0;
X }
X else
X f = f->nxt;
X }
X free((voidp *)p);
X if (m)
X return ZE_MISS; /* no match */
X }
X else
X {
X /* Live name--use if file, recurse if directory */
X#if defined(FORCE_UPPER) && defined(MSDOS)
X# ifndef OS2
X strupr(n); /* convert to upper case */
X# else /* OS2 */
X if (IsFileSystemFAT(n)) strupr(n);
X# endif /* !OS2 */
X#endif
X
X#ifdef MSDOS
X for (p = n; *p; p++) /* use / consistently */
X if (*p == '\\')
X *p = '/';
X#endif /* MSDOS */
X if ((s.st_mode & S_IFDIR) == 0)
X {
X /* add or remove name of file */
X if ((m = newname(n)) != ZE_OK)
X return m;
X } else {
X /* recurse into directory */
X if (recurse && (d = opend(n)) != NULL)
X {
X#ifdef VMS
X while ((e = readd(d)) != NULL)
X if ((m = procname(e)) != ZE_OK) /* recurse on name */
X {
X /* want to just set warning error and continue */
X closed(d);
X return m;
X }
X#else /* !VMS */
X if ((p = malloc(strlen(n)+2)) == NULL)
X return ZE_MEM;
X if (strcmp(n, ".") == 0)
X *p = 0; /* avoid "./" prefix and do not create zip entry */
X else
X {
X strcpy(p, n);
X a = p + strlen(p);
X if (a[-1] != '/')
X strcpy(a, "/");
X if ((m = newname(p)) != ZE_OK)
X return m;
X }
X while ((e = readd(d)) != NULL)
X if (strcmp(e, ".") && strcmp(e, ".."))
X {
X if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
X {
X free((voidp *)p);
X closed(d);
X return ZE_MEM;
X }
X strcat(strcpy(a, p), e);
X if ((m = procname(a)) != ZE_OK) /* recurse on name */
X {
X free((voidp *)a); free((voidp *)p);
X closed(d);
X return m;
X }
X free((voidp *)a);
X }
X free((voidp *)p);
X#endif /* ?VMS */
X closed(d);
X }
X }
X }
X return ZE_OK;
X}
X
X
X#if !defined(CRAY) && !defined(__TURBOC__) && !defined(OS2) /* and ... */
X#if !defined( __GO32__)
X
Xlocal int cmptime(p, q)
Xstruct tm *p, *q; /* times to compare */
X/* Return negative if time p is before time q, positive if after, and
X zero if the same */
X{
X int r; /* temporary variable */
X
X if (p == NULL)
X return -1;
X else if ((r = p->tm_year - q->tm_year) != 0)
X return r;
X else if ((r = p->tm_mon - q->tm_mon) != 0)
X return r;
X else if ((r = p->tm_mday - q->tm_mday) != 0)
X return r;
X else if ((r = p->tm_hour - q->tm_hour) != 0)
X return r;
X else if ((r = p->tm_min - q->tm_min) != 0)
X return r;
X else
X return p->tm_sec - q->tm_sec;
X}
X
X
Xlocal time_t invlocal(t)
Xstruct tm *t; /* time to convert */
X/* Find inverse of localtime() using bisection. This routine assumes that
X time_t is an integer type, either signed or unsigned. The expectation
X is that sometime before the year 2038, time_t will be made a 64-bit
X integer, and this routine will still work. */
X{
X time_t i; /* midpoint of current root range */
X time_t l; /* lower end of root range */
X time_t u; /* upper end of root range */
X
X /* Bracket the root [0,largest time_t]. Note: if time_t is a 32-bit signed
X integer, then the upper bound is GMT 1/19/2038 03:14:07, after which all
X the Unix systems in the world come to a grinding halt. Either that, or
X all those systems will suddenly find themselves transported to December
X of 1901 ... */
X l = 0;
X u = 1;
X while (u < (u << 1))
X u = (u << 1) + 1;
X
X /* Find the root */
X while (u - l > 1)
X {
X i = l + ((u - l) >> 1);
X if (cmptime(localtime(&i), t) <= 0)
X l = i;
X else
X u = i;
X }
X return l;
X}
X#endif
X#endif
X
X
Xvoid stamp(f, d)
Xchar *f; /* name of file to change */
Xulg d; /* dos-style time to change it to */
X/* Set last updated and accessed time of file f to the DOS time d. */
X{
X#if defined(MACOS)
X warn("timestamp not implemented yet", "");
X#else
X#ifdef __TURBOC__
X int h; /* file handle */
X
X if ((h = open(f, 0)) != -1)
X {
X#ifdef ATARI_ST
X d = ( d >> 16 ) | ( d << 16 );
X#endif
X setftime(h, (struct ftime *)&d);
X close(h);
X }
X#else /* !__TURBOC__ */
X#ifdef VMS
X int tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year;
X char timbuf[24];
X static char *month[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
X "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
X struct VMStimbuf {
X char *actime; /* VMS revision date, ASCII format */
X char *modtime; /* VMS creation date, ASCII format */
X } ascii_times = {timbuf, timbuf};
X
X /* Convert DOS time to ASCII format for VMSmunch */
X tm_sec = (int)(d << 1) & 0x3e;
X tm_min = (int)(d >> 5) & 0x3f;
X tm_hour = (int)(d >> 11) & 0x1f;
X tm_mday = (int)(d >> 16) & 0x1f;
X tm_mon = ((int)(d >> 21) & 0xf) - 1;
X tm_year = ((int)(d >> 25) & 0x7f) + 1980;
X sprintf(timbuf, "%02d-%3s-%04d %02d:%02d:%02d.00", tm_mday, month[tm_mon],
X tm_year, tm_hour, tm_min, tm_sec);
X
X /* Set updated and accessed times of f */
X if (VMSmunch(f, SET_TIMES, &ascii_times) != RMS$_NMF)
X warn("can't set zipfile time: ", f);
X
X#else /* !VMS */
X#ifdef OS2
X SetFileTime(f, d);
X#else /* !OS2 */
X struct tm t; /* argument for mktime() or invlocal() */
X time_t u[2]; /* argument for utime() */
X#ifndef __GO32__
X extern time_t mktime OF((struct tm *));
X#endif
X
X /* Convert DOS time to time_t format in u[0] and u[1] */
X t.tm_sec = (int)(d << 1) & 0x3e;
X t.tm_min = (int)(d >> 5) & 0x3f;
X t.tm_hour = (int)(d >> 11) & 0x1f;
X t.tm_mday = (int)(d >> 16) & 0x1f;
X t.tm_mon = ((int)(d >> 21) & 0xf) - 1;
X t.tm_year = ((int)(d >> 25) & 0x7f) + 80;
X#if defined(MSDOS) || defined(OS2) || defined(CRAY)
X /* mktime() is more reliable than invlocal() because the time range is
X * wider on MSDOS than on Unix; required for Cray because invlocal assumes
X * 32-bit ints
X */
X u[0] = u[1] = mktime(&t);
X#else
X u[0] = u[1] = invlocal(&t);
X#endif
X
X /* Set updated and accessed times of f */
X utime(f, u);
X#endif /* ?OS2 */
X#endif /* ?VMS */
X#endif /* ?__TURBOC__ */
X#endif /* ?MACOS */
X}
X
X
Xlocal void inctime(s)
Xstruct tm *s; /* time to increment in place */
X/* Increment the time structure *s by one second, return the result in
X place. */
X{
X int y; /* temporary variable */
X
X /* days in each month, except for February */
X static int days[] = {31,0,31,30,31,30,31,31,30,31,30,31};
X
X /* Set days in February from year (1900 is a leap year, 2000 is not) */
X y = s->tm_year + 1900;
X days[1] = y % 4 == 0 && (y % 100 != 0 || y % 400 == 0) ? 29 : 28;
X
X /* Increment time with carry */
X if (s->tm_sec != 59)
X s->tm_sec++;
X else if (s->tm_sec = 0, s->tm_min != 59)
X s->tm_min++;
X else if (s->tm_min = 0, s->tm_hour != 23)
X s->tm_hour++;
X else if (s->tm_hour = 0, s->tm_mday != days[s->tm_mon])
X s->tm_mday++;
X else if (s->tm_mday = 1, s->tm_mon != 11)
X s->tm_mon++;
X else
X {
X s->tm_mon = 0;
X s->tm_year++;
X }
X}
X
X
Xulg dostime(y, n, d, h, m, s)
Xint y; /* year */
Xint n; /* month */
Xint d; /* day */
Xint h; /* hour */
Xint m; /* minute */
Xint s; /* second */
X/* Convert the date y/n/d and time h:m:s to a four byte DOS date and
X time (date in high two bytes, time in low two bytes allowing magnitude
X comparison). */
X{
X return y < 1980 ? dostime(1980, 1, 1, 0, 0, 0) :
X (((ulg)y - 1980) << 25) | ((ulg)n << 21) | ((ulg)d << 16) |
X ((ulg)h << 11) | ((ulg)m << 5) | ((ulg)s >> 1);
X}
X
X
Xlocal ulg unix2dostime(t)
Xstatime *t; /* unix time to convert */
X/* Return the Unix time t in DOS format, rounded up to the next two
X second boundary. */
X{
X struct tm *s; /* result of localtime() */
X
X s = localtime(t); /* Use local time since MSDOS does */
X inctime(s); /* Add one second to round up */
X return dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
X s->tm_hour, s->tm_min, s->tm_sec);
X}
X
X
Xulg filetime(f, a, n)
Xchar *f; /* name of file to get info on */
Xulg *a; /* return value: file attributes */
Xlong *n; /* return value: file size */
X/* If file *f does not exist, return 0. Else, return the file's last
X modified date and time as an MSDOS date and time. The date and
X time is returned in a long with the date most significant to allow
X unsigned integer comparison of absolute times. Also, if a is not
X a NULL pointer, store the file attributes there, with the high two
X bytes being the Unix attributes, and the low byte being a mapping
X of that to DOS attributes. If n is not NULL, store the file size
X there.
X If f is "-", use standard input as the file. If f is a device, return
X a file size of -1 */
X{
X struct stat s; /* results of stat() */
X char name[FNMAX];
X int len = strlen(f);
X
X strcpy(name, f);
X if (name[len - 1] == '/')
X name[len - 1] = 0;
X /* not all systems allow stat'ing a file with / appended */
X
X if (strcmp(f, "-") == 0) {
X if (fstat(fileno(stdin), &s) != 0)
X error("fstat(stdin)");
X } else if ((
X#ifdef S_IFLNK
X linkput ? lstat(name, &s) :
X#endif
X SSTAT(name, &s)) != 0 /* || (s.st_mode & S_IFDIR) != 0 */ )
X /* Accept about any file kind except directories */
X return 0;
X
X if (a != NULL)
X#ifdef OS2
X *a = (s.st_mode << 16) | GetFileMode(name);
X#else
X *a = (s.st_mode << 16) | !(s.st_mode & S_IWRITE);
X#endif
X if (n != NULL)
X *n = (s.st_mode & S_IFREG) == 0 ? -1L : s.st_size;
X
X#ifdef OS2
X return GetFileTime(name);
X#else /* !OS2 */
X# ifdef VMS
X return unix2dostime(&s.st_ctime); /* Use creation time in VMS */
X# else /* !VMS */
X# ifdef ATARI_ST
X return s.st_mtime; /* Turbo C doesn't use UNIX times */
X# else
X return unix2dostime(&s.st_mtime);
X# endif
X# endif /* ?VMS */
X#endif /* ?OS2 */
X}
X
X
Xint issymlnk(a)
Xulg a; /* Attributes returned by filetime() */
X/* Return true if the attributes are those of a symbolic link */
X{
X#ifdef S_IFLNK
X return ((a >> 16) & S_IFMT) == S_IFLNK;
X#else /* !S_IFLNK */
X return (int)a & 0; /* avoid warning on unused parameter */
X#endif /* ?S_IFLNK */
X}
X
X
Xint deletedir(d)
Xchar *d; /* directory to delete */
X/* Delete the (empty) directory *d. Return the result of rmdir(), delete(),
X or system(). */
X{
X#ifdef MACOS
X warn("deletedir not implemented yet", "");
X return 127;
X#else
X#ifdef RMDIR
X /* code from Greg Roelofs, who horked it from Mark Edwards (unzip) */
X int r, len;
X char *s; /* malloc'd string for system command */
X
X len = strlen(d);
X if ((s = malloc(len + 34)) == NULL)
X return 127;
X
X#ifdef VMS
X {
X char *c; /* pointer into VMS path */
X /* convert "DEV:[DIR.SUB1.SUB2]" form to "DEV:[DIR.SUB1]SUB2.DIR;0" */
X strcat(strcpy(s, "set prot=(o:rwed) "), d); /* d starts at s+18 */
X if (*(c = s+17+len) != ']')
X {
X free(s);
X return 127;
X }
X strcpy(c, ".DIR;0"); /* 0 translates to highest version */
X while (--c > s+18 && *c != '.' && *c != '[') ;
X if (c == s+18)
X {
X free(s);
X return 127;
X }
X if (*c == '.')
X *c = ']';
X else if (*--c == ']') /* presumably of form "DEV:[DIR.SUB1.][SUB2]" */
X { /* (possible to have "DEV:[DIR.SUB1.][][SUB2]"?) */
X char *b = c + 2;
X c[-1] = ']';
X while (*c++ = *b++) ;
X }
X else /* must have reached device name: can't delete top level */
X {
X free(s);
X return 127;
X }
X }
X /* unprotect directory and delete it as a file. May fail if exists
X normal file "foo.dir" on top of directory "foo.dir" */
X system(s);
X r = delete(s+18);
X#else /* !VMS */
X sprintf(s, "IFS=\" \t\n\" /bin/rmdir %s 2>/dev/null", d);
X r = system(s);
X#endif /* ?VMS */
X free(s);
X return r;
X#else /* !RMDIR */
X return rmdir(d);
X#endif /* ?RMDIR */
X#endif /* ?MACOS */
X}
X
X
X#endif /* !UTIL */
X
Xint destroy(f)
Xchar *f; /* file to delete */
X/* Delete the file *f, returning non-zero on failure. */
X{
X return unlink(f);
X}
X
X
Xint replace(d, s)
Xchar *d, *s; /* destination and source file names */
X/* Replace file *d by file *s, removing the old *s. Return an error code
X in the ZE_ class. */
X{
X struct stat t; /* results of stat() */
X
X if (SSTAT(d, &t) == 0 && unlink(d))
X return ZE_CREAT; /* Can't erase zip file--give up */
X if (link(s, d)) /* Just move s on top of d */
X#if !defined(VMS) && !defined(ATARI_ST)
X /* For VMS & ATARI assume failure is EXDEV */
X if (errno != EXDEV
X# ifdef ENOTSAM
X && errno != ENOTSAM /* Used at least on Turbo C */
X# endif
X ) return ZE_CREAT;
X else
X#endif
X {
X FILE *f, *g; /* source and destination files */
X int r; /* temporary variable */
X
X if ((f = fopen(s, FOPR)) == NULL) {
X fprintf(stderr," replace: can't open %s\n", s);
X return ZE_TEMP;
X }
X if ((g = fopen(d, FOPW)) == NULL)
X {
X fclose(f);
X return ZE_CREAT;
X }
X r = fcopy(f, g, (ulg)-1L);
X fclose(f);
X if (fclose(g) || r != ZE_OK)
X {
X unlink(d);
X return r ? (r == ZE_TEMP ? ZE_WRITE : r) : ZE_WRITE;
X }
X#ifdef VMS /* only delete if rename failed: previous version may exist */
X unlink(s);
X }
X#else /* !VMS */
X }
X unlink(s);
X#endif /* !VMS */
X return ZE_OK;
X}
X
X
Xint getfileattr(f)
Xchar *f; /* file path */
X/* Return the file attributes for file f or 0 if failure */
X{
X struct stat s;
X
X return SSTAT(f, &s) == 0 ? s.st_mode : 0;
X}
X
X
Xint setfileattr(f, a)
Xchar *f; /* file path */
Xint a; /* attributes returned by getfileattr() */
X/* Give the file f the attributes a, return non-zero on failure */
X{
X#if defined (VMS) || defined(MACOS)
X return 0;
X#else /* !VMS */
X return chmod(f, a);


X#endif /* ?VMS */
X}
X

X
X#ifdef NO_MKTEMP
X
Xchar *tempname(zip)
X char *zip; /* path name of zip file to generate temp name for */
X
X/* Return a temporary file name in its own malloc'ed space.
X * This function might accidentally destroy an existing file
X * with extension .$z$ . Use mktemp below if you have it on your system.
X */
X{
X char *p; /* temporary pointer */
X char *t; /* malloc'ed space for name */
X
X if ((t = malloc(strlen(zip)+5)) == NULL)
X return NULL;
X strcpy(t, zip);
X if ((p = strrchr(t, '.')) != NULL &&
X (!strncmp(p, ".zip", 4) || !strncmp(p, ".ZIP", 4)))
X /* strncmp to avoid problems with VMS ';' */
X strcpy(p, ".$z$");
X else
X strcat(t, ".$z$");
X
X return t;
X}
X#else /* !NO_MKTEMP */
X
Xchar *tempname(zip)
X char *zip; /* path name of zip file to generate temp name for */
X
X/* Return a temporary file name in its own malloc'ed space, using tempath. */
X{
X char *t = zip; /* malloc'ed space for name (use zip to avoid warning) */
X
X if (tempath != NULL)
X {
X if ((t = malloc(strlen(tempath)+10)) == NULL)
X return NULL;
X strcpy(t, tempath);
X#ifndef VMS
X if (t[strlen(t)-1] != '/')
X strcat(t, "/");
X#endif
X }
X else
X {
X if ((t = malloc(9)) == NULL)
X return NULL;
X *t = 0;
X }
X strcat(t, "_ZXXXXXX");
X return mktemp(t);
X}
X
X#endif /* NO_MKTEMP */
X
X
Xint fcopy(f, g, n)
XFILE *f, *g; /* source and destination files */
Xulg n; /* number of bytes to copy or -1 for all */
X/* Copy n bytes from file *f to file *g, or until EOF if n == -1. Return
X an error code in the ZE_ class. */
X{
X char *b; /* malloc'ed buffer for copying */
X extent k; /* result of fread() */
X ulg m; /* bytes copied so far */
X
X if ((b = malloc(CBSZ)) == NULL)
X return ZE_MEM;
X m = 0;
X while (n == -1L || m < n)
X {
X if ((k = fread(b, 1, n == -1 ?
X CBSZ : (n - m < CBSZ ? (extent)(n - m) : CBSZ), f)) == 0)
X if (ferror(f))
X {
X free((voidp *)b);
X return ZE_READ;
X }
X else
X break;
X if (fwrite(b, 1, k, g) != k)
X {
X free((voidp *)b);
X fprintf(stderr," fcopy: write error\n");
X return ZE_TEMP;
X }
X m += k;
X }
X free((voidp *)b);
X return ZE_OK;
X}
X
X
X#ifdef CRYPT
X
X#ifndef MSDOS
X
X#ifdef VMS
X
Xint echo(opt)
X int opt;
X{
X/*---------------------------------------------------------------------------
X Based on VMSmunch.c, which in turn was based on Joe Meadows' file.c code.
X ---------------------------------------------------------------------------
X * For VMS v5.x:
X * IO$_SENSEMODE/SETMODE info: Programming, Vol. 7A, System Programming,
X * I/O User's: Part I, sec. 8.4.1.1, 8.4.3, 8.4.5, 8.6
X * sys$assign(), sys$qio() info: Programming, Vol. 4B, System Services,
X * System Services Reference Manual, pp. sys-23, sys-379
X * fixed-length descriptor info: Programming, Vol. 3, System Services,
X * Intro to System Routines, sec. 2.9.2
X * GRR, 15 Aug 91
X ---------------------------------------------------------------------------*/
X static struct dsc$descriptor_s DevDesc =
X {9, DSC$K_DTYPE_T, DSC$K_CLASS_S, "SYS$INPUT"};
X /* {dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer}; */
X static short DevChan, iosb[4];
X static long i, status;
X static unsigned long oldmode[2], newmode[2]; /* each = 8 bytes */
X
X
X/*---------------------------------------------------------------------------
X Assign a channel to standard input.
X ---------------------------------------------------------------------------*/
X
X status = sys$assign(&DevDesc, &DevChan, 0, 0);
X if (!(status & 1))
X return status;
X
X/*---------------------------------------------------------------------------
X Use sys$qio and the IO$_SENSEMODE function to determine the current tty
X status (for password reading, could use IO$_READVBLK function instead,
X but echo on/off will be more general).
X ---------------------------------------------------------------------------*/
X
X status = sys$qio(0, DevChan, IO$_SENSEMODE, &iosb, 0, 0,
X oldmode, 8, 0, 0, 0, 0);
X if (!(status & 1))
X return status;
X status = iosb[0];
X if (!(status & 1))
X return status;
X
X/*---------------------------------------------------------------------------
X Copy old mode into new-mode buffer, then modify to be either NOECHO or
X ECHO (depending on function argument opt).
X ---------------------------------------------------------------------------*/
X
X newmode[0] = oldmode[0];
X newmode[1] = oldmode[1];
X if (opt == 0)
X newmode[1] |= TT$M_NOECHO; /* set NOECHO bit */
X else
X newmode[1] &= ~((unsigned long) TT$M_NOECHO); /* clear NOECHO bit */
X
X/*---------------------------------------------------------------------------
X Use the IO$_SETMODE function to change the tty status.
X ---------------------------------------------------------------------------*/
X
X status = sys$qio(0, DevChan, IO$_SETMODE, &iosb, 0, 0,
X newmode, 8, 0, 0, 0, 0);
X if (!(status & 1))
X return status;
X status = iosb[0];
X if (!(status & 1))
X return status;
X
X/*---------------------------------------------------------------------------
X Deassign the sys$input channel by way of clean-up, then exit happily.
X ---------------------------------------------------------------------------*/
X
X status = sys$dassgn(DevChan);
X if (!(status & 1))
X return status;
X
X return SS$_NORMAL; /* we be happy */
X
X} /* end function echo() */
X
X
X#else /* !VMS */
X
Xlocal int echofd = -1; /* file descriptor whose echo is off */
X
Xvoid echoff(f)
Xint f; /* file descriptor to turn echo off on */
X/* Turn echo off for file descriptor f. Assumes that f is a tty device. */
X{
X struct sgttyb sg; /* tty device structure */
X
X echofd = f;
X GTTY(f, &sg); /* get settings */
X sg.sg_flags &= ~ECHO; /* turn echo off */
X STTY(f, &sg);
X}
X
Xvoid echon()
X/* Turn echo back on for file descriptor echofd. */
X{
X struct sgttyb sg; /* tty device structure */
X
X if (echofd != -1)
X {
X GTTY(echofd, &sg); /* get settings */
X sg.sg_flags |= ECHO; /* turn echo on */
X STTY(echofd, &sg);
X echofd = -1;
X }
X}
X


X#endif /* ?VMS */
X

X#endif /* !MSDOS */
X
X
Xchar *getp(m, p, n)
Xchar *m; /* prompt for password */
Xchar *p; /* return value: line input */
Xint n; /* bytes available in p[] */
X/* Get a password of length n-1 or less into *p using the prompt *m.
X The entered password is not echoed. Return p on success, NULL on
X failure (can't get controlling tty). */
X{
X char c; /* one-byte buffer for read() to use */
X int i; /* number of characters input */
X char *w; /* warning on retry */
X
X#ifndef MSDOS
X#ifndef VMS
X int f; /* file decsriptor for tty device */
X
X /* Turn off echo on tty */
X if (!isatty(2))
X return NULL; /* error if not tty */
X if ((f = open(ttyname(2), 0, 0)) == -1)
X return NULL;
X#endif /* !VMS */
X echoff(f); /* turn echo off */
X#endif /* !MSDOS */
X
X /* Get password */
X w = "";
X do {
X#ifdef VMS /* bug: VMS adds '\n' to NULL fputs (apparently) */
X if (*w)
X#endif /* VMS */
X fputs(w, stderr); /* warning if back again */
X fputs(m, stderr); /* prompt */
X fflush(stderr);
X i = 0;
X do { /* read line, keeping n */
X#ifdef MSVMS
X if ((c = (char)getch()) == '\r')
X c = '\n';
X#else /* !MSVMS */
X read(f, &c, 1);
X#endif /* ?MSVMS */
X if (i < n)
X p[i++] = c;
X } while (c != '\n');
X putc('\n', stderr); fflush(stderr);
X w = "(line too long--try again)\n";
X } while (p[i-1] != '\n');
X p[i-1] = 0; /* terminate at newline */
X
X#ifndef MSDOS
X echon(); /* turn echo back on */
X#ifndef VMS
X close(f);
X#endif /* !VMS */
X#endif /* !MSDOS */
X
X /* Return pointer to password */
X return p;
X}
X
X#endif /* ?CRYPT */
X
X
X#ifdef ZMEM
X
X/************************/
X/* Function memset() */
X/************************/
X
X/*
X * memset - for systems without it
X * bill davidsen - March 1990
X */
X
Xchar *
Xmemset(buf, init, len)
Xregister char *buf; /* buffer loc */
Xregister int init; /* initializer */
Xregister unsigned int len; /* length of the buffer */
X{
X char *start;
X
X start = buf;
X while (len--) *(buf++) = init;
X return(start);
X}
X
X
X/************************/
X/* Function memcpy() */
X/************************/
X
Xchar *
Xmemcpy(dst,src,len) /* v2.0f */
Xregister char *dst, *src;
Xregister unsigned int len;
X{
X char *start;
X
X start = dst;
X while (len--)
X *dst++ = *src++;
X return(start);
X}
X
X
X/************************/
X/* Function memcmp() */
X/************************/
X
Xint
Xmemcmp(b1,b2,len) /* j...@usl.edu -- 11/16/90 */
Xregister char *b1, *b2;
Xregister unsigned int len;
X{
X
X if (len) do { /* examine each byte (if any) */
X if (*b1++ != *b2++)
X return (*((uch *)b1-1) - *((uch *)b2-1)); /* exit when miscompare */
X } while (--len);
X
X return(0); /* no miscompares, yield 0 result */
X}
X
X#endif /* ZMEM */
X
X#ifdef __TURBOC__
X
X/************************/
X/* Function fcalloc() */
X/************************/
X
X/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
X * and farmalloc(64K) returns a pointer with an offset of 8, so we
X * must fix the pointer. Warning: the pointer must be put back to its
X * original form in order to free it.
X * For MSC, use halloc instead of this function (see tailor.h).
X */
Xvoid far * fcalloc(items, size)
X unsigned items; /* number of items */
X unsigned size; /* item size */
X{
X void far * buf = farmalloc((ulg)items*size + 16L);
X /* Normalize the pointer to seg:0 */
X *((int*)&buf+1) += ((unsigned)((uch*)buf-0) + 15) >> 4;
X *(int*)&buf = 0;
X return buf; /* buf stays NULL if alloc failed */
X}
X
X#endif /* __TURBOC__ */
END_OF_FILE
if test 57097 -ne `wc -c <'fileio.c'`; then
echo shar: \"'fileio.c'\" unpacked with wrong size!
fi
# end of 'fileio.c'
fi
echo shar: End of archive 2 \(of 11\).
cp /dev/null ark2isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:45:51 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 95
Archive-name: zip19/part03

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: trees.c util.c vms/makefile.vms
# Wrapped by kent@sparky on Sun Aug 23 01:00:43 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 3 (of 11)."'
if test -f 'trees.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'trees.c'\"
else
echo shar: Extracting \"'trees.c'\" \(40777 characters\)
sed "s/^X//" >'trees.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * trees.c by Jean-loup Gailly
X *
X * This is a new version of im_ctree.c originally written by Richard B. Wales
X * for the defunct implosion method.
X *
X * PURPOSE
X *
X * Encode various sets of source values using variable-length
X * binary code trees.
X *
X * DISCUSSION
X *
X * The PKZIP "deflation" process uses several Huffman trees. The more
X * common source values are represented by shorter bit sequences.
X *
X * Each code tree is stored in the ZIP file in a compressed form
X * which is itself a Huffman encoding of the lengths of
X * all the code strings (in ascending order by source values).
X * The actual code strings are reconstructed from the lengths in
X * the UNZIP process, as described in the "application note"
X * (APPNOTE.TXT) distributed as part of PKWARE's PKZIP program.
X *
X * REFERENCES
X *
X * Lynch, Thomas J.
X * Data Compression: Techniques and Applications, pp. 53-55.
X * Lifetime Learning Publications, 1985. ISBN 0-534-03418-7.
X *
X * Storer, James A.
X * Data Compression: Methods and Theory, pp. 49-50.
X * Computer Science Press, 1988. ISBN 0-7167-8156-5.
X *
X * Sedgewick, R.
X * Algorithms, p290.
X * Addison-Wesley, 1983. ISBN 0-201-06672-6.
X *
X * INTERFACE
X *
X * void ct_init (ush *attr, int *method)
X * Allocate the match buffer, initialize the various tables and save
X * the location of the internal file attribute (ascii/binary) and
X * method (DEFLATE/STORE)
X *
X * void ct_tally (int dist, int lc);
X * Save the match info and tally the frequency counts.
X *
X * long flush_block (char *buf, ulg stored_len, int eof)
X * Determine the best encoding for the current block: dynamic trees,
X * static trees or store, and output the encoded block to the zip
X * file. Returns the total compressed length for the file so far.
X *
X */
X
X#include <ctype.h>
X#include "zip.h"
X
X/* ===========================================================================
X * Constants
X */
X
X#define MAX_BITS 15
X/* All codes must not exceed MAX_BITS bits */
X
X#define MAX_BL_BITS 7
X/* Bit length codes must not exceed MAX_BL_BITS bits */
X
X#define LENGTH_CODES 29
X/* number of length codes, not counting the special END_BLOCK code */
X
X#define LITERALS 256
X/* number of literal bytes 0..255 */
X
X#define END_BLOCK 256
X/* end of block literal code */
X
X#define L_CODES (LITERALS+1+LENGTH_CODES)
X/* number of Literal or Length codes, including the END_BLOCK code */
X
X#define D_CODES 30
X/* number of distance codes */
X
X#define BL_CODES 19
X/* number of codes used to transfer the bit lengths */
X
X
Xlocal int near extra_lbits[LENGTH_CODES] /* extra bits for each length code */
X = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
X
Xlocal int near extra_dbits[D_CODES] /* extra bits for each distance code */
X = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
X
Xlocal int near extra_blbits[BL_CODES]/* extra bits for each bit length code */
X = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
X
X#define STORED_BLOCK 0
X#define STATIC_TREES 1
X#define DYN_TREES 2
X/* The three kinds of block type */
X
X#ifndef LIT_BUFSIZE
X# ifdef SMALL_MEM
X# define LIT_BUFSIZE 0x2000
X# else
X# ifdef MEDIUM_MEM
X# define LIT_BUFSIZE 0x4000
X# else
X# define LIT_BUFSIZE 0x8000


X# endif
X# endif
X#endif

X#define DIST_BUFSIZE LIT_BUFSIZE
X/* Sizes of match buffers for literals/lengths and distances. There are
X * 4 reasons for limiting LIT_BUFSIZE to 64K:
X * - frequencies can be kept in 16 bit counters
X * - if compression is not successful for the first block, all input data is
X * still in the window so we can still emit a stored block even when input
X * comes from standard input. (This can also be done for all blocks if
X * LIT_BUFSIZE is not greater than 32K.)
X * - if compression is not successful for a file smaller than 64K, we can
X * even emit a stored file instead of a stored block (saving 5 bytes).
X * - creating new Huffman trees less frequently may not provide fast
X * adaptation to changes in the input data statistics. (Take for
X * example a binary file with poorly compressible code followed by
X * a highly compressible string table.) Smaller buffer sizes give
X * fast adaptation but have of course the overhead of transmitting trees
X * more frequently.
X * - I can't count above 4
X * The current code is general and allows DIST_BUFSIZE < LIT_BUFSIZE (to save
X * memory at the expense of compression). Some optimizations would be possible
X * if we rely on DIST_BUFSIZE == LIT_BUFSIZE.
X */
X
X#define REP_3_6 16
X/* repeat previous bit length 3-6 times (2 bits of repeat count) */
X
X#define REPZ_3_10 17
X/* repeat a zero length 3-10 times (3 bits of repeat count) */
X
X#define REPZ_11_138 18
X/* repeat a zero length 11-138 times (7 bits of repeat count) */
X
X/* ===========================================================================
X * Local data
X */
X
X/* Data structure describing a single value and its code string. */
Xtypedef struct ct_data {
X union {
X ush freq; /* frequency count */
X ush code; /* bit string */
X } fc;
X union {
X ush dad; /* father node in Huffman tree */
X ush len; /* length of bit string */
X } dl;
X} ct_data;
X
X#define Freq fc.freq
X#define Code fc.code
X#define Dad dl.dad
X#define Len dl.len
X
X#define HEAP_SIZE (2*L_CODES+1)
X/* maximum heap size */
X
Xlocal ct_data near dyn_ltree[HEAP_SIZE]; /* literal and length tree */
Xlocal ct_data near dyn_dtree[2*D_CODES+1]; /* distance tree */
X
Xlocal ct_data near static_ltree[L_CODES+2];
X/* The static literal tree. Since the bit lengths are imposed, there is no
X * need for the L_CODES extra codes used during heap construction. However
X * The codes 286 and 287 are needed to build a canonical tree (see ct_init
X * below).
X */
X
Xlocal ct_data near static_dtree[D_CODES];
X/* The static distance tree. (Actually a trivial tree since all codes use
X * 5 bits.)
X */
X
Xlocal ct_data near bl_tree[2*BL_CODES+1];
X/* Huffman tree for the bit lengths */
X
Xtypedef struct tree_desc {
X ct_data near *dyn_tree; /* the dynamic tree */
X ct_data near *static_tree; /* corresponding static tree or NULL */
X int near *extra_bits; /* extra bits for each code or NULL */
X int extra_base; /* base index for extra_bits */
X int elems; /* max number of elements in the tree */
X int max_length; /* max bit length for the codes */
X int max_code; /* largest code with non zero frequency */
X} tree_desc;
X
Xlocal tree_desc near l_desc =
X{dyn_ltree, static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS, 0};
X
Xlocal tree_desc near d_desc =
X{dyn_dtree, static_dtree, extra_dbits, 0, D_CODES, MAX_BITS, 0};
X
Xlocal tree_desc near bl_desc =
X{bl_tree, NULL, extra_blbits, 0, BL_CODES, MAX_BL_BITS, 0};
X
X
Xlocal ush near bl_count[MAX_BITS+1];
X/* number of codes at each bit length for an optimal tree */
X
Xlocal uch near bl_order[BL_CODES]
X = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
X/* The lengths of the bit length codes are sent in order of decreasing
X * probability, to avoid transmitting the lengths for unused bit length codes.
X */
X
Xlocal int near heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
Xlocal int heap_len; /* number of elements in the heap */
Xlocal int heap_max; /* element of largest frequency */
X/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
X * The same heap array is used to build all trees.
X */
X
Xlocal uch near depth[2*L_CODES+1];
X/* Depth of each subtree used as tie breaker for trees of equal frequency */
X
Xlocal uch length_code[MAX_MATCH-MIN_MATCH+1];
X/* length code for each normalized match length (0 == MIN_MATCH) */
X
Xlocal uch dist_code[512];
X/* distance codes. The first 256 values correspond to the distances
X * 3 .. 258, the last 256 values correspond to the top 8 bits of
X * the 15 bit distances.
X */
X
Xlocal int near base_length[LENGTH_CODES];
X/* First normalized length for each code (0 = MIN_MATCH) */
X
Xlocal int near base_dist[D_CODES];
X/* First normalized distance for each code (0 = distance of 1) */
X
X#ifndef DYN_ALLOC
X local uch far l_buf[LIT_BUFSIZE]; /* buffer for literals/lengths */
X local ush far d_buf[DIST_BUFSIZE]; /* buffer for distances */
X#else
X local uch far *l_buf;
X local ush far *d_buf;
X#endif
X
Xlocal uch near flag_buf[(LIT_BUFSIZE/8)];
X/* flag_buf is a bit array distinguishing literals from lengths in
X * l_buf, and thus indicating the presence or absence of a distance.
X */
X
Xlocal unsigned last_lit; /* running index in l_buf */
Xlocal unsigned last_dist; /* running index in d_buf */
Xlocal unsigned last_flags; /* running index in flag_buf */
Xlocal uch flags; /* current flags not yet saved in flag_buf */
Xlocal uch flag_bit; /* current bit used in flags */
X/* bits are filled in flags starting at bit 0 (least significant).
X * Note: these flags are overkill in the current code since we don't
X * take advantage of DIST_BUFSIZE == LIT_BUFSIZE.
X */
X
Xlocal ulg opt_len; /* bit length of current block with optimal trees */
Xlocal ulg static_len; /* bit length of current block with static trees */
X
Xlocal ulg compressed_len; /* total bit length of compressed file */
X
Xlocal ulg input_len; /* total byte length of input file */
X/* input_len is for debugging only since we can get it by other means. */
X
Xush *file_type; /* pointer to UNKNOWN, BINARY or ASCII */
Xint *file_method; /* pointer to DEFLATE or STORE */
X
X#ifdef DEBUG
Xextern ulg bits_sent; /* bit length of the compressed data */
Xextern ulg isize; /* byte length of input file */
X#endif
X
Xextern long block_start; /* window offset of current block */
Xextern unsigned near strstart; /* window offset of current string */
X
X/* ===========================================================================
X * Local (static) routines in this file.
X */
X
Xlocal void init_block OF((void));
Xlocal void pqdownheap OF((ct_data near *tree, int k));
Xlocal void gen_bitlen OF((tree_desc near *desc));
Xlocal void gen_codes OF((ct_data near *tree, int max_code));
Xlocal void build_tree OF((tree_desc near *desc));
Xlocal void scan_tree OF((ct_data near *tree, int max_code));
Xlocal void send_tree OF((ct_data near *tree, int max_code));
Xlocal int build_bl_tree OF((void));
Xlocal void send_all_trees OF((int lcodes, int dcodes, int blcodes));
Xlocal void compress_block OF((ct_data near *ltree, ct_data near *dtree));
Xlocal void set_file_type OF((void));
X
X
X#ifndef DEBUG
X# define send_code(c, tree) send_bits(tree[c].Code, tree[c].Len)
X /* Send a code of the given tree. c and tree must not have side effects */
X
X#else /* DEBUG */
X# define send_code(c, tree) \
X { if (verbose>1) fprintf(stderr,"\ncd %3d ",(c)); \
X send_bits(tree[c].Code, tree[c].Len); }
X#endif
X
X#define d_code(dist) \
X ((dist) < 256 ? dist_code[dist] : dist_code[256+((dist)>>7)])
X/* Mapping from a distance to a distance code. dist is the distance - 1 and
X * must not have side effects. dist_code[256] and dist_code[257] are never
X * used.
X */
X
X#define MAX(a,b) (a >= b ? a : b)
X/* the arguments must not have side effects */
X
X/* ===========================================================================
X * Allocate the match buffer, initialize the various tables and save the
X * location of the internal file attribute (ascii/binary) and method
X * (DEFLATE/STORE).
X */
Xvoid ct_init(attr, method)
X ush *attr; /* pointer to internal file attribute */
X int *method; /* pointer to compression method */
X{
X int n; /* iterates over tree elements */
X int bits; /* bit counter */
X int length; /* length value */
X int code; /* code value */
X int dist; /* distance index */
X
X file_type = attr;
X file_method = method;
X compressed_len = input_len = 0L;
X
X if (static_dtree[0].Len != 0) return; /* ct_init already called */
X
X#ifdef DYN_ALLOC
X d_buf = (ush far*) fcalloc(DIST_BUFSIZE, sizeof(ush));
X l_buf = (uch far*) fcalloc(LIT_BUFSIZE/2, 2);
X /* Avoid using the value 64K on 16 bit machines */
X if (l_buf == NULL || d_buf == NULL) error("ct_init: out of memory");
X#endif
X
X /* Initialize the mapping length (0..255) -> length code (0..28) */
X length = 0;
X for (code = 0; code < LENGTH_CODES-1; code++) {
X base_length[code] = length;
X for (n = 0; n < (1<<extra_lbits[code]); n++) {
X length_code[length++] = (uch)code;
X }
X }
X Assert (length == 256, "ct_init: length != 256");
X /* Note that the length 255 (match length 258) can be represented
X * in two different ways: code 284 + 5 bits or code 285, so we
X * overwrite length_code[255] to use the best encoding:
X */
X length_code[length-1] = (uch)code;
X
X /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
X dist = 0;
X for (code = 0 ; code < 16; code++) {
X base_dist[code] = dist;
X for (n = 0; n < (1<<extra_dbits[code]); n++) {
X dist_code[dist++] = (uch)code;
X }
X }
X Assert (dist == 256, "ct_init: dist != 256");
X dist >>= 7; /* from now on, all distances are divided by 128 */
X for ( ; code < D_CODES; code++) {
X base_dist[code] = dist << 7;
X for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
X dist_code[256 + dist++] = (uch)code;
X }
X }
X Assert (dist == 256, "ct_init: 256+dist != 512");
X
X /* Construct the codes of the static literal tree */
X for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
X n = 0;
X while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
X while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
X while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
X while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
X /* Codes 286 and 287 do not exist, but we must include them in the
X * tree construction to get a canonical Huffman tree (longest code
X * all ones)
X */
X gen_codes(static_ltree, L_CODES+1);
X
X /* The static distance tree is trivial: */
X for (n = 0; n < D_CODES; n++) {
X static_dtree[n].Len = 5;
X static_dtree[n].Code = bi_reverse(n, 5);
X }
X
X /* Initialize the first block of the first file: */
X init_block();
X}
X
X/* ===========================================================================
X * Initialize a new block.
X */
Xlocal void init_block()
X{
X int n; /* iterates over tree elements */
X
X /* Initialize the trees. */
X for (n = 0; n < L_CODES; n++) dyn_ltree[n].Freq = 0;
X for (n = 0; n < D_CODES; n++) dyn_dtree[n].Freq = 0;
X for (n = 0; n < BL_CODES; n++) bl_tree[n].Freq = 0;
X
X dyn_ltree[END_BLOCK].Freq = 1;
X opt_len = static_len = 0L;
X last_lit = last_dist = last_flags = 0;
X flags = 0; flag_bit = 1;
X}
X
X#define SMALLEST 1
X/* Index within the heap array of least frequent node in the Huffman tree */
X
X
X/* ===========================================================================
X * Remove the smallest element from the heap and recreate the heap with
X * one less element. Updates heap and heap_len.
X */
X#define pqremove(tree, top) \
X{\
X top = heap[SMALLEST]; \
X heap[SMALLEST] = heap[heap_len--]; \
X pqdownheap(tree, SMALLEST); \
X}
X
X/* ===========================================================================
X * Compares to subtrees, using the tree depth as tie breaker when
X * the subtrees have equal frequency. This minimizes the worst case length.
X */
X#define smaller(tree, n, m) \
X (tree[n].Freq < tree[m].Freq || \
X (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
X
X/* ===========================================================================
X * Restore the heap property by moving down the tree starting at node k,
X * exchanging a node with the smallest of its two sons if necessary, stopping
X * when the heap property is re-established (each father smaller than its
X * two sons).
X */
Xlocal void pqdownheap(tree, k)
X ct_data near *tree; /* the tree to restore */
X int k; /* node to move down */
X{
X int v = heap[k];
X int j = k << 1; /* left son of k */
X while (j <= heap_len) {
X /* Set j to the smallest of the two sons: */
X if (j < heap_len && smaller(tree, heap[j+1], heap[j])) j++;
X
X /* Exit if v is smaller than both sons */
X if (smaller(tree, v, heap[j])) break;
X
X /* Exchange v with the smallest son */
X heap[k] = heap[j], k = j;
X
X /* And continue down the tree, setting j to the left son of k */
X j <<= 1;
X }
X heap[k] = v;
X}
X
X/* ===========================================================================
X * Compute the optimal bit lengths for a tree and update the total bit length
X * for the current block.
X * IN assertion: the fields freq and dad are set, heap[heap_max] and
X * above are the tree nodes sorted by increasing frequency.
X * OUT assertions: the field len is set to the optimal bit length, the
X * array bl_count contains the frequencies for each bit length.
X * The length opt_len is updated; static_len is also updated if stree is
X * not null.
X */
Xlocal void gen_bitlen(desc)
X tree_desc near *desc; /* the tree descriptor */
X{
X ct_data near *tree = desc->dyn_tree;
X int near *extra = desc->extra_bits;
X int base = desc->extra_base;
X int max_code = desc->max_code;
X int max_length = desc->max_length;
X ct_data near *stree = desc->static_tree;
X int h; /* heap index */
X int n, m; /* iterate over the tree elements */
X int bits; /* bit length */
X int xbits; /* extra bits */
X ush f; /* frequency */
X int overflow = 0; /* number of elements with bit length too large */
X
X for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
X
X /* In a first pass, compute the optimal bit lengths (which may
X * overflow in the case of the bit length tree).
X */
X tree[heap[heap_max]].Len = 0; /* root of the heap */
X
X for (h = heap_max+1; h < HEAP_SIZE; h++) {
X n = heap[h];
X bits = tree[tree[n].Dad].Len + 1;
X if (bits > max_length) bits = max_length, overflow++;
X tree[n].Len = bits;
X /* We overwrite tree[n].Dad which is no longer needed */
X
X if (n > max_code) continue; /* not a leaf node */
X
X bl_count[bits]++;
X xbits = 0;
X if (n >= base) xbits = extra[n-base];
X f = tree[n].Freq;
X opt_len += (ulg)f * (bits + xbits);
X if (stree) static_len += (ulg)f * (stree[n].Len + xbits);
X }
X if (overflow == 0) return;
X
X Trace((stderr,"\nbit length overflow\n"));
X /* This happens for example on obj2 and pic of the Calgary corpus */
X
X /* Find the first bit length which could increase: */
X do {
X bits = max_length-1;
X while (bl_count[bits] == 0) bits--;
X bl_count[bits]--; /* move one leaf down the tree */
X bl_count[bits+1] += 2; /* move one overflow item as its brother */
X bl_count[max_length]--;
X /* The brother of the overflow item also moves one step up,
X * but this does not affect bl_count[max_length]
X */
X overflow -= 2;
X } while (overflow > 0);
X
X /* Now recompute all bit lengths, scanning in increasing frequency.
X * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
X * lengths instead of fixing only the wrong ones. This idea is taken
X * from 'ar' written by Haruhiko Okumura.)
X */
X for (bits = max_length; bits != 0; bits--) {
X n = bl_count[bits];
X while (n != 0) {
X m = heap[--h];
X if (m > max_code) continue;
X if (tree[m].Len != (unsigned) bits) {
X Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
X opt_len += ((long)bits-(long)tree[m].Len)*(long)tree[m].Freq;
X tree[m].Len = bits;
X }
X n--;
X }
X }
X}
X
X/* ===========================================================================
X * Generate the codes for a given tree and bit counts (which need not be
X * optimal).
X * IN assertion: the array bl_count contains the bit length statistics for
X * the given tree and the field len is set for all tree elements.
X * OUT assertion: the field code is set for all tree elements of non
X * zero code length.
X */
Xlocal void gen_codes (tree, max_code)
X ct_data near *tree; /* the tree to decorate */
X int max_code; /* largest code with non zero frequency */
X{
X ush next_code[MAX_BITS+1]; /* next code value for each bit length */
X ush code = 0; /* running code value */
X int bits; /* bit index */
X int n; /* code index */
X
X /* The distribution counts are first used to generate the code values
X * without bit reversal.
X */
X for (bits = 1; bits <= MAX_BITS; bits++) {
X next_code[bits] = code = (code + bl_count[bits-1]) << 1;
X }
X /* Check that the bit counts in bl_count are consistent. The last code
X * must be all ones.
X */
X Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
X "inconsistent bit counts");
X Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
X
X for (n = 0; n <= max_code; n++) {
X int len = tree[n].Len;
X if (len == 0) continue;
X /* Now reverse the bits */
X tree[n].Code = bi_reverse(next_code[len]++, len);
X
X Tracec(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
X n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
X }
X}
X
X/* ===========================================================================
X * Construct one Huffman tree and assigns the code bit strings and lengths.
X * Update the total bit length for the current block.
X * IN assertion: the field freq is set for all tree elements.
X * OUT assertions: the fields len and code are set to the optimal bit length
X * and corresponding code. The length opt_len is updated; static_len is
X * also updated if stree is not null. The field max_code is set.
X */
Xlocal void build_tree(desc)
X tree_desc near *desc; /* the tree descriptor */
X{
X ct_data near *tree = desc->dyn_tree;
X ct_data near *stree = desc->static_tree;
X int elems = desc->elems;
X int n, m; /* iterate over heap elements */
X int max_code = -1; /* largest code with non zero frequency */
X int node = elems; /* next internal node of the tree */
X
X /* Construct the initial heap, with least frequent element in
X * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
X * heap[0] is not used.
X */
X heap_len = 0, heap_max = HEAP_SIZE;
X
X for (n = 0; n < elems; n++) {
X if (tree[n].Freq != 0) {
X heap[++heap_len] = max_code = n;
X depth[n] = 0;
X } else {
X tree[n].Len = 0;
X }
X }
X
X /* The pkzip format requires that at least one distance code exists,
X * and that at least one bit should be sent even if there is only one
X * possible code. So to avoid special checks later on we force at least
X * two codes of non zero frequency.
X */
X while (heap_len < 2) {
X int new = heap[++heap_len] = (max_code < 2 ? ++max_code : 0);
X tree[new].Freq = 1;
X depth[new] = 0;
X opt_len--; if (stree) static_len -= stree[new].Len;
X /* new is 0 or 1 so it does not have extra bits */
X }
X desc->max_code = max_code;
X
X /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
X * establish sub-heaps of increasing lengths:
X */
X for (n = heap_len/2; n >= 1; n--) pqdownheap(tree, n);
X
X /* Construct the Huffman tree by repeatedly combining the least two
X * frequent nodes.
X */
X do {
X pqremove(tree, n); /* n = node of least frequency */
X m = heap[SMALLEST]; /* m = node of next least frequency */
X
X heap[--heap_max] = n; /* keep the nodes sorted by frequency */
X heap[--heap_max] = m;
X
X /* Create a new node father of n and m */
X tree[node].Freq = tree[n].Freq + tree[m].Freq;
X depth[node] = (uch) (MAX(depth[n], depth[m]) + 1);
X tree[n].Dad = tree[m].Dad = node;
X#ifdef DUMP_BL_TREE
X if (tree == bl_tree) {
X fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
X node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
X }
X#endif
X /* and insert the new node in the heap */
X heap[SMALLEST] = node++;
X pqdownheap(tree, SMALLEST);
X
X } while (heap_len >= 2);
X
X heap[--heap_max] = heap[SMALLEST];
X
X /* At this point, the fields freq and dad are set. We can now
X * generate the bit lengths.
X */
X gen_bitlen(desc);
X
X /* The field len is now set, we can generate the bit codes */
X gen_codes (tree, max_code);
X}
X
X/* ===========================================================================
X * Scan a literal or distance tree to determine the frequencies of the codes
X * in the bit length tree. Updates opt_len to take into account the repeat
X * counts. (The contribution of the bit length codes will be added later
X * during the construction of bl_tree.)
X */
Xlocal void scan_tree (tree, max_code)
X ct_data near *tree; /* the tree to be scanned */
X int max_code; /* and its largest code of non zero frequency */
X{
X int n; /* iterates over all tree elements */
X int prevlen = -1; /* last emitted length */
X int curlen; /* length of current code */
X int nextlen = tree[0].Len; /* length of next code */
X int count = 0; /* repeat count of the current code */
X int max_count = 7; /* max repeat count */
X int min_count = 4; /* min repeat count */
X
X if (nextlen == 0) max_count = 138, min_count = 3;
X tree[max_code+1].Len = (ush)-1; /* guard */
X
X for (n = 0; n <= max_code; n++) {
X curlen = nextlen; nextlen = tree[n+1].Len;
X if (++count < max_count && curlen == nextlen) {
X continue;
X } else if (count < min_count) {
X bl_tree[curlen].Freq += count;
X } else if (curlen != 0) {
X if (curlen != prevlen) bl_tree[curlen].Freq++;
X bl_tree[REP_3_6].Freq++;
X } else if (count <= 10) {
X bl_tree[REPZ_3_10].Freq++;
X } else {
X bl_tree[REPZ_11_138].Freq++;
X }
X count = 0; prevlen = curlen;
X if (nextlen == 0) {
X max_count = 138, min_count = 3;
X } else if (curlen == nextlen) {
X max_count = 6, min_count = 3;
X } else {
X max_count = 7, min_count = 4;
X }
X }
X}
X
X/* ===========================================================================
X * Send a literal or distance tree in compressed form, using the codes in
X * bl_tree.
X */
Xlocal void send_tree (tree, max_code)
X ct_data near *tree; /* the tree to be scanned */
X int max_code; /* and its largest code of non zero frequency */
X{
X int n; /* iterates over all tree elements */
X int prevlen = -1; /* last emitted length */
X int curlen; /* length of current code */
X int nextlen = tree[0].Len; /* length of next code */
X int count = 0; /* repeat count of the current code */
X int max_count = 7; /* max repeat count */
X int min_count = 4; /* min repeat count */
X
X /* tree[max_code+1].Len = -1; */ /* guard already set */
X if (nextlen == 0) max_count = 138, min_count = 3;
X
X for (n = 0; n <= max_code; n++) {
X curlen = nextlen; nextlen = tree[n+1].Len;
X if (++count < max_count && curlen == nextlen) {
X continue;
X } else if (count < min_count) {
X do { send_code(curlen, bl_tree); } while (--count != 0);
X
X } else if (curlen != 0) {
X if (curlen != prevlen) {
X send_code(curlen, bl_tree); count--;
X }
X Assert(count >= 3 && count <= 6, " 3_6?");
X send_code(REP_3_6, bl_tree); send_bits(count-3, 2);
X
X } else if (count <= 10) {
X send_code(REPZ_3_10, bl_tree); send_bits(count-3, 3);
X
X } else {
X send_code(REPZ_11_138, bl_tree); send_bits(count-11, 7);
X }
X count = 0; prevlen = curlen;
X if (nextlen == 0) {
X max_count = 138, min_count = 3;
X } else if (curlen == nextlen) {
X max_count = 6, min_count = 3;
X } else {
X max_count = 7, min_count = 4;
X }
X }
X}
X
X/* ===========================================================================
X * Construct the Huffman tree for the bit lengths and return the index in
X * bl_order of the last bit length code to send.
X */
Xlocal int build_bl_tree()
X{
X int max_blindex; /* index of last bit length code of non zero freq */
X
X /* Determine the bit length frequencies for literal and distance trees */
X scan_tree(dyn_ltree, l_desc.max_code);
X scan_tree(dyn_dtree, d_desc.max_code);
X
X /* Build the bit length tree: */
X build_tree(&bl_desc);
X /* opt_len now includes the length of the tree representations, except
X * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
X */
X
X /* Determine the number of bit length codes to send. The pkzip format
X * requires that at least 4 bit length codes be sent. (appnote.txt says
X * 3 but the actual value used is 4.)
X */
X for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
X if (bl_tree[bl_order[max_blindex]].Len != 0) break;
X }
X /* Update opt_len to include the bit length tree and counts */
X opt_len += 3*(max_blindex+1) + 5+5+4;
X Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", opt_len, static_len));
X
X return max_blindex;
X}
X
X/* ===========================================================================
X * Send the header for a block using dynamic Huffman trees: the counts, the
X * lengths of the bit length codes, the literal tree and the distance tree.
X * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
X */
Xlocal void send_all_trees(lcodes, dcodes, blcodes)
X int lcodes, dcodes, blcodes; /* number of codes for each tree */
X{
X int rank; /* index in bl_order */
X
X Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
X Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
X "too many codes");
X Tracev((stderr, "\nbl counts: "));
X send_bits(lcodes-257, 5); /* not -255 as stated in appnote.txt */
X send_bits(dcodes-1, 5);
X send_bits(blcodes-4, 4); /* not -3 as stated in appnote.txt */
X for (rank = 0; rank < blcodes; rank++) {
X Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
X send_bits(bl_tree[bl_order[rank]].Len, 3);
X }
X Tracev((stderr, "\nbl tree: sent %ld", bits_sent));
X
X send_tree(dyn_ltree, lcodes-1); /* send the literal tree */
X Tracev((stderr, "\nlit tree: sent %ld", bits_sent));
X
X send_tree(dyn_dtree, dcodes-1); /* send the distance tree */
X Tracev((stderr, "\ndist tree: sent %ld", bits_sent));
X}
X
X/* ===========================================================================
X * Determine the best encoding for the current block: dynamic trees, static
X * trees or store, and output the encoded block to the zip file. This function
X * returns the total compressed length for the file so far.
X */
Xulg flush_block(buf, stored_len, eof)
X char *buf; /* input block, or NULL if too old */
X ulg stored_len; /* length of input block */
X int eof; /* true if this is the last block for a file */
X{
X ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
X int max_blindex; /* index of last bit length code of non zero freq */
X
X flag_buf[last_flags] = flags; /* Save the flags for the last 8 items */
X
X /* Check if the file is ascii or binary */
X if (*file_type == (ush)UNKNOWN) set_file_type();
X
X /* Construct the literal and distance trees */
X build_tree(&l_desc);
X Tracev((stderr, "\nlit data: dyn %ld, stat %ld", opt_len, static_len));
X
X build_tree(&d_desc);
X Tracev((stderr, "\ndist data: dyn %ld, stat %ld", opt_len, static_len));
X /* At this point, opt_len and static_len are the total bit lengths of
X * the compressed block data, excluding the tree representations.
X */
X
X /* Build the bit length tree for the above two trees, and get the index
X * in bl_order of the last bit length code to send.
X */
X max_blindex = build_bl_tree();
X
X /* Determine the best encoding. Compute first the block length in bytes */
X opt_lenb = (opt_len+3+7)>>3;
X static_lenb = (static_len+3+7)>>3;
X input_len += stored_len; /* for debugging only */
X
X Trace((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
X opt_lenb, opt_len, static_lenb, static_len, stored_len,
X last_lit, last_dist));
X
X if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
X
X /* If compression failed and this is the first and last block,
X * and if the zip file can be seeked (to rewrite the local header),
X * the whole file is transformed into a stored file:
X */
X#ifdef FORCE_METHOD
X if (level == 1 && eof && compressed_len == 0L) { /* force stored file */
X#else
X if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
X#endif
X /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
X if (buf == NULL) error ("block vanished");
X
X copy_block(buf, (unsigned)stored_len, 0); /* without header */
X compressed_len = stored_len << 3;
X *file_method = STORE;
X
X#ifdef FORCE_METHOD
X } else if (level == 2 && buf != NULL) { /* force stored block */
X#else
X } else if (stored_len+4 <= opt_lenb && buf != NULL) {
X /* 4: two words for the lengths */
X#endif
X /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
X * Otherwise we can't have processed more than WSIZE input bytes since
X * the last block flush, because compression would have been
X * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
X * transform a block into a stored block.
X */
X send_bits((STORED_BLOCK<<1)+eof, 3); /* send block type */
X compressed_len = (compressed_len + 3 + 7) & ~7L;
X compressed_len += (stored_len + 4) << 3;
X
X copy_block(buf, (unsigned)stored_len, 1); /* with header */
X
X#ifdef FORCE_METHOD
X } else if (level == 3) { /* force static trees */
X#else
X } else if (static_lenb == opt_lenb) {
X#endif
X send_bits((STATIC_TREES<<1)+eof, 3);
X compress_block(static_ltree, static_dtree);
X compressed_len += 3 + static_len;
X } else {
X send_bits((DYN_TREES<<1)+eof, 3);
X send_all_trees(l_desc.max_code+1, d_desc.max_code+1, max_blindex+1);
X compress_block(dyn_ltree, dyn_dtree);
X compressed_len += 3 + opt_len;
X }
X Assert (compressed_len == bits_sent, "bad compressed size");
X init_block();
X
X if (eof) {
X Assert (input_len == isize, "bad input size");
X bi_windup();
X compressed_len += 7; /* align on byte boundary */
X }
X Tracev((stderr,"\ncomprlen %lu(%lu) ", compressed_len>>3,
X compressed_len-7*eof));
X
X return compressed_len >> 3;
X}
X
X/* ===========================================================================
X * Save the match info and tally the frequency counts. Return true if
X * the current block must be flushed.
X */
Xint ct_tally (dist, lc)
X int dist; /* distance of matched string */
X int lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
X{
X l_buf[last_lit++] = (uch)lc;
X if (dist == 0) {
X /* lc is the unmatched char */
X dyn_ltree[lc].Freq++;
X } else {
X /* Here, lc is the match length - MIN_MATCH */
X dist--; /* dist = match distance - 1 */
X Assert((ush)dist < (ush)MAX_DIST &&
X (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
X (ush)d_code(dist) < (ush)D_CODES, "ct_tally: bad match");
X
X dyn_ltree[length_code[lc]+LITERALS+1].Freq++;
X dyn_dtree[d_code(dist)].Freq++;
X
X d_buf[last_dist++] = dist;
X flags |= flag_bit;
X }
X flag_bit <<= 1;
X
X /* Output the flags if they fill a byte: */
X if ((last_lit & 7) == 0) {
X flag_buf[last_flags++] = flags;
X flags = 0, flag_bit = 1;
X }
X /* Try to guess if it is profitable to stop the current block here */
X if (level > 2 && (last_lit & 0xfff) == 0) {
X /* Compute an upper bound for the compressed length */
X ulg out_length = (ulg)last_lit*8L;
X ulg in_length = (ulg)strstart-block_start;
X int dcode;
X for (dcode = 0; dcode < D_CODES; dcode++) {
X out_length += (ulg)dyn_dtree[dcode].Freq*(5L+extra_dbits[dcode]);
X }
X out_length >>= 3;
X Trace((stderr,"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
X last_lit, last_dist, in_length, out_length,
X 100L - out_length*100L/in_length));
X if (last_dist < last_lit/2 && out_length < in_length/2) return 1;
X }
X return (last_lit == LIT_BUFSIZE-1 || last_dist == DIST_BUFSIZE);
X /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K
X * on 16 bit machines and because stored blocks are restricted to
X * 64K-1 bytes.
X */
X}
X
X/* ===========================================================================
X * Send the block data compressed using the given Huffman trees
X */
Xlocal void compress_block(ltree, dtree)
X ct_data near *ltree; /* literal tree */
X ct_data near *dtree; /* distance tree */
X{
X unsigned dist; /* distance of matched string */
X int lc; /* match length or unmatched char (if dist == 0) */
X unsigned lx = 0; /* running index in l_buf */
X unsigned dx = 0; /* running index in d_buf */
X unsigned fx = 0; /* running index in flag_buf */
X uch flag = 0; /* current flags */
X unsigned code; /* the code to send */
X int extra; /* number of extra bits to send */
X
X if (last_lit != 0) do {
X if ((lx & 7) == 0) flag = flag_buf[fx++];
X lc = l_buf[lx++];
X if ((flag & 1) == 0) {
X send_code(lc, ltree); /* send a literal byte */
X Tracecv(isgraph(lc), (stderr," '%c' ", lc));
X } else {
X /* Here, lc is the match length - MIN_MATCH */
X code = length_code[lc];
X send_code(code+LITERALS+1, ltree); /* send the length code */
X extra = extra_lbits[code];
X if (extra != 0) {
X lc -= base_length[code];
X send_bits(lc, extra); /* send the extra length bits */
X }
X dist = d_buf[dx++];
X /* Here, dist is the match distance - 1 */
X code = d_code(dist);
X Assert (code < D_CODES, "bad d_code");
X
X send_code(code, dtree); /* send the distance code */
X extra = extra_dbits[code];
X if (extra != 0) {
X dist -= base_dist[code];
X send_bits(dist, extra); /* send the extra distance bits */
X }
X } /* literal or match pair ? */
X flag >>= 1;
X } while (lx < last_lit);
X
X send_code(END_BLOCK, ltree);
X}
X
X/* ===========================================================================
X * Set the file type to ASCII or BINARY, using a crude approximation:
X * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
X * IN assertion: the fields freq of dyn_ltree are set and the total of all
X * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
X */
Xlocal void set_file_type()
X{
X int n = 0;
X unsigned ascii_freq = 0;
X unsigned bin_freq = 0;
X while (n < 7) bin_freq += dyn_ltree[n++].Freq;
X while (n < 128) ascii_freq += dyn_ltree[n++].Freq;
X while (n < LITERALS) bin_freq += dyn_ltree[n++].Freq;
X *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
X if (*file_type == BINARY && translate_eol) {
X warn("-l used on binary file", "");
X }
X}
END_OF_FILE
if test 40777 -ne `wc -c <'trees.c'`; then
echo shar: \"'trees.c'\" unpacked with wrong size!
fi
# end of 'trees.c'
fi
if test -f 'util.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.c'\"
else
echo shar: Extracting \"'util.c'\" \(12887 characters\)
sed "s/^X//" >'util.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * util.c by Mark Adler.


X */
X
X#include "zip.h"

X#include <ctype.h>
X
X#if defined(MSDOS) && !defined(OS2) && !defined(__GO32__) && !defined(WIN32)
X# include <dos.h>
X#endif
X
Xuch upper[256], lower[256];
X/* Country-dependent case map table */
X
X
X#ifndef UTIL /* UTIL picks out namecmp code (all utils) and crc32 (zipcloak) */


X
X/* Local functions */
X#ifdef PROTO

X local int recmatch(char *, char *);
X local unsigned ident(unsigned chr);


X#endif /* PROTO */
X

Xchar *isshexp(p)
Xchar *p; /* candidate sh expression */
X/* If p is a sh expression, a pointer to the first special character is
X returned. Otherwise, NULL is returned. */
X{
X for (; *p; p++)
X if (*p == '\\' && *(p+1))
X p++;
X#ifdef VMS
X else if (*p == '%' || *p == '*')
X#else /* !VMS */
X else if (*p == '?' || *p == '*' || *p == '[')
X#endif /* ?VMS */
X return p;


X return NULL;
X}
X
X

Xlocal int recmatch(p, s)
Xchar *p; /* sh pattern to match */
Xchar *s; /* string to match it to */
X/* Recursively compare the sh pattern p with the string s and return 1 if
X they match, and 0 or 2 if they don't or if there is a syntax error in the
X pattern. This routine recurses on itself no deeper than the number of
X characters in the pattern. */
X{
X int c; /* pattern char or start of range in [-] loop */
X
X /* Get first character, the pattern for new recmatch calls follows */
X c = *p++;
X
X /* If that was the end of the pattern, match if string empty too */
X if (c == 0)
X return *s == 0;
X
X /* '?' (or '%') matches any character (but not an empty string) */
X#ifdef VMS
X if (c == '%')
X#else /* !VMS */
X if (c == '?')
X#endif /* ?VMS */
X return *s ? recmatch(p, s + 1) : 0;
X
X /* '*' matches any number of characters, including zero */
X if (c == '*')
X {


X if (*p == 0)

X return 1;
X for (; *s; s++)
X if ((c = recmatch(p, s)) != 0)
X return c;
X return 2; /* 2 means give up--shmatch will return false */
X }
X
X#ifndef VMS /* No bracket matching in VMS */
X /* Parse and process the list of characters and ranges in brackets */
X if (c == '[')
X {
X int e; /* flag true if next char to be taken literally */
X char *q; /* pointer to end of [-] group */
X int r; /* flag true to match anything but the range */
X
X if (*s == 0) /* need a character to match */
X return 0;
X p += (r = *p == '!'); /* see if reverse */
X for (q = p, e = 0; *q; q++) /* find closing bracket */
X if (e)
X e = 0;
X else


X if (*q == '\\')

X e = 1;
X else if (*q == ']')
X break;
X if (*q != ']') /* nothing matches if bad syntax */
X return 0;
X for (c = 0, e = *p == '-'; p < q; p++) /* go through the list */
X {
X if (e == 0 && *p == '\\') /* set escape flag if \ */
X e = 1;
X else if (e == 0 && *p == '-') /* set start of range if - */
X c = *(p-1);
X else
X {
X if (*(p+1) != '-')
X for (c = c ? c : *p; c <= *p; c++) /* compare range */
X if (case_map(c) == case_map(*s))
X return r ? 0 : recmatch(q + 1, s + 1);
X c = e = 0; /* clear range, escape flags */
X }
X }
X return r ? recmatch(q + 1, s + 1) : 0; /* bracket match failed */
X }


X#endif /* !VMS */
X

X /* If escape ('\'), just compare next character */
X if (c == '\\')
X if ((c = *p++) == 0) /* if \ at end, then syntax error */
X return 0;
X
X /* Just a character--compare it */
X return case_map(c) == case_map(*s) ? recmatch(p, ++s) : 0;
X}
X
X
Xint shmatch(p, s)
Xchar *p; /* sh pattern to match */
Xchar *s; /* string to match it to */
X/* Compare the sh pattern p with the string s and return true if they match,
X false if they don't or if there is a syntax error in the pattern. */
X{
X return recmatch(p, s) == 1;
X}


X
X
X#ifdef MSDOS
X

Xint dosmatch(p, s)
Xchar *p; /* dos pattern to match */
Xchar *s; /* string to match it to */
X/* Break the pattern and string into name and extension parts and match
X each separately using shmatch(). */
X{
X char *p1, *p2; /* pattern sections */
X char *s1, *s2; /* string sections */
X int r; /* result */
X
X if ((p1 = malloc(strlen(p) + 1)) == NULL ||
X (s1 = malloc(strlen(s) + 1)) == NULL)
X {
X if (p1 != NULL)
X free((voidp *)p1);
X return 0;
X }
X strcpy(p1, p);
X strcpy(s1, s);
X if ((p2 = strrchr(p1, '.')) != NULL)
X *p2++ = 0;
X else
X p2 = "";
X if ((s2 = strrchr(s1, '.')) != NULL)
X *s2++ = 0;
X else
X s2 = "";
X r = shmatch(p2, s2) && shmatch(p1, s1);
X free((voidp *)p1);
X free((voidp *)s1);
X return r;
X}


X#endif /* MSDOS */
X

Xvoidp far **search(b, a, n, cmp)
Xvoidp *b; /* pointer to value to search for */
Xvoidp far **a; /* table of pointers to values, sorted */
Xextent n; /* number of pointers in a[] */
Xint (*cmp) OF((voidp *, voidp far *)); /* comparison function for search */
X/* Search for b in the pointer list a[0..n-1] using the compare function
X cmp(b, c) where c is an element of a[i] and cmp() returns negative if
X *b < *c, zero if *b == *c, or positive if *b > *c. If *b is found,
X search returns a pointer to the entry in a[], else search() returns
X NULL. The nature and size of *b and *c (they can be different) are
X left up to the cmp() function. A binary search is used, and it is
X assumed that the list is sorted in ascending order. */
X{
X voidp far **i; /* pointer to midpoint of current range */
X voidp far **l; /* pointer to lower end of current range */
X int r; /* result of (*cmp)() call */
X voidp far **u; /* pointer to upper end of current range */
X
X l = (voidp far **)a; u = l + (n-1);
X while (u >= l)
X if ((r = (*cmp)(b, *(i = l + ((u - l) >> 1)))) < 0)
X u = i - 1;
X else if (r > 0)
X l = i + 1;
X else
X return (voidp far **)i;
X return NULL; /* If b were in list, it would belong at l */
X}
X


X#endif /* !UTIL */
X
X

X/* Table of CRC-32's of all single byte values (made by makecrc.c) */
Xlocal ulg crctab[] = {
X 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
X 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
X 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
X 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
X 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
X 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
X 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
X 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
X 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
X 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
X 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
X 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
X 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
X 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
X 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
X 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
X 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
X 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
X 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
X 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
X 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
X 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
X 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
X 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
X 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
X 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
X 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
X 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
X 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
X 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
X 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
X 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
X 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
X 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
X 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
X 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
X 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
X 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
X 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
X 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
X 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
X 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
X 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
X 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
X 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
X 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
X 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
X 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
X 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
X 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
X 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
X 0x2d02ef8dL
X};
X
X
Xulg crc32(c, b)
Xulg c; /* current contents of crc shift register */
Xint b; /* byte (eight bits) to run through */
X/* Return the CRC-32 c updated with the eight bits in b. */
X{
X return crctab[((int)c ^ b) & 0xff] ^ (c >> 8);
X}
X
X
X#ifndef UTIL /* UTIL picks out namecmp code (all utils) and crc32 (zipcloak) */
X
Xulg updcrc(s, n)
Xchar *s; /* pointer to bytes to pump through */
Xextent n; /* number of bytes in s[] */
X/* Run a set of bytes through the crc shift register. If s is a NULL
X pointer, then initialize the crc shift register contents instead.
X Return the current crc in either case. */
X{
X register ulg c; /* temporary variable */
X
X static ulg crc = 0xffffffffL; /* shift register contents */
X
X if (s == NULL)
X c = 0xffffffffL;
X else
X {
X c = crc;
X while (n--)
X c = crctab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8);
X }
X crc = c;
X return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
X}
X
X#endif /* !UTIL */
X
X
X#if (defined(MSDOS) && !defined(OS2) && !defined(__GO32__) && !defined(WIN32))
X
Xlocal unsigned ident(unsigned chr)
X{
X return chr; /* in al */
X}
X
Xvoid init_upper()
X{
X static struct country {
X uch ignore[18];
X int (far *casemap)(int);
X uch filler[16];
X } country_info;
X
X struct country far *info = &country_info;
X union REGS regs;
X struct SREGS sregs;
X int c;
X
X regs.x.ax = 0x3800; /* get country info */
X regs.x.dx = FP_OFF(info);
X sregs.ds = FP_SEG(info);
X intdosx(&regs, &regs, &sregs);
X for (c = 0; c < 128; c++) {
X upper[c] = (uch) toupper(c);
X lower[c] = (uch) c;
X }
X for (; c < sizeof(upper); c++) {
X upper[c] = (uch) (*country_info.casemap)(ident(c));
X /* ident() required because casemap takes its parameter in al */
X lower[c] = (uch) c;
X }
X for (c = 0; c < sizeof(upper); c++ ) {
X int u = upper[c];
X if (u != c && lower[u] == (uch) u) {
X lower[u] = (uch)c;
X }
X }
X for (c = 'A'; c <= 'Z'; c++) {
X lower[c] = (uch) (c - 'A' + 'a');
X }
X}
X#else
X# ifndef OS2
X
Xvoid init_upper()
X{
X int c;
X for (c = 0; c < sizeof(upper); c++) upper[c] = lower[c] = c;
X for (c = 'a'; c <= 'z'; c++) upper[c] = c - 'a' + 'A';
X for (c = 'A'; c <= 'Z'; c++) lower[c] = c - 'A' + 'a';
X}
X# endif /* OS2 */
X
X#endif /* MSDOS && !__GO32__ && !OS2 */
X
Xint namecmp(string1, string2)
X char *string1, *string2;
X/* Compare the two strings ignoring case, and correctly taking into
X * account national language characters. For operating systems with
X * case sensitive file names, this function is equivalent to strcmp.
X */
X{
X int d;
X
X for (;;)
X {
X d = (int) (unsigned char) case_map(*string1)
X - (int) (unsigned char) case_map(*string2);
X
X if (d || *string1 == 0 || *string2 == 0)
X return d;
X
X string1++;
X string2++;
X }
X}
END_OF_FILE
if test 12887 -ne `wc -c <'util.c'`; then
echo shar: \"'util.c'\" unpacked with wrong size!
fi
# end of 'util.c'
fi
if test -f 'vms/makefile.vms' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/makefile.vms'\"
else
echo shar: Extracting \"'vms/makefile.vms'\" \(3279 characters\)
sed "s/^X//" >'vms/makefile.vms' <<'END_OF_FILE'
X#============================================================================
X# Makefile for VMS Zip, ZipCloak, ZipNote and ZipSplit Greg Roelofs
X# Version: 1.8f [for use with Todd Aven's MAKE/VMS 3.4] 25 June 1992
X#============================================================================
X
X# Most recent revisions: 25 June 1992
X
X
X#####################
X# MACRO DEFINITIONS #
X#####################
X
XCRYPTO =
XCLOAK =
XCFLAGS =
XUFLAGS = /def=UTIL
X# Uncomment next three lines for decryption version:
X#CRYPTO = crypt.obj,
X#CLOAK = zipcloak.exe
X#CFLAGS = /def=CRYPT
X#UFLAGS = /def=(UTIL,CRYPT)
X
XCC = cc
XLIB =
X# Uncomment next two lines to use the GNU compiler (also add /undef=__STDC__
X# to CFLAGS and UFLAGS, possibly split UFLAGS into two /def's, and possibly
X# replace /obj=$@ [below] with copy/rename/delete setup). NOT TESTED.
X#CC = gcc
X#LIB = gnu_cc:[000000]gcclib.olb/lib,
X
XE = .exe
XO = .obj
XLD = link
XLDFLAGS =
X
XZIPS = zip$E zipnote$E zipsplit$E $(CLOAK)
X
X# object file lists
XOBJZ = zip$O, zipfile$O, zipup$O, fileio$O, $(CRYPTO) util$O,-
X globals$O, VMSmunch$O, vms$O
XOBJI = deflate$O, trees$O, bits$O
XOBJN = zipnote$O, zipfile_$O, zipup_$O, fileio_$O, util_$O,-
X globals$O, VMSmunch$O
XOBJS = zipsplit$O, zipfile_$O, zipup_$O, fileio_$O, util_$O,-
X globals$O, VMSmunch$O
XOBJC = zipcloak$O, zipfile_$O, zipup_$O, fileio_$O, util$O,-
X globals$O, VMSmunch$O, crypt_$O
X
X
X###############################################
X# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
X###############################################
X
Xdefault: $(ZIPS)
X
X
X# suffix rules
X*.obj: *.c # `*.c' necessary?
X $(CC) $(CFLAGS) $<
X
X*_.obj: *.c # `$*' not legal
X $(CC) $(UFLAGS) /obj=$@ $<
X
X
X# executables makerules (trailing `$' makes line a data line)
Xzip$E: $(OBJZ), $(OBJI)
X $(LD) $(LDFLAGS) $(OBJZ), $(OBJI), $(LIB) sys$input/opt
X sys$share:vaxcrtl.exe/shareable $
X
Xzipnote$E: $(OBJN)
X $(LD) $(LDFLAGS) $(OBJN), $(LIB) sys$input/opt
X sys$share:vaxcrtl.exe/shareable $
X
Xzipcloak$E: $(OBJC)
X $(LD) $(LDFLAGS) $(OBJC), $(LIB) sys$input/opt
X sys$share:vaxcrtl.exe/shareable $
X
Xzipsplit$E: $(OBJS)
X $(LD) $(LDFLAGS) $(OBJS), $(LIB) sys$input/opt
X sys$share:vaxcrtl.exe/shareable $
X
X# dependencies for zip, zipnote, zipcloak, and zipsplit
X$(OBJZ): zip.h ziperr.h tailor.h
X$(OBJI): zip.h ziperr.h tailor.h
X$(OBJN): zip.h ziperr.h tailor.h
X$(OBJS): zip.h ziperr.h tailor.h
X$(OBJC): zip.h ziperr.h tailor.h
Xfileio$O: VMSmunch.h
Xvms$O: vms.c zip.h
XVMSmunch$O: VMSmunch.c VMSmunch.h
Xzip$O: revision.h
Xzipcloak$O: revision.h
Xzipfile$O: VMSmunch.h
Xzipnote$O: revision.h
Xzipsplit$O: revision.h
Xzipup$O: revision.h
X
X
Xclean:
X del *.obj;*
X del *.exe;* # use "purge/log" instead?
X
X
X# the backslash '\' is the continuation character if it occurs as
X# the last non-white character on the line.
X# the hyphen '-' is the DCL continuation character, so if it occurs
X# as the last non-white character on the line, the next line will
X# not have the dollar sign '$' prepended.
X
X
X################################
X# INDIVIDUAL MACHINE MAKERULES #
X################################
X
Xgeneric: default # first try if unknown
Xgeneric2: default # second try if unknown
Xvax: default
Xvms: default
X
Xall: $(ZIPS)
Xzip: zip$E
Xzipcloak: zipcloak$E
Xzipnote: zipnote$E
Xzipsplit: zipsplit$E
END_OF_FILE
if test 3279 -ne `wc -c <'vms/makefile.vms'`; then
echo shar: \"'vms/makefile.vms'\" unpacked with wrong size!
fi
# end of 'vms/makefile.vms'
fi
echo shar: End of archive 3 \(of 11\).
cp /dev/null ark3isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:46:28 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 96
Archive-name: zip19/part04

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: mac/macstat.h zip.c zip.doc
# Wrapped by kent@sparky on Sun Aug 23 01:00:44 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 4 (of 11)."'
if test -f 'mac/macstat.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mac/macstat.h'\"
else
echo shar: Extracting \"'mac/macstat.h'\" \(974 characters\)
sed "s/^X//" >'mac/macstat.h' <<'END_OF_FILE'
X/*****************************************************************
X *
X * stat.h
X *
X *****************************************************************/
X
X#include <time.h>
Xextern int macstat(char *path, struct stat *buf, short nVRefNum, long lDirID );
Xtypedef long dev_t;
Xtypedef long ino_t;
Xtypedef long off_t;
X
Xstruct stat {
X dev_t st_dev;
X ino_t st_ino;
X unsigned short st_mode;
X short st_nlink;
X short st_uid;
X short st_gid;
X dev_t st_rdev;
X off_t st_size;
X time_t st_atime, st_mtime, st_ctime;
X long st_blksize;
X long st_blocks;
X};
X
X#define S_IFMT 0xF000
X#define S_IFIFO 0x1000
X#define S_IFCHR 0x2000
X#define S_IFDIR 0x4000
X#define S_IFBLK 0x6000
X#define S_IFREG 0x8000
X#define S_IFLNK 0xA000
X#define S_IFSOCK 0xC000
X#define S_ISUID 0x800
X#define S_ISGID 0x400
X#define S_ISVTX 0x200
X#define S_IREAD 0x100
X#define S_IWRITE 0x80
X#define S_IEXEC 0x40
END_OF_FILE
if test 974 -ne `wc -c <'mac/macstat.h'`; then
echo shar: \"'mac/macstat.h'\" unpacked with wrong size!
fi
# end of 'mac/macstat.h'
fi
if test -f 'zip.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zip.c'\"
else
echo shar: Extracting \"'zip.c'\" \(32880 characters\)
sed "s/^X//" >'zip.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zip.c by Mark Adler.
X */
X
X#include "revision.h"
X#include "zip.h"
X#ifdef VMS
X# include "VMSmunch.h"
X# define echon() echo(1)
X#endif
X#include <signal.h>
X
X#ifdef MACOS
X# include <console.h>
X#endif
X
X#define PWLEN 80 /* Input buffer size for reading encryption key */
X#define MAXCOM 256 /* Maximum one-line comment size */
X
X
X/* Local option flags */
X#define DELETE 0
X#define ADD 1
X#define UPDATE 2
X#define FRESHEN 3
Xlocal int action = ADD; /* one of ADD, UPDATE, FRESHEN, or DELETE */
Xlocal int comadd = 0; /* 1=add comments for new files */
Xlocal int zipedit = 0; /* 1=edit zip comment and all file comments */
Xlocal int dispose = 0; /* 1=remove files after put in zip file */
Xlocal int latest = 0; /* 1=set zip file time to time of latest file */
Xlocal ulg before = 0; /* 0=ignore, else exclude files before this time */
X
X
X/* Temporary zip file name and file pointer */
Xlocal char *tempzip;
Xlocal FILE *tempzf;
X


X
X/* Local functions */
X#ifdef PROTO

X local void freeup(void);
X local void leave(int);
X local void handler(int);
X local void license(void);
X local void help(void);
X local void zipstdout(void);
X void main(int, char **);
X local int count_args(char *s);
X local void envargs(int *Pargc, char ***Pargv, char *envstr);


X#endif /* PROTO */
X
X

X
Xlocal void freeup()
X/* Free all allocations in the found list and the zfiles list */
X{


X struct flist far *f; /* steps through found list */

X struct zlist far *z; /* pointer to next entry in zfiles list */
X
X for (f = found; f != NULL; f = fexpel(f))
X ;
X while (zfiles != NULL)
X {
X z = zfiles->nxt;
X free((voidp *)(zfiles->name));
X free((voidp *)(zfiles->zname));
X if (zfiles->ext)
X free((voidp *)(zfiles->extra));
X if (zfiles->cext && zfiles->cextra != zfiles->extra)
X free((voidp *)(zfiles->cextra));
X if (zfiles->com)
X free((voidp *)(zfiles->comment));
X farfree((voidp far *)zfiles);
X zfiles = z;
X zcount--;
X }
X}
X
X
Xlocal void leave(e)
Xint e; /* exit code */
X/* Process -o and -m options (if specified), free up malloc'ed stuff, and
X exit with the code e. */
X{
X int r; /* return value from trash() */
X ulg t; /* latest time in zip file */
X struct zlist far *z; /* pointer into zfile list */
X
X /* If latest, set time to zip file to latest file in zip file */
X if (latest && strcmp(zipfile, "-"))
X {
X diag("changing time of zip file to time of latest file in it");
X /* find latest time in zip file */
X if (zfiles == NULL)
X warn("zip file is empty, can't make it as old as latest entry", "");
X else {
X t = zfiles->tim;
X for (z = zfiles->nxt; z != NULL; z = z->nxt)
X if (t < z->tim)
X t = z->tim;
X /* set modified time of zip file to that time */
X stamp(zipfile, t);
X }


X }
X if (tempath != NULL)
X {

X free((voidp *)tempath);
X tempath = NULL;
X }
X if (zipfile != NULL)
X {
X free((voidp *)zipfile);
X zipfile = NULL;
X }
X
X
X /* If dispose, delete all files in the zfiles list that are marked */
X if (dispose)
X {
X diag("deleting files that were added to zip file");
X if ((r = trash()) != ZE_OK)
X err(r, "was deleting moved files and directories");
X }
X
X
X /* Done! */
X freeup();
X#ifdef VMS
X exit(0);
X#else /* !VMS */
X exit(e);


X#endif /* ?VMS */
X}
X

X
Xvoid err(c, h)
Xint c; /* error code from the ZE_ class */
Xchar *h; /* message about how it happened */
X/* Issue a message for the error, clean up files and memory, and exit. */
X{
X static int error_level;
X if (error_level++ > 0) exit(0); /* avoid recursive err() */
X
X if (PERR(c))
X perror("zip error");
X fprintf(stderr, "zip error: %s (%s)\n", errors[c-1], h);
X if (tempzip != NULL)
X {
X if (tempzip != zipfile) {
X if (tempzf != NULL)
X fclose(tempzf);
X#ifndef DEBUG
X destroy(tempzip);
X#endif
X free((voidp *)tempzip);
X } else {
X /* -g option, attempt to restore the old file */
X int k = 0; /* keep count for end header */
X ulg cb = cenbeg; /* get start of central */
X struct zlist far *z; /* steps through zfiles linked list */
X
X fprintf(stderr, "attempting to restore %s to its previous state\n",
X zipfile);
X fseek(tempzf, cenbeg, SEEK_SET);
X tempzn = cenbeg;


X for (z = zfiles; z != NULL; z = z->nxt)

X {
X putcentral(z, tempzf);
X tempzn += 4 + CENHEAD + z->nam + z->cext + z->com;
X k++;
X }
X putend(k, tempzn - cb, cb, zcomlen, zcomment, tempzf);
X tempzf = NULL;
X fclose(tempzf);
X }
X }
X if (key != NULL)
X free((voidp *)key);


X if (tempath != NULL)

X free((voidp *)tempath);
X if (zipfile != NULL)
X free((voidp *)zipfile);
X freeup();
X#ifdef VMS
X c = 0;
X#endif
X exit(c);
X}
X
X
Xvoid error(h)
X char *h;
X/* Internal error, should never happen */
X{
X err(ZE_LOGIC, h);
X}
X
Xlocal void handler(s)
Xint s; /* signal number (ignored) */
X/* Upon getting a user interrupt, turn echo back on for tty and abort
X cleanly using err(). */
X{
X#ifndef MSDOS
X# ifdef CRYPT
X echon();
X# endif


X putc('\n', stderr);

X#endif /* !MSDOS */
X err(ZE_ABORT, "aborting");
X s++; /* keep some compilers happy */
X}
X
X
Xvoid warn(a, b)
Xchar *a, *b; /* message strings juxtaposed in output */
X/* Print a warning message to stderr and return. */
X{
X fprintf(stderr, "zip warning: %s%s\n", a, b);
X}
X
X
Xlocal void license()
X/* Print license information to stdout. */
X{
X extent i; /* counter for copyright array */
X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {
X printf(copyright[i], "zip");
X putchar('\n');
X }
X for (i = 0; i < sizeof(disclaimer)/sizeof(char *); i++)
X puts(disclaimer[i]);
X}
X
X
Xlocal void help()
X/* Print help (along with license info) to stdout. */
X{
X extent i; /* counter for help array */
X
X /* help array */
X static char *text[] = {
X"",
X"Zip %d.%d (%s). Usage:",
X"zip [-options] [-b path] [-t mmddyy] [-n suffixes] [zipfile list] [-x list]",
X" The default action is to add or replace zipfile entries from list, which",
X" can include the special name - to compress standard input.",
X" If zipfile and list are ommitted, zip compresses stdin to stdout.",
X" -f freshen: only changed files -u update: only changed or new files",
X" -d delete entries in zipfile -m move into zipfile (delete files)",
X" -k simulate PKZIP made zipfile -g allow growing existing zipfile",
X" -h show this help -L show software license",
X" -r recurse into directories -j junk (don't record) directory names",
X" -0 store only -l translate end-of-line",
X" -1 compress faster -9 compress better",
X" -q quiet operation -n don't compress these suffixes",
X" -c add one-line comments -z add zipfile comment",
X" -b use \"path\" for temp files -t only do files after \"mmddyy\"",
X" -@ read names from stdin -o make zipfile as old as latest entry",
X#ifdef CRYPT
X" -e encrypt (-ee verify key)",
X#endif
X#ifdef VMS
X" -w append the VMS version number to the name stored in the zip file",
X" -V save VMS file attributes",


X#endif /* VMS */
X#ifdef OS2

X" -E use the .LONGNAME Extended attribute (if found) as filename",
X#endif /* OS2 */
X#ifdef S_IFLNK
X" -y store symbolic links as the link instead of the referenced file",
X#endif /* !S_IFLNK */
X" -x exclude the names that follow from those operated on"
X };
X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++)
X {
X printf(copyright[i], "zip");
X putchar('\n');
X }
X for (i = 0; i < sizeof(text)/sizeof(char *); i++)
X {
X printf(text[i], REVISION / 10, REVISION % 10, REVDATE);
X putchar('\n');
X }
X}
X
X
X/* Do command line expansion for MSDOS and VMS */
X#if defined(MSVMS) && !defined(__GO32__)
X# define PROCNAME(n) (action==ADD||action==UPDATE?wild(n):procname(n))
X#else /* !MSVMS */
X# define PROCNAME(n) procname(n)


X#endif /* ?MSVMS */
X

Xlocal void zipstdout()
X/* setup for writing zip file on stdout */
X{
X int r;
X mesg = stderr;
X if (isatty(1))
X err(ZE_PARMS, "no zip file provided");
X if ((zipfile = malloc(4)) == NULL)
X err(ZE_MEM, "was processing arguments");
X strcpy(zipfile, "-");
X if ((r = readzipfile()) != ZE_OK)
X err(r, zipfile);
X}
X
X
Xvoid main(argc, argv)
Xint argc; /* number of tokens in command line */
Xchar **argv; /* command line tokens */
X/* Add, update, freshen, or delete zip entries in a zip file. See the
X command help in help() above. */
X{
X int a; /* attributes of zip file */
X ulg c; /* start of central directory */
X int d; /* true if just adding to a zip file */
X char *e; /* malloc'd comment buffer */
X struct flist far *f; /* steps through found linked list */
X int i; /* arg counter, root directory flag */
X int k; /* next argument type, marked counter,
X comment size, entry count */
X ulg n; /* total of entry len's */
X int o; /* true if there were any ZE_OPEN errors */
X char *p; /* steps through option arguments */
X char *pp; /* temporary pointer */
X int r; /* temporary variable */
X ulg t; /* file time, length of central directory */
X struct zlist far *v; /* temporary variable */
X struct zlist far * far *w; /* pointer to last link in zfiles list */
X FILE *x, *y; /* input and output zip files */
X struct zlist far *z; /* steps through zfiles linked list */
X char *zipbuf; /* stdio buffer for the zip file */
X
X mesg = (FILE *) stdout; /* cannot be made at link time for VMS */
X init_upper(); /* build case map table */
X
X#ifdef MACOS
X argc = ccommand(&argv);
X#endif
X
X /* Process arguments */
X diag("processing arguments");
X if (argc == 1 && isatty(1))
X {
X help();
X exit(0);
X }
X envargs(&argc, &argv, "ZIPOPT"); /* get options from environment */
X
X zipfile = tempzip = NULL;
X tempzf = NULL;
X d = 0; /* disallow adding to a zip file */
X signal(SIGINT, handler);
X signal(SIGTERM, handler);
X k = 0; /* Next non-option argument type */
X for (i = 1; i < argc; i++)
X {
X if (argv[i][0] == '-')
X if (argv[i][1])
X for (p = argv[i]+1; *p; p++)
X switch(*p)
X {
X case '0':
X method = STORE; level = 0; break;
X case '1': case '2': case '3': case '4':
X case '5': case '6': case '7': case '8': case '9':
X /* Set the compression efficacy */
X level = *p - '0'; break;
X case 'b': /* Specify path for temporary file */
X if (k != 0)
X err(ZE_PARMS, "use -b before zip file name");
X else
X k = 1; /* Next non-option is path */
X break;
X case 'c': /* Add comments for new files in zip file */
X comadd = 1; break;
X case 'd': /* Delete files from zip file */
X if (action != ADD)
X err(ZE_PARMS, "specify just one action");
X action = DELETE;
X break;
X#ifdef CRYPT
X case 'e': /* Encrypt */
X e = key == NULL ? (char *)NULL : key;
X if ((key = malloc(PWLEN+1)) == NULL)
X err(ZE_MEM, "was getting encryption password");
X if (getp(e == NULL ? "Enter password: " : "Verify password: ",
X key, PWLEN+1) == NULL)
X err(ZE_PARMS, "stderr is not a tty");
X if (e != NULL)
X {
X r = strcmp(key, e);
X free((voidp *)e);
X if (r)
X err(ZE_PARMS, "password not verified");
X }
X latest = 1; /* to make breaking the code harder */
X break;
X#endif /* CRYPT */
X case 'f': /* Freshen zip file--overwrite only */
X if (action != ADD)
X err(ZE_PARMS, "specify just one action");
X action = FRESHEN;
X break;
X case 'g': /* Allow appending to a zip file */
X d = 1; break;
X case 'h': case 'H': case '?': /* Help */
X help();
X leave(ZE_OK);
X case 'j': /* Junk directory names */
X pathput = 0; break;
X case 'k': /* Make entries using DOS names (k for Katz) */
X dosify = 1; break;
X case 'l': /* Translate end-of-line */
X translate_eol = 1; break;
X case 'L': /* Show license, version */
X license();
X leave(ZE_OK);
X case 'm': /* Delete files added or updated in zip file */
X dispose = 1; break;
X case 'n': /* Don't compress files with a special suffix */
X special = NULL;
X break;
X case 'o': /* Set zip file time to time of latest file in it */
X latest = 1; break;
X case 'p': /* Store path with name */
X break; /* (do nothing as annoyance avoidance) */
X case 'q': /* Quiet operation */
X noisy = 0; break;
X case 'r': /* Recurse into subdirectories */
X recurse = 1; break;
X case 't': /* Exclude files earlier than specified date */
X if (before)
X err(ZE_PARMS, "can only have one -t");
X k = 2; break;
X case 'u': /* Update zip file--overwrite only if newer */
X if (action != ADD)
X err(ZE_PARMS, "specify just one action");
X action = UPDATE;
X break;
X case 'v': /* Mention oddities in zip file structure */
X verbose++;
X break;
X#ifdef VMS
X case 'w': /* Append the VMS version number */
X vmsver = 1; break;
X case 'V': /* Store in VMS format */
X vms_native = 1; break;
X#endif /* VMS */
X case 'x': /* Exclude following files */
X if (k != 4 &&
X (k != 3 || (action != UPDATE && action != FRESHEN)))
X err(ZE_PARMS, "nothing to exclude (-x) from");
X if (k == 3) /* must be -u or -f */


X for (z = zfiles; z != NULL; z = z->nxt)

X z->mark = 1; /* mark all of them */
X k = 5;
X if ((r = exclude()) != ZE_OK)
X if (r == ZE_PARMS)
X err(r, "cannot repeat names in zip file");
X else
X err(r, "was processing list of files");
X break;
X#ifdef S_IFLNK
X case 'y': /* Store symbolic links as such */
X linkput = 1; break;
X#endif /* S_IFLNK */
X case 'z': /* Edit zip file comment */
X zipedit = 1; break;
X case '@': /* read file names from stdin */
X while ((pp = getnam(errbuf)) != NULL)
X {
X if ((r = PROCNAME(pp)) != ZE_OK)
X if (r == ZE_MISS)
X warn("name not matched: ", pp);
X else
X err(r, pp);
X }
X break;
X#ifdef OS2
X case 'E':
X /* use the .LONGNAME EA (if any) as the file's name. */
X use_longname_ea = 1;
X break;
X#endif
X default:
X {
X sprintf(errbuf, "no such option: %c", *p);
X err(ZE_PARMS, errbuf);
X }
X }
X else /* just a dash */
X switch (k)
X {
X case 0:
X zipstdout();
X k = 3;
X break;
X case 1:
X err(ZE_PARMS, "invalid path");
X break;
X case 2:
X err(ZE_PARMS, "invalid time");
X break;
X case 3: case 4: case 5:
X if ((r = PROCNAME(argv[i])) != ZE_OK)
X if (r == ZE_MISS)
X warn("name not matched: ", argv[i]);
X else
X err(r, argv[i]);
X if (k == 3)
X k = 4;
X }
X else /* not an option */
X {
X if (special == NULL)
X special = argv[i];
X else
X switch (k)
X {
X case 0:
X if ((zipfile = ziptyp(argv[i])) == NULL)
X err(ZE_MEM, "was processing arguments");
X if ((r = readzipfile()) != ZE_OK)
X err(r, zipfile);
X k = 3;
X break;
X case 1:
X if ((tempath = malloc(strlen(argv[i]) + 1)) == NULL)
X err(ZE_MEM, "was processing arguments");
X strcpy(tempath, argv[i]);
X k = 0;
X break;
X case 2:
X {
X int yy, mm, dd; /* results of sscanf() */
X
X if (sscanf(argv[i], "%2d%2d%2d", &mm, &dd, &yy) != 3 ||
X mm < 1 || mm > 12 || dd < 1 || dd > 31)
X err(ZE_PARMS, "invalid date entered for -t option");
X before = dostime(yy + (yy < 80 ? 2000 : 1900), mm, dd, 0, 0, 0);
X k = 0;
X break;
X }
X case 3: case 4: case 5:
X if ((r = PROCNAME(argv[i])) != ZE_OK)
X if (r == ZE_MISS)
X warn("name not matched: ", argv[i]);
X else
X err(r, argv[i]);
X if (k == 3)
X k = 4;
X }
X }
X }
X if (k < 3) { /* zip used as filter */
X zipstdout();
X if ((r = procname("-")) != ZE_OK)
X if (r == ZE_MISS)
X warn("name not matched: ", "-");
X else
X err(r, "-");
X k = 4;
X }
X
X if (k != 5) /* Clean up selections */
X {
X if (k == 3 && (action == UPDATE || action == FRESHEN))


X for (z = zfiles; z != NULL; z = z->nxt)

X z->mark = 1; /* if -u or -f with no args, do all */
X if ((r = exclude()) != ZE_OK) /* remove duplicates in found list */
X if (r == ZE_PARMS)
X err(r, "cannot repeat names in zip file");
X else
X err(r, "was processing list of files");
X }
X if (zcount)
X free((voidp *)zsort);
X
X /* Check option combinations */
X if (action == DELETE && (method != BEST || dispose || recurse ||
X key != NULL || comadd || zipedit))
X err(ZE_PARMS, "invalid option(s) used with -d");
X if (linkput && dosify)
X err(ZE_PARMS, "can't use -y with -k");
X if ((action != ADD || d) && !strcmp(zipfile, "-"))
X err(ZE_PARMS, "can't use -d,-f,-u or -g on standard output");
X#ifdef VMS
X if (vms_native && translate_eol)
X err(ZE_PARMS, "can't use -V with -l");
X#endif
X if (zcount == 0 && (action != ADD || d))
X warn(zipfile, " not found or empty");
X
X
X /* If -b not specified, make temporary path the same as the zip file */
X#ifdef MSDOS
X if (tempath == NULL && ((p = strrchr(zipfile, '/')) != NULL ||
X (p = strrchr(zipfile, '\\')) != NULL ||
X (p = strrchr(zipfile, ':')) != NULL))
X {
X if (*p == ':')
X p++;
X#else /* !MSDOS */
X if (tempath == NULL && (p = strrchr(zipfile, '/')) != NULL)
X {
X#endif /* ?MSDOS */
X if ((tempath = malloc((int)(p - zipfile) + 1)) == NULL)
X err(ZE_MEM, "was processing arguments");
X r = *p; *p = 0;
X strcpy(tempath, zipfile);
X *p = (char)r;
X }
X
X /* For each marked entry, if not deleting, check if it exists, and if
X updating or freshening, compare date with entry in old zip file.
X Unmark if it doesn't exist or is too old, else update marked count. */
X diag("stating marked entries");
X k = 0; /* Initialize marked count */


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark)
X if (action != DELETE &&
X ((t = filetime(z->name, (ulg *)NULL, (long *)NULL)) == 0 ||
X t < before ||
X ((action == UPDATE || action == FRESHEN) && t <= z->tim)))


X {
X z->mark = 0;

X z->trash = t && t >= before; /* delete if -um or -fm */
X if (verbose)
X fprintf(mesg, "zip diagnostic: %s %s\n", z->name,
X z->trash ? "up to date" : "missing or early");
X }
X else
X k++;
X
X
X /* Remove entries from found list that do not exist or are too old */
X diag("stating new entries");


X for (f = found; f != NULL;)

X if (action == DELETE || action == FRESHEN ||
X (t = filetime(f->name, (ulg *)NULL, (long *)NULL)) == 0 ||
X t < before || (namecmp(f->name, zipfile) == 0 && strcmp(zipfile, "-")))
X f = fexpel(f);


X else
X f = f->nxt;
X

X /* Make sure there's something left to do */
X if (k == 0 && found == NULL && !(zfiles != NULL && (latest || zipedit)))
X if (action == UPDATE || action == FRESHEN)
X leave(ZE_OK);
X else if (zfiles == NULL && latest)
X err(ZE_NAME, zipfile);
X else
X err(ZE_NONE, zipfile);
X d = (d && k == 0 && (zipbeg || zfiles != NULL)); /* d true if appending */
X
X
X /* Before we get carried away, make sure zip file is writeable */
X if (strcmp(zipfile, "-"))
X {
X x = zfiles == NULL && zipbeg == 0 ? fopen(zipfile, FOPW) :
X fopen(zipfile, FOPM);
X /* Note: FOPW and FOPM expand to several parameters for VMS */
X if (x == NULL)
X err(ZE_CREAT, zipfile);
X fclose(x);
X a = getfileattr(zipfile);
X if (zfiles == NULL && zipbeg == 0)
X destroy(zipfile);
X }
X else
X a = 0;
X
X
X /* Open zip file and temporary output file */
X diag("opening zip file and creating temporary zip file");
X x = NULL;
X tempzn = 0;
X if (strcmp(zipfile, "-") == 0)
X {
X#ifdef MSDOS
X /* Set stdout mode to binary for MSDOS systems */
X setmode(fileno(stdout), O_BINARY);
X tempzf = y = fdopen(fileno(stdout), FOPW);
X#else
X tempzf = y = stdout;
X#endif
X tempzip = "-";
X }
X else if (d) /* d true if just appending (-g) */
X {
X if ((y = fopen(zipfile, FOPM)) == NULL)
X err(ZE_NAME, zipfile);
X tempzip = zipfile;
X tempzf = y;
X if (fseek(y, cenbeg, SEEK_SET))
X err(ferror(y) ? ZE_READ : ZE_EOF, zipfile);
X tempzn = cenbeg;
X }
X else
X {
X if ((zfiles != NULL || zipbeg) && (x = fopen(zipfile, FOPR_EX)) == NULL)
X err(ZE_NAME, zipfile);
X if ((tempzip = tempname(zipfile)) == NULL)
X err(ZE_MEM, tempzip);
X if ((tempzf = y = fopen(tempzip, FOPW)) == NULL)
X err(ZE_TEMP, tempzip);
X if (zipbeg && (r = fcopy(x, y, zipbeg)) != ZE_OK)
X err(r, r == ZE_TEMP ? tempzip : zipfile);
X tempzn = zipbeg;
X }
X#ifndef VMS
X /* Use large buffer to speed up stdio: */
X zipbuf = (char *)malloc(ZBSZ);
X if (zipbuf == NULL)
X err(ZE_MEM, tempzip);
X# ifdef _IOFBF
X setvbuf(y, zipbuf, _IOFBF, ZBSZ);
X# else
X setbuf(y, zipbuf);
X# endif /* _IOBUF */
X#endif /* VMS */
X o = 0; /* no ZE_OPEN errors yet */
X
X
X /* Process zip file, updating marked files */
X if (zfiles != NULL)
X diag("going through old zip file");
X w = &zfiles;
X while ((z = *w) != NULL)
X if (z->mark)
X {
X /* if not deleting, zip it up */
X if (action != DELETE)
X {
X if (noisy)
X {
X fprintf(mesg, "updating %s", z->zname);
X fflush(mesg);
X }
X if ((r = zipup(z, y)) != ZE_OK && r != ZE_OPEN)
X {
X if (noisy)
X {
X putc('\n', mesg);
X fflush(mesg);
X }
X sprintf(errbuf, "was zipping %s", z->name);
X err(r, errbuf);
X }
X if (r == ZE_OPEN)
X {
X o = 1;
X if (noisy)
X {
X putc('\n', mesg);
X fflush(mesg);
X }
X perror("zip warning");
X warn("could not open for reading: ", z->name);
X warn("will just copy entry over: ", z->zname);
X if ((r = zipcopy(z, x, y)) != ZE_OK)
X {
X sprintf(errbuf, "was copying %s", z->zname);
X err(r, errbuf);


X }
X z->mark = 0;
X }

X w = &z->nxt;
X }
X else
X {
X if (noisy)
X {
X fprintf(mesg, "deleting %s\n", z->zname);
X fflush(mesg);
X }
X v = z->nxt; /* delete entry from list */


X free((voidp *)(z->name));
X free((voidp *)(z->zname));

X if (z->ext)
X free((voidp *)(z->extra));
X if (z->cext && z->cextra != z->extra)
X free((voidp *)(z->cextra));
X if (z->com)
X free((voidp *)(z->comment));
X farfree((voidp far *)z);
X *w = v;
X zcount--;
X }
X }
X else
X {
X /* copy the original entry verbatim */
X if (!d && (r = zipcopy(z, x, y)) != ZE_OK)
X {
X sprintf(errbuf, "was copying %s", z->zname);
X err(r, errbuf);
X }
X w = &z->nxt;
X }
X
X
X /* Process the edited found list, adding them to the zip file */
X diag("zipping up new entries, if any");
X for (f = found; f != NULL; f = fexpel(f))
X {
X /* add a new zfiles entry and set the name */
X if ((z = (struct zlist far *)farmalloc(sizeof(struct zlist))) == NULL)
X err(ZE_MEM, "was adding files to zip file");
X z->nxt = NULL;
X z->name = f->name;
X f->name = NULL;
X z->zname = f->zname;
X f->zname = NULL;
X z->ext = z->cext = z->com = 0;


X z->mark = 1;

X z->dosflag = f->dosflag;
X /* zip it up */
X if (noisy)
X {
X fprintf(mesg, "adding %s", z->zname);
X fflush(mesg);
X }
X if ((r = zipup(z, y)) != ZE_OK && r != ZE_OPEN)
X {
X if (noisy)
X {
X putc('\n', mesg);
X fflush(mesg);
X }
X sprintf(errbuf, "was zipping %s", z->name);
X err(r, errbuf);
X }
X if (r == ZE_OPEN)
X {
X o = 1;
X if (noisy)
X {
X putc('\n', mesg);
X fflush(mesg);
X }
X perror("zip warning");
X warn("could not open for reading: ", z->name);


X free((voidp *)(z->name));
X free((voidp *)(z->zname));

X farfree((voidp far *)z);
X }
X else
X {
X *w = z;
X w = &z->nxt;
X zcount++;
X }
X }
X if (key != NULL)
X {
X free((voidp *)key);
X key = NULL;
X }
X
X
X /* Get one line comment for each new entry */
X if (comadd)
X {
X if ((e = malloc(MAXCOM + 1)) == NULL)
X err(ZE_MEM, "was reading comment lines");


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark)
X {
X if (noisy)
X fprintf(mesg, "Enter comment for %s:\n", z->name);
X /* ??? reopen /dev/tty if one file was zipped from stdin
X * or if file names were read from stdin.
X */
X if (fgets(e, MAXCOM+1, stdin) != NULL)
X {
X if ((p = malloc((k = strlen(e))+1)) == NULL)
X {
X free((voidp *)e);
X err(ZE_MEM, "was reading comment lines");
X }
X strcpy(p, e);
X if (p[k-1] == '\n')
X p[--k] = 0;
X z->comment = p;
X z->com = k;
X }
X }
X free((voidp *)e);
X }
X
X /* Get multi-line comment for the zip file */
X if (zipedit)
X {
X if ((e = malloc(MAXCOM + 1)) == NULL)
X err(ZE_MEM, "was reading comment lines");
X if (noisy && zcomlen)
X {
X fputs("current zip file comment is:\n", mesg);
X fwrite(zcomment, 1, zcomlen, mesg);
X if (zcomment[zcomlen-1] != '\n')
X putc('\n', mesg);
X free((voidp *)zcomment);
X }
X zcomment = malloc(1);
X *zcomment = 0;
X if (noisy)
X fputs("enter new zip file comment (end with .):\n", mesg);
X /* ??? reopen /dev/tty if one file was zipped from stdin
X * or if file names were read from stdin.
X */
X while (fgets(e, MAXCOM+1, stdin) != NULL && strcmp(e, ".\n"))
X {
X if (e[(r = strlen(e)) - 1] == '\n')
X e[--r] = 0;
X if ((p = malloc((*zcomment ? strlen(zcomment) + 3 : 1) + r)) == NULL)
X {
X free((voidp *)e);
X err(ZE_MEM, "was reading comment lines");
X }
X if (*zcomment)
X strcat(strcat(strcpy(p, zcomment), "\r\n"), e);
X else
X strcpy(p, *e ? e : "\r\n");
X free((voidp *)zcomment);
X zcomment = p;
X }
X zcomlen = strlen(zcomment);
X free((voidp *)e);
X }
X
X
X /* Write central directory and end header to temporary zip */
X diag("writing central directory");
X k = 0; /* keep count for end header */
X c = tempzn; /* get start of central */
X n = t = 0;


X for (z = zfiles; z != NULL; z = z->nxt)

X {
X if ((r = putcentral(z, y)) != ZE_OK)
X err(r, tempzip);
X tempzn += 4 + CENHEAD + z->nam + z->cext + z->com;
X n += z->len;
X t += z->siz;
X k++;
X }
X if (k == 0)
X warn("zip file empty", "");
X if (verbose)
X fprintf(mesg, "total bytes=%lu, compressed=%lu -> %d%% savings\n",
X n, t, percent(n, t));
X t = tempzn - c; /* compute length of central */
X diag("writing end of central directory");
X if ((r = putend(k, t, c, zcomlen, zcomment, y)) != ZE_OK)
X err(r, tempzip);
X tempzf = NULL;
X if (fclose(y))
X err(d ? ZE_WRITE : ZE_TEMP, tempzip);
X if (x != NULL)
X fclose(x);
X
X
X /* Replace old zip file with new zip file, leaving only the new one */
X if (strcmp(zipfile, "-") && !d)
X {
X diag("replacing old zip file with new zip file");
X if ((r = replace(zipfile, tempzip)) != ZE_OK)
X {
X warn("new zip file left as: ", tempzip);
X free((voidp *)tempzip);
X tempzip = NULL;
X err(r, "was replacing the original zip file");
X }
X free((voidp *)tempzip);
X }
X tempzip = NULL;
X if (strcmp(zipfile, "-")) {
X setfileattr(zipfile, a);
X#ifdef VMS
X /* If the zip file existed previously, restore its record format: */
X if (x != NULL)
X VMSmunch(zipfile, RESTORE_RTYPE, NULL);
X#endif
X }
X
X /* Finish up (process -o, -m, clean up). Exit code depends on o. */
X leave(o ? ZE_OPEN : ZE_OK);
X}
X
X/*****************************************************************
X | envargs - add default options from environment to command line
X |----------------------------------------------------------------
X | Author: Bill Davidsen, original 10/13/91, revised 23 Oct 1991.
X | This program is in the public domain.
X |----------------------------------------------------------------
X | Minor program notes:
X | 1. Yes, the indirection is a tad complex
X | 2. Parenthesis were added where not needed in some cases
X | to make the action of the code less obscure.
X ****************************************************************/
X
Xlocal void
Xenvargs(Pargc, Pargv, envstr)
Xint *Pargc;
Xchar ***Pargv;
Xchar *envstr;
X{
X char *getenv();
X char *envptr; /* value returned by getenv */
X char *bufptr; /* copy of env info */
X int argc = 0; /* internal arg count */
X int ch; /* spare temp value */
X char **argv; /* internal arg vector */
X char **argvect; /* copy of vector address */
X
X /* see if anything in the environment */
X envptr = getenv(envstr);
X if (envptr == NULL || *envptr == 0) return;
X
X /* count the args so we can allocate room for them */
X argc = count_args(envptr);
X bufptr = malloc(1+strlen(envptr));
X if (bufptr == NULL)
X err(ZE_MEM, "Can't get memory for arguments");
X
X strcpy(bufptr, envptr);
X
X /* allocate a vector large enough for all args */
X argv = (char **)malloc((argc+*Pargc+1)*sizeof(char *));
X if (argv == NULL)
X err(ZE_MEM, "Can't get memory for arguments");
X argvect = argv;
X
X /* copy the program name first, that's always true */
X *(argv++) = *((*Pargv)++);
X
X /* copy the environment args first, may be changed */
X do {
X *(argv++) = bufptr;
X /* skip the arg and any trailing blanks */
X while ((ch = *bufptr) != '\0' && ch != ' ') ++bufptr;
X if (ch == ' ') *(bufptr++) = '\0';
X while ((ch = *bufptr) != '\0' && ch == ' ') ++bufptr;
X } while (ch);
X
X /* now save old argc and copy in the old args */
X argc += *Pargc;
X while (--(*Pargc)) *(argv++) = *((*Pargv)++);
X
X /* finally, add a NULL after the last arg, like UNIX */
X *argv = NULL;
X
X /* save the values and return */
X *Pargv = argvect;
X *Pargc = argc;
X}
X
Xstatic int
Xcount_args(s)
Xchar *s;
X{


X int count = 0;

X int ch;
X
X do {
X /* count and skip args */
X ++count;
X while ((ch = *s) != '\0' && ch != ' ') ++s;
X while ((ch = *s) != '\0' && ch == ' ') ++s;
X } while (ch);
X
X return count;
X}
END_OF_FILE
if test 32880 -ne `wc -c <'zip.c'`; then
echo shar: \"'zip.c'\" unpacked with wrong size!
fi
# end of 'zip.c'
fi
if test -f 'zip.doc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zip.doc'\"
else
echo shar: Extracting \"'zip.doc'\" \(23559 characters\)
sed "s/^X//" >'zip.doc' <<'END_OF_FILE'
X
XZIP(1) USER COMMANDS ZIP(1)
X
XNAME
X zip, zipcloak, zipnote, zipsplit - package and compress
X (archive) files
X
XSYNOPSIS
X zip [ -cdeEfghjklmoqruwyz@ ] [ -b temppath ] [ -n suffixes ]
X [ -t mmddyy ] [ zipfile list ] [ -x list ]
X
X zipcloak [ -d ] [ -b path ] zipfile
X
X zipnote [ -w ] [ -b path ] zipfile
X
X zipsplit [ -ti ] [ -n size ] [ -b path ] zipfile
X
XDESCRIPTION
X zip is a compression and file packaging utility for Unix,
X VMS, MSDOS, OS/2, Windows NT, Minix, Atari and Macintosh.
X It is analogous to a combination of tar and compress and is
X compatible with PKZIP (Phil Katz ZIP) for MSDOS systems.
X
X There is a companion to zip called unzip (of course) which
X you should be able to find the same place you got zip. zip
X and unzip can work with files produced by PKZIP under MSDOS,
X and PKZIP and PKUNZIP can work with files produced by zip.
X
X zip version 1.9 is compatible with pkzip 1.93a. Note that
X pkunzip 1.10 cannot extract files produced by pkzip 1.93a or
X zip 1.9b. You must use pkunzip 1.93a or unzip 5.0 to extract
X them.
X
X For a brief help on zip and unzip, run each without specify-
X ing any parameters on the command line.
X
X zip puts one or more compressed files into a single "zip
X file" along with information about the files, including the
X name, path if requested, date and time last modified, pro-
X tection, and check information to verify the fidelity of
X each entry. zip can also be used as a filter, compressing
X standard input to standard output. zip can pack an entire
X directory structure in a zip file with a single command.
X Compression ratios of 2:1 to 3:1 are common for text files.
X zip has one compression method (deflation) and can also
X store files without compression. It automatically chooses
X the better of the two for each file to be compressed.
X
X zip is useful for packaging a set of files to send to some-
X one or for distribution; for archiving or backing up files;
X and for saving disk space by temporarily compressing unused
X files or directories.
X
XHOW TO USE ZIP
X The simplest use of zip is as follows:
X
X zip stuff *
X
X This will create the file "stuff.zip" (assuming it does not
X exist) and put all the files in the current directory in
X stuff.zip in a compressed form. The .zip suffix is added
X automatically, unless that file name given contains a dot
X already. This allows specifying suffixes other than ".zip".
X
X Because of the way the shell does filename substitution,
X files that start with a "." are not included. To include
X those as well, you can:
X
X zip stuff .* *
X
X Even this will not include any subdirectories that are in
X the current directory. To zip up an entire directory, the
X command:
X
X zip -r foo foo
X
X will create the file "foo.zip" containing all the files and
X directories in the directory "foo" that is in the current
X directory. (The first "foo" denotes the zip file, the second
X one denotes the directory.) The "r" option means recurse
X through the directory structure. In this case, all the
X files and directories in foo are zipped, including the ones
X that start with a ".", since the recursion does not use the
X shell's file-name substitution. You should not use -r with
X the name ".*", since that matches ".." which will attempt to
X zip up the parent directory--probably not what was intended.
X
X You may want to make a zip file that contains the files in
X foo, but not record the directory name, foo. You can use
X the -j (junk path) option to leave off the path:
X
X zip -j foo foo/*
X
X The -y option (only under Unix) will store symbolic links as
X such in the zip file, instead of compressing and storing the
X file referred to in the link.
X
X You might be zipping to save disk space, in which case you
X could:
X
X zip -rm foo foo
X
X where the "m" option means "move". This will delete foo and
X its contents after making foo.zip. No deletions will be
X done until the zip has completed with no errors. This
X option is obviously more dangerous and should be used with
X care.
X
X If the zip file already exists, these commands will replace
X existing or add new entries to the zip file. For example,
X if you were really short on disk space, you might not have
X enough room simultaneously to hold the directory foo and the
X compressed foo.zip. In this case, you could do it in steps.
X If foo contained the subdirectories tom, dick, and harry,
X then you could:
X
X zip -rm foo foo/tom
X zip -rm foo foo/dick
X zip -rm foo foo/harry
X
X where the first command would create foo.zip, and the next
X two would add to it. At the completion of each zip command,
X the directory just zipped would be deleted, making room in
X which the next zip command could work.
X
X zip will also accept a single dash ("-") as the zip file
X name, in which case it will write the zip file to stdout,
X allowing the output to be piped to another program. For
X example:
X
X zip -r - . | dd of=/dev/nrst0 obs=16k
X
X would write the zip output directly to a tape with the
X specified block size for the purpose of backing up the
X current directory.
X
X zip also accepts a single dash ("-") as the name of a file
X to be compressed, in which case it will read the zip file
X from stdin, allowing zip to take input from another program.
X For example:
X
X tar cf - . | zip backup -
X
X would compress the output of the tar command for the purpose
X of backing up the current directory. This generally produces
X better compression than the previous example using the -r
X option, because zip can take advantage of redundancy between
X files. The backup can be restored using the command
X
X unzip -p backup | tar xf -
X
X When no zip file name is given and stdout is not a terminal,
X zip acts as a filter, compressing standard input to standard
X output. For example,
X
X tar cf - . | zip | dd of=/dev/nrst0
X
X is equivalent to
X
X tar cf - . | zip - - | dd of=/dev/nrst0
X
X Zip archives created in this manner can be extracted with
X the program funzip which is provided in the unzip package.
X For example,
X
X dd if=/dev/nrst0 | funzip | tar xvf -
X
XMODIFYING EXISTING ZIP FILES
X When given the name of an existing zip file with the above
X commands, zip will replace identically named entries in the
X zip file or add entries for new names. For example, if
X foo.zip exists and contains foo/file1 and foo/file2, and the
X directory foo contains the files foo/file1 and foo/file3,
X then:
X
X zip -r foo foo
X
X will replace foo/file1 in foo.zip and add foo/file3 to
X foo.zip. After this, foo.zip contains foo/file1, foo/file2,
X and foo/file3, with foo/file2 unchanged from before.
X
X When changing an existing zip file, zip will write a tem-
X porary file with the new contents, and only replace the old
X one when the zip has completed with no errors. You can use
X the -b option to specify a different path (usually a dif-
X ferent device) to put the temporary file in. For example:
X
X zip -b /tmp stuff *
X
X will put the temporary zip file and the temporary compres-
X sion files in the directory "/tmp", copying over stuff.zip
X in the current directory when done.
X
X If you are only adding entries to a zip file, not replacing,
X and the -g option is given, then zip grows (appends to) the
X file instead of copying it. The danger of this is that if
X the operation fails, the original zip file is corrupted and
X lost.
X
X There are two other ways to change or add entries in a zip
X file that are restrictions of simple addition or replace-
X ment. The first is -u (update) which will add new entries
X to the zip file as before but will replace existing entries
X only if the modified date of the file is more recent than
X the date recorded for that name in the zip file. For exam-
X ple:
X
X zip -u stuff *
X
X will add any new files in the current directory, and update
X any changed files in the zip file stuff.zip. Note that zip
X will not try to pack stuff.zip into itself when you do this.
X zip will always exclude the zip file from the files on which
X to be operated.
X
X The second restriction is -f (freshen) which, like update,
X will only replace entries with newer files; unlike update,
X will not add files that are not already in the zip file.
X For this option, you may want to simply freshen all of the
X files that are in the specified zip file. To do this you
X would simply:
X
X zip -f foo
X
X Note that the -f option with no arguments freshens all the
X entries in the zip file. The same is true of -u, and hence
X "zip -u foo" and "zip -f foo" both do the same thing.
X
X This command should be run from the same directory from
X which the original zip command was run, since paths stored
X in zip files are always relative.
X
X Another restriction that can be used with adding, updating,
X or freshening is -t (time), which will not operate on files
X modified earlier than the specified date. For example:
X
X zip -rt 120791 infamy foo
X
X will add all the files in foo and its subdirectories that
X were last modified on December 7, 1991, or later to the zip
X file infamy.zip.
X
X Also, files can be explicitly excluded using the -x option:
X
X zip -r foo foo -x \*.o
X
X which will zip up the contents of foo into foo.zip but
X exclude all the files that end in ".o". Here the backslash
X causes zip to match file names that were found when foo was
X searched.
X
X The last operation is -d (delete) which will remove entries
X from a zip file. An example might be:
X
X zip -d foo foo/tom/junk foo/harry/\* \*.o
X
X which will remove the entry foo/tom/junk, all of the files
X that start with "foo/harry/", and all of the files that end
X with ".o" (in any path). Note that once again, the shell
X expansion has been inhibited with backslashes, so that zip
X can see the asterisks. zip can then match on the contents of
X the zip file instead of the contents of the current direc-
X tory.
X
X Under MSDOS, -d is case sensitive when it matches names in
X the zip file. This allows deleting names that were zipped
X on other systems, but requires that the names be entered in
X upper case if they were zipped on an MSDOS system, so that
X the names can be found in the zip file and deleted.
X
XMORE OPTIONS
X As mentioned before, zip will use the best of two methods:
X deflate or store.
X
X The option -0 will force zip to use store on all files. For
X example:
X
X zip -r0 foo foo
X
X will zip up the directory foo into foo.zip using only store.
X
X The speed of deflation can also be controlled with options
X -1 (fastest method but less compression) to -9 (best
X compression but slower). The default value is -5. For exam-
X ple:
X
X zip -r8 foo foo
X
X In nearly all cases, a file that is already compressed can-
X not be compressed further by zip, or if it can, the effect
X is minimal. The -n option prevents zip from trying to
X compress files that have the given suffixes. Such files are
X simply stored (0% compression) in the output zip file, so
X that zip doesn't waste its time trying to compress them.
X The suffixes are separated by either colons or semicolons.
X For example:
X
X zip -rn ".Z:.zip:.tiff:.gif:.snd" foo foo
X
X will put everything in foo into foo.zip, but will store any
X files that end in .Z, .zip, .tiff, .gif, or .snd without
X trying to compress them. (Image and sound files often have
X their own specialized compression methods.) The default suf-
X fix list is ".Z:.zip;.zoo:.arc:.lzh:.arj". The environment
X variable ZIPOPT can be used to change this default. For
X example under Unix with csh:
X
X setenv ZIPOPT "-n .gif:.zip"
X
X The variable ZIPOPT can be used for any option and can
X include several options.
X
X Under Unix and under OS/2 (if files from an HPFS are
X stored), zip will store the full path (relative to the
X current path) and name of the file (or just the name if -j
X is specified) in the zip file along with the Unix
X attributes, and it will mark the entry as made under Unix.
X If the zip file is intended for PKUNZIP under MSDOS, then
X the -k (Katz) option should be used to attempt to convert
X the names and paths to conform to MSDOS, store only the
X MSDOS attribute (just the user write attribute from Unix),
X and mark the entry as made under MSDOS (even though it
X wasn't).
X
X The -o (older) option will set the "last modified" time of
X the zip file to the latest "last modified" time of the
X entries in the zip file. This can be used without any other
X operations, if desired. For example:
X
X zip -o foo
X
X will change the last modified time of foo.zip to the latest
X time of the entries in foo.zip.
X
X The -e and -c options operate on all files updated or added
X to the zip file. Encryption (-e) will prompt for a password
X on the terminal and will not echo the password as it is
X typed (if stderr is not a TTY, zip will exit with an error).
X New zip entries will be encrypted using that password. For
X added peace of mind, you can use -ee, which will prompt for
X the password twice, checking that the two are the same
X before using it. The encryption code is distributed
X separately, so the -e option may not be available in your
X version.
X
X One-line comments can be added for each file with the -c
X option. The zip file operations (adding or updating) will
X be done first, and you will then be prompted for a one-line
X comment for each file. You can then enter the comment fol-
X lowed by return, or just return for no comment.
X
X The -z option will prompt you for a multi-line comment for
X the entire zip file. This option can be used by itself, or
X in combination with other options. The comment is ended by
X a line containing just a period, or an end of file condition
X (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS). Since -z
X reads the lines from stdin, you can simply take the comment
X from a file:
X
X zip -z foo < foowhat
X
X The -q (quiet) option eliminates the informational messages
X and comment prompts while zip is operating. This might be
X used in shell scripts, for example, or if the zip operation
X is being performed as a background task ("zip -q foo *.c
X &").
X
X zip can take a list of file names to operate on from stdin
X using the -@ option. In Unix, this option can be used with
X the find command to extend greatly the functionality of zip.
X For example, to zip up all the C source files in the current
X directory and its subdirectories, you can:
X
X find . -type f -name "*.[ch]" -print | zip source -@
X
X Note that the pattern must be quoted to keep the shell from
X expanding it.
X
X Under VMS only, the -w option will append the version number
X of the files to the name and zip up multiple versions of
X files. Without -w, zip will only use the most recent ver-
X sion of the specified file(s).
X
X The -l option translates the Unix end-of-line character LF
X into the MSDOS convention CR LF. This option should not be
X used on binary files. This option can be used on Unix if
X the zip file is intended for PKUNZIP under MSDOS. If the
X input files already contain CR LF, this option adds an extra
X CR. This ensure that "unzip -a" on Unix will get back an
X exact copy of the original file, to undo the effect of "zip
X -l".
X
X If zip is run with the -h option, or with no arguments and
X standard output is a terminal, the license and the command-
X argument and option help is shown. The -L option just shows
X the license.
X
XABOUT PATTERN MATCHING
X (Note: this section applies to Unix. Watch this space for
X details on MSDOS and VMS operation.)
X
X The Unix shell (sh or csh) does filename substitution on
X command arguments. The special characters are ?, which
X matches any single character; * which matches any number of
X characters (including none); and [] which matches any char-
X acter in the range inside the brackets (like [a-f] or
X [0-9]). When these characters are encountered (and not
X escaped with a backslash or quotes), the shell will look for
X files relative to the current path that match the pattern,
X and replace the argument with a list of the names that
X matched.
X
X zip can do the same matching on names that are in the zip
X file being modified or, in the case of the -x (exclude)
X option, on the list of files to be operated on, by using
X backslashes or quotes to tell the shell not to do the name
X expansion. In general, when zip encounters a name in the
X list of files to do, it first looks for the name in the file
X system. If it finds it, it then adds it to the list of
X files to do. If it does not find it, it will look for the
X name in the zip file being modified (if it exists), using
X the pattern matching characters above, if any. For each
X match, it will add that name to the list of files to do.
X After -x (exclude), the names are removed from the to-do
X list instead of added.
X
X The pattern matching includes the path, and so patterns like
X \*.o match names that end in ".o", no matter what the path
X prefix is. Note that the backslash must precede every spe-
X cial character (i.e. ?*[]), or the entire argument must be
X enclosed in double quotes ("").
X
X In general, using backslash to make zip do the pattern
X matching is used with the -f (freshen) and -d (delete)
X options, and sometimes after the -x (exclude) option when
X used with any operation (add, -u, -f, or -d). zip will
X never use pattern matching to search the file system. If
X zip has recursed into a directory, all files (and all direc-
X tories) in there are fair game.
X
XCOPYRIGHT


X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-

X loup Gailly, Kai Uwe Rommel and Igor Mandrichenko. Permis-
X sion is granted to any individual or institution to use,
X copy, or redistribute this software so long as all of the
X original files are included unmodified, that it is not sold
X for profit, and that this copyright notice is retained.
X
XACKNOWLEDGEMENTS
X Thanks to R. P. Byrne for his Shrink.Pas program which
X inspired this project; to Phil Katz for making the zip file
X format, compression format, and .zip filename extension all
X public domain; to Steve Burg and Phil Katz for help on
X unclear points of the deflate format; to Keith Petersen and
X Rich Wales for providing a mailing list and ftp site for the
X INFO-ZIP group to use; and most importantly, to the INFO-ZIP
X group itself (listed in the file infozip.who) without whose
X tireless testing and bug-fixing efforts a portable zip would
X not have been possible. Finally we should thank (blame) the
X INFO-ZIP moderator, David Kirschbaum for getting us into
X this mess in the first place.
X
XSEE ALSO
X unzip(1), tar(1), compress(1)
X
XBUGS
X WARNING: zip files produced by this version of zip must not
X be *updated* by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if
X they contain encrypted members, or if they have been pro-
X duced in a pipe or on a non seekable device. The old ver-
X sions of zip or pkzip would destroy the zip structure. The
X old versions can list the contents of the zip file but can-
X not extract it anyway (because of the new compression algo-
X rithm). If you do not use encryption and use regular disk
X files, you do not have to care about this problem.
X
X zip 1.9 is compatible with pkzip 1.93a, except when two
X features are used: encryption or zip file created in a pipe
X or on a non seekable device. pkzip versions above 2.0 will
X support such files, and unzip 5.0 already supports them.
X
X Without -y, when zip must compress a symbolic link to an non
X existing file, it only displays a warning "name not
X matched". A better warnign should be given.
X
X Under VMS, not all of the odd file formats are treated prop-
X erly. Only zip files of format stream-LF and fixed length
X 512 are expected to work with zip. Others can be converted
X using Rahul Dhesi's BILF program. This version of zip does
X handle some of the conversion internally. When using Kermit
X to transfer zip files from Vax to MSDOS, type "set file type
X block" on the Vax. When transfering from MSDOS to Vax, type
X "set file type fixed" on the Vax. In both cases, type "set
X file type binary" on MSDOS.
X
X Under VMS, zip hangs for file specification that uses DECnet
X syntax (foo::*.*).
X
X Under OS/2, the amount of External Attributes displayed by
X DIR is (for compatibility) the amount returned by the 16-bit
X version of DosQueryPathInfo(). Otherwise OS/2 1.3 and 2.0
X would report different EA sizes when DIRing a file. How-
X ever, the structure layout returned by the 32-bit
X DosQueryPathInfo() is a bit different, it uses extra padding
X bytes and link pointers (it's a linked list) to have all
X fields on 4-byte boundaries for portability to future RISC
X OS/2 versions. Therefore the value reported by ZIP (which
X uses this 32-bit-mode size) differs from that reported by
X DIR. ZIP stores the 32-bit format for portability, even the
X 16-bit MS-C-compiled version running on OS/2 1.3, so even
X this one shows the 32-bit-mode size.
X
X LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTIL-
X ITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY
X KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE
X COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM
X THE USE OF THIS SOFTWARE.
X
X That having been said, please send any problems or comments
X via email to the Internet address zip-...@cs.ucla.edu. For
X bug reports, please include the version of zip, the make
X options you used to compile it, the machine and operating
X system you are using, and as much additional information as
X possible. Thank you for your support.
END_OF_FILE
if test 23559 -ne `wc -c <'zip.doc'`; then
echo shar: \"'zip.doc'\" unpacked with wrong size!
fi
# end of 'zip.doc'
fi
echo shar: End of archive 4 \(of 11\).
cp /dev/null ark4isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:46:51 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 97
Archive-name: zip19/part05

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: deflate.c msdos/tcconfig.tc.UU os2/os2zip.c.UU
# Wrapped by kent@sparky on Sun Aug 23 01:00:44 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 5 (of 11)."'
if test -f 'deflate.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'deflate.c'\"
else
echo shar: Extracting \"'deflate.c'\" \(26162 characters\)
sed "s/^X//" >'deflate.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * deflate.c by Jean-loup Gailly.


X *
X * PURPOSE
X *

X * Identify new text as repetitions of old text within a fixed-
X * length sliding window trailing behind the new text.


X *
X * DISCUSSION
X *

X * The "deflation" process depends on being able to identify portions
X * of the input text which are identical to earlier input (within a
X * sliding window trailing behind the input currently being processed).
X *
X * The most straightforward technique turns out to be the fastest for
X * most input files: try all possible matches and select the longest.
X * The key feature is of this algorithm is that insertion and deletions
X * from the string dictionary are very simple and thus fast. Insertions
X * and deletions are performed at each input character, whereas string
X * matches are performed only when the previous match ends. So it is
X * preferable to spend more time in matches to allow very fast string
X * insertions and deletions. The matching algorithm for small strings
X * is inspired from that of Rabin & Karp. A brute force approach is
X * used to find longer strings when a small match has been found.
X * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
X * (by Leonid Broukhis).
X * A previous version of this file used a more sophisticated algorithm
X * (by Fiala and Greene) which is guaranteed to run in linear amortized
X * time, but has a larger average cost and uses more memory. However
X * the F&G algorithm may be faster for some highly redundant files if
X * the parameter max_chain_length (described below) is too large.
X *
X * ACKNOWLEDGEMENTS
X *
X * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
X * I found it in 'freeze' written by Leonid Broukhis.
X * Thanks to many info-zippers for bug reports and testing.


X *
X * REFERENCES
X *

X * APPNOTE.TXT documentation file in PKZIP 2.0 distribution.
X *
X * A description of the Rabin and Karp algorithm is given in the book
X * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
X *
X * Fiala,E.R., and Greene,D.H.
X * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595


X *
X * INTERFACE
X *

X * void lm_init (int pack_level, ush *flags)
X * Initialize the "longest match" routines for a new file
X *
X * ulg deflate (void)
X * Processes a new input file and return its compressed length. Sets
X * the compressed length, crc, deflate flags and internal file
X * attributes.


X */
X
X#include "zip.h"

X
X/* ===========================================================================
X * Configuration parameters
X */
X
X/* Compile with MEDIUM_MEM to reduce the memory requirements or


X * with SMALL_MEM to use as little memory as possible.

X * Warning: defining these symbols affects MATCH_BUFSIZE and HASH_BITS
X * (see below) and thus affects the compression ratio. The compressed output
X * is still correct, and might even be smaller in some cases.
X */
X
X#ifdef SMALL_MEM
X# define HASH_BITS 13 /* Number of bits used to hash strings */
X#else
X#ifdef MEDIUM_MEM
X# define HASH_BITS 14
X#else
X# define HASH_BITS 15
X /* For portability to 16 bit machines, do not use values above 15. */
X#endif
X#endif
X
X#define HASH_SIZE (unsigned)(1<<HASH_BITS)
X#define HASH_MASK (HASH_SIZE-1)
X#define WMASK (WSIZE-1)
X/* HASH_SIZE and WSIZE must be powers of two */
X
X#define NIL 0
X/* Tail of hash chains */
X
X#define FAST 4
X#define SLOW 2
X/* speed options for the general purpose bit flag */
X
X#ifndef TOO_FAR
X# define TOO_FAR 4096
X#endif
X/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
X
X/* ===========================================================================
X * Local data used by the "longest match" routines.
X */
X
Xtypedef ush Pos;
Xtypedef unsigned IPos;
X/* A Pos is an index in the character window. We use short instead of int to
X * save space in the various tables. IPos is used only for parameter passing.
X */
X
X#ifndef DYN_ALLOC
X uch far window[2L*WSIZE];
X /* Sliding window. Input bytes are read into the second half of the window,
X * and move to the first half later to keep a dictionary of at least WSIZE
X * bytes. With this organization, matches are limited to a distance of
X * WSIZE-MAX_MATCH bytes, but this ensures that IO is always
X * performed with a length multiple of the block size. Also, it limits
X * the window size to 64K, which is quite useful on MSDOS.
X * To do: limit the window size to WSIZE+BSZ if SMALL_MEM (the code would
X * be less efficient since the data would have to be copied WSIZE/BSZ times)
X */
X Pos far prev[WSIZE];
X /* Link to older string with same hash index. To limit the size of this
X * array to 64K, this link is maintained only for the last 32K strings.
X * An index in this array is thus a window index modulo 32K.
X */
X Pos far head[HASH_SIZE];
X /* Heads of the hash chains or NIL */
X#else
X uch far * near window = NULL;
X Pos far * near prev = NULL;
X Pos far * near head;
X#endif
X
Xlong block_start;
X/* window position at the beginning of the current output block. Gets
X * negative when the window is moved backwards.
X */
X
Xlocal unsigned near ins_h; /* hash index of string to be inserted */
X
X#define H_SHIFT ((HASH_BITS+MIN_MATCH-1)/MIN_MATCH)
X/* Number of bits by which ins_h and del_h must be shifted at each
X * input step. It must be such that after MIN_MATCH steps, the oldest
X * byte no longer takes part in the hash key, that is:
X * H_SHIFT * MIN_MATCH >= HASH_BITS
X */
X
Xunsigned int near prev_length;
X/* Length of the best match at previous step. Matches not greater than this
X * are discarded. This is used in the lazy match evaluation.
X */
X
X unsigned near strstart; /* start of string to insert */
X unsigned near match_start; /* start of matching string */
Xlocal int near eofile; /* flag set at end of input file */
Xlocal unsigned near lookahead; /* number of valid bytes ahead in window */
X
Xunsigned near max_chain_length;
X/* To speed up deflation, hash chains are never searched beyond this length.
X * A higher limit improves compression ratio but degrades the speed.
X */
X
Xlocal unsigned int max_lazy_match;
X/* Attempt to find a better match only when the current match is strictly
X * smaller than this value.
X */
X
Xint near good_match;
X/* Use a faster search when the previous match is longer than this */
X
X
X/* Values for max_lazy_match, good_match and max_chain_length, depending on
X * the desired pack level (0..9). The values given below have been tuned to
X * exclude worst case performance for pathological files. Better values may be
X * found for specific files.
X */
Xtypedef struct config {
X int good_length;
X int max_lazy;
X unsigned max_chain;
X uch flag;
X} config;
X
Xlocal config configuration_table[10] = {
X/* good lazy chain flag */
X/* 0 */ {0, 0, 0, 0}, /* store only */
X/* 1 */ {4, 4, 16, FAST}, /* maximum speed */
X/* 2 */ {6, 8, 16, 0},
X/* 3 */ {8, 16, 32, 0},
X/* 4 */ {8, 32, 64, 0},
X/* 5 */ {8, 64, 128, 0},
X/* 6 */ {8, 128, 256, 0},
X/* 7 */ {8, 128, 512, 0},
X/* 8 */ {32, 258, 1024, 0},
X/* 9 */ {32, 258, 4096, SLOW}}; /* maximum compression */
X
X/* Note: the current code requires max_lazy >= MIN_MATCH and max_chain >= 4
X * but these restrictions can easily be removed at a small cost.
X */
X
X#define EQUAL 0
X/* result of memcmp for equal strings */
X
X/* ===========================================================================
X * Prototypes for local functions. Use asm version by default for
X * MSDOS but not Unix. However the asm version version is recommended
X * for 386 Unix.
X */
X#ifdef ATARI_ST
X# undef MSDOS /* avoid the processor specific parts */
X#endif
X#if defined(MSDOS) && !defined(NO_ASM) && !defined(ASM)
X# define ASM
X#endif
X
Xlocal void fill_window OF((void));
X int longest_match OF((IPos cur_match));
X#ifdef ASM
X void match_init OF((void)); /* asm code initialization */
X#endif
X
X#ifdef DEBUG
Xlocal void check_match OF((IPos start, IPos match, int length));
X#endif
X
X#define MIN(a,b) ((a) <= (b) ? (a) : (b))
X/* The arguments must not have side effects. */
X
X/* ===========================================================================
X * Update a hash value with the given input byte
X * IN assertion: all calls to to UPDATE_HASH are made with consecutive
X * input characters, so that a running hash key can be computed from the
X * previous key instead of complete recalculation each time.
X */
X#define UPDATE_HASH(h,c) (h = (((h)<<H_SHIFT) ^ (c)) & HASH_MASK)
X
X/* ===========================================================================
X * Insert string s in the dictionary and set match_head to the previous head
X * of the hash chain (the most recent string with same hash key). Return
X * the previous length of the hash chain.
X * IN assertion: all calls to to INSERT_STRING are made with consecutive
X * input characters and the first MIN_MATCH bytes of s are valid
X * (except for the last MIN_MATCH-1 bytes of the input file).
X */
X#define INSERT_STRING(s, match_head) \
X (UPDATE_HASH(ins_h, window[(s) + MIN_MATCH-1]), \
X prev[(s) & WMASK] = match_head = head[ins_h], \
X head[ins_h] = (s))
X
X/* ===========================================================================
X * Initialize the "longest match" routines for a new file
X */
Xvoid lm_init (pack_level, flags)
X int pack_level; /* 0: store, 1: best speed, 9: best compression */
X ush *flags; /* general purpose bit flag */
X{
X register unsigned j;
X
X if (pack_level < 1 || pack_level > 9) error("bad pack level");
X
X /* Use dynamic allocation if compiler does not like big static arrays: */
X#ifdef DYN_ALLOC
X if (window == NULL) {
X window = (uch far*) fcalloc(WSIZE, 2*sizeof(uch));
X prev = (Pos far*) fcalloc(WSIZE, sizeof(Pos));
X head = (Pos far*) fcalloc(HASH_SIZE, sizeof(Pos));
X
X if (window == NULL || prev == NULL || head == NULL) {
X err(ZE_MEM, "window allocation");
X }
X }
X#endif /* DYN_ALLOC */
X#ifdef ASM
X match_init(); /* initialize the asm code */
X#endif
X /* Initialize the hash table. */
X for (j = 0; j < HASH_SIZE; j++) head[j] = NIL;
X /* prev will be initialized on the fly */
X
X /* Set the default configuration parameters:
X */
X max_lazy_match = configuration_table[pack_level].max_lazy;
X good_match = configuration_table[pack_level].good_length;
X max_chain_length = configuration_table[pack_level].max_chain;
X *flags |= configuration_table[pack_level].flag;
X /* ??? reduce max_chain_length for binary files */
X
X strstart = 0;
X block_start = 0L;
X
X#if defined(MSDOS) && !defined(__32BIT__)
X /* Can't read a 64K block under MSDOS */
X lookahead = read_buf((char*)window, (unsigned)WSIZE);
X#else
X lookahead = read_buf((char*)window, 2*WSIZE);
X#endif
X if (lookahead == 0 || lookahead == (unsigned)EOF) {
X eofile = 1, lookahead = 0;
X return;
X }
X eofile = 0;
X /* Make sure that we always have enough lookahead. This is important
X * if input comes from a device such as a tty.
X */
X while (lookahead < MIN_LOOKAHEAD && !eofile) fill_window();
X
X ins_h = 0;
X for (j=0; j<MIN_MATCH-1; j++) UPDATE_HASH(ins_h, window[j]);
X /* If lookahead < MIN_MATCH, ins_h is garbage, but this is
X * not important since only literal bytes will be emitted.


X */
X}
X
X/* ===========================================================================

X * Set match_start to the longest match starting at the given string and
X * return its length. Matches shorter or equal to prev_length are discarded,
X * in which case the result is equal to prev_length and match_start is
X * garbage.
X * IN assertions: cur_match is the head of the hash chain for the current
X * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
X */
X#ifndef ASM
X/* For MSDOS, OS/2 and 386 Unix, an optimized version is in match.asm. The code
X * is functionally equivalent, so you can use the C version if desired.
X */
Xint longest_match(cur_match)
X IPos cur_match; /* current match */
X{
X unsigned chain_length = max_chain_length; /* max hash chain length */
X register uch far *scan = window + strstart; /* current string */
X register uch far *match = scan; /* matched string */
X register int len; /* length of current match */
X int best_len = prev_length; /* best match length so far */
X IPos limit = strstart > (IPos)MAX_DIST ? strstart - (IPos)MAX_DIST : NIL;
X /* Stop when cur_match becomes <= limit. To simplify the code,
X * we prevent matches with the string of window index 0.
X */
X#ifdef UNALIGNED_OK
X register ush scan_start = *(ush*)scan;
X register ush scan_end = *(ush*)(scan+best_len-1);
X#else
X register uch scan_start = *scan;
X register uch scan_end1 = scan[best_len-1];
X register uch scan_end = scan[best_len];
X#endif
X
X /* Do not waste too much time if we already have a good match: */
X if (prev_length >= good_match) {
X chain_length >>= 2;
X }
X
X do {
X Assert(cur_match < strstart, "no future");
X match = window + cur_match;
X
X /* Skip to next match if the match length cannot increase
X * or if the match length is less than 2:
X */
X#if (defined(UNALIGNED_OK) && HASH_BITS >= 8)
X /* This code assumes sizeof(unsigned short) == 2 and
X * sizeof(unsigned long) == 4. Do not use UNALIGNED_OK if your
X * compiler uses different sizes.
X */
X if (*(ush*)(match+best_len-1) != scan_end ||
X *(ush*)match != scan_start) continue;
X
X len = MIN_MATCH - 4;
X /* It is not necessary to compare scan[2] and match[2] since they are
X * always equal when the other bytes match, given that the hash keys
X * are equal and that HASH_BITS >= 8.
X */
X do {} while ((len+=4) < MAX_MATCH-3 &&
X *(ulg*)(scan+len) == *(ulg*)(match+len));
X /* The funny do {} generates better code for most compilers */
X
X if (*(ush*)(scan+len) == *(ush*)(match+len)) len += 2;
X if (scan[len] == match[len]) len++;
X
X#else /* UNALIGNED_OK */
X if (match[best_len] != scan_end ||
X match[best_len-1] != scan_end1 || *match != scan_start)
X continue;
X /* It is not necessary to compare scan[1] and match[1] since they
X * are always equal when the other bytes match, given that
X * the hash keys are equal and that h_shift+8 <= HASH_BITS,
X * that is, when the last byte is entirely included in the hash key.
X * The condition is equivalent to
X * (HASH_BITS+2)/3 + 8 <= HASH_BITS
X * or: HASH_BITS >= 13
X * Also, we check for a match at best_len-1 to get rid quickly of
X * the match with the suffix of the match made at the previous step,
X * which is known to fail.
X */
X#if HASH_BITS >= 13
X len = 1;
X#else
X len = 0;
X#endif
X do {} while (++len < MAX_MATCH && scan[len] == match[len]);
X
X#endif /* UNALIGNED_OK */
X
X if (len > best_len) {
X match_start = cur_match;
X best_len = len;
X if (len == MAX_MATCH) break;
X#ifdef UNALIGNED_OK
X scan_end = *(ush*)(scan+best_len-1);
X#else
X scan_end1 = scan[best_len-1];
X scan_end = scan[best_len];
X#endif
X }
X } while (--chain_length != 0 &&
X (cur_match = prev[cur_match & WMASK]) > limit);
X
X return best_len;
X}
X#endif /* NO_ASM */
X
X#ifdef DEBUG
X/* ===========================================================================
X * Check that the match at match_start is indeed a match.
X */
Xlocal void check_match(start, match, length)
X IPos start, match;
X int length;
X{
X /* check that the match is indeed a match */
X if (memcmp((char*)window + match,
X (char*)window + start, length) != EQUAL) {
X fprintf(stderr,
X " start %d, match %d, length %d\n",
X start, match, length);
X error("invalid match");
X }
X if (verbose > 1) {
X fprintf(stderr,"\\[%d,%d]", start-match, length);
X do { putc(window[start++], stderr); } while (--length != 0);
X }
X}
X#else
X# define check_match(start, match, length)
X#endif
X
X/* ===========================================================================
X * Fill the window when the lookahead becomes insufficient.
X * Updates strstart and lookahead, and sets eofile if end of input file.
X * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0
X * OUT assertion: at least one byte has been read, or eofile is set.
X */
Xlocal void fill_window()
X{
X register unsigned n, m;
X unsigned more = (unsigned)((ulg)2*WSIZE - (ulg)lookahead - (ulg)strstart);
X /* Amount of free space at the end of the window. */
X
X /* If the window is full, move the upper half to the lower one to make
X * room in the upper half.
X */
X if (more == 0) {
X /* By the IN assertion, the window is not empty so we can't confuse
X * more == 0 with more == 64K on a 16 bit machine.
X */
X memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
X match_start -= WSIZE;
X strstart -= WSIZE;
X /* strstart - WSIZE = WSIZE - lookahead > WSIZE - MIN_LOOKAHEAD
X * so we now have strstart > MAX_DIST:
X */
X Assert (strstart > MAX_DIST, "window slide too early");
X block_start -= (long) WSIZE;
X
X for (n = 0; n < HASH_SIZE; n++) {
X m = head[n];
X head[n] = (Pos)(m >= WSIZE ? m-WSIZE : NIL);
X }
X for (n = 0; n < WSIZE; n++) {
X m = prev[n];
X prev[n] = (Pos)(m >= WSIZE ? m-WSIZE : NIL);
X /* If n is not on any hash chain, prev[n] is garbage but
X * its value will never be used.
X */
X }
X more = WSIZE;
X if (verbose) putc('.', stderr);
X
X } else if (more == (unsigned)EOF) {
X /* Very unlikely, but possible on 16 bit machine if strstart == 0
X * and lookahead == 1 (input done one byte at time)
X */
X more--;
X }
X n = read_buf((char*)window+strstart+lookahead, more);
X if (n == 0 || n == (unsigned)EOF) {
X eofile = 1;
X } else {
X lookahead += n;


X }
X}
X
X/* ===========================================================================

X * Flush the current block, with given end-of-file flag.
X * IN assertion: strstart is set to the end of the current match.
X */
X#define FLUSH_BLOCK(eof) \
X flush_block(block_start >= 0L ? (char*)&window[block_start] : (char*)NULL,\
X (long)strstart - block_start, (eof))
X
X/* ===========================================================================
X * Processes a new input file and return its compressed length.
X */
X#ifdef NO_LAZY
Xulg deflate()
X{
X IPos hash_head; /* head of the hash chain */
X int flush; /* set if current block must be flushed */
X unsigned match_length = 0; /* length of best match */
X
X prev_length = MIN_MATCH-1;
X while (lookahead != 0) {
X /* Insert the string window[strstart .. strstart+2] in the
X * dictionary, and set hash_head to the head of the hash chain:
X */
X INSERT_STRING(strstart, hash_head);
X
X /* Find the longest match, discarding those <= prev_length.
X * At this point we have always match_length < MIN_MATCH
X */
X if (hash_head != NIL && strstart - hash_head <= MAX_DIST) {
X /* To simplify the code, we prevent matches with the string
X * of window index 0 (in particular we have to avoid a match
X * of the string with itself at the start of the input file).
X */
X match_length = longest_match (hash_head);
X /* longest_match() sets match_start */
X if (match_length > lookahead) match_length = lookahead;
X }
X if (match_length >= MIN_MATCH) {
X check_match(strstart, match_start, match_length);
X
X flush = ct_tally(strstart-match_start, match_length - MIN_MATCH);
X
X lookahead -= match_length;
X match_length--; /* string at strstart already in hash table */
X do {
X strstart++;
X INSERT_STRING(strstart, hash_head);
X /* strstart never exceeds WSIZE-MAX_MATCH, so there are
X * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH
X * these bytes are garbage, but it does not matter since the
X * next lookahead bytes will always be emitted as literals.
X */
X } while (--match_length != 0);
X } else {
X /* No match, output a literal byte */
X flush = ct_tally (0, window[strstart]);
X lookahead--;
X }
X strstart++;
X if (flush) FLUSH_BLOCK(0), block_start = strstart;
X
X /* Make sure that we always have enough lookahead, except
X * at the end of the input file. We need MAX_MATCH bytes
X * for the next match, plus MIN_MATCH bytes to insert the
X * string following the next match.
X */
X while (lookahead < MIN_LOOKAHEAD && !eofile) fill_window();
X
X }
X return FLUSH_BLOCK(1); /* eof */
X}
X#else /* LAZY */
X/* ===========================================================================
X * Same as above, but achieves better compression. We use a lazy
X * evaluation for matches: a match is finally adopted only if there is
X * no better match at the next window position.
X */
Xulg deflate()
X{
X IPos hash_head; /* head of hash chain */
X IPos prev_match; /* previous match */
X int flush; /* set if current block must be flushed */
X int match_available = 0; /* set if previous match exists */
X register unsigned match_length = MIN_MATCH-1; /* length of best match */
X#ifdef DEBUG
X extern ulg isize; /* byte length of input file, for debug only */
X#endif
X
X /* Process the input block. */
X while (lookahead != 0) {
X /* Insert the string window[strstart .. strstart+2] in the
X * dictionary, and set hash_head to the head of the hash chain:
X */
X INSERT_STRING(strstart, hash_head);
X
X /* Find the longest match, discarding those <= prev_length.
X */
X prev_length = match_length, prev_match = match_start;
X match_length = MIN_MATCH-1;
X
X if (hash_head != NIL && prev_length < max_lazy_match &&
X strstart - hash_head <= MAX_DIST) {
X /* To simplify the code, we prevent matches with the string
X * of window index 0 (in particular we have to avoid a match
X * of the string with itself at the start of the input file).
X */
X match_length = longest_match (hash_head);
X /* longest_match() sets match_start */
X if (match_length > lookahead) match_length = lookahead;
X /* Ignore a length 3 match if it is too distant: */
X if (match_length == MIN_MATCH && strstart-match_start > TOO_FAR){
X /* If prev_match is also MIN_MATCH, match_start is garbage
X * but we will ignore the current match anyway.
X */
X match_length--;
X }
X }
X /* If there was a match at the previous step and the current
X * match is not better, output the previous match:
X */
X if (prev_length >= MIN_MATCH && match_length <= prev_length) {
X
X check_match(strstart-1, prev_match, prev_length);
X
X flush = ct_tally(strstart-1-prev_match, prev_length - MIN_MATCH);
X
X /* Insert in hash table all strings up to the end of the match.
X * strstart-1 and strstart are already inserted.
X */
X lookahead -= prev_length-1;
X prev_length -= 2;
X do {
X strstart++;
X INSERT_STRING(strstart, hash_head);
X /* strstart never exceeds WSIZE-MAX_MATCH, so there are
X * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH
X * these bytes are garbage, but it does not matter since the
X * next lookahead bytes will always be emitted as literals.
X */
X } while (--prev_length != 0);
X match_available = 0;
X match_length = MIN_MATCH-1;
X
X } else if (match_available) {
X /* If there was no match at the previous position, output a
X * single literal. If there was a match but the current match
X * is longer, truncate the previous match to a single literal.
X */
X flush = ct_tally (0, window[strstart-1]);
X Tracevv((stderr,"%c",window[strstart-1]));
X lookahead--;
X } else {
X /* There is no previous match to compare with, wait for
X * the next step to decide.
X */
X match_available = 1;
X flush = 0;
X lookahead--;
X }
X if (flush) FLUSH_BLOCK(0), block_start = strstart;
X strstart++;
X Assert (strstart <= isize && lookahead <= isize, "a bit too far");
X
X /* Make sure that we always have enough lookahead, except
X * at the end of the input file. We need MAX_MATCH bytes
X * for the next match, plus MIN_MATCH bytes to insert the
X * string following the next match.
X */
X while (lookahead < MIN_LOOKAHEAD && !eofile) fill_window();
X }
X if (match_available) ct_tally (0, window[strstart-1]);
X
X return FLUSH_BLOCK(1); /* eof */
X}
X#endif /* LAZY */
END_OF_FILE
if test 26162 -ne `wc -c <'deflate.c'`; then
echo shar: \"'deflate.c'\" unpacked with wrong size!
fi
# end of 'deflate.c'
fi
if test -f 'msdos/tcconfig.tc.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/tcconfig.tc.UU'\"
else
echo shar: Extracting \"'msdos/tcconfig.tc.UU'\" \(2366 characters\)
sed "s/^X//" >'msdos/tcconfig.tc.UU' <<'END_OF_FILE'
Xbegin 666 msdos/tcconfig.tc
XM5'5R8F\@0R!#;VYF:6=U<F%T:6]N($9I;&4@&@ !#1(7 1H @$! ( "
XM ( 0 # ( @ $ $ 4 0 !@ ! ( $ PD @ T @ ! X
XM @ !$ 0 ($@ " $ $P " !D % " %0 " $ %@ " ( %P " $
XM& " 9 ! %E $ 68 0 !9P ! %H $ 6D 0 !:@ ! %K $
XM &P 0 !;0 ! %N $ 6\ 0 !< ! %Q $ '( 0 !<P ! !T $
XM 74 0 !=@ ! %W $ 7@ 0 !>0 ! %Z $ 7L 0 ? ! %] $
XM 7X 0 !?P ! & $ (( 0 A ! &% $ <@ 0 R0 ! '* $
XM ,L 0 S ! #- $ ,X 0 !SP ! #0 $ &=$ 0!DT@ ! "#5 $
XM -< 0 V ! '9 $ =H 0 !VP ! #< $ =T 0 !W@ ! #? $
XM . 0 X0 ! #B $ 2P!1
XM "T!
XM@ !#.EQ40UQ)3D-,541%
XM
XM "X!@ !#
XM.EQ40UQ,24(
XM
XM "\!4 !:25 N
XM4%)*
XM # !! S,@ ,0$% #(U
XM ,@$% #$P, ,P%_
XM
XM
XM T 1X *@ -0$>
XM "H #8!'@ J
XM W 1X *@
XM . $> "H #D!
XM'@ J Z 1X *@
XM .P$> "H
XM #P!'@ J ]
XM 8
XM
XM ^ 00
XM. #\!4
XM $ !
XM1 !#.EQ40P
XM $$!4
XM
X9 /__ @ :
X
Xend
END_OF_FILE
if test 2366 -ne `wc -c <'msdos/tcconfig.tc.UU'`; then
echo shar: \"'msdos/tcconfig.tc.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/tcconfig.tc'\" \(1690 characters\)
cat msdos/tcconfig.tc.UU | uudecode
if test 1690 -ne `wc -c <'msdos/tcconfig.tc'`; then
echo shar: \"'msdos/tcconfig.tc'\" uudecoded with wrong size!
else
rm msdos/tcconfig.tc.UU
fi
fi
# end of 'msdos/tcconfig.tc.UU'
fi
if test -f 'os2/os2zip.c.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'os2/os2zip.c.UU'\"
else
echo shar: Extracting \"'os2/os2zip.c.UU'\" \(28901 characters\)
sed "s/^X//" >'os2/os2zip.c.UU' <<'END_OF_FILE'
Xbegin 666 os2/os2zip.c
XM+RH-"B J($ H(RED:7(N8R Q+C0@.#<O,3$O,#8@4'5B;&EC($1O;6%I;BX-
XM"B J#0H@*B @02!P=6)L:6,@9&]M86EN(&EM<&QE;65N=&%T:6]N(&]F($)3
XM1"!D:7)E8W1O<GD@<F]U=&EN97,@9F]R#0H@*B @35,M1$]3+B @5W)I='1E
XM;B!B>2!-:6-H865L(%)E;F1E;&P@*'MU=6YE="QU=&%I?6UI8VAA96Q 9V%R
XM9FEE;&0I+ T*("H@($%U9W5S=" Q.#DW#0H@*B @4&]R=&5D('1O($]3+S(@
XM8GD@2V%I(%5W92!2;VUM96P-"B J("!$96-E;6)E<B Q.3@Y+"!&96)R=6%R
XM>2 Q.3DP#0H@*B @0VAA;F=E(&9O<B!(4$93('-U<'!O<G0L($]C=&]B97(@
XM,3DY, T*("HO#0H-"B\J(&1O97,@86QS;R!C;VYT86EN($5!(&%C8V5S<R!C
XM;V1E(&9O<B!U<V4@:6X@6DE0("HO#0H-"@T*(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@(&1I<G @+3X@9&1?;&]C(#T@,#L-"B @9&ER
XM<" M/B!D9%]C;VYT96YT<R ](&1I<G @+3X@9&1?8W @/2!.54Q,.PT*#0H@
XM(&EF("@H<R ](&=E=&1I<F5N="AN8G5F*2D@/3T@3E5,3"D-"B @("!R971U
XM<FX@9&ER<#L-"@T*("!D;PT*("![#0H@(" @:68@*"@H9' @/2!M86QL;V,H
XM<VEZ96]F*'-T<G5C="!?9&ER8V]N=&5N=',I*2D@/3T@3E5,3"D@?'P-"B @
XM(" @(" @*"AD<" M/B!?9%]E;G1R>2 ](&UA;&QO8RAS=')L96XH<RD@*R Q
XM*2D@/3T@3E5,3"D@(" @(" I#0H@(" @>PT*(" @(" @:68@*&1P*0T*(" @
XM(" @("!F<F5E*&1P*3L-"B @(" @(&9R965?9&ER8V]N=&5N=',H9&ER<" M
XM/B!D9%]C;VYT96YT<RD[#0H-"B @(" @(')E='5R;B!.54Q,.PT*(" @('T-
XM"@T*(" @(&EF("AD:7)P("T^(&1D7V-O;G1E;G1S*0T*(" @('L-"B @(" @
XM(&1I<G @+3X@9&1?8W @+3X@7V1?;F5X=" ](&1P.PT*(" @(" @9&ER<" M
XM/B!D9%]C<" ](&1I<G @+3X@9&1?8W @+3X@7V1?;F5X=#L-"B @("!]#0H@
XM(" @96QS90T*(" @(" @9&ER<" M/B!D9%]C;VYT96YT<R ](&1I<G @+3X@
XM9&1?8W @/2!D<#L-"@T*(" @('-T<F-P>2AD<" M/B!?9%]E;G1R>2P@<RD[
XM#0H@(" @9' @+3X@7V1?;F5X=" ]($Y53$P[#0H-"B @("!D<" M/B!?9%]S
XM:7IE(#T@9FEN9"YC8D9I;&4[#0H@(" @9' @+3X@7V1?;6]D92 ](&9I;F0N
XM871T<D9I;&4[#0H@(" @9' @+3X@7V1?=&EM92 ]("HH=6YS:6=N960@*BD@
XM)BAF:6YD+F9T:6UE3&%S=%=R:71E*3L-"B @("!D<" M/B!?9%]D871E(#T@
XM*BAU;G-I9VYE9" J*2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" @(" @(" @(" @(" @(" @
XM(" @(" @(" @(" @("\J(&=E="!N97AT(&5N=')Y("HO#0H@(" @9&]N92 ]
XM($1O<T9I;F1.97AT*&AD:7(L("9F:6YD+"!S:7IE;V8H9FEN9"DL("9C;W5N
XM="D[#0H-"B @:68@*&1O;F4@/3T@,"D-"B @>PT*(" @(&EF("@@;&]W97(@
XM*0T*(" @(" @4W1R:6YG3&]W97(H9FEN9"YA8VA.86UE*3L-"B @("!R971U
XM<FX@9FEN9"YA8VA.86UE.PT*("!]#0H@(&5L<V4-"B @>PT*(" @($1O<T9I
XM;F1#;&]S92AH9&ER*3L-"B @("!R971U<FX@3E5,3#L-"B @?0T*?0T*#0H-
XM"B\J($9!5" O($A01E,@9&5T96-T:6]N("HO#0H-"FEN="!)<T9I;&53>7-T
XM96U&050H8VAA<B J9&ER*0T*>PT*("!S=&%T:6,@55-(3U)4(&Y,87-T1')I
XM=F4@/2 M,2P@;E)E<W5L=#L-"B @54Q/3D<@;$UA<#L-"B @0EE412!B1&%T
XM85LV-%TL(&).86UE6S-=.PT*(VEF9&5F(%]?,S)"251?7PT*("!53$].1R!N
XM1')I=F4L(&-B1&%T83L-"B @4$9344)51D9%4C(@<$1A=&$@/2 H4$9344)5
XM1D9%4C(I(&)$871A.PT*(V5L<V4-"B @55-(3U)4(&Y$<FEV92P@8V)$871A
XM.PT*("!01E-10E5&1D52('!$871A(#T@*%!&4U%"549&15(I(&)$871A.PT*
XM(V5N9&EF#0H-"B @:68@*"!?;W-M;V1E(#T]($1/4U]-3T1%("D-"B @("!R
XM971U<FX@5%)513L-"B @96QS90T*("![#0H@(" @+RH@5V4@<V5P87)A=&4@
XM1D%4(&%N9"!(4$93*V]T:&5R(&9I;&4@<WES=&5M<R!H97)E+@T*(" @(" @
XM(&%T('1H92!M;VUE;G0@22!C;VYS:61E<B!O=&AE<B!S>7-T96US('1O(&)E
XM('-I;6EL87(@=&\@2%!&4RP-"B @(" @("!I+F4N('-U<'!O<G0@;&]N9R!F
XM:6QE(&YA;65S(&%N9"!B965I;F<@8V%S92!S96YS:71I=F4@*B\-"@T*(" @
XM(&EF("@@:7-A;'!H82AD:7);,%TI("8F("AD:7);,5T@/3T@)SHG*2 I#0H@
XM(" @("!N1')I=F4@/2!T;U]U<"AD:7);,%TI("T@)T G.PT*(" @(&5L<V4-
XM"B @(" @($1O<U%U97)Y0W5R<F5N=$1I<VLH)FY$<FEV92P@)FQ-87 I.PT*
XM#0H@(" @:68@*"!N1')I=F4@/3T@;DQA<W1$<FEV92 I#0H@(" @("!R971U
XM<FX@;E)E<W5L=#L-"@T*(" @(&).86UE6S!=(#T@*&-H87(I("AN1')I=F4@
XM*R G0"<I.PT*(" @(&).86UE6S%=(#T@)SHG.PT*(" @(&).86UE6S)=(#T@
XM,#L-"@T*(" @(&Y,87-T1')I=F4@/2!N1')I=F4[#0H@(" @8V)$871A(#T@
XM<VEZ96]F*&)$871A*3L-"@T*(" @(&EF("@@(41O<U%U97)Y1E-!='1A8V@H
XM8DYA;64L(# L($9304E,7U%515)93D%-12P@*%!63TE$*2!P1&%T82P@)F-B
XM1&%T82D@*0T*(" @(" @;E)E<W5L=" ]("%S=')C;7 H<$1A=&$@+3X@<WI&
XM4T1.86UE("L@<$1A=&$@+3X@8V).86UE+" B1D%4(BD[#0H@(" @96QS90T*
XM(" @(" @;E)E<W5L=" ]($9!3%-%.PT*#0H@(" @+RH@16YD(&]F('1H:7,@
XM=6=L>2!C;V1E("HO#0H@(" @<F5T=7)N(&Y297-U;'0[#0H@('T-"GT-"@T*
XM#0HO*B!A8V-E<W,@;6]D92!B:71S(&%N9"!T:6UE('-T86UP("HO#0H-"FEN
XM="!'971&:6QE36]D92AC:&%R("IN86UE*0T*>PT*(VEF9&5F(%]?,S)"251?
XM7PT*("!&24Q%4U1!5%53,R!F<SL-"B @<F5T=7)N($1O<U%U97)Y4&%T:$EN
XM9F\H;F%M92P@,2P@)F9S+"!S:7IE;V8H9G,I*2 _("TQ(#H@9G,N871T<D9I
XM;&4[#0HC96QS90T*("!54TA/4E0@;6]D93L-"B @<F5T=7)N($1O<U%&:6QE
XM36]D92AN86UE+" F;6]D92P@,$PI(#\@+3$@.B!M;V1E.PT*(V5N9&EF#0I]
XM#0H-"FQO;F<@1V5T1FEL951I;64H8VAA<B J;F%M92D-"GL-"B-I9F1E9B!?
XM7S,R0DE47U\-"B @1DE,15-405154S,@9G,[#0HC96QS90T*("!&24Q%4U1!
XM5%53(&9S.PT*(V5N9&EF#0H@(%532$]25"!N1&%T92P@;E1I;64[#0H-"B @
XM:68@*"!$;W-1=65R>5!A=&A);F9O*&YA;64L(#$L("A00EE412D@)F9S+"!S
XM:7IE;V8H9G,I*2 I#0H@(" @<F5T=7)N("TQ.PT*#0H@(&Y$871E(#T@*B H
XM55-(3U)4("HI("9F<RYF9&%T94QA<W17<FET93L-"B @;E1I;64@/2 J("A5
XM4TA/4E0@*BD@)F9S+F9T:6UE3&%S=%=R:71E.PT*#0H@(')E='5R;B H*%5,
XM3TY'*2!N1&%T92D@/#P@,38@?"!N5&EM93L-"GT-"@T*=F]I9"!3971&:6QE
XM5&EM92AC:&%R("IP871H+"!L;VYG('-T86UP*0T*>PT*("!&24Q%4U1!5%53
XM(&9S.PT*("!54TA/4E0@9F0L(&9T.PT*("!54TA/4E0@;DQE;F=T:#L-"B @
XM8VAA<B!S>DYA;65;0T-(34%84$%42%T[#0H-"B @:68@*"!$;W-1=65R>5!A
XM=&A);F9O*'!A=&@L($9)3%]35$%.1$%21"P@*%!"651%*2 F9G,L('-I>F5O
XM9BAF<RDI("D-"B @("!R971U<FX[#0H-"B @9F0@/2 H55-(3U)4*2 H<W1A
XM;7 @/CX@,38I.PT*("!F=" ]("A54TA/4E0I('-T86UP.PT*("!F<RYF9&%T
XM94QA<W17<FET92 ](&9S+F9D871E0W)E871I;VX@/2 J("A&1$%412 J*2 F
XM9F0[#0H@(&9S+F9T:6UE3&%S=%=R:71E(#T@9G,N9G1I;65#<F5A=&EO;B ]
XM("H@*$9424U%("HI("9F=#L-"@T*("!$;W-39710871H26YF;RAP871H+"!&
XM24Q?4U1!3D1!4D0L("A00EE412D@)F9S+"!S:7IE;V8H9G,I+" P*3L-"GT-
XM"@T*#0HO*B!&050@+R!(4$93(&YA;64@8V]N=F5R<VEO;B!S='5F9B J+PT*
XM#0II;G0@27-&:6QE3F%M959A;&ED*&-H87(@*FYA;64I#0I[#0H@($A&24Q%
XM(&AF.PT*(VEF9&5F(%]?,S)"251?7PT*("!53$].1R!U06-T:6]N.PT*(V5L
XM<V4-"B @55-(3U)4('5!8W1I;VX[#0HC96YD:68-"@T*("!S=VET8V@H($1O
XM<T]P96XH;F%M92P@)FAF+" F=4%C=&EO;BP@,"P@,"P@1DE,15]/4$5.+ T*
XM(" @(" @(" @(" @(" @(" @3U!%3E]!0T-%4U-?4D5!1$].3%D@?"!/4$5.
XM7U-(05)%7T1%3EE.3TY%+" P*2 I#0H@('L-"B @8V%S92!%4E)/4E])3E9!
XM3$E$7TY!344Z#0H@(&-A<V4@15)23U)?1DE,14Y!345?15A#141?4D%.1T4Z
XM#0H@(" @<F5T=7)N($9!3%-%.PT*("!C87-E($Y/7T524D]2.@T*(" @($1O
XM<T-L;W-E*&AF*3L-"B @9&5F875L=#H-"B @("!R971U<FX@5%)513L-"B @
XM?0T*?0T*#0H-"G9O:60@0VAA;F=E3F%M949O<D9!5"AC:&%R("IN86UE*0T*
XM>PT*("!C:&%R("IS<F,L("ID<W0L("IN97AT+" J<'1R+" J9&]T+" J<W1A
XM<G0[#0H@('-T871I8R!C:&%R(&EN=F%L:61;72 ]("(Z.RP]*UPB6UT\/GP@
XM7'0B.PT*#0H@(&EF("@@:7-A;'!H82AN86UE6S!=*2 F)B H;F%M95LQ72 ]
XM/2 G.B<I("D-"B @("!S=&%R=" ](&YA;64@*R R.PT*("!E;'-E#0H@(" @
XM<W1A<G0@/2!N86UE.PT*#0H@('-R8R ](&1S=" ]('-T87)T.PT*("!I9B H
XM("@J<W)C(#T]("<O)RD@?'P@*"IS<F,@/3T@)UQ<)RD@*0T*(" @('-R8RLK
XM+"!D<W0K*SL-"@T*("!W:&EL92 H("IS<F,@*0T*("![#0H@(" @9F]R("@@
XM;F5X=" ]('-R8SL@*FYE>'0@)B8@*"IN97AT("$]("<O)RD@)B8@*"IN97AT
XM("$]("=<7"<I.R!N97AT*RL@*3L-"@T*(" @(&9O<B H('!T<B ]('-R8RP@
XM9&]T(#T@3E5,3#L@<'1R(#P@;F5X=#L@<'1R*RL@*0T*(" @(" @:68@*" J
XM<'1R(#T]("<N)R I#0H@(" @("![#0H@(" @(" @(&1O=" ]('!T<CL@+RH@
XM<F5M96UB97(@;&%S="!D;W0@*B\-"B @(" @(" @*G!T<B ]("=?)SL-"B @
XM(" @('T-"@T*(" @(&EF("@@9&]T(#T]($Y53$P@*0T*(" @(" @9F]R("@@
XM<'1R(#T@<W)C.R!P='(@/"!N97AT.R!P='(K*R I#0H@(" @(" @(&EF("@@
XM*G!T<B ]/2 G7R<@*0T*(" @(" @(" @(&1O=" ]('!T<CL@+RH@<F5M96UB
XM97(@;&%S="!?(&%S(&EF(&ET('=E<F4@82!D;W0@*B\-"@T*(" @(&EF("@@
XM9&]T("8F("AD;W0@/B!S<F,I("8F#0H@(" @(" @(" H*&YE>'0@+2!D;W0@
XM/#T@-"D@?'P-"B @(" @(" @(" H*&YE>'0@+2!S<F,@/B X*2 F)B H9&]T
XM("T@<W)C(#X@,RDI*2 I#0H@(" @>PT*(" @(" @:68@*"!D;W0@*0T*(" @
XM(" @(" J9&]T(#T@)RXG.PT*#0H@(" @("!F;W(@*"!P='(@/2!S<F,[("AP
XM='(@/"!D;W0I("8F("@H<'1R("T@<W)C*2 \(#@I.R!P='(K*R I#0H@(" @
XM(" @("ID<W0K*R ]("IP='([#0H-"B @(" @(&9O<B H('!T<B ](&1O=#L@
XM*'!T<B \(&YE>'0I("8F("@H<'1R("T@9&]T*2 \(#0I.R!P='(K*R I#0H@
XM(" @(" @("ID<W0K*R ]("IP='([#0H@(" @?0T*(" @(&5L<V4-"B @("![
XM#0H@(" @("!I9B H(&1O=" F)B H;F5X=" M('-R8R ]/2 Q*2 I#0H@(" @
XM(" @("ID;W0@/2 G+B<[(" @(" @(" @(" O*B!S<&5C:6%L(&-A<V4Z("(N
XM(B!A<R!A('!A=&@@8V]M<&]N96YT("HO#0H-"B @(" @(&9O<B H('!T<B ]
XM('-R8SL@*'!T<B \(&YE>'0I("8F("@H<'1R("T@<W)C*2 \(#@I.R!P='(K
XM*R I#0H@(" @(" @("ID<W0K*R ]("IP='([#0H@(" @?0T*#0H@(" @*F1S
XM="LK(#T@*FYE>'0[("\J(&5I=&AE<B G+R<@;W(@," J+PT*#0H@(" @:68@
XM*" J;F5X=" I#0H@(" @>PT*(" @(" @<W)C(#T@;F5X=" K(#$[#0H-"B @
XM(" @(&EF("@@*G-R8R ]/2 P("D@+RH@:&%N9&QE('1R86EL:6YG("<O)R!O
XM;B!D:7)S("$@*B\-"B @(" @(" @*F1S=" ](# [#0H@(" @?0T*(" @(&5L
XM<V4-"B @(" @(&)R96%K.PT*("!]#0H-"B @9F]R("@@<W)C(#T@<W1A<G0[
XM("IS<F,@(3T@,#L@*RMS<F,@*0T*(" @(&EF("@@*'-T<F-H<BAI;G9A;&ED
XM+" J<W)C*2 A/2!.54Q,*2!\?" H*G-R8R ]/2 G("<I("D-"B @(" @("IS
XM<F,@/2 G7R<[#0I]#0H-"@T*+RH@+DQ/3D=.04U%($5!(&-O9&4@*B\-"@T*
XM='EP961E9B!S=')U8W0-"GL-"B @54Q/3D<@8V),:7-T.R @(" @(" @(" @
XM(" @("\J(&QE;F=T:"!O9B!V86QU92 K(#(R("HO#0HC:69D968@7U\S,D))
XM5%]?#0H@(%5,3TY'(&].97AT.PT*(V5N9&EF#0H@($)95$4@9D5!.R @(" @
XM(" @(" @(" @(" @(" O*B P("HO#0H@($)95$4@8V).86UE.R @(" @(" @
XM(" @(" @(" O*B!L96YG=&@@;V8@(BY,3TY'3D%-12(@/2 Y("HO#0H@(%53
XM2$]25"!C8E9A;'5E.R @(" @(" @(" @(" O*B!L96YG=&@@;V8@=F%L=64@
XM*R T("HO#0H@($)95$4@<WI.86UE6S$P73L@(" @(" @(" @(" O*B B+DQ/
XM3D=.04U%(B J+PT*("!54TA/4E0@96%4>7!E.R @(" @(" @(" @(" @+RH@
XM,'A&1D9$(&9O<B!L96YG=&@M<')E8V5D960@05-#24D@*B\-"B @55-(3U)4
XM(&5A4VEZ93L@(" @(" @(" @(" @("\J(&QE;F=T:"!O9B!V86QU92 J+PT*
XM("!"651%('-Z5F%L=65;0T-(34%84$%42%T[#0I]#0I&14%,4U0[#0H-"G1Y
XM<&5D968@<W1R=6-T#0I[#0H@(%5,3TY'(&-B3&ES=#L-"B-I9F1E9B!?7S,R
XM0DE47U\-"B @54Q/3D<@;TYE>'0[#0HC96YD:68-"B @0EE412!C8DYA;64[
XM#0H@($)95$4@<WI.86UE6S$P73L@(" @(" @(" @(" O*B B+DQ/3D=.04U%
XM(B J+PT*?0T*1T5!3%-4.PT*#0H-"F-H87(@*D=E=$QO;F=.86UE14$H8VAA
XM<B J;F%M92D-"GL-"B @14%/4"!E86]P.PT*("!'14%,4U0@9V5A;'-T.PT*
XM("!S=&%T:6,@1D5!3%-4(&9E86QS=#L-"@T*("!I9B H(%]O<VUO9&4@/3T@
XM1$]37TU/1$4@*0T*(" @(')E='5R;B!.54Q,.PT*#0H@(&5A;W N9G!'14%,
XM:7-T(#T@*%!'14%,25-4*2 F9V5A;'-T.PT*("!E86]P+F9P1D5!3&ES=" ]
XM("A01D5!3$E35"D@)F9E86QS=#L-"B @96%O<"YO17)R;W(@/2 P.PT*#0H@
XM('-T<F-P>2AG96%L<W0N<WI.86UE+" B+DQ/3D=.04U%(BD[#0H@(&=E86QS
XM="YC8DYA;64@(#T@*$)95$4I('-T<FQE;BAG96%L<W0N<WI.86UE*3L-"B-I
XM9F1E9B!?7S,R0DE47U\-"B @9V5A;'-T+F].97AT(" @/2 P.PT*(V5N9&EF
XM#0H-"B @9V5A;'-T+F-B3&ES=" @/2!S:7IE;V8H9V5A;'-T*3L-"B @9F5A
XM;'-T+F-B3&ES=" @/2!S:7IE;V8H9F5A;'-T*3L-"@T*("!I9B H($1O<U%U
XM97)Y4&%T:$EN9F\H;F%M92P@1DE,7U%515)914%31E)/34Q)4U0L#0H@(" @
XM(" @(" @(" @(" @(" @(" @(" H4$)95$4I("9E86]P+"!S:7IE;V8H96%O
XM<"DI("D-"B @("!R971U<FX@3E5,3#L-"@T*("!I9B H(&9E86QS="YC8E9A
XM;'5E(#X@-" F)B!F96%L<W0N96%4>7!E(#T](#!X1D9&1" I#0H@('L-"B @
XM("!F96%L<W0N<WI686QU95MF96%L<W0N96%3:7IE72 ](# [#0H@(" @<F5T
XM=7)N(&9E86QS="YS>E9A;'5E.PT*("!]#0H-"B @<F5T=7)N($Y53$P[#0I]
XM#0H-"@T*8VAA<B J1V5T3&]N9U!A=&A%02AC:&%R("IN86UE*0T*>PT*("!S
XM=&%T:6,@8VAA<B!N8G5F6T-#2$U!6%!!5$@@*R Q73L-"B @8VAA<B J8V]M
XM<"P@*FYE>'0L("IE82P@<V5P.PT*("!"3T],(&)&;W5N9" ]($9!3%-%.PT*
XM#0H@(&YB=69;,%T@/2 P.PT*("!N97AT(#T@;F%M93L-"@T*("!W:&EL92 H
XM("IN97AT("D-"B @>PT*(" @(&-O;7 @/2!N97AT.PT*#0H@(" @=VAI;&4@
XM*" J;F5X=" A/2 G7%PG("8F("IN97AT("$]("<O)R F)B J;F5X=" A/2 P
XM("D-"B @(" @(&YE>'0K*SL-"@T*(" @('-E<" ]("IN97AT.PT*(" @("IN
XM97AT(#T@,#L-"@T*(" @(&5A(#T@1V5T3&]N9TYA;65%02AN86UE*3L-"B @
XM("!S=')C870H;F)U9BP@96$@/R!E82 Z(&-O;7 I.PT*(" @(&)&;W5N9" ]
XM(&)&;W5N9"!\?" H96$@(3T@3E5,3"D[#0H-"B @(" J;F5X=" ]('-E<#L-
XM"@T*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3&5N9W1H(#T@<W1R
XM;&5N*'-Z3F%M92D[#0H@(&EF("@@<WI.86UE6VY,96YG=&@@+2 Q72 ]/2 G
XM+R<@*0T*(" @('-Z3F%M95MN3&5N9W1H("T@,5T@/2 P.PT*#0H@(&EF("@@
XM1&]S475E<GE0871H26YF;RAS>DYA;64L($9)3%]15452645!4TE:12P@*%!"
XM651%*2 F9G,L('-I>F5O9BAF<RDI#0H@(" @?'P@9G,N8V),:7-T(#P](#(@
XM*B!S:7IE;V8H54Q/3D<I#0H@(" @?'P@*'!$14Y!(#T@86QL;V,H*'-I>F5?
XM="D@9G,N8V),:7-T*2D@/3T@3E5,3" I#0H@(" @<F5T=7)N.PT*#0H@('5L
XM071T<FEB=71E<R ]("TQ.PT*#0H@(&EF("@@1&]S16YU;4%T=')I8G5T92A%
XM3E5-14%?4D5&5%E015]0051(+"!S>DYA;64L(#$L('!$14Y!+"!F<RYC8DQI
XM<W0L#0H@(" @(" @(" @(" @(" @(" @(" @(" F=6Q!='1R:6)U=&5S+"!%
XM3E5-14%?3$5614Q?3D]?5D%,544I#0H@(" @?'P@=6Q!='1R:6)U=&5S(#T]
XM(# -"B @("!\?" H<$=%06QI<W0@/2!A;&QO8R@H<VEZ95]T*2!F<RYC8DQI
XM<W0I*2 ]/2!.54Q,("D-"B @>PT*(VEF9&5F(%]?1E)%15]?#0H@(" @9G)E
XM92AP1$5.02D[#0HC96YD:68-"B @("!R971U<FX[#0H@('T-"@T*("!P1T5!
XM(#T@<$=%06QI<W0@+3X@;&ES=#L-"B @<$9O=6YD(#T@<$1%3D$[#0H-"B @
XM=VAI;&4@*"!U;$%T=')I8G5T97,M+2 I#0H@('L-"B @("!I9B H("$H<W1R
XM8VUP*'!&;W5N9" M/B!S>DYA;64L("(N3$].1TY!344B*2 ]/2 P("8F('5S
XM95]L;VYG;F%M95]E82D@*0T*(" @('L-"B @(" @('!'14$@+3X@8V).86UE
XM(#T@<$9O=6YD("T^(&-B3F%M93L-"B @(" @('-T<F-P>2AP1T5!("T^('-Z
XM3F%M92P@<$9O=6YD("T^('-Z3F%M92D[#0H-"B @(" @(&Y,96YG=&@@/2!S
XM:7IE;V8H1T5!,BD@*R!S=')L96XH<$=%02 M/B!S>DYA;64I.PT*(" @(" @
XM;DQE;F=T:" ]("@H;DQE;F=T:" M(#$I("\@<VEZ96]F*%5,3TY'*2 K(#$I
XM("H@<VEZ96]F*%5,3TY'*3L-"@T*(" @(" @<$=%02 M/B!O3F5X=$5N=')Y
XM3V9F<V5T(#T@=6Q!='1R:6)U=&5S(#\@;DQE;F=T:" Z(# [#0H@(" @("!P
XM1T5!(" @/2 H4$=%03(I(" H*%!#2"D@<$=%02 K(&Y,96YG=&@I.PT*(" @
XM('T-"@T*(" @('!&;W5N9" ]("A01$5.03(I("@H4$-(*2!P1F]U;F0@*R!P
XM1F]U;F0@+3X@;TYE>'1%;G1R>4]F9G-E="D[#0H@('T-"@T*("!I9B H('!'
XM14$@/3T@<$=%06QI<W0@+3X@;&ES=" I("\J(&YO(&%T=')I8G5T97,@=&\@
XM<V%V92 J+PT*("![#0HC:69D968@7U]&4D5%7U\-"B @("!F<F5E*'!$14Y!
XM*3L-"B @("!F<F5E*'!'14%L:7-T*3L-"B-E;F1I9@T*(" @(')E='5R;CL-
XM"B @?0T*#0H@('!'14%L:7-T("T^(&-B3&ES=" ]("A00T@I('!'14$@+2 H
XM4$-(*2!P1T5!;&ES=#L-"@T*("!P1D5!;&ES=" ]("A05D])1"D@<$1%3D$[
XM(" O*B!R975S92!B=69F97(@*B\-"B @<$9%06QI<W0@+3X@8V),:7-T(#T@
XM9G,N8V),:7-T.PT*#0H@(&5A;W N9G!'14$R3&ES=" ]('!'14%L:7-T.PT*
XM("!E86]P+F9P1D5!,DQI<W0@/2!P1D5!;&ES=#L-"B @96%O<"YO17)R;W(@
XM/2 P.PT*#0H@(&EF("@@1&]S475E<GE0871H26YF;RAS>DYA;64L($9)3%]1
XM5452645!4T923TU,25-4+ T*(" @(" @(" @(" @(" @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" @(" @(" @(" @("AC:&%R("HI
XM('!&14%L:7-T+"!U;$%T=')I8G5T97,I.PT*(" J<VEZ92 K/2!N3&5N9W1H
XM.PT*("!P14%B;&]C:R M/B!N4VEZ92 K/2!N3&5N9W1H.PT*#0H@(&EF("@@
XM*'!%06)L;V-K(#T@*%!%04A%041%4BD@;6%L;&]C*'-I>F5O9BA%04A%041%
XM4BDI*2 ]/2!.54Q,("D-"B @("!R971U<FX[#0H-"B @*F-B=69P='(@/2 H
XM8VAA<B J*2!P14%B;&]C:SL-"B @*F-S:7IE(#T@<VEZ96]F*$5!2$5!1$52
XM*3L-"@T*("!P14%B;&]C:R M/B!N240@/2!%04E$.PT*("!P14%B;&]C:R M
XM/B!N4VEZ92 ]('-I>F5O9BAP14%B;&]C:R M/B!L4VEZ92D[#0H@('!%06)L
XM;V-K("T^(&Q3:7IE(#T@=6Q!='1R:6)U=&5S.PT*#0H@(&EF("@@;F]I<WD@
XM*0T*(" @('!R:6YT9B@B("@E;&0@8GET97,@14$G<RDB+"!U;$%T=')I8G5T
XM97,I.PT*?0T*#0HC96QS92 O*B A7U\S,D))5%]?("HO#0H-"G1Y<&5D968@
XM<W1R=6-T#0I[#0H@(%5,3TY'(&].97AT16YT<GE/9F9S970[#0H@($)95$4@
XM9D5!.PT*("!"651%(&-B3F%M93L-"B @55-(3U)4(&-B5F%L=64[#0H@($-(
XM05(@<WI.86UE6S%=.PT*?0T*1D5!,BP@*E!&14$R.PT*#0IT>7!E9&5F('-T
XM<G5C= T*>PT*("!53$].1R!C8DQI<W0[#0H@($9%03(@;&ES=%LQ73L-"GT-
XM"D9%03),25-4+" J4$9%03),25-4.PT*#0IV;VED($=E=$5!<RAC:&%R("IP
XM871H+"!C:&%R("HJ8G5F<'1R+"!U;G-I9VYE9" J<VEZ92P-"B @(" @(" @
XM(" @(" @(" @(" @(" @(&-H87(@*BIC8G5F<'1R+"!U;G-I9VYE9" J8W-I
XM>F4I#0I[#0H@($9)3$535$%455,R(&9S.PT*("!01$5.03$@<$1%3D$L('!&
XM;W5N9#L-"B @14%/4"!E86]P.PT*("!01T5!3$E35"!P1T5!;&ES=#L-"B @
XM4$=%02!P1T5!.PT*("!01D5!3$E35"!P1D5!;&ES=#L-"B @4$9%02!P1D5!
XM.PT*("!01D5!,DQ)4U0@<$9%03)L:7-T.PT*("!01D5!,B!P1D5!,CL-"B @
XM14%(14%$15(@*G!%06)L;V-K.PT*("!53$].1R!U;$%T=')I8G5T97,[#0H@
XM(%532$]25"!N3&5N9W1H+"!N36%X4VEZ93L-"B @8VAA<B!S>DYA;65;0T-(
XM34%84$%42%T[#0H-"B @*G-I>F4@/2 J8W-I>F4@/2 P.PT*#0H@(&EF("@@
XM7V]S;6]D92 ]/2!$3U-?34]$12 I#0H@(" @<F5T=7)N.PT*#0H@('-T<F-P
XM>2AS>DYA;64L('!A=&@I.PT*("!N3&5N9W1H(#T@<W1R;&5N*'-Z3F%M92D[
XM#0H@(&EF("@@<WI.86UE6VY,96YG=&@@+2 Q72 ]/2 G+R<@*0T*(" @('-Z
XM3F%M95MN3&5N9W1H("T@,5T@/2 P.PT*#0H@(&EF("@@1&]S475E<GE0871H
XM26YF;RAS>DYA;64L($9)3%]15452645!4TE:12P@*%!"651%*2 F9G,L('-I
XM>F5O9BAF<RDI#0H@(" @?'P@9G,N8V),:7-T(#P](#(@*B!S:7IE;V8H54Q/
XM3D<I("D-"B @("!R971U<FX[#0H-"B @=6Q!='1R:6)U=&5S(#T@+3$[#0H@
XM(&Y-87A3:7IE(#T@*%532$]25"D@;6EN*&9S+F-B3&ES=" J(#(L(#8U-3(P
XM3"D[#0H-"B @:68@*" H<$1%3D$@/2!M86QL;V,H*'-I>F5?="D@;DUA>%-I
XM>F4I*2 ]/2!.54Q,("D-"B @("!R971U<FX[#0H-"B @:68@*"!$;W-%;G5M
XM071T<FEB=71E*$5.54U%05]2149465!%7U!!5$@L('-Z3F%M92P@,2P@<$1%
XM3D$L(&9S+F-B3&ES="P-"B @(" @(" @(" @(" @(" @(" @(" @("9U;$%T
XM=')I8G5T97,L($5.54U%05],159%3%].3U]604Q512D-"B @("!\?"!U;$%T
XM=')I8G5T97,@/3T@, T*(" @('Q\("AP1T5!;&ES=" ](&UA;&QO8RAN36%X
XM4VEZ92DI(#T]($Y53$P@*0T*("![#0H@(" @9G)E92AP1$5.02D[#0H@(" @
XM<F5T=7)N.PT*("!]#0H-"B @<$=%02 ]('!'14%L:7-T("T^(&QI<W0[#0H@
XM('!&;W5N9" ]('!$14Y!.PT*#0H@('=H:6QE("@@=6Q!='1R:6)U=&5S+2T@
XM*0T*("![#0H@(" @;DQE;F=T:" ]('-T<FQE;BAP1F]U;F0@+3X@<WI.86UE
XM*3L-"@T*(" @(&EF("@@(2AS=')C;7 H<$9O=6YD("T^('-Z3F%M92P@(BY,
XM3TY'3D%-12(I(#T](# @)B8@=7-E7VQO;F=N86UE7V5A*2 I#0H@(" @>PT*
XM(" @(" @<$=%02 M/B!C8DYA;64@/2!P1F]U;F0@+3X@8V).86UE.PT*(" @
XM(" @<W1R8W!Y*'!'14$@+3X@<WI.86UE+"!P1F]U;F0@+3X@<WI.86UE*3L-
XM"@T*(" @(" @<$=%02 ]("A01T5!*2 H*%!#2"D@*'!'14$K*RD@*R!N3&5N
XM9W1H*3L-"B @("!]#0H-"B @("!P1F]U;F0@/2 H4$1%3D$Q*2 H*%!#2"D@
XM*'!&;W5N9"LK*2 K(&Y,96YG=&@I.PT*("!]#0H-"B @:68@*"!P1T5!(#T]
XM('!'14%L:7-T("T^(&QI<W0@*0T*("![#0H@(" @9G)E92AP1$5.02D[#0H@
XM(" @9G)E92AP1T5!;&ES="D[#0H@(" @<F5T=7)N.PT*("!]#0H-"B @<$=%
XM06QI<W0@+3X@8V),:7-T(#T@*%!#2"D@<$=%02 M("A00T@I('!'14%L:7-T
XM.PT*#0H@('!&14%L:7-T(#T@*%!&14%,25-4*2!P1$5.03L@+RH@<F5U<V4@
XM8G5F9F5R("HO#0H@('!&14%L:7-T("T^(&-B3&ES=" ](&9S+F-B3&ES=#L-
XM"B @<$9%02 ]('!&14%L:7-T("T^(&QI<W0[#0H-"B @96%O<"YF<$=%04QI
XM<W0@/2!P1T5!;&ES=#L-"B @96%O<"YF<$9%04QI<W0@/2!P1D5!;&ES=#L-
XM"B @96%O<"YO17)R;W(@/2 P.PT*#0H@(&EF("@@1&]S475E<GE0871H26YF
XM;RAS>DYA;64L($9)3%]15452645!4T923TU,25-4+ T*(" @(" @(" @(" @
XM(" @(" @(" H4$)95$4I("9E86]P+"!S:7IE;V8H96%O<"DI("D-"B @>PT*
XM(" @(&9R964H<$1%3D$I.PT*(" @(&9R964H<$=%06QI<W0I.PT*(" @(')E
XM='5R;CL-"B @?0T*#0H@("\J(&YO=R!C;VYV97)T(&EN=&\@;F5W($]3+S(@
XM,BXP(#,R+6)I="!F;W)M870@*B\-"@T*("!P1D5!,FQI<W0@/2 H4$9%03),
XM25-4*2!P1T5!;&ES=#L@("\J(')E=7-E(&)U9F9E<B J+PT*("!P1D5!,B ]
XM('!&14$R;&ES=" M/B!L:7-T.PT*#0H@('=H:6QE("@@*%!#2"D@<$9%02 M
XM("A00T@I('!&14%L:7-T(#P@<$9%06QI<W0@+3X@8V),:7-T("D-"B @>PT*
XM(" @(&Y,96YG=&@@/2!S:7IE;V8H1D5!*2 K('!&14$@+3X@8V).86UE("L@
XM,2 K('!&14$@+3X@8V)686QU93L-"B @("!M96UC<'DH*%!#2"D@<$9%03(@
XM*R!S:7IE;V8H<$9%03(@+3X@;TYE>'1%;G1R>4]F9G-E="DL('!&14$L(&Y,
XM96YG=&@I.PT*(" @(&UE;7-E="@H4$-(*2!P1D5!,B K('-I>F5O9BAP1D5!
XM,B M/B!O3F5X=$5N=')Y3V9F<V5T*2 K(&Y,96YG=&@L(# L(#,I.PT*(" @
XM('!&14$@/2 H4$9%02D@*"A00T@I('!&14$@*R!N3&5N9W1H*3L-"@T*(" @
XM(&Y,96YG=&@@/2!S:7IE;V8H1D5!,BD@*R!P1D5!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
XM"B @>PT*(" @(&Y5(#T@=7!P97);;D-N=%T[#0H@(" @:68@*&Y5("$](&Y#
XM;G0@)B8@;&]W97);;E5=(#T]("AU;G-I9VYE9"!C:&%R*2!N52D-"B @(" @
XM(&QO=V5R6VY572 ]("AU;G-I9VYE9"!C:&%R*2!N0VYT.PT*("!]#0H-"B @
XM9F]R("@@;D-N=" ]("=!)SL@;D-N=" \/2 G6B<[(&Y#;G0K*R I#0H@(" @
XM;&]W97);;D-N=%T@/2 H=6YS:6=N960@8VAA<BD@*&Y#;G0@+2 G02<@*R G
XM82<I.PT*?0T*#0H-"F-H87(@*E-T<FEN9TQO=V5R*&-H87(@*G-Z07)G*0T*
XM>PT*("!U;G-I9VYE9"!C:&%R("IS>E!T<CL-"B @9F]R("@@<WI0='(@/2!S
XM>D%R9SL@*G-Z4'1R.R!S>E!T<BLK("D-"B @(" J<WI0='(@/2!L;W=E<ELJ
X=<WI0=')=.PT*("!R971U<FX@<WI!<F<[#0I]#0HJ
X
Xend
END_OF_FILE
if test 28901 -ne `wc -c <'os2/os2zip.c.UU'`; then
echo shar: \"'os2/os2zip.c.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'os2/os2zip.c'\" \(20954 characters\)
cat os2/os2zip.c.UU | uudecode
if test 20954 -ne `wc -c <'os2/os2zip.c'`; then
echo shar: \"'os2/os2zip.c'\" uudecoded with wrong size!
else
rm os2/os2zip.c.UU
fi
fi
# end of 'os2/os2zip.c.UU'
fi
echo shar: End of archive 5 \(of 11\).
cp /dev/null ark5isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:47:18 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 98
Archive-name: zip19/part06

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: os2/zip.def.UU zip.1 zip.h zipfile.c
# Wrapped by kent@sparky on Sun Aug 23 01:00:45 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 6 (of 11)."'
if test -f 'os2/zip.def.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'os2/zip.def.UU'\"
else
echo shar: Extracting \"'os2/zip.def.UU'\" \(152 characters\)
sed "s/^X//" >'os2/zip.def.UU' <<'END_OF_FILE'
Xbegin 666 os2/zip.def
XM3D%-12!724Y$3U=#3TU0050@3D571DE,15,-"D1%4T-225!424].("=4:&4@
XK=V]R;&0M9F%M;W5S('II<"!U=&EL:71I97,@9G)O;2!);F9O+5I)4"<-"F4@
X
Xend
END_OF_FILE
if test 152 -ne `wc -c <'os2/zip.def.UU'`; then
echo shar: \"'os2/zip.def.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'os2/zip.def'\" \(88 characters\)
cat os2/zip.def.UU | uudecode
if test 88 -ne `wc -c <'os2/zip.def'`; then
echo shar: \"'os2/zip.def'\" uudecoded with wrong size!
else
rm os2/zip.def.UU
fi
fi
# end of 'os2/zip.def.UU'
fi
if test -f 'zip.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zip.1'\"
else
echo shar: Extracting \"'zip.1'\" \(21796 characters\)
sed "s/^X//" >'zip.1' <<'END_OF_FILE'
X.\" Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X.\" Kai Uwe Rommel and Igor Mandrichenko.
X.\" Permission is granted to any individual or institution to use, copy, or
X.\" redistribute this software so long as all of the original files are included
X.\" unmodified, that it is not sold for profit, and that this copyright notice
X.\" is retained.
X.\"
X.\" zip.1 by Mark Adler.
X.\"
X.TH ZIP 1
X.SH NAME
Xzip, zipcloak, zipnote, zipsplit \- package and compress (archive) files
X.SH SYNOPSIS
X.B zip
X[
X.B \-cdeEfghjklmoqruwyz@
X] [
X.B \-b
Xtemppath ] [
X.B \-n
Xsuffixes ] [
X.B \-t
Xmmddyy ] [ zipfile list ] [
X.B \-x
Xlist ]
X.PP
X.B zipcloak
X[
X.B \-d
X] [
X.BI -b " path"
X]
X.I zipfile
X.PP
X.B zipnote
X[
X.B -w
X] [
X.BI \-b " path"
X]
X.I zipfile
X.PP
X.B zipsplit
X[
X.B \-ti
X] [
X.BI \-n " size"
X] [
X.BI \-b " path"
X]
X.I zipfile
X.br
X.SH DESCRIPTION
X.I zip
Xis a compression and file packaging utility for Unix, VMS, MSDOS,
XOS/2, Windows NT, Minix, Atari and Macintosh. It is analogous to a
Xcombination of tar and compress and is compatible with PKZIP (Phil
XKatz ZIP) for MSDOS systems.
X.PP
XThere is a companion to
X.I zip
Xcalled
X.I unzip
X(of course) which you should be able
Xto find the same place you got
X.I zip. zip
Xand
X.I unzip
Xcan work with files
Xproduced by PKZIP under MSDOS, and PKZIP and PKUNZIP can work with files
Xproduced by
X.I zip.
X.PP
X.I zip
Xversion 1.9 is compatible with pkzip 1.93a.
XNote that pkunzip 1.10 cannot extract files produced by pkzip 1.93a
Xor zip 1.9. You must use pkunzip 1.93a or unzip 5.0 to extract them.
X.PP
XFor a brief help on
X.I zip
Xand
X.I unzip,
Xrun each without specifying any parameters on the command line.
X.PP
X.I zip
Xputs one or more compressed files into a single "zip file" along with
Xinformation about the files, including the name, path if requested, date
Xand time last modified, protection, and check information to verify the
Xfidelity of each entry.
X.I zip
Xcan also be used as a filter, compressing standard input to standard output.
X.I zip
Xcan pack an entire directory structure in a
Xzip file with a single command. Compression ratios of 2:1 to 3:1 are
Xcommon for text files.
X.I zip
Xhas one compression method (deflation) and can also store files without
Xcompression. It automatically chooses the better of the two for each file
Xto be compressed.
X.PP
X.I zip
Xis useful for packaging a set of files to send to someone or for distribution;
Xfor archiving or backing up files; and for saving disk space by temporarily
Xcompressing unused files or directories.
X.SH "HOW TO USE ZIP"
XThe simplest use of
X.I zip
Xis as follows:
X.PP
X.ti +5n
Xzip stuff *
X.PP
XThis will create the file "stuff.zip" (assuming it does not exist) and put
Xall the files in the current directory in stuff.zip in a compressed form.
XThe .zip suffix is added automatically, unless that file name given contains
Xa dot already. This allows specifying suffixes other than ".zip".
X.PP
XBecause of the way the shell does filename substitution, files that start
Xwith a "." are not included. To include those as well, you can:
X.PP
X.ti +5n
Xzip stuff .* *
X.PP
XEven this will not include any subdirectories that are in the current
Xdirectory. To zip up an entire directory, the command:
X.PP
X.ti +5n
Xzip -r foo foo
X.PP
Xwill create the file "foo.zip" containing all the files and directories in
Xthe directory "foo" that is in the current directory. (The first "foo" denotes
Xthe zip file, the second one denotes the directory.) The "r" option means
Xrecurse through the directory structure. In this case, all the
Xfiles and directories in foo are zipped, including the ones that start with
Xa ".", since the recursion does not use the shell's file-name substitution.
XYou should not use -r with the name ".*", since that matches ".." which will
Xattempt to zip up the parent directory--probably not what was intended.
X.PP
XYou may want to make a zip file that contains the files in foo, but not record
Xthe directory name, foo. You can use the -j (junk path) option to leave off
Xthe path:
X.PP
X.ti +5n
Xzip -j foo foo/*
X.PP
XThe -y option (only under Unix) will store symbolic links as such in the
Xzip file, instead of compressing and storing the file referred to in the link.
X.PP
XYou might be zipping to save disk space, in which case you could:
X.PP
X.ti +5n
Xzip -rm foo foo
X.PP
Xwhere the "m" option means "move". This will delete foo and its contents
Xafter making foo.zip. No deletions will be done until the zip has completed
Xwith no errors. This option is obviously more dangerous and should be
Xused with care.
X.PP
XIf the zip file already exists, these commands will replace existing or add
Xnew entries to the zip file. For example, if you were really short on disk
Xspace, you might not have enough room simultaneously to hold the directory
Xfoo and the compressed foo.zip. In this case, you could do it in steps. If
Xfoo contained the subdirectories tom, dick, and harry, then you could:
X.PP
X.ti +5n
Xzip -rm foo foo/tom
X.ti +5n
Xzip -rm foo foo/dick
X.ti +5n
Xzip -rm foo foo/harry
X.PP
Xwhere the first command would create foo.zip, and the next two would add to
Xit. At the completion of each zip command, the directory just zipped would
Xbe deleted, making room in which the next
X.I zip
Xcommand could work.
X.PP
X.I zip
Xwill also accept a single dash ("-") as the zip file name, in which case it
Xwill write the zip file to stdout, allowing the output to be piped to another
Xprogram. For example:
X.PP
X.ti +5n
Xzip -r - . | dd of=/dev/nrst0 obs=16k
X.PP
Xwould write the zip output directly to a tape with the specified block size
Xfor the purpose of backing up the current directory.
X.PP
X.I zip
Xalso accepts a single dash ("-") as the name of a file to be compressed, in
Xwhich case it will read the zip file from stdin, allowing zip to take
Xinput from another program. For example:
X.PP
X.ti +5n
Xtar cf - . | zip backup -
X.PP
Xwould compress the output of the tar command for the purpose of backing up
Xthe current directory. This generally produces better compression than
Xthe previous example using the -r option, because
X.I zip
Xcan take advantage of redundancy between files. The backup can be restored
Xusing the command
X.PP
X.ti +5n
Xunzip -p backup | tar xf -
X.PP
XWhen no zip file name is given and stdout is not a terminal,
X.I zip
Xacts as a filter, compressing standard input to standard output.
XFor example,
X.PP
X.ti +5n
Xtar cf - . | zip | dd of=/dev/nrst0
X.PP
Xis equivalent to
X.PP
X.ti +5n
Xtar cf - . | zip - - | dd of=/dev/nrst0
X.PP
XZip archives created in this manner can be extracted with the program
X.I funzip
Xwhich is provided in the
X.I unzip
Xpackage. For example,
X.PP
X.ti +5n


X dd if=/dev/nrst0 | funzip | tar xvf -

X.SH "MODIFYING EXISTING ZIP FILES"
XWhen given the name of an existing zip file with the above commands,
X.I zip
Xwill replace identically named entries in the
X.I zip
Xfile or add entries for
Xnew names. For example, if foo.zip exists and contains foo/file1 and
Xfoo/file2, and the directory foo contains the files foo/file1 and foo/file3,
Xthen:
X.PP
X.ti +5n
Xzip -r foo foo
X.PP
Xwill replace foo/file1 in foo.zip and add foo/file3 to foo.zip. After
Xthis, foo.zip contains foo/file1, foo/file2, and foo/file3, with foo/file2
Xunchanged from before.
X.PP
XWhen changing an existing zip file,
X.I zip
Xwill write a temporary file with
Xthe new contents, and only replace the old one when the zip has completed
Xwith no errors. You can use
Xthe -b option to specify a different path (usually a different device) to
Xput the temporary file in. For example:
X.PP
X.ti +5n
Xzip -b /tmp stuff *
X.PP
Xwill put the temporary zip file and the temporary compression files in the
Xdirectory "/tmp", copying over stuff.zip in the current directory when
Xdone.
X.PP
XIf you are only adding entries to a zip file, not replacing, and the
X-g option is given, then
X.I zip
Xgrows (appends to) the file instead of copying it. The danger of this is that
Xif the operation fails, the original zip file is corrupted and lost.
X.PP
XThere are two other ways to change or add entries in a zip file that are
Xrestrictions of simple addition or replacement. The first is -u (update)
Xwhich will add new entries to the zip file as before but will replace
Xexisting entries only if the modified date of the file is more recent than
Xthe date recorded for that name in the zip file. For example:
X.PP
X.ti +5n
Xzip -u stuff *
X.PP
Xwill add any new files in the current directory, and update any changed files
Xin the zip file stuff.zip. Note that
X.I zip
Xwill not try to pack stuff.zip into
Xitself when you do this.
X.I zip
Xwill always exclude the zip file from the files on which to be operated.
X.PP
XThe second restriction is -f (freshen) which, like update, will only replace
Xentries with newer files; unlike update, will not add files that are not
Xalready in the zip file. For this option, you may want to simply freshen all
Xof the files that are in the specified zip file. To do this you would simply:
X.PP
X.ti +5n
Xzip -f foo
X.PP
XNote that the -f option with no arguments freshens all the entries in the
Xzip file. The same is true of -u, and hence "zip -u foo" and "zip -f foo"
Xboth do the same thing.
X.PP
XThis command should
Xbe run from the same directory from which the original zip command was run,
Xsince paths stored in zip files are always relative.
X.PP
XAnother restriction that can be used with adding, updating, or freshening is
X-t (time), which will not operate on files modified earlier than the specified
Xdate. For example:
X.PP
X.ti +5n
Xzip -rt 120791 infamy foo
X.PP
Xwill add all the files in foo and its subdirectories that were last modified
Xon December 7, 1991, or later to the zip file infamy.zip.
X.PP
XAlso, files can be explicitly excluded using the -x option:
X.PP
X.ti +5n
Xzip -r foo foo -x \\*.o
X.PP
Xwhich will zip up the contents of foo into foo.zip but exclude all the
Xfiles that end in ".o". Here the backslash causes
X.I zip
Xto match file names
Xthat were found when foo was searched.
X.PP
XThe last operation is -d (delete) which will remove entries from a zip file.
XAn example might be:
X.PP
X.ti +5n
Xzip -d foo foo/tom/junk foo/harry/\\* \\*.o
X.PP
Xwhich will remove the entry foo/tom/junk, all of the files that start with
X"foo/harry/", and all of the files that end with ".o" (in any path). Note
Xthat once again, the shell expansion has been inhibited with backslashes, so
Xthat
X.I zip
Xcan see the asterisks.
X.I zip
Xcan then match on the contents of the zip
Xfile instead of the contents of the current directory.
X.PP
XUnder MSDOS, -d is case sensitive when it matches names in the zip file.
XThis allows deleting names that were zipped on other systems, but requires
Xthat the names be entered in upper case if they were zipped on an MSDOS
Xsystem, so that the names can be found in the zip file and deleted.
X.SH "MORE OPTIONS"
XAs mentioned before,
X.I zip
Xwill use the best of two methods: deflate or store.
X.PP
XThe option -0 will force
X.I zip
Xto use store on all files. For example:
X.PP
X.ti +5n
Xzip -r0 foo foo
X.PP
Xwill zip up the directory foo into foo.zip using only store.
X.PP
XThe speed of deflation can also be controlled with options -1 (fastest
Xmethod but less compression) to -9 (best compression but slower). The
Xdefault value is -5. For example:
X.PP
X.ti +5n
Xzip -r8 foo foo
X.PP
XIn nearly all cases, a file that is already compressed cannot be compressed
Xfurther by
X.I zip,
Xor if it can, the effect is minimal. The -n option prevents
X.I zip
Xfrom trying to compress files that have the given suffixes.
XSuch files are simply stored (0% compression) in the output zip file,
Xso that
X.I zip
Xdoesn't waste its time trying to compress them.


XThe suffixes are separated by

Xeither colons or semicolons. For example:
X.PP
X.ti +5n
Xzip -rn ".Z:.zip:.tiff:.gif:.snd" foo foo
X.PP
Xwill put everything in foo into foo.zip, but will store any files that end
Xin .Z, .zip, .tiff, .gif, or .snd without trying to compress them. (Image
Xand sound files often have their own specialized compression methods.)
XThe default suffix list is ".Z:.zip;.zoo:.arc:.lzh:.arj".
XThe environment variable ZIPOPT can be used to change this default. For


Xexample under Unix with csh:

X.PP
X.ti +5n
Xsetenv ZIPOPT "-n .gif:.zip"
X.PP
XThe variable ZIPOPT can be used for any option and can include several
Xoptions.
X.PP
XUnder Unix and under OS/2 (if files from an HPFS are stored),
X.I zip
Xwill store the full path (relative to the current path) and name of the
Xfile (or just the name if -j is specified) in the zip file along with the
XUnix attributes, and it will mark
Xthe entry as made under Unix. If the zip file is intended for PKUNZIP under
XMSDOS, then the -k (Katz) option should be used to attempt to convert the
Xnames and paths to conform to MSDOS, store only the MSDOS attribute (just
Xthe user write attribute from Unix), and mark the entry as made under MSDOS
X(even though it wasn't).
X.PP
XThe -o (older) option will set the "last modified" time of the zip file to
Xthe latest "last modified" time of the entries in the zip file. This can
Xbe used without any other operations, if desired. For example:
X.PP
X.ti +5n
Xzip -o foo
X.PP
Xwill change the last modified time of foo.zip to the latest time of the
Xentries in foo.zip.
X.PP
XThe -e and -c options operate on all files updated or added to the zip file.
XEncryption (-e) will prompt for a password on the terminal and will
Xnot echo the password as it is typed (if stderr is not a TTY, zip will exit
Xwith an error). New zip entries will be encrypted using that password. For
Xadded peace of mind, you can use -ee, which will prompt for the password
Xtwice, checking that the two are the same before using it. The encryption
Xcode is distributed separately, so the -e option may not be available
Xin your version.
X.PP
XOne-line comments can be added for each file with the -c option. The zip
Xfile operations (adding or updating) will be done first, and you will then be
Xprompted for a one-line comment for each file. You can then enter the comment
Xfollowed by return, or just return for no comment.
X.PP
XThe -z option will prompt you for a multi-line comment for the entire zip
Xfile. This option can be used by itself, or in combination with other
Xoptions. The comment is ended by a line containing just a period, or an end
Xof file condition (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS).
XSince -z reads the
Xlines from stdin, you can simply take the comment from a file:
X.PP
X.ti +5n
Xzip -z foo < foowhat
X.PP
XThe -q (quiet) option eliminates the informational messages and comment prompts
Xwhile
X.I zip
Xis operating. This might be used in shell scripts, for example, or if the
Xzip operation is being performed as a background task ("zip -q foo *.c &").
X.PP
X.I zip
Xcan take a list of file names to operate on from stdin using the -@ option.
XIn Unix, this option can be used with the find command to extend greatly
Xthe functionality of
X.I zip.
XFor example, to zip up all the C source files in the current directory and
Xits subdirectories, you can:
X.PP
X.ti +5n
Xfind . -type f -name "*.[ch]" -print | zip source -@
X.PP
XNote that the pattern must be quoted to keep the shell from expanding it.
X.PP
XUnder VMS only, the -w option will append the version number of the files to
Xthe name and zip up multiple versions of files. Without -w,
X.I zip
Xwill only use the most recent version of the specified file(s).
X.PP
XThe -l option translates the Unix end-of-line character LF into the
XMSDOS convention CR LF. This option should not be used on binary files.
XThis option can be used on Unix if the zip file is intended for PKUNZIP
Xunder MSDOS. If the input files already contain CR LF, this option adds
Xan extra CR. This ensure that "unzip -a" on Unix will get back an exact
Xcopy of the original file, to undo the effect of "zip -l".
X.PP
XIf
X.I zip
Xis run with the -h option, or with no arguments and standard output is
Xa terminal, the license and the command-argument and option help is shown.
XThe -L option just shows the license.
X.SH "ABOUT PATTERN MATCHING"
X(Note: this section applies to Unix. Watch this space for details on MSDOS
Xand VMS operation.)
X.PP
XThe Unix shell (sh or csh) does filename substitution on command arguments.
XThe special characters are ?, which matches any single character; * which
Xmatches any number of characters (including none); and [] which matches any
Xcharacter in the range inside the brackets (like [a\-f] or [0\-9]). When
Xthese characters are encountered (and not escaped with a backslash or
Xquotes), the
Xshell will look for files relative to the current path that match the
Xpattern, and replace the argument with a list of the names that matched.
X.PP
X.I zip
Xcan do the same matching on names that are in the zip file being
Xmodified or, in the case of the -x (exclude) option, on the list of
Xfiles to be operated on, by using backslashes or quotes
Xto tell the shell not to do the name expansion. In general, when
X.I zip
Xencounters a name in the list
Xof files to do, it first looks for the name in the file system. If it
Xfinds it, it then adds it to the list of files to do. If it does not
Xfind it, it will look for the name in the zip file being modified (if it
Xexists), using the pattern matching characters above, if any. For each
Xmatch, it will add that name to the list of files to do. After -x
X(exclude), the names are removed from the to-do list instead of added.
X.PP
XThe pattern matching includes the path, and so patterns like \\*.o match
Xnames that end in ".o", no matter what the path prefix is. Note that the
Xbackslash must precede every special character (i.e. ?*[]), or the entire
Xargument must be enclosed in double quotes ("").
X.PP
XIn general, using backslash to make
X.I zip
Xdo the pattern matching is used
Xwith the -f (freshen) and -d (delete) options, and sometimes after the
X-x (exclude) option when used with any operation (add, -u, -f, or -d).
X.I zip
Xwill never use pattern matching to search the file system. If
X.I zip
Xhas recursed into a directory, all files (and all directories) in there
Xare fair game.
X.SH COPYRIGHT
XCopyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
XKai Uwe Rommel and Igor Mandrichenko.
XPermission is granted to any individual or institution to use, copy, or
Xredistribute this software so long as all of the original files are included
Xunmodified, that it is not sold for profit, and that this copyright notice
Xis retained.
X.SH ACKNOWLEDGEMENTS
XThanks to R. P. Byrne for his Shrink.Pas program which inspired this project;
Xto Phil Katz for making the zip
Xfile format, compression format, and .zip filename extension all public domain;
Xto Steve Burg and Phil Katz for help on unclear points of the deflate format;
Xto Keith Petersen and Rich Wales for providing a mailing list and ftp site for
Xthe INFO-ZIP group to use; and most importantly, to the INFO-ZIP group itself
X(listed in the file infozip.who) without whose tireless testing and bug-fixing
Xefforts a portable
X.I zip
Xwould not have been possible. Finally we should thank (blame) the INFO-ZIP
Xmoderator, David Kirschbaum for getting us into this mess in the first place.
X.SH "SEE ALSO"
Xunzip(1), tar(1), compress(1)
X.SH BUGS
XWARNING: zip files produced by zip 1.9 must not be
X*updated* by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if they contain
Xencrypted members, or if they have been produced in a pipe or on a non
Xseekable device. The old versions of zip or pkzip would destroy the
Xzip structure. The old versions can list the contents of the zip file
Xbut cannot extract it anyway (because of the new compression algorithm).
XIf you do not use encryption and use regular disk files, you do
Xnot have to care about this problem.
X.PP
Xzip 1.9 is compatible with pkzip 1.93a, except when two features
Xare used: encryption or zip file created in a pipe or on a non
Xseekable device. pkzip versions above 2.0 will support such files, and
Xunzip 5.0 already supports them.
X.PP
XWithout -y, when zip must compress a symbolic link to an non existing file,
Xit only displays a warning "name not matched". A better warnign should be
Xgiven.
X.PP
XUnder VMS, not all of the odd file formats are treated properly. Only
Xzip files of format stream-LF and fixed length 512 are expected to work
Xwith zip. Others can be converted using Rahul Dhesi's BILF program.
XThis version of zip does handle some of the conversion internally.
XWhen using Kermit to transfer zip files from Vax to MSDOS, type "set
Xfile type block" on the Vax. When transfering from MSDOS to Vax, type
X"set file type fixed" on the Vax. In both cases, type "set file type
Xbinary" on MSDOS.
X.PP
XUnder VMS, zip hangs for file specification that uses DECnet syntax (foo::*.*).
X.PP
XUnder OS/2, the amount of External Attributes displayed by DIR is (for
Xcompatibility) the amount returned by the 16-bit version of
XDosQueryPathInfo(). Otherwise OS/2 1.3 and 2.0 would report different
XEA sizes when DIRing a file.
XHowever, the structure layout returned by the 32-bit DosQueryPathInfo()
Xis a bit different, it uses extra padding bytes and link pointers (it's
Xa linked list) to have all fields on 4-byte boundaries for portability
Xto future RISC OS/2 versions. Therefore the value reported by ZIP
X(which uses this 32-bit-mode size) differs from that reported by DIR.
XZIP stores the 32-bit format for portability, even the 16-bit
XMS-C-compiled version running on OS/2 1.3, so even this one shows the
X32-bit-mode size.
X.PP
XLIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE
XPROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR
XIMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES
XRESULTING FROM THE USE OF THIS SOFTWARE.
X.PP
XThat having been said, please send any problems or comments via email to
Xthe Internet address
Xzip\-bu...@cs.ucla.edu. For bug reports, please include the
Xversion of zip, the make options you used to compile it, the machine and
Xoperating system you are using, and as much additional information as
Xpossible. Thank you for your support.
END_OF_FILE
if test 21796 -ne `wc -c <'zip.1'`; then
echo shar: \"'zip.1'\" unpacked with wrong size!
fi
# end of 'zip.1'
fi
if test -f 'zip.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zip.h'\"
else
echo shar: Extracting \"'zip.h'\" \(10606 characters\)
sed "s/^X//" >'zip.h' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zip.h by Mark Adler.
X */
X
X
X/* Set up portability */
X#include "tailor.h"
X
X#define MIN_MATCH 3
X#define MAX_MATCH 258
X/* The minimum and maximum match lengths */
X
X#ifndef WSIZE
X# define WSIZE ((unsigned)32768)
X#endif
X/* Maximum window size = 32K. If you are really short of memory, compile
X * with a smaller WSIZE but this reduces the compression ratio for files
X * of size > WSIZE. WSIZE must be a power of two in the current implementation.
X */
X
X#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
X/* Minimum amount of lookahead, except at the end of the input file.
X * See deflate.c for comments about the MIN_MATCH+1.
X */
X
X#define MAX_DIST (WSIZE-MIN_LOOKAHEAD)
X/* In order to simplify the code, particularly on 16 bit machines, match
X * distances are limited to MAX_DIST instead of WSIZE.
X */
X
X/* Define malloc() and string functions */
X#ifdef MODERN
X# include <string.h>
X#else /* !MODERN */
X voidp *malloc();
X char *getenv();
X long atol();
X char *strcpy();
X char *strcat();
X char *strchr();
X char *strrchr();
X# ifndef ZMEM
X char *memset();
X char *memcpy();
X# endif /* !ZMEM */


X#endif /* ?MODERN */
X
X

X/* Define fseek() commands */
X#ifndef SEEK_SET
X# define SEEK_SET 0
X#endif /* !SEEK_SET */
X
X#ifndef SEEK_CUR
X# define SEEK_CUR 1
X#endif /* !SEEK_CUR */
X
X
X/* Forget FILENAME_MAX (incorrectly = 14 on some System V) */
X#ifdef MSDOS
X# define FNMAX 256
X#else /* !MSDOS */
X# define FNMAX 1024


X#endif /* ?MSDOS */
X
X

X/* For setting stdout to binary */


X#ifdef MSDOS
X# include <io.h>

X# include <fcntl.h>


X#endif /* MSDOS */
X
X

X/* Types centralized here for easy modification */
X#define local static /* More meaningful outside functions */
Xtypedef unsigned char uch; /* unsigned 8-bit value */
Xtypedef unsigned short ush; /* unsigned 16-bit value */
Xtypedef unsigned long ulg; /* unsigned 32-bit value */
X
X
X/* Lengths of headers after signatures in bytes */
X#define LOCHEAD 26
X#define CENHEAD 42
X#define ENDHEAD 18
X
X
X/* Structures for in-memory file information */
Xstruct zlist {
X /* See central header in zipfile.c for what vem..off are */
X ush vem, ver, flg, how;
X ulg tim, crc, siz, len;
X extent nam, ext, cext, com; /* offset of ext must be >= LOCHEAD */
X ush dsk, att, lflg; /* offset of lflg must be >= LOCHEAD */
X ulg atx, off;
X char *name; /* File name in zip file */
X char *extra; /* Extra field (set only if ext != 0) */
X char *cextra; /* Extra in central (set only if cext != 0) */
X char *comment; /* Comment (set only if com != 0) */
X char *zname; /* Name for new zip file header */
X int mark; /* Marker for files to operate on */
X int trash; /* Marker for files to delete */
X int dosflag; /* Set to force MSDOS file attributes */
X struct zlist far *nxt; /* Pointer to next header in list */
X};
Xstruct flist {
X char *name; /* Pointer to zero-delimited name */
X char *zname; /* Name used for zip file headers */
X int dosflag; /* Set to force MSDOS file attributes */
X struct flist far * far *lst; /* Pointer to link pointing here */
X struct flist far *nxt; /* Link to next name */
X};
X
X/* internal file attribute */
X#define UNKNOWN (-1)
X#define BINARY 0
X#define ASCII 1
X
X/* Error return codes and PERR macro */
X#include "ziperr.h"
X
X
X/* Public globals */
Xextern uch upper[256]; /* Country dependent case map table */
Xextern uch lower[256];
Xextern char errbuf[]; /* Handy place to build error messages */
Xextern int recurse; /* Recurse into directories encountered */
Xextern int pathput; /* Store path with name */
X
X#define BEST -1 /* Use best method (deflation or store) */
X#define STORE 0 /* Store method */
X#define DEFLATE 8 /* Deflation method*/
Xextern int method; /* Restriction on compression method */
X
Xextern int dosify; /* Make new entries look like MSDOS */
Xextern char *special; /* Don't compress special suffixes */
Xextern int verbose; /* Report oddities in zip file structure */
Xextern int level; /* Compression level */
Xextern int translate_eol; /* Translate end-of-line LF -> CR LF */
X#ifdef VMS
X extern int vmsver; /* Append VMS version number to file names */
X extern int vms_native; /* Store in VMS formait */
X#endif /* VMS */
X#ifdef OS2
X extern int use_longname_ea; /* use the .LONGNAME EA as the file's name */
X#endif /* OS2 */
Xextern int linkput; /* Store symbolic links as such */
Xextern int noisy; /* False for quiet operation */
Xextern char *key; /* Scramble password or NULL */
Xextern char *tempath; /* Path for temporary files */
Xextern FILE *mesg; /* Where informational output goes */
Xextern char *zipfile; /* New or existing zip archive (zip file) */
Xextern ulg zipbeg; /* Starting offset of zip structures */
Xextern ulg cenbeg; /* Starting offset of central directory */
Xextern struct zlist far *zfiles;/* Pointer to list of files in zip file */
Xextern extent zcount; /* Number of files in zip file */
Xextern extent zcomlen; /* Length of zip file comment */
Xextern char *zcomment; /* Zip file comment (not zero-terminated) */
Xextern struct zlist far **zsort;/* List of files sorted by name */
Xextern ulg tempzn; /* Count of bytes written to output zip file */
Xextern struct flist far *found; /* List of names found */
Xextern struct flist far * far *fnxt; /* Where to put next in found list */
Xextern extent fcount; /* Count of names in found list */
X
X
X/* Diagnostic functions */
X#ifdef DEBUG
X# ifdef MSDOS
X# undef stderr
X# define stderr stdout
X# endif
X# define diag(where) fprintf(stderr, "zip diagnostic: %s\n", where)
X# define Assert(cond,msg) {if(!(cond)) error(msg);}
X# define Trace(x) fprintf x
X# define Tracev(x) {if (verbose) fprintf x ;}
X# define Tracevv(x) {if (verbose>1) fprintf x ;}
X# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
X# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
X#else
X# define diag(where)
X# define Assert(cond,msg)
X# define Trace(x)
X# define Tracev(x)
X# define Tracevv(x)
X# define Tracec(c,x)
X# define Tracecv(c,x)
X#endif
X
X
X/* Public function prototypes */
X
X /* in zip.c, zipcloak.c, or zipsplit.c */
Xvoid warn OF((char *, char *));
Xvoid err OF((int c, char *h));
Xvoid error OF((char *h));
X
X /* in zipup.c */
Xint zipcopy OF((struct zlist far *, FILE *, FILE *));
X#ifndef UTIL
X int percent OF((long, long));
X int zipup OF((struct zlist far *, FILE *));
X int file_read OF((char *buf, unsigned size));


X#endif /* !UTIL */
X

X /* in zipfile.c */
X#ifndef UTIL
X struct zlist far *zsearch OF((char *));
X int trash OF((void));
X#endif /* !UTIL */
Xchar *ziptyp OF((char *));
Xint readzipfile OF((void));
Xint putlocal OF((struct zlist far *, FILE *));
Xint putextended OF((struct zlist far *, FILE *));
Xint putcentral OF((struct zlist far *, FILE *));
Xint putend OF((int, ulg, ulg, extent, char *, FILE *));
X
X /* in fileio.c */
X#ifndef UTIL
X# ifdef MSDOS
X int wild OF((char *));
X# endif /* MSDOS */
X# ifdef VMS
X int wild OF((char *));
X# endif /* VMS */
X char *getnam OF((char *));
X struct flist far *fexpel OF((struct flist far *));
X char *in2ex OF((char *));
X int exclude OF((void));
X int procname OF((char *));
X void stamp OF((char *, ulg));
X ulg dostime OF((int, int, int, int, int, int));
X ulg filetime OF((char *, ulg *, long *));
X int issymlnk OF((ulg a));
X# ifdef S_IFLNK
X# define rdsymlnk(p,b,n) readlink(p,b,n)
X extern int readlink OF((char *, char *, int));
X# else /* !S_IFLNK */
X# define rdsymlnk(p,b,n) (0)
X# endif /* !S_IFLNK */
X int deletedir OF((char *));
X#endif /* !UTIL */
Xint destroy OF((char *));
Xint replace OF((char *, char *));
Xint getfileattr OF((char *));
Xint setfileattr OF((char *, int));
Xchar *tempname OF((char *));
Xint fcopy OF((FILE *, FILE *, ulg));
X#ifdef CRYPT
X# ifndef MSVMS
X void echoff OF((int));
X void echon OF((void));
X# endif /* !MSVMS */
X char *getp OF((char *, char *, int));
X#endif /* !CRYPT */
X#ifdef ZMEM
X char *memset OF((char *, int, unsigned int));
X char *memcpy OF((char *, char *, unsigned int));
X int memcmp OF((char *, char *, unsigned int));


X#endif /* ZMEM */
X

X /* in crypt.c */
X#ifndef CRYPT
X# define zfwrite fwrite
X# define zputc putc
X#else /* CRYPT */
X void crypthead OF((char *, ulg, FILE *));
X# ifdef UTIL
X int zipcloak OF ((struct zlist far *, FILE *, FILE *, char *));
X int zipbare OF ((struct zlist far *, FILE *, FILE *, char *));
X# else /* !UTIL */
X unsigned zfwrite OF((voidp *, extent, extent, FILE *));
X int zencode OF((int c));
X extern char *key;
X# define zputc(c,f) (putc(key!=NULL? zencode(c) : (c),(f)))
X# endif /* ?UTIL */


X#endif /* ?CRYPT */
X

X /* in util.c */
Xchar *isshexp OF((char *));
Xint shmatch OF((char *, char *));
X#ifdef MSDOS
X int dosmatch OF((char *, char *));
X#endif /* MSDOS */
Xvoid init_upper OF((void));
Xint namecmp OF((char *string1, char *string2));
Xvoidp far **search OF((voidp *, voidp far **, extent,
X int (*)(voidp *, voidp far *)));
Xulg crc32 OF((ulg, int));
Xulg updcrc OF((char *, extent));
X
X#ifndef UTIL
X /* in deflate.c */
Xvoid lm_init OF((int pack_level, ush *flags));
Xulg deflate OF((void));
X
X /* in trees.c */
Xvoid ct_init OF((ush *attr, int *method));
Xint ct_tally OF((int dist, int lc));
Xulg flush_block OF((char far *buf, ulg stored_len, int eof));
X
X /* in bits.c */
Xvoid bi_init OF((FILE *zipfile));
Xvoid send_bits OF((int value, int length));
Xunsigned bi_reverse OF((unsigned value, int length));
Xvoid bi_windup OF((void));
Xvoid copy_block OF((char far *buf, unsigned len, int header));
Xint seekable OF((void));
Xextern int (*read_buf) OF((char *buf, unsigned size));
Xulg memcompress OF((char *tgt, ulg tgtsize, char *src, ulg srcsize));


X
X#endif /* !UTIL */
X
X

X/* end of zip.h */
END_OF_FILE
if test 10606 -ne `wc -c <'zip.h'`; then
echo shar: \"'zip.h'\" unpacked with wrong size!
fi
# end of 'zip.h'
fi
if test -f 'zipfile.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zipfile.c'\"
else
echo shar: Extracting \"'zipfile.c'\" \(24578 characters\)
sed "s/^X//" >'zipfile.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zipfile.c by Mark Adler.


X */
X
X#include "zip.h"
X

X#ifdef VMS
X# include "VMSmunch.h"

X# include <rms.h>
X#endif
X
X
X/* Macros for converting integers in little-endian to machine format */
X#define SH(a) (((ush)(uch)(a)[0]) | (((ush)(uch)(a)[1]) << 8))
X#define LG(a) ((ulg)SH(a) | ((ulg)SH((a)+2) << 16))
X
X/* Macros for writing machine integers to little-endian format */
X#define PUTSH(a,f) {putc((char)(a),(f)); putc((char)((a) >> 8),(f));}
X#define PUTLG(a,f) {PUTSH(a,f) PUTSH((a) >> 16,f)}
X
X
X/* -- Structure of a ZIP file -- */
X
X/* Signatures for zip file information headers */
X#define LOCSIG 0x04034b50L
X#define CENSIG 0x02014b50L
X#define ENDSIG 0x06054b50L
X#define EXTLOCSIG 0x08074b50L
X
X/* Offsets of values in headers */
X#define LOCVER 0 /* version needed to extract */
X#define LOCFLG 2 /* encrypt, deflate flags */
X#define LOCHOW 4 /* compression method */
X#define LOCTIM 6 /* last modified file time, DOS format */
X#define LOCDAT 8 /* last modified file date, DOS format */
X#define LOCCRC 10 /* uncompressed crc-32 for file */
X#define LOCSIZ 14 /* compressed size in zip file */
X#define LOCLEN 18 /* uncompressed size */
X#define LOCNAM 22 /* length of filename */
X#define LOCEXT 24 /* length of extra field */
X
X#define CENVEM 0 /* version made by */
X#define CENVER 2 /* version needed to extract */
X#define CENFLG 4 /* encrypt, deflate flags */
X#define CENHOW 6 /* compression method */
X#define CENTIM 8 /* last modified file time, DOS format */
X#define CENDAT 10 /* last modified file date, DOS format */
X#define CENCRC 12 /* uncompressed crc-32 for file */
X#define CENSIZ 16 /* compressed size in zip file */
X#define CENLEN 20 /* uncompressed size */
X#define CENNAM 24 /* length of filename */
X#define CENEXT 26 /* length of extra field */
X#define CENCOM 28 /* file comment length */
X#define CENDSK 30 /* disk number start */
X#define CENATT 32 /* internal file attributes */
X#define CENATX 34 /* external file attributes */
X#define CENOFF 38 /* relative offset of local header */
X
X#define ENDDSK 0 /* number of this disk */
X#define ENDBEG 2 /* number of the starting disk */
X#define ENDSUB 4 /* entries on this disk */
X#define ENDTOT 6 /* total number of entries */
X#define ENDSIZ 8 /* size of entire central directory */
X#define ENDOFF 12 /* offset of central on starting disk */
X#define ENDCOM 16 /* length of zip file comment */
X


X
X/* Local functions */
X#ifdef PROTO

X local int zqcmp(voidp *, voidp *);
X# ifndef UTIL
X local int zbcmp(voidp *, voidp far *);
X local char *cutpath(char *);
X# endif /* !UTIL */


X#endif /* PROTO */
X
X

Xlocal int zqcmp(a, b)
Xvoidp *a, *b; /* pointers to pointers to zip entries */
X/* Used by qsort() to compare entries in the zfile list. */
X{
X return namecmp((*(struct zlist far **)a)->zname,
X (*(struct zlist far **)b)->zname);


X}
X
X
X#ifndef UTIL

X
Xlocal int zbcmp(n, z)
Xvoidp *n; /* string to search for */
Xvoidp far *z; /* pointer to a pointer to a zip entry */
X/* Used by search() to compare a target to an entry in the zfile list. */
X{
X return namecmp((char *)n, ((struct zlist far *)z)->zname);
X}
X
X
Xstruct zlist far *zsearch(n)
Xchar *n; /* name to find */
X/* Return a pointer to the entry in zfile with the name n, or NULL if
X not found. */
X{
X voidp far **p; /* result of search() */
X
X if (zcount && (p = search(n, (voidp far **)zsort, zcount, zbcmp)) != NULL)
X return *(struct zlist far **)p;
X else


X return NULL;
X}
X

X#endif /* !UTIL */
X

X#ifndef VMS
X# define PATHCUT '/'
X
Xchar *ziptyp(s)
Xchar *s; /* file name to force to zip */
X/* If the file name *s has a dot (other than the first char), then return
X the name, otherwise append .zip to the name. Allocate the space for
X the name in either case. Return a pointer to the new name, or NULL
X if malloc() fails. */
X{
X char *q; /* temporary pointer */
X char *t; /* pointer to malloc'ed string */
X
X if ((t = malloc(strlen(s) + 5)) == NULL)
X return NULL;
X strcpy(t, s);
X#ifdef MSDOS
X for (q = t; *q; q++)


X if (*q == '\\')

X *q = '/';
X#endif /* MSDOS */
X if (strrchr((q = strrchr(t, PATHCUT)) == NULL ? t : q + 1, '.') == NULL)
X strcat(t, ".zip");
X#if defined(FORCE_UPPER) && defined(MSDOS) && !defined(OS2)
X strupr(t);
X#endif
X return t;
X}
X
X#else /* VMS */
X
X# define PATHCUT ']'
X
Xchar *ziptyp(s)
Xchar *s;
X{ int status;


X struct FAB fab;
X struct NAM nam;

X static char zero=0;
X char result[NAM$C_MAXRSS+1],exp[NAM$C_MAXRSS+1];
X char *p;
X
X fab = cc$rms_fab;
X nam = cc$rms_nam;
X
X fab.fab$l_fna = s;
X fab.fab$b_fns = strlen(fab.fab$l_fna);
X
X fab.fab$l_dna = "sys$disk:[].zip"; /* Default fspec */
X fab.fab$b_dns = strlen(fab.fab$l_dna);
X
X fab.fab$l_nam = &nam;
X
X nam.nam$l_rsa = result; /* Put resultant name of */
X nam.nam$b_rss = sizeof(result)-1; /* existing zipfile here */
X
X nam.nam$l_esa = exp; /* For full spec of */
X nam.nam$b_ess = sizeof(exp)-1; /* file to create */
X
X status = sys$parse(&fab);
X if( (status & 1) == 0 )
X return &zero;
X
X status = sys$search(&fab);
X if( status & 1 )
X { /* Existing ZIP file */
X int l;
X if( (p=malloc( (l=nam.nam$b_rsl) + 1 )) != NULL )
X { result[l] = 0;
X strcpy(p,result);
X }
X }
X else
X { /* New ZIP file */
X int l;
X if( (p=malloc( (l=nam.nam$b_esl) + 1 )) != NULL )
X { exp[l] = 0;
X strcpy(p,exp);
X }
X }


X return p;
X}
X

X#endif /* VMS */
X
X

Xint readzipfile()
X/*
X Make first pass through zip file, reading information from local file
X headers and then verifying that information with the central file
X headers. Any deviation from the expected zip file format returns an
X error. At the end, a sorted list of file names in the zip file is made
X to facilitate searching by name.
X
X The name of the zip file is pointed to by the global "zipfile". The
X globals zfiles, zcount, zcomlen, zcomment, and zsort are filled in.
X Return an error code in the ZE_ class.
X*/
X{
X char b[CENHEAD]; /* buffer for central headers */
X FILE *f; /* zip file */
X ush flg; /* general purpose bit flag */
X int m; /* mismatch flag */
X extent n; /* length of name */
X ulg p; /* current file offset */
X char r; /* holds reserved bits during memcmp() */
X ulg s; /* size of data, start of central */
X char *t; /* temporary variable */
X char far *u; /* temporary variable */
X struct zlist far * far *x; /* pointer last entry's link */
X struct zlist far *z; /* current zip entry structure */
X
X /* Initialize zip file info */
X zipbeg = 0;
X zfiles = NULL; /* Points to first header */
X zcomlen = 0; /* zip file comment length */
X
X /* If zip file exists, read headers and check structure */
X#ifdef VMS
X if (zipfile == NULL || !(*zipfile) || !strcmp(zipfile, "-"))
X return ZE_OK;
X {
X int rtype;
X VMSmunch(zipfile, GET_RTYPE, (char *)&rtype);
X if (rtype == FAT$C_VARIABLE) {
X fprintf(stderr,
X "\n Error: zipfile is in variable-length record format. Please\n\
X run \"bilf b %s\" to convert the zipfile to fixed-length\n\
X record format. (Bilf.exe, bilf.c and make_bilf.com are included\n\
X in the VMS UnZip distribution.)\n\n", zipfile);
X return ZE_FORM;
X }
X }
X if ((f = fopen(zipfile, FOPR)) != NULL)
X#else /* !VMS */
X if (zipfile != NULL && *zipfile && strcmp(zipfile, "-") &&
X (f = fopen(zipfile, FOPR)) != NULL)
X#endif /* ?VMS */
X {
X x = &zfiles; /* first link */
X p = 0; /* starting file offset */
X zcount = 0; /* number of files */
X
X /* Find start of zip structures */
X for (;;) {
X while ((m = getc(f)) != EOF && m != 'P') p++;
X b[0] = (char) m;
X if (fread(b+1, 3, 1, f) != 1 || (s = LG(b)) == LOCSIG || s == ENDSIG)
X break;
X if (fseek(f, -3L, SEEK_CUR))
X return ferror(f) ? ZE_READ : ZE_EOF;
X p++;
X }
X zipbeg = p;
X
X /* Read local headers */
X while (LG(b) == LOCSIG)
X {
X /* Read local header raw to compare later with central header
X (this requires that the offest of ext in the zlist structure
X be greater than or equal to LOCHEAD) */


X if ((z = (struct zlist far *)farmalloc(sizeof(struct zlist))) == NULL)

X return ZE_MEM;
X if (fread(b, LOCHEAD, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X t = b; u = (char far *)z; n = LOCHEAD;
X do {
X *u++ = *t++;
X } while (--n);
X
X /* Link into list */
X *x = z;


X z->nxt = NULL;

X x = &z->nxt;
X
X /* Read file name and extra field and skip data */
X n = SH(LOCNAM + (uch far *)z);
X z->ext = SH(LOCEXT + (uch far *)z);
X s = LG(LOCSIZ + (uch far *)z);
X if (n == 0)
X {
X sprintf(errbuf, "%d", zcount + 1);
X warn("zero-length name for entry #", errbuf);
X return ZE_FORM;
X }
X if ((z->zname = malloc(n+1)) == NULL ||
X (z->ext && (z->extra = malloc(z->ext)) == NULL))
X return ZE_MEM;
X if (fread(z->zname, n, 1, f) != 1 ||
X (z->ext && fread(z->extra, z->ext, 1, f) != 1) ||
X fseek(f, (long)s, SEEK_CUR))
X return ferror(f) ? ZE_READ : ZE_EOF;
X /* If there is an extended local header, s is either 0 or
X * the correct compressed size.
X */
X z->zname[n] = 0; /* terminate name */
X#ifdef UTIL
X z->name = z->zname;
X#else /* !UTIL */
X z->name = in2ex(z->zname); /* convert to external name */
X if (z->name == NULL)
X return ZE_MEM;
X#endif /* ?UTIL */
X
X /* Save offset, update for next header */
X z->off = p;
X p += 4 + LOCHEAD + n + z->ext + s;
X zcount++;
X
X /* Skip extended local header if there is one */
X flg = SH(b+LOCFLG);
X if ((flg & 8) != 0) {
X /* Skip the compressed data if compressed size is unknown.
X * For safety, we should use the central directory.
X */
X if (s == 0) {
X for (;;) {
X while ((m = getc(f)) != EOF && m != 'P') ;
X b[0] = (char) m;
X if (fread(b+1, 15, 1, f) != 1 || LG(b) == EXTLOCSIG)
X break;
X if (fseek(f, -15L, SEEK_CUR))
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X s = LG(b+8);
X p += s;
X if ((ulg) ftell(f) != p+16L) {
X warn("bad extended local header for ", z->zname);
X return ZE_FORM;
X }
X } else {
X /* compressed size non zero, assume that it is valid: */
X if (fseek(f, p, SEEK_SET) || fread(b, 16, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X if (LG(b) != EXTLOCSIG) {
X warn("extended local header not found for ", z->zname);
X return ZE_FORM;
X }
X }
X /* overwrite the unknown values of the local header: */
X t = b+4; u = (char far *)z+LOCCRC; n = 12;
X do {
X *u++ = *t++;
X } while (--n);
X p += 16L;
X }
X /* Read next signature */
X if (fread(b, 4, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X
X /* Point to start of header list and read central headers */
X z = zfiles;
X s = p; /* save start of central */
X while (LG(b) == CENSIG)
X {
X if (z == NULL)
X {
X warn("extraneous central header signature", "");
X return ZE_FORM;
X }
X
X /* Read central header */
X if (fread(b, CENHEAD, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X
X /* Compare local header with that part of central header (except
X for the reserved bits in the general purpose flags and except
X for length of extra fields--authentication can make these
X different in central and local headers) */
X z->lflg = SH(LOCFLG + (uch far *)z); /* Save reserved bits */
X r = b[CENFLG+1];
X ((uch far *)z)[LOCFLG+1] &= 0x1f; /* Zero out reserved bits */
X b[CENFLG+1] &= 0x1f;
X for (m = 0, u = (char far *)z, n = 0; n < LOCHEAD - 2; n++)
X if (u[n] != b[n+2])
X {
X if (!m)
X warn("local and central headers differ for ", z->zname);
X m = 1;
X sprintf(errbuf, " offset %d--local = %02x, central = %02x",
X n, (uch)u[n], (uch)b[n+2]);
X warn(errbuf, "");
X }
X if (m)
X return ZE_FORM;
X b[CENFLG+1] = r; /* Restore reserved bits */
X
X /* Overwrite local header with translated central header */
X z->vem = SH(CENVEM + b);
X z->ver = SH(CENVER + b);
X z->flg = SH(CENFLG + b); /* may be different from z->lflg */
X z->how = SH(CENHOW + b);
X z->tim = LG(CENTIM + b); /* time and date into one long */
X z->crc = LG(CENCRC + b);
X z->siz = LG(CENSIZ + b);
X z->len = LG(CENLEN + b);
X z->nam = SH(CENNAM + b);
X z->cext = SH(CENEXT + b); /* may be different from z->ext */
X z->com = SH(CENCOM + b);
X z->dsk = SH(CENDSK + b);
X z->att = SH(CENATT + b);
X z->atx = LG(CENATX + b);
X if (z->off != LG(CENOFF + b))
X {
X warn("local offset in central header incorrect for ", z->zname);
X return ZE_FORM;
X }
X
X /* Compare name and extra fields and read comment field */
X if ((t = malloc(z->nam)) == NULL)
X return ZE_MEM;
X if (fread(t, z->nam, 1, f) != 1)
X {
X free((voidp *)t);
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X if (memcmp(t, z->zname, z->nam))
X {
X free((voidp *)t);
X warn("names in local and central differ for ", z->zname);
X return ZE_FORM;
X }
X free((voidp *)t);
X if (z->cext)
X {
X if ((z->cextra = malloc(z->cext)) == NULL)
X return ZE_MEM;
X if (fread(z->cextra, z->cext, 1, f) != 1)
X {
X free((voidp *)(z->cextra));
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X if (z->ext == z->cext && memcmp(z->extra, z->cextra, z->ext) == 0)
X {
X free((voidp *)(z->cextra));
X z->cextra = z->extra;
X }
X }
X if (z->com)
X {
X if ((z->comment = malloc(z->com)) == NULL)
X return ZE_MEM;
X if (fread(z->comment, z->com, 1, f) != 1)
X {
X free((voidp *)(z->comment));
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X }
X
X /* Note oddities */
X if (verbose)
X {
X if (z->vem != 10 && z->vem != 11 && z->vem != 20 &&
X (n = z->vem >> 8) != 3 && n != 2 && n != 6 && n != 0)
X {
X sprintf(errbuf, "made by version %d.%d on system type %d: ",
X (ush)(z->vem & 0xff) / (ush)10,
X (ush)(z->vem & 0xff) % (ush)10, z->vem >> 8);
X warn(errbuf, z->zname);
X }
X if (z->ver != 10 && z->ver != 11 && z->ver != 20)
X {
X sprintf(errbuf, "needs unzip %d.%d on system type %d: ",
X (ush)(z->ver & 0xff) / (ush)10,
X (ush)(z->ver & 0xff) % (ush)10, z->ver >> 8);
X warn(errbuf, z->zname);
X }
X if (z->flg != z->lflg)
X {
X sprintf(errbuf, "local flags = 0x%04x, central = 0x%04x: ",
X z->lflg, z->flg);
X warn(errbuf, z->zname);
X }
X else if (z->flg & ~0xf)
X {
X sprintf(errbuf, "undefined bits used in flags = 0x%04x: ", z->flg);
X warn(errbuf, z->zname);
X }
X if (z->how > DEFLATE)
X {
X sprintf(errbuf, "unknown compression method %u: ", z->how);
X warn(errbuf, z->zname);
X }
X if (z->dsk)
X {
X sprintf(errbuf, "starts on disk %u: ", z->dsk);
X warn(errbuf, z->zname);
X }
X if (z->att & ~1)
X {
X sprintf(errbuf, "unknown internal attributes = 0x%04x: ", z->att);
X warn(errbuf, z->zname);
X }
X if (((n = z->vem >> 8) != 3) && n != 2 && z->atx & ~0xffL)
X {
X sprintf(errbuf, "unknown external attributes = 0x%08lx: ", z->atx);
X warn(errbuf, z->zname);
X }
X if (z->ext || z->cext)
X if (z->ext == z->cext && z->extra == z->cextra)
X {
X sprintf(errbuf, "has %d bytes of extra data: ", z->ext);
X warn(errbuf, z->zname);
X }
X else
X {
X sprintf(errbuf,
X "local extra (%d bytes) != central extra (%d bytes): ",
X z->ext, z->cext);
X warn(errbuf, z->zname);
X }
X }
X
X /* Clear actions */


X z->mark = 0;

X z->trash = 0;
X
X /* Update file offset */
X p += 4 + CENHEAD + z->nam + z->cext + z->com;
X
X /* Advance to next header structure */
X z = z->nxt;
X
X /* Read next signature */
X if (fread(b, 4, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X
X /* Read end header */
X if (z != NULL || LG(b) != ENDSIG)
X {
X warn("missing end signature--probably not a zip file (did you", "");
X warn("remember to use binary mode when you transferred it?)", "");
X return ZE_FORM;
X }
X if (fread(b, ENDHEAD, 1, f) != 1)
X return ferror(f) ? ZE_READ : ZE_EOF;
X if (SH(ENDDSK + b) || SH(ENDBEG + b) ||
X SH(ENDSUB + b) != SH(ENDTOT + b))
X warn("multiple disk information ignored", "");
X if (zcount != SH(ENDSUB + b))
X {
X warn("count in end of central directory incorrect", "");
X return ZE_FORM;
X }
X if (LG(ENDSIZ + b) != p - s)
X {
X warn("central directory size is incorrect (made by stzip?)", "");
X /* stzip 0.9 gets this wrong, so be tolerant */
X /* return ZE_FORM; */
X }
X if (LG(ENDOFF + b) != s)
X {
X warn("central directory start is incorrect", "");
X return ZE_FORM;
X }
X cenbeg = s;
X zcomlen = SH(ENDCOM + b);
X if (zcomlen)
X {
X if ((zcomment = malloc(zcomlen)) == NULL)
X return ZE_MEM;
X if (fread(zcomment, zcomlen, 1, f) != 1)
X {
X free((voidp *)zcomment);
X return ferror(f) ? ZE_READ : ZE_EOF;
X }
X }
X if (zipbeg)
X {
X sprintf(errbuf, " has a preamble of %ld bytes", zipbeg);
X warn(zipfile, errbuf);
X }
X if (getc(f) != EOF)
X warn("garbage at end of zip file ignored", "");
X
X /* Done with zip file for now */
X fclose(f);
X
X /* If one or more files, sort by name */
X if (zcount)
X {
X if ((x = zsort =
X (struct zlist far **)malloc(zcount * sizeof(struct zlist far *))) ==
X NULL)
X return ZE_MEM;


X for (z = zfiles; z != NULL; z = z->nxt)

X *x++ = z;
X qsort((char *)zsort, zcount, sizeof(struct zlist far *), zqcmp);


X }
X }
X return ZE_OK;
X}
X
X

Xint putlocal(z, f)
Xstruct zlist far *z; /* zip entry to write local header for */
XFILE *f; /* file to write to */
X/* Write a local header described by *z to file *f. Return an error code


X in the ZE_ class. */
X{

X PUTLG(LOCSIG, f);
X PUTSH(z->ver, f);
X PUTSH(z->lflg, f);
X PUTSH(z->how, f);
X PUTLG(z->tim, f);
X PUTLG(z->crc, f);
X PUTLG(z->siz, f);
X PUTLG(z->len, f);
X PUTSH(z->nam, f);
X PUTSH(z->ext, f);
X if (fwrite(z->zname, 1, z->nam, f) != z->nam ||
X (z->ext && fwrite(z->extra, 1, z->ext, f) != z->ext))
X return ZE_TEMP;


X return ZE_OK;
X}
X

Xint putextended(z, f)
Xstruct zlist far *z; /* zip entry to write local header for */
XFILE *f; /* file to write to */
X/* Write an extended local header described by *z to file *f.
X * Return an error code in the ZE_ class. */
X{
X PUTLG(EXTLOCSIG, f);
X PUTLG(z->crc, f);
X PUTLG(z->siz, f);
X PUTLG(z->len, f);


X return ZE_OK;
X}
X

Xint putcentral(z, f)
Xstruct zlist far *z; /* zip entry to write central header for */
XFILE *f; /* file to write to */
X/* Write a central header described by *z to file *f. Return an error code


X in the ZE_ class. */
X{

X PUTLG(CENSIG, f);
X PUTSH(z->vem, f);
X PUTSH(z->ver, f);
X PUTSH(z->flg, f);
X PUTSH(z->how, f);
X PUTLG(z->tim, f);
X PUTLG(z->crc, f);
X PUTLG(z->siz, f);
X PUTLG(z->len, f);
X PUTSH(z->nam, f);
X PUTSH(z->cext, f);
X PUTSH(z->com, f);
X PUTSH(z->dsk, f);
X PUTSH(z->att, f);
X PUTLG(z->atx, f);
X PUTLG(z->off, f);
X if (fwrite(z->zname, 1, z->nam, f) != z->nam ||
X (z->cext && fwrite(z->cextra, 1, z->cext, f) != z->cext) ||
X (z->com && fwrite(z->comment, 1, z->com, f) != z->com))
X return ZE_TEMP;


X return ZE_OK;
X}
X
X

Xint putend(n, s, c, m, z, f)
Xint n; /* number of entries in central directory */
Xulg s, c; /* size and offset of central directory */
Xextent m; /* length of zip file comment (0 if none) */
Xchar *z; /* zip file comment if m != 0 */
XFILE *f; /* file to write to */
X/* Write the end of central directory data to file *f. Return an error code


X in the ZE_ class. */
X{

X PUTLG(ENDSIG, f);
X PUTSH(0, f);
X PUTSH(0, f);
X PUTSH(n, f);
X PUTSH(n, f);
X PUTLG(s, f);
X PUTLG(c, f);
X PUTSH(m, f);
X if (m && fwrite(z, 1, m, f) != m)
X return ZE_TEMP;
X return ZE_OK;


X}
X
X
X#ifndef UTIL

X
Xlocal char *cutpath(p)
Xchar *p; /* path string */
X/* Cut the last path component off the name *p in place. Return p. */
X{
X char *r; /* pointer to last path delimiter */
X
X#ifdef VMS /* change [w.x.y]z to [w.x]y.DIR */
X if ((r = strrchr(p, ']')) != NULL)
X {
X *r = 0;
X if ((r = strrchr(p, '.')) != NULL)
X {
X *r = ']';
X strcat(r, ".DIR"); /* this assumes a little padding--see PAD */
X }
X else
X *p = 0;
X }
X else
X *p = 0;
X#else /* !VMS */ /* change w/x/y/z to w/x/y */
X if ((r = strrchr(p, '/')) != NULL)
X *r = 0;
X else
X *p = 0;
X#endif /* ?VMS */


X return p;
X}
X
X

Xint trash()
X/* Delete the compressed files and the directories that contained the deleted
X files, if empty. Return an error code in the ZE_ class. Failure of
X destroy() or deletedir() is ignored. */
X{
X extent i; /* counter on deleted names */
X extent k; /* number of deleted directories this pass */
X extent n; /* number of deleted names left to handle */
X struct zlist far **s; /* table of zip entries to handle, sorted */
X struct zlist far *z; /* current zip entry */
X
X /* Count and delete marked names */
X n = 0;


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark || z->trash)
X {
X z->mark = 1;
X n++;
X if (verbose)
X printf("zip diagnostic: trashing file %s\n", z->name);
X destroy(z->name);
X }
X
X /* Try to delete all paths that lead up to marked names */
X if (n)
X {
X if ((s = (struct zlist far **)malloc((n+1)*sizeof(struct zlist far *))) ==
X NULL ||
X (s[0] = (struct zlist far *)farmalloc(sizeof(struct zlist))) == NULL)
X return ZE_MEM;
X s[0]->name = "";
X s++;
X do {
X n = k = 0;


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark)
X s[n++] = z;
X qsort((char *)s, n, sizeof(struct zlist far *), zqcmp);
X for (i = 0; i < n; i++)
X if (*cutpath(s[i]->name) && strcmp(s[i]->name, s[i-1]->name))
X {
X if (verbose)
X printf("zip diagnostic: trashing directory %s\n", s[i]->name);
X deletedir(s[i]->name);
X k++;
X }
X else
X s[i]->mark = 0;
X } while (k);
X farfree((voidp far *)((--s)[0]));
X free((voidp *)s);
X }
X return ZE_OK;


X}
X
X#endif /* !UTIL */

END_OF_FILE
if test 24578 -ne `wc -c <'zipfile.c'`; then
echo shar: \"'zipfile.c'\" unpacked with wrong size!
fi
# end of 'zipfile.c'
fi
echo shar: End of archive 6 \(of 11\).
cp /dev/null ark6isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:47:39 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 99
Archive-name: zip19/part07

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: msdos/makefile.gcc.UU vms/vms.c vms/vms_zip.rnh zipsplit.c
# Wrapped by kent@sparky on Sun Aug 23 01:00:45 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 7 (of 11)."'
if test -f 'msdos/makefile.gcc.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/makefile.gcc.UU'\"
else
echo shar: Extracting \"'msdos/makefile.gcc.UU'\" \(2879 characters\)
sed "s/^X//" >'msdos/makefile.gcc.UU' <<'END_OF_FILE'
Xbegin 666 msdos/makefile.gcc
XM(R!-86ME9FEL92!F;W(@6FEP+"!::7!#;&]A:RP@6FEP3F]T92!A;F0@6FEP
XM4W!L:70@9F]R#0HC(&1J9V-C(#$N,#8-"@T*0U)94%1//0T*0TQ/04L]#0I#
XM4D9,04<]#0H-"B,@("HJ*B!&;W(@96YC<GEP=&EO;B!V97)S:6]N+"!R96UO
XM=F4@=&AE(",@870@=&AE(&9R;VYT(&]F(&YE>'0@,R!L:6YE<R J*BH-"B-#
XM4EE05$\]8W)Y<'0N;PT*(T-,3T%+/7II<&-L;V%K+F5X90T*(T-21DQ!1STM
XM1$-265!4#0H-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$%'4RD@)"A/0DI:*2 D*$]"
XM2DDI("UO("1 #0H)86]U=#)E>&4@)$ -"@ED96P@)$ -"@T*>FEP8VQO86LZ
XM("0H3T)*0RD-"@DD*$Q$*2 D*$Q$1DQ!1U,I("0H3T)*0RD@+6\@)$ -"@EA
XM;W5T,F5X92 D0 T*"61E;" D0 T*#0IZ:7!N;W1E.B D*$]"2DXI#0H))"A,
XM1"D@)"A,1$9,04=3*2 D*$]"2DXI("UO("1 #0H)86]U=#)E>&4@)$ -"@ED
XM96P@)$ -"@T*>FEP<W!L:70Z("0H3T)*4RD-"@DD*$Q$*2 D*$Q$1D%'4RD@
XF)"A/0DI3*2 M;R D0 T*"6%O=70R97AE("1 #0H)9&5L("1 #0I$
X
Xend
END_OF_FILE
if test 2879 -ne `wc -c <'msdos/makefile.gcc.UU'`; then
echo shar: \"'msdos/makefile.gcc.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/makefile.gcc'\" \(2063 characters\)
cat msdos/makefile.gcc.UU | uudecode
if test 2063 -ne `wc -c <'msdos/makefile.gcc'`; then
echo shar: \"'msdos/makefile.gcc'\" uudecoded with wrong size!
else
rm msdos/makefile.gcc.UU
fi
fi
# end of 'msdos/makefile.gcc.UU'
fi
if test -f 'vms/vms.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/vms.c'\"
else
echo shar: Extracting \"'vms/vms.c'\" \(18616 characters\)
sed "s/^X//" >'vms/vms.c' <<'END_OF_FILE'
X/*************************************************************************
X * *
X * VMS portions copyright (C) 1992 Igor Mandrichenko. *
X * Permission is granted to any individual or institution to use, copy, *
X * or redistribute this software so long as all of the original files *
X * are included unmodified, that it is not sold for profit, and that *
X * this copyright notice is retained. *
X * *
X *************************************************************************/
X
X/*
X * vms.c (zip) by Igor Mandrichenko Version 2.1-1
X *
X * Revision history:
X * ...
X * 2.1-1 16-feb-1992 I.Mandrichenko
X * Get file size from XABFHC and check bytes rest in file before
X * reading.
X * 2.1-2 2-mar-1992 I.Mandrichenko
X * Make code more standard
X * 2.2 21-jun-1992 I.Mandrichenko
X * Free all allocated space, use more static storage.
X * Use memcompress() from bits.c (deflation) for block compression.
X * To revert to old compression method #define OLD_COMPRESS
X */
X
X#ifdef VMS /* For VMS only ! */
X
X#define OLD_COMPRESS /*To use old compression method define it.*/
X
X#include <rms.h>
X#include <descrip.h>
X#include <syidef.h>
X
X#ifndef VAXC
X /* This definition may be missed */
Xstruct XAB {
X unsigned char xab$b_cod;
X unsigned char xab$b_bln;
X short int xabdef$$_fill_1;
X char *xab$l_nxt;
X};
X
X#endif
X
X#ifndef SYI$_VERSION
X#define SYI$_VERSION 4096 /* VMS 5.4 definition */
X#endif
X
X#include "zip.h"
X
X#define ERR(s) !((s)&1)
X
X#define RET_ERROR 1
X#define RET_SUCCESS 0
X#define RET_EOF 0
X
X#define Kbyte 1024
X
Xtypedef struct XAB *xabptr;
X
X/*
X* Extra record format
X* ===================
X* signature (2 bytes) = 'I','M'
X* size (2 bytes)
X* block signature (4 bytes)
X* flags (2 butes)
X* uncomprssed size(2 bytes)
X* reserved (4 bytes)
X* data (size-12 bytes)
X* ....
X*/
X
X
X/*
X* Extra field signature and block signatures
X*/
X#define SIGNATURE "IM"
X#define EXTBSL 4 /* Block signature length */
X#define RESL 8
X
X#define BC_MASK 07 /* 3 bits for compression type */
X#define BC_STORED 0 /* Stored */
X#define BC_00 1 /* 0byte -> 0bit compression */
X#define BC_DEFL 2 /* Deflated */
X
Xstruct extra_block
X{ ush im_sig;
X ush size;
X ulg block_sig;
X ush flags;
X ush length;
X ulg reserved;
X uch body[1]; /* The actual size is unknown */
X};
X
X#define FABSIG "VFAB"
X#define XALLSIG "VALL"
X#define XFHCSIG "VFHC"
X#define XDATSIG "VDAT"
X#define XRDTSIG "VRDT"
X#define XPROSIG "VPRO"
X#define XKEYSIG "VKEY"
X#define VERSIG "VMSV"
X/*
X* Block sizes
X*/
X#define FABL (cc$rms_fab.fab$b_bln)
X#define RABL (cc$rms_rab.rab$b_bln)
X#define XALLL (cc$rms_xaball.xab$b_bln)
X#define XDATL (cc$rms_xabdat.xab$b_bln)
X#define XFHCL (cc$rms_xabfhc.xab$b_bln)
X#define XKEYL (cc$rms_xabkey.xab$b_bln)
X#define XPROL (cc$rms_xabpro.xab$b_bln)
X#define XRDTL (cc$rms_xabrdt.xab$b_bln)
X#define XSUML (cc$rms_xabsum.xab$b_bln)
X#define EXTHL (4+EXTBSL+RESL)
X#define EXTL0 ((FABL + EXTHL)+ \
X (XFHCL + EXTHL)+ \
X (XPROL + EXTHL)+ \
X (XDATL + EXTHL)+ \
X (XRDTL + EXTHL))
X
X#ifdef OLD_COMPRESS
X#define PAD sizeof(uch)
X#else
X#define PAD 10*sizeof(ush) /* Two extra bytes for compr. header */
X#endif
X
X#define PAD0 (5*PAD) /* Reserve space for the case when
X * compression failes */
Xstatic int _compress();
X
X/***********************************
X * Function get_vms_attributes *
X ***********************************/
X
Xstatic uch *_compress_block();
Xstatic int get_vms_version();
X
Xint get_vms_attributes(z)
X struct zlist *z;
X/*
X * Get file VMS file attributes and store them into extent fields.
X * Store VMS version also.
X * On error leave z intact.
X */
X{
X int status;
X uch *extra=(uch*)NULL, *scan;
X extent extra_l;
X static struct FAB fab;
X static struct XABSUM xabsum;
X static struct XABFHC xabfhc;
X static struct XABDAT xabdat;
X static struct XABPRO xabpro;
X static struct XABRDT xabrdt;
X xabptr x = (xabptr)NULL, xab_chain = (xabptr)NULL, last_xab = (xabptr)NULL;
X int nk, na;
X int i;
X int rc=RET_ERROR;
X char verbuf[80];
X int verlen = 0;
X
X /*
X * Initialize RMS control blocks and link them
X */


X
X fab = cc$rms_fab;

X xabsum = cc$rms_xabsum;
X xabdat = cc$rms_xabdat;
X xabfhc = cc$rms_xabfhc;
X xabpro = cc$rms_xabpro;
X xabrdt = cc$rms_xabrdt;
X
X
X fab.fab$l_xab = (char*)&xabsum;
X /*
X * Open the file and read summary information.
X */
X fab.fab$b_fns = strlen(z->name);
X fab.fab$l_fna = z->name;
X
X status = sys$open(&fab);
X if (ERR(status))
X {
X#ifdef DEBUG
X printf("get_vms_attributes: sys$open for file %s:\n error status = %d\n",
X z->name, status);
X#endif
X goto err_exit;
X }
X
X nk = xabsum.xab$b_nok;
X na = xabsum.xab$b_noa;
X#ifdef DEBUG
X printf("%d keys, %d alls\n", nk, na);
X#endif
X
X /*
X * Allocate XABKEY and XABALL blocks ind link them
X */
X
X xabfhc.xab$l_nxt = (char*)&xabdat;
X xabdat.xab$l_nxt = (char*)&xabpro;
X xabpro.xab$l_nxt = (char*)&xabrdt;
X xabrdt.xab$l_nxt = (char*)0L;
X
X xab_chain = (xabptr)(&xabfhc);
X last_xab = (xabptr)(&xabrdt);
X
X#define INIT(ptr,size,init) \
X if( (ptr = (uch*)malloc(size)) == NULL ) \
X { \
X printf( "get_vms_attributes: Insufficient memory.\n" ); \
X goto err_exit; \
X } \
X *(ptr) = (init);
X /*
X * Allocate and initialize all needed XABKEYs and XABALLs
X */
X for (i = 0; i < nk; i++)
X {
X struct XABKEY *k;
X INIT(k, XKEYL, cc$rms_xabkey);
X k->xab$b_ref = i;
X if (last_xab != 0L)
X last_xab->xab$l_nxt = (char*)k;
X last_xab = (xabptr)k;
X }
X for (i = 0; i < na; i++)
X {
X struct XABALL *a;
X INIT(a, XALLL, cc$rms_xaball);
X a->xab$b_aid = i;
X if (last_xab != 0L)
X last_xab->xab$l_nxt = (char*)a;
X last_xab = (xabptr)a;
X }
X
X fab.fab$l_xab = (char*)xab_chain;
X#ifdef DEBUG
X printf("Dump of XAB chain before DISPLAY:\n");
X for (x = xab_chain; x != 0L; x = x->xab$l_nxt)
X dump_rms_block(x);
X#endif
X /*
X * Get information on the file structure etc.
X */
X status = sys$display(&fab, 0, 0);
X if (ERR(status))
X {
X#ifdef DEBUG
X printf("get_vms_attributes: sys$display for file %s:\n error status = %d\n",
X z->name, status);
X#endif
X goto err_exit;
X }
X
X#ifdef DEBUG
X printf("\nDump of XAB chain after DISPLAY:\n");
X for (x = xab_chain; x != 0L; x = x->xab$l_nxt)
X dump_rms_block(x);
X#endif
X
X fab.fab$l_xab = 0; /* Keep XABs */
X status = sys$close(&fab);
X if (ERR(status))
X {
X#ifdef DEBUG
X printf("get_vms_attributes: sys$close for file %s:\n error status = %d\n",
X z->name, status);
X#endif
X goto err_exit;
X }
X
X extra_l = EXTL0 + nk * (XKEYL + EXTHL) + na * (XALLL + EXTHL);
X#ifndef OLD_COMPRESS
X extra_l += PAD0 + (nk+na) * PAD;
X#endif
X
X if( verlen = get_vms_version(verbuf,sizeof(verbuf)) )
X { extra_l += verlen + EXTHL;
X#ifndef OLD_COMPRESS
X extra_l += PAD;
X#endif
X }
X
X if ((scan = extra = (uch *) malloc(extra_l)) == (uch*)NULL)
X {
X#ifdef DEBUG
X printf("get_vms_attributes: Insufficient memory to allocate extra buffer\n");
X#endif
X goto err_exit;
X }
X
X
X if( verlen > 0 )
X scan = _compress_block(scan,verbuf, verlen, VERSIG);
X
X /*
X * Zero all unusable fields to improve compression
X */
X fab.fab$b_fns = fab.fab$b_shr = fab.fab$b_dns = fab.fab$b_fac = 0;
X fab.fab$w_ifi = 0;
X fab.fab$l_stv = fab.fab$l_sts = fab.fab$l_ctx = 0;
X fab.fab$l_fna = fab.fab$l_nam = fab.fab$l_xab = fab.fab$l_dna = (char*)0L;
X
X#ifdef DEBUG
X dump_rms_block( &fab );
X#endif
X scan = _compress_block(scan,&fab, FABL, FABSIG);
X for (x = xab_chain; x != 0L;)
X {
X int bln;
X char *sig;
X xabptr next;
X
X next = (xabptr)(x->xab$l_nxt);
X x->xab$l_nxt = 0;
X
X switch (x->xab$b_cod)
X {
X case XAB$C_ALL:
X bln = XALLL;
X sig = XALLSIG;
X break;
X case XAB$C_KEY:
X bln = XKEYL;
X sig = XKEYSIG;
X break;
X case XAB$C_PRO:
X bln = XPROL;
X sig = XPROSIG;
X break;
X case XAB$C_FHC:
X bln = XFHCL;
X sig = XFHCSIG;
X break;
X case XAB$C_DAT:
X bln = XDATL;
X sig = XDATSIG;
X break;
X case XAB$C_RDT:
X bln = XRDTL;
X sig = XRDTSIG;
X break;
X default:
X bln = 0;
X sig = 0L;
X break;
X }
X if (bln > 0)
X scan = _compress_block(scan,x, bln, sig);
X x = next;
X }
X
X z->ext = z->cext = scan-extra;
X z->extra = z->cextra = (char*)extra;
X rc = RET_SUCCESS;
X
Xerr_exit:
X /*
X * Give up all allocated blocks
X */
X for(x = (struct XAB *)xab_chain; x != 0L; )
X { struct XAB *next;
X next = (xabptr)(x->xab$l_nxt);
X if( x->xab$b_cod == XAB$C_ALL || x->xab$b_cod == XAB$C_KEY )
X free(x);
X x = next;
X }
X return rc;
X}
X
Xstatic int get_vms_version(verbuf,len)
Xchar *verbuf;
Xint len;
X{ int i = SYI$_VERSION;
X int verlen = 0;
X struct dsc$descriptor version;
X char *m;
X
X version.dsc$a_pointer = verbuf;
X version.dsc$w_length = len-1;
X version.dsc$b_dtype = DSC$K_DTYPE_B;
X version.dsc$b_class = DSC$K_CLASS_S;
X
X if (ERR(lib$getsyi(&i, 0, &version, &verlen, 0, 0)) || verlen == 0)
X return 0;
X
X /* Cut out trailing spaces "V5.4-3 " -> "V5.4-3" */
X for(m=verbuf+verlen,i=verlen-1; i>0 && verbuf[i]==' '; --i)
X --m;
X *m = 0;
X
X /* Cut out release number "V5.4-3" -> "V5.4" */
X if( (m=strrchr(verbuf,'-')) != (char*)NULL )
X *m = 0;
X return strlen(verbuf)+1; /* Transmit ending 0 too */
X}
X
X#define CTXSIG ((ulg)('CtXx'))
X
Xtypedef struct user_context
X{
X ulg sig;
X struct FAB *fab;
X struct RAB *rab;
X ulg size,rest;
X int status;
X} Ctx, *Ctxptr;
X
XCtx init_ctx =
X{ CTXSIG,
X 0L,
X 0L,
X 0L,
X 0L,
X 0
X};
X
X#define CTXL sizeof(Ctx)
X#define CHECK_RAB(_r) ( (_r) != 0 && \
X (_r) -> rab$b_bid == RAB$C_BID && \
X (_r) -> rab$b_bln == RAB$C_BLN && \
X (_r) -> rab$l_ctx != 0L && \
X (_r) -> rab$l_fab != 0L )
X
X/**************************
X * Function vms_open *
X **************************/
Xstruct RAB *vms_open(name)
X char *name;
X{
X struct RAB *rab;
X struct FAB *fab;
X struct XABFHC *fhc;
X Ctxptr ctx;
X
X if ((fab = (struct FAB *) malloc(FABL)) == (struct FAB *)NULL)
X return 0;
X if ((rab = (struct RAB *) malloc(RABL)) == (struct RAB *)NULL)
X {
X free(fab);
X return 0;
X }
X if ((fhc = (struct XABFHC *) malloc(XFHCL)) == (struct XABFHC *)NULL)
X {
X free(rab);
X free(fab);
X return 0;
X }
X if ((ctx = (Ctxptr) malloc(CTXL)) == (Ctxptr)NULL)
X {
X free(fhc);
X free(fab);
X free(rab);
X return 0;
X }
X *fab = cc$rms_fab;
X *rab = cc$rms_rab;
X *fhc = cc$rms_xabfhc;
X
X fab->fab$l_fna = name;
X fab->fab$b_fns = strlen(name);
X fab->fab$b_fac = FAB$M_GET | FAB$M_BIO;
X fab->fab$l_xab = (char*)fhc;
X
X if (ERR(sys$open(fab)))
X {
X sys$close(fab);
X free(fhc);
X free(fab);
X free(rab);
X free(ctx);


X return 0;
X }
X

X rab->rab$l_fab = fab;
X rab->rab$l_rop = RAB$M_BIO;
X
X if (ERR(sys$connect(rab)))
X {
X sys$close(fab);
X free(fab);
X free(rab);
X free(ctx);


X return 0;
X }
X

X *ctx = init_ctx;
X ctx->rab = rab;
X ctx->fab = fab;
X
X if( fhc->xab$l_ebk > 0 )
X ctx->size = ctx->rest = ( fhc->xab$l_ebk-1 ) * 512 + fhc->xab$w_ffb;
X else
X ctx->size = ctx->rest = 0;
X free(fhc);
X fab -> fab$l_xab = 0;
X rab->rab$l_ctx = (long)ctx;
X return rab;
X}
X
X/**************************
X * Function vms_close *
X **************************/
Xint vms_close(rab)
X struct RAB *rab;
X{
X struct FAB *fab;
X Ctxptr ctx;
X
X if (!CHECK_RAB(rab))
X return RET_ERROR;
X fab = (ctx = (Ctxptr)(rab->rab$l_ctx))->fab;
X sys$close(fab);
X
X free(fab);
X free(rab);
X free(ctx);
X
X return RET_SUCCESS;
X}
X
X/**************************
X * Function vms_rewind *
X **************************/
Xint vms_rewind(rab)
X struct RAB *rab;
X{
X Ctxptr ctx;
X
X int status;
X if (!CHECK_RAB(rab))
X return RET_ERROR;
X
X ctx = (Ctxptr) (rab->rab$l_ctx);
X if (ERR(status = sys$rewind(rab)))
X {
X ctx->status = status;
X return RET_ERROR;
X }
X
X ctx->status = 0;
X ctx->rest = ctx->size;
X
X return RET_SUCCESS;
X}
X
X/**************************
X * Function vms_read *
X **************************/
Xint vms_read(rab, buf, size)
X struct RAB *rab;
Xchar *buf;
Xint size;
X/*
X* size must be greater or equal to 512 !
X*/
X{
X int status;
X Ctxptr ctx;
X
X ctx = (Ctxptr)rab->rab$l_ctx;
X
X if (!CHECK_RAB(rab))
X return 0;
X
X if (ctx -> rest <= 0)
X return 0; /* Eof */
X
X if(size > 16*Kbyte) /* RMS can not read too much */
X size = 16*Kbyte;
X else
X size &= ~511L;
X
X rab->rab$l_ubf = buf;
X rab->rab$w_usz = size;
X status = sys$read(rab);
X if (!ERR(status) && rab->rab$w_rsz > 0)
X {
X ctx -> status = 0;
X ctx -> rest -= rab->rab$w_rsz;
X return rab->rab$w_rsz;
X }
X else
X {
X ctx->status = (status==RMS$_EOF ? 0:status);
X if(status == RMS$_EOF)
X ctx -> rest = 0L;


X return 0;
X }
X}

X
X/**************************
X * Function vms_error *
X **************************/
Xint vms_error(rab)
X struct RAB *rab;
X{
X if (!CHECK_RAB(rab))
X return RET_ERROR;
X return ((Ctxptr) (rab->rab$l_ctx))->status;
X}
X
X
Xdump_rms_block(p)
X unsigned char *p;
X{
X unsigned char bid, len;
X int err;
X char *type;
X char buf[132];
X int i;
X
X err = 0;
X bid = p[0];
X len = p[1];
X switch (bid)
X {
X case FAB$C_BID:
X type = "FAB";
X break;
X case XAB$C_ALL:
X type = "xabALL";
X break;
X case XAB$C_KEY:
X type = "xabKEY";
X break;
X case XAB$C_DAT:
X type = "xabDAT";
X break;
X case XAB$C_RDT:
X type = "xabRDT";
X break;
X case XAB$C_FHC:
X type = "xabFHC";
X break;
X case XAB$C_PRO:
X type = "xabPRO";
X break;
X default:
X type = "Unknown";
X err = 1;
X break;
X }
X printf("Block @%08X of type %s (%d).", p, type, bid);
X if (err)
X {
X printf("\n");
X return;
X }
X printf(" Size = %d\n", len);
X printf(" Offset - Hex - Dec\n");
X for (i = 0; i < len; i += 8)
X {
X int j;
X printf("%3d - ", i);
X for (j = 0; j < 8; j++)
X if (i + j < len)
X printf("%02X ", p[i + j]);
X else
X printf(" ");
X printf(" - ");
X for (j = 0; j < 8; j++)
X if (i + j < len)
X printf("%03d ", p[i + j]);
X else
X printf(" ");
X printf("\n");
X }
X}
X
X#ifdef OLD_COMPRESS
X# define BC_METHOD BC_00
X# define COMP_BLK(to,tos,from,froms) _compress( from,to,froms )
X#else
X# define BC_METHOD BC_DEFL
X# define COMP_BLK(to,tos,from,froms) memcompress(to,tos,from,froms)
X#endif
X
Xstatic uch *_compress_block(to,from,size,sig)
Xregister struct extra_block *to;
Xuch *from,*sig;
Xint size;
X{
X ulg cl;
X to -> im_sig = *(ush*)SIGNATURE;
X to -> block_sig = *(ulg*)(sig);
X to -> flags = BC_METHOD;
X to -> length = size;
X#ifdef DEBUG
X printf("\nmemcompr(%d,%d,%d,%d)\n",&(to->body[0]),size+PAD,from,size);
X#endif
X cl = COMP_BLK( &(to->body[0]), size+PAD, from, size );
X#ifdef DEBUG
X printf("Compressed to %d\n",cl);
X#endif
X if( cl >= size )
X { memcpy(&(to->body[0]), from, size);
X to->flags = BC_STORED;
X cl = size;
X#ifdef DEBUG
X printf("Storing block...\n");
X#endif
X }
X return (uch*)(to) + (to->size = cl + EXTBSL + RESL) + 4;
X}
X
X#define NBITS 32
X
Xstatic int _compress(from,to,size)
Xuch *from,*to;
Xint size;
X{
X int off=0;
X ulg bitbuf=0;
X int bitcnt=0;
X int i;
X
X#define _BIT(val,len) { \
X if(bitcnt + (len) > NBITS) \
X while(bitcnt >= 8) \
X { \
X to[off++] = (uch)bitbuf; \
X bitbuf >>= 8; \
X bitcnt -= 8; \
X } \
X bitbuf |= ((ulg)(val))<<bitcnt; \
X bitcnt += len; \
X }
X
X#define _FLUSH { \
X while(bitcnt>0) \
X { \
X to[off++] = (uch)bitbuf; \
X bitbuf >>= 8; \
X bitcnt -= 8; \
X } \
X }
X
X for(i=0; i<size; i++)
X {
X if( from[i] )
X {
X _BIT(1,1);
X _BIT(from[i],8);
X }
X else
X _BIT(0,1);
X }
X _FLUSH;
X return off;


X}
X
X#endif /* ?VMS */

END_OF_FILE
if test 18616 -ne `wc -c <'vms/vms.c'`; then
echo shar: \"'vms/vms.c'\" unpacked with wrong size!
fi
# end of 'vms/vms.c'
fi
if test -f 'vms/vms_zip.rnh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/vms_zip.rnh'\"
else
echo shar: Extracting \"'vms/vms_zip.rnh'\" \(18026 characters\)
sed "s/^X//" >'vms/vms_zip.rnh' <<'END_OF_FILE'
X.!
X.! File: ZIP.RNH
X.!
X.! Author: Hunter Goatley
X.!
X.! Date: October 22, 1991
X.!
X.! Description:
X.!
X.! RUNOFF source file for portable ZIP on-line help for VMS.
X.! Adapted from ZIP.DOC, distributed with ZIP.
X.!
X.! To build: $ RUNOFF ZIP.RNH
X.! $ LIBR/HELP/INSERT libr ZIP
X.!
X.! Modification history:
X.!
X.! Hunter Goatley 22-OCT-1991 20:45
X.! Genesis.
X.! Jean-loup Gailly 25 March 92
X.! Adaptation to zip 1.6.
X.! Igor Mandrichenko 9-JUN-1992
X.! Added explanation of -V option.
X.! Jean-loup Gailly 14 June 92
X.! Adaptation to zip 1.8.
X.! Jean-loup Gailly 20 Aug 92
X.! Adaptation to zip 1.9.
X.!
X.noflags
X.lm4 .rm72
X.indent -4
X1 ZIP
X.br
XZip is a compression and file packaging utility for Unix, MSDOS, OS/2, and
XVMS. It is analogous to a combination of tar and compress and is
Xcompatible with PKZIP (Phil Katz ZIP) for MSDOS systems.
X.sk
XThere is a companion to Zip called UnZip (of course). Zip and UnZip can
Xwork with files produced by PKZIP under MSDOS, and PKZIP and PKUNZIP can
Xwork with files produced by Zip.
X.sk
XZip 1.9 is compatible with PKZIP 1.93a.


XNote that pkunzip 1.10 cannot extract files produced by pkzip 1.93a

Xor zip 1.9. You must use pkzip 1.93a or unzip 5.0 to extract them.
X.sk
XFor a brief help on Zip and Unzip, run each without specifying any
Xparameters on the command line.
X.sk
XZip puts one or more compressed files into a single "zip file" along with


Xinformation about the files, including the name, path if requested, date
Xand time last modified, protection, and check information to verify the

Xfidelity of each entry. Zip can pack an entire directory structure in a


Xzip file with a single command. Compression ratios of 2:1 to 3:1 are

Xcommon for text files. Zip has has one compression method (deflation) and
Xcan also store files without compression. It automatically chooses the better
Xof the two for each file to be compressed.
X.sk
XZip is useful for packaging a set of files to send to someone or for
Xdistribution; for archiving or backing up files; and for saving disk space
Xby temporarily compressing unused files or directories.
X.sk
XFormat:
X.sk;.lm+1;.literal
XZIP [-options] [-b path] [-n suffixes] [-t mmddyy] zipfile file(s) [-x list]
X.end literal;.lm-1
X.!------------------------------------------------------------------------------
X.indent -4
X2 Options
X.br
XThe default action of Zip is to add or replace zipfile entries from list, which
Xcan include the special name -@ to read names from SYS$INPUT. The following
Xlist of options was taken from the on-line help generated when Zip is run
Xwithout any command-line parameters:
X.sk
X.literal


X -f freshen: only changed files

X -d delete entries in zipfile

X -k simulate PKZIP made zipfile

X -h show this help

X -r recurse into directories

X -q quiet operation


X -c add one-line comments

X -b use "path" for temp files

X -o make zipfile as old as latest entry
X -w append the VMS version number to name stored in zip file


X -x exclude the names that follow from those operated on

X -u update: only changed or new files
X -m move into zipfile (delete files)
X -g allow growing existing zipfile
X -l translate end-of-lines
X -j junk (don't record) directory names
X -0 store only
X -1 compress faster
X -9 compress better
X -n don't compress theses suffixes
X -z add zipfile comment
X -t only do files after "mmddyy"
X -L show software license


X -V save VMS file attributes

X.end literal
X.!------------------------------------------------------------------------------
X.indent -4
X2 How_To_Use_Zip
X.br
XThe simplest use of Zip is as follows:
X.sk;.indent 10;$ zip stuff *
X.sk
XThis will create the file "STUFF.ZIP" (assuming it does not exist) and put
Xall the files in the current directory in STUFF.ZIP in a compressed form.
XThe .ZIP suffix is added automatically, unless that file name given
Xcontains a dot already. This allows specifying suffixes other than ".ZIP".
X.sk
XTo zip up an entire directory, the command:
X.sk;.indent 10
X$ zip -r foo *.*
X.sk
Xwill create the file "FOO.ZIP" containing all the files and directories in
Xthe in the current directory. The "r" option means recurse through the
Xdirectory structure.
X.sk
XYou may want to make a zip file that contains the files in [.FOO], but not
Xrecord the directory name, FOO. You can use the -j (junk path) option to
Xleave off the path:
X.sk;.indent 10
X$ zip -j foo [.foo]*.*
X.sk


XYou might be zipping to save disk space, in which case you could:

X.sk;.indent 10
X$ zip -rm foo *.txt
X.sk
Xwhere the "m" option means "move". This will delete all files matching
X*.txt after making FOO.ZIP. No deletions will be done until the zip has
Xcompleted with no errors. This option is obviously more dangerous and
Xshould be used with care.
X.sk


XIf the zip file already exists, these commands will replace existing or add
Xnew entries to the zip file. For example, if you were really short on disk
Xspace, you might not have enough room simultaneously to hold the directory

X[.FOO] and the compressed FOO.ZIP. In this case, you could do it in steps.
XIf [.FOO] contained the subdirectories [.TOM], [.DICK], and [.HARRY], then
Xyou could:
X.sk;
X.indent 10;$ zip -rm foo [.foo.tom]
X.indent 10;$ zip -rm foo [.foo.dick]
X.indent 10;$ zip -rm foo [.foo.harry]
X.sk
Xwhere the first command would create FOO.ZIP, and the next two would add to
Xit. At the completion of each zip command, the files in the directory just
Xzipped would be deleted, making room in which the next Zip command could
Xwork.
X.!------------------------------------------------------------------------------
X.indent -4
X2 Modifying_Existing_Zip_Files
X.br
XWhen given the name of an existing zip file with the above commands, Zip
Xwill replace identically named entries in the Zip file or add entries for
Xnew names. For example, if FOO.ZIP exists and contains foo/file1 and
Xfoo/file2, and the directory [.FOO] contains the files foo/file1 and
Xfoo/file3, then:
X.sk;.indent 10
X$ zip -r foo foo
X.sk
Xwill replace foo/file1 in foo.zip and add foo/file3 to FOO.ZIP. After
Xthis, FOO.ZIP contains foo/file1, foo/file2, and foo/file3, with foo/file2
Xunchanged from before.
X.sk
XWhen changing an existing zip file, Zip will write a temporary file with


Xthe new contents, and only replace the old one when the zip has completed
Xwith no errors. You can use

Xthe -b option to specify a different path (usually a different dev- ice) to
Xput the temporary files in. For example:
X.sk;.indent 10
X$ zip -b scratch$:[tmp] stuff *
X.sk


Xwill put the temporary zip file and the temporary compression files in the

Xdirectory "SCRATCH$:[TMP]", copying over STUFF.ZIP in the current directory
Xwhen done.
X.sk
XIf you are only adding entries to a zip file, not replacing, and the -g
Xoption is given, then Zip grows (appends to) the file instead of copying
Xit. The danger of this is that if the operation fails, the original zip
Xfile is corrupted and lost.
X.sk


XThere are two other ways to change or add entries in a zip file that are
Xrestrictions of simple addition or replacement. The first is -u (update)
Xwhich will add new entries to the zip file as before but will replace
Xexisting entries only if the modified date of the file is more recent than
Xthe date recorded for that name in the zip file. For example:

X.sk;.indent 10
X$ zip -u stuff *
X.sk


Xwill add any new files in the current directory, and update any changed

Xfiles in the zip file STUFF.ZIP. Note that Zip will not try to pack
XSTUFF.ZIP into itself when you do this. Zip will always exclude the zip
Xfile from the files on which to be operated.
X.sk


XThe second restriction is -f (freshen) which, like update, will only

Xreplace entries with newer files; unlike update, will not add files that
Xare not already in the zip file. For this option, you may want to simply
Xfreshen all of the files that are in the specified zip file. To do this
Xyou would simply:
X.sk;.indent 10
X$ zip -f foo
X.sk


XNote that the -f option with no arguments freshens all the entries in the
Xzip file. The same is true of -u, and hence "zip -u foo" and "zip -f foo"
Xboth do the same thing.

X.sk
XThis command should be run from the same directory from which the original
Xzip command was run, since paths stored in zip files are always relative.
X.sk


XAnother restriction that can be used with adding, updating, or freshening

Xis -t (time), which will not operate on files modified earlier than the
Xspecified date. For example:
X.sk;.indent 10
X$ zip -rt 120791 infamy [.FOO]*.*
X.sk
Xwill add all the files in [.FOO] and its subdirectories that were last
Xmodified on December 7, 1991, or later to the zip file INFAMY.ZIP.
X.sk


XAlso, files can be explicitly excluded using the -x option:

X.sk;.indent 10
X$ zip -r foo [.FOO] -x *.obj
X.sk
Xwhich will zip up the contents of [.FOO] into FOO.ZIP but exclude all the
Xfiles that end in ".OBJ".
X.sk


XThe last operation is -d (delete) which will remove entries from a zip

Xfile. An example might be:
X.sk;.indent 10
X$ zip -d foo foo/harry/*.* *.obj
X.sk
Xwhich will remove all of the files that start with "foo/harry/" and all of
Xthe files that end with ".OBJ" (in any path).
X.sk


XUnder MSDOS, -d is case sensitive when it matches names in the zip file.
XThis allows deleting names that were zipped on other systems, but requires
Xthat the names be entered in upper case if they were zipped on an MSDOS
Xsystem, so that the names can be found in the zip file and deleted.

X.!------------------------------------------------------------------------------
X.indent -4
X2 More_Options
X.br
XAs mentioned before, Zip will use the best of two methods: deflate or store.
XThe option -0 will force Zip to use store on all files. For example:
X.sk;.indent 10
Xzip -r0 foo foo
X.sk


Xwill zip up the directory foo into foo.zip using only store.

X.sk


XThe speed of deflation can also be controlled with options -1 (fastest
Xmethod but less compression) to -9 (best compression but slower). The
Xdefault value is -5. For example:

X.sk;.indent 10
Xzip -r8 foo foo
X.sk


XIn nearly all cases, a file that is already compressed cannot be compressed

Xfurther by Zip, or if it can, the effect is minimal. The -n option
Xprevents Zip from trying to compress files that have the
Xgiven suffixes. Such files are simply stored (0%
Xcompression) in the
Xoutput zip file, so that Zip doesn't waste its time trying to compress
Xthem. The suffixes are separated by
Xeither colons or semicolons. For example, in DCL:
X.sk
X.indent 10;$ zip -rn ".Z:.zip:.tiff:.gif:.snd" foo [.FOO]*.*
X.sk
Xwill put everything in [.FOO] into FOO.ZIP, but will store any files that end
Xin .Z, .ZIP, .TIFF, .GIF, or .SND without trying to compress them. (Image and
Xsound files often have their own specialized compression methods.)


XThe default suffix list is ".Z:.zip;.zoo:.arc:.lzh:.arj".
XThe environment variable ZIPOPT can be used to change this default. For

Xexample:
X.sk
X.indent 10;$ ZIPOPT == "-n .Z:.zip:.tiff:.gif:.snd"
X.sk


XThe variable ZIPOPT can be used for any option and can include several
Xoptions.

X.sk
XUnder Unix and under OS/2 (if files from a HPFS are stored), Zip will store
Xthe full path (relative to the current path) and name of the file (or just
Xthe name if -j is specified) in the zip file along with the Unix
Xattributes, and it will mark the entry as made under Unix. If the zip file
Xis intended for PKUNZIP under MSDOS, then the -k (Katz) option should be
Xused to attempt to convert the names and paths to conform to MSDOS, store
Xonly the MSDOS attribute (just the user write attribute from Unix), and
Xmark the entry as made under MSDOS (even though it wasn't).
X.sk


XThe -o (older) option will set the "last modified" time of the zip file to
Xthe latest "last modified" time of the entries in the zip file. This can
Xbe used without any other operations, if desired. For example:

X.sk;.indent 10
X$ zip -o foo
X.sk
Xwill change the last modified time of FOO.ZIP to the latest time of the
Xentries in FOO.ZIP.
X.sk


XThe -e and -c options operate on all files updated or added to the zip

Xfile. Encryption (-e) will prompt for a password on the terminal and will
Xnot echo the password as it is typed (if stderr is not a TTY, Zip will exit


Xwith an error). New zip entries will be encrypted using that password. For
Xadded peace of mind, you can use -ee, which will prompt for the password
Xtwice, checking that the two are the same before using it.

X.sk


XOne-line comments can be added for each file with the -c option. The zip
Xfile operations (adding or updating) will be done first, and you will then

Xbe prompted for a one-line comment for each file. You can then enter the
Xcomment followed by return, or just return for no comment.
X.sk


XThe -z option will prompt you for a multi-line comment for the entire zip
Xfile. This option can be used by itself, or in combination with other
Xoptions. The comment is ended by a line containing just a period, or an

Xend of file condition (^D on Unix, ^Z on MSDOS, OS/2, and VAX/VMS).
X.sk


XThe -q (quiet) option eliminates the informational messages and comment

Xprompts while Zip is operating. This might be used in shell scripts, for
Xexample, or if the zip operation is being performed as a background task
X("$ spawn/nowait zip -q foo *.c").
X.sk
XZip can take a list of file names to operate on from SYS$INPUT using the
X"-@"
Xoption.
X.! In Unix, this option can be used with the find command to extend
X.!greatly the functionality of Zip. For example, to zip up all the C source
X.!files in the current directory and its subdirectories, you can:
X.!.sk
X.!find . -type f -name "*.[ch]" -print | zip source -@
X.!.sk
X.!Note that the pattern must be quoted to keep the shell from expanding it.
X.sk


XUnder VMS only, the -w option will append the version number of the files

Xto the name and zip up multiple versions of files. Without -w, Zip will
Xonly use the most recent version of the specified file(s).
X.sk
XOne more option that valid only under VMS is -V option. This option saves
Xall (hopefully) file attributes needed to make EXACT copy of the
Xfile after extraction from archive. To extract a file with saved attributes
Xuse UnZip version 4.2 or later. Note that to specify this option you should
Xquote it ("-V"). Be carefull: it's rather hard (if possible at all) to extract
Xa file archived on VMS with this option specified on other systems. See
Xdocumentation on UnZip for further information.
X.sk


XThe -l option translates the Unix end-of-line character LF into the
XMSDOS convention CR LF. This option should not be used on binary files.
XThis option can be used on Unix if the zip file is intended for PKUNZIP
Xunder MSDOS.

X.sk
XIf Zip is run with the -h option, or with no arguments and standard output is


Xa terminal, the license and the command-argument and option help is shown.
XThe -L option just shows the license.

X.!------------------------------------------------------------------------------
X.indent -4
X2 Copyright
X.br
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Igor Mandrichenko and Kai Uwe Rommel. Permission is granted to any
X individual or institution to use, copy, or redistribute this software
X so long as all of the original files are included unmodified,
X that it is not sold for profit, and that this copyright
X notice is retained.
X.!------------------------------------------------------------------------------
X.indent -4
X2 Acknowledgements
X.br


X Thanks to R. P. Byrne for his Shrink.Pas program which

X inspired this project; to Phil Katz for making the zip file format,
X compression format, and .ZIP filename extension all public
X domain; to Steve Burg and Phil Katz for help on unclear points of
X the deflate format; to Keith Petersen for providing a mailing list and
X ftp site for the INFO-ZIP group to use; and most importantly, to
X the INFO-ZIP group itself (listed in the file
X infozip.who) without whose tireless testing and bug-fixing
X efforts a portable Zip would not have been possible.
X Finally we should thank (blame) the INFO-ZIP moderator,
X David Kirschbaum for getting us into this mess in the first
X place.
X.!------------------------------------------------------------------------------
X.indent -4
X2 Bugs
X.sk
X WARNING: zip files produced by this version of zip must not be
X *updated* by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if they contain
X encrypted members, or if they have been produced in a pipe or on a non
X seekable device. The old versions of zip or pkzip would destroy the
X zip structure. The old versions can list the contents of the zip file
X but cannot extract it anyway (because of the new compression algorithm).
X If you do not use encryption and use regular disk files, you do
X not have to care about this problem.
X.sk
X Under VMS, not all of the odd file formats are treated properly. Only
X zip files of format stream-LF and fixed length 512 are expected to work
X with Zip. Others can be converted using Rahul Dhesi's BILF
X program. This version of Zip does handle some of the
X conversion internally.
X When using Kermit to transfer zip files from Vax to MSDOS, type "set
X file type block" on the Vax. When transfering from MSDOS to Vax, type


X "set file type fixed" on the Vax. In both cases, type "set file type
X binary" on MSDOS.

X.sk
X Under VMS, zip hangs for file specification that uses DECnet
X syntax (foo::*.*).
X.sk
X LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES
X ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY
X KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE
X COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM
X THE USE OF THIS SOFTWARE.
X.sk


X That having been said, please send any problems or comments
X via email to the Internet address zip-...@cs.ucla.edu. For

X bug reports, please include the version of Zip, the make
X options you used to compile it, the machine and operating
X system you are using, and as much additional information as
X possible. Thank you for your support.
X.!------------------------------------------------------------------------------
END_OF_FILE
if test 18026 -ne `wc -c <'vms/vms_zip.rnh'`; then
echo shar: \"'vms/vms_zip.rnh'\" unpacked with wrong size!
fi
# end of 'vms/vms_zip.rnh'
fi
if test -f 'zipsplit.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zipsplit.c'\"
else
echo shar: Extracting \"'zipsplit.c'\" \(17114 characters\)
sed "s/^X//" >'zipsplit.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zipsplit.c by Mark Adler.
X */
X
X#define UTIL
X#include "revision.h"
X#include "zip.h"
X#include <signal.h>
X
X#define DEFSIZ 36000L /* Default split size (change in help() too) */
X#ifdef MSDOS
X# define NL 2 /* Number of bytes written for a \n */
X#else /* !MSDOS */
X# define NL 1 /* Number of bytes written for a \n */
X#endif /* ?MSDOS */
X#define INDEX "zipsplit.idx" /* Name of index file */


X
X
X/* Local functions */
X#ifdef PROTO

X local void handler(int);
X local void license(void);
X local void help(void);

X local extent simple(ulg *, extent, ulg, ulg);
X local int descmp(voidp *, voidp *);
X local extent greedy(ulg *, extent, ulg, ulg);


X void main(int, char **);

X#endif /* PROTO */
X
X

X/* Output zip files */
Xlocal char template[16]; /* name template for output files */
Xlocal int zipsmade = 0; /* number of zip files made */
Xlocal int indexmade = 0; /* true if index file made */
Xlocal char *path = NULL; /* space for full name */
Xlocal char *name; /* where name goes in path[] */


X
X
Xvoid err(c, h)
Xint c; /* error code from the ZE_ class */
Xchar *h; /* message about how it happened */
X/* Issue a message for the error, clean up files and memory, and exit. */
X{

X if (PERR(c))
X perror("zipsplit error");
X fprintf(stderr, "zipsplit error: %s (%s)\n", errors[c-1], h);
X if (indexmade)
X {
X strcpy(name, INDEX);
X destroy(path);
X }
X for (; zipsmade; zipsmade--)
X {
X sprintf(name, template, zipsmade);
X destroy(path);
X }
X if (path != NULL)
X free((voidp *)path);


X if (zipfile != NULL)
X free((voidp *)zipfile);

X#ifdef VMS
X exit(0);
X#else /* !VMS */
X exit(c);


X#endif /* ?VMS */
X}

X
X
X


Xlocal void handler(s)
Xint s; /* signal number (ignored) */

X/* Upon getting a user interrupt, abort cleanly using err(). */
X{
X#ifndef MSDOS


X putc('\n', stderr);
X#endif /* !MSDOS */
X err(ZE_ABORT, "aborting");
X s++; /* keep some compilers happy */
X}
X
X
Xvoid warn(a, b)
Xchar *a, *b; /* message strings juxtaposed in output */
X/* Print a warning message to stderr and return. */
X{

X fprintf(stderr, "zipsplit warning: %s%s\n", a, b);


X}
X
X
Xlocal void license()

X/* Print license information to stdout. */
X{


X extent i; /* counter for copyright array */
X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {

X printf(copyright[i], "zipsplit");


X putchar('\n');
X }
X for (i = 0; i < sizeof(disclaimer)/sizeof(char *); i++)
X puts(disclaimer[i]);
X}
X
X
Xlocal void help()

X/* Print help (along with license info) to stdout. */
X{


X extent i; /* counter for help array */
X
X /* help array */
X static char *text[] = {
X"",

X"ZipSplit %d.%d (%s)",
X"Usage: zipsplit [-ti] [-n size] [-b path] zipfile",
X" -t report how many files it will take, but don't make them",
X" -i make index (zipsplit.idx) and count its size against first zip file",
X" -n make zip files no larger than \"size\" (default = 36000)",
X" -b use \"path\" for the output zip files",
X" -s do a sequential split even if it takes more zip files",


X" -h show this help -L show software license"

X };


X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {

X printf(copyright[i], "zipsplit");


X putchar('\n');
X }

X for (i = 0; i < sizeof(text)/sizeof(char *); i++)
X {
X printf(text[i], REVISION / 10, REVISION % 10, REVDATE);
X putchar('\n');
X }
X}
X
X

Xlocal extent simple(a, n, c, d)
Xulg *a; /* items to put in bins, return value: destination bins */
Xextent n; /* number of items */
Xulg c; /* capacity of each bin */
Xulg d; /* amount to deduct from first bin */
X/* Return the number of bins of capacity c that are needed to contain the
X integers in a[0..n-1] placed sequentially into the bins. The value d
X is deducted initially from the first bin (space for index). The entries
X in a[] are replaced by the destination bins. */
X{
X extent k; /* current bin number */
X ulg t; /* space used in current bin */
X
X t = k = 0;
X while (n--)
X {
X if (*a + t > c - (k == 0 ? d : 0))
X {
X k++;
X t = 0;
X }
X t += *a;
X *(ulg huge *)a++ = k;
X }
X return k + 1;
X}
X
X
Xlocal int descmp(a, b)
Xvoidp *a, *b; /* pointers to pointers to ulg's to compare */
X/* Used by qsort() in greedy() to do a descending sort. */
X{
X return **(ulg **)a < **(ulg **)b ? 1 : (**(ulg **)a > **(ulg **)b ? -1 : 0);
X}
X
X
Xlocal extent greedy(a, n, c, d)
Xulg *a; /* items to put in bins, return value: destination bins */
Xextent n; /* number of items */
Xulg c; /* capacity of each bin */
Xulg d; /* amount to deduct from first bin */
X/* Return the number of bins of capacity c that are needed to contain the
X items with sizes a[0..n-1] placed non-sequentially into the bins. The
X value d is deducted initially from the first bin (space for index).
X The entries in a[] are replaced by the destination bins. */
X{
X ulg *b; /* space left in each bin (malloc'ed for each m) */
X ulg *e; /* copy of argument a[] (malloc'ed) */
X extent i; /* steps through items */
X extent j; /* steps through bins */
X extent k; /* best bin to put current item in */
X extent m; /* current number of bins */
X ulg **s; /* pointers to e[], sorted descending (malloc'ed) */
X ulg t; /* space left in best bin (index k) */
X
X /* Algorithm:
X 1. Copy a[] to e[] and sort pointers to e[0..n-1] (in s[]), in
X descending order.
X 2. Compute total of s[] and set m to the smallest number of bins of
X capacity c that can hold the total.
X 3. Allocate m bins.
X 4. For each item in s[], starting with the largest, put it in the
X bin with the smallest current capacity greater than or equal to the
X item's size. If no bin has enough room, increment m and go to step 4.
X 5. Else, all items ended up in a bin--return m.
X */
X
X /* Copy a[] to e[], put pointers to e[] in s[], and sort s[]. Also compute
X the initial number of bins (minus 1). */
X if ((e = (ulg *)malloc(n * sizeof(ulg))) == NULL ||
X (s = (ulg **)malloc(n * sizeof(ulg *))) == NULL)
X {


X if (e != NULL)

X free((voidp *)e);
X err(ZE_MEM, "was trying a smart split");
X return 0; /* only to make compiler happy */
X }
X memcpy((char *)e, (char *)a, n * sizeof(ulg));
X for (t = i = 0; i < n; i++)
X t += *(s[i] = e + i);
X m = (extent)((t + c - 1) / c) - 1; /* pre-decrement for loop */
X qsort((char *)s, n, sizeof(ulg *), descmp);
X
X /* Stuff bins until successful */
X do {
X /* Increment the number of bins, allocate and initialize bins */
X if ((b = (ulg *)malloc(++m * sizeof(ulg))) == NULL)
X {
X free((voidp *)s);
X free((voidp *)e);
X err(ZE_MEM, "was trying a smart split");
X }
X b[0] = c - d; /* leave space in first bin */
X for (j = 1; j < m; j++)
X b[j] = c;
X
X /* Fill the bins greedily */


X for (i = 0; i < n; i++)

X {
X /* Find smallest bin that will hold item i (size s[i]) */
X t = c + 1;
X for (k = j = 0; j < m; j++)
X if (*s[i] <= b[j] && b[j] < t)
X t = b[k = j];
X
X /* If no bins big enough for *s[i], try next m */
X if (t == c + 1)
X break;
X
X /* Diminish that bin and save where it goes */
X b[k] -= *s[i];
X a[(int)((ulg huge *)(s[i]) - (ulg huge *)e)] = k;
X }
X
X /* Clean up */
X free((voidp *)b);
X
X /* Do until all items put in a bin */
X } while (i < n);
X
X /* Done--clean up and return the number of bins needed */
X free((voidp *)s);
X free((voidp *)e);
X return m;


X}
X
X
Xvoid main(argc, argv)
Xint argc; /* number of tokens in command line */
Xchar **argv; /* command line tokens */

X/* Split a zip file into several zip files less than a specified size. See
X the command help in help() above. */
X{
X ulg *a; /* malloc'ed list of sizes, dest bins */
X extent *b; /* heads of bin linked lists (malloc'ed) */
X ulg c; /* bin capacity, start of central directory */
X int d; /* if true, just report the number of disks */
X FILE *e; /* input zip file */
X FILE *f; /* output index and zip files */
X extent g; /* number of bins from greedy(), entry to write */
X int h; /* how to split--true means simple split, counter */
X ulg i; /* size of index file or zero if none */
X extent j; /* steps through zip entries, bins */
X int k; /* next argument type */
X ulg *p; /* malloc'ed list of sizes, dest bins for greedy() */
X char *q; /* steps through option characters */
X int r; /* temporary variable, counter */
X extent s; /* number of bins needed */
X ulg t; /* total of sizes, end of central directory */
X struct zlist far **w; /* malloc'ed table for zfiles linked list */
X int x; /* if true, make an index file */


X struct zlist far *z; /* steps through zfiles linked list */

X
X
X /* If no args, show help */
X if (argc == 1)


X {
X help();
X exit(0);
X }
X

X init_upper(); /* build case map table */
X

X /* Go through args */


X signal(SIGINT, handler);
X signal(SIGTERM, handler);

X k = h = x = d = 0;
X c = DEFSIZ;
X for (r = 1; r < argc; r++)
X if (*argv[r] == '-')
X if (argv[r][1])
X for (q = argv[r]+1; *q; q++)
X switch(*q)
X {
X case 'b': /* Specify path for output files */
X if (k)
X err(ZE_PARMS, "options are separate and precede zip file");
X else


X k = 1; /* Next non-option is path */
X break;

X case 'h': /* Show help */
X help(); exit(0);
X case 'i': /* Make an index file */
X x = 1;
X break;
X case 'l': case 'L': /* Show copyright and disclaimer */
X license(); exit(0);
X case 'n': /* Specify maximum size of resulting zip files */
X if (k)
X err(ZE_PARMS, "options are separate and precede zip file");
X else
X k = 2; /* Next non-option is size */
X break;
X case 's':
X h = 1; /* Only try simple */
X break;
X case 't': /* Just report number of disks */
X d = 1;
X break;
X default:
X err(ZE_PARMS, "unknown option");
X }
X else
X err(ZE_PARMS, "zip file cannot be stdin");
X else


X if (k == 0)

X if (zipfile == NULL)
X {
X if ((zipfile = ziptyp(argv[r])) == NULL)


X err(ZE_MEM, "was processing arguments");
X }

X else
X err(ZE_PARMS, "can only specify one zip file");
X else if (k == 1)
X {
X tempath = argv[r];
X k = 0;
X }
X else /* k must be 2 */
X {
X if ((c = (ulg)atol(argv[r])) < 100) /* 100 is smallest zip file */
X err(ZE_PARMS, "invalid size given");


X k = 0;
X }

X if (zipfile == NULL)
X err(ZE_PARMS, "need to specify zip file");
X
X
X /* Read zip file */


X if ((r = readzipfile()) != ZE_OK)
X err(r, zipfile);

X if (zfiles == NULL)

X err(ZE_NAME, zipfile);
X
X /* Make a list of sizes and check against capacity. Also compute the
X size of the index file. */
X c -= ENDHEAD + 4; /* subtract overhead/zipfile */
X if ((a = (ulg *)malloc(zcount * sizeof(ulg))) == NULL ||
X (w = (struct zlist far **)malloc(zcount * sizeof(struct zlist far *))) ==
X NULL)
X {


X if (a != NULL)

X free((voidp *)a);
X err(ZE_MEM, "was computing split");
X return;
X }
X i = t = 0;
X for (j = 0, z = zfiles; j < zcount; j++, z = z->nxt)
X {
X w[j] = z;
X if (x)
X i += z->nam + 6 + NL;
X t += a[j] = 8 + LOCHEAD + CENHEAD +
X 2 * (ulg)z->nam + 2 * (ulg)z->ext + z->com + z->siz;
X if (a[j] > c)
X {
X free((voidp *)w); free((voidp *)a);
X err(ZE_BIG, z->zname);
X }
X }
X
X /* Decide on split to use, report number of files */
X if (h)
X s = simple(a, zcount, c, i);
X else
X {
X if ((p = (ulg *)malloc(zcount * sizeof(ulg))) == NULL)
X {
X free((voidp *)w); free((voidp *)a);
X err(ZE_MEM, "was computing split");
X }
X memcpy((char *)p, (char *)a, zcount * sizeof(ulg));
X s = simple(a, zcount, c, i);
X g = greedy(p, zcount, c, i);
X if (s <= g)
X free((voidp *)p);
X else
X {
X free((voidp *)a);
X a = p;
X s = g;
X }
X }
X printf("%d zip files w%s be made (%d%% efficiency)\n",
X s, d ? "ould" : "ill", ((200 * ((t + c - 1)/c)) / s + 1) >> 1);
X if (d)
X {
X free((voidp *)w); free((voidp *)a);


X free((voidp *)zipfile);
X zipfile = NULL;

X return;
X }
X
X /* Set up path for output files */
X if ((path = malloc(tempath == NULL ? 13 : strlen(tempath) + 14)) == NULL)
X err(ZE_MEM, "was making output file names");
X if (tempath == NULL)
X name = path;
X else
X {
X strcpy(path, tempath);
X if (path[0] && path[strlen(path) - 1] != '/')
X strcat(path, "/");
X name = path + strlen(path);
X }
X
X /* Write the index file */
X if (x)
X {
X strcpy(name, INDEX);
X printf("creating %s\n", path);
X indexmade = 1;
X if ((f = fopen(path, "w")) == NULL)
X {
X free((voidp *)w); free((voidp *)a);
X err(ZE_CREAT, path);
X }
X for (j = 0; j < zcount; j++)
X fprintf(f, "%5ld %s\n", a[j] + 1, w[j]->zname);
X if ((j = ferror(f)) != 0 || fclose(f))
X {
X if (j)
X fclose(f);
X free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X }
X
X /* Make linked lists of results */
X if ((b = (extent *)malloc(s * sizeof(extent))) == NULL)
X {
X free((voidp *)w); free((voidp *)a);
X err(ZE_MEM, "was computing split");
X }
X for (j = 0; j < s; j++)
X b[j] = (extent)-1;
X j = zcount;
X while (j--)
X {
X g = (extent)a[j];
X a[j] = b[g];
X b[g] = j;
X }
X
X /* Make a name template for the zip files that is eight or less characters
X before the .zip, and that will not overwrite the original zip file. */
X for (k = 1, j = s; j >= 10; j /= 10)
X k++;
X if (k > 7)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_PARMS, "way too many zip files must be made");
X }
X#ifdef VMS
X if ((q = strrchr(zipfile, ']')) != NULL)
X#else /* !VMS */
X if ((q = strrchr(zipfile, '/')) != NULL)
X#endif /* ?VMS */
X q++;
X else
X q = zipfile;
X r = 0;
X while ((g = *q++) != 0 && g != '.' && r < 8 - k)
X template[r++] = (char)g;
X if (r == 0)
X template[r++] = '_';
X else if (g >= '0' && g <= '9')
X template[r - 1] = (char)(template[r - 1] == '_' ? '-' : '_');
X sprintf(template + r, "%%0%dd.zip", k);
X
X /* Make the zip files from the linked lists of entry numbers */
X if ((e = fopen(zipfile, FOPR)) == NULL)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_NAME, zipfile);


X }
X free((voidp *)zipfile);
X zipfile = NULL;

X for (j = 0; j < s; j++)
X {
X sprintf(name, template, j + 1);
X printf("creating %s\n", path);
X zipsmade = j + 1;
X if ((f = fopen(path, FOPW)) == NULL)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_CREAT, path);
X }
X tempzn = 0;
X for (g = b[j]; g != (extent)-1; g = (extent)a[g])
X {
X if (fseek(e, w[g]->off, SEEK_SET))
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ferror(e) ? ZE_READ : ZE_EOF, zipfile);
X }
X if ((r = zipcopy(w[g], e, f)) != ZE_OK)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X if (r == ZE_TEMP)
X err(ZE_WRITE, path);
X else


X err(r, zipfile);
X }
X }

X if ((c = ftell(f)) == -1L)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X for (g = b[j], k = 0; g != (extent)-1; g = (extent)a[g], k++)
X if ((r = putcentral(w[g], f)) != ZE_OK)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X if ((t = ftell(f)) == -1L)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X if ((r = putend(k, t - c, c, (extent)0, (char *)NULL, f)) != ZE_OK)
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X if (ferror(f) || fclose(f))
X {
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X err(ZE_WRITE, path);
X }
X }
X free((voidp *)b); free((voidp *)w); free((voidp *)a);
X fclose(e);


X
X /* Done! */

X exit(0);
X}
END_OF_FILE
if test 17114 -ne `wc -c <'zipsplit.c'`; then
echo shar: \"'zipsplit.c'\" unpacked with wrong size!
fi
# end of 'zipsplit.c'
fi
echo shar: End of archive 7 \(of 11\).
cp /dev/null ark7isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:48:03 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 100
Archive-name: zip19/part08

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: bits.c makecrc.c os2/makefile.os2.UU vms/VMSmunch.c
# zipnote.c zipup.c
# Wrapped by kent@sparky on Sun Aug 23 01:00:46 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 8 (of 11)."'
if test -f 'bits.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bits.c'\"
else
echo shar: Extracting \"'bits.c'\" \(11292 characters\)
sed "s/^X//" >'bits.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * bits.c by Jean-loup Gailly and Kai Uwe Rommel.
X *
X * This is a new version of im_bits.c originally written by Richard B. Wales


X *
X * PURPOSE
X *

X * Output variable-length bit strings. Compression can be done
X * to a file or to memory.


X *
X * DISCUSSION
X *

X * The PKZIP "deflate" file format interprets compressed file data
X * as a sequence of bits. Multi-bit strings in the file may cross
X * byte boundaries without restriction.
X *
X * The first bit of each byte is the low-order bit.
X *
X * The routines in this file allow a variable-length bit value to
X * be output right-to-left (useful for literal values). For
X * left-to-right output (useful for code strings from the tree routines),
X * the bits must have been reversed first with bi_reverse().
X *
X * For in-memory compression, the compressed bit stream goes directly
X * into the requested output buffer. The input data is read in blocks
X * by the mem_read() function.


X *
X * INTERFACE
X *

X * void bi_init (FILE *zipfile)
X * Initialize the bit string routines.
X *
X * void send_bits (int value, int length)
X * Write out a bit string, taking the source bits right to
X * left.
X *
X * int bi_reverse (int value, int length)
X * Reverse the bits of a bit string, taking the source bits left to
X * right and emitting them right to left.
X *
X * void bi_windup (void)
X * Write out any remaining bits in an incomplete byte.
X *
X * void copy_block(char far *buf, unsigned len, int header)
X * Copy a stored block to the zip file, storing first the length and
X * its one's complement if requested.
X *
X * int seekable(void)
X * Return true if the zip file can be seeked.
X *
X * ulg memcompress (char *tgt, ulg tgtsize, char *src, ulg srcsize);
X * Compress the source buffer src into the target buffer tgt.


X */
X
X#include "zip.h"
X

X/* ===========================================================================
X * Local data used by the "bit string" routines.
X */
X
Xlocal FILE *zfile; /* output zip file */
X
Xlocal unsigned short bi_buf;
X/* Output buffer. bits are inserted starting at the bottom (least significant
X * bits).
X */
X
X#define Buf_size (8 * 2*sizeof(char))
X/* Number of bits used within bi_buf. (bi_buf might be implemented on
X * more than 16 bits on some systems.)
X */
X
Xlocal int bi_valid;
X/* Number of valid bits in bi_buf. All bits above the last valid bit
X * are always zero.
X */
X
Xchar file_outbuf[1024];
X/* Output buffer for compression to file */
X
Xlocal char *in_buf, *out_buf;
X/* Current input and output buffers. in_buf is used only for in-memory
X * compression.
X */
X
Xlocal ulg in_offset, out_offset;
X/* Current offset in input and output buffers. in_offset is used only for
X * in-memory compression.
X */
X
Xlocal ulg in_size, out_size;
X/* Size of current input and output buffers */
X
Xint (*read_buf) OF((char *buf, unsigned size)) = file_read;
X/* Current input function. Set to mem_read for in-memory compression */
X
X#ifdef DEBUG
Xulg bits_sent; /* bit length of the compressed data */
X#endif
X
X/* Output a 16 bit value to the bit stream, lower (oldest) byte first */
X#define PUTSHORT(w) \
X{ if (out_offset < out_size-1) { \
X out_buf[out_offset++] = (char) ((w) & 0xff); \
X out_buf[out_offset++] = (char) ((ush)(w) >> 8); \
X } else { \
X flush_outbuf((w),2); \
X } \
X}
X
X#define PUTBYTE(b) \
X{ if (out_offset < out_size) { \
X out_buf[out_offset++] = (char) (b); \
X } else { \
X flush_outbuf((b),1); \
X } \


X}
X
X
X/* ===========================================================================

X * Prototypes for local functions
X */
Xlocal int mem_read OF((char *buf, unsigned size));
Xlocal void flush_outbuf OF((unsigned w, unsigned size));
X
X/* ===========================================================================
X * Initialize the bit string routines.
X */
Xvoid bi_init (zipfile)
X FILE *zipfile; /* output zip file, NULL for in-memory compression */
X{
X zfile = zipfile;
X bi_buf = 0;
X bi_valid = 0;
X#ifdef DEBUG
X bits_sent = 0L;
X#endif
X
X /* Set the defaults for file compression. They are set by memcompress
X * for in-memory compression.
X */
X if (zfile != NULL) {
X out_buf = file_outbuf;
X out_size = sizeof(file_outbuf);
X out_offset = 0;
X read_buf = file_read;


X }
X}
X
X/* ===========================================================================

X * Send a value on a given number of bits.
X * IN assertion: length <= 16 and value fits in length bits.
X */
Xvoid send_bits(value, length)
X int value; /* value to send */
X int length; /* number of bits */
X{
X#ifdef DEBUG
X Tracevv((stderr," l %2d v %4x ", length, value));
X Assert(length > 0 && length <= 15, "invalid length");
X bits_sent += (ulg)length;
X#endif
X /* If not enough room in bi_buf, use (valid) bits from bi_buf and
X * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
X * unused bits in value.
X */
X if (bi_valid > (int)Buf_size - length) {
X bi_buf |= (value << bi_valid);
X PUTSHORT(bi_buf);
X bi_buf = (ush)value >> (Buf_size - bi_valid);
X bi_valid += length - Buf_size;
X } else {
X bi_buf |= value << bi_valid;
X bi_valid += length;


X }
X}
X
X/* ===========================================================================

X * Reverse the first len bits of a code, using straightforward code (a faster
X * method would use a table)
X * IN assertion: 1 <= len <= 15
X */
Xunsigned bi_reverse(code, len)
X unsigned code; /* the value to invert */
X int len; /* its bit length */
X{
X register unsigned res = 0;
X do {
X res |= code & 1;
X code >>= 1, res <<= 1;
X } while (--len > 0);
X return res >> 1;
X}
X
X/* ===========================================================================
X * Flush the current output buffer.
X */
Xlocal void flush_outbuf(w, size)
X unsigned w; /* value to flush */
X unsigned size; /* it size in bytes (0, 1 or 2) */
X{
X if (zfile == NULL) {
X error("output buffer too small for in-memory compression");
X }
X /* Encrypt and write the output buffer: */
X if (out_offset != 0) {
X zfwrite(out_buf, 1, (extent)out_offset, zfile);
X if (ferror(zfile)) error ("write error on zip file");
X }
X out_offset = 0;
X if (size == 2) {
X PUTSHORT(w);
X } else if (size == 1) {
X out_buf[out_offset++] = (char) (w & 0xff);


X }
X}
X
X/* ===========================================================================

X * Write out any remaining bits in an incomplete byte.
X */
Xvoid bi_windup()
X{
X if (bi_valid > 8) {
X PUTSHORT(bi_buf);
X } else if (bi_valid > 0) {
X PUTBYTE(bi_buf);
X }
X if (zfile != NULL) {
X flush_outbuf(0, 0);
X }
X bi_buf = 0;
X bi_valid = 0;
X#ifdef DEBUG
X bits_sent = (bits_sent+7) & ~7;
X#endif
X}
X
X/* ===========================================================================
X * Copy a stored block to the zip file, storing first the length and its
X * one's complement if requested.
X */
Xvoid copy_block(buf, len, header)
X char far *buf; /* the input data */
X unsigned len; /* its length */
X int header; /* true if block header must be written */
X{
X bi_windup(); /* align on byte boundary */
X
X if (header) {
X PUTSHORT((ush)len);
X PUTSHORT((ush)~len);
X#ifdef DEBUG
X bits_sent += 2*16;
X#endif
X }
X if (zfile) {
X flush_outbuf(0, 0);
X zfwrite(buf, 1, len, zfile);
X if (ferror(zfile)) error ("write error on zip file");
X } else if (out_offset + (ulg)len > out_size) {
X error("output buffer too small for in-memory compression");
X } else {
X memcpy(out_buf + out_offset, buf, len);
X out_offset += (ulg)len;
X }
X#ifdef DEBUG
X bits_sent += (ulg)len<<3;
X#endif


X}
X
X
X/* ===========================================================================

X * Return true if the zip file can be seeked. This is used to check if
X * the local header can be re-rewritten. This function always returns
X * true for in-memory compression.
X * IN assertion: the local header has already been written (ftell() > 0).
X */
Xint seekable()
X{
X return (zfile == NULL ||
X (fseek(zfile, -1L, SEEK_CUR) == 0 &&
X fseek(zfile, 1L, SEEK_CUR) == 0));
X}
X
X/* ===========================================================================
X * In-memory compression. This version can be used only if the entire input
X * fits in one memory buffer. The compression is then done in a single
X * call of memcompress(). (An extension to allow repeated calls would be
X * possible but is not needed here.)
X * The first two bytes of the compressed output are set to a short with the
X * method used (DEFLATE or STORE). The following four bytes contain the CRC.
X * The values are stored in little-endian order on all machines.
X * This function returns the byte size of the compressed output, including
X * the first six bytes (method and crc).
X */
X
Xulg memcompress(tgt, tgtsize, src, srcsize)
X char *tgt, *src; /* target and source buffers */
X ulg tgtsize, srcsize; /* target and source sizes */
X{
X ush att = (ush)UNKNOWN;
X ush flags = 0;
X ulg crc = 0;
X int method = DEFLATE;
X
X if (tgtsize <= 6L) error("target buffer too small");
X
X crc = updcrc((char *)NULL, 0);
X crc = updcrc(src, (extent) srcsize);
X
X read_buf = mem_read;
X in_buf = src;
X in_size = srcsize;
X in_offset = 0;
X
X out_buf = tgt;
X out_size = tgtsize;
X out_offset = 2 + 4;
X
X bi_init(NULL);
X ct_init(&att, &method);
X lm_init(level, &flags);
X deflate();
X
X /* For portability, force little-endian order on all machines: */
X tgt[0] = (char)(method & 0xff);
X tgt[1] = (char)((method >> 8) & 0xff);
X tgt[2] = (char)(crc & 0xff);
X tgt[3] = (char)((crc >> 8) & 0xff);
X tgt[4] = (char)((crc >> 16) & 0xff);
X tgt[5] = (char)((crc >> 24) & 0xff);
X
X return out_offset;
X}
X
X/* ===========================================================================
X * In-memory read function. As opposed to file_read(), this function
X * does not perform end-of-line translation, and does not update the
X * crc and input size.
X * Note that the size of the entire input buffer is an unsigned long,
X * but the size used in mem_read() is only an unsigned int. This makes a
X * difference on 16 bit machines. mem_read() may be called several
X * times for an in-memory compression.
X */
Xlocal int mem_read(buf, size)
X char *buf;
X unsigned size;
X{
X if (in_offset < in_size) {
X ulg block_size = in_size - in_offset;
X if (block_size > (ulg)size) block_size = (ulg)size;
X memcpy(buf, in_buf + in_offset, (unsigned)block_size);
X in_offset += block_size;
X return (int)block_size;
X } else {
X return 0; /* end of input */
X }
X}
END_OF_FILE
if test 11292 -ne `wc -c <'bits.c'`; then
echo shar: \"'bits.c'\" unpacked with wrong size!
fi
# end of 'bits.c'
fi
if test -f 'makecrc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makecrc.c'\"
else
echo shar: Extracting \"'makecrc.c'\" \(2388 characters\)
sed "s/^X//" >'makecrc.c' <<'END_OF_FILE'
X/* Not copyrighted 1990 Mark Adler */
X
X#include <stdio.h>
X
Xmain()
X/*
X Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
X x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
X
X Polynomials over GF(2) are represented in binary, one bit per coefficient,
X with the lowest powers in the most significant bit. Then adding polynomials
X is just exclusive-or, and multiplying a polynomial by x is a right shift by
X one. If we call the above polynomial p, and represent a byte as the
X polynomial q, also with the lowest power in the most significant bit (so the
X byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
X where a mod b means the remainder after dividing a by b.
X
X This calculation is done using the shift-register method of multiplying and
X taking the remainder. The register is initialized to zero, and for each
X incoming bit, x^32 is added mod p to the register if the bit is a one (where
X x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
X x (which is shifting right by one and adding x^32 mod p if the bit shifted
X out is a one). We start with the highest power (least significant bit) of
X q and repeat for all eight bits of q.
X
X The table is simply the CRC of all possible eight bit values. This is all
X the information needed to generate CRC's on data a byte at a time for all
X combinations of CRC register values and incoming bytes. The table is
X written to stdout as 256 long hexadecimal values in C language format.
X*/
X{
X unsigned long c; /* crc shift register */
X unsigned long e; /* polynomial exclusive-or pattern */
X int i; /* counter for all possible eight bit values */
X int k; /* byte being shifted into crc apparatus */
X
X /* terms of polynomial defining this crc (except x^32): */
X static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
X
X /* Make exclusive-or pattern from polynomial */
X e = 0;
X for (i = 0; i < sizeof(p)/sizeof(int); i++)
X e |= 1L << (31 - p[i]);
X
X /* Compute and print table of CRC's, five per line */
X printf(" 0x00000000L");
X for (i = 1; i < 256; i++)
X {
X c = 0;
X for (k = i | 256; k != 1; k >>= 1)
X {
X c = c & 1 ? (c >> 1) ^ e : c >> 1;
X if (k & 1)
X c ^= e;
X }
X printf(i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
X }
X putchar('\n');
X return 0;
X}
END_OF_FILE
if test 2388 -ne `wc -c <'makecrc.c'`; then
echo shar: \"'makecrc.c'\" unpacked with wrong size!
fi
# end of 'makecrc.c'
fi
if test -f 'os2/makefile.os2.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'os2/makefile.os2.UU'\"
else
echo shar: Extracting \"'os2/makefile.os2.UU'\" \(8519 characters\)
sed "s/^X//" >'os2/makefile.os2.UU' <<'END_OF_FILE'
Xbegin 666 os2/makefile.os2


XM(R!-86ME9FEL92!F;W(@6FEP+"!::7!#;&]A:RP@6FEP3F]T92!A;F0@6FEP

XM4W!L:70-"@T*(R!3=7!P;W)T960@36%K92!U=&EL:71I97,Z#0HC("T@36EC
XM<F]S;V9T+TE"32!N;6%K90T*(R M(&1M86ME(#,N." H<&%R86QL96P@;6%K
XM92P@=7-E("U0-"!I9B!Y;W4@:&%V92!T:&4@;65M;W)Y*2P-"B,@("!I;B!T
XM:&4@97AE(&9I;&4@=&%R9V5T<RP@>6]U('=I;&P@:&%V92!T;R!A9&0@<W!A
XM8V5S(&)E9F]R92 D0"!F;W(@9V-C#0HC("T@3D]4('=A=&-O;2!M86ME("AB
XM<F%I;B!D96%D+"!A<'!A<F5N=&QY(&1O97-N)W0@:VYO=R!L:6YE<R!C;VYT
XM)V0@=VET:"!<*0T*(R M($Y/5"!'3E4@;6%K92 H8G5G9WDL(&EN8V]M<&%T
XM:6)L92D-"@T*(R!3=7!P;W)T960@0R!#;VUP:6QE<G,Z#0HC("T@36EC<F]S
XM;V9T($,@-BXP,"!U;F1E<B!/4R\R(#$N>" H,38M8FET*0T*(R M($=.52!G
XM8V,@*&5M>"!K:70I('5N9&5R($]3+S(@,BXP#0HC("T@24)-($,@4V5T+S(@
XM=6YD97(@3U,O,B R+C @(" @(" @("T@9&]E<R!N;W0@>65T('=O<FL@=VET
XM:"!!4TT@8V]D90T*(R M(%=A=&-O;2!#+S,X-B Y+C @=6YD97(@3U,O,B R
XM+C @(" M(&1O97,@;F]T('EE="!W;W)K('=I=&@@05--(&-O9&4-"@T*(R!3
XM=7!P;W)T960@07-S96UB;&5R<SH-"B,@+2!-:6-R;W-O9G0@34%332 V+C P
XM('=I=&@@35,@0RP@24)-($,L(%=A=&-O;2!##0HC("T@36EC<F]S;V9T($U!
XM4TT@-2YX>"!W:71H($U3($,L(&EF('5N8V]M;65N=" B;6%S;2(@;&EN92!N
XM96%R(&QI;F4@,34P#0HC("T@1TY5(&%S('=I=&@@1TY5(&=C8PT*#0HC(%1O
XM('5S92P@96YT97(@(FYM86ME+V1M86ME("UF(&UA:V5F:6QE+F]S,B(@*'1H
XM:7,@;6%K969I;&4@9&5P96YD<R!O;B!I=',-"B,@;F%M92!B96EN9R B;6%K
XM969I;&4N;W,R(BDN#0H-"B,@061D("U$3D]?05--('1O($-&3$%'4R!A;F0@
XM<F5M;W9E(&UA=&-H+F]B:B!F<F]M($]"2D\@:68@>6]U(&1O#0HC(&YO="!H
XM879E(&UA<VT@;W(@;6PN#0HC($%D9" M1$193E]!3$Q/0R!T;R!!4T9,04=3
XM(&EF('EO=2!H879E(&1E9FEN960@:70@:6X@=&%I;&]R+F@@;W(@0T9,04=3
XM#0H-"B,@3F]T97,@;VX@,38M8FET("A-:6-R;W-O9G0@0R V+C P*2!C;VUP
XM:6QA=&EO;CH-"@T*(R @(%1H92!R97-U;'1I;F<@<')O9W)A;7,@8V%N(&)E
XM('5S960@=6YD97(@3U,O,B!P<F]T96-T960@;6]D92!O;FQY+@T*(R @($$@
XM;&%R9V5R('-T86-K(&AA<R!T;R!B92!U<V5D(&9O<B!/4R\R(&)E8V%U<V4@
XM<WES=&5M(&-A;&QS#0HC(" @=7-E(&UO<F4@<W1A8VL@=&AA;B!U;F1E<B!$
XM3U,L(#AK(&ES(')E8V]M;65N9&5D(&)Y($UI8W)O<V]F="X-"B,@("!.;W1E
XM('1H870@7U]35$1#7U\@:&%S('1O(&)E(&1E9FEN960@97AP;&EC:71L>2!W
XM:71H($,@-BXP,"!W:&5N("U:90T*(R @(&ES(&=I=F5N+"!B96-A=7-E($UI
XM8W)O<V]F="!D:7-A8FQE<R!?7U-41$-?7R!W:&5N('1H96ER(&5X=&5N<VEO
XM;G,-"B,@("!A<F4@96YA8FQE9"X@5&AI<R!I<R!D:69F97)E;G0@9G)O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E:6\N8R!Z:7 N:"!Z:7!E<G(N:"!T86EL;W(N: T*
XM"20H0T,I("UC("0H0T9,04=3*2 M1%5424P@)"A/550I)$ @9FEL96EO+F,-
XM"@T*=71I;%\D*$]"2BDZ"75T:6PN8R!Z:7 N:"!Z:7!E<G(N:"!T86EL;W(N
XM:"!O<S)Z:7 N: T*"20H0T,I("UC("0H0T9,04=3*2 M1%5424P@)"A/550I
XM)$ @=71I;"YC#0H-"F-R>7!T7R0H3T)**3H)8W)Y<'0N8R!Z:7 N:"!Z:7!E
XM<G(N:"!T86EL;W(N: T*"20H0T,I("UC("0H0T9,04=3*2 M1%5424P@)"A/
XM550I)$ @8W)Y<'0N8PT*#0IO<S)Z:7!?)"A/0DHI.B!O<S)Z:7 N8R!O<S)Z
XM:7 N: T*"20H0T,I("UC("0H0T9,04=3*2 M1%5424P@)"A/550I)$ @;W,R
XM>FEP+F,-"@T*>FEP+F5X93H@)"A/0DI:*2 D*$]"2DDI("0H3T)*02D@)"A$
XM148I#0H))"A#0RD@)"A,1$9,04=3*21 ("0H1$5&*2 D*$]"2EHI("0H3T)*
XM22D@)"A/0DI!*2 D*$Q$1DQ!1U,R*0T*#0IZ:7!C;&]A:RYE>&4Z("0H3T)*
XM0RD@)"A$148I#0H))"A#0RD@)"A,1$9,04=3*21 ("0H1$5&*2 D*$]"2D,I
XM("0H3$1&3$%'4S(I#0H-"GII<&YO=&4N97AE.B D*$]"2DXI("0H1$5&*0T*
XM"20H0T,I("0H3$1&3$%'4RDD0" D*$1%1BD@)"A/0DI.*2 D*$Q$1DQ!1U,R
XM*0T*#0IZ:7!S<&QI="YE>&4Z("0H3T)*4RD@)"A$148I#0H))"A#0RD@)"A,
XF1$9,04=3*21 ("0H1$5&*2 D*$]"2E,I("0H3$1&3$%'4S(I#0I#
X
Xend
END_OF_FILE
if test 8519 -ne `wc -c <'os2/makefile.os2.UU'`; then
echo shar: \"'os2/makefile.os2.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'os2/makefile.os2'\" \(6158 characters\)
cat os2/makefile.os2.UU | uudecode
if test 6158 -ne `wc -c <'os2/makefile.os2'`; then
echo shar: \"'os2/makefile.os2'\" uudecoded with wrong size!
else
rm os2/makefile.os2.UU
fi
fi
# end of 'os2/makefile.os2.UU'
fi
if test -f 'vms/VMSmunch.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/VMSmunch.c'\"
else
echo shar: Extracting \"'vms/VMSmunch.c'\" \(11629 characters\)
sed "s/^X//" >'vms/VMSmunch.c' <<'END_OF_FILE'
X/*---------------------------------------------------------------------------
X
X VMSmunch.c version 1.2 28 Apr 1992
X
X This routine is a blatant and unrepentent appropriation of all the nasty
X and difficult-to-do and complicated VMS shenanigans which Joe Meadows has
X so magnificently captured in his FILE utility. Not only that, it's even
X allowed! (see below). But let it be clear at the outset that Joe did all
X the work; yea, verily, he is truly a godlike unit.
X
X The appropriations and modifications herein were performed primarily by
X him known as "Cave Newt," although the Info-ZIP working group probably had
X their fingers in it somewhere along the line. The idea is to put the raw
X power of Joe's original routine at the disposal of various routines used
X by UnZip (and Zip, possibly), not least among them the utime() function.
X Read on for details...
X
X ---------------------------------------------------------------------------
X
X Usage (i.e., "interface," in geek-speak):
X
X int VMSmunch( char *filename, int action, char *ptr );
X
X filename the name of the file on which to be operated, obviously
X action an integer which specifies what action to take
X ptr pointer to any extra item which may be needed (else NULL)
X
X The possible values for the action argument are as follows:
X
X GET_TIMES get the creation and revision dates of filename; ptr
X must point to an empty VMStimbuf struct, as defined below
X (with room for at least 24 characters, including term.)
X SET_TIMES set the creation and revision dates of filename (utime
X option); ptr must point to a valid VMStimbuf struct,
X as defined below
X GET_RTYPE get the record type of filename; ptr must point to an
X integer which, on return, is set to the type (as defined
X in VMSmunch.h: FAT$C_* defines)
X CHANGE_RTYPE change the record type to that specified by the integer
X to which ptr points; save the old record type (later
X saves overwrite earlier ones)
X RESTORE_RTYPE restore the record type to the previously saved value;
X or, if none, set it to "fixed-length, 512-byte" record
X format (ptr not used)
X
X ---------------------------------------------------------------------------
X
X Comments from FILE.C, a utility to modify file characteristics:
X
X Written by Joe Meadows Jr, at the Fred Hutchinson Cancer Research Center
X BITNET: JOE@FHCRCVAX
X PHONE: (206) 467-4970
X
X There are no restrictions on this code, you may sell it, include it
X with any commercial package, or feed it to a whale.. However, I would
X appreciate it if you kept this comment in the source code so that anyone
X receiving this code knows who to contact in case of problems. Note that
X I do not demand this condition..
X
X ---------------------------------------------------------------------------*/
X
X
X
X
X/*****************************/
X/* Includes, Defines, etc. */
X/*****************************/
X
X#include <descrip.h>
X#include <rms.h>
X#include <stdio.h>
X#include <iodef.h>
X#include <atrdef.h> /* this gets created with the c3.0 compiler */
X#include <fibdef.h> /* this gets created with the c3.0 compiler */
X
X#include "VMSmunch.h" /* GET/SET_TIMES, RTYPE, fatdef.h, etc. */
X
X#define RTYPE fat$r_rtype_overlay.fat$r_rtype_bits
X#define RATTRIB fat$r_rattrib_overlay.fat$r_rattrib_bits
X
Xstatic void asctim();
Xstatic void bintim();
X
Xstruct VMStimbuf { /* VMSmunch */


X char *actime; /* VMS revision date, ASCII format */
X char *modtime; /* VMS creation date, ASCII format */

X};
X
X/* from <ssdef.h> */
X#ifndef SS$_NORMAL
X# define SS$_NORMAL 1
X# define SS$_BADPARAM 20
X#endif


X
X
X
X
X

X/*************************/
X/* Function VMSmunch() */
X/*************************/
X
Xint VMSmunch( filename, action, ptr )
X char *filename, *ptr;
X int action;
X{
X
X /* original file.c variables */
X
X static struct FAB Fab;
X static struct NAM Nam;
X static struct fibdef Fib; /* short fib */
X
X static struct dsc$descriptor FibDesc =
X {sizeof(Fib),DSC$K_DTYPE_Z,DSC$K_CLASS_S,&Fib};


X static struct dsc$descriptor_s DevDesc =

X {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.nam$t_dvi[1]};
X static struct fatdef Fat;
X static union {
X struct fchdef fch;
X long int dummy;
X } uchar;
X static struct fjndef jnl;
X static long int Cdate[2],Rdate[2],Edate[2],Bdate[2];
X static short int revisions;
X static unsigned long uic;
X static union {
X unsigned short int value;
X struct {
X unsigned system : 4;
X unsigned owner : 4;
X unsigned group : 4;
X unsigned world : 4;
X } bits;
X } prot;
X
X static struct atrdef Atr[] = {
X {sizeof(Fat),ATR$C_RECATTR,&Fat}, /* record attributes */
X {sizeof(uchar),ATR$C_UCHAR,&uchar}, /* File characteristics */
X {sizeof(Cdate),ATR$C_CREDATE,&Cdate[0]}, /* Creation date */
X {sizeof(Rdate),ATR$C_REVDATE,&Rdate[0]}, /* Revision date */
X {sizeof(Edate),ATR$C_EXPDATE,&Edate[0]}, /* Expiration date */
X {sizeof(Bdate),ATR$C_BAKDATE,&Bdate[0]}, /* Backup date */
X {sizeof(revisions),ATR$C_ASCDATES,&revisions}, /* number of revisions */
X {sizeof(prot),ATR$C_FPRO,&prot}, /* file protection */
X {sizeof(uic),ATR$C_UIC,&uic}, /* file owner */
X {sizeof(jnl),ATR$C_JOURNAL,&jnl}, /* journal flags */
X {0,0,0}
X } ;
X
X static char EName[NAM$C_MAXRSS];
X static char RName[NAM$C_MAXRSS];
X static struct dsc$descriptor_s FileName =
X {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
X static struct dsc$descriptor_s string = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
X static short int DevChan;
X static short int iosb[4];
X
X static long int i,status;
X/* static char *retval; */
X
X
X /* new VMSmunch variables */
X
X static int old_rtype=FAT$C_FIXED; /* storage for record type */
X
X
X
X/*---------------------------------------------------------------------------
X Initialize attribute blocks, parse filename, resolve any wildcards, and
X get the file info.
X ---------------------------------------------------------------------------*/
X
X /* initialize RMS structures, we need a NAM to retrieve the FID */
X Fab = cc$rms_fab;
X Fab.fab$l_fna = filename;
X Fab.fab$b_fns = strlen(filename);
X Fab.fab$l_nam = &Nam; /* FAB has an associated NAM */
X Nam = cc$rms_nam;
X Nam.nam$l_esa = &EName; /* expanded filename */
X Nam.nam$b_ess = sizeof(EName);
X Nam.nam$l_rsa = &RName; /* resultant filename */
X Nam.nam$b_rss = sizeof(RName);
X
X /* do $PARSE and $SEARCH here */
X status = sys$parse(&Fab);
X if (!(status & 1)) return(status);
X
X /* search for the first file.. If none signal error */
X status = sys$search(&Fab);
X if (!(status & 1)) return(status);
X
X while (status & 1) {
X /* initialize Device name length, note that this points into the NAM
X to get the device name filled in by the $PARSE, $SEARCH services */
X DevDesc.dsc$w_length = Nam.nam$t_dvi[0];
X
X status = sys$assign(&DevDesc,&DevChan,0,0);
X if (!(status & 1)) return(status);
X
X FileName.dsc$a_pointer = Nam.nam$l_name;
X FileName.dsc$w_length = Nam.nam$b_name+Nam.nam$b_type+Nam.nam$b_ver;
X
X /* Initialize the FIB */
X for (i=0;i<3;i++)
X Fib.fib$r_fid_overlay.fib$w_fid[i]=Nam.nam$w_fid[i];
X for (i=0;i<3;i++)
X Fib.fib$r_did_overlay.fib$w_did[i]=Nam.nam$w_did[i];
X
X /* Use the IO$_ACCESS function to return info about the file */
X /* Note, used this way, the file is not opened, and the expiration */
X /* and revision dates are not modified */
X status = sys$qiow(0,DevChan,IO$_ACCESS,&iosb,0,0,
X &FibDesc,&FileName,0,0,&Atr,0);
X if (!(status & 1)) return(status);


X status = iosb[0];

X if (!(status & 1)) return(status);
X
X /*-----------------------------------------------------------------------
X We have the current information from the file: now see what user
X wants done with it.
X -----------------------------------------------------------------------*/
X
X switch (action) {
X
X case GET_TIMES:
X asctim(((struct VMStimbuf *)ptr)->modtime, Cdate);
X asctim(((struct VMStimbuf *)ptr)->actime, Rdate);
X break;
X
X case SET_TIMES:
X bintim(((struct VMStimbuf *)ptr)->modtime, Cdate);
X bintim(((struct VMStimbuf *)ptr)->actime, Rdate);
X break;
X
X case GET_RTYPE: /* non-modifying */
X *(int *)ptr = Fat.RTYPE.fat$v_rtype;
X return RMS$_NORMAL; /* return to user */
X break;
X
X case CHANGE_RTYPE:
X old_rtype = Fat.RTYPE.fat$v_rtype; /* save current one */
X if ((*(int *)ptr < FAT$C_UNDEFINED) ||
X (*(int *)ptr > FAT$C_STREAMCR))
X Fat.RTYPE.fat$v_rtype = FAT$C_STREAMLF; /* Unix I/O happy */
X else
X Fat.RTYPE.fat$v_rtype = *(int *)ptr;
X break;
X
X case RESTORE_RTYPE:
X Fat.RTYPE.fat$v_rtype = old_rtype;
X break;
X
X default:
X return SS$_BADPARAM; /* anything better? */
X }
X
X /*-----------------------------------------------------------------------
X Go back and write modified data to the file header.
X -----------------------------------------------------------------------*/
X
X /* note, part of the FIB was cleared by earlier QIOW, so reset it */
X Fib.fib$r_acctl_overlay.fib$l_acctl = FIB$M_NORECORD;
X for (i=0;i<3;i++)
X Fib.fib$r_fid_overlay.fib$w_fid[i]=Nam.nam$w_fid[i];
X for (i=0;i<3;i++)
X Fib.fib$r_did_overlay.fib$w_did[i]=Nam.nam$w_did[i];
X
X /* Use the IO$_MODIFY function to change info about the file */
X /* Note, used this way, the file is not opened, however this would */
X /* normally cause the expiration and revision dates to be modified. */
X /* Using FIB$M_NORECORD prohibits this from happening. */
X status = sys$qiow(0,DevChan,IO$_MODIFY,&iosb,0,0,
X &FibDesc,&FileName,0,0,&Atr,0);
X if (!(status & 1)) return(status);
X


X status = iosb[0];

X if (!(status & 1)) return(status);


X
X status = sys$dassgn(DevChan);

X if (!(status & 1)) return(status);
X
X /* look for next file, if none, no big deal.. */
X status = sys$search(&Fab);
X }
X} /* end function VMSmunch() */


X
X
X
X
X

X/***********************/
X/* Function bintim() */
X/***********************/
X
Xvoid asctim(time,binval) /* convert 64-bit binval to string, put in time */
X char *time;
X long int binval[2];
X{
X static struct dsc$descriptor date_str={23,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};


X /* dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer */
X

X date_str.dsc$a_pointer = time;
X sys$asctim(0, &date_str, binval, 0);
X time[23] = '\0';
X}
X
X
X
X
X
X/***********************/
X/* Function bintim() */
X/***********************/
X
Xvoid bintim(time,binval) /* convert time string to 64 bits, put in binval */
X char *time;
X long int binval[2];
X{
X static struct dsc$descriptor date_str={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
X
X date_str.dsc$w_length = strlen(time);
X date_str.dsc$a_pointer = time;
X sys$bintim(&date_str, binval);
X}
END_OF_FILE
if test 11629 -ne `wc -c <'vms/VMSmunch.c'`; then
echo shar: \"'vms/VMSmunch.c'\" unpacked with wrong size!
fi
# end of 'vms/VMSmunch.c'
fi
if test -f 'zipnote.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zipnote.c'\"
else
echo shar: Extracting \"'zipnote.c'\" \(9993 characters\)
sed "s/^X//" >'zipnote.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zipnote.c by Mark Adler.


X */
X
X#define UTIL
X#include "revision.h"
X#include "zip.h"
X#include <signal.h>
X
X

X/* Character to mark zip entry names in the comment file */
X#define MARK '@'


X
X/* Temporary zip file name and file pointer */
Xlocal char *tempzip;
Xlocal FILE *tempzf;

X
X
X/* Local functions */
X#ifdef PROTO
X local void handler(int);
X local void license(void);
X local void help(void);

X local void putclean(char *, int);
X local int catalloc(char * far *, char *);


X void main(int, char **);
X#endif /* PROTO */
X
X

X
Xvoid err(c, h)
Xint c; /* error code from the ZE_ class */
Xchar *h; /* message about how it happened */
X/* Issue a message for the error, clean up files and memory, and exit. */
X{
X if (PERR(c))

X perror("zipnote error");
X fprintf(stderr, "zipnote error: %s (%s)\n", errors[c-1], h);


X if (tempzf != NULL)
X fclose(tempzf);

X if (tempzip != NULL)
X {

X destroy(tempzip);
X free((voidp *)tempzip);
X }


X if (zipfile != NULL)
X free((voidp *)zipfile);
X#ifdef VMS
X exit(0);
X#else /* !VMS */
X exit(c);

X#endif /* ?VMS */
X}

X
X
Xlocal void handler(s)
Xint s; /* signal number (ignored) */
X/* Upon getting a user interrupt, abort cleanly using err(). */
X{
X#ifndef MSDOS
X putc('\n', stderr);
X#endif /* !MSDOS */
X err(ZE_ABORT, "aborting");
X s++; /* keep some compilers happy */
X}
X
X
Xvoid warn(a, b)
Xchar *a, *b; /* message strings juxtaposed in output */
X/* Print a warning message to stderr and return. */
X{

X fprintf(stderr, "zipnote warning: %s%s\n", a, b);


X}
X
X
Xlocal void license()
X/* Print license information to stdout. */
X{
X extent i; /* counter for copyright array */
X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {

X printf(copyright[i], "zipnote");


X putchar('\n');
X }
X for (i = 0; i < sizeof(disclaimer)/sizeof(char *); i++)
X puts(disclaimer[i]);
X}
X
X
Xlocal void help()
X/* Print help (along with license info) to stdout. */
X{
X extent i; /* counter for help array */
X
X /* help array */
X static char *text[] = {
X"",

X"ZipNote %d.%d (%s)",
X"Usage: zipnote [-w] [-b path] zipfile",
X" the default action is to write the comments in zipfile to stdout",
X" -w write the zipfile comments from stdin",
X" -b use \"path\" for the temporary zip file",
X" -h show this help -L show software license",
X"",
X"Example:",
X#ifdef VMS
X" define/user sys$output foo.tmp",
X" zipnote foo.zip",
X" edit foo.tmp",
X" ... then you edit the comments, save, and exit ...",
X" define/user sys$input foo.tmp",
X" zipnote -w foo.zip"
X#else /* !VMS */
X" zipnote foo.zip > foo.tmp",
X" ed foo.tmp",
X" ... then you edit the comments, save, and exit ...",
X" zipnote -w foo.zip < foo.tmp"
X#endif /* ?VMS */
X };


X
X for (i = 0; i < sizeof(copyright)/sizeof(char *); i++) {

X printf(copyright[i], "zipnote");


X putchar('\n');
X }
X for (i = 0; i < sizeof(text)/sizeof(char *); i++)
X {
X printf(text[i], REVISION / 10, REVISION % 10, REVDATE);
X putchar('\n');
X }
X}
X
X

Xlocal void putclean(s, n)
Xchar *s; /* string to write to stdout */
Xint n; /* length of string */
X/* Write the string s to stdout, filtering out control characters that are
X not tab or newline (mainly to remove carriage returns), and prefix MARK's
X and backslashes with a backslash. Also, terminate with a newline if
X needed. */
X{
X int c; /* next character in string */
X int e; /* last character written */
X
X e = '\n'; /* if empty, write nothing */
X while (n--)
X {
X c = *(uch *)s++;
X if (c == MARK || c == '\\')
X putchar('\\');
X if (c >= ' ' || c == '\t' || c == '\n')
X putchar(e = c);
X }
X if (e != '\n')


X putchar('\n');
X}
X

X
Xlocal int catalloc(a, s)
Xchar * far *a; /* pointer to a pointer to a malloc'ed string */
Xchar *s; /* string to concatenate on a */
X/* Concatentate the string s to the malloc'ed string pointed to by a.
X Preprocess s by removing backslash escape characters. */
X{
X char *p; /* temporary pointer */
X char *q; /* temporary pointer */
X
X for (p = q = s; *q; *p++ = *q++)
X if (*q == '\\' && *(q+1))
X q++;
X *p = 0;
X if ((p = malloc(strlen(*a) + strlen(s) + 3)) == NULL)
X return ZE_MEM;
X strcat(strcat(strcpy(p, *a), **a ? "\r\n" : ""), s);
X free((voidp *)*a);
X *a = p;
X return ZE_OK;


X}
X
X
Xvoid main(argc, argv)
Xint argc; /* number of tokens in command line */
Xchar **argv; /* command line tokens */

X/* Write the comments in the zipfile to stdout, or read them from stdin. */
X{
X char a[FNMAX+1]; /* input line buffer */
X ulg c; /* start of central directory */


X int k; /* next argument type */

X char *q; /* steps through option arguments */
X int r; /* arg counter, temporary variable */
X ulg s; /* length of central directory */
X int t; /* attributes of zip file */
X int w; /* true if updating zip file from stdin */
X FILE *x, *y; /* input and output zip files */


X struct zlist far *z; /* steps through zfiles linked list */
X
X
X /* If no args, show help */
X if (argc == 1)
X {
X help();
X exit(0);
X }
X
X init_upper(); /* build case map table */
X
X /* Go through args */

X zipfile = tempzip = NULL;
X tempzf = NULL;

X signal(SIGINT, handler);
X signal(SIGTERM, handler);

X k = w = 0;


X for (r = 1; r < argc; r++)
X if (*argv[r] == '-')
X if (argv[r][1])
X for (q = argv[r]+1; *q; q++)
X switch(*q)
X {

X case 'b': /* Specify path for temporary file */
X if (k)
X err(ZE_PARMS, "use -b before zip file name");


X else
X k = 1; /* Next non-option is path */
X break;
X case 'h': /* Show help */
X help(); exit(0);

X case 'l': case 'L': /* Show copyright and disclaimer */
X license(); exit(0);

X case 'w':
X w = 1; break;


X default:
X err(ZE_PARMS, "unknown option");
X }
X else
X err(ZE_PARMS, "zip file cannot be stdin");
X else
X if (k == 0)
X if (zipfile == NULL)
X {
X if ((zipfile = ziptyp(argv[r])) == NULL)
X err(ZE_MEM, "was processing arguments");
X }
X else
X err(ZE_PARMS, "can only specify one zip file");
X else

X {
X tempath = argv[r];
X k = 0;
X }

X if (zipfile == NULL)
X err(ZE_PARMS, "need to specify zip file");
X
X /* Read zip file */
X if ((r = readzipfile()) != ZE_OK)
X err(r, zipfile);
X if (zfiles == NULL)
X err(ZE_NAME, zipfile);
X

X /* Put comments to stdout, if not -w */
X if (!w)
X {
X for (z = zfiles; z != NULL; z = z->nxt)
X {
X printf("%c %s\n", MARK, z->zname);
X putclean(z->comment, z->com);
X putchar(MARK); putchar('\n');
X }
X putchar(MARK); putchar('\n');
X putclean(zcomment, zcomlen);
X exit(ZE_OK);
X }
X
X /* If updating comments, make sure zip file is writeable */
X if ((x = fopen(zipfile, "a")) == NULL)


X err(ZE_CREAT, zipfile);
X fclose(x);

X t = getfileattr(zipfile);
X
X /* Process stdin, replacing comments */
X for (z = zfiles; z != NULL; z = z->nxt)
X {
X if (gets(a) == NULL || a[0] != MARK || a[1] != ' ' ||
X strcmp(a + 2, z->zname))
X err(ZE_NOTE, "missing entry name");
X if (z->com)
X free((voidp *)z->comment);
X z->comment = malloc(1); *(z->comment) = 0;
X while (gets(a) != NULL && *a != MARK)
X if ((r = catalloc(&(z->comment), a)) != ZE_OK)
X err(r, "was building new comments");
X if (a[1])
X err(ZE_NOTE, "missing comment end line");
X z->com = strlen(z->comment);
X }
X if (gets(a) == NULL || a[0] != MARK || a[1])
X err(ZE_NOTE, "missing zip file comment marker line");
X zcomment = malloc(1); *zcomment = 0;
X while (gets(a) != NULL)
X if ((r = catalloc(&zcomment, a)) != ZE_OK)
X err(r, "was building new comments");


X zcomlen = strlen(zcomment);
X

X /* Open output zip file for writing */
X if ((tempzf = y = fopen(tempzip = tempname(zipfile), FOPW)) == NULL)
X err(ZE_TEMP, tempzip);
X
X /* Open input zip file again, copy preamble if any */
X if ((x = fopen(zipfile, FOPR)) == NULL)
X err(ZE_NAME, zipfile);


X if (zipbeg && (r = fcopy(x, y, zipbeg)) != ZE_OK)
X err(r, r == ZE_TEMP ? tempzip : zipfile);

X
X /* Go through local entries, copying them over as is */
X for (z = zfiles; z != NULL; z = z->nxt)


X if ((r = zipcopy(z, x, y)) != ZE_OK)

X err(r, "was copying an entry");
X fclose(x);
X
X /* Write central directory and end of central directory with new comments */
X if ((c = ftell(y)) == -1L) /* get start of central */
X err(ZE_TEMP, tempzip);
X for (z = zfiles; z != NULL; z = z->nxt)


X if ((r = putcentral(z, y)) != ZE_OK)
X err(r, tempzip);

X if ((s = ftell(y)) == -1L) /* get end of central */
X err(ZE_TEMP, tempzip);
X s -= c; /* compute length of central */
X if ((r = putend((int)zcount, s, c, zcomlen, zcomment, y)) != ZE_OK)


X err(r, tempzip);
X tempzf = NULL;
X if (fclose(y))

X err(ZE_TEMP, tempzip);


X if ((r = replace(zipfile, tempzip)) != ZE_OK)
X {
X warn("new zip file left as: ", tempzip);
X free((voidp *)tempzip);
X tempzip = NULL;

X err(r, "was replacing the original zip file");
X }


X free((voidp *)tempzip);
X tempzip = NULL;

X setfileattr(zipfile, t);


X free((voidp *)zipfile);
X zipfile = NULL;
X

X /* Done! */
X exit(ZE_OK);
X}
END_OF_FILE
if test 9993 -ne `wc -c <'zipnote.c'`; then
echo shar: \"'zipnote.c'\" unpacked with wrong size!
fi
# end of 'zipnote.c'
fi
if test -f 'zipup.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'zipup.c'\"
else
echo shar: Extracting \"'zipup.c'\" \(12100 characters\)
sed "s/^X//" >'zipup.c' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * zipup.c by Mark Adler. Includes modifications by Jean-loup Gailly.
X */
X
X#define NOCPYRT /* this is not a main module */
X#include <ctype.h>
X#include "zip.h"
X#include "revision.h"
X#ifdef OS2
X# include "os2zip.h"
X#endif
X
X/* Use the raw functions for MSDOS and Unix to save on buffer space.
X They're not used for VMS since it doesn't work (raw is weird on VMS).
X (This sort of stuff belongs in fileio.c, but oh well.) */
X#ifdef VMS
X# define fhow "r"
X# define fbad NULL
X typedef void *ftype;
X# define zopen(n,p) (vms_native?vms_open(n) :(ftype)fopen((n),(p)))
X# define zread(f,b,n) (vms_native?vms_read(f,b,n):fread((b),1,(n),(FILE*)(f)))
X# define zclose(f) (vms_native?vms_close(f) :fclose((FILE*)(f)))
X# define zerr(f) (vms_native?vms_error(f) :ferror((FILE*)(f)))
X# define zstdin stdin
X ftype vms_open OF((char *));
X int vms_read OF((ftype, char *, int));
X int vms_close OF((ftype));
X int vms_error OF((ftype));
X#else /* !VMS */
X# if defined(MSDOS) && !defined(ATARI_ST)


X# include <io.h>
X# include <fcntl.h>

X# define fhow (O_RDONLY|O_BINARY)


X# else /* !MSDOS */

X int open OF((char *, int));
X int read OF((int, char *, int));
X int close OF((int));
X int lseek OF((int, long, int));
X# define fhow 0


X# endif /* ?MSDOS */

X typedef int ftype;
X# define fbad (-1)
X# define zopen(n,p) open(n,p)
X# define zread(f,b,n) read(f,b,n)
X# define zclose(f) close(f)
X# define zerr(f) (k==(extent)(-1L))
X# define zstdin 0


X#endif /* ?VMS */
X
X

X/* Local data */
X
X#ifndef UTIL
Xlocal ulg crc; /* crc on uncompressed file data */
Xlocal ftype ifile; /* file to compress */
X#endif
Xulg isize; /* input file size. global only for debugging */

X
X/* Local functions */

X#if defined(PROTO) && !defined(UTIL)
X local int suffixes(char *, char *);
X#endif
X
X
X/* Note: a zip "entry" includes a local header (which includes the file
X name), an encryption header if encrypting, the compressed data
X and possibly an extended local header. */
X
Xint zipcopy(z, x, y)
Xstruct zlist far *z; /* zip entry to copy */
XFILE *x, *y; /* source and destination files */
X/* Copy the zip entry described by *z from file *x to file *y. Return an
X error code in the ZE_ class. Also update tempzn by the number of bytes
X copied. */
X{
X ulg n; /* holds local header offset */
X
X if (fseek(x, z->off, SEEK_SET))
X return ferror(x) ? ZE_READ : ZE_EOF;
X z->off = tempzn;
X n = 4 + LOCHEAD + (long)z->nam + (long)z->ext + z->siz;
X /* copy the extended local header if there is one */
X if (z->lflg & 8) n += 16;
X tempzn += n;
X return fcopy(x, y, n);


X}
X
X
X#ifndef UTIL
X

Xint percent(n, m)
Xlong n, m; /* n is the original size, m is the new size */
X/* Return the percentage compression from n to m using only integer
X operations */
X{
X if (n > 0xffffffL) /* If n >= 16M */
X { /* then divide n and m by 256 */
X n += 0x80; n >>= 8;
X m += 0x80; m >>= 8;
X }
X return n ? (int)(1 + (200 * (n - m)/n)) / 2 : 0;
X}
X
Xlocal int suffixes(a, s)
Xchar *a; /* name to check suffix of */
Xchar *s; /* list of suffixes separated by : or ; */
X/* Return true if a ends in any of the suffixes in the list s. */
X{
X int m; /* true if suffix matches so far */
X char *p; /* pointer into special */
X char *q; /* pointer into name a */
X
X m = 1;
X#ifdef VMS
X if( (q = strrchr(a,';')) != NULL ) /* Cut out VMS file version */
X --q;
X else
X q = a + strlen(a) - 1;
X#else
X q = a + strlen(a) - 1;
X#endif
X for (p = s + strlen(s) - 1; p >= s; p--)
X if (*p == ':' || *p == ';')
X if (m)
X return 1;
X else
X {
X m = 1;
X#ifdef VMS
X if( (q = strrchr(a,';')) != NULL ) /* Cut out VMS file version */
X --q;
X else
X q = a + strlen(a) - 1;
X#else
X q = a + strlen(a) - 1;
X#endif
X }
X else
X {
X m = m && q >= a && case_map(*p) == case_map(*q);
X q--;
X }


X return m;
X}
X

Xint zipup(z, y)
Xstruct zlist far *z; /* zip entry to compress */
XFILE *y; /* output file */
X/* Compress the file z->name into the zip entry described by *z and write
X it to the file *y. Encrypt if requested. Return an error code in the
X ZE_ class. Also, update tempzn by the number of bytes written. */
X{
X ulg a = 0L; /* attributes returned by filetime() */
X char *b; /* malloc'ed file buffer */
X extent k = 0; /* result of zread */
X int l = 0; /* true if this file is a symbolic link */
X int m; /* method for this entry */
X ulg o, p; /* offsets in zip file */
X long q = -2L; /* size returned by filetime */
X int r; /* temporary variable */
X ulg s = 0L; /* size of compressed data */
X
X if ((z->tim = filetime(z->name, &a, &q)) == 0 || q < -1L)
X return ZE_OPEN;
X /* q is set to -1 if the input file is a device */
X
X z->nam = strlen(z->zname);
X
X /* Select method based on the suffix and the global method */
X m = special != NULL && suffixes(z->name, special) ? STORE : method;
X
X /* Open file to zip up unless it is stdin */
X if (strcmp(z->name, "-") == 0)
X {
X ifile = (ftype)zstdin;
X#ifdef MSDOS
X setmode(zstdin, O_BINARY);
X#endif
X }
X else
X {
X#ifdef VMS
X if (vms_native)
X get_vms_attributes(z);
X#endif
X#ifdef OS2
X GetEAs(z->name, &z->extra, &z->ext, &z->cextra, &z->cext);
X /* store data in local header, and size only in central headers */
X#endif
X l = issymlnk(a);
X if (l)
X ifile = fbad;
X else if (z->name[z->nam - 1] == '/') { /* directory */
X ifile = fbad;
X m = STORE;
X }
X else if ((ifile = zopen(z->name, fhow)) == fbad)
X return ZE_OPEN;
X }
X
X if (l || q == 0)
X m = STORE;
X if (m == BEST)
X m = DEFLATE;
X
X /* Do not create STORED files with extended local headers if the
X * input size is not known, because such files could not be extracted.
X * So if the zip file is not seekable and the input file is not
X * on disk, obey the -0 option by forcing deflation with stored block.
X * Note however that using "zip -0" as filter is not very useful...
X * ??? to be done.
X */
X
X /* Fill in header information and write local header to zip file.
X * This header will later be re-written since compressed length and
X * crc are not yet known.
X */
X
X /* (Assume ext, cext, com, and zname already filled in.) */
X#ifdef OS2
X z->vem = z->dosflag ? 20 : /* Made under MSDOS by PKZIP 2.0 */
X /* We for a FAT file system, we must cheat and pretend that the
X * file was not made on OS2 but under DOS. unzip is confused otherwise.
X */
X#else
X z->vem = dosify ? 20 : /* Made under MSDOS by PKZIP 2.0 */
X#endif
X#ifdef VMS
X 0x200 + REVISION; /* Made under VMS by this Zip */
X#else /* !VMS */
X# ifdef OS2
X 0x600 + REVISION; /* Made under OS/2 by this Zip */


X# else /* !OS2 */

X# ifdef MSDOS
X 0 + REVISION; /* Made under MSDOS by this Zip */
X# else
X 0x300 + REVISION; /* Made under Unix by this Zip */


X# endif /* MSDOS */

X# endif /* ?OS2 */


X#endif /* ?VMS */
X

X z->ver = 20; /* Need PKUNZIP 2.0 */
X z->crc = 0; /* to be updated later */
X /* Assume first that we will need an extended local header: */
X z->flg = 8; /* to be updated later */
X#ifdef CRYPT


X if (key != NULL) {

X z->flg |= 1;
X /* Since we do not yet know the crc here, we pretend that the crc
X * is the modification time:
X */
X z->crc = z->tim << 16;
X }
X#endif
X z->lflg = z->flg;
X z->how = m; /* may be changed later */
X z->siz = m == STORE && q >= 0 ? q : 0; /* will be changed later */
X z->len = q >= 0 ? q : 0; /* may be changed later */
X z->dsk = 0;
X z->att = BINARY; /* may be changed later */
X z->atx = z->dosflag ? a & 0xff : a; /* Attributes from filetime() */
X z->off = tempzn;
X if ((r = putlocal(z, y)) != ZE_OK)
X return r;
X tempzn += 4 + LOCHEAD + z->nam + z->ext;
X
X#ifdef CRYPT


X if (key != NULL) {

X crypthead(key, z->crc, y);
X z->siz += 12; /* to be updated later */
X tempzn += 12;
X }
X#endif
X o = ftell(y); /* for debugging only */
X
X /* Write stored or deflated file to zip file */
X isize = 0L;
X crc = updcrc((char *)NULL, 0);
X
X if (m == DEFLATE) {
X bi_init(y);
X z->att = (ush)UNKNOWN;
X ct_init(&z->att, &m);
X lm_init(level, &z->flg);
X s = deflate();
X }
X else
X {
X if ((b = malloc(CBSZ)) == NULL)
X return ZE_MEM;
X
X if (z->name[z->nam - 1] != '/') /* no read for directories */
X while ((k = l ? rdsymlnk(z->name, b, CBSZ) : zread(ifile, b, CBSZ)) > 0)
X {
X isize += k;
X crc = updcrc(b, k);
X if (zfwrite(b, 1, k, y) != k)
X {
X free((voidp *)b);
X return ZE_TEMP;
X }
X#ifdef MINIX
X if (l)
X q = k;
X#endif /* MINIX */
X if (l)
X break;
X }
X free((voidp *)b);
X s = isize;
X }
X if (ifile != fbad && zerr(ifile))
X return ZE_READ;
X if (ifile != fbad)
X zclose(ifile);
X
X tempzn += s;
X p = tempzn; /* save for future fseek() */
X
X#ifndef VMS
X /* Check input size (but not in VMS--variable record lengths mess it up) */
X if (q >= 0 && isize != (ulg)q && !translate_eol)
X {
X fprintf(mesg, " i=%ld, q=%ld ", isize, q);
X error("incorrect input size");


X }
X#endif /* !VMS */

X
X /* Try to rewrite the local header with correct information */
X z->crc = crc;
X z->siz = s;
X#ifdef CRYPT


X if (key != NULL)

X z->siz += 12;
X#endif
X z->len = isize;
X if (fseek(y, z->off, SEEK_SET)) {
X if (z->how != (ush) m)
X error("can't rewrite method");
X if (m == STORE && q < 0)
X error("zip -0 not allowed for input/output from/to pipe or device");
X if ((r = putextended(z, y)) != ZE_OK)
X return r;
X tempzn += 16L;
X z->flg = z->lflg; /* if flg modified by inflate */
X } else {
X /* seek ok, ftell() should work, check compressed size */
X#ifndef VMS
X if (p - o != s) {
X fprintf(mesg, " s=%ld, actual=%ld ", s, p-o);
X error("incorrect compressed size");
X }
X#endif
X z->how = m;
X if ((z->flg & 1) == 0)
X z->flg &= ~8; /* clear the extended local header flag */
X z->lflg = z->flg;
X /* rewrite the local header: */
X if ((r = putlocal(z, y)) != ZE_OK)
X return r;
X if (fseek(y, p, SEEK_SET))
X return ZE_READ;
X if ((z->flg & 1) != 0) {
X /* encrypted file, extended header still required */
X if ((r = putextended(z, y)) != ZE_OK)
X return r;
X tempzn += 16L;
X }
X }
X
X /* Display statistics */
X if (noisy)
X {
X if (verbose)
X fprintf(mesg, " (in=%lu) (out=%lu)", isize, s);
X if (m == DEFLATE)
X fprintf(mesg, " (deflated %d%%)\n", percent(isize, s));
X else
X fprintf(mesg, " (stored 0%%)\n");
X fflush(mesg);


X }
X return ZE_OK;
X}
X
X

Xint file_read(buf, size)
X char *buf;
X unsigned size;
X/* Read a new buffer from the current input file, and update the crc and
X * input file size.
X * IN assertion: size >= 2 (for end-of-line translation)
X */
X{
X unsigned len;
X char far *b;
X if (translate_eol) {
X /* static char last_byte = '\0'; */
X size >>= 1;
X b = buf+size;
X size = len = zread(ifile, b, size);
X if (len == (unsigned)EOF || len == 0) return len;
X do {
X /* ??? keep cr lf intact */
X if ((*buf++ = *b++) == '\n') *(buf-1) = '\r', *buf++ = '\n', len++;
X } while (--size != 0);
X buf -= len;
X } else {
X len = zread(ifile, buf, size);
X if (len == (unsigned)EOF || len == 0) return len;
X }
X crc = updcrc(buf, len);
X isize += (ulg)len;
X return len;


X}
X#endif /* !UTIL */
END_OF_FILE

if test 12100 -ne `wc -c <'zipup.c'`; then
echo shar: \"'zipup.c'\" unpacked with wrong size!
fi
# end of 'zipup.c'
fi
echo shar: End of archive 8 \(of 11\).
cp /dev/null ark8isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:49:47 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 101
Archive-name: zip19/part09

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: atari/makefile.st infozip.who mac/macfile.c mac/macstat.c
# makefile msdos/makefile.msc.UU msdos/match.asm os2/match32.asm.UU
# vms/VMSmunch.h vms/vaxclib.opt
# Wrapped by kent@sparky on Sun Aug 23 01:00:46 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 9 (of 11)."'
if test -f 'atari/makefile.st' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/makefile.st'\"
else
echo shar: Extracting \"'atari/makefile.st'\" \(1949 characters\)
sed "s/^X//" >'atari/makefile.st' <<'END_OF_FILE'
X# Makefile for Zip, ZipNote and ZipSplit for
X# Atari ST with Turbo C 2.0.
X
X# To use, do "make -f makefile.st"
X
X# ------------- Turbo C -------------
XTCHOME=\TC
X
XCFLAGS=-A -G -I$(TCHOME)\INCLUDE -DATARI_ST
XUTILFLAGS=-DUTIL $(CFLAGS)
XCC=tcc
XLD=tlink
XLDFLAGS= -S=8192
X
X# variables
XOBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o atari.o
XOBJI = deflate.o trees.o bits.o
X
XOBJU = zipfile_.o zipup_.o fileio_.o util_.o globals.o
XOBJN = zipnote.o $(OBJU)
XOBJS = zipsplit.o $(OBJU)
X
Xzips: zip.prg zipnote.prg zipsplit.prg
X echo done
X
Xatari.o: atari.c
X $(CC) -c $(CFLAGS) atari.c
X
Xzip.o: zip.h ziperr.h tailor.h revision.h zip.c
X $(CC) -c $(CFLAGS) zip.c
X
Xzipfile.o: zip.h ziperr.h tailor.h zipfile.c
X $(CC) -c $(CFLAGS) zipfile.c
X
Xzipup.o: zip.h ziperr.h tailor.h revision.h zipup.c
X $(CC) -c $(CFLAGS) zipup.c
X
Xfileio.o: zip.h ziperr.h tailor.h fileio.c
X $(CC) -c $(CFLAGS) fileio.c
X
Xutil.o: zip.h ziperr.h tailor.h util.c
X $(CC) -c $(CFLAGS) util.c
X
Xglobals.o: zip.h ziperr.h tailor.h globals.c
X $(CC) -c $(CFLAGS) globals.c
X
Xzipnote.o: zip.h ziperr.h tailor.h revision.h zipnote.c
X $(CC) -c $(CFLAGS) zipnote.c
X
Xzipsplit.o: zipsplit.c zip.h ziperr.h tailor.h revision.h
X $(CC) -c $(CFLAGS) zipsplit.c
X
Xdeflate.o: zip.h ziperr.h tailor.h deflate.c
X $(CC) -c $(CFLAGS) deflate.c
X
Xtrees.o: zip.h ziperr.h tailor.h trees.c
X $(CC) -c $(CFLAGS) trees.c
X
Xbits.o: zip.h ziperr.h tailor.h bits.c
X $(CC) -c $(CFLAGS) bits.c
X
Xzipfile_.o: zipfile.c zip.h ziperr.h tailor.h
X $(CC) -c $(UTILFLAGS) -Ozipfile_.o zipfile.c
X
Xzipup_.o: zipup.c zip.h ziperr.h tailor.h
X $(CC) -c $(UTILFLAGS) -Ozipup_.o zipup.c
X
Xfileio_.o: fileio.c zip.h ziperr.h tailor.h
X $(CC) -c $(UTILFLAGS) -Ofileio_.o fileio.c
X
Xutil_.o: util.c zip.h ziperr.h tailor.h
X $(CC) -c $(UTILFLAGS) -Ofileio_.o fileio.c
X
Xzip.prg: $(OBJZ) $(OBJI)
X $(LD) $(LDFLAGS) -C=zip.lnk -O=$@
X
Xzipnote.prg: $(OBJN)
X $(LD) $(LDFLAGS) -C=zipn.lnk -O=$@
X
Xzipsplit.prg: $(OBJS)
X $(LD) $(LDFLAGS) -C=zips.lnk -O=$@
END_OF_FILE
if test 1949 -ne `wc -c <'atari/makefile.st'`; then
echo shar: \"'atari/makefile.st'\" unpacked with wrong size!
fi
# end of 'atari/makefile.st'
fi
if test -f 'infozip.who' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'infozip.who'\"
else
echo shar: Extracting \"'infozip.who'\" \(6165 characters\)
sed "s/^X//" >'infozip.who' <<'END_OF_FILE'
XThese members of the INFO-ZIP group contributed to the development and
Xtesting of portable Zip. They are responsible for whatever works in Zip.
XWhatever doesn't work is solely the fault of the authors of Zip (Mark Adler,
XRich Wales, Jean-loup Gailly, Kai Uwe Rommel and Igor Mandrichenko).
XBill Davidsen provided the envargs code. If you have contributed and
Xyour name has been forgotten, please send a reminder to the zip-bugs
Xaddress given in the Readme file.
X
XMark Adler mad...@tybalt.caltech.edu NeXT 2.x
XGlenn J. Andrews oper1%drcv06...@drcvax.af.mil VAX VMS
XTom Betz marob!upaya!tb...@phri.nyu.edu SCO Xenix 2.3.1
XJames Birdsall jwbi...@amc.com AT&T 3B1
XWim Bonner 2731...@WSUVM1.CSC.WSU.EDU HP 9000/840a HPUX
XPaul Borman p...@cray.com Cray-X/YMP,2 UNICOS 6-8
XLeslie C. Brown lbr...@BRL.MIL Pyramid MIS-4
XRalf Brown ra...@b.gp.cs.cmu.edu Pyramid MIS-4
XPietro Caselli zap...@petruz.sublink.org Minix 1.5.10
XBill Davidsen davi...@crdos1.crd.ge.com Xenix (on what?)
XDaniel Deimert dan...@hexagon.se zeus3.21 Zilog S8000
XJames P. Dugal j...@usl.edu Pyramid 90X OSx4.1
X"Evil Ed" esa...@gmuvax2.gmu.edu Ulrix-32 V3.1 (Rev. 9)
XDavid A. Feinleib t-da...@microsoft.com Windows NT
XGreg Flint a...@klaatu.cc.purdue.edu ETA-10P* hybrid Sys V
XJeff Foy jf...@glia.biostr.washington.edu IRIX Sys V Rel 3.3.1
XMike Freeman fre...@watsun.cc.columbia.edu Vax VMS
XKevin M. Fritz kmf...@apgea.army.mil Turbo C++ 1.0
XJean-loup Gailly jl...@chorus.fr MS-DOS Microsoft C 5.1
XScott D. Galloway sgal...@letterkenn-emh1.army.mil Sperry 5000 SysV.3
XGeorge Grimes gri...@netcom.com Apollo Domain SR10.4
XHunter Goatley goath...@WKUVX1.BITNET Vax VMS
XArnt Gulbrandsen agu...@pvv.unit.no Linux
XDavid Gundlach da...@rolf.stat.uga.edu Sun SS1+ SunOS 4.1
XBob Hardy ha...@lucid.com Power C on MSDOS
XPeter Jones jo...@mips1.info.uqam.ca MIPS UMIPS 4.0
XKjetil W. J{\o}rgensen jor...@lise.unit.no OSF/1
XBruce Kahn bk...@archive.webo.dg.com MS-DOS Microsoft C 5.1
XJonathan I. Kamens j...@pit-manager.mit.edu ultrix on DECstation
XBob Kemp Robert...@att.com AT&T 3B2 SysV 3.2v2
XEarl Kiech KI...@utkvx.utk.edu VAX VMS V5.4-1A
XDavid Kirschbaum kir...@usasoc.soc.mil He got us all in this
X mess in the first place
XBo Kullmar b...@kullmar.se DNIX 5.2, 5.3
XHarry Langenbacher ha...@neuron6.Jpl.Nasa.Gov Sun SS1+ SunOS 4.1
XMichael D. Lawler mdla...@bsu-cs.bsu.edu Mt.Xinu BSD 4.3 on VAX
XJohnny Lee joh...@microsoft.com Microsoft C 7.0
XDavid Lemson lem...@ux1.cso.uiuc.edu Sequent Dynix 3.0.17
XOnno van der Linden vdli...@fwi.uva.nl SCO Unix 3.2.0
X BC++ 3.0, djgcc 1.06
XWarner Losh i...@Solbourne.COM packing algorithm help
XJohn Lundin lun...@urvax.urich.edu VAX VMS
XIgor Mandrichenko mandri...@m10.ihep.su VAX VMS
XCliff Manis ro...@csoftec.csf.com SCO 2.3.1 (386)
XFulvio Marino ful...@iconet.ico.olivetti.it X/OS 2.3 & 2.4
XBill Marsh bma...@cod.nosc.mil SGI Iris 4D35
XPeter Mauzey p...@mtdcc.att.com AT&T 6300
XRafal Z. Maszkowski <rzm%pltumk1...@mvs.oac.ucla.edu> Bug report
XRobert McBroom (?) r...@ornl.gov DECsystem 5810
XHumberto Ortiz-Zuazaga zua...@ucunix.san.uc.edu Linux
XJames E. O'Dell j...@fpr.com MacOS
XWilliam O'Shaughnessy will...@hpcupt1.cup.hp.com HPUX
XEnrico Renato Palmerini pal...@vxscaq.cineca.it UNISYS 7000 Sys 5 r2.3
XKeith Petersen w8...@simtel20.army.mil Maintainer of Info-ZIP
X Pyramid UCB OSx4.4c
XDavid A Rasmussen da...@convex.csd.uwm.edu Convex C220 with 9.0 OS
XMichael Regoli m...@cica.indiana.edu Ultrix 3.1 VAX 8650
X BSD 4.3 IBM RT/125
X BSD 4.3 MicroVAX 3500
X SunOS 4.0.3 Sun 4/330
XRick Rodgers rod...@maxwell.mmwb.ucsf.EDU Unix man page
XGreg Roelofs ro...@midway.uchicago.edu SunOS 4.1.1,4.1.2 Sun 4
X Unicos 5.1--6.1.5 Cray
X OS/2 1.3 MS C 6.0
X Ultrix 4.1,4.2 DEC 5810
X VMS 5.2, 5.4 VAX 8600
X Irix 3.3.2, SGI Iris 4D
X UTS 1.2.4 Amdahl 5880
XKai Uwe Rommel rom...@informatik.tu-muenchen.de OS/2
XJon Saxton j...@panix.com Microsoft C 6.0
XSteve Salisbury ste...@microsoft.com Microsoft C 6.0
XMartin Schulz mar...@indian.cs.unb.ca Atari ST
XDave Sisson da...@vtcosy.cns.vt.edu AIX 1.1.1 PS/2 & 3090
XRon Srodawa sro...@vela.acs.oakland.edu SCO Xenix/386 2.3.3
XBertil Stenstr|m ste...@heron.qz.se HP-UX 7.0 HP9000/835
XAntoine Verheijen ant...@sysmail.ucs.ualberta.ca envargs fix
XArjan de Vet de...@info.win.tue.nl SunOS 4.1, MSC 5.1
XRich Wales wa...@cs.ucla.edu SunOS 4.0.3 Sun-3/50
END_OF_FILE
if test 6165 -ne `wc -c <'infozip.who'`; then
echo shar: \"'infozip.who'\" unpacked with wrong size!
fi
# end of 'infozip.who'
fi
if test -f 'mac/macfile.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mac/macfile.c'\"
else
echo shar: Extracting \"'mac/macfile.c'\" \(6797 characters\)
sed "s/^X//" >'mac/macfile.c' <<'END_OF_FILE'
X/*---------------------------------------------------------------------------
X
X macfile.c
X
X This source file is used by the mac port to support commands not available
X directly on the Mac, i.e. mkdir().
X It also helps determine if we're running on a Mac with HFS and a disk
X formatted for HFS (HFS - Hierarchical File System; compared to its predecessor,
X MFS - Macintosh File System).
X
X ---------------------------------------------------------------------------*/
X
X#include "unzip.h"
X
X#ifdef MACOS
X#ifndef FSFCBLen
X#define FSFCBLen (*(short *)0x3F6)
X#endif
X
Xstatic short wAppVRefNum;
Xstatic long lAppDirID;
Xint hfsflag; /* set if disk has hierarchical file system */
X
Xstatic int IsHFSDisk(short wRefNum)
X{
X /* get info about the specified volume */
X if (hfsflag == true) {
X HParamBlockRec hpbr;
X Str255 temp;
X short wErr;
X
X hpbr.volumeParam.ioCompletion = 0;
X hpbr.volumeParam.ioNamePtr = temp;
X hpbr.volumeParam.ioVRefNum = wRefNum;
X hpbr.volumeParam.ioVolIndex = 0;
X wErr = PBHGetVInfo(&hpbr, 0);
X
X if (wErr == noErr && hpbr.volumeParam.ioVFSID == 0
X && hpbr.volumeParam.ioVSigWord == 0x4244) {
X return true;
X }
X }
X
X return false;
X} /* IsHFSDisk */
X
Xvoid macfstest(int vrefnum)
X{
X Str255 st;
X
X /* is this machine running HFS file system? */
X if (FSFCBLen <= 0) {
X hfsflag = false;
X }
X else
X {
X hfsflag = true;
X }
X
X /* get the file's volume reference number and directory ID */
X if (hfsflag == true) {
X WDPBRec wdpb;
X OSErr err = noErr;
X
X if (vrefnum != 0) {
X wdpb.ioCompletion = false;
X wdpb.ioNamePtr = st;
X wdpb.ioWDIndex = 0;
X wdpb.ioVRefNum = vrefnum;
X err = PBHGetVol(&wdpb, false);
X
X if (err == noErr) {
X wAppVRefNum = wdpb.ioWDVRefNum;
X lAppDirID = wdpb.ioWDDirID;
X }
X }
X
X /* is the disk we're using formatted for HFS? */
X hfsflag = IsHFSDisk(wAppVRefNum);
X }
X
X return;
X} /* mactest */
X
Xint macmkdir(char *path, short nVRefNum, long lDirID)
X{
X OSErr err = -1;
X
X if (path != 0 && strlen(path)<256 && hfsflag == true) {
X HParamBlockRec hpbr;
X Str255 st;
X
X CtoPstr(path);
X if ((nVRefNum == 0) && (lDirID == 0))
X {
X hpbr.fileParam.ioNamePtr = st;
X hpbr.fileParam.ioCompletion = NULL;
X err = PBHGetVol((WDPBPtr)&hpbr, false);
X nVRefNum = hpbr.wdParam.ioWDVRefNum;
X lDirID = hpbr.wdParam.ioWDDirID;
X }
X else
X {
X err = noErr;
X }
X if (err == noErr) {
X hpbr.fileParam.ioCompletion = NULL;
X hpbr.fileParam.ioVRefNum = nVRefNum;
X hpbr.fileParam.ioDirID = lDirID;
X hpbr.fileParam.ioNamePtr = (StringPtr)path;
X err = PBDirCreate(&hpbr, false);
X }
X PtoCstr(path);
X }
X
X return (int)err;
X} /* mkdir */
X
Xvoid ResolveMacVol(short nVRefNum, short *pnVRefNum, long *plDirID, StringPtr pst)
X{
X if (hfsflag)
X {
X WDPBRec wdpbr;
X Str255 st;
X OSErr err;
X
X wdpbr.ioCompletion = (ProcPtr)NULL;
X wdpbr.ioNamePtr = st;
X wdpbr.ioVRefNum = nVRefNum;
X wdpbr.ioWDIndex = 0;
X wdpbr.ioWDProcID = 0;
X wdpbr.ioWDVRefNum = 0;
X err = PBGetWDInfo( &wdpbr, false );
X if ( err == noErr )
X {
X if (pnVRefNum)
X *pnVRefNum = wdpbr.ioWDVRefNum;
X if (plDirID)
X *plDirID = wdpbr.ioWDDirID;
X if (pst)
X BlockMove( st, pst, st[0]+1 );
X }
X }
X else
X {
X if (pnVRefNum)
X *pnVRefNum = nVRefNum;
X if (plDirID)
X *plDirID = 0;
X if (pst)
X *pst = 0;
X }
X}
X
Xshort macopen(char *sz, short nFlags, short nVRefNum, long lDirID)
X{
X OSErr err;
X Str255 st;
X char chPerms = (!nFlags) ? fsRdPerm : fsRdWrPerm;
X short nFRefNum;
X
X CtoPstr( sz );
X BlockMove( sz, st, sz[0]+1 );
X PtoCstr( sz );
X if (hfsflag)
X {
X if (nFlags > 1)
X err = HOpenRF( nVRefNum, lDirID, st, chPerms, &nFRefNum);
X else
X err = HOpen( nVRefNum, lDirID, st, chPerms, &nFRefNum);
X }
X else
X {
X /*
X * Have to use PBxxx style calls since the high level
X * versions don't support specifying permissions
X */
X ParamBlockRec pbr;
X
X pbr.ioParam.ioNamePtr = st;
X pbr.ioParam.ioVRefNum = gnVRefNum;
X pbr.ioParam.ioVersNum = 0;
X pbr.ioParam.ioPermssn = chPerms;
X pbr.ioParam.ioMisc = 0;
X if (nFlags >1)
X err = PBOpenRF( &pbr, false );
X else
X err = PBOpen( &pbr, false );
X nFRefNum = pbr.ioParam.ioRefNum;
X }
X if ( err )


X return -1;
X else

X return nFRefNum;
X}
X
Xshort maccreat(char *sz, short nVRefNum, long lDirID, OSType ostCreator, OSType ostType)
X{
X OSErr err;
X Str255 st;
X FInfo fi;
X
X CtoPstr( sz );
X BlockMove( sz, st, sz[0]+1 );
X PtoCstr( sz );
X if (hfsflag)
X {
X err = HGetFInfo( nVRefNum, lDirID, st, &fi );
X if (err == fnfErr)
X err = HCreate( nVRefNum, lDirID, st, ostCreator, ostType );
X else if (err == noErr)
X {
X fi.fdCreator = ostCreator;
X fi.fdType = ostType;
X err = HSetFInfo( nVRefNum, lDirID, st, &fi );
X }
X }
X else
X {
X err = GetFInfo( st, nVRefNum, &fi );
X if (err == fnfErr)
X err = Create( st, nVRefNum, ostCreator, ostType );
X else if (err == noErr)
X {
X fi.fdCreator = ostCreator;
X fi.fdType = ostType;
X err = SetFInfo( st, nVRefNum, &fi );
X }
X }
X if (err == noErr)
X return noErr;
X else
X return -1;
X}
X
Xshort macread(short nFRefNum, char *pb, unsigned cb)
X{
X long lcb = cb;
X
X (void)FSRead( nFRefNum, &lcb, pb );
X
X return (short)lcb;
X}
X
Xshort macwrite(short nFRefNum, char *pb, unsigned cb)
X{
X long lcb = cb;
X
X (void)FSWrite( nFRefNum, &lcb, pb );
X
X return (short)lcb;
X}
X
Xshort macclose(short nFRefNum)
X{
X return FSClose( nFRefNum );
X}
X
Xlong maclseek(short nFRefNum, long lib, short nMode)
X{
X ParamBlockRec pbr;
X
X if (nMode == SEEK_SET)
X nMode = fsFromStart;
X else if (nMode == SEEK_CUR)
X nMode = fsFromMark;
X else if (nMode == SEEK_END)
X nMode = fsFromLEOF;
X pbr.ioParam.ioRefNum = nFRefNum;
X pbr.ioParam.ioPosMode = nMode;
X pbr.ioParam.ioPosOffset = lib;
X (void)PBSetFPos(&pbr, 0);
X return pbr.ioParam.ioPosOffset;
X}
X
X#endif /* MACOS */
END_OF_FILE
if test 6797 -ne `wc -c <'mac/macfile.c'`; then
echo shar: \"'mac/macfile.c'\" unpacked with wrong size!
fi
# end of 'mac/macfile.c'
fi
if test -f 'mac/macstat.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mac/macstat.c'\"
else
echo shar: Extracting \"'mac/macstat.c'\" \(5863 characters\)
sed "s/^X//" >'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#define CtoPstr c2pstr
X#define PtoCstr p2cstr
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 CtoPstr(path);
X strncpy(temp,path, path[0]+1);
X PtoCstr(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) {
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 CtoPstr(path);
X strncpy(temp, path, path[0]+1);
X PtoCstr(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 5863 -ne `wc -c <'mac/macstat.c'`; then
echo shar: \"'mac/macstat.c'\" unpacked with wrong size!
fi
# end of 'mac/macstat.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(7055 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# Makefile for Zip, ZipNote, ZipCloak and ZipSplit
X
X# what you can make ...
Xall:
X @echo ''
X @echo 'Make what? You must say what system to make Zip for--e.g.'
X @echo '"make bsd". Choices: bsd, bsdold, sysv, sysv_old, sysv_386,'
X @echo 'dnix, linux, sun, sun_gcc, next10, next, hpux, cray, cray3,'
X @echo '3b1, att6300, zilog, scodos, aux, c120, convex, aix, minix,'
X @echo 'isc, ultrix, dec_osf1 and xos.'
X @echo 'See the files install.doc and zip.doc for more information.'
X @echo ''


X
XCRYPTO =
XCLOAK =

XCRFLAG =
XMAKE = make
X# **********************************************************************
X# *** For encryption version, remove the # at the front of next line ***
X# MAKE = make CRYPTO="crypt.o" CLOAK="zipcloak" CRFLAG="-DCRYPT"
X
X# (to use the Gnu compiler, change cc to gcc in CC and BIND)
XCC = cc
XBIND = cc
XE =
XCPP = /usr/lib/cpp -Dunix
X
X# probably can change this to 'install' if you have it
XINSTALL = cp
X
X# target directories - where to install executables and man pages to
XBINDIR = /usr/local/bin
XMANDIR = /usr/man/manl
X
X# flags
X# CFLAGS flags for C compile
X# LFLAGS1 flags after output file spec, before obj file list
X# LFLAGS2 flags after obj file list (libraries, etc)
XCFLAGS = -O
XLFLAGS1 =
XLFLAGS2 = -s


X
X# object file lists

XOBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o $(CRYPTO)
X
XOBJI = deflate.o trees.o bits.o
XOBJA =
XOBJU = zipfile_.o zipup_.o fileio_.o util_.o globals.o
XOBJN = zipnote.o $(OBJU)
XOBJC = zipcloak.o $(OBJU) crypt_.o
XOBJS = zipsplit.o $(OBJU)
X
X# suffix rules
X.SUFFIXES:
X.SUFFIXES: _.o .o .c .doc .1
X.c_.o:
X rm -f $*_.c; ln $< $*_.c
X $(CC) $(CFLAGS) -DUTIL $(CRFLAG) -c $*_.c
X rm -f $*_.c
X.c.o:
X $(CC) $(CFLAGS) $(CRFLAG) -c $<
X
X.1.doc:
X nroff -man $< | col -b | uniq > $@
X
X# rules for zip, zipnote, zipcloak, zipsplit, and zip.doc.


X$(OBJZ): zip.h ziperr.h tailor.h
X$(OBJI): zip.h ziperr.h tailor.h
X$(OBJN): zip.h ziperr.h tailor.h
X$(OBJS): zip.h ziperr.h tailor.h
X$(OBJC): zip.h ziperr.h tailor.h
X

Xmatch.o: match.s
X $(CPP) match.s > _match.s
X $(CC) -c _match.s
X mv _match.o match.o
X rm -f _match.s
X
XZIPS = zip$E zipnote$E zipsplit$E $(CLOAK)$E
X
Xzip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
Xzips: $(ZIPS)
Xzipsman: zip zipnote zipsplit $(CLOAK) zip.doc
X
Xzip$E: $(OBJZ) $(OBJI) $(OBJA)
X $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
Xzipnote$E: $(OBJN)
X $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
Xzipcloak$E: $(OBJC)
X $(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
Xzipsplit$E: $(OBJS)
X $(BIND) -o zipsplit$E $(LFLAGS1) $(OBJS) $(LFLAGS2)
X
X# install
Xinstall: $(ZIPS)
X $(INSTALL) $(ZIPS) $(BINDIR)
X $(INSTALL) zip.1 $(MANDIR)
X
X
X# These symbols, when #defined using -D have these effects on compilation:
X# ZMEM - includes C language versions of memset(), memcpy(), and
X# memcmp() (util.c).
X# DIRENT - use <sys/dirent.h> and getdents() instead of <sys/dir.h>
X# and opendir(), etc. (fileio.c).
X# NODIR - used for 3B1, which has neither getdents() nor opendir().
X# NDIR - use "ndir.h" instead of <sys/dir.h> (fileio.c).
X# UTIL - select routines for utilities (note, cloak, and split).
X# PROTO - enable function prototypes.
X# RMDIR - remove directories using a system("rmdir ...") call.
X# CONVEX - for Convex make target.
X# AIX - for AIX make target.
X# CRYPT - include the encryption code.
X# LINUX - for linux make target.
X
X# BSD 4.3 (also Unisys 7000--AT&T System V with heavy BSD 4.2)
Xbsd:
X $(MAKE) zips CFLAGS="-O"
X
X# BSD, but missing memset(), memcmp().
Xbsdold:
X $(MAKE) zips CFLAGS="-O -DZMEM"
X
X# AT&T System V, Rel 3. Also SCO, Xenix, OpenDeskTop, ETA-10P*, SGI.
Xsysv_old:
X $(MAKE) zips CFLAGS="-O -DDIRENT"
X
X# AT&T System V, Rel 4. Also any system with readdir() and termio.
Xsysv:
X $(MAKE) zips CFLAGS="-O -DSYSV -DTERMIO"
X
X# AT&T System V, Rel 4 for 386 (uses asm version):
Xsysv_386:
X $(MAKE) zips CFLAGS="-O -DSYSV -DTERMIO -DASM" OBJA=match.o
X
X# DNIX 5.x: like System V but optimization is messed up.
Xdnix:
X $(MAKE) zips CFLAGS="-DDIRENT"
X
X# Linux 0.96a with GCC 2.12, dies with <= 2.11c. The problem with
X# builtin functions still has to be investigated.
Xlinux:
X $(MAKE) zips CFLAGS="-O -fno-builtin -DSYSV -DTERMIO -DLINUX"
X
X# Sun OS 4.x: BSD, but use getdents(). If you have gcc, use 'make sun_gcc'
X# instead since the code produced is better.
Xsun:
X $(MAKE) zips CFLAGS="-O4 -DDIRENT"
X
X# Sun OS 4.x with gcc (bug with -s linker flag). Use -O if your version
X# of gcc does not like -O2.
Xsun_gcc:
X $(MAKE) zips CFLAGS="-O2 -DDIRENT" CC=gcc BIND=gcc LFLAGS2=""
X strip $(ZIPS)
X
X# NeXT 1.0: BSD, but use shared library.
Xnext10:
X $(MAKE) zips CFLAGS="-O" LFLAGS2="-s -lsys_s"
X
X# NeXT 2.0: BSD, but use MH_OBJECT format for smaller executables.
Xnext:
X $(MAKE) zips CFLAGS="-O" LFLAGS2="-s -object"
X
X# HPUX: System V, but use <ndir.h> and opendir(), etc.
Xhpux:
X $(MAKE) zips CFLAGS="-O -DNDIR"
X
X# Cray Unicos 5.1.10 & 6.0.11, Standard C compiler 2.0
Xcray:
X $(MAKE) zips CFLAGS="-O -DDIRENT" CC="scc"
X
X# Cray Unicos 6.1, Standard C compiler 3.0 (all routines except trees.c
X# may be compiled with vector3; internal compiler bug in 3.0.2.3 and
X# earlier requires vector2 for trees.c)
Xcray3:
X $(MAKE) zips CFLAGS="-O -h vector2 -h scalar3 -DDIRENT" CC="scc"
X
X# AT&T 3B1: System V, but missing a few things.
X3b1:
X $(MAKE) zips CFLAGS="-O -DNODIR -DRMDIR"
X
X# AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
Xatt6300:
X $(MAKE) zips LFLAGS1="-Ml" \
X CFLAGS="-O -Ml -DNODIR -DRMDIR -DDYN_ALLOC -DMEDIUM_MEM -DWSIZE=16384"
X
X# zilog zeus 3.21
Xzilog:
X $(MAKE) zips CFLAGS="-O -DZMEM -DNDIR -DRMDIR" CC="scc -i" BIND="scc"
X
X# SCO 386 cross compile for MS-DOS
X# Note: zip.exe should be lzexe'd on DOS to reduce its size
Xscodos:
X $(MAKE) zips CFLAGS="-O -Mc -dos -DNO_ASM" LFLAGS1="-Mc -dos" \
X LFLAGS2="-F 1000" E=".exe"
X
X# A/UX:
Xaux:
X $(MAKE) zips CFLAGS="-O -DTERMIO"
X
X# Convex C120, OS 9.0, cc v. 4.0, no vectorization.
Xc120:
X $(MAKE) zips CFLAGS="-O1 -rl -DCONVEX"
X
X# Convex C220, OS 9.0
Xconvex:
X $(MAKE) zips CFLAGS="-O2 -rl -DCONVEX"
X
X# AIX Version 3.1 for RISC System/6000
Xaix:
X $(MAKE) zips CC="c89" BIND="c89" \
X CFLAGS="-O -D_POSIX_SOURCE -D_ALL_SOURCE -D_BSD -DAIX"
X
X# MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
Xminix:
X $(MAKE) zips CFLAGS="-O -DDIRENT -DMINIX" CC=gcc BIND=gcc
X chmem =262144 zip
X
X# Interactive Systems Corporation System V/386, Rel 3.2--optimizer problems
Xisc:
X $(MAKE) zips CFLAGS="-DDIRENT"
X
X# DYNIX (R) V3.0.18 (no memset() or memcmp(), rindex() instead of strrchr())
Xdynix:
X $(MAKE) zips CFLAGS="-O -DZMEM -Dstrrchr=rindex"
X
X# Ultrix
Xultrix:
X $(MAKE) zips CFLAGS="-O -Olimit 700"
X
X# DEC OSF/1
Xdec_osf1:
X $(MAKE) zips CFLAGS="-O -Olimit 1000 -DOSF -D_BSD"
X
X# xos: Olivetti LSX-3005..3045 with X/OS 2.3 or 2.4
Xxos:
X $(MAKE) zips CFLAGS="-O -DTERMIO"
X
X# clean up after making stuff and installing it
Xclean:
X rm -f *.o
X rm -f $(ZIPS)
X
X# This one's for Mark:
Xit:
X $(MAKE) zipsman CFLAGS="-O -Wall -DPROTO"\
X LFLAGS2="-s -object" VPATH="${HOME}/Unix/bin"
X
X# and this one for Jean-loup:
Xgcc_d:
X $(MAKE) zip CFLAGS="-g -DDEBUG -DDIRENT" CC=gcc BIND=gcc LFLAGS2="-g"
X mv zip zipd
X
X# end of Makefile
END_OF_FILE
if test 7055 -ne `wc -c <'makefile'`; then
echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'msdos/makefile.msc.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/makefile.msc.UU'\"
else
echo shar: Extracting \"'msdos/makefile.msc.UU'\" \(5501 characters\)
sed "s/^X//" >'msdos/makefile.msc.UU' <<'END_OF_FILE'
Xbegin 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D*%-4
XM4DE0*2!Z:7!S<&QI="YE>&4-"@T*:6YS=&%L;#H))"A:25!3*0T*"6-O<'D@
XM+V(@*BYE>&4@)"A"24XI#0H-"F-L96%N.@T*"61E;" J+F]B:@T*"61E;" J
X&+F5X90T*
X
Xend
END_OF_FILE
if test 5501 -ne `wc -c <'msdos/makefile.msc.UU'`; then
echo shar: \"'msdos/makefile.msc.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/makefile.msc'\" \(3966 characters\)
cat msdos/makefile.msc.UU | uudecode
if test 3966 -ne `wc -c <'msdos/makefile.msc'`; then
echo shar: \"'msdos/makefile.msc'\" uudecoded with wrong size!
else
rm msdos/makefile.msc.UU
fi
fi
# end of 'msdos/makefile.msc.UU'
fi
if test -f 'msdos/match.asm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/match.asm'\"
else
echo shar: Extracting \"'msdos/match.asm'\" \(7753 characters\)
sed "s/^X//" >'msdos/match.asm' <<'END_OF_FILE'
X;
X; Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, and Jean-loup Gailly.


X; Permission is granted to any individual or institution to use, copy, or
X; redistribute this software so long as all of the original files are included

X; unmodified, that it is not sold for profit, and that this copyright notice
X; is retained.
X;
X; match.asm by Jean-loup Gailly.
X
X; match.asm, optimized version of longest_match() in deflate.c
X; Must be assembled with masm -ml. To be used only with C compact model.
X; (For large model, follow the instructions given below.)
X; This file is only optional. If you don't have masm or tasm, use the
X; C version (add -DNO_ASM to CFLAGS in makefile.msc and remove match.obj
X; from OBJI). If you have reduced WSIZE in zip.h, then change its value
X; below.
X;
X; Turbo C 2.0 does not support static allocation of more than 64K bytes per
X; file, and does not have SS == DS. So TC and BC++ users must use:
X; tasm -ml -DDYN_ALLOC -DSS_NEQ_DS match;
X;
X; To simplify the code, the option -DDYN_ALLOC is supported for OS/2
X; only if the arrays are guaranteed to have zero offset (allocated by
X; halloc). We also require SS==DS. This is satisfied for MSC but not Turbo C.
X
X name match
X
Xifndef DYN_ALLOC
X extrn _prev : word
X extrn _window : byte
X prev equ _prev ; offset part
X window equ _window
Xendif
X
X_DATA segment word public 'DATA'
X extrn _match_start : word
X extrn _prev_length : word
X extrn _good_match : word
X extrn _strstart : word
X extrn _max_chain_length : word
Xifdef DYN_ALLOC
X extrn _prev : word
X extrn _window : word
X prev equ 0 ; offset forced to zero
X window equ 0
X window_seg equ _window[2]
X window_off equ 0
Xelse
X wseg dw seg _window
X window_seg equ wseg
X window_off equ offset _window
Xendif
X_DATA ends
X
XDGROUP group _DATA
X
X_TEXT segment word public 'CODE'
X assume cs: _TEXT, ds: DGROUP
X
X public _match_init
X public _longest_match
X
X MIN_MATCH equ 3
X MAX_MATCH equ 258
X WSIZE equ 32768 ; keep in sync with zip.h !
X MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
X MAX_DIST equ (WSIZE-MIN_LOOKAHEAD)
X
Xprev_ptr dw seg _prev ; pointer to the prev array
Xifdef SS_NEQ_DS
X match_start dw 0 ; copy of _match_start if SS != DS
Xendif
X
X; initialize or check the variables used in match.asm.
X
X_match_init proc near ; 'proc far' for large model
Xifdef SS_NEQ_DS
X ma_start equ cs:match_start ; does not work on OS/2
Xelse
X assume ss: DGROUP
X ma_start equ ss:_match_start
X mov ax,ds
X mov bx,ss
X cmp ax,bx ; SS == DS?
X jne error
Xendif
Xifdef DYN_ALLOC
X cmp _prev[0],0 ; verify zero offset
X jne error
X cmp _window[0],0
X jne error
X ifdef SS_NEQ_DS
X mov ax,_prev[2] ; segment value
X mov cs:prev_ptr,ax ; ugly write to code, crash on OS/2
X prev_seg equ cs:prev_ptr
X else
X prev_seg equ ss:_prev[2] ; works on OS/2 if SS == DS
X endif
Xelse
X prev_seg equ cs:prev_ptr
Xendif
X ret
X extrn _exit : near ; 'far' for large model
Xerror: call _exit
X
X_match_init endp
X
X; -----------------------------------------------------------------------
X; Set match_start to the longest match starting at the given string and
X; return its length. Matches shorter or equal to prev_length are discarded,
X; in which case the result is equal to prev_length and match_start is
X; garbage.
X; IN assertions: cur_match is the head of the hash chain for the current
X; string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
X
X; int longest_match(cur_match)
X
X_longest_match proc near ; 'proc far' for large model
X push bp
X mov bp,sp
X push di
X push si
X push ds
X
X cur_match equ word ptr [bp+4] ; [bp+6] for large model
X
X; window equ es:window (es:0 for DYN_ALLOC)
X; prev equ ds:prev
X; match equ es:si
X; scan equ es:di
X; chain_length equ bp
X; best_len equ bx
X; limit equ dx
X
X mov si,cur_match ; use bp before it is destroyed
X mov bp,_max_chain_length ; chain_length = max_chain_length
X mov di,_strstart
X mov dx,di
X sub dx,MAX_DIST ; limit = strstart-MAX_DIST
X jae limit_ok
X sub dx,dx ; limit = NIL
Xlimit_ok:
X add di,2+window_off ; di = offset(window + strstart + 2)
X mov bx,_prev_length ; best_len = prev_length
X mov es,window_seg
X mov ax,es:[bx+di-3] ; ax = scan[best_len-1..best_len]
X mov cx,es:[di-2] ; cx = scan[0..1]
X cmp bx,_good_match ; do we have a good match already?
X mov ds,prev_seg ; (does not destroy the flags)
X assume ds: nothing
X jb do_scan ; good match?
X shr bp,1 ; chain_length >>= 2
X shr bp,1
X jmp short do_scan
X
X even ; align destination of branch
Xlong_loop:
X; at this point, ds:di == scan+2, ds:si == cur_match
X mov ax,[bx+di-3] ; ax = scan[best_len-1..best_len]
X mov cx,[di-2] ; cx = scan[0..1]
X mov ds,prev_seg ; reset ds to address the prev array
Xshort_loop:
X dec bp ; --chain_length
X jz the_end
X; at this point, di == scan+2, si = cur_match,
X; ax = scan[best_len-1..best_len] and cx = scan[0..1]
Xif (WSIZE-32768)
X and si,WSIZE-1 ; not needed if WSIZE=32768
Xendif
X shl si,1 ; cur_match as word index
X mov si,prev[si] ; cur_match = prev[cur_match]
X cmp si,dx ; cur_match <= limit ?
X jbe the_end
Xdo_scan:
X cmp ax,word ptr es:window[bx+si-1] ; check match at best_len-1
X jne short_loop
X cmp cx,word ptr es:window[si] ; check min_match_length match
X jne short_loop
X
X lea si,window[si+2] ; si = match
X mov ax,di ; ax = scan+2
X mov cx,es
X mov ds,cx ; ds = es = window
X mov cx,(MAX_MATCH-2)/2 ; scan for at most MAX_MATCH bytes
X repe cmpsw ; loop until mismatch
X je maxmatch ; match of length MAX_MATCH?
Xmismatch:
X mov cl,[di-2] ; mismatch on first or second byte?
X sub cl,[si-2] ; cl = 0 if first bytes equal
X xchg ax,di ; di = scan+2, ax = end of scan
X sub ax,di ; ax = len
X sub si,ax ; si = cur_match + 2 + offset(window)
X sub si,2+window_off ; si = cur_match
X sub cl,1 ; set carry if cl == 0 (can't use DEC)
X adc ax,0 ; ax = carry ? len+1 : len
X cmp ax,bx ; len > best_len ?
X jle long_loop
X mov ma_start,si ; match_start = cur_match
X mov bx,ax ; bx = best_len = len
X cmp ax,MAX_MATCH ; len >= MAX_MATCH ?
X jl long_loop
Xthe_end:
X pop ds
X assume ds: DGROUP
Xifdef SS_NEQ_DS
X mov ax,ma_start ; garbage if no match found
X mov ds:_match_start,ax
Xendif
X pop si
X pop di
X pop bp
X mov ax,bx ; result = ax = best_len
X ret
Xmaxmatch: ; come here if maximum match
X cmpsb ; increment si and di
X jmp mismatch ; force match_length = MAX_LENGTH
X
X_longest_match endp
X
X_TEXT ends
Xend
END_OF_FILE
if test 7753 -ne `wc -c <'msdos/match.asm'`; then
echo shar: \"'msdos/match.asm'\" unpacked with wrong size!
fi
# end of 'msdos/match.asm'
fi
if test -f 'os2/match32.asm.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'os2/match32.asm.UU'\"
else
echo shar: Extracting \"'os2/match32.asm.UU'\" \(8134 characters\)
sed "s/^X//" >'os2/match32.asm.UU' <<'END_OF_FILE'
Xbegin 666 os2/match32.asm
XM.PT*.R!#;W!Y<FEG:'0@*$,I(#$Y.3 M,3DY,B!-87)K($%D;&5R+"!2:6-H
XM87)D($(N(%=A;&5S+"!*96%N+6QO=7 @1V%I;&QY+ T*.R!+86D@57=E(%)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" @(" @+C,X-@T*#0H@(" @(" @(&YA;64@(" @
XM;6%T8V@-"@T*7T)34R @("!S96=M96YT("!D=V]R9"!54T4S,B!P=6)L:6,@
XM)T)34R<-"B @(" @(" @97AT<FX@("!?;6%T8VA?<W1A<G0@(#H@9'=O<F0-
XM"B @(" @(" @97AT<FX@("!?<')E=E]L96YG=&@@(#H@9'=O<F0-"B @(" @
XM(" @97AT<FX@("!?9V]O9%]M871C:" @(#H@9'=O<F0-"B @(" @(" @97AT
XM<FX@("!?<W1R<W1A<G0@(" @(#H@9'=O<F0-"B @(" @(" @97AT<FX@("!?
XM;6%X7V-H86EN7VQE;F=T:" Z(&1W;W)D#0H@(" @(" @(&5X=')N(" @7W!R
XM978@(" @(" @(" Z('=O<F0-"B @(" @(" @97AT<FX@("!?=VEN9&]W(" @
XM(" @(#H@8GET90T*7T)34R @("!E;F1S#0H-"D1'4D]54" @9W)O=7 @7T)3
XM4PT*#0I?5$585" @('-E9VUE;G0@9'=O<F0@55-%,S(@<'5B;&EC("=#3T1%
XM)PT*(" @(" @("!A<W-U;64@(&-S.B!?5$585"P@9',Z($1'4D]54"P@<W,Z
XM($1'4D]54 T*#0H)<'5B;&EC(&UA=&-H7VEN:71?#0H@(" @(" @('!U8FQI
XM8R!L;VYG97-T7VUA=&-H7PT*#0H)34E.7TU!5$-((" @("!E<74@,PT*(" @
XM(" @("!-05A?34%40T@@(" @(&5Q=2 R-3@-"@E74TE:12 @(" @(" @(&5Q
XM=2 S,C<V. D).R!K965P(&EN('-Y;F,@=VET:"!Z:7 N:" A#0H)34E.7TQ/
XM3TM!2$5!1"!E<74@*$U!6%]-051#2"M-24Y?34%40T@K,2D-"@E-05A?1$E3
XM5" @(" @(&5Q=2 H5U-)6D4M34E.7TQ/3TM!2$5!1"D-"@T*.R!I;FET:6%L
XM:7IE(&]R(&-H96-K('1H92!V87)I86)L97,@=7-E9"!I;B!M871C:"YA<VTN
XM#0H-"FUA=&-H7VEN:71?('!R;V,@;F5A<@T*"7)E= T*;6%T8VA?:6YI=%\@
XM96YD< T*#0H[("TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
XM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM#0H[(%-E="!M
XM871C:%]S=&%R="!T;R!T:&4@;&]N9V5S="!M871C:"!S=&%R=&EN9R!A="!T
XM:&4@9VEV96X@<W1R:6YG(&%N9 T*.R!R971U<FX@:71S(&QE;F=T:"X@36%T
XM8VAE<R!S:&]R=&5R(&]R(&5Q=6%L('1O('!R979?;&5N9W1H(&%R92!D:7-C
XM87)D960L#0H[(&EN('=H:6-H(&-A<V4@=&AE(')E<W5L="!I<R!E<75A;"!T
XM;R!P<F5V7VQE;F=T:"!A;F0@;6%T8VA?<W1A<G0@:7,-"CL@9V%R8F%G92X-
XM"CL@24X@87-S97)T:6]N<SH@8W5R7VUA=&-H(&ES('1H92!H96%D(&]F('1H
XM92!H87-H(&-H86EN(&9O<B!T:&4@8W5R<F5N= T*.R @('-T<FEN9R H<W1R
XM<W1A<G0I(&%N9"!I=',@9&ES=&%N8V4@:7,@/#T@34%87T1)4U0L(&%N9"!P
XM<F5V7VQE;F=T:" ^/2 Q#0H-"CL@:6YT(&QO;F=E<W1?;6%T8V@H8W5R7VUA
XM=&-H*0T*#0IL;VYG97-T7VUA=&-H7R!P<F]C(&YE87(-"@T*(" @(" @("!C
XM=7)?;6%T8V@@(" @97%U(&1W;W)D('!T<B!;97-P*S(P70T*(" @(" @(" [
XM(')E='5R;B!A9&1R97-S(" @(" @(" @(" @(" @(#L@97-P*S$V#0H@(" @
XM(" @('!U<V@@(" @96)P(" @(" @(" @(" @(" @(" @(" @.R!E<W K,3(-
XM"B @(" @(" @<'5S:" @("!E9&D@(" @(" @(" @(" @(" @(" @(" [(&5S
XM<"LX#0H)<'5S: EE<VD@(" @(" @(" @(" @(" @(" @(" [(&5S<"LT#0H)
XM<'5S: EE8G@@(" @(" @(" @(" @(" @(" @(" [(&5S< T*#0H[(" @(" @
XM(&UA=&-H(" @(" @("!E<74@97-I#0H[(" @(" @('-C86X@(" @(" @("!E
XM<74@961I#0H[(" @(" @(&-H86EN7VQE;F=T:"!E<74@96)P#0H[(" @(" @
XM(&)E<W1?;&5N(" @("!E<74@96)X#0H[(" @(" @(&QI;6ET(" @(" @("!E
XM<74@961X#0H-"@EM;W8)97-I+&-U<E]M871C: T*(" @(" @("!M;W8@(" @
XM(&5B<"Q?;6%X7V-H86EN7VQE;F=T:" @(#L@8VAA:6Y?;&5N9W1H(#T@;6%X
XM7V-H86EN7VQE;F=T: T*"6UO=@EE9&DL7W-T<G-T87)T#0H);6]V"65D>"QE
XM9&D-"@ES=6()961X+$U!6%]$25-4(" @(" @(" @(" @.R!L:6UI=" ]('-T
XM<G-T87)T+4U!6%]$25-4#0H):F%E"7-H;W)T(&QI;6ET7V]K#0H)<W5B"65D
XM>"QE9'@)"0D[(&QI;6ET(#T@3DE,#0IL:6UI=%]O:SH-"B @(" @(" @861D
XM(" @("!E9&DL,BMO9F9S970@7W=I;F1O=R @(" [(&5D:2 ](&]F9G-E="AW
XM:6YD;W<@*R!S=')S=&%R=" K(#(I#0H@(" @(" @(&UO=B @(" @96)X+%]P
XM<F5V7VQE;F=T:" @(" @(" @.R!B97-T7VQE;B ]('!R979?;&5N9W1H#0H@
XM(" @(" @(&UO=B @(" @87@L6V5B>"ME9&DM,UT@(" @(" @(" @.R!A>" ]
XM('-C86Y;8F5S=%]L96XM,2XN8F5S=%]L96Y=#0H@(" @(" @(&UO=B @(" @
XM8W@L6V5D:2TR72 @(" @(" @(" @(" @.R!C>" ]('-C86Y;,"XN,5T-"@EC
XM;7 )96)X+%]G;V]D7VUA=&-H( D[(&1O('=E(&AA=F4@82!G;V]D(&UA=&-H
XM(&%L<F5A9'D_#0H@(" @(" @(&IB(" @(" @9&]?<V-A;@T*"7-H<@EE8G L
XM,@D)"3L@8VAA:6Y?;&5N9W1H(#X^/2 R#0H@(" @(" @(&IM<" @(" @<VAO
XM<G0@9&]?<V-A;@T*#0H@(" @(" @(&%L:6=N(" @-" @(" @(" @(" @(" @
XM(" @(" @(" @.R!A;&EG;B!D97-T:6YA=&EO;B!O9B!B<F%N8V@-"FQO;F=?
XM;&]O<#H-"CL@870@=&AI<R!P;VEN="P@961I(#T]('-C86XK,BP@97-I(#T]
XM(&-U<E]M871C: T*(" @(" @("!M;W8@(" @(&%X+%ME8G@K961I+3-=(" @
XM(" @(" @(#L@87@@/2!S8V%N6V)E<W1?;&5N+3$N+F)E<W1?;&5N70T*(" @
XM(" @("!M;W8@(" @(&-X+%ME9&DM,ET@(" @(" @(" @(" @(#L@8W@@/2!S
XM8V%N6S N+C%=#0IS:&]R=%]L;V]P.@T*(" @(" @("!D96,@(" @(&5B<" @
XM(" @(" @(" @(" @(" @(" @(#L@+2UC:&%I;E]L96YG=&@-"B @(" @(" @
XM:GH@(" @("!T:&5?96YD#0H[(&%T('1H:7,@<&]I;G0L(&5D:2 ]/2!S8V%N
XM*S(L(&5S:2 ]/2!C=7)?;6%T8V@L#0H[(&%X(#T@<V-A;EMB97-T7VQE;BTQ
XM+BYB97-T7VQE;ET@86YD(&-X(#T@<V-A;ELP+BXQ70T*(" @(" @("!A;F0@
XM(" @(&5S:2Q74TE:12TQ#0H@(" @(" @(&UO=B @(" @<VDL7W!R979;97-I
XM*V5S:5T@(" @(" @.R!C=7)?;6%T8V@@/2!P<F5V6V-U<E]M871C:%T-"B @
XM(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" [('1O<"!W
XM;W)D(&]F(&5S:2!I<R!S=&EL;" P#0H@(" @(" @(&-M<" @(" @97-I+&5D
XM> D)"3L@8W5R7VUA=&-H(#P](&QI;6ET(#\-"B @(" @(" @:F)E(" @("!S
XM:&]R="!T:&5?96YD#0ID;U]S8V%N.@T*(" @(" @("!C;7 @(" @(&%X+'=O
XM<F0@<'1R(%]W:6YD;W=;96)X*V5S:2TQ72 @(#L@8VAE8VL@;6%T8V@@870@
XM8F5S=%]L96XM,0T*(" @(" @("!J;F4@(" @('-H;W)T7VQO;W -"B @(" @
XM(" @8VUP(" @("!C>"QW;W)D('!T<B!?=VEN9&]W6V5S:5T@(" @(" @(" [
XM(&-H96-K(&UI;E]M871C:%]L96YG=&@@;6%T8V@-"B @(" @(" @:FYE(" @
XM("!S:&]R=%]L;V]P#0H-"B @(" @(" @;&5A(" @("!E<VDL7W=I;F1O=UME
XM<VDK,ET@(" @(" [('-I(#T@;6%T8V@-"B @(" @(" @;6]V(" @("!E87@L
XM961I(" @(" @(" @(" @(" @(" [(&%X(#T@<V-A;BLR#0H@(" @(" @(&UO
XM=B @(" @96-X+"A-05A?34%40T@M,BDO,B @(" @.R!S8V%N(&9O<B!A="!M
XM;W-T($U!6%]-051#2"!B>71E<PT*(" @(" @("!R97!E(" @(&-M<'-W(" @
XM(" @(" @(" @(" @(" @(#L@;&]O<"!U;G1I;"!M:7-M871C: T*(" @(" @
XM("!J92 @(" @(&UA>&UA=&-H(" @(" @(" @(" @(" @(#L@;6%T8V@@;V8@
XM;&5N9W1H($U!6%]-051#2#\-"FUI<VUA=&-H.@T*(" @(" @("!M;W8@(" @
XM(&-L+%ME9&DM,ET@(" @(" @(" @(" @(#L@;6ES;6%T8V@@;VX@9FER<W0@
XM;W(@<V5C;VYD(&)Y=&4_#0H@(" @(" @('-U8B @(" @8VPL6V5S:2TR72 @
XM(" @(" @(" @(" @.R!C;" ](# @:68@9FER<W0@8GET97,@97%U86P-"B @
XM(" @(" @>&-H9R @("!E87@L961I(" @(" @(" @(" @(" @(" [(&5D:2 ]
XM('-C86XK,BP@96%X(#T@96YD(&]F('-C86X-"B @(" @(" @<W5B(" @("!E
XM87@L961I(" @(" @(" @(" @(" @(" [(&5A>" ](&QE;@T*"7-U8@EE<VDL
XM96%X(" @(" @(" )"3L@97-I(#T@8W5R7VUA=&-H("L@,B K(&]F9G-E="AW
XM:6YD;W<I#0H)<W5B"65S:2PR*V]F9G-E="!?=VEN9&]W(" @(#L@97-I(#T@
XM8W5R7VUA=&-H#0H@(" @(" @('-U8B @(" @8VPL,2 @(" @(" @(" @(" @
XM(" @(" @.R!S970@8V%R<GD@:68@8VP@/3T@," H8V%N)W0@=7-E($1%0RD-
XM"B @(" @(" @861C(" @("!E87@L," @(" @(" @(" @(" @(" @(" [(&5A
XM>" ](&-A<G)Y(#\@;&5N*S$@.B!L96X-"B @(" @(" @8VUP(" @("!E87@L
XM96)X(" @(" @(" @(" @(" @(" [(&QE;B ^(&)E<W1?;&5N(#\-"B @(" @
XM(" @:FQE(" @("!L;VYG7VQO;W -"B @(" @(" @;6]V(" @("!?;6%T8VA?
XM<W1A<G0L97-I(" @(" @(" [(&UA=&-H7W-T87)T(#T@8W5R7VUA=&-H#0H@
XM(" @(" @(&UO=B @(" @96)X+&5A>" @(" @(" @(" @(" @(" @.R!E8G@@
XM/2!B97-T7VQE;B ](&QE;@T*(" @(" @("!C;7 @(" @(&5A>"Q-05A?34%4
XM0T@@(" @(" @(" @(#L@;&5N(#X]($U!6%]-051#2" _#0H@(" @(" @(&IL
XM(" @(" @;&]N9U]L;V]P#0IT:&5?96YD.@T*(" @(" @("!M;W8@(" @(&5A
XM>"QE8G@@(" @(" @(" @(" @(" @(#L@<F5S=6QT(#T@96%X(#T@8F5S=%]L
XM96X-"@EP;W )96)X#0H@(" @(" @('!O<" @(" @97-I#0H@(" @(" @('!O
XM<" @(" @961I#0H@(" @(" @('!O<" @(" @96)P#0H@(" @(" @(')E= T*
XM;6%X;6%T8V@Z(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(#L@8V]M
XM92!H97)E(&EF(&UA>&EM=6T@;6%T8V@-"B @(" @(" @8VUP<V(@(" @(" @
XM(" @(" @(" @(" @(" @(" @(" [(&EN8W)E;65N="!E<VD@86YD(&5D:0T*
XM(" @(" @("!J;7 @(" @(&UI<VUA=&-H(" @(" @(" @(" @(" @(#L@9F]R
XM8V4@;6%T8VA?;&5N9W1H(#T@34%87TQ%3D=42 T*#0IL;VYG97-T7VUA=&-H
X=7R!E;F1P#0H-"E]415A4(" @96YD<PT*96YD#0H*
X
Xend
END_OF_FILE
if test 8134 -ne `wc -c <'os2/match32.asm.UU'`; then
echo shar: \"'os2/match32.asm.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'os2/match32.asm'\" \(5879 characters\)
cat os2/match32.asm.UU | uudecode
if test 5879 -ne `wc -c <'os2/match32.asm'`; then
echo shar: \"'os2/match32.asm'\" uudecoded with wrong size!
else
rm os2/match32.asm.UU
fi
fi
# end of 'os2/match32.asm.UU'
fi
if test -f 'vms/VMSmunch.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/VMSmunch.h'\"
else
echo shar: Extracting \"'vms/VMSmunch.h'\" \(5511 characters\)
sed "s/^X//" >'vms/VMSmunch.h' <<'END_OF_FILE'
X/*---------------------------------------------------------------------------
X
X VMSmunch.h
X
X A few handy #defines, plus the contents of three header files from Joe
X Meadows' FILE program. Used by VMSmunch and by various routines which
X call VMSmunch (e.g., in Zip and UnZip).
X
X ---------------------------------------------------------------------------*/
X
X#define GET_TIMES 4
X#define SET_TIMES 0
X#define GET_RTYPE 1
X#define CHANGE_RTYPE 2
X#define RESTORE_RTYPE 3
X
X/*---------------------------------------------------------------------------
X fatdef.h
X ---------------------------------------------------------------------------*/
X
X/* This header file was created by Joe Meadows, and is not copyrighted
X in any way. No guarantee is made as to the accuracy of the contents
X of this header file. This header file was last modified on Sep. 22th,
X 1987. (Modified to include this statement) */
X#define FAT$K_LENGTH 32
X#define FAT$C_LENGTH 32
X#define FAT$S_FATDEF 32
X
Xstruct fatdef {
X union {
X unsigned char fat$b_rtype;
X struct {
X unsigned fat$v_rtype : 4;
X unsigned fat$v_fileorg : 4;
X } fat$r_rtype_bits;
X } fat$r_rtype_overlay;
X# define FAT$S_RTYPE 4
X# define FAT$V_RTYPE 0
X# define FAT$C_UNDEFINED 0
X# define FAT$C_FIXED 1
X# define FAT$C_VARIABLE 2
X# define FAT$C_VFC 3
X# define FAT$C_STREAM 4
X# define FAT$C_STREAMLF 5
X# define FAT$C_STREAMCR 6
X# define FAT$S_FILEORG 4
X# define FAT$V_FILEORG 4
X# define FAT$C_SEQUENTIAL 0
X# define FAT$C_RELATIVE 1
X# define FAT$C_INDEXED 2
X# define FAT$C_DIRECT 3
X union {
X unsigned char fat$b_rattrib;
X struct {
X unsigned fat$v_fortrancc : 1;
X unsigned fat$v_impliedcc : 1;
X unsigned fat$v_printcc : 1;
X unsigned fat$v_nospan : 1;
X } fat$r_rattrib_bits;
X } fat$r_rattrib_overlay;
X# define FAT$V_FORTRANCC 0
X# define FAT$M_FORTRANCC 1
X# define FAT$V_IMPLIEDCC 1
X# define FAT$M_IMPLIEDCC 2
X# define FAT$V_PRINTCC 2
X# define FAT$M_PRINTCC 4
X# define FAT$V_NOSPAN 3
X# define FAT$M_NOSPAN 8
X unsigned short int fat$w_rsize;
X union
X {
X unsigned long int fat$l_hiblk;
X struct
X {
X unsigned short int fat$w_hiblkh;
X unsigned short int fat$w_hiblkl;
X } fat$r_hiblk_fields;
X } fat$r_hiblk_overlay;
X union
X {
X unsigned long int fat$l_efblk;
X struct
X {
X unsigned short int fat$w_efblkh;
X unsigned short int fat$w_efblkl;
X } fat$r_efblk_fields;
X } fat$r_efblk_overlay;
X unsigned short int fat$w_ffbyte;
X unsigned char fat$b_bktsize;
X unsigned char fat$b_vfcsize;
X unsigned short int fat$w_maxrec;
X unsigned short int fat$w_defext;
X unsigned short int fat$w_gbc;
X char fat$fill[8];
X unsigned short int fat$w_versions;
X};
X
X/*---------------------------------------------------------------------------
X fchdef.h
X ---------------------------------------------------------------------------*/
X
X/* This header file was created by Joe Meadows, and is not copyrighted
X in any way. No guarantee is made as to the accuracy of the contents
X of this header file. This header file was last modified on Sep. 22th,
X 1987. (Modified to include this statement) */
X
X#define FCH$V_BADACL 0x00B
X#define FCH$M_BADACL (1 << FCH$V_ACL)
X#define FCH$V_BADBLOCK 0x00E
X#define FCH$M_BADBLOCK (1 << FCH$V_BADBLOCK)
X#define FCH$V_CONTIG 0x007
X#define FCH$M_CONTIG (1 << FCH$V_CONTIG)
X#define FCH$V_CONTIGB 0x005
X#define FCH$M_CONTIGB (1 << FCH$V_CONTIGB)
X#define FCH$V_DIRECTORY 0x00D
X#define FCH$M_DIRECTORY (1 << FCH$V_DIRECTORY)
X#define FCH$V_ERASE 0x011
X#define FCH$M_ERASE (1 << FCH$V_ERASE)
X#define FCH$V_LOCKED 0x006
X#define FCH$M_LOCKED (1 << FCH$V_LOCKED)
X#define FCH$V_MARKDEL 0x00F
X#define FCH$M_MARKDEL (1 << FCH$V_MARKDEL)
X#define FCH$V_NOBACKUP 0x001
X#define FCH$M_NOBACKUP (1 << FCH$V_NOBACKUP)
X#define FCH$V_NOCHARGE 0x010
X#define FCH$M_NOCHARGE (1 << FCH$V_NOCHARGE)
X#define FCH$V_READCHECK 0x003
X#define FCH$M_READCHECK (1 << FCH$V_READCHECK)
X#define FCH$V_SPOOL 0x00C
X#define FCH$M_SPOOL (1 << FCH$V_SPOOL)
X#define FCH$V_WRITCHECK 0x004
X#define FCH$M_WRITCHECK (1 << FCH$V_WRITCHECK)
X#define FCH$V_WRITEBACK 0x002
X#define FCH$M_WRITEBACK (1 << FCH$V_WRITEBACK)
X
Xstruct fchdef {
X unsigned : 1;
X unsigned fch$v_nobackup : 1 ;
X unsigned fch$v_writeback : 1;
X unsigned fch$v_readcheck : 1;
X unsigned fch$v_writcheck : 1;
X unsigned fch$v_contigb : 1;
X unsigned fch$v_locked : 1;
X unsigned fch$v_contig : 1;
X unsigned : 3;
X unsigned fch$v_badacl : 1;
X unsigned fch$v_spool : 1;
X unsigned fch$v_directory : 1;
X unsigned fch$v_badblock : 1;
X unsigned fch$v_markdel : 1;
X unsigned fch$v_nocharge : 1;
X unsigned fch$v_erase : 1;
X};
X
X/*---------------------------------------------------------------------------
X fjndef.h
X ---------------------------------------------------------------------------*/
X
X/* This header file was created by Joe Meadows, and is not copyrighted
X in any way. No guarantee is made as to the accuracy of the contents
X of this header file. This header file was last modified on Sep. 22th,
X 1987. (Modified to include this statement) */
X
X#define FJN$M_ONLY_RU 1
X#define FJN$M_RUJNL 2
X#define FJN$M_BIJNL 4
X#define FJN$M_AIJNL 8
X#define FJN$M_ATJNL 16
X#define FJN$M_NEVER_RU 32
X#define FJN$M_JOURNAL_FILE 64
X#define FJN$S_FJNDEF 1
Xstruct fjndef {
X unsigned fjn$v_only_ru : 1;
X unsigned fjn$v_rujnl : 1;
X unsigned fjn$v_bijnl : 1;
X unsigned fjn$v_aijnl : 1;
X unsigned fjn$v_atjnl : 1;
X unsigned fjn$v_never_ru : 1;
X unsigned fjn$v_journal_file:1;
X} ;
END_OF_FILE
if test 5511 -ne `wc -c <'vms/VMSmunch.h'`; then
echo shar: \"'vms/VMSmunch.h'\" unpacked with wrong size!
fi
# end of 'vms/VMSmunch.h'
fi
if test -f 'vms/vaxclib.opt' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/vaxclib.opt'\"
else
echo shar: Extracting \"'vms/vaxclib.opt'\" \(30 characters\)
sed "s/^X//" >'vms/vaxclib.opt' <<'END_OF_FILE'
Xsys$library:vaxcrtl.exe/share
END_OF_FILE
if test 30 -ne `wc -c <'vms/vaxclib.opt'`; then
echo shar: \"'vms/vaxclib.opt'\" unpacked with wrong size!
fi
# end of 'vms/vaxclib.opt'
fi
echo shar: End of archive 9 \(of 11\).
cp /dev/null ark9isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:50:15 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 102
Archive-name: zip19/part10

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: Readme Where algorith.doc atari/atari.c atari/tc.cfg.UU
# contents globals.c install.doc match.s mktime.c
# msdos/doturboc.bat.UU msdos/makefile.bor.UU nt/makefile.nt.UU
# os2/os2zip.h.UU ziperr.h
# Wrapped by kent@sparky on Sun Aug 23 01:00:47 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 10 (of 11)."'
if test -f 'Readme' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Readme'\"
else
echo shar: Extracting \"'Readme'\" \(5257 characters\)
sed "s/^X//" >'Readme' <<'END_OF_FILE'


XCopyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
XKai Uwe Rommel and Igor Mandrichenko.
XPermission is granted to any individual or institution to use, copy, or
Xredistribute this software so long as all of the original files are included
Xunmodified, that it is not sold for profit, and that this copyright notice
Xis retained.
X

X
XZip 1.9 is a compression and file packaging utility. It is analogous to a
Xcombination of tar and compress and is compatible with PKZIP 1.93a
X(Phil Katz ZIP) for MSDOS systems. There is a companion to zip called
Xunzip (of course) which you should be able to find the same place you
Xgot zip. (See the file 'where' for details on ftp sites and mail
Xservers.)
X
XThis version of zip has been ported to a wide array of Unix and other
Xmainframes, minis, and micros including VMS, OS/2, Minix, MSDOS,
XWindows NT, Atari, and Macintosh (the latter two have not been tested
Xrecently). Although highly compatible with PKware's PKZIP and PKUNZIP
Xutilities of MSDOS fame, our primary objective has been one of
Xportability and other-than-MSDOS functionality. Features not found in
Xthe PKWare version include creation of zip files in a pipe or on a
Xdevice, VMS and OS/2 extended file attributes, conversion from Unix to
XMSDOS text file format; and, of course, the ability to run on most of
Xyour favorite operating systems. And it's free.
X
XIf you got this file from zip19.zip, you can extract the rest only
Xwith unzip 5.0 or pkzip 1.93a. See the file 'Where' if you do not
Xhave them already.
X
XPlease read the file install.doc for information on how to compile and
Xinstall zip, zipsplit and zipnote. Please read the file zip.doc for
Xinformation on how to use them. The file "contents" is a complete
Xlist of the files you should have in this distribution. Also, if you
Xare using MSDOS, you should read the note on file formats at the end
Xof the contents file.
X
XThis version supports encryption, but the encryption code is distributed
Xseparately because of the US export regulations. See the file 'Where'
Xfor access to the encryption code. Decryption can be made with unzip 5.0
Xor later, or with zipcloak (which is provided in the encryption supplement).
X
XAll bug reports and patches should go to zip-...@cs.ucla.edu, and
Xsuggestions for new features can be sent to info...@cs.ucla.edu
X(although we don't promise to use all suggestions). Patches should be
Xsent as context diffs only (diff -c).
X
XIf you're considering a port, please check in with zip-bugs FIRST,
Xsince the code is constantly being updated behind the scenes. We'll
Xarrange to give you access to the latest source. The alternative is the
Xpossibility that your hard work will be tucked away in a sub-archive
Xand pretty much ignored. A port to VM/CMS would be welcome.
X
XIf you'd like to keep up to date with our zip (and companion unzip utility)
Xdevelopment, join the ranks of BETA testers, add your own thoughts and
Xcontributions, etc., send your request to Info-ZIP...@cs.ucla.edu and
Xyou will be added to the Info-ZIP newsletter mailing list.
X
X
XIMPORTANT NOTES:
X
X- pkzip 1.93a is only an alpha version (see historical notes below). If
X you wish to create zip files compatible with the official version of
X pkzip (1.10), you must use zip 1.0. zip 1.9 cannot create files
X with the old compression method (implosion).
X
X- zip 1.9 is is compatible with pkzip 1.93a, except when two features
X are used: encryption or zip file created in a pipe or on a non
X seekable device. pkzip versions of 2.0 will support such files, and
X unzip 5.0 already supports them. (Thanks to Phil Katz for accepting
X our suggested minor changes to the zip file format.)
X
X- the ports to the Macintosh and the Atari ST have been provided in
X the hope that they can be useful, but they have been adapted from an
X older version of zip (1.0) and are still completely untested. A
X makefile is still missing for the Mac. Another Macintosh port is
X being made by Johnny Lee <joh...@microsoft.com> but it requires
X more substantial changes so it will be distributed separately.
X
X- Please read the file zip.doc, and in particular its list of known bugs
X at the end.
X
XHistorical notes:
X
XAt the time of release of zip 1.9, the official released version of
XPKZIP is version 1.10. PKZIP 1.93a is only an alpha version, which was
Xreleased in October 1991. It was supposed to be replaced soon after
Xwith an official release of pkzip 2.0. However, Phil Katz has not yet
Xannounced a release date at the time of writing (Aug 19th, 1992).
X
XBeta versions of zip compatible with pkzip 1.93a have been available
Xsince February 1992 to the info-zip group (see the file 'history').
XThe zip authors would have preferred to release zip 2.0 only after
Xpkzip 2.0(*), to ensure full compatibility in case of archive format
Xchanges between pkzip 1.93a and 2.0. However we feel that we cannot
Xdelay any further the release of zip 1.9, since all the major features
Xthat we wanted to put in are now available and well tested by the
Xinfo-zip group.
X
X(*) The version number for the new pkzip was planned to be 2.00, but may
X be increased to a number greater than 2.2 to prevent confusion with
X several bogus versions, which may destroy all the data on your hard
X disk if you run them.
END_OF_FILE
if test 5257 -ne `wc -c <'Readme'`; then
echo shar: \"'Readme'\" unpacked with wrong size!
fi
# end of 'Readme'
fi
if test -f 'Where' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Where'\"
else
echo shar: Extracting \"'Where'\" \(4412 characters\)
sed "s/^X//" >'Where' <<'END_OF_FILE'
X__________________________________________________________________________
X
X This is the Info-ZIP file ``Where,'' last updated on 20 August 1992.
X__________________________________________________________________________
X
X
X SITE OWNERS: If you're listed in here but the information is not
X correct (or if you're a big site but aren't listed at all), please
X let us know! E-mail to zip-bugs at the address given in Readme
X and we'll update this file.
X
XBasic source-archive names for Info-ZIP's portable Zip, UnZip, and related
Xutilities (on some ftp sites, the .zip files may have a .zoo equivalent
Xin zoo 2.10 format):
X
X zip19.zip Zip 1.9 (includes zipnote and zipsplit)
X zip19.tar.Z ditto, compress'd tar format
X
X unzip50.zip UnZip 5.0 (includes zipinfo and funzip)
X unzip50.tar.Z ditto, compress'd tar format
X
X wunz12sr.zip WizUnZip 1.2 support files for Windows 3.1, UnZip 5.0
X
X zcrypt19.zip encryption/decryption support (includes zipcloak)
X
XRelated archives and files:
X
X UnzpHist.zip changes history of UnZip, back to 2.0
X
X zip19x.zip MSDOS executables and docs for zip, zipnote, zipsplit
X unzip50.exe MSDOS executable for unzip
X
X zip19_16.zip OS/2 1.x 16-bit executables and docs
X zip19_32.zip OS/2 2.x 32-bit executables and docs
X unz50_16.exe OS/2 1.x 16-bit executable
X unz50_32.exe OS/2 2.x 32-bit executable
X
X zip19vms.zip VMS executables and docs for zip, zipnote, zipsplit
X unz50vms.exe VMS executable for unzip
X
X zip_unzip.hqx Macinstosh executables (zip 1.0 only, 1.9 not ready)
X
X winunz12.zip Windows 3.1 executables (zip 1.0 only, 1.9 not ready)
X
X pkz110eu.exe MS-DOS PKZIP/PKUNZIP 1.1 (self-extracting archive)
X pkz193a.exe MS-DOS PKZIP/PKUNZIP beta 1.93 (self-extracting)
X pkz102-2.exe OS/2 PKZIP/PKUNZIP 1.02 (self-extracting)
X
Xftp sites for the US-exportable sources and executables. Look for
Xthe file names given above in the following directories. Some sites
Xlike to use slightly different names, such as zip-1.9.tar-z instead
Xof zip19.tar.Z.
X
X wuarchive.wustl.edu:/packages/compression/...
X wuarchive.wustl.edu:/mirrors/misc/unix/...
X wuarchive.wustl.edu:/mirrors/misc/vaxvms/...
X wuarchive.wustl.edu:/mirrors/msdos/zip/...
X wuarchive.wustl.edu:/mirrors/msdos/windows3/...
X
X ftp.uu.net:/pub/zip/...
X
X ftp-os2.nmsu.edu:/pub/os2/2.0/archivers/...
X ftp-os2.nmsu.edu:/pub/os2/all/archivers/...
X
X Zip 1.9 and UnZip 5.0 will also be available at any comp.sources.misc
X archive site as soon as they are posted.
X
X wuarchive.wustl.edu:/mirrors/msdos/zip/pkz110eu.exe
X ux1.cso.uiuc.edu:/pc/exec-pc/pkz193a.exe [128.174.5.59]
X
Xftp sites for the encryption and decryption sources:
X
X NOTE: Non-US users, please do NOT ftp from the US site (US
X regulations and all that). Likewise, US users, please do not
X ftp from the European sites (it's not illegal, but it sure is
X a waste of expensive bandwidth).
X
X From the US:
X wuarchive.wustl.edu:/mirrors3/garbo.uwasa.fi/arcutil/zcrypt19.zip
X
X Outside the US:
X garbo.uwasa.fi:/pc/arcutil/zcrypt19.zip
X ftp.win.tue.nl:/pub/compression/zip/zcrypt19.zip
X ftp.inria.fr:/system/arch-compr/zcrypt19.zip
X ftp.informatik.tu-muenchen.de:/pub/utils/archiver/zcrypt19.zip
X (mail server at ftp-m...@ftp.informatik.tu-muenchen.de)
X
XTo find other ftp sites:
X
X The "archie" ftp database utility can be used to find an ftp site
X near you. If you don't know how to use it, DON'T ASK US--check the
X Usenet groups news.newusers.questions or news.answers or some such,
X or ask your system administrator.
X
XUUCP sites:
X
X uunet!~/pub/zip/ ...
X
XMail servers:
X
X If you don't have anonymous FTP capability, you can mail one
X of the following commands (in the body of an e-mail message) to
X list...@vm1.nodak.edu or list...@vm.ecs.rpi.edu in order to
X get a copy via e-mail:
X
X /pdget mail pd:<misc.unix>unzip50.tar-z uuencode
X /pdget mail pd:<misc.unix>zip19.zip uuencode
X or: /pdget mail pd:<misc.unix>zip19.tar-z uuencode
X
X To get the encryption source by email, send the following commands
X to ftp-m...@ftp.informatik.tu-muenchen.de:
X
X get /pub/utils/archiver/zcrypt19.zip
X quit
X
X__________________________________________________________________________
X
XAgain, if someone repackages any of the source or executable archives in
XVMS-, Mac- or Atari-specific formats, please let us know (send e-mail to
Xzip-bugs at the address listed in README).
X__________________________________________________________________________
X
END_OF_FILE
if test 4412 -ne `wc -c <'Where'`; then
echo shar: \"'Where'\" unpacked with wrong size!
fi
# end of 'Where'
fi
if test -f 'algorith.doc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'algorith.doc'\"
else
echo shar: Extracting \"'algorith.doc'\" \(2948 characters\)
sed "s/^X//" >'algorith.doc' <<'END_OF_FILE'
XZip's deflation algorithm is a variation of LZ77 (Lempel-Ziv 1977, see
Xreference below). It finds duplicated strings in the input data. The
Xsecond occurrence of a string is replaced by a pointer to the previous
Xstring, in the form of a pair (distance, length). Distances are
Xlimited to 32K bytes, and lengths are limited to 258 bytes. When a
Xstring does not occur anywhere in the previous 32K bytes, it is
Xemitted as a sequence of literal bytes. (In this description,
X'string' must be taken as an arbitrary sequence of bytes, and is not
Xrestricted to printable characters.)
X
XLiterals or match lengths are compressed with one Huffman tree, and
Xmatch distances are compressed with another tree. The trees are stored
Xin a compact form at the start of each block. The blocks can have any
Xsize (except that the compressed data for one block must fit in
Xavailable memory). A block is terminated when zip determines that it
Xwould be useful to start another block with fresh trees. (This is
Xsomewhat similar to compress.)
X
XDuplicated strings are found using a hash table. All input strings of
Xlength 3 are inserted in the hash table. A hash index is computed for
Xthe next 3 bytes. If the hash chain for this index is not empty, all
Xstrings in the chain are compared with the current input string, and
Xthe longest match is selected.
X
XThe hash chains are searched starting with the most recent strings, to
Xfavor small distances and thus take advantage of the Huffman encoding.
XThe hash chains are singly linked. There are no deletions from the
Xhash chains, the algorithm simply discards matches that are too old.
X
XTo avoid a worst-case situation, very long hash chains are arbitrarily
Xtruncated at a certain length, determined by a runtime option (zip -1
Xto -9). So zip does not always find the longest possible match but
Xgenerally finds a match which is long enough.
X
Xzip also defers the selection of matches with a lazy evaluation
Xmechanism. After a match of length N has been found, zip searches for a
Xlonger match at the next input byte. If a longer match is found, the
Xprevious match is truncated to a length of one (thus producing a single
Xliteral byte) and the longer match is emitted afterwards. Otherwise,
Xthe original match is kept, and the next match search is attempted only
XN steps later.
X
XThe lazy match evaluation is also subject to a runtime parameter. If
Xthe current match is long enough, zip reduces the search for a longer
Xmatch, thus speeding up the whole process. If compression ratio is more
Ximportant than speed, zip attempts a complete second search even if
Xthe first match is already long enough.
X
XJean-loup Gailly
Xjl...@chorus.fr
X
XReferences:
X
X[LZ77] Ziv J., Lempel A., "A Universal Algorithm for Sequential Data
XCompression", IEEE Transactions on Information Theory", Vol. 23, No. 3,
Xpp. 337-343.
X
XAPPNOTE.TXT documentation file in PKZIP 1.93a. It is available by
Xftp in ux1.cso.uiuc.edu:/pc/exec-pc/pkz193a.exe [128.174.5.59]
END_OF_FILE
if test 2948 -ne `wc -c <'algorith.doc'`; then
echo shar: \"'algorith.doc'\" unpacked with wrong size!
fi
# end of 'algorith.doc'
fi
if test -f 'atari/atari.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/atari.c'\"
else
echo shar: Extracting \"'atari/atari.c'\" \(1896 characters\)
sed "s/^X//" >'atari/atari.c' <<'END_OF_FILE'
X/*
X * ATARI.C
X *
X * Necessary interface functions, mostly for conversion
X * of path names.
X */
X#ifdef ATARI_ST
X
X#include <stdio.h>
X#include <stdlib.h>
X#include <tos.h>
X#include <ext.h>
X
X#define FNMAX 256
X#define OF(sig) sig
X
Xchar *st_fn OF((char *));
X
Xchar *st_fn(s)
Xchar *s;
X{
Xstatic char tosname [ FNMAX ];
Xchar *t = tosname;
X
X while ( *t=*s++ ) {
X if ( *t == '/' )
X *t = '\\';
X t++;
X }
X
X return(tosname);
X}
X
Xint st_unlink(f)
Xchar *f;
X{
X return(unlink(st_fn(f)));
X}
X
X/* Fake chmod with minimalistic functionality.
X * [ anyway people will be in trouble with the readonly files
X * produces by this, since 'normal' users don't own the
X * 'tools' to manipulate these. ]
X */
Xint st_chmod(f, a)


Xchar *f; /* file path */
Xint a; /* attributes returned by getfileattr() */
X/* Give the file f the attributes a, return non-zero on failure */
X{

X if ( ! ( a & S_IWRITE ) )
X if (Fattrib(st_fn(f), 1, FA_READONLY) < 0 )
X return(-1);


X return 0;
X}
X

X/*
X * mktemp is not part of the Turbo C library.
X */
Xchar *st_mktemp(s)
Xchar *s;
X{
Xchar *t;
Xlong i;
X for(t=s; *t; t++)
X if ( *t == '/' )
X *t = '\\';
X t -= 6;
X i = (unsigned long)s % 1000000L;
X do {
X sprintf(t, "%06ld", i++);
X } while ( Fsfirst(s, 0x21) == 0 );
X return(s);
X}
X
XFILE *st_fopen(f,m)
Xchar *f;
Xchar *m;
X{
X return(fopen(st_fn(f),m));
X}
X
Xint st_open(f,m)
Xchar *f;
Xint m;
X{
X return(open(st_fn(f),m));
X}
X
Xint st_stat(f, b)
Xchar *f;
Xstruct stat *b;
X{
X return(stat(st_fn(f),b));
X}
X
Xint st_findfirst(n,d,a)
Xchar *n;
Xstruct ffblk *d;
Xint a;
X{
X return(findfirst( st_fn(n),(struct ffblk *)d,a));
X}
X
X
Xint st_rename(s, d)
Xchar *s, *d;
X{
Xchar tosname [ FNMAX ];
Xchar *t = tosname;
X
X while ( *t=*s++ ) {
X if ( *t == '/' )
X *t = '\\';
X t++;
X }
X return(rename(tosname, st_fn(d)));
X}
X
Xint st_rmdir(d)
Xchar *d;
X{
X return(Ddelete(st_fn(d)));
X}
X
X#endif /* ?ATARI_ST */
END_OF_FILE
if test 1896 -ne `wc -c <'atari/atari.c'`; then
echo shar: \"'atari/atari.c'\" unpacked with wrong size!
fi
# end of 'atari/atari.c'
fi
if test -f 'atari/tc.cfg.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/tc.cfg.UU'\"
else
echo shar: Extracting \"'atari/tc.cfg.UU'\" \(3563 characters\)
sed "s/^X//" >'atari/tc.cfg.UU' <<'END_OF_FILE'
Xbegin 666 atari/tc.cfg
XM @( "C0
XM
XM
XM
XM
XM
XM
XM
XM
XM 0
XM 93I<=&-<:6YC;'5D90
XM $%405))7U-4 !84$]25 3U)4
XM ,C4 #$P
XM, S,@ ,@
XM
XM
XM
XM
XM
XM
XM
XM
XM
XM
XM
XM
XM !
XM X,3DR 93I<
XM=&-<;&EB
XM
XM
XM
XM1CI<6DE07%I)4%Q:25 N4%)*
XM
XM !&.EQ:25!<
XM6DE07 !#+EI)4
XM
XM
XM
XM
XM /S\_
XM @ # $8 %$8Z7%I)4%Q:25!<34%+149)3$4 7$U!2T5&24Q% ,
XM )^?H #>* P ")'D $ -XH#$ (FIH "LUN # @
XM 0 GZ(@ 0 ( $ " ! 0 ! "=)P
XM !# 0P 1@ 41CI<6DE07%I)4%Q:25 N4%)* !<34%+149)
XM3$4 P GY^@ -XH# (D>0 0 WB@,0 B:F@ *
XMS6X ," ! "?HB ! @ 0 ( $
XM ! $ )TG 0!& !1%.EQ40UQ$149!54Q4+E!2
XM2@ %Q-04M%1DE,10 # "?GZ WB@, B1Y !
XM #>* Q ")J: K-;@ P( $ )^B(
XM $ " ! @ 0 $ 0 G2< ! L@ +( ! $8 %$UE<W-A
XM9V5S
XM
XM (
XM
XM
XL
X
Xend
END_OF_FILE
if test 3563 -ne `wc -c <'atari/tc.cfg.UU'`; then
echo shar: \"'atari/tc.cfg.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'atari/tc.cfg'\" \(2564 characters\)
cat atari/tc.cfg.UU | uudecode
if test 2564 -ne `wc -c <'atari/tc.cfg'`; then
echo shar: \"'atari/tc.cfg'\" uudecoded with wrong size!
else
rm atari/tc.cfg.UU
fi
fi
# end of 'atari/tc.cfg.UU'
fi
if test -f 'contents' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'contents'\"
else
echo shar: Extracting \"'contents'\" \(4614 characters\)
sed "s/^X//" >'contents' <<'END_OF_FILE'


XCopyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
XKai Uwe Rommel and Igor Mandrichenko.
XPermission is granted to any individual or institution to use, copy, or
Xredistribute this software so long as all of the original files are included
Xunmodified, that it is not sold for profit, and that this copyright notice
Xis retained.
X

XThis file is a complete list of files mentioned in the above copyright. Some
Xof the files in this list explicitly state in their text that they are public
Xdomain or not copyrighted. These files can be distributed separately and are
Xmarked below with asterisks.
X
Xfile what it is
X---- ----------
XReadme What zip is; general information.
XWhere where Zip/UnZip and encryption/decryption support can be found
Xalgorith.doc Description of the deflation algorithm
Xbits.c Output variable-length bit strings.
Xcontents This file.
Xdeflate.c Deflation compression method
Xfileio.c System dependent routines (most of them anyway).
Xglobals.c Global variables.
Xhistory List of changes in the versions leading up to this one.
Xinfozip.who List of contributors to the portable Zip project.
Xinstall.doc Documentation for Zip compilation and installation
Xmakecrc.c * Generate the CRC table in util.c and shrink.c.
Xmakefile Unix make file.
Xmatch.s Optimized 386 version of longest_match() (Unix & OS/2)
Xmktime.c Version of mktime for systems without it (currently unused)
Xrevision.h Contains the program version number and revision date.
Xtailor.h * Tailors the compilation to the system being compiled on.
Xtrees.c Encode source values using variable-length binary code trees.
Xutil.c Miscellaneous utility routines.
Xzip.1 Source for the Zip man page (zip.doc).
Xzip.c Main routine for Zip.
Xzip.doc Documentation for Zip (zip.1 processed).
Xzip.h Header for all Zip modules.
Xziperr.h Error messages in Zip.
Xzipfile.c Zip file format handler.
Xzipnote.c Main routine for ZipNote.
Xzipsplit.c Main routine for ZipSplit.
Xzipup.c Applies deflate or store methods to compress an entry.
Xatari/atari.c Atari ST specific routines
Xatari/makefile.st Turbo C makefile
Xatari/stzip.lnk Linker command file for zip
Xatari/stzip.prj Turbo C project file
Xatari/stzipn.lnk Linker command file for zipnote
Xatari/stzips.lnk Linker command file for zipsplit
Xatari/tc.cfg Turbo C configuration file
Xmac/macfile.c Macintosh specific routines
Xmac/macstat.c Macintosh specific routines
Xmac/macstat.h Macintosh specific header file
Xmsdos/doturboc.bat Batch file for compiling under Turbo C 2.0.
Xmsdos/makefile.bor MSDOS Borland C++ make file.
Xmsdos/makefile.gcc MSDOS DJGCC make file.
Xmsdos/makefile.msc MSDOS Microsoft C make file.
Xmsdos/match.asm Optimized 8086 version of longest_match().
Xmsdos/tcconfig.tc TurboC 2.0 configuration file
Xmsdos/zip.prj Project file for Borland (Turbo) C++.
Xmsdos/zipnote.prj Project file for Borland (Turbo) C++.
Xmsdos/zipsplit.prj Project file for Borland (Turbo) C++.
Xnt/makefile.nt Makefile for Windows NT
Xos2/makefile.os2 OS/2 make file.
Xos2/match32.asm Optimized 386 version of longest_match() (*untested*)
Xos2/os2zip.c * Directory routines for OS/2.
Xos2/os2zip.h * Definitions of functions in os2zip.c.
Xos2/zip.def OS/2 def file for Zip.
Xvms/VMSmunch.c file manipulation, adapted from Joe Meadows' FILE
Xvms/VMSmunch.h definitions for VMSmunch.c
Xvms/descrip.mms VMS makefile
Xvms/make_gcc.com VMS command file for compilation with gcc.
Xvms/make_vaxc.com VMS command file for compilation with Vax C.
Xvms/makefile.vms VMS makefile for use with Todd Aven's MAKE/VMS
Xvms/vaxclib.opt VMS option file
Xvms/vms.c VMS specific code
Xvms/vms_zip.rnh VMS manual page
X
XAll of the files are in Unix (LF only) format except for the msdos and os2
Xfiles. On MSDOS and OS/2 systems, you can use the -a option of unzip to
Xconvert the source files to CRLF format. This is only necessary if you wish
Xto edit the files -- they will compile as is with Microsoft C and
XTurbo/Borland C++ 1.0 or later. However, you will have to convert the files
X(using unzip -a) to the CRLF format to compile with the older Turbo C 1.0 or
X2.0. In this case, do not convert the binary file turboc.cfg.
XYou should be able to find unzip the same place you found this (see the
Xfile 'where').
END_OF_FILE
if test 4614 -ne `wc -c <'contents'`; then
echo shar: \"'contents'\" unpacked with wrong size!
fi
# end of 'contents'
fi
if test -f 'globals.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'globals.c'\"
else
echo shar: Extracting \"'globals.c'\" \(2576 characters\)
sed "s/^X//" >'globals.c' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.


X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included

X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * globals.c by Mark Adler.
X */
X
X#define GLOBALS /* include definition of errors[] in zip.h */
X#include "zip.h"
X
X
X/* Handy place to build error messages */
Xchar errbuf[FNMAX+81];
X
X/* Argument processing globals */
Xint recurse = 0; /* 1=recurse into directories encountered */
Xint pathput = 1; /* 1=store path with name */
Xint method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
Xint dosify = 0; /* 1=make new entries look like MSDOS */
Xint verbose = 0; /* 1=report oddities in zip file structure */
Xint level = 5; /* 0=fastest compression, 9=best compression */
Xint translate_eol = 0; /* Translate end-of-line LF -> CR LF */
X#ifdef VMS
X int vmsver = 0; /* 1=append VMS version number to file names */
X int vms_native = 0; /* 1=store in VMS format */
X#endif /* VMS */
X#ifdef OS2
X int use_longname_ea = 0; /* 1=use the .LONGNAME EA as the file's name */
X#endif /* OS2 */
Xint linkput = 0; /* 1=store symbolic links as such */
Xint noisy = 1; /* 0=quiet operation */
Xchar *special = ".Z:.zip:.zoo:.arc:.lzh:.arj"; /* List of special suffixes */
Xchar *key = NULL; /* Scramble password if scrambling */
Xchar *tempath = NULL; /* Path for temporary files */
XFILE *mesg; /* stdout by default, stderr for piping */
X
X/* Zip file globals */
Xchar *zipfile; /* New or existing zip archive (zip file) */
Xulg zipbeg; /* Starting offset of zip structures */
Xulg cenbeg; /* Starting offset of central directory */
Xstruct zlist far *zfiles = NULL; /* Pointer to list of files in zip file */
Xextent zcount; /* Number of files in zip file */
Xextent zcomlen; /* Length of zip file comment */
Xchar *zcomment; /* Zip file comment (not zero-terminated) */
Xstruct zlist far **zsort; /* List of files sorted by name */
Xulg tempzn; /* Count of bytes written to output zip file */
X
X/* Files to operate on that are not in zip file */
Xstruct flist far *found = NULL; /* List of names found */
Xstruct flist far * far *fnxt = &found;
X /* Where to put next name in found list */
Xextent fcount; /* Count of files in list */
END_OF_FILE
if test 2576 -ne `wc -c <'globals.c'`; then
echo shar: \"'globals.c'\" unpacked with wrong size!
fi
# end of 'globals.c'
fi
if test -f 'install.doc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'install.doc'\"
else
echo shar: Extracting \"'install.doc'\" \(4088 characters\)
sed "s/^X//" >'install.doc' <<'END_OF_FILE'
XHOW TO INSTALL ZIP
X Zip is distributed as C source code that can be compiled on
X a wide range of Unix machines, VAXes running VMS, and MSDOS
X machines using Microsoft or Borland C++, and OS/2 machines
X using Microsoft C. You will need Unzip 5.0 (under Unix, MSDOS,
X or VMS) or PKUNZIP 1.93a (under MSDOS) to unpack the distribution
X file, zip19.zip. But since you read this, you have unpacked it
X already, or you cheated and got a tar.Z file...
X
X Let's assume however that you start from scratch and have not yet
X unpacked the sources. First, unpack the source as follows,
X assuming that you have zip19.zip in the current directory.
X
X mkdir zipsrc
X cd zipsrc
X unzip ../zip19
X
X This extracts all source files and documentation in the
X directory called "zipsrc". If you wish to build a version
X of zip with encryption capabilities, you must also get the
X separate package zcrypt19.zip and uncomment the definition
X of MAKE at the beginning of the makefile.
X
X You then do:
X
X make system
X
X where "system" is one of: bsd, bsdold, sysv, sysv_386, sysv_old, sun,
X sun_gcc, next, next10, hpux, dnix, cray, 3b1, zilog, aux, convex, aix,
X minix, isc, dynix, ultrix, dec_osf1 or xos. If you are using a NeXT
X running version 2.0 or greater, then make next. If you are using 1.0,
X then make next10. If you are using Sun OS 4.x, then make sun (or
X sun_gcc if you use gcc). If you are using SVR4 on a 386, use
X sysv_386 to get the optimized asm code.
X
X The other special systems are HPUX, DNIX 5.2 or 5.3, Cray Unicos,
X AT&T 3B1 (also known as Unix PC or PC 7300), Zilog Zeus, A/UX,
X Convex, AIX, MINIX, ISC System V/386, Dynix, Ultrix and DEC OSF/1.
X
X Otherwise, if you are using BSD Unix, try bsd. If the linker
X cannot find _memset or _memcpy, try bsdold. If you are using
X System V Unix or SCO Unix, try sysv or sysv_old. Also use sysv
X on a Silicon Graphics (SGI) machine. You can also cross-compile
X Zip for MSDOS under SCO 386 Unix using "make scodos".
X
X If none of these compiles, links, and functions properly on
X your Unix system, see the section BUGS below for how to get
X help.
X
X If the appropriate system was selected, then the executables
X zip, zipnote and zipsplit will be created. You can copy them
X to an appropriate directory in the search path using:
X
X make install
X
X The defaults are /usr/local/bin for the executables and
X /usr/man/man1 for the manual page. Change the macros BINDIR
X and MANDIR in makefile if appropriate.
X
X You can use the command "set" to see the current search
X path. If you are using the C-Shell (csh), enter the com-
X mand:
X
X rehash
X
X so csh can find the new command in the path. You are now
X ready to use Zip.
X
X You can get rid of the now unnecessary source and object
X files with:
X
X cd ..
X rm -r zipsrc
X
X This will remove the directory zip and its contents created
X by unzip. You should keep the zip19.zip file around though,
X in case you need to build it again or want to give it to a
X colleague.
X
X The steps for installation under MSDOS, OS/2, and VMS are
X similar to the above: first unzip the distribution files
X into their own directory. The system dependant files are
X stored in special subdirectories. You may have to
X copy or move them to the main sources directory.
X Then under MSDOS do one of:
X
X make makefile.msc
X make -fmakefile.bor
X
X for Microsoft or Borland C++, respectively. For Turbo C 2.0,
X use the configuration file tcconfig.tc, the batch file
X doturboc.bat and the project files zip.prj, zipnote.prj
X and zipsplit.prj. Make sure to use the compact model.
X
X Under OS/2:
X
X nmake -f makefile.os2
X
X for Microsoft C 6.00. Under VAX VMS:
X
X @make_vaxc
X or: @make_gcc
X
X For command help on any of the zip* utilities, simply enter
X the name with no arguments.
END_OF_FILE
if test 4088 -ne `wc -c <'install.doc'`; then
echo shar: \"'install.doc'\" unpacked with wrong size!
fi
# end of 'install.doc'
fi
if test -f 'match.s' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'match.s'\"
else
echo shar: Extracting \"'match.s'\" \(5410 characters\)
sed "s/^X//" >'match.s' <<'END_OF_FILE'
X/
X/ Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X/ Kai Uwe Rommel and Igor Mandrichenko.
X/ Permission is granted to any individual or institution to use, copy, or
X/ redistribute this software so long as all of the original files are included
X/ unmodified, that it is not sold for profit, and that this copyright notice
X/ is retained.
X/
X/ match.s by Jean-loup Gailly. Translated to 32 bit code by Kai Uwe Rommel.
X
X/ match.s, optimized version of longest_match() in deflate.c
X/ This version is for 386 Unix or OS/2 in 32 bit mode.
X/ Warning: it uses the AT&T syntax: mov source,dest
X/ This file is only optional. If you want to force the C version,
X/ add -DNO_ASM to CFLAGS in makefile and remove match.o from OBJI).
X/ If you have reduced WSIZE in zip.h, then change its value below.
X/ This version assumes static allocation of the arrays (-DDYN_ALLOC not used).
X
X .file "match.s"
X
X#if defined(__GO32__) && defined(unix)
X# undef unix
X#endif
X
X#ifdef unix
X# define _prev prev
X# define _window window
X# define _match_start match_start
X# define _prev_length prev_length
X# define _good_match good_match
X# define _strstart strstart
X# define _max_chain_length max_chain_length
X
X# define _match_init match_init
X# define _longest_match longest_match
X#endif
X
X#define MAX_MATCH 258
X#define MAX_MATCH2 128 /* MAX_MATCH/2-1 */
X#define MIN_MATCH 3
X#define WSIZE 32768
X#define MAX_DIST WSIZE - MAX_MATCH - MIN_MATCH - 1
X
X .globl _match_init
X .globl _longest_match
X
X .text
X
X_match_init:
X ret
X
X/ -----------------------------------------------------------------------
X/ Set match_start to the longest match starting at the given string and
X/ return its length. Matches shorter or equal to prev_length are discarded,
X/ in which case the result is equal to prev_length and match_start is
X/ garbage.
X/ IN assertions: cur_match is the head of the hash chain for the current
X/ string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
X
X_longest_match: /* int longest_match(cur_match) */
X
X#define cur_match 20(%esp)
X / return address / esp+16
X push %ebp / esp+12
X push %edi / esp+8
X push %esi / esp+4
X push %ebx / esp
X
X/ match equ esi
X/ scan equ edi
X/ chain_length equ ebp
X/ best_len equ ebx
X/ limit equ edx
X
X mov cur_match,%esi
X mov _max_chain_length,%ebp / chain_length = max_chain_length
X mov _strstart,%edi
X mov %edi,%edx
X sub $ MAX_DIST,%edx / limit = strstart-MAX_DIST
X jae limit_ok
X sub %edx,%edx / limit = NIL
Xlimit_ok:
X add $_window+2,%edi / edi = offset(window + strstart + 2)
X mov _prev_length,%ebx / best_len = prev_length
X movw -3(%ebx,%edi),%ax / ax = scan[best_len-1..best_len]
X movw -2(%edi),%cx / cx = scan[0..1]
X cmp _good_match,%ebx / do we have a good match already?
X jb do_scan
X shr $2,%ebp / chain_length >>= 2
X jmp do_scan
X
X .align 4
Xlong_loop:
X/ at this point, edi == scan+2, esi == cur_match
X movw -3(%ebx,%edi),%ax / ax = scan[best_len-1..best_len]
X movw -2(%edi),%cx / cx = scan[0..1]
Xshort_loop:
X dec %ebp / --chain_length
X jz the_end
X/ at this point, di == scan+2, si == cur_match,
X/ ax = scan[best_len-1..best_len] and cx = scan[0..1]
X and $ WSIZE-1, %esi
X movw _prev(%esi,%esi),%si / cur_match = prev[cur_match]
X / top word of esi is still 0
X cmp %edx,%esi / cur_match <= limit ?
X jbe the_end
Xdo_scan:
X cmpw _window-1(%ebx,%esi),%ax /check match at best_len-1
X jne short_loop
X cmpw _window(%esi),%cx / check min_match_length match
X jne short_loop
X
X lea _window+2(%esi),%esi / si = match
X mov %edi,%eax / ax = scan+2
X mov $ MAX_MATCH2,%ecx / scan for at most MAX_MATCH bytes
X#ifdef unix
X repz; cmpsw / loop until mismatch
X#else
X repe; cmpsw
X#endif
X je maxmatch / match of length MAX_MATCH?
Xmismatch:
X movb -2(%edi),%cl / mismatch on first or second byte?
X subb -2(%esi),%cl / cl = 0 if first bytes equal
X xchg %edi,%eax / edi = scan+2, eax = end of scan
X sub %edi,%eax / eax = len
X sub %eax,%esi / esi = cur_match + 2 + offset(window)
X sub $_window+2,%esi / esi = cur_match
X subb $1,%cl / set carry if cl == 0 (cannot use DEC)
X adc $0,%eax / eax = carry ? len+1 : len
X cmp %ebx,%eax / len > best_len ?
X jle long_loop
X mov %esi,_match_start / match_start = cur_match
X mov %eax,%ebx / ebx = best_len = len
X cmp $ MAX_MATCH,%eax / len >= MAX_MATCH ?
X jl long_loop
Xthe_end:
X mov %ebx,%eax / result = eax = best_len
X pop %ebx
X pop %esi
X pop %edi
X pop %ebp
X ret
Xmaxmatch:
X cmpsb
X jmp mismatch
END_OF_FILE
if test 5410 -ne `wc -c <'match.s'`; then
echo shar: \"'match.s'\" unpacked with wrong size!
fi
# end of 'match.s'
fi
if test -f 'mktime.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mktime.c'\"
else
echo shar: Extracting \"'mktime.c'\" \(3614 characters\)
sed "s/^X//" >'mktime.c' <<'END_OF_FILE'
X/* free mktime function
X Copyright 1988, 1989 by David MacKenzie <d...@ai.mit.edu>
X and Michael Haertel <mi...@ai.mit.edu>
X Unlimited distribution permitted provided this copyright notice is
X retained and any functional modifications are prominently identified. */
X
X/* Note: This version of mktime is ignorant of the tzfile; it does not
X return correct results during the few hours around when daylight savings
X time goes in to or out of effect. It also does not allow or adjust
X for invalid values in any of the fields, contrary to the ANSI C
X specification. */
X
X#ifdef MKTIME_MISSING
X#include <sys/types.h>
X#include <time.h>
X
Xtime_t mkgmtime ();
X
X/* Return the equivalent in seconds past 12:00:00 a.m. Jan 1, 1970 GMT
X of the local time and date in the exploded time structure `tm',
X and set `tm->tm_yday', `tm->tm_wday', and `tm->tm_isdst'.
X Return -1 if any of the other fields in `tm' has an invalid value. */
X
Xtime_t
Xmktime (tm)
X struct tm *tm;
X{
X struct tm save_tm; /* Copy of contents of `*tm'. */
X struct tm *ltm; /* Local time. */
X time_t then; /* The time to return. */
X
X then = mkgmtime (tm);
X if (then == -1)
X return -1;
X
X /* In case `tm' points to the static area used by localtime,
X save its contents and restore them later. */
X save_tm = *tm;
X /* Correct for the timezone and any daylight savings time.
X If a change to or from daylight savings time occurs between when
X it is the time in `tm' locally and when it is that time in Greenwich,
X the change to or from dst is ignored, but that is a rare case. */
X then += then - mkgmtime (localtime (&then));
X
X ltm = localtime (&then);
X save_tm.tm_yday = ltm->tm_yday;
X save_tm.tm_wday = ltm->tm_wday;
X save_tm.tm_isdst = ltm->tm_isdst;
X *tm = save_tm;
X
X return then;
X}
X
X/* Nonzero if `y' is a leap year, else zero. */
X#define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0)
X
X/* Number of leap years from 1970 to `y' (not including `y' itself). */
X#define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400)
X
X/* Number of days in each month of the year. */
Xstatic char monlens[] =
X{
X 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
X};
X
X/* Return the equivalent in seconds past 12:00:00 a.m. Jan 1, 1970 GMT
X of the Greenwich Mean time and date in the exploded time structure `tm',
X and set `tm->tm_yday', `tm->tm_wday', and `tm->tm_isdst'.
X Return -1 if any of the other fields in `tm' has an invalid value. */
X
Xtime_t
Xmkgmtime (tm)
X struct tm *tm;
X{
X int years, months, days, hours, minutes, seconds;
X
X years = tm->tm_year + 1900; /* year - 1900 -> year */
X months = tm->tm_mon; /* 0..11 */
X days = tm->tm_mday - 1; /* 1..31 -> 0..30 */
X hours = tm->tm_hour; /* 0..23 */
X minutes = tm->tm_min; /* 0..59 */
X seconds = tm->tm_sec; /* 0..61 in ANSI C. */
X
X if (years < 1970
X || months < 0 || months > 11
X || days < 0
X || days > monlens[months] + (months == 1 && leap (years)) - 1
X || hours < 0 || hours > 23
X || minutes < 0 || minutes > 59
X || seconds < 0 || seconds > 61)
X return -1;
X
X /* Set `days' to the number of days into the year. */
X if (months > 1 && leap (years))
X ++days;
X while (months-- > 0)
X days += monlens[months];
X tm->tm_yday = days;
X
X /* Now set `days' to the number of days since Jan 1, 1970. */
X days += 365 * (years - 1970) + nleap (years);
X tm->tm_wday = (days + 4) % 7; /* Jan 1, 1970 was Thursday. */
X tm->tm_isdst = 0;
X
X return 86400 * days + 3600 * hours + 60 * minutes + seconds;
X}
X#endif
END_OF_FILE
if test 3614 -ne `wc -c <'mktime.c'`; then
echo shar: \"'mktime.c'\" unpacked with wrong size!
fi
# end of 'mktime.c'
fi
if test -f 'msdos/doturboc.bat.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/doturboc.bat.UU'\"
else
echo shar: Extracting \"'msdos/doturboc.bat.UU'\" \(669 characters\)
sed "s/^X//" >'msdos/doturboc.bat.UU' <<'END_OF_FILE'
Xbegin 666 msdos/doturboc.bat
XM.B!4:&ES(&9I;&4@:7,@82!C;VUP;&5M96YT('1O('II<"YP<FH@9F]R(%1U
XM<F)O($,@,BXP('5S97)S+@T*.B!#:&%N9V4@=&AE(&-O;7!I;&%T:6]N(&9L
XM86=S(&EF('EO=2!W:7-H("AA9&0@4TU!3$Q?345-(&]R($U%1$E535]-14T-
XM"CH@=&\@<F5D=6-E('1H92!M96UO<GD@<F5Q=6ER96UE;G1S*2P@86YD('!R
XM97-S($8Y+BXN#0HZ(%=!4DY)3D<Z('EO=2!M=7-T('5S92!T:&4@8V]M<&%C
XM="!O<B!L87)G92!M;V1E;"!I;B!T:&ES('9E<G-I;VXN#0H-"G1A<VT@+6UL
XM("U$1%E.7T%,3$]#("U$4U-?3D517T13(&UA=&-H.PT*#0HZ(%1O(&-O;7!I
XM;&4@>FEP<W!L:70@86YD('II<&YO=&4L(&1E;&5T92!A;&P@+F]B:B!F:6QE
XM<RP@861D('1H92!C;VUP:6QA=&EO;@T*.B!F;&%G(%5424PL(&%N9"!U<V4@
XM>FEP<W!L:70N<')J(&]R('II<&YO=&4N<')J('1O(')E8V]M<&EL92!E=F5R
X)>71H:6YG+@T*
X
Xend
END_OF_FILE
if test 669 -ne `wc -c <'msdos/doturboc.bat.UU'`; then
echo shar: \"'msdos/doturboc.bat.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/doturboc.bat'\" \(459 characters\)
cat msdos/doturboc.bat.UU | uudecode
if test 459 -ne `wc -c <'msdos/doturboc.bat'`; then
echo shar: \"'msdos/doturboc.bat'\" uudecoded with wrong size!
else
rm msdos/doturboc.bat.UU
fi
fi
# end of 'msdos/doturboc.bat.UU'
fi
if test -f 'msdos/makefile.bor.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/makefile.bor.UU'\"
else
echo shar: Extracting \"'msdos/makefile.bor.UU'\" \(5393 characters\)
sed "s/^X//" >'msdos/makefile.bor.UU' <<'END_OF_FILE'
Xbegin 666 msdos/makefile.bor


XM(R!-86ME9FEL92!F;W(@6FEP+"!::7!#;&]A:RP@6FEP3F]T92!A;F0@6FEP

XM4W!L:70@9F]R#0HC($)O<FQA;F0@*%1U<F)O*2!#*RL@,2XP(&]R(#(N,"X-
XM"B,@5V%R;FEN9SH@=&AI<R!F:6QE(&ES(&YO="!S=6ET86)L92!F;W(@5'5R
XM8F\@0R R+C N(%5S92!Z:7 N<')J(&EN<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XM:6X@=&AE($U3+T1/4R Q,C@@8GET92!L:6UI=#H-"GII<"YE>&4Z("0H3T)*
XM6BD@)"A/0DI)*0T*"65C:&\@)"A/0DI:*2 ^('II<"YR<W -"@EE8VAO("0H
XM3T)*22D@/CX@>FEP+G)S< T*"20H3$0I("0H3$1&3$%'4RD@0'II<"YR<W -
XM"@ED96P@>FEP+G)S< T*"20H4U1225 I('II<"YE>&4-"@T*>FEP8VQO86LN
XM97AE.B D*$]"2D,I#0H)96-H;R D*$]"2D,I(#X@>FEP8RYR<W -"@DD*$Q$
XM*2 D*$Q$1DQ!1U,I($!Z:7!C+G)S< T*"61E;"!Z:7!C+G)S< T*"20H4U12
XM25 I('II<&-L;V%K+F5X90T*#0IZ:7!N;W1E+F5X93H@)"A/0DI.*0T*"65C
XM:&\@)"A/0DI.*2 ^('II<&XN<G-P#0H))"A,1"D@)"A,1$9,04=3*2! >FEP
XM;BYR<W -"@ED96P@>FEP;BYR<W -"@DD*%-44DE0*2!Z:7!N;W1E+F5X90T*
XM#0IZ:7!S<&QI="YE>&4Z("0H3T)*4RD-"@EE8VAO("0H3T)*4RD@/B!Z:7!S
XM+G)S< T*"20H3$0I("0H3$1&3$%'4RD@0'II<',N<G-P#0H)9&5L('II<',N
XM<G-P#0H))"A35%))4"D@>FEP<W!L:70N97AE#0H-"FEN<W1A;&PZ"20H6DE0
XM4RD-"@EC;W!Y("]B("HN97AE("0H0DE.*0T*#0IC;&5A;CH-"@ED96P@*BYO
X08FH-"@ED96P@*BYE>&4-"GAE
X
Xend
END_OF_FILE
if test 5393 -ne `wc -c <'msdos/makefile.bor.UU'`; then
echo shar: \"'msdos/makefile.bor.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/makefile.bor'\" \(3886 characters\)
cat msdos/makefile.bor.UU | uudecode
if test 3886 -ne `wc -c <'msdos/makefile.bor'`; then
echo shar: \"'msdos/makefile.bor'\" uudecoded with wrong size!
else
rm msdos/makefile.bor.UU
fi
fi
# end of 'msdos/makefile.bor.UU'
fi
if test -f 'nt/makefile.nt.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'nt/makefile.nt.UU'\"
else
echo shar: Extracting \"'nt/makefile.nt.UU'\" \(2631 characters\)
sed "s/^X//" >'nt/makefile.nt.UU' <<'END_OF_FILE'
Xbegin 666 nt/makefile.nt
XM(R!.34%+12!-86ME9FEL90T*(R!$+D9E:6YL96EB(#<O.3(@="UD879E9F5
XM;6EC<F]S;V9T+F-O;0T*(R!7:6YD;W=S($Y4#0H-"B,@3FUA:V4@;6%C<F]S
XM(&9O<B!B=6EL9&EN9R!7:6YD;W=S($Y4(&%P<&QI8V%T:6]N<PT*(6EN8VQU
XM9&4@/&YT=VEN,S(N;6%K/@T*#0I04D]*/7II< T*3T)*/4))5%,N;V)J($-2
XM65!4+F]B:B!$149,051%+F]B:B!&24Q%24\N;V)J($=,3T)!3%,N;V)J($U+
XM5$E-12YO8FH@5%)%15,N;V)J(%5424PN;V)J(%I)4"YO8FH@6DE01DE,12YO
XM8FH@6DE055 N;V)J#0I,24)303UC;VUD;&<S,BYL:6(@9V1I,S(N;&EB(&ME
XM<FYE;#,R+FQI8B!L:6)C+FQI8B!L:6)C>#,R+FQI8B!L>C,R+FQI8B!M<'(N
XM;&EB(&YE=&%P:3,R+FQI8B!N=&1L;"YL:6(@#0I,24)30CUW:6YS=')M+FQI
XM8B!R<&-N9'(N;&EB(')P8VYS-"YL:6(@<G!C<G0T+FQI8B!S:&5L;#,R+FQI
XM8B!U<V5R,S(N;&EB('5S97)R=&PN;&EB#0I,24)3/20H3$E"4T$I("0H3$E"
XM4T(I#0IC=F%R<STD*&-V87)S*2 M1$U31$]3("U$0U)94%0@+41.3U]!4TT-
XM"@T*86QL(#H@>FEP+F5X90T*#0I"2513+F]B:B Z($))5%,N8PT*(" @("0H
XM8V,I("0H8V9L86=S*2 D*&-V87)S*2!"2513+F,-"B @(" D*&-V=&]B:BD@
XM0DE44RYO8FH-"@T*0U)94%0N;V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12YO8FH@.B!:25!&24Q%+F,-"B @(" D*&-C*2 D*&-F;&%G<RD@
XM)"AC=F%R<RD@6DE01DE,12YC#0H@(" @)"AC=G1O8FHI(%I)4$9)3$4N;V)J
XM#0H-"EI)4$Y/5$4N;V)J(#H@6DE03D]412YC#0H@(" @)"AC8RD@)"AC9FQA
XM9W,I("0H8W9A<G,I(%I)4$Y/5$4N8PT*(" @("0H8W9T;V)J*2!:25!.3U1%
XM+F]B:@T*#0I:25!34$Q)5"YO8FH@.B!:25!34$Q)5"YC#0H@(" @)"AC8RD@
XM)"AC9FQA9W,I("0H8W9A<G,I(%I)4%-03$E4+F,-"B @(" D*&-V=&]B:BD@
XM6DE04U!,250N;V)J#0H-"EI)4%50+F]B:B Z(%I)4%50+F,-"B @(" D*&-C
XM*2 D*&-F;&%G<RD@)"AC=F%R<RD@6DE055 N8PT*(" @("0H8W9T;V)J*2!:
XM25!54"YO8FH-"@T*>FEP+F5X92 Z("0H3T)**0T*(" @("0H;&EN:RD@)"AC
XJ;VYF;&%G<RD@+6]U=#HD*%!23THI+F5X92 D*$]"2BD@)"A,24)3*0T*
X
Xend
END_OF_FILE
if test 2631 -ne `wc -c <'nt/makefile.nt.UU'`; then
echo shar: \"'nt/makefile.nt.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'nt/makefile.nt'\" \(1887 characters\)
cat nt/makefile.nt.UU | uudecode
if test 1887 -ne `wc -c <'nt/makefile.nt'`; then
echo shar: \"'nt/makefile.nt'\" uudecoded with wrong size!
else
rm nt/makefile.nt.UU
fi
fi
# end of 'nt/makefile.nt.UU'
fi
if test -f 'os2/os2zip.h.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'os2/os2zip.h.UU'\"
else
echo shar: Extracting \"'os2/os2zip.h.UU'\" \(3399 characters\)
sed "s/^X//" >'os2/os2zip.h.UU' <<'END_OF_FILE'
Xbegin 666 os2/os2zip.h
XM+RH-"B J($ H(RD@9&ER+F@@,2XT(#@W+S$Q+S V(" @4'5B;&EC($1O;6%I
XM;BX-"B J#0H@*B @02!P=6)L:6,@9&]M86EN(&EM<&QE;65N=&%T:6]N(&]F
XM($)31"!D:7)E8W1O<GD@<F]U=&EN97,@9F]R#0H@*B @35,M1$]3+B @5W)I
XM='1E;B!B>2!-:6-H865L(%)E;F1E;&P@*'MU=6YE="QU=&%I?6UI8VAA96Q
XM9V%R9FEE;&0I+ T*("H@($%U9W5S=" Q.3@W#0H@*@T*("H@($5N:&%N8V5D
XM(&%N9"!P;W)T960@=&\@3U,O,B!B>2!+86D@57=E(%)O;6UE;#L@861D960@
XM<V-A;F1I<B@I('!R;W1O='EP90T*("H@($1E8V5M8F5R(#$Y.#DL($9E8G)U
XM87)Y(#$Y.3 -"B J("!#:&%N9V4@;V8@34%84$%42$Q%3B!F;W(@2%!&4RP@
XM3V-T;V)E<B Q.3DP#0H@*B\-"@T*#0HC9&5F:6YE($U!6$Y!34Q%3B @,C4V
XM#0HC9&5F:6YE($U!6%!!5$A,14X@,C4V#0H-"B-D969I;F4@05]23TY,62 @
XM(" P># Q#0HC9&5F:6YE($%?2$E$1$5.(" @,'@P,@T*(V1E9FEN92!!7U-9
XM4U1%32 @(#!X,#0-"B-D969I;F4@05],04)%3" @(" P># X#0HC9&5F:6YE
XM($%?1$E2(" @(" @,'@Q, T*(V1E9FEN92!!7T%20TA)5D4@(#!X,C -"@T*
XM#0IS=')U8W0@9&ER96-T#0I[#0H@(&EN;U]T(" @(&1?:6YO.R @(" @(" @
XM(" @(" @(" @(" O*B!A(&)I="!O9B!A(&9A<F-E("HO#0H@(&EN=" @(" @
XM(&1?<F5C;&5N.R @(" @(" @(" @(" @(" O*B!M;W)E(&9A<F-E("HO#0H@
XM(&EN=" @(" @(&1?;F%M;&5N.R @(" @(" @(" @(" @(" O*B!L96YG=&@@
XM;V8@9%]N86UE("HO#0H@(&-H87(@(" @(&1?;F%M95M-05A.04U,14X@*R Q
XM73L@(" O*B!N=6QL('1E<FUI;F%T960@*B\-"B @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-97(H8VAA<B J*3L-"F=N
X
Xend
END_OF_FILE
if test 3399 -ne `wc -c <'os2/os2zip.h.UU'`; then
echo shar: \"'os2/os2zip.h.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'os2/os2zip.h'\" \(2443 characters\)
cat os2/os2zip.h.UU | uudecode
if test 2443 -ne `wc -c <'os2/os2zip.h'`; then
echo shar: \"'os2/os2zip.h'\" uudecoded with wrong size!
else
rm os2/os2zip.h.UU
fi
fi
# end of 'os2/os2zip.h.UU'
fi
if test -f 'ziperr.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ziperr.h'\"
else
echo shar: Extracting \"'ziperr.h'\" \(2586 characters\)
sed "s/^X//" >'ziperr.h' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.


X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included

X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * ziperr.h by Mark Adler.
X */
X
X/* Error return values. The values 0..4 and 12..18 follow the conventions
X of PKZIP. The values 4..10 are all assigned to "insufficient memory"
X by PKZIP, so the codes 5..10 are used here for other purposes. */
X#define ZE_MISS -1 /* used by procname(), zipbare() */
X#define ZE_OK 0 /* success */
X#define ZE_EOF 2 /* unexpected end of zip file */
X#define ZE_FORM 3 /* zip file structure error */
X#define ZE_MEM 4 /* out of memory */
X#define ZE_LOGIC 5 /* internal logic error */
X#define ZE_BIG 6 /* entry too large to split */
X#define ZE_NOTE 7 /* invalid comment format */
X#define ZE_ABORT 9 /* user interrupt or termination */
X#define ZE_TEMP 10 /* error using a temp file */
X#define ZE_READ 11 /* read or seek error */
X#define ZE_NONE 12 /* nothing to do */
X#define ZE_NAME 13 /* missing or empty zip file */
X#define ZE_WRITE 14 /* error writing to a file */
X#define ZE_CREAT 15 /* couldn't open to write */
X#define ZE_PARMS 16 /* bad command line */
X#define ZE_OPEN 18 /* could not open a specified file to read */
X/* Macro to determine whether to call perror() or not */
X#define PERR(e) (e==ZE_READ||e==ZE_WRITE||e==ZE_CREAT||e==ZE_TEMP||e==ZE_OPEN)
X
X#ifdef GLOBALS
X/* Error messages for the err() function in the zip programs */
Xchar *errors[] = {
X/* 1 */ "",
X/* 2 */ "Unexpected end of zip file",
X/* 3 */ "Zip file structure invalid",
X/* 4 */ "Out of memory",
X/* 5 */ "Internal logic error",
X/* 6 */ "Entry too big to split",
X/* 7 */ "Invalid comment format",
X/* 8 */ "",
X/* 9 */ "Interrupted",
X/* 10 */ "Temporary file failure",
X/* 11 */ "Input file read failure",
X/* 12 */ "Nothing to do!",
X/* 13 */ "Missing or empty zip file",
X/* 14 */ "Output file write failure",
X/* 15 */ "Could not create output file",
X/* 16 */ "Invalid command arguments",
X/* 17 */ "",
X/* 18 */ "File not found or no read permission",
X};
X#else /* !GLOBALS */
Xextern char *errors[]; /* Error messages for err() */
X#endif /* ?GLOBALS */
END_OF_FILE
if test 2586 -ne `wc -c <'ziperr.h'`; then
echo shar: \"'ziperr.h'\" unpacked with wrong size!
fi
# end of 'ziperr.h'
fi
echo shar: End of archive 10 \(of 11\).
cp /dev/null ark10isdone

Info-ZIP group

unread,
Aug 23, 1992, 2:50:39 AM8/23/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 103
Archive-name: zip19/part11

Supersedes: zip: Volume 23, Issue 88-96
Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sou...@uunet.uu.net if you want that tool.

# Contents: atari/stzip.prj atari/stzipn.lnk atari/stzips.lnk
# msdos/zip.prj.UU msdos/zipnote.prj.UU msdos/zipsplit.prj.U
# revision.h vms/descrip.mms vms/make_gcc.com vms/make_vaxc.com
# Wrapped by kent@sparky on Sun Aug 23 01:00:48 1992


PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 11 (of 11)."'
if test -f 'atari/stzip.prj' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/stzip.prj'\"
else
echo shar: Extracting \"'atari/stzip.prj'\" \(482 characters\)
sed "s/^X//" >'atari/stzip.prj' <<'END_OF_FILE'
XZIP.PRG
X.C[-DEXPORT]
X=
X
Xc0.o
Xzip.c (zip.h, ziperr.h, tailor.h, revision.h)
Xtcstdlib.lib
Xatari.c
Xzipfile.c (zip.h, ziperr.h, tailor.h)
Xzipup.c (zip.h, ziperr.h, tailor.h, revision.h)
Xfileio.c (zip.h, ziperr.h, tailor.h)
Xutil.c (zip.h, ziperr.h, tailor.h)
Xglobals.c (zip.h, ziperr.h, tailor.h)
Xdeflate.c (zip.h, ziperr.h, tailor.h)
Xtrees.c (zip.h, ziperr.h, tailor.h)
Xbits.c (zip.h, ziperr.h, tailor.h)
Xtcstdlib.lib
Xtcextlib.lib
Xtctoslib.lib
END_OF_FILE
if test 482 -ne `wc -c <'atari/stzip.prj'`; then
echo shar: \"'atari/stzip.prj'\" unpacked with wrong size!
fi
# end of 'atari/stzip.prj'
fi
if test -f 'atari/stzipn.lnk' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/stzipn.lnk'\"
else
echo shar: Extracting \"'atari/stzipn.lnk'\" \(134 characters\)
sed "s/^X//" >'atari/stzipn.lnk' <<'END_OF_FILE'
X\TC\lib\c0.o
Xatari.o
Xzipnote.o
Xzipfile_.o
Xzipup_.o
Xfileio_.o
Xglobals.o


X\TC\lib\tcstdlib.lib
X\TC\lib\tcextlib.lib
X\TC\lib\tctoslib.lib
END_OF_FILE

if test 134 -ne `wc -c <'atari/stzipn.lnk'`; then
echo shar: \"'atari/stzipn.lnk'\" unpacked with wrong size!
fi
# end of 'atari/stzipn.lnk'
fi
if test -f 'atari/stzips.lnk' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atari/stzips.lnk'\"
else
echo shar: Extracting \"'atari/stzips.lnk'\" \(135 characters\)
sed "s/^X//" >'atari/stzips.lnk' <<'END_OF_FILE'
X\TC\lib\c0.o
Xatari.o
Xzipsplit.o
Xzipfile_.o
Xzipup_.o
Xfileio_.o
Xglobals.o


X\TC\lib\tcstdlib.lib
X\TC\lib\tcextlib.lib
X\TC\lib\tctoslib.lib
END_OF_FILE

if test 135 -ne `wc -c <'atari/stzips.lnk'`; then
echo shar: \"'atari/stzips.lnk'\" unpacked with wrong size!
fi
# end of 'atari/stzips.lnk'
fi
if test -f 'msdos/zip.prj.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/zip.prj.UU'\"
else
echo shar: Extracting \"'msdos/zip.prj.UU'\" \(572 characters\)
sed "s/^X//" >'msdos/zip.prj.UU' <<'END_OF_FILE'
Xbegin 666 msdos/zip.prj
XM>FEP+F,@(" @(" @("AZ:7 N:"!Z:7!E<G(N:"!T86EL;W(N:"!R979I<VEO
XM;BYH*0T*>FEP9FEL92YC(" @("AZ:7 N:"!Z:7!E<G(N:"!T86EL;W(N:"D-
XM"GII<'5P+F,@(" @(" H>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@@<F5V:7-I
XM;VXN:"D-"F9I;&5I;RYC(" @(" H>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@I
XM#0IU=&EL+F,@(" @(" @*'II<"YH('II<&5R<BYH('1A:6QO<BYH*0T*9VQO
XM8F%L<RYC(" @("AZ:7 N:"!Z:7!E<G(N:"!T86EL;W(N:"D-"F1E9FQA=&4N
XM8R @(" H>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@I#0IB:71S+F,@(" @(" @
XM*'II<"YH('II<&5R<BYH('1A:6QO<BYH*0T*=')E97,N8R @(" @("AZ:7 N
XA:"!Z:7!E<G(N:"!T86EL;W(N:"D-"FUA=&-H+F]B:@T*
X
Xend
END_OF_FILE
if test 572 -ne `wc -c <'msdos/zip.prj.UU'`; then
echo shar: \"'msdos/zip.prj.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/zip.prj'\" \(393 characters\)
cat msdos/zip.prj.UU | uudecode
if test 393 -ne `wc -c <'msdos/zip.prj'`; then
echo shar: \"'msdos/zip.prj'\" uudecoded with wrong size!
else
rm msdos/zip.prj.UU
fi
fi
# end of 'msdos/zip.prj.UU'
fi
if test -f 'msdos/zipnote.prj.UU' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/zipnote.prj.UU'\"
else
echo shar: Extracting \"'msdos/zipnote.prj.UU'\" \(336 characters\)
sed "s/^X//" >'msdos/zipnote.prj.UU' <<'END_OF_FILE'
Xbegin 666 msdos/zipnote.prj
XM>FEP;F]T92YC"2AZ:7 N:"!Z:7!E<G(N:"!T86EL;W(N:"D-"GII<&9I;&4N
XM8PDH>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@I#0IZ:7!U<"YC"0DH>FEP+F@@
XM>FEP97)R+F@@=&%I;&]R+F@I#0IF:6QE:6\N8PDH>FEP+F@@>FEP97)R+F@@
XM=&%I;&]R+F@I#0IG;&]B86QS+F,)*'II<"YH('II<&5R<BYH('1A:6QO<BYH
XF*0T*=71I;"YC"0DH>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@I#0IA
X
Xend
END_OF_FILE
if test 336 -ne `wc -c <'msdos/zipnote.prj.UU'`; then
echo shar: \"'msdos/zipnote.prj.UU'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/zipnote.prj'\" \(218 characters\)
cat msdos/zipnote.prj.UU | uudecode
if test 218 -ne `wc -c <'msdos/zipnote.prj'`; then
echo shar: \"'msdos/zipnote.prj'\" uudecoded with wrong size!
else
rm msdos/zipnote.prj.UU
fi
fi
# end of 'msdos/zipnote.prj.UU'
fi
if test -f 'msdos/zipsplit.prj.U' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'msdos/zipsplit.prj.U'\"
else
echo shar: Extracting \"'msdos/zipsplit.prj.U'\" \(337 characters\)
sed "s/^X//" >'msdos/zipsplit.prj.U' <<'END_OF_FILE'
Xbegin 666 msdos/zipsplit.prj
XM>FEP<W!L:70N8PDH>FEP+F@@>FEP97)R+F@@=&%I;&]R+F@I#0IZ:7!F:6QE
XM+F,)*'II<"YH('II<&5R<BYH('1A:6QO<BYH*0T*>FEP=7 N8PD)*'II<"YH
XM('II<&5R<BYH('1A:6QO<BYH*0T*9FEL96EO+F,)*'II<"YH('II<&5R<BYH
XM('1A:6QO<BYH*0T*9VQO8F%L<RYC"2AZ:7 N:"!Z:7!E<G(N:"!T86EL;W(N
XG:"D-"G5T:6PN8PD)*'II<"YH('II<&5R<BYH('1A:6QO<BYH*0T*
X
Xend
END_OF_FILE
if test 337 -ne `wc -c <'msdos/zipsplit.prj.U'`; then
echo shar: \"'msdos/zipsplit.prj.U'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'msdos/zipsplit.prj'\" \(219 characters\)
cat msdos/zipsplit.prj.U | uudecode
if test 219 -ne `wc -c <'msdos/zipsplit.prj'`; then
echo shar: \"'msdos/zipsplit.prj'\" uudecoded with wrong size!
else
rm msdos/zipsplit.prj.U
fi
fi
# end of 'msdos/zipsplit.prj.U'
fi
if test -f 'revision.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'revision.h'\"
else
echo shar: Extracting \"'revision.h'\" \(1470 characters\)
sed "s/^X//" >'revision.h' <<'END_OF_FILE'


X/*
X
X Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
X Kai Uwe Rommel and Igor Mandrichenko.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*

X * revision.h by Mark Adler.
X */
X
X#define REVISION 19
X#define REVDATE "Aug 20th 1992"
X
X/* Copyright notice for binary executables--this notice only applies to
X * those (zip, zipcloak, zipsplit, and zipnote), not to this file
X * (revision.h).
X */
X
X#ifndef NOCPYRT
Xchar *copyright[] = {
X#ifdef VMS
X"Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,",
X"Kai Uwe Rommel and Igor Mandrichenko. Type '%s -L' for the software license.",
X#else


X"Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly",

X"and Kai Uwe Rommel. Type '%s -L' for the software License.",
X#endif
X};
Xchar *disclaimer[] = {
X"",
X"Permission is granted to any individual or institution to use, copy, or",
X"redistribute this executable so long as it is not modified and that it is",
X"not sold for profit.",
X"",
X"LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE",
X"PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR",
X"IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES",
X"RESULTING FROM THE USE OF THIS SOFTWARE."
X};
X#endif /* !NOCPYRT */
END_OF_FILE
if test 1470 -ne `wc -c <'revision.h'`; then
echo shar: \"'revision.h'\" unpacked with wrong size!
fi
# end of 'revision.h'
fi
if test -f 'vms/descrip.mms' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/descrip.mms'\"
else
echo shar: Extracting \"'vms/descrip.mms'\" \(1449 characters\)
sed "s/^X//" >'vms/descrip.mms' <<'END_OF_FILE'
X# VMS Makefile for Zip, ZipNote and ZipSplit
X
XCDEB = ! /DEBUG/NOOPT
XLDEB = ! /DEBUG
X
XOBJZ = zip.obj,zipfile.obj,zipup.obj,fileio.obj,util.obj,globals.obj,-
X crypt.obj,vms.obj,VMSmunch.obj
XOBJI = deflate.obj,trees.obj,bits.obj
XOBJN = zipnote.obj,zipfile.obj_,zipup.obj_,fileio.obj_,globals.obj,-
X util_.obj_,vmsmunch.obj
XOBJS = zipsplit.obj,zipfile.obj_,zipup.obj_,fileio.obj_,globals.obj,-
X util_.obj_,vmsmunch.obj
XOBJC = zipcloak.obj,zipfile.obj_,zipup.obj_,fileio.OBJ_,util_.obj,-
X crypt.obj_,globals.obj,vmsmunch.obj
X
XCC = cc $(CDEB)
X
XLINK = link $(LDEB)
X
X.suffixes
X.suffixes : .obj .obj_ .c .exe
X
X.c.obj_ :
X $(CC)/define=("UTIL")/OBJ=$(mms$target) $(mms$source)
X.c.obj :
X $(cc)/OBJ=$(mms$target) $(mms$source)
X.obj.exe :
X $(LINK)/exe=$(mms$target) vaxclib.opt/opt,$(mms$source)
X
X# rules for zip, zipnote, zipsplit, and zip.doc.
X
Xdefault : zip.exe,zipnote.exe,zipsplit.exe
X @ !
X
Xzipfile.obj_ : zipfile.c
Xzipup.obj_ : zipup.c
Xfileio.obj_ : fileio.c
Xutil.obj_ : util.c
X
X$(OBJZ) : zip.h,ziperr.h,tailor.h
X$(OBJI) : zip.h,ziperr.h,tailor.h
X$(OBJN) : zip.h,ziperr.h,tailor.h
X$(OBJS) : zip.h,ziperr.h,tailor.h
X
Xzip.obj,zipup.obj,zipnote.obj,zipsplit.obj : revision.h
X
Xzipfile.obj, fileio.obj, VMSmunch.obj : VMSmunch.h
X
Xzip.exe : $(OBJZ),$(OBJI)
X $(LINK)/exe=zip.exe vaxclib.opt/opt,$(OBJZ),$(OBJI)
X
Xzipnote.exe : $(OBJN)
X $(LINK)/exe=zipnote.exe vaxclib.opt/opt,$(OBJN)
X
Xzipsplit.exe : $(OBJS)
X $(LINK)/exe=zipsplit.exe vaxclib.opt/opt,$(OBJS)
END_OF_FILE
if test 1449 -ne `wc -c <'vms/descrip.mms'`; then
echo shar: \"'vms/descrip.mms'\" unpacked with wrong size!
fi
# end of 'vms/descrip.mms'
fi
if test -f 'vms/make_gcc.com' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/make_gcc.com'\"
else
echo shar: Extracting \"'vms/make_gcc.com'\" \(1677 characters\)
sed "s/^X//" >'vms/make_gcc.com' <<'END_OF_FILE'
X$ !
X$ ! "Makefile" for VMS versions of Zip, ZipCloak, ZipNote,
X$ ! and ZipSplit (stolen from Unzip)
X$ !
X$ ! IMPORTANT NOTE: do not forget to set the symbols as said below
X$ ! in the Symbols section.
X$ !
X$ set verify ! like "echo on", eh?
X$ !
X$ !------------------------------- Zip section --------------------------------
X$ !
X$ ! For crypt version, use version of make_gcc.com which in the zcrypt
X$ ! distribution.
X$ gcc zip
X$ gcc zipfile
X$ gcc zipup
X$ gcc fileio
X$ gcc util
X$ gcc deflate
X$ gcc globals
X$ gcc trees
X$ gcc bits
X$ gcc vms
X$ gcc VMSmunch
X$ link zip,zipfile,zipup,fileio,util,deflate,globals,trees,bits, -
X vms,VMSmunch, gnu_cc:[000000]gcclib.olb/lib, sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ !
X$ !-------------------------- Zip utilities section ---------------------------
X$ !
X$ gcc /def=UTIL zipnote
X$ gcc /def=UTIL zipsplit
X$ gcc /def=UTIL /obj=zipfile_.obj zipfile
X$ gcc /def=UTIL /obj=zipup_.obj zipup
X$ gcc /def=UTIL /obj=fileio_.obj fileio
X$ gcc /def=UTIL /obj=util_.obj util
X$ link zipnote, zipfile_, zipup_, fileio_, util_, globals, VMSmunch, -
X sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ link zipsplit, zipfile_, zipup_, fileio_, util_, globals, VMSmunch, -
X gnu_cc:[000000]gcclib.olb/lib, sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ !
X$ !----------------------------- Symbols section ------------------------------
X$ !
X$ ! Set up symbols for the various executables. Edit the example below,
X$ ! changing "disk:[directory]" as appropriate.
X$ !
X$ zip == "$disk:[directory]zip.exe"
X$ zipnote == "$disk:[directory]zipnote.exe"
X$ zipsplit == "$disk:[directory]zipsplit.exe"
X$ !
X$ set noverify
END_OF_FILE
if test 1677 -ne `wc -c <'vms/make_gcc.com'`; then
echo shar: \"'vms/make_gcc.com'\" unpacked with wrong size!
fi
# end of 'vms/make_gcc.com'
fi
if test -f 'vms/make_vaxc.com' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vms/make_vaxc.com'\"
else
echo shar: Extracting \"'vms/make_vaxc.com'\" \(1444 characters\)
sed "s/^X//" >'vms/make_vaxc.com' <<'END_OF_FILE'
X$ !
X$ ! "Makefile" for VMS versions of Zip, ZipNote,
X$ ! and ZipSplit (stolen from Unzip)
X$ !
X$ ! IMPORTANT NOTE: do not forget to set the symbols as said below
X$ ! in the Symbols section.
X$ !
X$ set verify ! like "echo on", eh?
X$ !
X$ !------------------------------- Zip section --------------------------------
X$ !
X$ cc zip, zipfile, zipup, fileio, util, deflate, globals,-
X trees, bits, vms, VMSmunch
X$ link zip, zipfile, zipup, fileio, util, deflate, globals,-
X trees, bits, vms, VMSmunch, sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ !
X$ !-------------------------- Zip utilities section ---------------------------
X$ !
X$ cc /def=UTIL /obj=zipfile_.obj zipfile.c
X$ cc /def=UTIL /obj=zipup_.obj zipup.c
X$ cc /def=UTIL /obj=fileio_.obj fileio.c
X$ cc /def=UTIL /obj=util_.obj util.c
X$ cc zipnote, zipsplit
X$ link zipnote, zipfile_, zipup_, fileio_, util_, globals, VMSmunch,-
X sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ link zipsplit, zipfile_, zipup_, fileio_, util_, globals, VMSmunch,-
X sys$input:/opt
Xsys$share:vaxcrtl.exe/shareable
X$ !
X$ !----------------------------- Symbols section ------------------------------
X$ !
X$ ! Set up symbols for the various executables. Edit the example below,
X$ ! changing "disk:[directory]" as appropriate.
X$ !
X$ zip == "$disk:[directory]zip.exe"
X$ zipnote == "$disk:[directory]zipnote.exe"
X$ zipsplit == "$disk:[directory]zipsplit.exe"
X$ !
X$ set noverify
END_OF_FILE
if test 1444 -ne `wc -c <'vms/make_vaxc.com'`; then
echo shar: \"'vms/make_vaxc.com'\" unpacked with wrong size!
fi
# end of 'vms/make_vaxc.com'
fi
echo shar: End of archive 11 \(of 11\).
cp /dev/null ark11isdone

Info-ZIP group

unread,
Sep 2, 1992, 3:52:52 PM9/2/92
to
Submitted-by: zip-...@cs.ucla.edu (Info-ZIP group)
Posting-number: Volume 31, Issue 133
Archive-name: zip19/patch01
Patch-To: zip19: Volume 31, Issue 93-103

Environment: UNIX, VMS, OS/2, MS-DOS, MACINTOSH, WIN-NT, LINUX, MINIX, XOS, !AMIGA, ATARI, symlink, SGI, DEC, Cray, Convex, Amdahl, Sun, PC

This is Patch01 to zip 1.9. The patches enclosed fix the main bugs reported
in zip 1.9:

- file truncation to zero bytes for some file names
- file truncation for large files with option -l
- possible removal of non empty directories with option -m when run as root

Other minor changes are documented in the file 'history'. These changes
constitute zip 1.9 patch level 1. The complete package is available by
anonymous ftp on garbo.uwasa.fi:/unix/arcers/zip19p1.zip or zip19p1.tar.Z,
and should become available soon on the main US archive sites.

Patch01 actually consists of two patches. Both patch files are enclosed in
this shar file. The patches for msdos/makefile.bor, msdos/makefile.gcc and
os2/os2zip.c have been uuencoded and should automagically be uudecoded when
unshared. [And if they don't, send mail to Kent as this is his doing.] To
apply Patch01, cd to the zip19 sources directory and unshar the enclosed
patches. Then apply the patches.

patch -p1 < patch1.1
patch -p1 < patch1.2

Please report problems with zip and unzip to zip-...@cs.ucla.edu.
Thanks.

Jean-loup Gailly
jl...@chorus.fr
--------------


#! /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: patch1.1 patch1.2.uu
# Wrapped by kent@sparky on Wed Sep 2 14:21:36 1992
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH


echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive."'
if test -f 'patch1.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patch1.1'\"
else
echo shar: Extracting \"'patch1.1'\" \(25094 characters\)
sed "s/^X//" >'patch1.1' <<'END_OF_FILE'
Xdiff -cr zip19/Where zip19p1/Where
X*** zip19/Where Thu Aug 20 18:55:08 1992
X--- zip19p1/Where Wed Aug 26 15:13:30 1992
X***************
X*** 1,8 ****
X __________________________________________________________________________
X
X! This is the Info-ZIP file ``Where,'' last updated on 20 August 1992.


X __________________________________________________________________________
X
X
X SITE OWNERS: If you're listed in here but the information is not
X correct (or if you're a big site but aren't listed at all), please

X--- 1,11 ----
X __________________________________________________________________________
X
X! This is the Info-ZIP file ``Where,'' last updated on 26 August 1992.
X __________________________________________________________________________
X
X+ Note that some ftp sites may not yet have the latest versions of
X+ zip and unzip when you read this. The latest versions are always on
X+ the comp.sources.misc archives.


X
X SITE OWNERS: If you're listed in here but the information is not
X correct (or if you're a big site but aren't listed at all), please

X***************
X*** 13,25 ****
X utilities (on some ftp sites, the .zip files may have a .zoo equivalent


X in zoo 2.10 format):
X

X! zip19.zip Zip 1.9 (includes zipnote and zipsplit)
X! zip19.tar.Z ditto, compress'd tar format


X
X unzip50.zip UnZip 5.0 (includes zipinfo and funzip)
X unzip50.tar.Z ditto, compress'd tar format
X

X! wunz12sr.zip WizUnZip 1.2 support files for Windows 3.1, UnZip 5.0


X
X zcrypt19.zip encryption/decryption support (includes zipcloak)
X

X--- 16,28 ----
X utilities (on some ftp sites, the .zip files may have a .zoo equivalent


X in zoo 2.10 format):
X

X! zip19p1.zip Zip 1.9 (includes zipnote and zipsplit), patch level 1
X! zip19p1.tar.Z ditto, compress'd tar format


X
X unzip50.zip UnZip 5.0 (includes zipinfo and funzip)
X unzip50.tar.Z ditto, compress'd tar format
X

X! wunz13sr.zip WizUnZip 1.3 support files for Windows 3.1, UnZip 5.0


X
X zcrypt19.zip encryption/decryption support (includes zipcloak)
X

X***************
X*** 27,33 ****


X
X UnzpHist.zip changes history of UnZip, back to 2.0
X

X! zip19x.zip MSDOS executables and docs for zip, zipnote, zipsplit


X unzip50.exe MSDOS executable for unzip
X
X zip19_16.zip OS/2 1.x 16-bit executables and docs

X--- 30,36 ----


X
X UnzpHist.zip changes history of UnZip, back to 2.0
X

X! zip19p1x.zip MSDOS executables and docs for zip, zipnote, zipsplit


X unzip50.exe MSDOS executable for unzip
X
X zip19_16.zip OS/2 1.x 16-bit executables and docs

X***************
X*** 48,55 ****
X
X ftp sites for the US-exportable sources and executables. Look for
X the file names given above in the following directories. Some sites
X! like to use slightly different names, such as zip-1.9.tar-z instead
X! of zip19.tar.Z.


X
X wuarchive.wustl.edu:/packages/compression/...
X wuarchive.wustl.edu:/mirrors/misc/unix/...

X--- 51,58 ----
X
X ftp sites for the US-exportable sources and executables. Look for
X the file names given above in the following directories. Some sites
X! like to use slightly different names, such as zip-1.9p1.tar-z instead
X! of zip19p1.tar.Z.


X
X wuarchive.wustl.edu:/packages/compression/...
X wuarchive.wustl.edu:/mirrors/misc/unix/...

Xdiff -cr zip19/deflate.c zip19p1/deflate.c
X*** zip19/deflate.c Tue Aug 18 11:54:28 1992
X--- zip19p1/deflate.c Tue Aug 25 10:49:40 1992
X***************
X*** 459,465 ****


X * Fill the window when the lookahead becomes insufficient.
X * Updates strstart and lookahead, and sets eofile if end of input file.
X * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0

X! * OUT assertion: at least one byte has been read, or eofile is set.


X */
X local void fill_window()
X {

X--- 459,467 ----


X * Fill the window when the lookahead becomes insufficient.
X * Updates strstart and lookahead, and sets eofile if end of input file.
X * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0

X! * OUT assertions: at least one byte has been read, or eofile is set;
X! * file reads are performed for at least two bytes (required for the
X! * translate_eol option).
X */
X local void fill_window()
X {
X***************
X*** 470,476 ****


X /* If the window is full, move the upper half to the lower one to make
X * room in the upper half.
X */

X! if (more == 0) {


X /* By the IN assertion, the window is not empty so we can't confuse
X * more == 0 with more == 64K on a 16 bit machine.
X */

X--- 472,483 ----


X /* If the window is full, move the upper half to the lower one to make
X * room in the upper half.
X */

X! if (more == (unsigned)EOF) {
X! /* Very unlikely, but possible on 16 bit machine if strstart == 0
X! * and lookahead == 1 (input done one byte at time)
X! */
X! more--;
X! } else if (more <= 1) {


X /* By the IN assertion, the window is not empty so we can't confuse
X * more == 0 with more == 64K on a 16 bit machine.
X */

X***************
X*** 477,486 ****


X memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
X match_start -= WSIZE;
X strstart -= WSIZE;

X! /* strstart - WSIZE = WSIZE - lookahead > WSIZE - MIN_LOOKAHEAD
X! * so we now have strstart > MAX_DIST:
X */
X! Assert (strstart > MAX_DIST, "window slide too early");


X block_start -= (long) WSIZE;
X
X for (n = 0; n < HASH_SIZE; n++) {

X--- 484,493 ----


X memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
X match_start -= WSIZE;
X strstart -= WSIZE;

X! /* strstart - WSIZE >= WSIZE - 1 - lookahead >= WSIZE - MIN_LOOKAHEAD
X! * so we now have strstart >= MAX_DIST:
X */
X! Assert (strstart >= MAX_DIST, "window slide too early");


X block_start -= (long) WSIZE;
X
X for (n = 0; n < HASH_SIZE; n++) {

X***************
X*** 494,508 ****


X * its value will never be used.
X */
X }

X! more = WSIZE;


X if (verbose) putc('.', stderr);

X-
X- } else if (more == (unsigned)EOF) {
X- /* Very unlikely, but possible on 16 bit machine if strstart == 0
X- * and lookahead == 1 (input done one byte at time)
X- */
X- more--;


X }
X n = read_buf((char*)window+strstart+lookahead, more);
X if (n == 0 || n == (unsigned)EOF) {
X eofile = 1;

X--- 501,510 ----


X * its value will never be used.
X */
X }

X! more += WSIZE;


X if (verbose) putc('.', stderr);
X }

X+ /* At this point, more >= 2 */


X n = read_buf((char*)window+strstart+lookahead, more);
X if (n == 0 || n == (unsigned)EOF) {
X eofile = 1;

Xdiff -cr zip19/fileio.c zip19p1/fileio.c
X*** zip19/fileio.c Tue Aug 18 12:34:34 1992
X--- zip19p1/fileio.c Wed Aug 26 11:53:38 1992
X***************
X*** 1544,1551 ****
X #ifdef S_IFLNK


X linkput ? lstat(name, &s) :
X #endif

X! SSTAT(name, &s)) != 0 /* || (s.st_mode & S_IFDIR) != 0 */ )
X! /* Accept about any file kind except directories */
X return 0;
X
X if (a != NULL)
X--- 1544,1553 ----
X #ifdef S_IFLNK


X linkput ? lstat(name, &s) :
X #endif

X! SSTAT(name, &s)) != 0)
X! /* Accept about any file kind including directories
X! * (stored with trailing / with -r option)
X! */
X return 0;
X
X if (a != NULL)
X***************
X*** 1587,1594 ****
X
X int deletedir(d)
X char *d; /* directory to delete */
X! /* Delete the (empty) directory *d. Return the result of rmdir(), delete(),
X! or system(). */
X {
X #ifdef MACOS


X warn("deletedir not implemented yet", "");

X--- 1589,1597 ----
X
X int deletedir(d)
X char *d; /* directory to delete */
X! /* Delete the directory *d if it is empty, do nothing otherwise.
X! Return the result of rmdir(), delete(), or system().
X! */
X {
X #ifdef MACOS


X warn("deletedir not implemented yet", "");

Xdiff -cr zip19/history zip19p1/history
X*** zip19/history Thu Aug 20 20:04:56 1992
X--- zip19p1/history Wed Aug 26 15:31:18 1992
X***************
X*** 908,913 ****
X--- 908,926 ----
X 8. Fixed vms/vms_zip.rnh
X 9. Fixed init_upper() in util.c and os2zip.c (Kai-Uwe)
X
X+ ------------------------ Aug 26 1992 version 1.9p1 ------------------------
X+ This is official patch 1 for zip 1.9, not a beta version.
X+
X+ 1. Simplified makefile entry for convex (Rafal Maszkowski)
X+ 2. Do not use 'const' even for djgcc (Onno van der Linden)
X+ 3. Use gcc in linux makefile entry (Arnt Gulbrandsen)
X+ 4. Fix serious bug in -l option (file truncated).
X+ 5. Fix stack problem for OS/2 IBM-C (Kai-Uwe)
X+ 6. Fix serious bug in zipup.c sometimes causing file truncation to zero bytes
X+ or internal error (Timo Salmi and Robert Tobler)
X+ 7. Do not unlink() directories when running as root (Charles Hannum)
X+ 8. Fix msdos/makefile.bor and msdos/makefile.gcc (Onno van der Linden)
X+
X
X Things to check or to be done (see also BUGS section in zip.1):
X
Xdiff -cr zip19/infozip.who zip19p1/infozip.who
X*** zip19/infozip.who Thu Aug 20 19:46:40 1992
X--- zip19p1/infozip.who Wed Aug 26 15:32:02 1992
X***************
X*** 30,35 ****
X--- 30,36 ----
X Hunter Goatley goath...@WKUVX1.BITNET Vax VMS
X Arnt Gulbrandsen agu...@pvv.unit.no Linux
X David Gundlach da...@rolf.stat.uga.edu Sun SS1+ SunOS 4.1
X+ Charles Hannum myc...@ai.mit.edu bug report
X Bob Hardy ha...@lucid.com Power C on MSDOS
X Peter Jones jo...@mips1.info.uqam.ca MIPS UMIPS 4.0
X Kjetil W. J{\o}rgensen jor...@lise.unit.no OSF/1
X***************
X*** 44,51 ****
X Michael D. Lawler mdla...@bsu-cs.bsu.edu Mt.Xinu BSD 4.3 on VAX
X Johnny Lee joh...@microsoft.com Microsoft C 7.0
X David Lemson lem...@ux1.cso.uiuc.edu Sequent Dynix 3.0.17
X! Onno van der Linden vdli...@fwi.uva.nl SCO Unix 3.2.0
X! BC++ 3.0, djgcc 1.06
X Warner Losh i...@Solbourne.COM packing algorithm help


X John Lundin lun...@urvax.urich.edu VAX VMS
X Igor Mandrichenko mandri...@m10.ihep.su VAX VMS

X--- 45,52 ----
X Michael D. Lawler mdla...@bsu-cs.bsu.edu Mt.Xinu BSD 4.3 on VAX
X Johnny Lee joh...@microsoft.com Microsoft C 7.0
X David Lemson lem...@ux1.cso.uiuc.edu Sequent Dynix 3.0.17
X! Onno van der Linden vdli...@fwi.uva.nl SCO Unix 3.2.0, 386/BSD
X! BC++ 3.0, djgcc 1.08
X Warner Losh i...@Solbourne.COM packing algorithm help


X John Lundin lun...@urvax.urich.edu VAX VMS
X Igor Mandrichenko mandri...@m10.ihep.su VAX VMS

X***************
X*** 77,86 ****
X--- 78,90 ----
X Kai Uwe Rommel rom...@informatik.tu-muenchen.de OS/2
X Jon Saxton j...@panix.com Microsoft C 6.0
X Steve Salisbury ste...@microsoft.com Microsoft C 6.0
X+ Timo Salmi t...@uwasa.fi bug report
X Martin Schulz mar...@indian.cs.unb.ca Atari ST
X Dave Sisson da...@vtcosy.cns.vt.edu AIX 1.1.1 PS/2 & 3090
X Ron Srodawa sro...@vela.acs.oakland.edu SCO Xenix/386 2.3.3
X Bertil Stenstr|m ste...@heron.qz.se HP-UX 7.0 HP9000/835
X+ Paul Telles pa...@pubnet.com SCO Xenix
X+ Robert F Tobler r...@cs.stanford.edu bug report
X Antoine Verheijen ant...@sysmail.ucs.ualberta.ca envargs fix
X Arjan de Vet de...@info.win.tue.nl SunOS 4.1, MSC 5.1
X Rich Wales wa...@cs.ucla.edu SunOS 4.0.3 Sun-3/50
Xdiff -cr zip19/install.doc zip19p1/install.doc
X*** zip19/install.doc Thu Aug 20 18:31:04 1992
X--- zip19p1/install.doc Tue Aug 25 11:20:40 1992
X***************
X*** 41,51 ****


X cannot find _memset or _memcpy, try bsdold. If you are using
X System V Unix or SCO Unix, try sysv or sysv_old. Also use sysv
X on a Silicon Graphics (SGI) machine. You can also cross-compile

X! Zip for MSDOS under SCO 386 Unix using "make scodos".


X
X If none of these compiles, links, and functions properly on

X! your Unix system, see the section BUGS below for how to get
X! help.


X
X If the appropriate system was selected, then the executables
X zip, zipnote and zipsplit will be created. You can copy them

X--- 41,52 ----


X cannot find _memset or _memcpy, try bsdold. If you are using
X System V Unix or SCO Unix, try sysv or sysv_old. Also use sysv
X on a Silicon Graphics (SGI) machine. You can also cross-compile

X! Zip for MSDOS under SCO 386 Unix using "make scodos". If you get
X! error messages "constant expected" in deflate.c, add -DDYN_ALLOC
X! to CFLAGS in your makefile entry.


X
X If none of these compiles, links, and functions properly on

X! your Unix system, see the file Readme for how to get help.


X
X If the appropriate system was selected, then the executables
X zip, zipnote and zipsplit will be created. You can copy them

Xdiff -cr zip19/makefile zip19p1/makefile
X*** zip19/makefile Wed Aug 19 18:17:38 1992
X--- zip19p1/makefile Wed Aug 26 15:01:22 1992
X***************
X*** 4,13 ****
X all:


X @echo ''
X @echo 'Make what? You must say what system to make Zip for--e.g.'

X! @echo '"make bsd". Choices: bsd, bsdold, sysv, sysv_old, sysv_386,'
X! @echo 'dnix, linux, sun, sun_gcc, next10, next, hpux, cray, cray3,'
X! @echo '3b1, att6300, zilog, scodos, aux, c120, convex, aix, minix,'
X! @echo 'isc, ultrix, dec_osf1 and xos.'


X @echo 'See the files install.doc and zip.doc for more information.'
X @echo ''
X

X--- 4,13 ----
X all:


X @echo ''
X @echo 'Make what? You must say what system to make Zip for--e.g.'

X! @echo '"make bsd". Choices: 3b1, aix, att6300, aux, bsd, bsdold,'
X! @echo 'convex, cray, cray3, dec_osf1, dnix, hpux, isc, linux,'
X! @echo 'minix, next, next10, scodos, sun, sun_gcc, sysv, sysv_386,'
X! @echo 'sysv_old, ultrix, xenix, xos, zilog.'


X @echo 'See the files install.doc and zip.doc for more information.'
X @echo ''
X

X***************
X*** 120,126 ****
X bsdold:


X $(MAKE) zips CFLAGS="-O -DZMEM"
X

X! # AT&T System V, Rel 3. Also SCO, Xenix, OpenDeskTop, ETA-10P*, SGI.


X sysv_old:
X $(MAKE) zips CFLAGS="-O -DDIRENT"
X

X--- 120,126 ----
X bsdold:


X $(MAKE) zips CFLAGS="-O -DZMEM"
X

X! # AT&T System V, Rel 3. Also SCO Unix, OpenDeskTop, ETA-10P*, SGI.
X sysv_old:


X $(MAKE) zips CFLAGS="-O -DDIRENT"
X

X***************
X*** 132,145 ****
X sysv_386:


X $(MAKE) zips CFLAGS="-O -DSYSV -DTERMIO -DASM" OBJA=match.o
X

X # DNIX 5.x: like System V but optimization is messed up.


X dnix:
X $(MAKE) zips CFLAGS="-DDIRENT"
X

X! # Linux 0.96a with GCC 2.12, dies with <= 2.11c. The problem with
X! # builtin functions still has to be investigated.
X linux:
X! $(MAKE) zips CFLAGS="-O -fno-builtin -DSYSV -DTERMIO -DLINUX"
X
X # Sun OS 4.x: BSD, but use getdents(). If you have gcc, use 'make sun_gcc'
X # instead since the code produced is better.
X--- 132,151 ----
X sysv_386:


X $(MAKE) zips CFLAGS="-O -DSYSV -DTERMIO -DASM" OBJA=match.o
X

X+ # SCO Xenix
X+ xenix:
X+ $(MAKE) zips CFLAGS="-O -DSYSV -DTERMIO" LFLAGS2="-lx -s"
X+
X # DNIX 5.x: like System V but optimization is messed up.


X dnix:
X $(MAKE) zips CFLAGS="-DDIRENT"
X

X! # Linux 0.96a with GCC 2.12, dies with <= 2.11c. builtin functions are
X! # disabled because '#define const' removes const from normal functions
X! # but not builtin ones. And keeping const causes problems on other systems.
X linux:
X! $(MAKE) zips CFLAGS="-O -fno-builtin -DSYSV -DTERMIO -DLINUX" \
X! CC=gcc BIND=gcc
X
X # Sun OS 4.x: BSD, but use getdents(). If you have gcc, use 'make sun_gcc'
X # instead since the code produced is better.
X***************
X*** 197,209 ****
X aux:


X $(MAKE) zips CFLAGS="-O -DTERMIO"
X

X! # Convex C120, OS 9.0, cc v. 4.0, no vectorization.
X! c120:
X! $(MAKE) zips CFLAGS="-O1 -rl -DCONVEX"
X!
X! # Convex C220, OS 9.0
X convex:
X! $(MAKE) zips CFLAGS="-O2 -rl -DCONVEX"
X
X # AIX Version 3.1 for RISC System/6000
X aix:
X--- 203,211 ----
X aux:


X $(MAKE) zips CFLAGS="-O -DTERMIO"
X

X! # Convex C-120, C-210, OS 9.0, cc v. 4.0, no vectorization used.
X convex:
X! $(MAKE) zips CFLAGS="-O"
X
X # AIX Version 3.1 for RISC System/6000
X aix:
Xdiff -cr zip19/revision.h zip19p1/revision.h
X*** zip19/revision.h Thu Aug 20 17:59:20 1992
X--- zip19p1/revision.h Wed Aug 26 14:46:28 1992
X***************
X*** 14,20 ****
X */
X
X #define REVISION 19
X! #define REVDATE "Aug 20th 1992"
X
X /* Copyright notice for binary executables--this notice only applies to


X * those (zip, zipcloak, zipsplit, and zipnote), not to this file

X--- 14,21 ----
X */
X
X #define REVISION 19
X! #define PATCHLEVEL 1
X! #define REVDATE "Aug 26th 1992"
X
X /* Copyright notice for binary executables--this notice only applies to


X * those (zip, zipcloak, zipsplit, and zipnote), not to this file

Xdiff -cr zip19/tailor.h zip19p1/tailor.h
X*** zip19/tailor.h Tue Aug 18 13:14:44 1992
X--- zip19p1/tailor.h Wed Aug 26 14:50:20 1992
X***************
X*** 2,10 ****
X
X /* const's are inconsistently used across ANSI libraries--kill for all
X header files. */
X! #ifndef __GO32__
X! # define const
X! #endif
X
X
X /* Define MSDOS for Turbo C as well as Microsoft C */
X--- 2,8 ----
X
X /* const's are inconsistently used across ANSI libraries--kill for all
X header files. */
X! #define const
X
X
X /* Define MSDOS for Turbo C as well as Microsoft C */
X***************
X*** 53,58 ****
X--- 51,59 ----
X # define OS2
X #endif
X
X+ #ifdef __convexc__
X+ # define CONVEX
X+ #endif /* __convexc__ */
X
X /* Turn off prototypes if requested */


X #if (defined(NOPROTO) && defined(PROTO))

Xdiff -cr zip19/zip.1 zip19p1/zip.1
X*** zip19/zip.1 Thu Aug 20 20:00:14 1992
X--- zip19p1/zip.1 Tue Aug 25 10:19:48 1992
X***************
X*** 550,555 ****
X--- 550,558 ----
X it only displays a warning "name not matched". A better warnign should be
X given.
X .PP
X+ The option -e also forces -o (make zipfile as old as latest entry). This
X+ is used to make brute force attacks on the password harder.
X+ .PP


X Under VMS, not all of the odd file formats are treated properly. Only
X zip files of format stream-LF and fixed length 512 are expected to work

X with zip. Others can be converted using Rahul Dhesi's BILF program.
Xdiff -cr zip19/zip.doc zip19p1/zip.doc
X*** zip19/zip.doc Thu Aug 20 19:48:58 1992
X--- zip19p1/zip.doc Wed Aug 26 14:26:34 1992
X***************
X*** 28,34 ****
X
X zip version 1.9 is compatible with pkzip 1.93a. Note that
X pkunzip 1.10 cannot extract files produced by pkzip 1.93a or
X! zip 1.9b. You must use pkunzip 1.93a or unzip 5.0 to extract


X them.
X
X For a brief help on zip and unzip, run each without specify-

X--- 28,34 ----
X
X zip version 1.9 is compatible with pkzip 1.93a. Note that
X pkunzip 1.10 cannot extract files produced by pkzip 1.93a or
X! zip 1.9. You must use pkunzip 1.93a or unzip 5.0 to extract


X them.
X
X For a brief help on zip and unzip, run each without specify-

X***************
X*** 464,478 ****


X unzip(1), tar(1), compress(1)
X
X BUGS

X! WARNING: zip files produced by this version of zip must not
X! be *updated* by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if
X! they contain encrypted members, or if they have been pro-
X! duced in a pipe or on a non seekable device. The old ver-
X! sions of zip or pkzip would destroy the zip structure. The
X! old versions can list the contents of the zip file but can-
X! not extract it anyway (because of the new compression algo-
X! rithm). If you do not use encryption and use regular disk
X! files, you do not have to care about this problem.
X
X zip 1.9 is compatible with pkzip 1.93a, except when two
X features are used: encryption or zip file created in a pipe
X--- 464,478 ----


X unzip(1), tar(1), compress(1)
X
X BUGS

X! WARNING: zip files produced by zip 1.9 must not be *updated*
X! by zip 1.0 or pkzip 1.10 or pkzip 1.93a, if they contain
X! encrypted members, or if they have been produced in a pipe
X! or on a non seekable device. The old versions of zip or
X! pkzip would destroy the zip structure. The old versions can
X! list the contents of the zip file but cannot extract it any-
X! way (because of the new compression algorithm). If you do
X! not use encryption and use regular disk files, you do not
X! have to care about this problem.
X
X zip 1.9 is compatible with pkzip 1.93a, except when two
X features are used: encryption or zip file created in a pipe
X***************
X*** 482,487 ****
X--- 482,491 ----
X Without -y, when zip must compress a symbolic link to an non
X existing file, it only displays a warning "name not
X matched". A better warnign should be given.
X+
X+ The option -e also forces -o (make zipfile as old as latest
X+ entry). This is used to make brute force attacks on the
X+ password harder.
X
X Under VMS, not all of the odd file formats are treated prop-
X erly. Only zip files of format stream-LF and fixed length
Xdiff -cr zip19/zipfile.c zip19p1/zipfile.c
X*** zip19/zipfile.c Tue Aug 18 11:54:32 1992
X--- zip19p1/zipfile.c Wed Aug 26 14:35:42 1992
X***************
X*** 753,763 ****


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark || z->trash)
X {

X! z->mark = 1;
X! n++;
X! if (verbose)
X! printf("zip diagnostic: trashing file %s\n", z->name);
X! destroy(z->name);
X }
X

X /* Try to delete all paths that lead up to marked names */

X--- 753,767 ----


X for (z = zfiles; z != NULL; z = z->nxt)

X if (z->mark || z->trash)
X {

X! if (z->zname[z->nam - 1] == '/') /* directory */
X! z->mark = z->trash = 0;
X! else {
X! z->mark = 1;
X! n++;
X! if (verbose)
X! printf("zip diagnostic: trashing file %s\n", z->name);
X! destroy(z->name);
X! }
X }
X

X /* Try to delete all paths that lead up to marked names */

X***************
X*** 779,785 ****


X if (*cutpath(s[i]->name) && strcmp(s[i]->name, s[i-1]->name))
X {
X if (verbose)

X! printf("zip diagnostic: trashing directory %s\n", s[i]->name);


X deletedir(s[i]->name);
X k++;
X }

X--- 783,790 ----


X if (*cutpath(s[i]->name) && strcmp(s[i]->name, s[i-1]->name))
X {
X if (verbose)

X! printf("zip diagnostic: trashing directory %s (if empty)\n",
X! s[i]->name);


X deletedir(s[i]->name);
X k++;
X }

Xdiff -cr zip19/zipup.c zip19p1/zipup.c
X*** zip19/zipup.c Tue Aug 18 11:54:32 1992
X--- zip19p1/zipup.c Wed Aug 26 13:51:42 1992
X***************
X*** 170,176 ****
X--- 170,179 ----


X long q = -2L; /* size returned by filetime */
X int r; /* temporary variable */
X ulg s = 0L; /* size of compressed data */

X+ int isdir; /* set for a directory name */
X
X+ isdir = z->name[strlen(z->name)-1] == '/';
X+

X if ((z->tim = filetime(z->name, &a, &q)) == 0 || q < -1L)
X return ZE_OPEN;
X /* q is set to -1 if the input file is a device */

X***************
X*** 201,207 ****


X l = issymlnk(a);
X if (l)
X ifile = fbad;

X! else if (z->name[z->nam - 1] == '/') { /* directory */


X ifile = fbad;
X m = STORE;
X }

X--- 204,210 ----


X l = issymlnk(a);
X if (l)
X ifile = fbad;

X! else if (isdir) { /* directory */


X ifile = fbad;
X m = STORE;
X }

X***************
X*** 300,306 ****


X if ((b = malloc(CBSZ)) == NULL)
X return ZE_MEM;
X

X! if (z->name[z->nam - 1] != '/') /* no read for directories */


X while ((k = l ? rdsymlnk(z->name, b, CBSZ) : zread(ifile, b, CBSZ)) > 0)
X {
X isize += k;

X--- 303,309 ----


X if ((b = malloc(CBSZ)) == NULL)
X return ZE_MEM;
X

X! if (!isdir) /* no read for directories */


X while ((k = l ? rdsymlnk(z->name, b, CBSZ) : zread(ifile, b, CBSZ)) > 0)
X {
X isize += k;

X***************
X*** 405,417 ****


X unsigned len;
X char far *b;
X if (translate_eol) {

X- /* static char last_byte = '\0'; */


X size >>= 1;
X b = buf+size;
X size = len = zread(ifile, b, size);
X if (len == (unsigned)EOF || len == 0) return len;
X do {

X- /* ??? keep cr lf intact */


X if ((*buf++ = *b++) == '\n') *(buf-1) = '\r', *buf++ = '\n', len++;
X } while (--size != 0);
X buf -= len;

X--- 408,418 ----
END_OF_FILE
if test 25094 -ne `wc -c <'patch1.1'`; then
echo shar: \"'patch1.1'\" unpacked with wrong size!
fi
# end of 'patch1.1'
fi
if test -f 'patch1.2.uu' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patch1.2.uu'\"
else
echo shar: Extracting \"'patch1.2.uu'\" \(4857 characters\)
sed "s/^X//" >'patch1.2.uu' <<'END_OF_FILE'
Xbegin 666 patch1.2
XM9&EF9B M8W(@>FEP,3DO;7-D;W,O;6%K969I;&4N8F]R('II<#$Y<#$O;7-D
XM;W,O;6%K969I;&4N8F]R"BHJ*B!Z:7 Q.2]M<V1O<R]M86ME9FEL92YB;W()
XM5&AU($%U9R R," P-#HQ.3HU-B Q.3DR"BTM+2!Z:7 Q.7 Q+VUS9&]S+VUA
XM:V5F:6QE+F)O<@E7960@075G(#(V(#$U.C(V.C(P(#$Y.3(**BHJ*BHJ*BHJ
XM*BHJ*BHJ"BHJ*B Q,#8L,3$R("HJ*BH*(" ))"A#0RD@+6,@)"A55$E,1DQ!
XM1U,I)"H@9FEL96EO+F,-"B @#0H@('5T:6Q?+F]B:CH)=71I;"YC('II<"YH
XM('II<&5R<BYH('1A:6QO<BYH#0HA( DD*$-#*2 M8R D*%5424Q&3$%'4RDD
XM*B!F:6QE:6\N8PT*(" -"B @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#3TU#7U\I('Q\(&1E9FEN960H7U])0DU#7U\I#0H@("-D969I;F4@86QL
XI;V,@;6%L;&]C#0H@("-D969I;F4@7U]&4D5%7U\-"B @(V5N9&EF#0H@
X
Xend
END_OF_FILE
if test 4857 -ne `wc -c <'patch1.2.uu'`; then
echo shar: \"'patch1.2.uu'\" unpacked with wrong size!
else
echo shar: Uudecoding \"'patch1.2'\" \(3506 characters\)
cat patch1.2.uu | uudecode
if test 3506 -ne `wc -c <'patch1.2'`; then
echo shar: \"'patch1.2'\" uudecoded with wrong size!
else
rm patch1.2.uu
fi
fi
# end of 'patch1.2.uu'
fi
echo shar: End of archive.

0 new messages