This repository has been archived by the owner on May 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
LhA.man
3001 lines (1873 loc) · 114 KB
/
LhA.man
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
LhA User's Guide
Version 1.38 - August 1992
### ### ######
## ## ### ##
## ## ## ###
## ##### #######
## ## ### ## ##
### ## ## ## ## ##
####### ### ### ### ###
Written by Stefan Boberg
Copyright (c) 1991,92 by Stefan Boberg
All rights reserved
V1.38 LhA User's Guide Page 1
1 - Introduction
LhA is a powerful archiver for the Commodore-Amiga computer.
It is fully compatible with LHA for MSDOS systems and LhArc for
MSDOS, Amiga and *NIX. It is also compatible with LhArcA, LZ and
LhArc for the Amiga. LhA sports fast compression and
decompression and has several commands and options not found in
any other currently available archiver for the Amiga.
1.1 About the manual
The manual is divided into two main sections, the first
section (this one) contains miscellaneous information related to
the program. The second section is a reference section, where all
commands and options are explained thoroughly. For information
about registering read `LICENSE.man' and `Orderform'.
1.2 System requirements
LhA will run on any Amiga system with at least 512KB RAM and
one diskdrive, though 1MB RAM and two diskdrives or harddrive is
recommended to get the most out of LhA. LhA will run on any
KickStart from version 1.2 and up. If LhA is used on a system
with the new KickStart 2.x it will adapt to this and utilize
features new to this release. Special care has been taken in the
program design to make the program execute as fast as possible on
68020, 030 and 040-processors without sacrificing 68000
compatibility.
Under KickStart 1.3, LhA requires `arp.library' to be able to
use other wildcard characters than `*' and `?'.
1.4 Terminology
ARCHIVE - An archive is a file containing one or more files in a
compressed or non-compressed state and related information like
file names, last modification date/time, filenotes etc.
COMPRESSION - The process of encoding redundant information into
data requiring less storage space. There are a multitude of ways
you can do this in. LhA uses a modified version of Lempel-Ziv
compression with block-adaptive Huffman coding and a dictionary
size of 4096 or 8192 characters.
COMPRESSION RATIO - The compression ratio figures reported by LhA
are calculated as follows: ratio = (1 - (CompressedSize) /
(OriginalSize)) * 100. I.e how many percent of the file that was
GAINED. Other archivers may use other methods. LHA and ARJ for
MS-DOS, for example, calculates the ratio as: ratio =
(CompressedSize) / (OriginalSize), i.e. how large the compressed
file is compared to the original file. (MSDOSratio =
1-(ADOSratio/100)). The higher the LhA compression ratio is, the
V1.38 LhA User's Guide Page 2
better the compression. Most Amiga archivers use the same ratio
calculation method as I use.
CRC - CRC stands for `Cyclic Redundancy Check'. It is a
relatively sophisticated method of checking data integrity. The
version used in LhA is a 16-bit CRC.
EXTRACTION or DECOMPRESSION - The process of recreating the exact
information that was previously compressed (file contents,
modification date, filenotes, protection flags, directory
structure etc.)
SELF-EXTRACTION MODULE (SFX-Module) - This is an archive that is
an executable file capable of extracting self-contained files.
1.5 LhA - what is it?
LhA is a file archiving program written especially for the
Commodore Amiga computer. The primary goal is to provide the
Amiga community with a fast, efficient and reliable file
archiver. LhA creates and processes archive files with the '.LZH'
suffix, and is fully compatible with both MSDOS LhArc and MSDOS
LhA, as well as the Amiga LhArc, LZ, and LhArcA. It handles both
the old LhArc-style compression (-lh1-, -lh0-) and the new
LHA-style (-lh5-, -lh4-).
LhA is at the time of release by far the fastest LhArc archive
handler, and is more reliable and robust than both LZ and LhArc.
Neither LZ nor LhArc even comes close to the speed of LhA. The
compression and decompression routines are written entirely in
very optimized 68000 assembly language. The routines were written
directly from scratch in pure 68000 assembler, and did not, as in
the other Amiga LZH/LHA-archivers, start as compiled C-code.
Because of this, the routines are both smaller and, more
importantly, faster than they would have been if I'd used
compiler output as source material. You can get an idea of how
fast LhA is compared to other archivers by looking at the speed
test results in `benchm.txt'. An even better way to see how fast
LhA is, is to try it yourself!
1.6 What is a file archiver anyway?
A file archiver, as the name implies, archives files. It
collects the files you specify and stores them all in a single
archive-file. Almost all file archivers (including LhA) also
compress the files before putting them in the archive-file, so
that they occupy less diskspace. When you wish to retrieve some
file from the archive, the archiver decompresses the file and
restores it's file attributes (Last modification date, time, file
comments, protection status etc.). A file archiver can usually
also process archive files in different ways, for instance delete
V1.38 LhA User's Guide Page 3
files, freshen files, print files etc. See the 'ARCHIVER
COMMANDS' section of this manual for an explanation of the
different actions LhA is capable of performing.
The most common use for a file archiver is for transferring
several related files via modem. It would be a very tedious and
cumbersome task to transfer for instance every single source file
of a big project separately, so why not put them all into one
single file? This is where the file archiver comes in, we simply
feed the archiver with all the files we wish to transmit, and
then just transfer the single archive-file the archiver then
creates! After the transfer the receiver just has to use the
archiver to extract all files from the archive-file onto his/hers
harddisk (or floppy). Also, if the files were compressed by the
archiver, it would take less time to transfer the files as well,
which means the phonecall will cost us less. There are of course
other uses for a file archiver, you can use it as a
harddisk-backup program for example (if you have another harddisk
partition to put the archive file on..), and you can use it to
stuff away files you don't use very often, and then when you want
to use them you simply extract the files from the archive, and
then delete them when you're finished (saves disk space).
Personally I use LhA a lot to make automatic backups of my source
codes for various projects.
The file compression methods vary from very simple, less
effective, and fast (Run-Length Encoding, RLE, for instance), to
complex, effective and relatively time-consuming methods
(Lempel-Ziv-Huffman, LZHUF, as used in LhA). The method used in
LZH-Archivers (LZHUF) is to date probably the best algorithm used
in an archiver. There are other similar methods, like ZIP, but
they are not as good. Even though the files become smaller you
don't lose any information when compressing them, the information
is just stored in a different way. Basically, redundant
(repeated) information is replaced with a pointer to some other
part of the file, where this information is located. For example
in this text the word 'archive' appears at several places, this
is an example of redundant data. Simply put, if a file compressor
was to compress this file it would let the first occurence of
'archive' remain unchanged, and then it would replace all other
occurences of 'archive' with a pointer to the first one. When
decompressing the file, the archiver uses these pointers to
restore the file to its original state.
Files which have already been compressed with one technique
can generally not be compressed any further by feeding them to
the same file compressing program again (If that had been
possible, modem transfers would have been a lot cheaper :), since
the redundant information has already been eliminated. It is
possible though to compress files output by certain compressors
(RunLength-Encoders for example) further by feeding them to a
program that uses another method (like LZHUF), since they
V1.38 LhA User's Guide Page 4
eliminate different kinds of redundant information.
1.8 Compatibility and Amiga-specific features
LhA is aimed at full compatibility with LHA V2.13 for MS-DOS,
which is an improvement of the original LhArc V1.13. LhA is also
compatible with LhArc, LhArcA and LZ for the Commodore Amiga
computer. However, LhArc and LhArcA cannot process any archives
with headers of level 1 or 2, or files compressed with the new
LHA compression (-lh5-). LZ 1.92 cannot process archives with
headers of level 2. LHA V2.13 can process all archives created by
LhA.
1.9 About the author program history and future
I, Stefan Boberg - the author of the programs in the LhA
family, am 19 years old and currently studying `applied physics
and electrical engineering', first year, at the Linköping
Institute of Technology. I started working on LhA mainly because
I thought there was no real good archiver for the Amiga, the ones
that existed at the time (June 1991) I began work on it were
either too slow, had loose compression ratios or were
bugged/crippled so that they could not do what I needed an
archiver to do. I use archivers mainly to back up sources for my
various programming projects automatically, and I also use it a
lot to just decompress archives from bulletin board systems and
computer networks. Another reason for doing it was to earn a
little extra money, which I badly need, being a poor student with
a _small_ allowance.. :)
Anyway, I intend to continue developing LhA and the related
programs as long as I can, and will release other, related,
programs as well, like an intuition-driven archiver called `LhI'
for instance. A file system to enable you to treat archives as
directories is also in the pipeline and will be released sometime
in 1992. Other archive formats than LhA-style archives are also
planned to be supported in the filesystem and intuition driven
archiver by means of special resident libraries and handlers.
When these will be finished depends on how much time I can devote
to developing the programs (have to take care of my studies
first).
But this all depends on YOU, if I get a good response and
people register I will continue work on the program. If not,
well, then I might as well drop it for other projects, and just
make minor bugfixes to it instead of continuing development...
It's your choice! If you would like to express your opinions
about the program, or have an idea for a feature you'd like to
see in the next version, please drop me a line via EMail (see
section 3 for addresses) or write a letter. I would really
appreciate it! You MUST report any bugs you find (though I hope
you won't find too many), so I can fix it right away!
V1.38 LhA User's Guide Page 5
2 Reference guide
This section of the manual is intended to be used mostly as a
reference guide when you want to know exactly how a certain
option or command works. If you haven't used LhA before (but
used other archivers), you should at least glance through the
descriptions of all the commands and options to get an idea of
what LhA can do.
2.1 Command line syntax
The command line syntax is as follows:
LhA [-options] <Command> <Archive> [[HomeDir] FileSpec] [@file]
[destdir]
The items in square brackets are optional, and the items in
angle brackets are mandatory. Read the following sections for
exact information on the various items.
2.1.1 Specifying options
Unlike other archivers, LhA lets you specify options anywhere
on the command line. The option specifier is `-' (dash), any
items on the command line that begins with this character are
considered to be option switches. If you want to specify a
filename or something else that begins with a `-' character,
enclose the name in double quotes or use double dashes. For
example, to specify a filename of `-minus', you could write
either `"-minus"' or `--minus'.
If you write `-o' the option `o' is enabled regardless of its
initial state. If you want to disable an option, append a `0'
(zero) after the option, like in `-o0'. If an option is followed
by any other numeric character than `0', the option is enabled.
You can specify multiple options without having a dash in
front of every option character. An example would be `-ox0m',
which would enable option `o', disable option `x' and enable
option `m'. The only exception is options taking multi-digit
numeric arguments, which must be followed by whitespace and
another dash if you want to specify more options (like in `-b32
-ox0m').
2.1.2 Specifying commands
The first non-option argument on the command line MUST be the
command specifier. The commands are case-insensitive (`l' means
the same thing as `L'), and only the first character of the
argument is considered (except for the `vv' command), so you may
use verbose commands such as `list' or `add' instead of `l' and
`a', respectively.
V1.38 LhA User's Guide Page 6
2.1.3 Specifying archives
The archive specification must be the second non-option
argument (the first being the command specification). In most
cases you can specify a pattern here. The exception being the
`m' (move files to archive) command.
2.1.4 Specifying action files
The action files are specified after the archive
specification. The action file specifications may include pattern
matching tokens. Note that, as all other file specifications in
LhA, action file specifications may contain wildcards for
directory names as well - `hd:*/*/dir/*.h' is valid, for
example.
NOTE
If you do not specify any action files, LhA assumes
that you wish to act upon all files in the archive or
in the current directory.
2.1.5 Home directories
Home directories is a new concept introduced with LhA, it
provides an easy way of specifying what parts of pathnames that
should be preserved in the archive. It can also be used to
simplify specifications of mutiple files in the same directory.
It is perhaps best explained with a couple of examples:
EXAMPLE
Example 1:
lha -x a newarc dh0:files/ file1 dir1/file2 dir2/file3
dh0:files2/ *.c
This would add the following files to `newarc.lha':
Added file(s) Stored as
----------------- --------------
dh0:files/file1 file1
dh0:files/dir1/file2 dir1/file2
dh0:files/dir2/file3 dir2/file3
dh0:files2/*.c *.c
Example 2:
lha -r a newarc hd:tmp/ *.c *.h hd:px/ *.s *.snd *.iff
This would add all `.c' and `.h' files in `hd:tmp' and it's
V1.38 LhA User's Guide Page 7
subdirectories, storing pathnames, but excluding the `hd:tmp'
part. For instance, the file `hd:tmp/src/foo/arargh.c' would
be stored in the archive with the name `src/foo/arargh.c'.
Additionally, all `.s', `.snd' and `.iff' files in `hd:px' and
its subdirectories will be added, excluding the `hd:px/' part
of the name.
Homedir specifications must end in `/' or `:', otherwise they
won't be recognized as such.
Homedir specifications may contain wildcards and other pattern
matching tokens.
NOTE
You are not supposed to include the home directory name
in the action file specifications after the home
directory spec. I.e. you should not enter
`devs:printers/ devs:printers/*HP*', but
`devs:printers/ *HP*' is correct.
The home directory remains active for the rest of the
command line or until the next home directory
specification. If you want to set the home directory to
the current directory (as it is from the beginning),
use a single slash (`/') as a home directory
specification. This means you cannot use a single slash
to specify the parent directory, to do this you will
have to add an additional slash (`//' means parent
directory, `///' the parent's parent directory and so
on).
2.1.6 Recursive file collection
When collecting files recursively (by using the -r option with
a or u commands), action file specs are treated somewhat
differently. Home directories work the same way as usual. In
recursive file collection mode, the last node of the action file
specification (i.e. the file name part) is used as a pattern that
is compared to all files in the specified directory and its
subdirectories. Some examples to hopefully clarify the somewhat
fuzzy description:
EXAMPLE
Example 1:
lha -r a myarc *
This will add all files in the current directory and its
subdirectories to `myarc.lha'.
V1.38 LhA User's Guide Page 8
Example 2:
lha -r a myarc *.c *.cpp
Will add all `.c' and `.cpp' files in the current directory
and its subdirectories to `myarc.lha'.
Example 3:
lha -r a myarc ram:work/* hd:tmp/*.c
Will add all files in `ram:work' and its subdirectories - as
well as all `.c' files in `hd:tmp' and its subdirectories - to
`myarc.lha'. The full pathnames will be stored (excluding the
device specification of course).
Example 4:
lha -r a myarc ram:work/ * hd:tmp/ *.c
Will do exactly the same as example 3, but LhA will not store
the `ram:work/' and `hd:tmp/' parts of the filenames in the
archive. (Because of the home directory specifications).
Example 5:
lha -r a myarc ram:dir1 ram:makefile
Will archive all files in the directory `dir1' and its
subdirectories, as well as the file `ram:makefile'.
Example 6:
lha -r a myarc ram:dir1 ram:(makefile)
Will do almost the same as example 5, but will archive ALL
`makefile's in ram: and all it's subdirectories (because of
the parentheses - see note below).
NOTE
Explicitly specified directories (explicitly = without
pattern matching) will be treated as `dirname/*', i.e.
all files in the directory and it's subdirs will be
archived. Explicitly specified files will only be
looked for in the current home directory, unless the
filename is enclosed in parentheses, in which case the
file will be looked for recursively. I have chosen to
implement it this way because LhA can then be used
better together with directory utilities such as
V1.38 LhA User's Guide Page 9
Browser or DirectoryOpus.
2.1.7 Specifying destination directory
You can optionally specify a destination directory for the
files written by the extract commands by writing the desired
directory name anywhere after the archive name on the command
line. If no destination directory is specified, LhA will use the
current directory as the destination. The destination directory
specification must end in `:' or `/', just like home directory
specifications, or LhA would not be able to distinguish directory
names from action file specs.
EXAMPLE
`lha x corpus ram:' would extract the contents of `corpus.lzh'
to ram:.
`lha x project *.c dl:tmp/' would extract the contents of
`project.lzh' to the `dl:tmp' directory.
and so would `lha x project dl:tmp/ *.c'.
NOTE
You can specify a directory that does not already exist
as the destination, LhA will automatically create the
directory for you (without asking first).
2.1.8 `@'-files
`@'-files are files that are treated as if their contents were
written on the command line. They can be used to specify files,
options commands and anything else can be specified on the
command line. An example would be the command `lha -r e arc.lzh
*.[chas] @filelist ram:', which would extract all files matching
`*.[chas]' or the files listed in `filelist' to ram:. Carriage
returns and linefeeds in `@'-files are treated as whitespace.
2.1.9 LhA limitations
LhA has been written to be as flexible as possible, but there
are some limitations that you should be aware of as a user.
o LhA pathnames are currently limited to 255 characters. If you
exceed this limit behaviour is undefined. User reports indicate
that AmigaDOS does not handle pathnames with more than 180-190
characters properly.
o When headers of level 0 are used, filenotes may not be longer
V1.38 LhA User's Guide Page 10
than 230-{filename length (including path)} characters. With
header level 1 or 2 filenotes may be up to 255 characters
(AmigaDOS currently only supports filenotes of max 80
characters so this should not be any problem except with
exceptionally long filenames and paths).
o The number of files in an archive files are only limited by
available disk space. The size of an archive must not exceed
2.147.483.648 bytes (2 Gigabytes); LhA will get VERY confused.
o The number of arguments on the command line is only limited by
available RAM memory and the used shell.
o The allowed number of wildcard-matched files is only limited
by available RAM memory. Any number of files may be extracted
or added to an archive in one go.
o Level 2 headers must not be longer than 1024 characters, or
LhA will not be able to process them.
o Currently LhA only handles multivolume archives with a maximum
of 100 volumes. If you create archives with more than this
number of volumes, behaviour is undefined.
2.2 Environment variables
Under KickStart 2.0 LhA supports both local and global
environment variables. Local variables are not available under
the 1.3 shell. Upon startup LhA looks for the environment
variable `LHAOPTS' and includes this as if it had been typed on
the command line directly after the `LhA' command name. If you
don't want to use the settings from the environment variable, use
the `-I' switch.
EXAMPLE
If you set LHAOPTS to `-N -b64' with the following command:
1> setenv LHAOPTS -N -b64
LhA would not display any file-progress indicator and use a
64K I/O buffer for all following invokations until the machine
is reset or LHAOPTS is changed. If you want to set some
default options that should survive reset and power off, use
the environment variable name `ENVARC:LHAOPTS' instead, like
in:
1> setenv ENVARC:LHAOPTS -b64
This would cause the environment variable LHAOPTS to be set to
`-b64' whenever the machine is rebooted.
V1.38 LhA User's Guide Page 11
2.3 Pattern matching
This section describes how LhA handles pattern matching and
file collection. For a discussion on what commands will accept
file patterns, please refer to section 2.1 (Command line
syntax).
Pattern matching in LhA is always case-insensitive. (i.e. it
doesn't matter if you write names in upper- or lowercase, `a'
will match both `a' and `A'.
2.3.0 Exactly what is pattern matching anyway?
Pattern matching is a means of specifying several files in an
elegant and relatively straightforward manner. Instead of just
lining up all the file names you would like to work on on the
command line (which can be very tedious when a lot of files are
involved) you can use a technique called `pattern matching'.
With this technique you - as the name implies - use the fact that
the names of the files you wish to work on often share certain
characteristics. For example, the names of files containing
C-source almost always end in `.c', so if you would like to add
all C-source files in the current directory you could take
advantage of this fact by specifying a pattern to that matches
these files (in this case such a pattern would be `*.c').
Exactly how these patterns are built up are explained in section
2.3.1 forward. Also read the sections explaining `how to specify
action files' and `how to specify archive files'.
2.3.1 Accepted pattern tokens
LhA accepts all valid KickStart 2.x and 1.x pattern tokens, it
also accepts all ARP tokens (works more or less the same way as
KS2.x).
In the explanations that follow, the term `expression' means
either a single token or character (such as `x' or `?'), or an
alternation (such as `(ab|cd|ef)'), or a character class (such as
`[a-z,A-Z]').
2.3.1.1 Question mark (?)
The question mark matches any one _single_ character. The
question mark is sometimes also referred to as the `wildchar'.
EXAMPLE
`d?' : matches all two-letter names beginning with a `d'
character. For example `dm' or 'd8'.
`ab?d' : matches all four-letter names beginning with `ab' and
ending in `d'. For example `abcd', `abad' and `ab_d'
V1.38 LhA User's Guide Page 12
but not `abd' or `acid'.
`f??' : matches all three-letter names beginning in `f'. For
example `foo', `fel', `fan' but not `ab', `fuga' or
`fini'
2.3.1.2 Star/Asterisk (*)
The star matches any sequence of any length, including
sequences with length zero (i.e. the null string). The `*'
character is often called the `wildcard' character.
EXAMPLE
`a*' : matches all names starting with an `a', for example
`abba', `anette'.
`a*z' : matches `auugaz', `awacz' and `az' and any other names
starting with an `a' and ending in `z'.
`s*f*n' : matches `stefan', `staffan', `steffen', `sfn' or any
other name starting with an `s', followed by any number
(including zero) of arbitrary characters, followed by
an `f', and ending in `n'.
`*.lzh' : matches all names ending in `.lzh'
2.3.1.3 Hash mark (#)
The hash mark matches a subsequent expression (pattern) 0 or
more times. The simplest example of this is `#?' which will
match any filename (equivalent to the `*' token).
EXAMPLE
`#a' : matches any name consisting of the `a' character only.
For example `aaaa' and `a'.
`b#ad' : matches any name beginning in `b', followed by any
number (including 0) of `a' characters, and ending in
`d'. For example `bad', `bd' and `baaaad'.
`#(ha)#(hi)urgh' : of `ha':s followed by any number of `hi':s
followed by `urgh'. For example `hahahahahihiurgh'
matches, and so does `haurgh' and `hahiurgh'.
2.3.1.4 Square brackets ([])
V1.38 LhA User's Guide Page 13
The square brackets enclose a set of characters to match.
They are a bit like the parentheses but match single-characters
only. You can either specify just the letters you would like the
expression to match, as in `[abcx]' (this would match `a', `b',
`c' and `x'), or you can specify ranges, like `[a-c,x-z]' (which
would match `a', `b', `c' and `x', `y', `z').
EXAMPLE
`prg.[1-9]' : matches any five-letter name beginning with
`prg.', followed by a non-zero digit. For example
`prg.1', 'Prg.8'.
`Ver_[1-2].[0-9].[a-z]' : matches any nine-letter name
beginning with `ver_' followed by either a `1' or a `2'
character, followed by a dot (`.'), a digit and finally
a character between `a' and `z' (i.e. all letters in
the english alphabet). For example `Ver_1.2.a',
`Ver_2.9.d'.
`#[a-z 0-9]' matches any name containing any number of
alphanumeric characters (i.e. either in the alphabet
or numeric). For example `ados' or `PDP11'. It does
not match `AXE.dat' however, since it contains a `.'
which is not in the specified character range.
`*.[chas]' : matches any name ending in `.c', `.h', `.a' or
`.s'.
2.3.1.5 Parentheses and the vertical bar
Parentheses can be used to achieve several things. The first
way of using them is just like in mathematics - to group several
individual expressions into one single expression. The other way
is to provide a list of acceptable expressions separated with `|'
chars. The entire parenthesized expression is treated as one
token by other tokens (like `#' and `~'). These two are actually
the same, since the first is just a special case of the second
use. This is easier to explain with a couple of examples:
EXAMPLE
`(abc|def|xyz)' : will match names `abc', `def' and `xyz' and
no other.
`*.(doc|prf|man)' : will match all names ending in `.doc',
`.prf' or `.man'.
`~(pfile)' : will match all names except `pfile'. (NB: this
expression is NOT the same thing as `~pfile', see
section 2.3.1.6 for details)
V1.38 LhA User's Guide Page 14
`(*.c|*.h|*.doc|ab*)' : will match all files ending in `.c',
`.h' or `.doc' and all files beginning with `ab'.
Typing an action-file spec of `(xxx|yyy|zzz)' is functionally
equivalent to writing `xxx yyy zzz' (xxx, yyy, zzz can be any
valid patterns, including patterns with parentheses).
Parentheses can be nested.
2.3.1.6 Tilde (~)
The tilde negates the immediately following expression. It
negates ONLY the immediately following token or paranthesized
expressiom, not the entire following expression as some people
think (see note about ARP<->KS2.0 below).
EXAMPLE
`~x?' : matches any two-letter name except those starting with
`x'. For example `ah', `ko' or 'ba' but not 'x0' or
'xi'.
`~(x?)' : matches anything except two-letter names starting
with `x'. For example `xaa' or `ab' but not `xa' or
'x9'.
`~(#?)' : matches nothing at all. (The tilde negates the
`#?', which matches all names).
`~lha' : matches all strings that doesn't begin with `l', and
ends in 'ha'. For example `uha', `why_lha' but not
'lumbha' or 'lha'.
NOTE
Because of a bug (or misfeature) in ARP, the `~'
token is not correctly handled by LhA when running
under KickStart 1.3 under ARP. Under KS2.x LhA
handles it okay however. In ARP a negation actually
negates the ENTIRE EXPRESSION, so `~lha' matches all
files but `lha'.
2.3.1.7 Percent sign (%)
The percent sign represents the empty string. i.e. it
matches 0 characters always. It is only useful in parenthesized
expressions and must not follow a the `#' token (`#%' would be a
rather pointless pattern, since the % always matches exactly 0
V1.38 LhA User's Guide Page 15
characters).
EXAMPLE
`lha(.doc|.man|%)' : matches `lha.doc', `lha.man' and `lha'.
`l%u%a' : matches `lua' only; the percent signs are totally
irrelevant here and may just as well be omitted.
2.3.2 KS1.3 ARP and KS2.x pattern matching
When running LhA (and other programs for that matter) under
KickStart 2.x, the `*' (star) wildcard will be enabled on program
startup. The initial state of the WILDSTAR flag will not be
reset. If arp.library is not available when running under
KickStart 1.3 LhA will use its internal pattern matching
routines, which only recognizes the `*' and `?' tokens.
2.3.3 National characters
LhA correctly converts national characters to lower- or
uppercase when the `-Qn' option is enabled. This causes some
trouble on older versions of the KickStart since these did not
correctly convert national characters to uppercase when
calculating the filename hash value. The `-Qn' option should not
be used on OFS or FFS disks.
V1.38 LhA User's Guide Page 16
2.4 Commands
This section describes the commands for archive manipulation
and maintenance LhA provides. See section 2.1.2 (Specifying
commands) for details on how to specify commands on the command
line.
2.4.1 `a' Add files to archive
Obviously, this command adds a number of files to one or more
archives. If the specified archive does not already exist, then
it will be created. You cannot add files to an archive if these
already exist in the archive. If you attempt to do so, a warning
will be issued, but LhA will continue adding the other files you
have specified.
Only the filenames are stored by default, if you want to
preserve some disk structure and directory names, you will have
to use the -x option to turn path preservation on. If you want to
archive entire subdirectories recursively you can use the -r
option, which will turn on the -x option automatically. These
options are explained in section 2.5.
EXAMPLE
`LhA a myarchive dict.txt' would add the file `dict.txt' to
the archive `myarchive.lha'.
`LhA a arc.lzh *.c *.h' would cause all files in the current
directory ending in `.c' or `.h' to be added to the archive
`arc.lzh'
`LhA -r -0 arch *.c' would cause all `.c' files in the current
directory and all it's subdirectories to be added to the
archive `arch.lzh' using the -lh1- (LhArc 1.x) compression