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