LHA\LHA205.DOC  ·  DOC  ·  27 KB  ·  1991-03-07  ·  from Amstrad-PC_Mega-Disk_Volume-1_Jun-1991
------------------------------------------------------------------------
                      Manual for LHA Version 2.05

                translated to English by Kenjirou Okubo

                                                   Ver 2.05   1991/01/27
------------------------------------------------------------------------
                             NIFTY-Serve  SDI00506    HARUYASU YOSHIZAKI
                             ASCII-pcs    pcs02846    Yoshi
                             PC-VAN       FEM12376
------------------------------------------------------------------------

     This is a manual for the Beta test version of LHA.EXE.  LHA is
     an upward compatible and improved version of LH113C v113C.  Since
     Microsoft's DOS 5.0 has an interior command LH.EXE, (for Load
     High) the name has been changed from LH.exe to LHA.exe.  Please
     run this program and tell me if/where improvements are needed.

           NOTE:  The help guide built into LHA.EXE is still
                  in Japanese.  Refer to the end of LHA205.HLP
                  for the English version last made available.


0.  To begin with
-----------------

     This is a revised version of LH113C.exe., an archiver which was
     rather slow in execution but tight in compression rate.  I am
     grateful for the support of LH113C's users both in Japan where
     the .LZH file is a standard archived file name and in other
     countries where .LZH is one of a known extension.  I had been
     working for this new version for two years since the last re-
     lease of LH113C.EXE am now glad to announce the release of
     this test version.


     LHA differs from LH113C:
     -----------------------

     LHA is better than LH113 in compression rate, especially with
     large files.  There are a few exceptions if using rather small
     files.  (Under 1 Kb.)  LHA is faster than LH113C in decompres-
     sing, with new static Huffman coding, compared with the older
     dynamic Huffman.  The speed of compression is not as fast as I
     was expecting.  <sigh>

     LHA needs more memory than LH113C did.  If there is not enough
     for LHA to work, it may have looser compression rate, although
     it tries to continue execution.  LHA is upper compatible to
     LH113C.  But LH113C is not completely compatible with the LHA
     format.  Please switch to LHA as soon as you can.  With the "/
     o" option, you can dearchive anything made by LH113C, but not
     vice versa.

     LHA is distributed as a free program with copyright reserved.
     There is no restriction for the use within private cooperations
     or the use for governmental agencies.  Users must be respon-
     sible for the use of facilities of the software especially of
     the auto ! batch file.  The software is distributed as is.  I
     am not liable for any damage caused by the use of this soft-
     ware.  For commercial use of this software, please refer to our
     distribution policy.


     Now you can proceed to read the complete description of commands
     and options.  However, if you are not familiar with what an
     archiver is, please refer to the introductory note LHA.HLP
     written especially for LHA.EXE by Irvin Hoff.



1.  Usage.
---------

  A.  General Format:
  ==================

    LHA <command> [/<option> ARC [[DIR\] [FILE]...]...  [-+012|WDIR]...]


    <command>: if one is not used, you get the help screen or a list of
               FILEs.
    <option>:  you may supply one or more of options explained below.
               (needs an  /  or  -  in front, to designate an option)
    ARC:       archive name.
    DIR:       base directory name.
    FILE:      File name or full pathname if specified.
    WDIR:      Working Directory name.


  B.  <command>
  =============

   a (Add) compress and add to an archive.

     Compress and Add files specified to an archive.  If the named
     archive does not exist, then create one with the name.  LHA
     overwrites any file in the archive by the given file name with
     'a' command.  Compare with 'u' command.

     The commands 'a' and 'm' are used to make an archive.

     < Example 1 >  LHA a ex *.EXE

     LHA makes an ARChive ex.LZH, from all the files with extension
     'EXE'.  Extension .LZH is default.


   u (Update) Compress and Update.

     Compress and add files specified to an archive as command 'a'.
     If LHA detects a file with the name same as the one in the
     archive, then LHA selects the new one to add to archive, by
     comparing the time stamp of each.

     < Example 2 > LHA u ex *.c

     All the FILEs with extension '.C' are archived in ex.LZH.  If
     you already have ex.LZH containing a FILE with the same name,
     only the one with newer time stamp is archived.


   m (Move)

     Compress and add to an archive as 'u' command with checking
     time stamps.  The difference is that LHA deletes all the files
     moved into the archive.

     < Example 3 > LHA m ex *.c

     does  the same as

                  LHA u ex *.c
                  del *.c  .

     Watch the second line.  With the /C option, LHA removes all the
     FILEs into the ARChive ignoring time stamps.  You may lose the
     one with the older time stamp.


   f (Freshen)

     LHA looks for a FILE with the same name as the FILE in the
     archive.  If it finds one with a newer time stamp, LHA
     rewrites the one in the archive.  'LHA f /c ARC ' will not
     check the time stamp.

     < Example 4 > LHA f ex lha.doc

     You have lha.doc compressed and archived in ex.LZH.  You get a
     new lha.doc, then you replace the one in ARChive too.


   d (Delete)

     LHA deletes FILE in ARC.


   e (Extract)

     LHA extracts FILEs from the archive with decompressing.  If LHA
     finds a FILE with a newer FILE with the same name, it skips the
     FILEs.  LHA extracts FILEs from ARChives made by L113C, namely,
     those with the compression ids -lzs-, -lz4-, -lz5-.

     <Example 6 > LHA e ex LHA

     Extracts all the FILEs in the archive 'ex.LZH'.

     < Example 7 > LHA e ex *.com

     LHA extracts all the files with extension .COM from 'ex.LZH'.


  x (eXtract) LHA eXtracts compressed FILE with pathnames.

     If LHA can not find any path, then it will create directories.
     FILEs must be archived with full-pathnames.  LHA restores the
     entire directory structure.  'LHA e /x1m1 ARC' does the same.

     < EXample 8 > LHA x ex

     Suppose '\BIN\CG86.EXE' were among the FILEs in 'EX.LZH'.  LHA
     creates directory '\BIN' if necessary, and extracts 'CG86.EXE'
     there.


   p (Print) Print FILE on standard out.

     LHA prints FILE decompressing from ARC to standard output.

     < Example 9 >  LHA  p ex lha.doc

     LHA extracts 'LHA.DOC' from 'EX.LZH' and displays it on your
     terminal.

     < Example 10 > LHA p ex lha.doc > prn

     LHA extracts 'LHA.DOC' from 'EX.LZH' and prints it out from
     your printer.


   l (List)

     LHA lists FILE names in the archive on a line.  A FILE with
     pathname will have a mark '+' on the head of the line.  'LHA
     l /x ARC' shows full-pathnames of FILEs in ARC, and in 2 lines
     per FILE.  You need not type 'l' to have the list.

     < Example 11 > LHA lha205.exe

     LHA assumes command 'l' and shows list of FILEs archived FILE
     per line.

     < Example 11x > LHA /x lha205.exe

     You get a similar list but full-pathnames are inserted, and
     each FILE is shown on two lines.

     NOTE: Forward slash '/' is used as the pathname separator.


   v (View)

     'LHA v ARC' is the same with 'LHA l /x ARC'.


   t (Test)

     Check the integrity of ARC, by CRC check.

     LHA t LHA.EXE or LHA t LHA???.LZH

     will announce the authenticity of the file you own.

           LHA t LHA.EXE

     "This file seems to be ORIGINAL distributed from H.Yoshi."

     LHA.exe tests itself for you.  This guarantees the version you
     have is not hacked by anyone, though it is not the full guaran-
     tee in the present state of art.  You can't check LHA.exe if
     you have used executable file compressors such as LZEXE, PKLITE
     or DIET.

     < Example 12 > LHA t ex

     LHA tests integrity of the FILEs in 'EX.LZH'.

     < Example 13 > LHA t LHA.exe

     LHA checks if LHA.EXE is the original file distributed.


   s (Self-extract)

     LHA makes a Self-Extracting ARChive from ARC.lzh.  The default
     switch /x0 is assumed when you do not specify.  SFX made with
     the /x0 switch, small model, extracts files on the current
     directory.  You can't activate some programs in the archived
     FILEs automatically with small model.  The size of the SFX file
     is smaller than those made with /x1 switch, large model.

     The large model SFX has the ability to restore subdirectory
     structures and can automatically start execution from a FILE
     inside the archive.

     < Example 14 > LHA s ex

     In this case, LHA makes a small model EX.EXE from EX.LZH.



  C.  </option>
  ============

     Each option takes 3 numerical values to define its finer
     actions.  Use 0,1 and 2 to specify.  For some options, the
     values 1 and 2 does the same thing.  You may toggle 0 and 1 by
     '+' and '-" as with LH113C.  You may change switch character
     (option) from  /  to  - if you prefer the '-'.

     /x[0|1] (eXtend)

     LHA uses eXtended FILE names, namely full-pathnames for FILEs.

     You are on the root directory.  Suppose you want to archive the
     FILE '\tc\include\sys\stat.h' in an archive 'ARC.lzh'.  You type
     'LHA a /x1 ARC.lzh \tc\include\sys\stat.h' to store the FILE
     with full-pathname,'\tc\include\sys\stat.h'.  Similarly, you
     have a 2-lined list with full-pathnames with 'l' command.


     /p[0|1|2] (Precise)

     Search file names precisely.

     Suppose an ARChive 'TC.LZH' contains both 'STAT.H' and
     'SYS\STAT.H'.  A simple command like 'LHA e TC stat.h' will
     extract both files on the current directory and let one
     override the other.  To avoid such confusion, you can type 'LHA
     e -p TC stat.h' to extract 'STAT.H' only.  While by typing 'LHA
     e -p TC sys\stat.h' you will get 'SYS\STAT.H'.


     /c[0|1|2]  (ignore Comparison of time)

     With commands 'u', 'f', 'e', 'x', LHA ignores the checking of
     time stamps.  With these commands, LHA chooses the newest FILE
     with the same pathname to act on, by default.  This option lets
     LHA ignore the time stamps.


     /m[0|1|2]  (no Message)

     ARC.lzh FILE' gives you the newest FILE n your directory.
     'LHA e /m2 ARC.lzh FILE' dearchives every FILE by choosing
     an unused file extension between 000-999.


     /a[0|1] (any Attribute)

     By default, LHA does not archive FILEs with attribute READONLY.
     This switch enables archiving such FILEs.  Extracted files have
     their archive bit set by default.  With the /a1 switch on, LHA
     restores any attributes of the archived FILEs.


     /r[0|1|2] (Recursive)

     LHA archives and extracts files recursively from
     subdirectories. 'Recursively', means LHA searches all FILEs
     from all subdirectories under the specified directory if there
     is any.

     There are three different modes for '/r' switch.


     /r0: (non-recursive mode, default)

     LHA collects files specified by path names only.

     /r1:

     LHA separates the given pathname into a directory name and FILE
     name.  LHA recursively collects FILEs with the given name from
     all the directories under the directory specified.

     < Example 15 > LHA a /r1 source.lzh \source\*.c \source\*.h

     LHA collects FILEs with extension C and H from directory
     \source and its subdirectories, probably '\sources\samples\*.c'
     but not '\source\*.obj'.


     /r2:

     LHA recursively collects all the files from all the specified
     subdirectories.  Tree structure of the specified directory is
     archived as it is.

     < Example 16 > LHA a /r2x1 a:\*.*


     NOTE: LH113C has set /x whenever /r is set in e or x commands.
     LHA differs from LH113C in that /x is not set with /r automati-
     cally.

     The following questions are the most frequently asked ones:

     (1) How do you backup a disk a: ?

                        LHA a /r2x1 ARC.lzh a:\

     (2) Then how do you retrieve all the directories and files on
         b:?

                        LHA x ARC.lzh b:\

     /w[0|1|<Directory Name>] (Work directory)

     Specify the directory name where LH makes temporary files.

                        LHA a /wd:\  ARC.lzh FILEs

     set -w switch on.

     By default, LHA makes all the temporary files on the directory
     where ARC.lzh is to be made.  It will rename the temporary file
     as ARC.lzh.

     LHA makes temporary files on the current directory if no name
     is specified with '/w+'.

     When you set Environmental variable 'TMP' this switch is set
     automatically to be 1.

     The switch helps LHA when you have not enough room in your base
     directory, or when you have a high speed memory device like RAM
     disk or HARD ram.


     /n[0|1] (No indicator)

     In this version, LHA outputs compressing indicator "ooo....."
     to standard error.  The switch is to suppress this output.

     /n1: LHA disables output "ooo....." to indicate its progress.

     /n2: LHA disables outputs of filename, compression rates.


     /t[0|1] (Time stamp)

     With command a,u,m,f,d reset time stamp of ARC.lzh according to
     the newest file in the archive. By default, the time stamp of
     an ARC.lzh is the time when the ARC.lzh is made.


     /z[0|1|2] (Zero compression)

     LHA makes an archive without compressing.

     /z1: None of the FILEs is compressed

     /z2: Compress and archive except for the FILEs with extensions:
          .ARC, .DWC, .LZH, .LZS, .PAK, .ZIP, .ZOO.


     /o[0|1] (Old compatible compression)

     LHA makes an ARChive compatible with LH113C format.  Even in
     this case, LHA makes tighter compression than LH113C ver.1xx.
     Header id is automatically set to be -h1.


     /h[0|1|2] (Header level)

     Choice of header level, default is -h1.


     /i[0|1] (don't Ignore case)

     Recognize Upper and Lower cases.  LH(arc)s have common header
     format in other OS's where cases are recognized as distinct.
     This option is prepared for dearchiving ARChives made by other
     OS'. In the DOS version of LHA, you can't differentiate upper
     and lower when LHA archives FILEs into ARC.  Names are all
     stored in upper case.


     /l[0|1|2] (Long display ).

     LHA outputs filenames in different formats when LHA archives
     and dearchives.

      /l0 : FILE names only.
      /l1 : Full-pathnames stored or to be stored in ARChive in 2 lines.
      /l2 : Full-pathname of FILEs accessed by LHA in 2 lines.

     < Example 16 > LHA a /r1x1l2 link.lzh c:\link.*

     LHA collect link.* with full-pathname from directories below
     c:\, with information from where LHA get these FILEs.


     /@[1] LHA

     recognizes the characters '-' and '@' as the first letter of a
     FILE name.  By default, any file beginning with '@', like
     '@xxx' is recognized as a Response File 'xxx'.  To exit from
     this mode specify '/@0'.  You cannot use '-@0' in this
     particular case.


  D.  Base Directory.
  ==================

     Base directory is not the current nor the root directory.  It
     is the directory on which LHA is executed.  Or you may believe
     that you move to this directory and execute LHA from there.
     You may specify a number of directories as your base
     directories.



  < Example 17 > LHA x program c:\bin\ *.exe *.com c:\temp\ *.man *.doc
                              ~~~~~~~             ~~~~~~~~
     Suppose you are on the directory d:\.  You want to extract
     files with extensions .COM and .EXE on c:\bin, and those with
     extensions .MAN and .DOC on the directory c:\temp.  This is
     equivalent to the following set of command lines.

             D>c:
             C>cd \bin
             C>LHA x d:\program *.com *.exe
             C>cd \temp
             C>LHA x d:\program *.man *.doc

     Naturally, you can't dearchive a single FILE on multiple
     directories.  The directory specified first has the priority.


  E.  DOS redirection and response file.
  =====================================

     LHA can't accept too many file names on a command line as
     MS-DOS's restriction.  To avoid this inconvenience, now LHA
     accepts PIPES and REDIRECTS of DOS.  Besides LHA can use work
     file called response file to record the names of the files to
     be archived like MAKEFILE for some compilers.

 a.  Response File.

     The response file name will be marked with the letter '@' as of
     Link.exe.  It is a text file.  You may just write whatever you
     want LHA to be done on this file.  Response file ignores CR
     code and uses space as a separator.  You may write options in
     the response file but you can't nest, calling other response
     file, file names.


 b.  DOS Pipes and Redirects.

     You may specify the same information supplied by a response
     FILE by using pipes or redirections.  You may create a response
     FILE by redirection.

     < Example 18 > LHA l /n1 parts > files
                    LHA a newparts @files.

     Make a list of files in ARC 'PARTS.LZH' as FILES and use it to
     make a new ARChive 'NEWPARTS.LZH'.  This is done by using the
     response files, after some editing.

     < Example 19 > ls | sort | LHA a all

     Make a list of files in a directory by ls.exe.  Sort file names
     and make a sorted ARChive ALL.LZH.  Beware of the various
     formats from output of ls.exe.  ls.exe is supposed to list
     files one name per line without any attributes or time stamps.


  F.  Environmental Variables.
  ===========================

 a.  LHA and LH113C

     LHA overrides LH113C.  This will reset default optional.


 b.  TMP

     Set working directory as -w option.  In case LHA recognizes no
     working directory, it uses the current directory as the working
     directory and creates temporary files on it.

 c.  TZ

     the Time Zone (EST, PST, etc.) must be set when you archive
     with the header level -h2- and when you dearchive with -h2-.
     In the Eastern Standard Time Zone you have to set TIME ZONE
     with the DOS command: set TZ=EST+5.  Remember the default
     Remember the default header level is -h1-, in which case you
     are all set.


  G.  Exit Codes.
  ==============

     LH will return following result codes after batch or other
     processes' execution.

     0.  Normal.

     1.  CRC error, probably with 'e','x','t' commands.

     2.  Fatal error.  Process terminated without transactions.

     3.  Failed to write temporary files in ARChive.  You may find
         temporary file LHTEMP)2(.LZH on your working directory. You
         may rename this file with extension LZH, and use it as an
         ARChive.


  H.  Working File Names
  ======================

       LHTMP)1(.LZH : Old ARChive renamed.
       LHTMP)2(.LZH : Working file to be renamed as ARChive.


2.SFX, Self-Extracting-ARChive
------------------------------

      General Usage:

                        SFX.exe [/x] [/!] [/eDIR] [DIR]

          /x: do not create new directory.
          /!: auto-execution batch enable.
          [/eDIR],[DIR]; specify directory to extract.


     SFX.exe is an executable file with FILEs archived in ARChive to
     be extracted by execution.  All the LHA distribution will be in
     Self-Extracting .EXE-format.  Only LHA.exe makes SFX files from
     archive *.lzh made by LHA.exe.  You can't make a Self-Extract-
     ing executable file from ARChive made by 'LH113C.1.xx'.

     LHA makes two models of SFX files (a) the small model and (b)
     the large model according to the switch /x0 or /x1, with the
     following special functions.


   A.  Telop.
   =========
      LHA  displays any file with name '!' if SFX.exe find it archived.
      LHA holds one screen after showing [Y/N] prompt.  LHA proceeds on
      execution if it receives 'Y' and quits execution for 'N'.


   B.  Directory Specification.
   ===========================

     This is possible only for the large model.  You can name the
     directory on which to execute SFX.exe.

     < Example 20 > lha205.exe /xec:\user

     LHA extracts FILEs in LHA205.EXE on C:\USER.  You may of course
     type:

                LHA e /x0 lha205.exe c:\user ,

     to keep the TELOP file.


   C.  Auto Execution
   ==================

     This is possible only for large models.

     Archive a batch file with the name "!.bat" and include it in
     the SFX file.  This batch works if and only if you type:

                lha205 -!

     LHA always extracts files on the current directory.  Any
     existing "!.bat" file is overwritten.  You can't activate
     existing !.bat by "-!" switch even if there is one on the
     current directory.  The batch file is read if and only if it is
     archived in SFX file.

     Two Models of Self-Extracting Files:


 a.  Small Model  (LHA s SFX.lzh)

     This is the default model.

     LHA ignores the directory structures even if you make the
     archive file with /x or /r[1|2] switch.  LHA holds only the
     FILE names.  SFX.exe extracts files to the current directory.

     There is no limit on the size of SFX.exe as there was for LH113C.


 b.  Large Model  (LHA s /x1 SFX.lzh)

     You can run a batch file to specify the directory to extract
     files. You can retrieve original directory structures with this
     model. You may refrain from creating unexpected structures by
     using /x switch.


3.  Main Differences from LH113C
--------------------------------

     LHA is an improved version of LH113C in principle.  You will
     notice a number of differences from LHA when comparing with
     LH113C.  Some of the differences will be mentioned at this
     time.  (You may wish to read the LH113.C manual for a better
     comparison if anything appears confusing.)


     FILE names are not sorted in ARC.  LHA takes FILEs into ARC in
     the order they were stored in the directory when using wild
     cards.  If you specify the order of FILE, then the order is
     reproduced in ARC.  If you add new FILEs in an ARC, then new
     ones will be added to the already existing FILEs.

     You may use utilities to sort FILE names in your directory to
     store FILEs in sorted order if you wish.  Or by using pipe you
     may type:

     < Example 21 >   ls *.c *.h | sort | LHA a ex.

     LHA collects FILEs with extensions C and H sorted in the
     ARChiver 'EX.LZH'.

     Consequently, /r switch does not necessarily activate /x switch
     in extraction. In this version of LHA, 'x' command is equiva-
     lent to 'E /x1m1', namely, LHA restores all the tree structures
     of subdirectories.


4.  Our distribution Policy
---------------------------

     This software, this document and LHA.EXE, is a
     copyright-reserved free program.  You may use, copy and
     distribute this software free of charge under the following
     conditions.

  1.  Never change Copyright statement.

  2.  The enclosed documents must be distributed with as a package.
  3.  When you have changed the program, or implemented the program
      for other OS or environment, then you must specify the part
      you have changed.  Also make a clear statement as to your name
      and MAIL address or phone number.
  4.  The author is not liable for any damage on your side caused by
      the use of this program.
  5.  The author has no duty to remedy for the deficiencies of the
      program.
  6.  When you are to distribute this software with publications or
      with your product, you have to print the copyright statement
      somewhere on the disk or on the package.  You cannot
      distribute this software with copyprotected products.


          As long as those conditions are satisfied, you do not
          have to get the author's permission to use or to dis-
          tribute the software.


5.  How to contact the author.
------------------------------

     Please send MAIL to Forum flabo on Nifty serve.  Go Nifty on
     CompuServe and read the instructions there.  Your inquiries or
     your questions are to be addressed to the one of the above
     Nifty forums.  Direct MAIL to the author.

    My mail address :  SDI00506 | PFF00253 on Nifty Serve.
                       pcs02846               ASCII-NET pcs.
                       FEM12376               PC-VAN.

    Oversea Users may send inquiries, also, to K.Okubo to the address:
                       [74100,2565]        on Compuserve,
                       K.Okubo                Genie,
                       [email protected].    INTERNET,CSNET etc.


6. Acknowledgements.
--------------------

     What have I done in these days of rapidly changing software
     technologies? My LH113C has contributed for the improvements of
     similar products such as PKZIP(tm) or PAK(tm).  Even with my
     modest Japanese estimate, this I can be proud of at this
     moment.  I thank for all those people who supported and used
     LH113C, voices of users have always been a constant
     encouragement to me.

        I express my gratitude to Haruhiko Okumura and members of
        SIG Science of PCVAN for the improvements of algorithms,

        to K.Okubo who introduced and supported LH113C on over-
        sea networks such as CompuServe and GEnie.

        to Irv Hoff who worked with Kenjirou Okubo on reviewing
        the English version for spelling, grammar and English
        phrasing.

        to K.Miki who introduced me to archivers and hold a place
        for experiments,

        to members of LSI-Japan who offered excellent versions of
        LSI-C, to the members of Forum FHONYAKU who prepared English
        manual, and finally to all who used LH113C and supported it.


7.  Reference
-------------
  1.  Knuth, D.E., Dynamic Huffman Coding, J.Algorithms, 6:163-180.
  2.  Kurita, T.   Harddisk Cook Book.  1987 Shoeisha,Tokyo.
  3.  Kurita, T.  Tool Box of Coputing, Huffman Coding, bit
      70:100-101,1988.
  4.  Okumura,K.,Masuyama,K.,Miki,K.  Practice and theory of Data
      Compression.  The Basic, 70(March):1-65,1989.
  5.  Fiala,E.R., and Greene,D.H., Data Compression with Finite Win-
      dows, Comm.ACM, 32:490-595,1989.
  6.  Okumura,H., and Yoshizaki,H.  Introduction to  Compression
      Algorithm, C Magazine 3:1:44-68,1991.

                              - end -