Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. A free Macintosh Port of Info-ZIP's
  2. Zip and UnZip
  3. By Dirk Haase, d_haase@sitec.net
  4. Home page: www.sitec.net/maczip
  5. Mirror page:
  6. www.haase-online.de/dirk/maczip
  7. ================================
  8.  
  9.  
  10.  
  11. Abstract:
  12. ---------
  13. MacZip is a cross-platform compatible tool that includes
  14. both Zip (for compression) and UnZip (for extraction).
  15.  
  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.
  19.  
  20. UnZip unpacks zip archives. The Zip and UnZip programs can
  21. process archives produced by PKZIP, and PKZIP and PKUNZIP
  22. can work with archives produced by zip. Zip version 2.2 is
  23. compatible with PKZIP 2.04.
  24.  
  25. If you are new to MacZip please read first the file
  26. "ReadMe.1st".
  27.  
  28.  
  29.  
  30. License:
  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.  
  41. Requirements
  42. ------------
  43. MacZip requires at least System 7 and a Macintosh with a
  44. minimum of a Motorola 68020 or PowerPC 601 processor. Other
  45. configurations may work but it is not tested at all.
  46.  
  47. The application is distributed as a fat binary with both
  48. regular 68K and native PowerPC versions included.
  49.  
  50.  
  51.  
  52. Installation
  53. ------------
  54. Move the executable(s) somewhere--for example, drag it (or
  55. them) to your Applications folder.  For easy access, make an
  56. alias in the Launcher Control Panel or directly on your
  57. desktop. The GUI is very simple. It was not my intention to
  58. make a full-blown GUI, however I think it is comfortable
  59. enough to use it as regular tool.
  60.  
  61. This port supports also Apple-event. So you can install it
  62. in your WWW-Browser as a helper app.
  63.  
  64. For more Info about the contents of this package, take a
  65. look into the "macos/Contents" (or :macos:Contents) file.
  66. Some notes on how to rebuild the Macintosh applications can
  67. be found in INSTALL.
  68.  
  69.  
  70.  
  71. Usage:
  72. ------
  73.  
  74. Basically there are four ways to start MacZip:
  75.  
  76. a) Drag'n Drop
  77. b) using the Dialog box (Menu: File -> Zip/Unzip):
  78.  
  79. Please read the file "ReadMe.1st"
  80. for the description of the items a and b.
  81.  
  82. c) 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.  
  117. d) Using Applescript:
  118.  
  119. There is only one additional event defined: "do_cmd". You
  120. can enter every valid command line. The first word must be
  121. "zip" or "unzip" to select the action (compress or
  122. extraction).
  123.  
  124. See 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.  
  133. This script opens MacZip, brings it to the foreground on the
  134. Mac, starts the zip action with the command line: zip -rjjN
  135. Volume:archive "My Volume:*" .
  136.  
  137.  
  138. A short introduction is also available online:
  139. http://www.sitec.net/maczip/How-To-Do/
  140.  
  141. It's possible to stop the run of Zip/Unzip with the well
  142. known shortcut [Command] + [.].
  143.  
  144.  
  145. ---------------------------------------------------------------------------
  146.  
  147. There are some Mac-specific switches available.
  148. Zip 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.  
  163. Unzip 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.  
  177. Select [File]->[Get Help on Zip/Unzip] for a complete list
  178. of switches.
  179.  
  180.  
  181.  
  182. Limitations / 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.  
  210. Known 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.  
  219. I strongly recommend to test your archive (e.g. unzip -t archive).
  220.  
  221.  
  222.  
  223.  
  224.  
  225. Zip Programs / Macintosh Extra-Data:
  226. -----------------------------------------
  227. A brief overview:
  228. Currently, as far as I know, there are 6 Zip programs
  229. available 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.  
  268. and 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.  
  277. Compatibility 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.  
  288. Compatibility 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.  
  295. Note: This port is complete unrelated to the shareware ZipIt.
  296. Even more, handling of special Macintosh attributes is
  297. incompatible with ZipIt. This port (MacZip) may be used to
  298. extract archives created by ZipIt, but make sure that you
  299. get the result as you expected.
  300.  
  301.  
  302.  
  303. Macintosh Files; File Forks:
  304. ----------------------------
  305.  
  306. All Macintosh files comprise two forks, known as the data
  307. fork and the resource fork.  Unlike the bytes stored in the
  308. resource fork, the bytes in the data fork do not have to
  309. exhibit any particular internal structure. The application
  310. is responsible for interpreting the bytes in the data fork
  311. in whatever manner is appropriate. The bytes in the resource
  312. fork usually have a defined internal structure and contain
  313. data object like menus, dialog boxes, icons and pictures.
  314. Although all Macintosh files contain both a data fork and a
  315. resource fork, one or both of these forks may be empty.
  316.  
  317. MacZip stores data-forks and resource-forks separately. The
  318. Zipfile format does not allow to store two archive entries
  319. using exactly the same name. My solution is to modify the
  320. Path name of the resource-fork. All resource-fork names are
  321. prepended with a leading special directory named
  322. "XtraStuf.mac". So, when extracting on a Mac, you should
  323. never see this directory "XtraStuf.mac" on your *disk*.
  324.  
  325. On all foreign systems that support directories in filenames
  326. (e.g.: OS/2, Unix, DOS/Windows, VMS) you will get a
  327. directory "XtraStuf.mac" when extracting MacZip archives.
  328. You can delete the complete directory "XtraStuf.mac" since
  329. Mac resources do not make much sense outside the MacOS
  330. world.
  331.  
  332.  
  333.  
  334. Text encoding; Charsets of the Filenames:
  335. -----------------------------------------
  336.  
  337. The following information is only important if you plan to
  338. transfer archives across different platforms/language systems:
  339.  
  340. A typical Zip archive does not support different charsets.
  341. All filenames stored in the public area (= accessible by
  342. foreign systems other than MacOS) must be coded in the
  343. charset ISO-8859-1 (CP1252 in the Microsoft Windows world)
  344. or CP850 (DOSLatin1). The latter should only be used by Zip
  345. programs that mark the archive entries as "created under
  346. DOS". Apart from Macs, the commonly used platforms either
  347. support ISO-8859-1 directly, or are compatible with it. To
  348. achieve maximum compatibility, MacZip convert filenames from
  349. the Mac OS Roman character set to ISO-8859-1 and vice versa.
  350. But not every char of the charset MacRoman has their
  351. equivalent in ISO-8859-1. To make the mapping in most cases
  352. possible, I chose most similar chars or at least the MIDDLE
  353. DOT.
  354.  
  355. Mac OS Roman character set is used for at least the
  356. following Mac OS localizations: U.S., British, Canadian
  357. French, French, Swiss French, German, Swiss German, Italian,
  358. Swiss Italian, Dutch, Swedish, Norwegian, Danish, Finnish,
  359. Spanish, Catalan, Portuguese, Brazilian, and the default
  360. International system.
  361.  
  362. In all Mac OS encodings, character codes 0x00-0x7F are
  363. identical 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
  369. So, for best compatibility, confine filenames to the standard
  370. 7-bit ASCII character set.
  371.  
  372. If you generate a filename list of your archive (unzip -l),
  373. you will see the converted filenames. Your can also extract
  374. the archive with the switch '-i' (= ignore mac filenames),
  375. and test your result.
  376.  
  377. This MacZip port uses its own filename stored in the
  378. archive. At the moment, the filename will be not converted.
  379. However, I'm planning to add support for Unicode.
  380.  
  381. Currently, the following Mac OS encodings are NOT supported:
  382. Japanese, ChineseTrad, Korean, Arabic, Hebrew, Greek,
  383. Cyrillic, Devanagari, Gurmukhi, Gujarati, Oriya, Bengali,
  384. Tamil, Telugu Kannada, Malayalam, Sinhalese, Burmese, Khmer,
  385. Thai, Laotian, Georgian, Armenian, ChineseSimp, Tibetan,
  386. Mongolian, Ethiopic, Vietnamese, ExtArabic and finally:
  387. Symbol - this is the encoding for the font named "Symbol".
  388. Dingbats - this is the encoding for the font named "Zapf Dingbats".
  389. If you extract an archive coded with one of these
  390. charsets you will probably get filenames with funny
  391. characters.
  392.  
  393. These problems apply only to filenames and NOT to the file
  394. content.
  395. of course: The content of the files will NEVER be converted !!
  396.  
  397.  
  398.  
  399. File-/Creator Type:
  400. -------------
  401.  
  402. This port uses the creator type 'IZip' and it is registered
  403. at Apple (since 08. March 1998). File types can not be
  404. registered any more. This port uses 'ZIP ' for Zip archive
  405. files. The creator 'IZip' type should be used for all future
  406. versions of MacZip.
  407.  
  408.  
  409.  
  410. Hints for proper restoration of file-time stamps:
  411. -------------------------------------------------
  412.  
  413. UnZip requires the host computer to have proper time zone
  414. information in order to handle certain tasks correctly (see
  415. unzip.txt).  To set the time zone on the Macintosh, go to
  416. the Map Control Panel and enter the correct number of hours
  417. (and, in a few locales, minutes) offset from Universal
  418. Time/Greenwich Mean Time.  For example, the US Pacific time
  419. zone is -8 hours from UTC/GMT during standard (winter) time
  420. and -7 hours from UTC/GMT during Daylight Savings Time.  The
  421. US Eastern time zone is -5 hours during the winter and -4
  422. hours during the summer.
  423.  
  424. Discussion of Daylight Savings Time
  425. -----------------------------------
  426. The setting in the Date & Time control panel for Daylight
  427. Savings time is a universal setting. That is, it assumes
  428. everybody in the world is observing Daylight Savings time
  429. when its check box is selected.
  430.  
  431. If other areas of the world are not observing Daylight
  432. Savings time when the check box is selected in the Date &
  433. Time control panel, then the Map control panel will be off
  434. by an hour for all areas that are not recognizing Daylight
  435. Savings time.
  436.  
  437. Conversely, if you set the Map control panel to an area that
  438. does not observe Daylight Savings time and deselect/uncheck
  439. the check box for Daylight Savings time in the Date & Time
  440. control panel, then time in all areas celebrating Daylight
  441. Savings time will be off by an hour in the Map control
  442. panel.
  443.  
  444. Example:
  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.  
  468. Conclusion:
  469. MacZip only knows the GMT and DST offsets of the
  470. current time, not for the time in question.
  471.  
  472.  
  473. Projects & Packages:
  474. --------------------
  475.  
  476. A Note to version numbers: Version of MacZip is currently
  477. 1.06 and is based on the zip code version 2.3 and unzip code
  478. version 5.42. See About Box for current version and compiler
  479. build date.
  480.  
  481. Because of the amount of sources I splitted this port into
  482. several projects. See http://www.sitec.net/maczip for
  483. updates.
  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.  
  519. Credits:
  520. --------
  521.  
  522. Macstuff.c and recurse.c: All the functions are from More Files.
  523. More Files fixes many of the broken or underfunctional parts of
  524. the file system. Thanks to Jim Luther. (see morefiles.doc)
  525.  
  526.  
  527.  
  528.  
  529. ---------------------------------------------------------------------------
  530. Footnotes:
  531.  
  532. 1. 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.  
  543. 2. Mac pathnames:
  544. The following characteristics of Macintosh pathnames should
  545. be 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.  
  568. Dirk Haase
  569. ==========
  570.