home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / compress / mactools.lha / docs / README < prev    next >
Text File  |  1993-01-17  |  22KB  |  452 lines

  1. This is version 2.0b1 of macutil (26-APR-1992).
  2.  
  3. This package contains the following utilities:
  4.     macunpack
  5.     hexbin
  6.     macsave
  7.  
  8. Requirements:
  9. a.  Of course a C compiler.
  10. b.  A 32-bit machine with large memory (or at least the ability to 'malloc'
  11.     large chunks of memory).  For reasons of efficiency and simplicity the
  12.     programs work 'in-core', also many files are first read in core.
  13.     If somebody can take the trouble to do it differently, go ahead!
  14.     There are also probably in a number of places implicit assumptions that
  15.     an int is 32 bits.  If you encounter such occurrences feel free to
  16.     notify me.
  17. c.  A Unix (tm) machine, or something very close.  There are probably quite
  18.     a lot of Unix dependencies.  Also here, if you have replacements, feel
  19.     free to send comments.
  20. d.  This version normally uses the 'mkdir' system call available on BSD Unix
  21.     and some versions of SysV Unix.  You can change that, see the makefile for
  22.     details.
  23.  
  24. File name translation:
  25.  
  26. The programs use a table driven program to do Mac filename -> Unix filename
  27. translation.  When compiled without further changes the translation is as
  28. follows:
  29.     Printable ASCII characters except space and slash are not changed.
  30.     Slash and space are changed to underscore, as are all characters that
  31.     do not fall in the following group.
  32.     Accented letters are translated to their unaccented counterparts.
  33. If your system supports the Latin-1 character set, you can change this
  34. translation scheme by specifying '-DLATIN1' for the 'CF' macro in the
  35. makefile.  This will translate all accented letters (and some symbols)
  36. to their Latin-1 counterpart.  This feature is untested (I do not have
  37. access to systems that cater for Latin-1), so use with care.
  38. Future revisions of the program will have user settable conversions.
  39.  
  40. Another feature of filename translation is that when the -DNODOT flag is
  41. specified in the CF macro an initial period will be translated to underscore.
  42.  
  43. Appleshare support:
  44.  
  45. Optionally the package can be compiled for systems that support the sharing
  46. of Unix and Mac filesystems.  The package supports AUFS (AppleTalk Unix File
  47. Server) from CAP (Columbia AppleTalk Package) and AppleDouble (from Apple).
  48. It will not support both at the same time.  Moreover this support requires
  49. the existence of the 'mkdir' system call.  And finally, as implemented it
  50. probably will work on big-endian BSD compatible systems.  If you have a SysV
  51. system with restricted filename lengths you can get problems.  I do not know
  52. also whether the structures are stored native or Apple-wise on little-endian
  53. systems.  And also, I did not test it fully; having no access to either AUFS
  54. or AppleDouble systems.
  55.  
  56. Acknowledgements:
  57. a.  Macunpack is for a large part based on the utilities 'unpit' and 'unsit'
  58.     written by:
  59.     Allan G. Weber
  60.     weber%brand.usc.edu@oberon.usc.edu
  61.     (wondering whether that is still valid!).  I combined the two into a
  62.     single program and did a lot of modification.  For information on the
  63.     originals, see the files README.unpit and README.unsit.
  64. b.  The crc-calculating routines are based on a routine originally written by:
  65.     Mark G. Mendel
  66.     UUCP: ihnp4!umn-cs!hyper!mark
  67.     (this will not work anymore for sure!).  Also here I modified the stuff
  68.     and expanded it, see the files README.crc and README.crc.orig.
  69. c.  LZW-decompression is taken from the sources of compress that are floating
  70.     around.  Probably I did not use the most efficient version, but this
  71.     program was written to get it done.  The version I based it on (4.0) is
  72.     authored by:
  73.     Steve Davies            (decvax!vax135!petsd!peora!srd)
  74.     Jim McKie               (decvax!mcvax!jim)  (Hi Jim!)
  75.     Joe Orost               (decvax!vax135!petsd!joe)
  76.     Spencer W. Thomas       (decvax!harpo!utah-cs!utah-gr!thomas)
  77.     Ken Turkowski           (decvax!decwrl!turtlevax!ken)
  78.     James A. Woods          (decvax!ihnp4!ames!jaw)
  79.     I am sure those e-mail addresses also will not work!
  80. d.  Optional AUFS support comes from information supplied by:
  81.     Casper H.S. Dik
  82.     University of Amsterdam
  83.     Kruislaan  409
  84.     1098 SJ  Amsterdam
  85.     Netherlands
  86.  
  87.     phone: +31205922022
  88.     email: casper@fwi.uva.nl
  89.     This is an e-mail address that will work.
  90.     See the makefile.
  91.     Some caveats are applicable:
  92.     1.  I did not fully test it (we do not use it).  But the unpacking
  93.     appears to be correct.  Anyhow, as the people who initially compile
  94.     it and use it will be system administrators I am confident they are
  95.     able to locate bugs!  (What if an archive contains a Macfile with
  96.     the name .finderinfo or .resource?  I have had two inputs for AUFS
  97.     support [I took Caspers; his came first], but both do not deal with
  98.     that.  Does CAP deal with it?)  Also I have no idea whether this
  99.     version supports it under SysV, so beware.
  100.     2.    From one of the README's supplied by Casper:
  101.         Files will not appear in an active folder, because Aufs doesn't like
  102.         people working behind it's back.
  103.         Simply opening and closing the folder will suffice.
  104.     Appears to be the same problem as when you are unpacking or in some
  105.     other way creating files in a folder open to multifinder.  I have seen
  106.     bundle bits disappear this way.  So if after unpacking you see the
  107.     generic icon; check whether a different icon should appear and check
  108.     the bundle bit.
  109.         The desktop isn't updated, but that doesn't seem to matter. 
  110.     I dunno, not using it.
  111. e.  Man pages are now supplied.  The base was provided by:
  112.     Douglas Siebert
  113.     ISCA
  114.     dsiebert@icaen.uiowa.edu
  115. f.  Because of some problems the Uncompactor has been rewritten, it is now
  116.     based on sources from the dearchiver unzip (of PC fame).  Apparently the
  117.     base code is by:
  118.     Samuel H. Smith
  119.     I have no further address available, but as soon as I find a better
  120.     attribution, I will include it.
  121. g.  UnstuffIt's LZAH code comes from lharc (also of PC fame) by:
  122.     Haruhiko Okumura,
  123.     Haruyasu Yoshizaki,
  124.     Yooichi Tagawa.
  125. h.  Zoom's code comes from information supplied by Jon W{tte
  126.     (d88-jwa@nada.kth.se).  The Zoo decompressor is based on the routine
  127.     written by Rahul Dhesi (dhesi@cirrus.COM).  This again is based on
  128.     code by Haruhiko Okumura.  See also the file README.zoom.
  129. i.  MacLHa's decompressors are identical to the ones mentioned in g and h.
  130. j.  Most of hexbin's code is based on code written/modified by:
  131.     Dave Johnson, Brown University Computer Science
  132.     Darin Adler, TMQ Software
  133.     Jim Budler, amdcad!jimb
  134.     Dan LaLiberte, liberte@uiucdcs
  135.     ahm (?)
  136.     Jeff Meyer, John Fluke Company
  137.     Guido van Rossum, guido@cwi.nl (Hi!)
  138.     (most of the e-mail addresses will not work, the affiliation may also
  139.     be incorrect by now.)  See also the file README.hexbin.
  140. k.  The dl code in hexbin comes is based on the original distribution of
  141.     SUMacC.
  142. l.  The mu code in hexbin is a slight modification of the hcx code (the
  143.     compressions are identical).
  144. m.  The MW code for StuffIt is loosely based on code by Daniel H. Bernstein
  145.     (brnstnd@acf10.nyu.edu).
  146.  
  147. -------------------------------------------------------------------------------
  148. Macunpack will unpack PackIt, StuffIt, Diamond, Compactor/Compact Pro, most
  149. StuffItClassic/StuffItDeluxe, and all Zoom and LHarc/MacLHa archives.
  150. Also it will decode files created by BinHex5.0, MacBinary, UMCP,
  151. Compress It, ShrinkToFit, MacCompress and DiskDoubler.
  152.  
  153. (PackIt, StuffIt, Diamond, Compactor, Compact/Pro, Zoom and LHarc/MacLHa are
  154. archivers written by respectively: Harry R. Chesley, Raymond Lau, Denis Sersa,
  155. Bill Goodman, Jon W{tte* and Kazuaki Ishizaki.  BinHex 5.0, MacBinary and
  156. UMCP are by respectively: Yves Lempereur, Gregory J. Smith, Information
  157. Electronics.  ShrinkToFit is by Roy T. Hashimoto, Compress It by Jerry
  158. Whitnell, and MacCompress and DiskDoubler are both by Lloyd Chambers.)
  159.  
  160. * from his signature:
  161.     Jon W{tte - Yes, that's a brace - Damn Swede.
  162. Actually it is an a with two dots above; some (German inclined) people
  163. refer to it (incorrectly) as a-umlaut.
  164.  
  165. It does not deal with:
  166. a.  Password protected archives.
  167. b.  Multi-segment archives.
  168. c.  Plugin methods for Zoom.
  169. d.  MacLHa archives not packed in MacBinary mode (the program deals very
  170.     poorly with that!).
  171.  
  172. Background:
  173. There are millions of ways to pack files, and unfortunately, all have been
  174. implemented one way or the other.  Below I will give some background
  175. information about the packing schemes used by the different programs
  176. mentioned above.  But first some background about compression (I am no
  177. expert, more comprehensive information can be found in for instance:
  178. Tomothy Bell, Ian H. Witten and John G. Cleary, Modelling for Text
  179. Compression, ACM Computing Surveys, Vol 21, No 4, Dec 1989, pp 557-591).
  180.  
  181. Huffman encoding (also called Shannon-Fano coding or some other variation
  182.     of the name).  An encoding where the length of the code for the symbols
  183.     depends on the frequency of the symbols.  Frequent symbols have shorter
  184.     codes than infrequent symbols.  The normal method is to first scan the
  185.     file to be compressed, and to assign codes when this is done (see for
  186.     instance: D. E. Knuth, the Art of Computer Programming).  Later methods
  187.     have been designed to create the codes adaptively; for a survey see:
  188.     Jeremy S. Vetter, Design and Analysis of Dynamic Huffman Codes, JACM,
  189.     Vol 34, No 4, Oct 1987, pp 825-845.
  190. LZ77: The first of two Ziv-Lempel methods.  Using a window of past encoded
  191.     text, output consists of triples for each sequence of newly encoded
  192.     symbols: a back pointer and length of past text to be repeated and the
  193.     first symbol that is not part of that sequence.  Later versions allowed
  194.     deviation from the strict alternation of pointers and uncoded symbols
  195.     (LZSS by Bell).  Later Brent included Huffman coding of the pointers
  196.     (LZH).
  197. LZ78: While LZ77 uses a window of already encoded text as a dictionary,
  198.     LZ78 dynamically builds the dictionary.  Here again pointers are strictly
  199.     alternated with unencoded new symbols.  Later Welch (LZW) managed to
  200.     eliminate the output of unencoded symbols.  This algorithm is about
  201.     the same as the one independently invented by Miller and Wegman (MW).
  202.     A problem with these two schemes is that they are patented.  Thomas
  203.     modified LZW to LZC (as used in the Unix compress command).  While LZ78
  204.     and LZW become static once the dictionary is full, LZC has possibilities
  205.     to reset the dictionary.  Many LZC variants are in use, depending on the
  206.     size of memory available.  They are distinguished by the maximum number
  207.     of bits that are used in a code.
  208. A number of other schemes are proposed and occasionally used.  The main
  209. advantage of the LZ type schemes is that (especially) decoding is fairly fast.
  210.  
  211. Programs background:
  212.  
  213. Plain programs:
  214. BinHex 5.0:
  215.     Unlike what its name suggest this is not a true successor of BinHex 4.0.
  216.     BinHex 5.0 takes the MacBinary form of a file and stores it in the data
  217.     fork of the newly created file.
  218.     Although BinHex 5.0 does not create BinHex 4.0 compatible files, StuffIt
  219.     will give the creator type of BinHex 5.0 (BnHq) to its binhexed files,
  220.     rather than the creator type of BinHex 4.0 (BNHQ).  The program knows
  221.     about that.
  222. MacBinary:
  223.     As its name suggests, it does the same as BinHex 5.0.
  224. UMCP:
  225.     Looks similar, but the file as stored by UMCP is not true MacBinary.
  226.     Size fields are modified, the result is not padded to a multiple of 128,
  227.     etc.  Macunpack deals with all that, but until now is not able to
  228.     correctly restore the finder flags of the original file.  Also, UMCP
  229.     created files have type "TEXT" and creator "ttxt", which can create a
  230.     bit of confusion.  Macunpack will recognize these files only if the
  231.     creator has been modified to "UMcp".
  232.  
  233. Compressors:
  234. ShrinkToFit:
  235.     This program uses a Huffman code to compress.  It has an option (default
  236.     checked for some reason), COMP, for which I do not yet know the
  237.     meaning.  Compressing more than a single file in a single run results
  238.     in a failure for the second and subsequent files.
  239. Compress It:
  240.     Also uses a Huffman code to compress.
  241. MacCompress:
  242.     MacCompress has two modes of operation, the first mode is (confusingly)
  243.     MacCompress, the seecond mode is (again confusingly) UnixCompress.  In
  244.     MacCompress mode both forks are compressed using the LZC algorithm.
  245.     In UnixCompress mode only the data fork is compressed, and some shuffling
  246.     of resources is performed.  Upto now macunpack only deals with MacCompress
  247.     mode.  The LZC variant MacCompress uses depends on memory availability.
  248.     12 bit to 16 bit LZC can be used.
  249.  
  250. Archivers:
  251. ArcMac:
  252.     Nearly PC-Arc compatible.  Arc knows 8 compression methods, I have seen
  253.     all of them used by ArcMac, except the LZW techniques.  Here they are:
  254.     1:    No compression, shorter header
  255.     2:    No compression
  256.     3:    (packing) Run length encoding
  257.     4:    (squeezing) RLE followed by Huffman encoding
  258.     5:    (crunching) LZW
  259.     6:    (crunching) RLE followed by LZW
  260.     7:    (crunching) as the previous but with a different hash function
  261.     8:    (crunching) RLE followed by 12-bit LZC
  262.     9:    (squashing) 13-bit LZC
  263. PackIt:
  264.     When archiving a file PackIt either stores the file uncompressed or
  265.     stores the file Huffman encoded.  In the latter case both forks are
  266.     encoded using the same Huffman tree.
  267. StuffIt and StuffIt Classic/Deluxe:
  268.     These have the ability to use different methods for the two forks of a
  269.     file.  The following standard methods I do know about (the last three
  270.     are only used by the Classic/Deluxe version 2.0 of StuffIt):
  271.     0:    No compression
  272.     1:    Run length encoding
  273.     2:    14-bit LZC compression
  274.     3:    Huffman encoding
  275.     5:    LZAH: like LZH, but the Huffman coding used is adaptive
  276.     6:    A Huffman encoding using a fixed (built-in) Huffman tree
  277.     8:    A MW encoding
  278. Diamond:
  279.     Uses a LZ77 like frontend plus a Fraenkel-Klein like backend (see
  280.     Apostolico & Galil, Combinatorial Algorithms on Words, pages 169-183).
  281. Compactor/Compact Pro:
  282.     Like StuffIt, different encodings are possible for data and resource fork.
  283.     Only two possible methods are used:
  284.     0:    Run length encoding
  285.     1:    RLE followed by some form of LZH
  286. Zoom:
  287.     Data and resource fork are compressed with the same method.  The standard
  288.     uses either no compression or some form of LZH
  289. MacLHa:
  290.     Has two basic modes of operation, Mac mode and Normal mode.  In Mac mode
  291.     the file is archived in MacBinary form.  In normal mode only the forks
  292.     are archived.  Normal mode should not be used (and can not be unpacked
  293.     by macunpack) as all information about data fork size/resource fork size,
  294.     type, creator etc. is lost.  It knows quite a few methods, some are
  295.     probably only used in older versions, the only methods I have seen used
  296.     are -lh0-, -lh1- and -lh5-.  Methods known by MacLHa:
  297.     -lz4-:  No compression
  298.     -lz5-:  LZSS
  299.     -lzs-:  LZSS, another variant
  300.     -lh0-:  No compression
  301.     -lh1-:  LZAH (see StuffIt)
  302.     -lh2-:  Another form of LZAH
  303.     -lh3-:  A form of LZH, different from the next two
  304.     -lh4-:  LZH with a 4096 byte buffer (as far as I can see the coding in
  305.         MacLHa is wrong)
  306.     -lh5-:  LZH with a 8192 byte buffer
  307. DiskDoubler:
  308.     The older version of DiskDoubler is compatible with MacCompress.  It does
  309.     not create archives, it only compresses files.  The newer version (since
  310.     3.0) does both archiving and compression.  The older version uses LZC as
  311.     its compression algorithm, the newer version knows a number of different
  312.     compression algorithms.  Many (all?) are algorithms used in other
  313.     archivers.  Probably this is done to simplify conversion from other formats
  314.     to DiskDoubler format archives.  I have seen actual DiskDoubler archives
  315.     that used methods 0, 1 and 8:
  316.     0:    No compression
  317.     1:    LZC
  318.     2:    ???
  319.     3:    RLE
  320.     4:    Huffman (or no compression)
  321.     5:    ???
  322.     6:    ???
  323.     7:    An improved form of LZSS
  324.     8:    Compactor/Compact Pro compatible RLE/LZH or RLE only
  325.     9:    ???
  326.     The DiskDoubler archive format contains many subtle twists that make it
  327.     difficult to properly read the archive (or perhaps this is on purpose?).
  328.  
  329. Naming:
  330. Some people have complained about the name conflict with the unpack utility
  331. that is already available on Sys V boxes.  I had forgotten it, so there
  332. really was a problem.  The best way to solve it was to trash pack/unpack/pcat
  333. and replace it by compress/uncompress/zcat.  Sure, man uses it; but man uses
  334. pcat, so you can retain pcat.  If that was not an option you were able to feel
  335. free to rename the program.  But finally I relented.  It is now macunpack.
  336.  
  337. When you have problems unpacking an archive feel free to ask for information.
  338. I am especially keen when the StuffIt part detects Fixed Huffman or bigram
  339. compression methods.  If you encounter such an archive, please, mail a
  340. 'binhexed' copy of the archive to me so that I can deal with it.  Password
  341. protected archives are (as already stated) not implemented.  I do not have much
  342. inclination to do that.  Also I feel no inclination to do multi-segment
  343. archives.
  344.  
  345. -------------------------------------------------------------------------------
  346. Hexbin will de-hexify files created in BinHex 4.0 compatible format (hqx)
  347. but also the older format (dl, hex and hcx).  Moreover it will uudecode
  348. files uuencoded by UUTool (the only program I know that does UU hexification
  349. of all Mac file information).
  350.  
  351. There are currently many programs that are able to create files in BinHex 4.0
  352. compatible format.  There are however some slight differences, and most
  353. de-hexifiers are not able to deal with all the variations.  This program is
  354. very simple minded.  First it will intuit (based on the input) whether the
  355. file is in dl, hex, hcx or hqx format.  Next it will de-hexify the file.
  356. When the format is hqx, it will check whether more files follow, and continue
  357. processing.  So you can catenate multiple (hqx) hexified files together and
  358. feed them as a single file to hexbin.  Also hexbin does not mind whether lines
  359. are separated by CR's, LF's or combinations of the two.  Moreover, it will
  360. strip all leading, trailing and intermediate garbage introduced by mailers
  361. etc.  Next, it does not mind if a file is not terminated by a CR or an LF
  362. (as StuffIt 1.5.1 and earlier did), but in that case a second file is not
  363. allowed to follow it.  Last, while most hexifiers output lines of equal length,
  364. some do not.  Hexbin will deal with that, but there are some caveats; see the
  365. -c option in the man page.
  366.  
  367. Background:
  368.  
  369. dl format:
  370.     This was the first hexified format used.  Programs to deal with it came
  371.     from SUMacC.  This format only coded resource forks, 4 bits in a byte.
  372. hex format:
  373.     I think this is the first format from Yves Lempereur.  Like dl format,
  374.     it codes 4 bits in a byte, but is able to code both resource and
  375.     data fork.  Is it BinHex 2.0?
  376. hcx format:
  377.     A compressing variant of hex format.  Codes 6 bits in a byte.
  378.     Is it BinHex 3.0?
  379. hqx format:
  380.     Like hcx, but using a different coding (possibly to allow for ASCII->EBCDIC
  381.     and EBCDIC->ASCII translation, which not always results in an identical
  382.     file).  Moreover this format also encodes the original Mac filename.
  383. mu format:
  384.     The conversion can be done by the UUTool program from Octavian Micro
  385.     Development.  It encodes both forks and also some finder info.  You will
  386.     in general not use this with uudecode on non Mac systems, with uudecode
  387.     only the data fork will be uudecoded.  UU hexification is well known (and
  388.     fairly old) in Unix environments.  Moreover it has been ported to lots of
  389.     other systems.
  390. -------------------------------------------------------------------------------
  391. Macsave will read a MacBinary stream from standard input and writes the
  392. files according to the options.
  393. -------------------------------------------------------------------------------
  394. This is an ongoing project, more stuff will appear.
  395.  
  396. All comments are still welcome.  Thanks for the comments I already received.
  397.  
  398. dik t. winter, amsterdam, nederland
  399. email: dik@cwi.nl
  400.  
  401. --
  402. Note:
  403. In these programs all algorithms are implemented based on publicly available
  404. software to prevent any claim that would prevent redistribution due to
  405. Copyright.  Although parts of the code would indeed fall under the Copyright
  406. by the original author, use and redistribution of all such code is explicitly
  407. allowed.  For some parts of it the GNU software license does apply.
  408. --
  409. Appendix.
  410.  
  411. BinHex 4.0 compatible file creators:
  412.  
  413. Type    Creator        Created by
  414.  
  415. "TEXT"    "BthX"        BinHqx
  416. "TEXT"    "BNHQ"        BinHex
  417. "TEXT"    "BnHq"        StuffIt and StuffIt Classic
  418. "TEXT"    "ttxt"        Compactor
  419.  
  420. Files recognized by macunpack:
  421.  
  422. Type    Creator        Recognized as
  423.  
  424. "APPL"    "DSEA"        "DiskDoubler"        Self extracting
  425. "APPL"    "EXTR"        "Compactor"        Self extracting
  426. "APPL"    "Mooz"        "Zoom"            Self extracting
  427. "APPL"    "Pack"        "Diamond"        Self extracting
  428. "APPL"    "arc@"        "ArcMac"        Self extracting (not yet)
  429. "APPL"    "aust"        "StuffIt"        Self extracting
  430. "ArCv"    "TrAS"        "AutoSqueeze"                (not yet)
  431. "COMP"    "STF "        "ShrinkToFit"
  432. "DD01"    "DDAP"        "DiskDoubler"
  433. "DDAR"    "DDAP"        "DiskDoubler"
  434. "DDF."    "DDAP"        "DiskDoubler" (any fourth character)
  435. "DDf."    "DDAP"        "DiskDoubler" (any fourth character)
  436. "LARC"    "LARC"        "MacLHa (LHARC)"
  437. "LHA "    "LARC"        "MacLHa (LHA)"
  438. "PACT"    "CPCT"        "Compactor"
  439. "PIT "    "PIT "        "PackIt"
  440. "Pack"    "Pack"        "Diamond"
  441. "SIT!"    "SIT!"        "StuffIt"
  442. "SITD"    "SIT!"        "StuffIt Deluxe"
  443. "Smal"    "Jdw "        "Compress It"
  444. "TEXT"    "BnHq"        "BinHex 5.0"
  445. "TEXT"    "GJBU"        "MacBinary 1.0"
  446. "TEXT"    "UMcp"        "UMCP"
  447. "ZIVM"    "LZIV"        "MacCompress(M)"
  448. "ZIVU"    "LZIV"        "MacCompress(U)"            (not yet)
  449. "mArc"    "arc*"        "ArcMac"                (not yet)
  450. "zooM"    "zooM"        "Zoom"
  451.  
  452.