1A free Macintosh Port of Info-ZIP's
2Zip and UnZip
3By Dirk Haase, d_haase@sitec.net
4Home page: www.sitec.net/maczip
5Mirror page:
6www.haase-online.de/dirk/maczip
7================================
8
9
10
11Abstract:
12---------
13MacZip is a cross-platform compatible tool that includes
14both Zip (for compression) and UnZip (for extraction).
15
16Zip is a compression and file packaging utility for Unix,
17VMS, MSDOS, OS/2, Windows 9x, Windows NT, Atari, Macintosh,
18Amiga, Acorn RISC OS, and other systems.
19
20UnZip unpacks zip archives. The Zip and UnZip programs can
21process archives produced by PKZIP, and PKZIP and PKUNZIP
22can work with archives produced by zip. Zip version 2.2 is
23compatible with PKZIP 2.04.
24
25If you are new to MacZip please read first the file
26"ReadMe.1st".
27
28
29
30License:
31--------
32  Copyright (c) 1990-2001 Info-ZIP.  All rights reserved.
33
34  See the accompanying file LICENSE, version 2000-Apr-09 or later
35  (the contents of which are also included in unzip.h) for terms of use.
36  If, for some reason, all these files are missing, the Info-ZIP license
37  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
38
39
40
41Requirements
42------------
43MacZip requires at least System 7 and a Macintosh with a
44minimum of a Motorola 68020 or PowerPC 601 processor. Other
45configurations may work but it is not tested at all.
46
47The application is distributed as a fat binary with both
48regular 68K and native PowerPC versions included.
49
50
51
52Installation
53------------
54Move the executable(s) somewhere--for example, drag it (or
55them) to your Applications folder.  For easy access, make an
56alias in the Launcher Control Panel or directly on your
57desktop. The GUI is very simple. It was not my intention to
58make a full-blown GUI, however I think it is comfortable
59enough to use it as regular tool.
60
61This port supports also Apple-event. So you can install it
62in your WWW-Browser as a helper app.
63
64For more Info about the contents of this package, take a
65look into the "macos/Contents" (or :macos:Contents) file.
66Some notes on how to rebuild the Macintosh applications can
67be found in INSTALL.
68
69
70
71Usage:
72------
73
74Basically there are four ways to start MacZip:
75
76a) Drag'n Drop
77b) using the Dialog box (Menu: File -> Zip/Unzip):
78
79Please read the file "ReadMe.1st"
80for the description of the items a and b.
81
82c) Using the Command line (Menu: File->Command Line):
83   The Zip & UnZip tools are command line tools. So the
84   behavior is exactly the same like the Zip & UnZip tools on
85   Unix or Windows/DOS. This means, if you want to zip some
86   files, you have to write a command line like this: "zip
87   [switches] path_to_zip_archive path_to_files_folders"
88
89   - Go to "File", select "Command Line" and the
90     "MacZip Entry box" Dialog Box appears.
91
92   An example:
93
94   a: your zip may be created at
95           Macintosh HD:applications:archive.zip
96
97   b: your files may be found at
98           Macintosh HD:somewhere:my_folder_to_archive:*
99
100   Note: At the end of the path there must be a filename or
101         a wildcard !
102   (see Footnotes: 1 wildcard, 2 Mac path names)
103
104   So the command line should look like (one line!):
105
106   zip "Macintosh HD:applications:archive.zip" "Macintosh HD:somewhere:my_folder_to_archive:*"
107
108   - Click on "Enter" to start the task.
109
110   Since you can not set a default folder you have to enter
111   always a full qualified path names. Full-qualified path
112   names are path names including the Volume name ! (see
113   Footnote: 2 Mac path names)
114
115
116
117d) Using Applescript:
118
119There is only one additional event defined: "do_cmd". You
120can enter every valid command line. The first word must be
121"zip" or "unzip" to select the action (compress or
122extraction).
123
124See sample Applescript:
125
126    tell application "MacZip (PPC)"
127        activate
128        with timeout of 90000 seconds
129            do_cmd "zip -rjjN Volume:archive \"My Volume:*\" "
130        end timeout
131    end tell
132
133This script opens MacZip, brings it to the foreground on the
134Mac, starts the zip action with the command line: zip -rjjN
135Volume:archive "My Volume:*" .
136
137
138A short introduction is also available online:
139http://www.sitec.net/maczip/How-To-Do/
140
141It's possible to stop the run of Zip/Unzip with the well
142known shortcut [Command] + [.].
143
144
145---------------------------------------------------------------------------
146
147There are some Mac-specific switches available.
148Zip Module:
149       -df    [MacOS] Include only data-fork of files zipped into
150              the  archive.   Good for exporting files to foreign
151              operating-systems.  Resource-forks will be  ignored
152              at all.
153
154       -jj    [MacOS] record Fullpath (+ Volname).  The  complete
155              path  including  volume  will be stored. By default
156              the relative path will be stored.
157
158       -S     [MSDOS, OS/2, WIN32 and ATARI] Include  system  and
159              hidden files.
160              [MacOS]  Includes finder invisible files, which are
161              ignored otherwise.
162
163Unzip Module:
164       -E     [MacOS only] display contents of MacOS extra  field
165              during restore operation.
166
167       -i     [MacOS only] ignore filenames stored in MacOS extra
168              fields.  Instead,  the  most  compatible   filename
169              stored in the generic part of the entry's header is
170              used.
171
172       -J     [MacOS only] ignore MacOS extra fields.  All Macin-
173              tosh  specific  info  is  skipped.  Data-fork   and
174              resource-fork are restored as separate files.
175
176
177Select [File]->[Get Help on Zip/Unzip] for a complete list
178of switches.
179
180
181
182Limitations / Problems:
183-----------------------
184
185    - Aliases are not supported. I tried, but I got broken
186      aliases. This port will silently ignore all aliases.
187      It's on my to-do list for future releases.
188
189    - Zip needs much memory to compress many files: You may need
190      to increase the 'Preferred Size' in 'Get Info'. Values of 12
191      Megabytes or more are possible
192
193    - Unzip needs about 500 Kbytes of memory to unzip no matter
194      how many files were compressed and expanded.
195
196    - and finally one big macintosh-related problem:
197      This port has one weak point: It's based on path names.
198      As you may be already know: Path names are not unique on a Mac !
199      The main reason is that an attempt to implement support exact
200      saving of the MacOS specific internal file structures would
201      require a throughout rewrite of major parts of shared code,
202      probably sacrifying compatibility with other systems. I have
203      no solution at the moment. The port will just warn you if you
204      try zip from / to a volume which has a duplicate name.
205      MacZip has problems to find the archive or the files. My
206      (Big) recommendation: Name all your volumes with a unique
207      name and MacZip will run without any problem.
208
209
210Known Bugs:
211
212    - crypted files in a zip archive are sometimes corrupt:
213      I get an error message: invalid compressed data to inflate.
214      Appearance of this error is purely be chance: I did a small
215      test: Unzipping an archive containing 3589 files 56 files
216      fails to unzip, so about 1.5%. Root cause is completely
217      unclear to me :(
218
219I strongly recommend to test your archive (e.g. unzip -t archive).
220
221
222
223
224
225Zip Programs / Macintosh Extra-Data:
226-----------------------------------------
227A brief overview:
228Currently, as far as I know, there are 6 Zip programs
229available for the Macintosh platform. These programs build
230(of course) different variants of Zip files:
231
232    - Info-ZIP's first Port of Zip. Ported by Johnny Lee
233      This port is rather outdated and no longer supported (since 1992).
234      68K only. Only minimal Mac-info is stored
235      (Creator/Type, Finder attributes). Creator/Type: '????' / '????'
236      Until year 1998, only UnZip 5.32 survived.
237
238    - ZipIt by Tom Brown. This is Shareware and still supported I think.
239      ZipIt has a nice GUI, but I found it can't handle large Zip files
240      quite well. ZipIt compresses Macintosh files using the Mac Binary
241      format. So, transferring files to other platforms is not so easy.
242      Only minimal Mac-info is stored (Creator/Type, Finder attributes).
243      Mac filenames are changed to a most compatible filename.
244      Creator/Type: 'ZIP ' / 'ZIP '
245
246    - PKZIP/mac v2.03/210d. This is Shareware.
247      This Zip implementation for the Mac can be found on ASI's web site
248      (http://www.asizip.com/products/products.htm).  The name of this
249      program is misleading, it is NOT a product from PKWARE.  ASI's last
250      release version is v2.03, and they also offer a newer beta version
251      PKZIP/mac 210d. But even the Beta version is rather outdated (1995).
252      Only minimal Mac-info is stored (Creator/Type, Finder attributes).
253      The Zipfile format looks like incompatible to other platforms.
254      (More details about the compatibility issue can be found in
255      proginfo/3rdparty.bug!). Type: 'PKz1'
256      Mac filenames are restored without any change.
257
258    - Aladdin DropZip 1999, This is Shareware. Aladdin chose
259      the format of ZipIt. Therefore, it has the some drawbacks
260      like ZipIt.
261      Creator/Type: 'SITx' / 'ZIP '
262
263    - SmartZip 1.0 1999 - by Marco Bambini Vampire Software.
264      This is Shareware. SmartZip compresses Macintosh files using the
265      Mac Binary. Therefore, it has the same drawbacks like ZipIt.
266      Creator/Type: 'dZIP' / 'ZIP '
267
268and finally:
269    - Info-ZIP's latest Port of Zip. MacZip 1.0. Ported by me :-)
270      It is supported (of course) and up to date. Full set of macintosh
271      info is stored: Creator/Type, Finder attributes, Finder comments,
272      MacOS 8.0 Folder settings, Icon/Folder Positions ...
273      Mac filenames are restored without any change.
274      Creator/Type: 'IZip' / 'ZIP '
275
276
277Compatibility of my port; Extraction:
278   - Archives from Info-ZIP's first port (by Johnny Lee) are
279     still compatible.
280   - Extraction of ZipIt archives is supported. This support
281     is not complete: Filenames are correct but Directory names
282     are sometimes mangled to a DOS compatible form. Segmented
283     archives are not supported.
284   - PKZiP/mac archive files are extracted without resource-forks
285     and without any Finder info. I have no information about
286     that zip format.
287
288Compatibility of my port; Compression:
289   - My port supports only the new Info-ZIP format (introduced
290     with this port). Therefore archives created by MacZip 1.0
291     (March 1999) must be extracted with this version or later
292     releases of Info-ZIP's UnZip to restore the complete set of
293     Macintosh attributes.
294
295Note: This port is complete unrelated to the shareware ZipIt.
296Even more, handling of special Macintosh attributes is
297incompatible with ZipIt. This port (MacZip) may be used to
298extract archives created by ZipIt, but make sure that you
299get the result as you expected.
300
301
302
303Macintosh Files; File Forks:
304----------------------------
305
306All Macintosh files comprise two forks, known as the data
307fork and the resource fork.  Unlike the bytes stored in the
308resource fork, the bytes in the data fork do not have to
309exhibit any particular internal structure. The application
310is responsible for interpreting the bytes in the data fork
311in whatever manner is appropriate. The bytes in the resource
312fork usually have a defined internal structure and contain
313data object like menus, dialog boxes, icons and pictures.
314Although all Macintosh files contain both a data fork and a
315resource fork, one or both of these forks may be empty.
316
317MacZip stores data-forks and resource-forks separately. The
318Zipfile format does not allow to store two archive entries
319using exactly the same name. My solution is to modify the
320Path name of the resource-fork. All resource-fork names are
321prepended with a leading special directory named
322"XtraStuf.mac". So, when extracting on a Mac, you should
323never see this directory "XtraStuf.mac" on your *disk*.
324
325On all foreign systems that support directories in filenames
326(e.g.: OS/2, Unix, DOS/Windows, VMS) you will get a
327directory "XtraStuf.mac" when extracting MacZip archives.
328You can delete the complete directory "XtraStuf.mac" since
329Mac resources do not make much sense outside the MacOS
330world.
331
332
333
334Text encoding; Charsets of the Filenames:
335-----------------------------------------
336
337The following information is only important if you plan to
338transfer archives across different platforms/language systems:
339
340A typical Zip archive does not support different charsets.
341All filenames stored in the public area (= accessible by
342foreign systems other than MacOS) must be coded in the
343charset ISO-8859-1 (CP1252 in the Microsoft Windows world)
344or CP850 (DOSLatin1). The latter should only be used by Zip
345programs that mark the archive entries as "created under
346DOS". Apart from Macs, the commonly used platforms either
347support ISO-8859-1 directly, or are compatible with it. To
348achieve maximum compatibility, MacZip convert filenames from
349the Mac OS Roman character set to ISO-8859-1 and vice versa.
350But not every char of the charset MacRoman has their
351equivalent in ISO-8859-1. To make the mapping in most cases
352possible, I chose most similar chars or at least the MIDDLE
353DOT.
354
355Mac OS Roman character set is used for at least the
356following Mac OS localizations: U.S., British, Canadian
357French, French, Swiss French, German, Swiss German, Italian,
358Swiss Italian, Dutch, Swedish, Norwegian, Danish, Finnish,
359Spanish, Catalan, Portuguese, Brazilian, and the default
360International system.
361
362In all Mac OS encodings, character codes 0x00-0x7F are
363identical to ASCII, except that
364  - in Mac OS Japanese, yen sign replaces reverse solidus
365  - in Mac OS Arabic, Farsi, and Hebrew, some of the
366    punctuation in this range is treated as having strong
367    left-right directionality, although the corresponding
368    Unicode characters have neutral directionality
369So, for best compatibility, confine filenames to the standard
3707-bit ASCII character set.
371
372If you generate a filename list of your archive (unzip -l),
373you will see the converted filenames. Your can also extract
374the archive with the switch '-i' (= ignore mac filenames),
375and test your result.
376
377This MacZip port uses its own filename stored in the
378archive. At the moment, the filename will be not converted.
379However, I'm planning to add support for Unicode.
380
381Currently, the following Mac OS encodings are NOT supported:
382Japanese, ChineseTrad, Korean, Arabic, Hebrew, Greek,
383Cyrillic, Devanagari, Gurmukhi, Gujarati, Oriya, Bengali,
384Tamil, Telugu Kannada, Malayalam, Sinhalese, Burmese, Khmer,
385Thai, Laotian, Georgian, Armenian, ChineseSimp, Tibetan,
386Mongolian, Ethiopic, Vietnamese, ExtArabic and finally:
387Symbol - this is the encoding for the font named "Symbol".
388Dingbats - this is the encoding for the font named "Zapf Dingbats".
389If you extract an archive coded with one of these
390charsets you will probably get filenames with funny
391characters.
392
393These problems apply only to filenames and NOT to the file
394content.
395of course: The content of the files will NEVER be converted !!
396
397
398
399File-/Creator Type:
400-------------
401
402This port uses the creator type 'IZip' and it is registered
403at Apple (since 08. March 1998). File types can not be
404registered any more. This port uses 'ZIP ' for Zip archive
405files. The creator 'IZip' type should be used for all future
406versions of MacZip.
407
408
409
410Hints for proper restoration of file-time stamps:
411-------------------------------------------------
412
413UnZip requires the host computer to have proper time zone
414information in order to handle certain tasks correctly (see
415unzip.txt).  To set the time zone on the Macintosh, go to
416the Map Control Panel and enter the correct number of hours
417(and, in a few locales, minutes) offset from Universal
418Time/Greenwich Mean Time.  For example, the US Pacific time
419zone is -8 hours from UTC/GMT during standard (winter) time
420and -7 hours from UTC/GMT during Daylight Savings Time.  The
421US Eastern time zone is -5 hours during the winter and -4
422hours during the summer.
423
424Discussion of Daylight Savings Time
425-----------------------------------
426The setting in the Date & Time control panel for Daylight
427Savings time is a universal setting. That is, it assumes
428everybody in the world is observing Daylight Savings time
429when its check box is selected.
430
431If other areas of the world are not observing Daylight
432Savings time when the check box is selected in the Date &
433Time control panel, then the Map control panel will be off
434by an hour for all areas that are not recognizing Daylight
435Savings time.
436
437Conversely, if you set the Map control panel to an area that
438does not observe Daylight Savings time and deselect/uncheck
439the check box for Daylight Savings time in the Date & Time
440control panel, then time in all areas celebrating Daylight
441Savings time will be off by an hour in the Map control
442panel.
443
444Example:
445     In the case of Hawaiians, sometimes they are three hours
446     behind Pacific Standard Time (PST) and sometimes two hours
447     behind Pacific Daylight Time (PDT). The Map control panel
448     can only calculate differences between time zones relative
449     to Greenwich Mean Time (GMT). Hawaii will always show up as
450     three hours past the Pacific time zone and five hours past
451     the Central time zone.
452
453     When Hawaiians are not observing Daylight Savings time, but
454     the rest of the country is, there is no combination of
455     settings in Map and Date & Time control panels which will
456     enable you to display Hawaiian local time correctly AND
457     concurrently display the correct time in other places that
458     do observe Daylight Savings time.
459
460     The knowledge about which countries observe Daylight Savings
461     time and which do not is not built into the Map control
462     panel, so it does not allow for such a complex calculation.
463
464     This same situation also occurs in other parts of the world
465     besides Hawaii. Phoenix, Arizona is an example of an area of
466     the U.S. which also does not observe Daylight Savings time.
467
468Conclusion:
469MacZip only knows the GMT and DST offsets of the
470current time, not for the time in question.
471
472
473Projects & Packages:
474--------------------
475
476A Note to version numbers: Version of MacZip is currently
4771.06 and is based on the zip code version 2.3 and unzip code
478version 5.42. See About Box for current version and compiler
479build date.
480
481Because of the amount of sources I splitted this port into
482several projects. See http://www.sitec.net/maczip for
483updates.
484
485- core source parts:
486    unzxxx.zip
487    zipxxx.zip
488      These archives contains the main parts of the port. You can
489      build libraries and a standalone App with Metrowerks
490      standard console SIOUX. They contain only sources, no
491      executables. These archives are exact copies of the standard
492      Info-ZIP source distributions; they were only repackaged
493      under MacOS using MacZip, with one minor addition: For those
494      files that are stored in BinHex'ed format in the Info-ZIP
495      reference source archives, unpacked version that are ready
496      for use have been added.
497
498- additional source part:
499    MacZipxxx.zip: contains all the GUI stuff and the project
500      files to build the main-app.  Only sources of the GUI, no
501      zip or unzip code. To build MacZip successfully you will
502      need to also download the zip and unzip packages.
503
504- executables:
505    MacZipxxxnc.hqx: contains only executables and 'README.TXT',
506                     This version is without en-/decryption support !
507    MacZipxxxc.hqx:  contains only executables and 'README.TXT',
508                     This version supports en-/decryption !
509
510- encryption sources:
511    zcryptxx.zip: To build crypt versions of MacZip.
512    download from ftp://ftp.icce.rug.nl/infozip/ (and subdirectories)
513
514- documentation:
515    MacZipDocu.zip: contains some further docus about the algorithm,
516                    limits, Info-ZIP's appnote and a How-to-do Webpage.
517
518
519Credits:
520--------
521
522Macstuff.c and recurse.c: All the functions are from More Files.
523More Files fixes many of the broken or underfunctional parts of
524the file system. Thanks to Jim Luther. (see morefiles.doc)
525
526
527
528
529---------------------------------------------------------------------------
530Footnotes:
531
5321. wildcard:
533    The '*' is a wildcard and means 'all files'
534    Just in case you don't know wildcards:
535    '*' is a place holder for any character.
536    e.g.:
537    "this*" matches with "this_file" or  "this_textfile" but it
538    doesn't match with "only_this_file" or  "first_this_textfile"
539    "*this*" matches with "this_file" or  "this_textfile" AND
540    matches with "only_this_file" or  "first_this_textfile"
541
542
5432. Mac pathnames:
544The following characteristics of Macintosh pathnames should
545be noted:
546
547    A full pathname never begins with a colon, but must contain
548    at least one colon.
549    A partial pathname always begins with a colon separator except
550    in the case where the file partial pathname is a simple file or
551    directory name.
552    Single trailing separator colons in full or partial pathnames
553    are ignored except in the case of full pathnames to volumes.
554    In full pathnames to volumes, the trailing separator colon is
555    required.
556    Consecutive separator colons can be used to ascend a level
557    from a directory to its parent directory. Two consecutive
558    separator colons will ascend one level, three consecutive
559    separator colons will ascend two levels, and so on. Ascending
560    can only occur from a directory; not a file.
561
562
563
564
565
566---------------------------------------------------------------------------
567
568Dirk Haase
569==========
570