home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 432b.lha / CClib.library_V3.0 / lharc / LHARC.DOC < prev    next >
Text File  |  1990-11-10  |  24KB  |  576 lines

  1. ________________________________________________________________________
  2. ------------------------------------------------------------------------
  3.  
  4.  
  5.                         LHARC        vers. 1.10
  6.  
  7.                         for the Commodore AMIGA
  8.          Compatible with version 1.13 of Lharc for MSDOS systems
  9.  
  10.                   by Paolo Zibetti   (FidoNet 2:331/101.6)
  11.                   (assembler routines by  Paolo Toccaceli) 
  12.  
  13.  
  14. ------------------------------------------------------------------------
  15.  IMPORTANT NOTICE:  This program is copyrighted by Paolo Zibetti, but can
  16.  be freely distributed, providing that the following rules are respected.
  17.  - No change is made to the program nor to the accompaning documentation
  18.  - The package is always distributed in its complete form consisting of 
  19.    3 files: "Lharc", "Lharc.doc" and "Changes".
  20.  - Every form of distribution is allowed and encouraged, but no fee can 
  21.    be charged for this program exept for, possibly, the cost of magnetic 
  22.    media and/or disk duplication and shipping.
  23.  - Inclusion in PD software libraries such as Fish Disks is allowed, 
  24.    provided the fees charged for theese disks are comparable with those
  25.    charged by Fred Fish.
  26.  - The program cannot be distributed in any commercial product without the 
  27.    written consent of the author.
  28.  By copying, distributing and/or using the program you indicate your 
  29.  acceptance of the above rules.
  30.  Also remember that this program is supplied 'as is': the entire risk as
  31.  to the quality of the program is to the user. In no event will the author 
  32.  be liable for direct or indirect damage or loss resulting from the use
  33.  of this program.
  34. ------------------------------------------------------------------------
  35.  
  36. ________________________________________________________________________
  37. ------------------------------------------------------------------------
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. Lharc is an archive program such as Arc and Zoo. It can store several
  49. files in one archive in a compressed form which is generally more
  50. efficent than that used by Arc and Zoo.  It also supplies all of the
  51. archive handling capabilities that an archive program should have.
  52. In particular it is able to store an entire directory tree 
  53. with one single command. This enables you, for example, to store an
  54. entire floppy-disk with a single command creating an archive which is
  55. usually shorter than those prodeced by Warp or even LhWarp (see the -r
  56. switch). 
  57. Another important feature of Lharc is its ability to preserve the file
  58. attributes (see the -a switch)
  59. Its only weakness is compression speed: Zoo 2.0, for example, is
  60. faster, but if compression efficency is more important for you than
  61. compression time you'll surely appreciate this progam. (anyway
  62. decompression is much faster than compression)
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Lharc is run from CLI with the following command line:
  71.  
  72.   Lharc [<switches>] <Command> <Archive> [<dest path>] [<file patterns>]
  73.  
  74. items in square brackets are optional.
  75.  
  76.  
  77.  
  78.  
  79. <Command> can be any of the following (case is not significant):
  80.  
  81.  
  82.   e,x  extract files from archive
  83.        Extracts files from archives. If you specify some file names
  84.        or patterns only those files satisfying the patterns are
  85.        extracted, otherwise all the files in the archive are
  86.        extracted.
  87.        While extracting files, Lharc checks if a file by the same
  88.        name already exsists in the destination directory and prompts 
  89.        you before overwriting the old file with the extracted one 
  90.        (unless you specified the -m switch)
  91.        By default, if the files have a path name stored in the archive, they 
  92.        are extracted with their path and needed directories
  93.        are automatically created; use the -x0 switch to ignore path names.
  94.        See below under '<dest path>' for a discussion on where the
  95.        extracted files are stored.
  96.  
  97.   l    show archives contents
  98.        Displays the names of the files in an archive along with their
  99.        date, time, CRC, compression type, original lenght and
  100.        compressed lenght.
  101.        If the -x switch is specified file names are listed complete
  102.        with their path (if present in the archive), otherwise
  103.        only the name of the files is listed.
  104.  
  105.   v    Same as 'l', but default is to display full pathnames: i.e.
  106.        the 'v' command is equivalent to the 'l' command with the -x switch;
  107.        on the other hand the 'l' command is equivalent to the 'v' command
  108.        with the -x0 switch.
  109.  
  110.   p    extract and print files to screen
  111.        same as 'e' and 'x', but extracted files are sent to stdout
  112.  
  113.   t    test archive integrity
  114.        Checks CRCs and checksums to ensure that the archive is not
  115.        corrupted. Lharc will test all the files on the archive, one
  116.        after each other, printing "OK" to the right of the file names
  117.        which are OK and "WARNING: CRC check failed" to the right of 
  118.        file names that are corrupted. At the end of the test the
  119.        message "Operation successful" means that all the files tested 
  120.        were OK, while the message "Operation not totally successful"
  121.        means that some files in the archive were corrupted (so you
  122.        will know of a corrupted file even if the warning message
  123.        relating to that file has scrolled away on the screen) 
  124.  
  125.   a    create archives or add to existing archives
  126.        Files are stored in alphabetical order, unless you change
  127.        this with the -S switch. Note however that sorting only
  128.        applies to the files beeing added in the current session,
  129.        i.e. if you add files to an existing archive containing
  130.        other files, the new files will be stored, in alphabetical
  131.        order, AT THE END of the archive: old and new files won't be
  132.        intermixed to preserve global alphabetical order.
  133.        If you try to archive a file and a file by the same name
  134.        already exists in the archive the file will not be added
  135.        and a message will be printed on the screen to inform you. 
  136.        By default only file names are stored in the archive, use the 
  137.        -x switch to store file names complete with their paths.
  138.        Also, by default file attributes are not stored, use the '-a'
  139.        switch to obtain this.
  140.  
  141.   m    move files into archivs
  142.        Same as add, but deletes original files after archiving them
  143.  
  144.   d    delete files from archives
  145.        You can delete from an archive a maximum of 150 files at a time,
  146.        if you find that they are too little, please let me know!  
  147.  
  148.   u    update files in archives
  149.        Same as with the 'a' command.  However, if a file already 
  150.        exists in the archive, LHarc will check its time stamp and will
  151.        keep the newer one and ignore the older one.
  152.  
  153.   f    freshen files in archives
  154.        Replaces a file in the archive with the newer one only if a file
  155.        with the same name already exists in the archive.
  156.        Otherwise, no action is taken.
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164. <Archive> is the name (eventually preceded by a path) of the
  165. archive you want to work on. If no extension is specified the default
  166. extension .LZH is used. 
  167. With the 'l' (or 'v'), 'e' (or 'x'), 'p', 't' and 'a' commands you can
  168. work on multiple archives by using wildcards (see 'file patterns'
  169. below for a list of accepted wildcards). For example "lharc v *.LZH"
  170. will show the contents of all the archives in the current directory,
  171. while "lharc x *.LZH *.c" will extract all the C source files
  172. contained in all the archives in the current directory.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179. [<dest path>] 
  180. This parameter is significant only with the 'x' (or 'e') command and is
  181. ignored otherwise. It tells where to put the extracted files; if not
  182. specified, extracted files will go to the current directory.
  183. Please note that this paramenter must always end with '/' or ':'
  184. otherwise it will not be recognized as such and will be considered
  185. as one of the file patterns. 
  186. If the path specified by <dest path> (or equivalently the path stored
  187. in the archive) does not already exist, you will be prompted if you
  188. want new directories to be automatically created (unless you specified
  189. the -m switch, in which case directories will be created without any
  190. prompt).
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197. [<file patterns>] rappresents an optional number of file names
  198. or file patterns. They indicate which files to
  199. extract/compress/list/delete, ecc. 
  200. Accepted wild cards are the standard AmigaDOS '#' and '?' plus the '*'
  201. which is a synonim of '#?'. Since however the asterisk is a valid
  202. caracter in AmigaDOS file names I provided the '**' sequence as an
  203. escape.  So if you want to refer to a file name containing an asterisk
  204. just double the asterisk in the file name.  
  205. Example:  '*.c' is equivalent to '#?.c' and refers to all the files
  206. ending with '.c', while 'my**file' refers to the file 'my*file'.
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. [<switches>] rappresents an optional number of switches that are used
  214. to change the behaviour of the program.
  215. A switch is composed by  a leading '-' followed by one letter; unlike
  216. commands which are case insensitive, switches are case sensitive.
  217. An important point is that if you want to specify more than one switch,
  218. every switch must be preceded by its own dash, i.e. to activate the 'x' and
  219. 'm' switches you must enter "-x -m" and NOT "-xm". 
  220. A switch can be followed by a '0' which turns off the function, while the
  221. switch alone turns the function on: i.e. -x means "use extended file names", 
  222. while -x0 means "don't use them". So you can override the default settings.
  223. Default value for every switch is off, exept for the -x switch which is by
  224. default on with the 'x' 'e' 'd' and 'v' commands and off with the other 
  225. commands.
  226.  
  227. Here is a summary of the available switches:
  228.  
  229.  
  230.   -p  Pause after loading        [note that this is lowercase 'p']
  231.       Causes Lharc to wait for the user to press RETURN before
  232.       executing a command. This allows floppy disk users to swap disks
  233.       after loading Lharc.
  234.  
  235.   -m  no Message for query
  236.       Suppresses all the queries Lharc normally issues before
  237.       overwriting existing files or before creating new directories
  238.       If you specify this switch Lharc will behave as if you choose
  239.       the default action (indicated by an uppercase letter) in
  240.       response to all the questions. This switch also disables
  241.       autoshowing of files (see 'Autoshow files' below)
  242.  
  243.   -x  use eXtended file names
  244.       By default, LHarc stores only the file names of
  245.       files and disregards the names of the directories in which
  246.       they reside.  This switch, used with the 'a' command, tells LHarc 
  247.       to extend all file names with directory names; with the 'x' 'e' 'd'
  248.       and 'v' commands the -x switch is automatically turned on: use 
  249.       -x0 if you want to turn it off thus ignoring pathnames with these 
  250.       commands.
  251.  
  252.   -n  No progress indicator
  253.       Suppresses the display of the number of bytes beeing processed
  254.       during compression or decompression. May be useful if you
  255.       redirect to a file the output of Lharc.
  256.       Note: this version of Lharc allows the -N switch as a synonim of -n :
  257.       but this might change in future versions, so preferibly use the
  258.       lowercase letter.
  259.  
  260.   -w  set Work directory
  261.       Use this switch to choose your own directory for temporary files.
  262.       The directory name must immediatly follow the letter 'w' without
  263.       any leading space, i.e. to set the 'temp' directory on your
  264.       hard-disk as the working directory you must write "-wdh0:temp".
  265.       See below "Temporary files" for a discussion on where temporary
  266.       files are stored in the absence of this switch. 
  267.  
  268.   -P  set Priority          [note that this is uppercase 'P']
  269.       Use this switch to set the priority with which Lharc will be
  270.       executed. Priority must be in the range -5..+5  and must
  271.       immediately follow the 'P' letter without blanks in between.
  272.       By default Lharc is excuted with the same priority of
  273.       the task that invoked it; using this switch will set the new
  274.       priority immediatley after loading and will set back the priority
  275.       to the original value immediately after terminating.
  276.       If you want to do something else with your Amiga, for example
  277.       editing a letter, while Lharc is compressing a long file, I
  278.       suggest that you set Lharc's priority to one less than that of
  279.       the other program, i.e. if you started your editor with the usual
  280.       priority of zero then invoke Lharc with the '-P-1' switch to set its
  281.       priority to -1
  282.  
  283.   -a  consider file Attributes
  284.       By default Lharc will ignore file attributes (i.e. the flags
  285.       indicating protection from deletion, and so on) for maximum
  286.       compatibility with the MSDOS version: in other words it will
  287.       store files with an attribute bit pattern which is suitable for 
  288.       MSDOS machines while during extraction it will ignore the
  289.       attributes stored in the archives, setting the attributes of the
  290.       extracted files to the usual '----rwed'.
  291.       If you use this switch, on the contrary, files will be stored
  292.       with their original attributes and during extraction the
  293.       stored attributed will be restored.
  294.       Remember that, to effectively preserve file attributes, you must
  295.       use this switch both during compression and during extraction.
  296.       Of course AmigaDOS file attributes are meaningless to MSDOS and
  297.       vice-versa; so extract files with the -a switch only if you are
  298.       sure that they contain AmigaDOS file attributes and similarly
  299.       compress files with the -a switch only if you are sure that the
  300.       archive will be unpacked only by Amigas and not by MSDOS
  301.       machines. (Anyway no harm is done if this rule is not respected:
  302.       extracted files will simply have strange attributes)
  303.  
  304.   -u  convert file names to Uppercase
  305.       By default Lharc stores file names/paths with thier original case,
  306.       if you use this switch they will be converted to uppercase.
  307.       See below 'Compatibility' for a possible use of this switch.
  308.  
  309.   -r  Recursively collect files
  310.       This switch instructs Lharc to search for files matching the
  311.       specified patterns not only in the specified directories, but also
  312.       in all the subdirectories that may be found in the specified
  313.       directories. For example: "Lharc -r a archive.lzh df1:source/*.c" 
  314.       will search for files whose name ends with ".c" in "df1:source/"
  315.       and in all the subdirectories that may be contained in the
  316.       "df1:source" directory. 
  317.       Another example: "Lharc -r a archive.lzh df1:*" will archive the
  318.       entire disk in drive df1:, including all its subdirectories.
  319.       (you may wish to add the -a switch to the above line in order to
  320.       be able to re-build exactly the disk, including file attributes)
  321.       Very powerfull, isn't it ?
  322.       When you specify the -r switch, files are always stored with their
  323.       path name, i.e. the -r switch automatically turns on the -x switch,
  324.       too.
  325.  
  326.   -S  Set sorting criteria          [note that this is an UPPLERCASE S]
  327.       This switch sets the sort criterium for files beeing added to
  328.       archives. The '-S' must be immediatly followed by one or two
  329.       characters, i.e. -Sxy 
  330.       'x' can be any of the following:
  331.          0  Don't sort files
  332.          a  Alphabetical sort
  333.          c  Chronological sort
  334.       'y', if present, can be any of the following:
  335.          a  Ascending order
  336.          d  Descending order
  337.       If 'y' is absent, ascending order is assumed by default.
  338.       Examples:
  339.          -Scd          Sort chronologically in descending order
  340.          -Sc  or -Sca  Sort chronologically in ascending order.
  341.          -S0           Don't sort at all
  342.          -Saa          Sort alphabetically in ascending order, this is
  343.                        the default action which is taken if you don't
  344.                        specify this switch. 
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351. -Autoshow files
  352. Suppose that your archive contains an important text file that you
  353. want to be sure it will be read by the guy who unpacks the archive.
  354. The file may for example contain a copyright notice or some special
  355. instructions for unpacking (if you have packed the archive with the -a
  356. switch you may wish to remind to the one who unpacks the archive the
  357. he/she has to use the -a switch too).
  358. For this purpuse this version of Lharc introduces autoshow files: while
  359. unpacking an archive, if Lharc encounters a file whose name ends with
  360. ".TXT.DISPLAYME" (case is not significant and quotes must not be
  361. included, of course), it first extracts the file (removing the .DISPLAYME
  362. extension) and then displays in a window the text found in that file
  363. waiting for the user to press RETURN before proceeding.
  364. You can add as many autoshow files as you want, for example one at the
  365. beginning and one at the end of the archive.
  366. Autoshowing of files is disabled when the -m switch is active so that
  367. a non-interactive unpacking session is allowed.
  368. Lharc uses the standard CON: device to open a window for displaing text,
  369. so you can insert ANSI codes in your autoshow files to make your
  370. messages nicer. Lharc will adjust the size of the window according to
  371. the number of lines contained in the text file, but the maximum allowed
  372. size is that of an NTSC screen (200 pixels), so if your text is longer
  373. than 20 lines it will scroll away.
  374. Finally, please note that this feature is unique to the Amiga version of
  375. Lharc (for now...) so remember that if your archive will be unpacked on
  376. another machine (or an an Amiga using Lharc version 1.0 or lower)
  377. autoshow files will simply be extracted without displaying them on the
  378. screen; anyway your important text file will still be there for later
  379. reading by the user and no compatibility problems will arise.
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387. -Temporary files.
  388.  
  389. While compressing files Lharc creates a temporary file called
  390. 'Lharc.TMP_XXXXXX' where XXXXXX is a hex digit representing the address
  391. of its own Task structure as returned by Exec's FindTask(NULL).  
  392. The reason for the XXXXXX part of the name is that if you run multiple
  393. copies of Lharc at the same time each copy will create its own temporary
  394. file with a different name (usefull for multiline BBSes for example).
  395. Here is how Lharc decides where to store temporary files.
  396. If you specify a path with the -w switch temporary files are stored
  397. there, otherwise if the T:  logical device is assigned they will be
  398. stored in that directory, otherwise they will go to the current
  399. directory.  
  400. If you are not using the -w switch, in order to increase compression
  401. speed, I raccomand that you assign T:  to a directory in the ram-disk.
  402. Note however that T:  is usually automatically assigned to 'ram:t' in
  403. the startup-sequence of the standard Workbench, so, unless you have
  404. modified the startup-sequence, you don't have to worry about this.
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416. -Corrupted archives
  417.  
  418. This version al Lharc for the Amiga has the capability of automatically
  419. handle corrupted archives.
  420. A Lharc archive is made up of several compressed files each precedeed by
  421. a header containing information about file name, date, lenght,...
  422. To ensure that the archive is not corrupted the header also contains a
  423. 16 bit CRC of the file and an 8 bit checksum of the header itself.
  424. If during extraction Lharc finds a corrupted file (i.e. one whose CRC
  425. does not match with the one stored in the header) the file is extracted
  426. anyway, but a warning is printed on the screen.
  427. The worst case comes when the header of a file is corrupted: in this case
  428. the file cannot be extracted even if the file itself is not corrupted.
  429. In this case Lharc will automatically skip the corrupted entry by
  430. starting a search for the next valid entry in the archive and will
  431. print a message like "WARNING: skipping extraneous/corrupted data"
  432. The reason for which it says "extraneous/corrupted" is that an Lharc
  433. archive might happen to contain parts that Lharc cannot recognize as valid
  434. archive entries even it's not corrupted. This happens when you are
  435. extracting files from a self-extracting archive produced by the MSDOS
  436. version of Lharc, since a self-extracting archive contains 8086
  437. extraction code which the Amiga-Lharc sees as extraneous data.
  438. The only extraneous data which is passed without warnings is additional
  439. bytes at the end of an archive: since they are likely to consist of
  440. zero padding due to XMODEM transfer they are totally ignored.
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. -Return codes
  451. When Lharc finishes his work, it returns to the operating system one of
  452. 3 possible return codes:
  453.  
  454.  0  Everything was OK  (the message "Operation successful" is printed on
  455.     the screen). 
  456.  5  Lharc finished its work, but something went wrong, for example Lharc
  457.     encountred a corrupted entry in the archive, but was able to continue
  458.     extracting/testing the rest of the archive (the message "Operation not
  459.     totally succesful" is printed on the screen).
  460.  20 A fatal error occurred and Lharc was unable to continue its work (an
  461.     appropriate message exlpaining the probelm is printed on the sceen) 
  462.  
  463. Thus you can test the succes of operation in your script files by means 
  464. of the 'failat' statement and the 'if warn' test.
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473. -Bugs
  474. No known relevant bugs remain in this version.
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483. -Compatibility.
  484.  
  485. This program is aimed at full compatibility with the MSDOS version
  486. 1.13 of Lharc. 
  487. A few little problems might arise from some file names that are legal
  488. under AmigaDOS, but illegal under MSDOS. As a matter of facts AmigaDOS
  489. allows a wider range of file names (almost every caracter in the ASCII
  490. set is allowed and file names can be longer than 8 characters). For
  491. the greatest convenience of Amiga users, I choose not to restrict the
  492. file name range to accomplish the MSDOS rules, but if you expect that
  493. your archives will be unpacked on an MSDOS machine you'd better
  494. rispect the MSDOS limits.
  495. Also note that, although MSODS Lharc version 1.13 CAN extract files
  496. whose names contain lowercase letters, its pattern matching functions
  497. don't work properly with lowercase file names. So if you want to
  498. extract an Amiga-created archive on an MSDOS machine by using pattern
  499. matching functions (for example to extract only some files instead of
  500. the whole archive) you have to create the archive on the Amiga with
  501. the -u switch. 
  502. Finally, to attain 100% compatibility you shuold not use the '-a' switch
  503. (see above in the switch descriptions)
  504.  
  505. Also note that the MSDOS version of Lharc has the additional
  506. capability of extracting files from archives produced by Larc (a
  507. pupular Giapanise archive program): this feature will not be
  508. implemented in the Amiga version.
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518. -Acknowledgements:
  519.  
  520. First of all I give credit to Haruyasu Yoshizaki for devising such an
  521. efficent compression algorythm as LZHUF.
  522. Second, since the source to the MSDOS version of Lharc is scarcely
  523. portable (lots of 8086 assembler ruotines and MSDOS-dependent C
  524. functions), I had to rewrite the program from scratch. Note howerer
  525. that for LZHUF compression/decompression I have used as a starting
  526. point a 'C' source for an example of single file compression
  527. which I found on a BBS. Although the code has been now remanaged (and
  528. partially rewritten in assembler by Paolo Toccaceli) it nevertheless
  529. was invaluable to me.
  530. For sake of correctness I quote here the the header found on this
  531. source:  
  532.  
  533. /*
  534.  * LZHUF.C English version 1.0
  535.  * Based on Japanese version 29-NOV-1988
  536.  * LZSS coded by Haruhiko OKUMURA
  537.  * Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI
  538.  * Edited and translated to English by Kenji RIKITAKE
  539.  */
  540.  
  541. I whish to thank the above people whose work has been of
  542. foundamental importance for this project.
  543. Many thanks also go to all the people who contributed with suggestions
  544. and bug reports and particularly to Luca Spada for his invaluable beta
  545. testing work.
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557. Please send suggestions, comments and bug reports to:
  558.  
  559. Paolo Zibetti       Fidonet 2:331/101.6
  560.  
  561. node 2:331/101 (AmnesiA) is also the official distribution node for
  562. Amiga-Lharc: you'll always find the latest version available on this
  563. board. If you are an officially listed FidoNet node you can f'request
  564. the latest version of Lharc with the magic file name AMILHARC.
  565.  
  566. Amnesia (2:331/101)  phone +39-331-263425  (v32/HST, upto 14400 bps)
  567.  
  568.  
  569.  
  570. For those who don't have access to a FidoNet node, my Fidonet point
  571. can also be reached from Internet at the following address:
  572.  
  573. Paolo.Zibetti@p6.f101.n331.z2.fidonet.org
  574.  
  575.  
  576.