OSDN Git Service

Initial revision
authorarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sat, 28 Aug 1999 16:36:15 +0000 (16:36 +0000)
committerarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sat, 28 Aug 1999 16:36:15 +0000 (16:36 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@3 6a8cc165-1e22-0410-a132-eb4e3f353aba

37 files changed:
CHANGES.euc [new file with mode: 0644]
MACHINES.euc [new file with mode: 0644]
MACHINES2.euc [new file with mode: 0755]
Makefile [new file with mode: 0644]
PROBLEMS.euc [new file with mode: 0644]
README.euc [new file with mode: 0644]
change-114e.txt [new file with mode: 0644]
change-114f.txt [new file with mode: 0644]
config.eng [new file with mode: 0644]
config.jpn.euc [new file with mode: 0644]
header.doc.euc [new file with mode: 0644]
man/Makefile [new file with mode: 0644]
man/lha.man [new file with mode: 0644]
man/lha.n [new file with mode: 0644]
src/Makefile [new file with mode: 0644]
src/append.c [new file with mode: 0644]
src/crcio.c [new file with mode: 0644]
src/dhuf.c [new file with mode: 0644]
src/extract.c [new file with mode: 0644]
src/header.c [new file with mode: 0644]
src/huf.c [new file with mode: 0644]
src/larc.c [new file with mode: 0644]
src/lha.h [new file with mode: 0644]
src/lha_macro.h [new file with mode: 0644]
src/lhadd.c [new file with mode: 0644]
src/lharc.c [new file with mode: 0644]
src/lhdir.c [new file with mode: 0644]
src/lhdir.h [new file with mode: 0644]
src/lhext.c [new file with mode: 0644]
src/lhlist.c [new file with mode: 0644]
src/makefile.dj [new file with mode: 0644]
src/maketbl.c [new file with mode: 0644]
src/maketree.c [new file with mode: 0644]
src/patmatch.c [new file with mode: 0644]
src/shuf.c [new file with mode: 0644]
src/slide.c [new file with mode: 0644]
src/util.c [new file with mode: 0644]

diff --git a/CHANGES.euc b/CHANGES.euc
new file mode 100644 (file)
index 0000000..d81eba7
--- /dev/null
@@ -0,0 +1,169 @@
+/* CHANGES (In Japanese) */
+LHx 0.01 -> 0.02
+
+       Usage ¤Î f ¥ª¥×¥·¥ç¥ó¤ÎÀâÌÀɽ¼¨¤¬¤º¤ì¤ë¤Î¤òľ¤·¤¿¡£
+       lhadd.c ¤Î 49 ¹ÔÌܤΠWarning (&hdr->method)¤ò½¤Àµ¤·¤¿¡£
+       strucmp.c ¤Î toupper() ¤ò static ´Ø¿ô¤ËÊѹ¹¤·¤¿¡£
+       lharc.h ¤Î malloc(),realloc() ¤ÎÊÖ¤êÃͤÎÀë¸À(Warning)¤ò½¤Àµ¡£
+       lhadd.c ¤Î 336 ¹ÔÌܤΠcopyfile() ¤ËÂè4°ú¿ô 0 ¤òÄɲá£
+       malloc ´ØÏ¢¤Î Warning ¤ò½¤Àµ(cast)¤·¤¿¡£
+       patmatch.c ¤Î toupper ¤ò¹Ô¤Ê¤¦¾ò·ï¤Ë islower() ¤òÄɲá£
+       stdlib.h ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë²Õ½ê¤Ë || defined(sony_news) ¤òÄɲá£
+       -lh0- ¤Î¥Õ¥¡¥¤¥ë¤ò¥Æ¥¹¥È¤¹¤ë¤ÈÆâÍƤòɽ¼¨¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+       Å¸³«»þ¥Ø¥Ã¥À¥ì¥Ù¥ë1¤ËÂбþ¤·¤¿¡£
+       crcio.c ¤Ç putc() ¤ÎÂå¤ï¤ê¤Ë fwrite() ¤ò»ÈÍѤ¹¤ë¤è¤¦Êѹ¹¡£
+       _errmsg() ¤ò»ÈÍѤ·¤Ê¤¤¤è¤¦Êѹ¹¡£
+       ÀÐÀî@»°É©Åŵ¡¤µ¤ó¤Î rename.c ¤òÉÕ°¡£
+       memset() ¤Î¤Ê¤¤¥Þ¥·¥ó¤Î¤¿¤á¤Ë memset.c ¤òÄɲá£(½ñ¤­²¼¤í¤·)
+
+LHx 0.02 -> LHa 0.03
+       Ì¾¾Î¤ò LHx ¤«¤é LHa ¤ËÊѹ¹¡£
+       owner ¤¬ root ¤Î¤È¤­¤Î¤ß chown() ¤¹¤ë¤è¤¦Êѹ¹¡£
+       ËÜ´ÖδǷ¤µ¤ó¤Î timezone ´Ø·¸¤Î¥Ñ¥Ã¥Á¤ò´Þ¤á¤¿¡£
+       lharc.c ¤Î135 ¹ÔÌܤò #endif /* MULTIBYTE_CHAR */ ¤ËÊѹ¹¡£
+       g option »ÈÍÑ»þ¤Ë¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤ò°µ½Ì¤Ç¤­¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£
+       z option ¤Ê¤·¤Çɸ½àÆþÎϤ«¤é¥Õ¥¡¥¤¥ë̾¤òÆɤ߹þ¤à¤è¤¦¤ËÊѹ¹¡£
+       put_indicator() ¤ò append.c ¤«¤é crcio.c ¤Ë°Ü¤·¤¿¡£
+       crcio.c ¤Ç fwrite() ¤ÎÊÖ¤êÃͤÎÈæ³ÓÂоݤò EOF ¤«¤é 0 ¤Ë½¤Àµ¡£
+       ¥¢¡¼¥«¥¤¥Ö̾¤Ë - ¤ò»ÈÍѤ¹¤ë¤³¤È¤Çɸ½àÆþ½ÐÎϤòÍøÍѲÄǽ¤Ë¤·¤¿¡£
+       ÁÒÅç@ÅìÂ礵¤ó¤Î EUC ¥Ñ¥Ã¥Á¤ò´Þ¤á¤¿¡£
+       ¥Ø¥Ã¥À´Ø·¸¤ò lharc.c ¤«¤éʬΥ¤· header.c ¤È¤·¤¿¡£
+       archive_is_msdos_sfx1() ¤È skip_msdos_sfx1_code() ¤ò util.c ¤Ë°Ü¤·¤¿¡£
+       °µ½Ì¤ª¤è¤ÓŸ³«¤ò¥Ø¥Ã¥À¥ì¥Ù¥ë1,2 ¤ËÂбþ¡£
+       ¥Ç¥Õ¥©¥ë¥È¤Î¥Ø¥Ã¥À¥ì¥Ù¥ë¤ò 1 ¤ËÊѹ¹¡£
+       ¥Ç¥Õ¥©¥ë¥È¤Î°µ½ÌÊý¼°¤ò -lh5- ¤ËÊѹ¹¡£h ¥ª¥×¥·¥ç¥ó¤òÇѻߡ£
+       Ìµ°µ½Ì³ÊǼ(z)¥ª¥×¥·¥ç¥ó¤òÄɲá£
+       LHarc ¸ß´¹·Á¼°°µ½Ì(o)¥ª¥×¥·¥ç¥ó¤òÄɲá£
+       É¸½àÆþÎϤΥê¥À¥¤¥ì¥¯¥È»þ¤Ë¥ª¡¼¥Ð¡¼¥é¥¤¥È³Îǧ¤ò¤·¤Ê¤¤¤è¤¦Êѹ¹¡£
+       uchar,ushort,uint,ulong ¤ò»ÈÍѤ·¤Ê¤¤¤è¤¦Êѹ¹¡£typedef.h ¤òºï½ü¡£
+
+LHa 0.03 -> LHa 0.04 (beta)
+       -lh0- file ¤Ç e, t option ¤òÍ­¸ú¤Ë¤·¤¿¡£(by ÁÒÅç@ÅìÂ礵¤ó)
+       °ú¿ô¤Ë¥¢¡¼¥«¥¤¥Ö¤Î¤ß»ØÄê»þ¤Ë list É½¼¨¤¹¤ë¤è¤¦Êѹ¹¡£(by ÁÒÅç@ÅìÂ礵¤ó)
+       -DMKTIME ¤Ç¥¿¥¤¥à¥¹¥¿¥ó¥×¤¬Àµ¾ï¤Ç¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£(by ÅÏî´@ÅìËÌÂ礵¤ó)
+       NEED_INCREMENTAL_INDICATOR ÀßÄê»þ¤ÎÊÑ¿ôÀë¸À¤òÄɲä·¤¿¡£
+       lhadd.c ¤Î encode_stored_crc() ¤ÎÀë¸À¤ÎÄÖ¤ò½¤Àµ¤·¤¿¡£(by ËÜ´ÖδǷ¤µ¤ó)
+       NULL ¤¬ 0 ¤Ç¤Ê¤¯¤Æ¤âÆ°ºî¤¹¤ë¤è¤¦ slide.c ¤òÊѹ¹¤·¤¿¡£
+       header.c ¤Î fwrite() ¤ÇÊÖ¤êÃͤò NULL ¤Ç¤Ï¤Ê¤¯ 0 ¤ÈÈæ³Ó¤¹¤ë¤è¤¦Êѹ¹¡£
+       °µ½Ì·Á¼°¤¬Àµ¤·¤¯¤Ê¤¤»þ Segmentation fault ¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+       ¥Ç¥£¥ì¥¯¥È¥ê¤Î°µ½Ì·Á¼°¤ò -lhd- ¤Ë¤¹¤ë¤è¤¦Êѹ¹¡£
+       strdup.c ¤Î strlib.h Æɤ߹þ¤ß¤Î¾ò·ï¤ò½¤Àµ¡£
+       header level 2 ¤Ç°µ½Ì¤Ç¤­¤Ê¤¤¥Ð¥°¤ò½¤Àµ¤·¤¿¡£
+       386MINIX ¤ËÂбþ¡£(by youchan@Æü·ÐMIX ¤µ¤ó)
+       ¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¢¡¼¥«¥¤¥Ö¤ÈƱ̾¤Î¥Õ¥¡¥¤¥ë¤ò°µ½Ì¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿¡£
+       -DNOFTRUNCATE ¤ÇÀÐÀî@»°É©Åŵ¡¤µ¤ó¤Î rename() ¤ò»È¤¦¤è¤¦Êѹ¹¡£
+       TITAN ¤Ç¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤ë¤è¤¦(?) lharc.h ¤òÊѹ¹¡£
+
+LHa 0.04 -> LHa 0.05
+       append.c ¤Ç»ÈÍѤ·¤Æ¤¤¤¿ ushort ¤ò unsigned short ¤Ë½¤Àµ¡£
+       ÆüÉÕ¤Îǯ¤ò 1991 ¤«¤é 1992 ¤Ë½¤Àµ¡£
+       -DFTIME, -DTIMELOCAL ¥Ñ¥Ã¥Á¤òÄɲá£(by ËÜ´ÖδǷ¤µ¤ó)
+       ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î¥µ¥Õ¥£¥Ã¥¯¥¹¤òÁªÂò²Äǽ¤Ë¤·¤¿¡£
+       -DNOMKDIR ¥Ñ¥Ã¥Á¤òÄɲá£(by ÀÐÀî@»°É©Åŵ¡¤µ¤ó)
+       É¸½àÆþÎϤ«¤é¤Î¥Õ¥¡¥¤¥ë̾¤ÎÆþÎÏ¿ô¤ò̵À©¸Â¤Ë¤·¤¿¡£(by º´Æ£ ¼£@PFU¤µ¤ó)
+       rename.c, strdup,c, strucmp.c, memmove.c ¤ò util.c ¤Ë½¸¤á¤¿¡£
+       archive file ¤Î suffix ¤¬ .lzh ¤Ë«Çû¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+       slidehuf.h ¤Î __STDC__ ¤ÎÉôʬ¤Ë AIX ¤ÎȽÄê¤òÄɲä·¤¿¡£
+       slidehuf.h,intrface.h ¤Î´Ø¿ôÀë¸À¤Ë extern ¤òÄɲä·¤¿¡£
+
+LHa 0.05 -> LHa 0.06
+       USESTRCASECMP ¤òÄɲä·¡¢strucmp ¤ÎÄêµÁ¤ò #ifndef ¤Ç³ç¤Ã¤¿¡£
+       #elif ¤Ê¤É¤ò»ÈÍѤ·¤Ê¤¤¤è¤¦Êѹ¹¡£
+       Makefile ¤ò¥È¥Ã¥×¥Ç¥£¥ì¥¯¥È¥ê¤ËÍÑ°Õ¡£
+       NEED_INCREMENT_INDICATOR ÄêµÁ¤Ç z option »ÈÍÑ»þ¤Î¥Ð¥°¤òÂ༣¡£
+       header level 2 ¤Î¥Ø¥Ã¥À¥µ¥¤¥º¤¬¿©¤¤°ã¤¦¥Ð¥°¤ò½¤Àµ¡£
+       maketree.c ¤Ç defined(_MINIX) ¤¬ÌµÂ̤ȤΤ³¤È¤Ê¤Î¤Çºï½ü¡£
+
+LHa 0.06 -> LHa 1.00
+       °µ½Ì¥µ¥¤¥º¤ÎȽÄê¥ë¡¼¥Á¥ó¤Î¥Ð¥°¤ò½¤Àµ¡£
+       NOMEMSET ¤òÍÑ°Õ¤·¡¢memset() ¤ò util.c ¤Ë°Ü¤·¤¿¡£
+
+LHa 1.00 -> LHa 1.10
+       lharc.h ¤Î FILE ATTRIBUTES ¤Ë is_symlink ¤òÄɲá£
+       lhadd.c ¤Î append_it()´Ø¿ô ¤Î stat ¤ò lstat ¤ËÊѹ¹¤·¡¢½èÍý¤òÄɲä·¤Æ
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤ËÂбþ¤·¤¿¡£
+       ¡Ê¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤ÈƱ¤¸°·¤¤¤Ë¤Ê¤Ã¤Æ¤Þ¤¹¡£¡Ë
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤ËÂбþ¤µ¤»¤ë¤¿¤á lhlist.c ¤òÊѹ¹¤·¤Æ¡¢°µ½Ì¥Õ¥¡¥¤¥ëÆâ
+       ¤Î¥ê¥¹¥Èɽ¼¨¤ÎºÝ¤Ë¡¢ls -al ¤ÈƱ¤¸¤è¤¦¤Êɽ¼¨¤ËÊѹ¹¡£
+       °µ½Ì¥Õ¥¡¥¤¥ëÆâ¤Î¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ëºÝ¤Ë¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¥Õ¥¡¥¤¥ë̾¤òɽ¼¨
+       ¤¹¤ë¤è¤¦¤ËÊѹ¹¡£ (quiet ¥ª¥×¥·¥ç¥ó²Ä¡Ë
+       w ¥ª¥×¥·¥ç¥ó¡Ê¥ï¡¼¥¯¥Ç¥£¥ì¥¯¥È¥ê¤Î»ØÄê¡Ë¤ò°µ½Ì¤ÎºÝ¤Î¥ï¡¼¥¯¥Ç¥£¥ì¥¯¥È¥ê
+       ¤ò»ØÄê²Äǽ¤ËÊѹ¹¡£
+
+LHa 1.10 -> LHa 1.11
+       lhext.c ¤Î inquire_extract() ¤Î´Ø¿ô¤Ë 'S'(Skip) ¤òÄɲá£
+       Å¸³«»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×°ì±þÈæ³ÓÂбþ¡£
+
+LHa 1.11 -> LHa 1.12
+       ¥¿¥¤¥à¥¹¥¿¥ó¥×Âбþ¤Î¤¿¤á¡¢extract_one¡Ê) ¤Î´Ø¿ô¤ÎŸ³«»þ¤Î½èÍý¤òÂçÉýÄɲá£
+       ¥í¡¼¥«¥ëÊÑ¿ô¡¢skip_flg (FALSE..No Skip , TRUE..Skip)¤òÄɲá£
+
+LHa 1.12 -> LHa 1.13
+       S_IFLNK ¤Î¥Þ¥¯¥í¤¬¤¢¤Ã¤¿¤Î¤ÇÂбþ¤¹¤ë¤è¤¦¤ËÊѹ¹¡£¡¡¤³¤Î¤³¤È¤Ë´ØÏ¢¤·¤Æ
+       lhadd.c ¤Î append_it()´Ø¿ô ¤Î lstat ¤ò GETSTAT ¤ËÊѹ¹¤·¤¿¡£
+       Ä¹¤¤¥Õ¥¡¥¤¥ë̾¤Î»þ¤Ë¡¢core dump ¤¹¤ë¤Î¤Ï append.c ¤Î MAX_INDICATOR_COUNT
+       ¤Î m ¤ÎÃͤ¬£°¤Ë¤Ê¤Ã¤Æ¤¤¤¿¤Î¤Ç¡¢if Ê¸¤Î (m<0) ¤ò (m<1) ¤Ë½¤Àµ¡£
+
+LHa 1.13 -> LHa 1.13a
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¥Õ¥¡¥¤¥ë¤¬¥¿¡¼¥²¥Ã¥È¤È¤Ê¤Ã¤¿¾ì¹ç¤Ë¡¢append_it ¤Î
+       fclose(fp) ¤¬¡¢fp == NULL ¤È¤Ê¤Ã¤Æ¤¤¤¿¤¿¤á¤Ë core dump ¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬¡¢¥¿¡¼¥²¥Ã¥È¥Õ¥¡¥¤¥ë¤ò¤Ê¤Ã¤¿ºÝ¤Ë¤¦¤Þ¤¯ºï½ü¤Ç¤­¤Ê¤¤
+       Bug ¤ò½¤Àµ¡£(by ¤¢¤Ë¤£ ¤µ¤ó¡Ë
+       
+LHa 1.13a -> LHa 1.13b
+       °µ½Ì¤ÎºÝ¤Ë¹¹¿·¤·¤Æ¤Ê¤¤¤Î¤Ë¡¢Symblic Link ¤Î¥Õ¥¡¥¤¥ë̾¤Î¤ß¾ï»þɽ¼¨¤·¤Æ
+       ¤¤¤¿.
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¥Õ¥¡¥¤¥ë¤ò¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤«¤é¥ê¥ó¥¯Ì¾¤Çºï½ü¤Ç¤­¤Ê¤«
+       ¤Ã¤¿.
+       Symbolic Link Àè¤Î¥Õ¥¡¥¤¥ë̾¤ò¼èÆÀ¤¹¤ëºÝ¤Ë¡¢¼ºÇÔ¤·¤Æ¤¤¤¿.
+       Å¸³«»þ¤Ë¡¢Symbolic Link ¥Õ¥¡¥¤¥ë¤Î¤ß¥¿¥¤¥à¥¹¥¿¥ó¥×Èæ³Ó¤ò˺¤ì¤Æ¤¤¤¿.
+       °Ê¾å¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¥Õ¥¡¥¤¥ë´Ø·¸¤Î Bug ¤ò½¤Àµ¤·¤¿.
+
+       q Option ¤Ç¡¢INDICATOR ¤ò²ÄÊѤ˽ÐÍè¤ë¤è¤¦¤ËÊѹ¹.
+       t option ¤ò»ÈÍѤ¹¤ë¤È CRC Error ¤Ç Test ¤È extract ¤¬¤Ç¤­¤Ê¤¤ Bug ¤È
+       Header Level 2 ¤Î½ñ¸Ë¤¬ MS_DOS ÈÇ LHa ¤Ç²òÅà¤Ç¤­¤Ê¤¤ Bug ¤È
+       -1 -2 ¤È -g Option ¤ÎÊ»ÍѤ¬½ÐÍè¤Ê¤¤ Bug ¤ò½¤Àµ. (by ²¬ËÜ@ËÌÂç¡Ë
+
+    ¤Þ¤¿¡¢Makefile Ãæ¤Î µ¡¼ï°Û¸¥Þ¥¯¥í¤Îµ­½Ò¾ì½ê¤ò SWITCHES ¤«¤é MACHINE
+       ¤ËÊѹ¹¤·¤Þ¤·¤¿.   
+
+LHa 1.13b -> LHa 1.13c
+       Å¸³«¤ÎºÝ¤Ë¡¢¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Æ¤¤¤ë¤È³Îǧ¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë¤¬
+       ¤½¤Î¥Õ¥¡¥¤¥ë¤Î¤É¤Î¹àÌܤòÁª¤ó¤Ç¤â°ì¤ÄÌܤÏŸ³«¤µ¤ì¤Æ¤·¤Þ¤¦ Bug ¤ò
+       ½¤Àµ.
+
+LHa 1.13c -> LHa 1.14
+       µ¤¤Þ¤°¤ì¤Ç¡¢-lh6- ¤ÎŸ³«¤Î¤ß½ÐÍè¤ë¤è¤¦¤Ë½èÍý¤òÄɲá£
+       ¥½¡¼¥¹¥ê¥¹¥È¤Î¸«Ä¾¤·¤ò¹Ô¤Ã¤¿¡£
+
+LHa 1.14 -> LHa 1.14a (°Ê²¼ t.okamoto)
+       °µ½Ì½ñ¸Ë¤òºî¤ì¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£
+       
+LHa 1.14a -> LHa 1.14b
+       ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ÎÀ褬¸ºß¤·¤Ê¤¤»þ¡¢½ñ¸Ë¤ËÄɲäǤ­¤Ê¤¤¥Ð¥°¤ò
+       ½¤Àµ¤·¤¿¡£½ñ¸Ë¤Ë¸ºß¤¹¤ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¥Õ¥¡¥¤¥ë¤ÈƱ̾¤Î¥Õ¥¡
+       ¥¤¥ë¤ò½ñ¸Ë¤ËÄɲ䷤褦¤È¤·¤Æ¤â¡¢ÄɲäǤ­¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£
+       ¤Þ¤¿¡¢¤¤¤¯¤Ä¤«¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯´Ø·¸¤Î¥Ð¥°¤ò½¤Àµ¤·¤¿¡£
+
+LHa 1.14b -> LHa 1.14c
+       Á°¥Ð¡¼¥¸¥ç¥ó¤Î¥Ð¥°½¤Àµ¤ÎºÝ¤Ë¡¢¿·¤¿¤Ê¥Ð¥°¤òÉղ䷤Ƥ·¤Þ¤Ã¤¿ÅÀ¤ò
+       ½¤Àµ¤·¤¿¡Êlhadd.c¡Ë¡£
+       ½ñ¸ËÆâ¤Î¥Õ¥¡¥¤¥ëɽ¼¨¤ÎºÝ¡¢setuid ¤·¤Æ¤¢¤ë¾ì¹ç 's' ¤Î¥Õ¥é¥°¤ò
+       ¸«¤¨¤ë¤è¤¦¤Ë¤·¤¿¡£
+       °ìÉô¥½¡¼¥¹¤Î void ¤ò¥³¥á¥ó¥È¤Ëľ¤·¤Æ²þÎɤò¹Ô¤Ê¤Ã¤¿¡£
+       LHa 1.00 ¤ËÆþ¤Ã¤Æ¤¤¤¿ config.eng ¤òÆþ¤ìľ¤·¤¿¡£
+
+LHa 1.14c -> LHa 1.14d
+       FreeBSD ¤Ç¤Î¥Ð¥°¤Î½¤Àµ¡£MS-DOS ¤ÇºîÀ®¤·¤¿½ñ¸Ë¤Î¥Õ¥¡¥¤¥ë¥¹¥¿¥ó¥×¤¬
+       ¤º¤ì¤Æɽ¼¨¤µ¤ì¤ë¥Ð¥°¤ò½¤Àµ¤·¤¿(header.c)¡£SWITCHES ¤Ë HAVE_TM_ZONE
+       ¤òÄɲ乤뤳¤È¤Ç¥Ð¥°¤Ï½¤Àµ¤µ¤ì¤ë¡£(by yav ¤µ¤ó)
+       Æó½ÅÄêµÁ¤ò¤·¤Æ¤¤¤¿Éôʬ¤ò½¤Àµ¡£Æó½ÅÄêµÁ¤òȯ¸«¤Ç¤­¤ë¥³¥ó¥Ñ¥¤¥é¡¼¤Ç
+       ¥¨¥é¡¼¤Þ¤¿¤Ï·Ù¹ð¤¬¤¿¤¯¤µ¤ó½Ð¤ë¤È¤¤¤¦¤³¤È¤Ï¡¢Ìµ¤¯¤Ê¤Ã¤¿¤È»×¤¤¤Þ¤¹¡£
+
+        -lh6- °µ½Ì·Á¼°¤Î°µ½Ì¤ò²Äǽ¤Ë¤·¤Þ¤·¤¿¡£°µ½Ì¥¢¥ë¥´¥ê¥º¥à¤Ë hash Ë¡
+        ¤ò»È¤Ã¤¿Êª¤ËÊѹ¹¤·¤Þ¤·¤¿¡£
+
+        ³«È¯´Ä¶­¤ò FreeBSD ¤Ë¤·¤Þ¤·¤¿¡£
+
+LHa 1.14d -> LHa 1.14e
+       change-114e.txt¤Ëµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£
diff --git a/MACHINES.euc b/MACHINES.euc
new file mode 100644 (file)
index 0000000..8fef3d2
--- /dev/null
@@ -0,0 +1,454 @@
+----------------------------------------------------------------
+¼Ò̾           Sun Microsystems
+¥Þ¥·¥ó         Sun3/80,SPARCstation
+OS             SunOS 4.0.3, 4.1.1, 4.1.2, 4.1.3(+JLE)
+Compiler       cc,gcc -traditional
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DFTIME -DUSESTRCASECMP ¤òÄɲÃ
+È÷¹Í           sun
+---------------------------------------------------------------
+¼Ò̾           Åì¼Ç
+¥Þ¥·¥ó         AS3000
+OS             AS3.3(SunOS 3.3)
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSTRDUP ¤òÄɲÃ
+È÷¹Í           sun
+----------------------------------------------------------------
+¼Ò̾           SONY
+¥Þ¥·¥ó         NWS-1460/1750
+OS             NEWS-OS 3.3a, 3.4
+Compiler       cc,gcc -traditional
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           sony_news
+----------------------------------------------------------------
+¼Ò̾           SONY
+¥Þ¥·¥ó         NWS-1830/1850
+OS             NEWS-OS 4.0.1C/4.1C
+Compiler       cc,gcc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           sony_news
+----------------------------------------------------------------
+¼Ò̾           SONY
+¥Þ¥·¥ó         NWS-3260/3460/3860
+OS             NEWS-OS 3.91R/4.1R
+Compiler       cc,gcc version 1.40
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           sony_news
+---------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         SX-9100 Mr.
+OS             UniOS-U/Sigma 1.40
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSG -DSYSTIME_HAS_NO_TM -DNOBSTRING -DNOINDEX
+               -DNOSTRDUP -DNODIRECTORY -DNOFTRUNCATE -Zu ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         LUNA (SX-9100/DT)
+OS             UNIOS-B 1.50,2.00
+Compiler       /bin/cc,gcc version 1.40
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DFTIME -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+---------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         LUNA-II
+OS             Mach 2.5 Vers 1.40
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP -DFTIME -DUSESTRCASECMP ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         LUNA-88K
+OS             Mach 2.5 vers 1.33
+Compiler       /bin/cc,gcc-1.40
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DFTIME -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         LUNA(SX-9100DT)
+OS             UniOS-U/Sigma 2.01
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -Zu -DSYSV_SYSTEM_DIR -DSYSTIME_HAS_NO_TM
+               -DNOFTRUNCATE -DNOSTRDUP -DNOBSTRING -DUSG -DNOINDEX ¤òÄɲÃ
+È÷¹Í           uniosu
+----------------------------------------------------------------
+¼Ò̾           OMRON
+¥Þ¥·¥ó         SX-9100¦²
+OS             OMRONIX-¦²
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -Zu -DNONSYSTEM_DIR_LIBRARY -DSYSTIME_HAS_NO_TM
+               -DNOFTRUNCATE -DNOBSTRING -DUSG -DNOINDEX ¤òÄɲÃ,LIBRARYOBJS
+               ¤Ë lhdir.o ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NeXT
+¥Þ¥·¥ó         NeXT station/Cube
+OS             NeXT OS 2.1, 2.1J
+Compiler       /bin/cc NeXT Release 2.0
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           DEC
+¥Þ¥·¥ó         DEC5100,DEC Station 3100,MicroVAX-3600
+OS             ULTRIX V4.0, 4.1, 4.2
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSESTRCASECMP -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           ultrix
+----------------------------------------------------------------
+¼Ò̾           Panasonic
+¥Þ¥·¥ó         BE
+OS             BE-OS 1.3
+Compiler       gcc version 1.37.1
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DSYSTIME_HAS_NO_TM -DTZSET
+               -DNOFTRUNCATE ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           MIPS
+¥Þ¥·¥ó         RS3230/3330
+OS             RISC/os 4.51,4.52
+Compiler       /bsd43/bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           Sequent Computer Systems, Inc.
+¥Þ¥·¥ó         Symmetry
+OS             DYNIX(R) V3.0.17.v3 NFS  #2()
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DJIS -DNOSTRDUP -DNOMEMSET ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           Solbourne
+¥Þ¥·¥ó         Series 5/600
+OS             OS/MP 4.0D_Export
+Compiler       cc,gcc -traditional
+Êѹ¹»ö¹à
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           »°É©Åŵ¡
+¥Þ¥·¥ó         ME100/200/250/350/400/520/550
+OS             ME/UX C00,C10,C20 (System V/68 Release R3V4)
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DNOFTRUNCATE ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           »°É©Åŵ¡
+¥Þ¥·¥ó         ME1100/1200/1300/1500
+OS             ME/UX (68020) C01ÈÇ (SYSV R2)
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNONSYSTEM_DIR_LIBRARY -DNOFTRUNCATE
+               -DSYSTIME_HAS_NO_TM -DNOBSTRING -DUSG -DNOSTRDUP -DNOMKDIR
+               -DTZSET -DNOINDEX ¤òÄɲÃ,LIBRARYOBJS ¤Ë lhdir.o ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           »°É©Åŵ¡
+¥Þ¥·¥ó         FAS350(FA-workstation)
+OS             ISI-4.3BSD
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DFTIME -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NEC
+¥Þ¥·¥ó         EWS4800/10,20,30,50,60
+OS             EWS-UX/V R8.1
+Compiler       cc,gcc -traditional
+Êѹ¹»ö¹à       SWITCHES ¤Ë -I/usr/ucbinclude -DSYSTIME_HAS_NO_TM -DTZSET
+               -DUSG -DNOINDEX ¤òÄɲÃ,LDFLAGS=-ldir ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NEC
+¥Þ¥·¥ó         EWS4800/220
+OS             EWS-UX/V (Rel 4.0)R2.1
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DMKTIME -DNOINDEX -DSYSV_SYSTEM_DIR -DUSG ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NEC
+¥Þ¥·¥ó         EWS4800/220
+OS             EWS-UX/V (Rel 4.0)R2.1
+Compiler       /usr/ucb/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DMKTIME ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NEC
+¥Þ¥·¥ó         PC-9801
+OS             PC-UX/V R3.2
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOFTRUNCATE  -DTZSET -DSYSV_SYSTEM_DIR
+               -DSYSTIME_HAS_NO_TM -DNOBSTRING -DUSG -DNOINDEX ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           NEC
+¥Þ¥·¥ó         PC-9801
+OS             PC-UX/V R3.0B
+Compiler       cc ¤ª¤è¤Ó gcc-2.0
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSG -DSYSV_SYSTEM_DIR -DSYSTIME_HAS_NO_TM
+               -DTZSET -DNOBSTRING -DNOFTRUNCATE -DNOINDEX ¤òÄɲÃ
+È÷¹Í           gcc ¤Ç¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¾ì¹ç¤Ï¡¢-traditional ¥ª¥×¥·¥ç¥ó¤ò
+               ¤Ä¤±¤ë¡£
+----------------------------------------------------------------
+¼Ò̾           Hewlett Packard
+¥Þ¥·¥ó         HP9000 s300/s400
+OS             HP-UX7.03
+Compiler       cc
+Êѹ¹»ö¹à       EUC ¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï SWITCHES ¤Ë -DNOBSTRING ¤òÄɲá£
+               Shift-JIS ¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏSWITCHES¤Ë -DNOBSTRING ¤òÄɲä·
+               -DEUC ¤òºï½ü¡£
+È÷¹Í           hpux
+----------------------------------------------------------------
+¼Ò̾           Hewlett Packard
+¥Þ¥·¥ó         HP9000 s800
+OS             HP-UX7.00
+Compiler       cc
+Êѹ¹»ö¹à       EUC ¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï SWITCHES ¤Ë -DNOBSTRING ¤òÄɲá£
+               Shift-JIS ¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏSWITCHES¤Ë -DNOBSTRING ¤òÄɲä·
+               -DEUC ¤òºï½ü¡£
+È÷¹Í           hpux
+----------------------------------------------------------------
+¼Ò̾           Hewlett Packard
+¥Þ¥·¥ó         HP9000 s300/s400
+OS             HP-UX8.0
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSESTRCASECMP ¤òÄɲá£Shift-JIS ¤ò»ÈÍѤ¹¤ë¾ì¹ç
+               ¤Ï¤µ¤é¤Ë -DEUC¤òºï½ü¡£
+È÷¹Í           hpux
+----------------------------------------------------------------
+¼Ò̾           Hewlett Packard
+¥Þ¥·¥ó         HP9000 s700
+OS             HP-UX 8.05,8.07
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSESTRCASECMP ¤òÄɲá£Shift-JIS ¤ò»ÈÍѤ¹¤ë¾ì¹ç
+               ¤Ï¤µ¤é¤Ë -DEUC¤òºï½ü¡£
+È÷¹Í           hpux
+----------------------------------------------------------------
+¼Ò̾           Hewlett Packard
+¥Þ¥·¥ó         HP apollo s400t,s25t
+OS             DOMAIN/OS SR10.3
+Compiler       cc Ver 6.8
+Êѹ¹»ö¹à       (SYSTYPE=bsd4.3,ENVIRON=bsd)
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           DOMAIN
+¥Þ¥·¥ó         DN4500F
+OS             DOMAIN/OS SR10.2
+Compiler       cc Ver 6.7
+Êѹ¹»ö¹à       SWITCHES ¤Ë -U__STDC__ ¤òÄɲÃ(SYSTYPE=bsd4.3,ENVIRON=bsd)
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           DOMAIN
+¥Þ¥·¥ó         DSP10000
+OS             DOMAIN/OS SR10.2p
+Compiler       cc Ver 6.7p (PRISM)
+Êѹ¹»ö¹à       SWITCHES ¤Ë -U__STDC__ ¤òÄɲÃ(SYSTYPE=bsd4.3,ENVIRON=bsd)
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           ÆüΩ
+¥Þ¥·¥ó         HIDIC V90/45
+OS             RENIX-V
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DTZSET -DSYSTIME_HAS_NO_TM -DSYSV_SYSTEM_DIR
+               -DNOBSTRING -DUSG -DNOINDEX -DNOFTRUNCATE ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           ÆüΩ
+¥Þ¥·¥ó         2050/32E
+OS             HI-UX (ver.ÉÔÌÀ)
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DTZSET -DSYSTIME_HAS_NO_TM -DSYSV_SYSTEM_DIR
+               -DNOBSTRING -DUSG -DNOINDEX ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           Åì¼Ç
+¥Þ¥·¥ó         J3100SGT
+OS             UX/386 (SysVR3)
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DTZSET -DSYSV_SYSTEM_DIR -DNOBSTRING -DUSG
+               -DNOINDEX -DNOFTRUNCATE ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           ÉÙ»ÎÄÌ
+¥Þ¥·¥ó         G150/160
+OS             SX/G E14
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHIES ¤Ë -DNONSYSTEM_DIR_LIBRARY -DNOSTRDUP -DTZSET
+               -DNOBSTRING -DUSG -DNOINDEX -DNOFTRUNCATE -DSYSTIME_HAS_NO_TM
+               ¤òÄɲÃ,LDFLAGS=-lu ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           ÉÙ»ÎÄÌ
+¥Þ¥·¥ó         VP2200 MODEL 10
+OS             UXP/M V10L10
+Compiler       BSD Compatibility Package ¤Î cc (/usr/ucb/cc)
+Êѹ¹»ö¹à       LDFLAGS=-lucb ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           ÉÙ»ÎÄÌ
+¥Þ¥·¥ó         M¥·¥ê¡¼¥º
+OS             UTS/M V22L20
+Compiler       cc
+Êѹ¹»ö¹à        SWITCHIES ¤Ë -DNODIRECTORY -DNOSTRDUP -DTZSET -DNOBSTRING
+               -DUSG -DNOINDEX -DNOFTRUNCATE -DSYSTIME_HAS_NO_TM¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           PFU
+¥Þ¥·¥ó         Astation 240
+OS             SX/A E60B
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DSYSTEM_HAS_NO_TM -DUSG
+               -DNOINDEX ¤òÄɲÃ
+È÷¹Í           SXA
+----------------------------------------------------------------
+¼Ò̾            PFU
+¥Þ¥·¥ó          A60 / Astation 350
+OS              SX/A  E50/E60B
+Compiler        /bin/cc
+Êѹ¹»ö¹à        SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DNOBSTRING -DNOFTRUNCATE
+               -DUSG -DEUC -DNEED_INCREMENTAL_INDICATOR ¤òÄɲÃ
+È÷¹Í           ËÜÅö¤Ï -DNOFTRUNCATE ¤ÏE50¤Ç¤Î¤ßɬÍ×
+----------------------------------------------------------------
+¼Ò̾           EPSON/NEC/IBM
+¥Þ¥·¥ó         PC-386GE/PC-9801NS/IBM PC-AT
+OS             MINIX 1.5.10 + MIX 386 patch
+Compiler       MIXÈÇgcc
+Êѹ¹»ö¹à       SWITCHES ¤ò -DEUC -DNOSTRDUP -D_MINIX -D_POSIX_SOURCE
+               -DSYSTIME_HAS_NO_TM -DSYSV_SYSTEM_DIR -DNOFTRUNCATE
+               -DNOBSTRING -DUSG -DNOINDEX -DTZSET ¤ËÊѹ¹
+               CC ¤ò gcc ¤ËÊѹ¹
+               OPTIMIZE ¤«¤é -g ¤òºï½ü
+È÷¹Í           (1) maketree.c¤ÇUINT_MAX¤Îɾ²Á¤¬CPP¥¨¥é¡¼¤Ë¤Ê¤Ã¤¿¤é
+               /usr/local/lib/include/gcc-limits.h¤ò
+               /usr/local/lib/include/limits.h¤Ëmv¤Þ¤¿¤Ïln¤¹¤ë¤«¡¢
+               ¤½¤ÎÉôʬ¤Î#if #endif¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤¹¤ë¤³¤È
+       (¤³¤ì¤Ï¡¢MIXÈÇgcc¤ÎÌäÂê¤Ç¤¹¡£ ºÇ¿·ÈÇgcc¤Ç¤Ï²ò·è¤µ¤ì¤Æ¤¤¤Þ¤¹¡£)
+               (2) ¥³¥ó¥Ñ¥¤¥ë¸å°Ê²¼¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¡¢¥á¥â¥ê¥µ¥¤¥º¤ò
+                   Êѹ¹¤¹¤ë¤³¤È
+                       chmem =500000 lha
+----------------------------------------------------------------
+¼Ò̾           Silicon Graphics
+¥Þ¥·¥ó         IRIS200
+OS             IRIX 2.2
+Compiler       /usr/bin/cc
+Êѹ¹»ö¹à
+È÷¹Í
+---------------------------------------------------------------------
+¼Ò̾           Silicon Graphics
+¥Þ¥·¥ó         IRIS 4D/25GT,4D/310GTX
+OS             IRIX System V Release 3.3.1
+Compiler       /usr/bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR  -DNOBSTRING -DNOINDEX ¤òÄɲÃ
+----------------------------------------------------------------
+¼Ò̾           ¥¯¥Ü¥¿¥³¥ó¥Ô¥å¡¼¥¿
+¥Þ¥·¥ó         TITAN3000
+OS             OS 3.0.3,OS 4.1
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOINDEX -DSYSV_SYSTEM_DIR ¤òÄɲÃ
+È÷¹Í           titan
+----------------------------------------------------------------
+¼Ò̾           ¥¯¥Ü¥¿¥³¥ó¥Ô¥å¡¼¥¿
+¥Þ¥·¥ó         TITAN1500
+OS             OS 2.5
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOINDEX -DSYSV_SYSTEM_DIR -DSYSTIME_HAS_NO_TM
+               ¤òÄɲÃ
+È÷¹Í           titan
+----------------------------------------------------------------
+¼Ò̾           ¥¯¥Ü¥¿¥³¥ó¥Ô¥å¡¼¥¿
+¥Þ¥·¥ó         TITAN VISTRA800ex/VISTRA800b
+OS             2.0
+Compiler       /usr/ucb/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DSYSTIME_HAS_NO_TM ¤òÄɲÃ
+È÷¹Í           titan
+----------------------------------------------------------------
+¼Ò̾           IBM
+¥Þ¥·¥ó         RISC System/6000 POWERstation 530
+OS             AIX version 3.1
+Compiler       /bin/cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -D_BSD_INCLUDES -DAIX ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           Convex
+¥Þ¥·¥ó         Mini Super Computer C-201,C-230,C-240
+OS             ConvexOS V.8.1, v9.1.6 (BSD 4.2)
+Compiler       /bin/cc V4.0
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR ¤òÄɲÃ, CC ¤Ë -pcc ¤òÄɲÃ
+È÷¹Í           __convexc__
+----------------------------------------------------------------
+¼Ò̾           ÅÅ»º
+¥Þ¥·¥ó         WORKS-3000, idea 2010
+OS             DEVOS V3 (4.3 More/bsd/NFS)
+Compiler       gcc -traditional  (gcc 1.40)
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DFTIME -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í
+------------------------------------------------------------------------
+¼Ò̾           SONY
+¥Þ¥·¥ó         NWS-1860
+OS             NEWS-OS 4.2.1C
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           sony_news
+------------------------------------------------------------------------
+¼Ò̾           SONY
+¥Þ¥·¥ó         NWS-3870
+OS             NEWS-OS 4.2.1R
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP ¤òÄɲÃ
+È÷¹Í           sony_news
+------------------------------------------------------------------------
+¼Ò̾           ÉÙ»ÎÄÌ
+¥Þ¥·¥ó         DS/90 7750 (Single CPU type)
+OS             UNIX_System_V 4.0.0 V10L20 Y92121
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DEUC -DUSG -DSYSV_SYSTEM_DIR -DNOBSTRING 
+                -DSYSTIME_HAS_NO_TM -DNOINDEX ¤òÄɲÃ
+È÷¹Í
+----------------------------------------------------------------
+¼Ò̾           DEC
+¥Þ¥·¥ó         DECstation 5000/25
+OS             ULTRIX V4.3
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DUSESTRCASECMP -DNOSTRDUP -DNOINDEX
+                               -DNOBSTRING ¤òÄɲÃ
+È÷¹Í           ultrix
+----------------------------------------------------------------
+¼Ò̾           DEC
+¥Þ¥·¥ó         DEC 3000/300
+OS             DEC OSF/1 V1.3A
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR -DNOINDEX -DNOBSTRING ¤òÄɲÃ
+È÷¹Í           osf
+----------------------------------------------------------------
+¼Ò̾           Silicon Graphics
+¥Þ¥·¥ó         INDY, INDIGO, ONYX
+OS             IRIX Release 5.1
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DSYSV_SYSTEM_DIR  -DNOBSTRING -DNOINDEX ¤òÄɲÃ
+----------------------------------------------------------------
+¼Ò̾           Apple
+¥Þ¥·¥ó         Quadra 950
+OS             A/UX 3.0
+Compiler       cc
+Êѹ¹»ö¹à       SWITCHES ¤Ë -DNOSTRDUP  -DTZSET ¤òÄɲÃ
+----------------------------------------------------------------
+¥Þ¥·¥ó         ÉÔÌÀ¡ÊPentium133MHz)
+OS             BSDI BSD/OS 2.0
+Compiler       cc(gcc)
+Êѹ¹»ö¹à       SWITCHES ¤«¤é -DFTIME ¤òºï½ü¤¹¤ë¡£
+----------------------------------------------------------------
+¥Þ¥·¥ó         IBM-PC/AT ¸ß´¹µ¡¡ÊPentium133MHz)
+OS             FreeBSD 2.1.0 Release
+Compiler       gcc
+Êѹ¹»ö¹à       SWITCHES ¤«¤é -DFTIME ¤òºï½ü¤·¡¢
+                -DHAVE_TM_ZONE ¤òÄɲ乤롣
+----------------------------------------------------------------
+¥Þ¥·¥ó         ÉÔÌÀ¡ÊPentium99MHz)
+OS             Linux 1.2.13(POSIX)
+Compiler       cc(gcc)
+Êѹ¹»ö¹à       ÆäËÊѹ¹¤Ê¤·¡£
+----------------------------------------------------------------
+¼Ò̾            Hewlett Packard
+¥Þ¥·¥ó          HP9000 s720
+OS              HP-UX 9.01
+Compiler        c89
+Êѹ¹»ö¹à        SWITCHES ¤Ë -DUSESTRCASECMP ¤òÄɲá£
+                SWITCHES ¤Ë -D_HPUX_SOURCE ¤òÄɲá£
+                Shift-JIS ¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï¤µ¤é¤Ë -DEUC¤òºï½ü¡£
+                OPTIMIZE ¤Ë¤Ï -O ¤À¤±¤ò»ØÄê
+----------------------------------------------------------------
diff --git a/MACHINES2.euc b/MACHINES2.euc
new file mode 100755 (executable)
index 0000000..35d44d9
--- /dev/null
@@ -0,0 +1,96 @@
+----------------------------------------------------------------
+¥Þ¥·¥ó          AT¸ß´¹µ¡ (Pentium 133MHz)
+OS              FreeBSD 2.0.5
+Compiler        gcc 2.6.3
+Êѹ¹»ö¹à        Æäˤʤ·
+È÷¹Í            Ver.1.14dÀ½ºî´Ä¶­
+                Ver.1.14d¤Î¥³¥ó¥Ñ¥¤¥ë
+----------------------------------------------------------------
+¥Þ¥·¥ó          AT¸ß´¹µ¡ (Pentium 100MHz)
+OS              Linux 2.0.20 (POSIX)
+Compiler        gcc version 2.7.2
+Êѹ¹»ö¹à        MACHINE ¤Ë -DSYSV_SYSTEM_DIR  ¤òÄɲÃ
+                OPTIMIZE ¤Ë -m486 ¤òÄɲÃ
+È÷¹Í            Slackware-3.0.0¥Ù¡¼¥¹¤Ç kernel version 2.0.XX
+                ¤¬Æ°¤¯¤è¤¦¤Ë¤·¤¿¥·¥¹¥Æ¥à (libc version 5.2.18)
+                ¥³¥ó¥Ñ¥¤¥ë¤·¤¿Æü: 1996/09/17(²Ð)
+----------------------------------------------------------------
+-- °Ê²¼¡¢1.14d¸ø³«°Ê¸åÊó¹ð
+----------------------------------------------------------------
+   NeXT
+   NeXTStationTurbo Color
+   NeXTSTEP Release 3.3J 
+   cc ( ¥·¥¹¥Æ¥àɸ½à gcc 2.4.5ÁêÅö) 
+   SWITHES¤Ë -DNOSTRDUP -DUSESTRCASECMP ¤òÄɲÃ
+   ¤Þ¤¿¡¢4way-MABºîÀ®¤Î°Ù¡¢ CC ¤Ë
+   -arch m68k -arch i386 -arch hppa -arch sparc¤òÄɲÃ
+    ( »î¤·¤Æ¤Ï¤¤¤Þ¤»¤ó¤¬¡¢¤³¤Î¥Ð¥¤¥Ê¥ê¤Ç Intel, PA-RISC, SPARCÍѤÎ
+       NeXTSTEP/OPENSTEP for Mach¤Ç¤â²ÔÆ°¤¹¤ë¤Ï¤º¤Ç¤¹ )
+----------------------------------------------------------------
+   NEC
+   EWS4800/320PX ( and 310PX )
+   EWS-UX/V R11.4
+   /usr/abiccs/bin/cc
+   SWITCHES ¤Ë -DNOINDEX -DMKTIME -DSYSV_SYSTEM_DIR ¤òÄɲÃ
+   ¤Þ¤¿ OPTIMIZE¤ò -O -Kmips2¤ËÀßÄê
+   -Kmips2¤Ï mips2¤ËºÇŬ²½¤¹¤ë¤¿¤á¡¢R3000·Ï¤ÎCPU¤ò»È¤Ã¤¿¥Þ¥·¥ó¤Ç¤Ï
+   ²ÔÆ°¤·¤Ê¤¤¥Ð¥¤¥Ê¥ê¤òºîÀ®¤·¤Þ¤¹¡£
+----------------------------------------------------------------
+¥á¡¼¥«¡¼¡§ ÉÔÌÀ
+¥Þ¥·¥ó  ¡§ SGI CRAY Origin 2000
+OS      ¡§ IRIX 6.4
+¥ª¥×¥·¥ç¥ó MACHINE¤«¤é-DHAVE_TM_ZONE¤ò½ü¤­¤Þ¤·¤¿¡£
+----------------------------------------------------------------
+¥Þ¥·¥ó        SGI O2
+OS           IRIX 6.5 + WorldView Japanese 6.5
+SWITCHES     = -DEUC
+MACHINE      = -DNOINDEX -DSYSTIME_HAS_NO_TM -DSYSV_SYSTEM_DIR -n32 -mips3
+OPTIMIZE     = -O2
+È÷¹Í         -DNOINDEX ¤òÉÕ¤±¤Ê¤¤¤È¥Ç¥ê¥ß¥¿¤ò´Þ¤à¥Ñ¥¹¤¬¤¦¤Þ¤¯½ñ¤±¤Þ¤»¤ó¡£
+----------------------------------------------------------------
+¥Þ¥·¥ó          AT¸ß´¹µ¡ (Pentium III 500MHz)
+OS              Solaris 2.7 (x86)
+Compiler        gcc version 2.8.1
+Êѹ¹»ö¹à        SWITCHES ¤Ë -DFTIME
+                            -DUSESTRCASECMP ¤òÄɲÃ
+                MACHINE ¤Ë -DSYSV_SYSTEM_DIR ¤òÄɲÃ
+                OPTIMIZE ¤Ë -m486 ¤òÄɲÃ
+È÷¹Í            make install »þ¤Ë
+                  "/usr/sbin/install"¤Ç¤Ï¥¨¥é¡¼¡£
+                  "/usr/ucb/install"¤ò»ÈÍÑ¡£
+                ¤³¤ì¤Ï Solaris Á´È̤Υ¤¥ó¥¹¥È¡¼¥ë»þ¤ÎÌäÂê¡£
+----------------------------------------------------------------
+¥Þ¥·¥ó         ?
+OS             Linux 2.2.x
+Compiler       gcc version egcs-2.91.66 19990314 (egcs-1.1.2 rel)
+Êѹ¹»ö¹à       -DHAVE_TM_ZONE ¤ò¾Ã¤·¤Æ -DMKTIME ¤òÆþ¤ì¤ë
+
+----------------------------------------------------------------
+¼Ò̾           Sun Microsystems
+¥Þ¥·¥ó         Ultra
+OS             Solaris2.5
+Compiler       cc,gcc
+Êѹ¹»ö¹à       MACHINE¤ò-DSYSTIME_HAS_NO_TM
+               -DEUC -DSYSV_SYSTEM_DIR¤ËÊѹ¹
+---------------------------------------------------------------
+¼Ò̾           Sun Microsystems
+¥Þ¥·¥ó         Sun Ultra 1/170
+OS             Solaris2.6 (SunOS5.6)
+Compiler       egcs-1.1 release (egcs-2.91.57 19980901)(gcc-2.8.*ÁêÅö¡©)
+Êѹ¹»ö¹à       MACHINE=-DNOBSTRING -DNOINDEX -DTZSET -DSYSV_SYSTEM_DIR
+               -DSYSTIME_HAS_NO_TM
+               MANDIR=/usr/local/man/ja
+               INSTALL=/usr/ucb/install
+               MANSECT=1       (¤ª¹¥¤ß¤Ë±þ¤¸¤Æ)
+È÷¹Í           sun solaris SVR4
+               SunOS¤Ë¤ÏÅÁÅýŪ¤Ë¡©struct tm¤Ëtimezone¤¬¤Ê¤¤¤Î¤ÇÃí°Õ
+----------------------------------------------------------------
+¼Ò̾¡§¡¡¡¡¡¡  IBM
+¥Þ¥·¥ó¡§¡¡¡¡¡¡RS/6000-25T
+£Ï£Ó¡¡¡§¡¡¡¡¡¡AIX Version 3.2.5
+¥³¥ó¥Ñ¥¤¥é¡§  /bin/cc
+Êѹ¹¡¡¡§¡¡¡¡¡¡SWITCHES¤Ë-DSYSV_SYSTEM_DIR -BSD_INCLUDES -DAIX¤òÄɲÃ
+              MACHINE¤ò-DSYSTIME_HAS_NO_TM -DTZSET¤ËÊѹ¹
+----------------------------------------------------------------
+
+
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..ce0d4b0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,68 @@
+################################################################
+# Makefile for LHa topdir
+#              Mar. 2, 1992, written by Masaru Oki.
+#              AUG. 22,1994, modified by Nobutaka Watazaki
+#               Jun.  7,1999, modified by Tsugio Okamoto
+################################################################
+
+#-----------------------------------------------------------------------
+# CONFIGURATION
+#      SWITCHES macro definitions ... see config.eng or config.jpn.
+#-----------------------------------------------------------------------
+
+SHELL=/bin/sh
+MAKE = make
+
+#CC                    = cc
+CC                     = gcc
+SWITCHES       = -DNEED_INCREMENTAL_INDICATOR \
+ -DTMP_FILENAME_TEMPLATE="\"/tmp/lhXXXXXX\""
+
+#MACHINE     = -DSYSTIME_HAS_NO_TM -DFTIME -DEUC
+#MACHINE     = -DSYSTIME_HAS_NO_TM -DEUC -DHAVE_TM_ZONE -DSYSV_SYSTEM_DIR
+MACHINE     = -DSYSTIME_HAS_NO_TM -DEUC -DSYSV_SYSTEM_DIR -DMKTIME
+
+#OPTIMIZE      = -O2 -fstrength-reduce -fomit-frame-pointer
+OPTIMIZE       = -O2 -DSUPPORT_LH6
+
+BINDIR = /usr/local/bin
+MANDIR = /usr/local/man
+MANSECT = n
+
+INSTALL = install
+INSTALLBIN = -s -m 755
+INSTALLMAN = -m 644
+
+SUBDIRS = src man
+
+O              = .o
+
+# missing library objects.
+#      memset$(O) lhdir$(O)
+LIBRARYOBJS    = patmatch$(O)
+
+MYMAKEFLAGS = 'BINDIR=$(BINDIR)' 'MANDIR=$(MANDIR)' 'MANSECT=$(MANSECT)'\
+ 'INSTALL=$(INSTALL)' 'INSTALLBIN=$(INSTALLBIN)' 'INSTALLMAN=$(INSTALLMAN)'\
+ 'CC=$(CC)' 'SWITCHES=$(SWITCHES)' 'O=$(O)' 'LIBRARYOBJS=$(LIBRARYOBJS)' \
+ 'OPTIMIZE=$(OPTIMIZE)' 'MACHINE=$(MACHINE)'
+
+all:
+       @for i in $(SUBDIRS); do \
+       echo "make all in $$i..."; \
+       (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) all); done
+
+install:
+       @for i in $(SUBDIRS); do \
+       echo "Installing in $$i..."; \
+       (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) install); done
+
+clean:
+       @for i in $(SUBDIRS); do \
+       echo "Clearing in $$i..."; \
+       (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) clean); done
+
+moreclean:
+       @for i in $(SUBDIRS); do \
+       echo "Clearing in $$i..."; \
+       (cd $$i; $(MAKE) $(MFLAGS) $(MYMAKEFLAGS) moreclean); done
+
diff --git a/PROBLEMS.euc b/PROBLEMS.euc
new file mode 100644 (file)
index 0000000..a81f80b
--- /dev/null
@@ -0,0 +1,45 @@
+
+                      LHa Version 1.14 ¤Ë´Ø¤¹¤ëÌäÂêÅÀ
+
+1) ¥¢¡¼¥«¥¤¥ÖÆâ¤Î´Á»ú¥Õ¥¡¥¤¥ë̾¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤
+
+    »îºîÈǤΤ³¤í¤ËÆâÅÄ@ÉÙ»ÎÄ̤µ¤ó¤«¤é»ØŦ¤µ¤ì¤Æ¤¤
+    ¤¿¤Î¤Ç¤¹¤¬¤Þ¤ÀÂн褷¤Æ¤¤¤Þ¤»¤ó¡£(¤¹¤ß¤Þ¤»¤ó)
+    ¤Þ¤¿¡¢Âнè¤ÎÊýË¡¤â¤¤¤¯¤Ä¤«ÁªÂò»è¤¬¤¢¤ê¤Þ¤¹¡£
+    ¥¢¡¼¥«¥¤¥ÖÆâ¤Î¥Õ¥¡¥¤¥ë̾¤Ï¤¹¤Ù¤Æ S-JIS ¤È¤·¤Æ
+    °·¤¦¤Ù¤­¤Ê¤Î¤«¡¢UNIX ¤Ç¤¢¤ì¤Ð EUC ¤ò´Þ¤á¤ÆÎɤ¤
+    ¤Î¤«¡¢¤Ê¤É¤Ê¤É¡£   ¡Ê¸¶ËÜ¡§²­ »á¡Ë
+
+    P.S
+    ¤­¤Á¤ó¤È°µ½Ì¤ÈŸ³«¤¬¤Ç¤­¤ë¤Î¤ÇÂбþ¤·¤Æ¤ë¤È»×¤Ã¤Æ¤Þ¤·¤¿¡£
+    ¤Ê¤ª¡¢»ä¤Ë¤Ï¤Ê¤ó¤Î¤³¤È¤ä¤é¤µ¤Ã¤Ñ¤ê¤ï¤«¤ê¤Þ¤»¤ó¤Î¤Ç̤Âбþ¤Ç¤¹¡£
+       ¡ÊÌʺê¡Ë
+
+
+2) ¥Þ¥·¥óÊ̤ΠMakefile ¤ÎÀßÄ꤬¤Þ¤È¤Þ¤Ã¤Æ¤¤¤Ê¤¤
+
+    config.h ¤ò¤Ä¤¯¤Ã¤Æ¤½¤³¤Ë¥Þ¥·¥óÊ̤Υޥ¯¥íÄêµÁ¤ò
+    ¤¤¤ì¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£¸½ºß¤Ï¤Þ¤À Makefile ¤Ç
+    »ØÄꤷ¤Æ²¼¤µ¤¤¡£   ¡Ê¸¶ËÜ¡§²­ »á¡Ë
+
+    P.S
+    »Å»öÀè¤Ë£Ó£õ£î¤·¤«¤Ê¤¤¤Î¤Ç¤Ê¤ó¤È¤â¡Å¡Å̤Âбþ¤Ç¤¹¡£
+                                                                                                               ¡ÊÌʺê¡Ë
+
+3) ½ñ¸Ë¤ÎÃæ¤Î¥Õ¥¡¥¤¥ë¤¬¥½¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢½ñ¸Ë¤Ø¤Î¥Õ¥¡¥¤¥ë¤ÎÄɲá¢
+   ¹¹¿·¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¡£
+
+       LHa for Unix ¤Ï½ñ¸Ë¤ÎÃæ¤Î¥Õ¥¡¥¤¥ë¤¬¥½¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤È²¾Äꤷ¤Æ
+       ¥Õ¥¡¥¤¥ë¤ÎÄɲᢹ¹¿·½èÍý¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤ë¡£MS-DOS ¤Î LHarc ¤Ï½ñ¸Ë
+       ¤ÎÃæ¤Î¥Õ¥¡¥¤¥ë¤ò¥½¡¼¥È¤·¤Æ¤¤¤¿¤¬¡¢LHA ¤Ï¥½¡¼¥È¤·¤Ê¤¯¤Ê¤Ã¤¿°Ù¡¢
+       MS-DOS ¤Çºî¤é¤ì¤¿½ñ¸Ë¤Ø¤Î¥Õ¥¡¥¤¥ë¤ÎÄɲᢹ¹¿·¤¬Àµ¾ï¤Ë¹Ô¤Ê¤ï¤ì
+       ¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ë¡£
+       ÂнèÊýË¡¤Ï°ìÅÙ²òÅà¤ò¹Ô¤Ê¤Ã¤Æ¤«¤é¡¢LHa for Unix ¤ÇºÆ°µ½Ì¤¹¤ì¤Ð
+       Îɤ¤¡£
+
+4) »þ´Öɽ¼¨¤¬¤ª¤«¤·¤¯¤Ê¤ë
+
+        DOS ¤ÇºîÀ®¤·¤¿½ñ¸Ë¤Î¥Õ¥¡¥¤¥ë¥¹¥¿¥ó¥×¤¬Àµ¤·¤¯É½¼¨¤µ¤ì¤Ê¤«¤Ã¤¿¤ê¡¢
+        TZ ¤ËÃͤòÀßÄꤹ¤ë¤È¥¿¥¤¥à¥¹¥¿¥ó¥×¤¬¤º¤ì¤¿¤ê¤·¤Þ¤¹¡£¤¤¤í¤¤¤í¤¢¤ë
+        »þ´Ö¤Ë´Ø¤¹¤ë´Ø¿ô¤¬¤è¤¯Ê¬¤«¤Ã¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢Ê¬¤«¤Ã¤Æ¤­¤¿¤é¤­¤Á¤ó
+        ¤Èľ¤½¤¦¤È»×¤¤¤Þ¤¹¡£
diff --git a/README.euc b/README.euc
new file mode 100644 (file)
index 0000000..95da9b9
--- /dev/null
@@ -0,0 +1,98 @@
+    LHa for UNIX version 1.14e Jun.  7 1999 by Tsugio Okamoto
+
+       This file is used EUC code.
+
+    ¢¨¼è°·¤Ë¤Ä¤¤¤Æ¤ÎÃí°Õ version 1.14e
+
+      ¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï¡¢UNIX ÈÇ LHa ¤ÎÀµ¼°È¯¹Ô¤Ê¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
+      °ÊÁ°¸ø³«¤µ¤ì¤¿¡¢²­¾¡»á¤Î UNIX ÈÇ LHa Ver. 1.00¡¢Ìʺê»á¤Î
+      Ver. 1.14 ¤ò²þÊѤ·¤¿¤â¤Î¤Ç¤¹¡£
+
+        Ï¢Íí¤Ï¡¢°Ê²¼¤ÎÏ¢ÍíÀè¤ÎÊý¤Ë¤·¤Æ¤¯¤À¤µ¤¤²­¾¡»á¤ª¤è¤ÓÌʺê»á¤ÎÊý¤Ë¤Ï¡¢
+      ¸æÌÂÏǤ¬¤«¤«¤ê¤Þ¤¹¤Î¤Ç¤Ê¤ë¤Ù¤¯¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£
+
+        ¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Î¥Ð¥°¤ÎÊó¹ð¤Ê¤É¤Ï¡¢»ä¡Ê²¬ËÜ ·ÑÃË,
+      E-MAIL:tsugio@muc.biglobe.ne.jp)¤Þ¤ÇÏ¢Íí²¼¤µ¤¤¡£
+
+
+    -lh5-, -lh6- °µ½Ì·Á¼°¤Ç¤Î°µ½Ì/Ÿ³«¤¬²Äǽ¤Ê¥¢¡¼¥«¥¤¥Ð
+     LHa ¤Î UNIX ÈǤÎÈóÀµ¼° ¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×ÈǤǤ¹¡£
+
+    UNIX ÈÇ LHarc 1.02 (by Y.Tagawa) ¤ò²þ¤¤· MS-DOS ÈÇ LHx C2.01E
+    (by µÈºê¡¡±ÉÂÙ) ¤Î¥¢¥ë¥´¥ê¥º¥à¤òÉղä·¤¿ LHx(arc) V2.00 for OSK
+    (by Sakura Tomozou) ¤ò¡¢²­¾¡»á¤¬ UNIX ¾å¤ÇÆ°ºî¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
+    ¤½¤ì¤ò¡¢Ìʺê»á¤¬ Symbolic Link ¤È Å¸³«»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×Âбþ¤·¤Þ
+    ¤·¤¿¡£¤½¤·¤Æ»ä¤¬ -lh6- ¤Î°µ½Ì·Á¼°¤ËÂбþ¤·¤Þ¤·¤¿¡£
+
+    MACHINES, config.jpn.euc (config.eng) ¤ò»²¹Í¤Ë¤·¤Æ
+    Makefile ¤òŬµ¹Êѹ¹¤·¡¢make ¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+    ¥³¥ó¥Ñ¥¤¥ë»þ¤ª¤è¤ÓÆ°ºî¤ËÌäÂ꤬ȯÀ¸¤·¤¿¾ì¹ç¤ÏÏ¢Íí¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£
+    Âоݥץé¥Ã¥È¥Õ¥©¡¼¥à (µ¡¼ï¡¢OS ¥Ð¡¼¥¸¥ç¥ó¡¢¥³¥ó¥Ñ¥¤¥é) ¤ª¤è¤Ó
+    ¾É¾õ¤ò¾Ü¤·¤¯¤ªÃΤ餻²¼¤µ¤¤¡£¤Þ¤¿¡¢LHa ¤Î¥½¡¼¥¹Êѹ¹¤Ë¤è¤Ã¤ÆÀµ¤·
+    ¤¯Æ°ºî¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤¿»þ¤Ë¤ÏÊѹ¹ÅÀ¤ò¤ªÃΤ餻²¼¤µ¤¤¡£
+    ²Äǽ¤Ê¤é¤Ð¼¡²ó¤Î Version UP ¤ËÈ¿±Ç¤·¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
+    ¡ÊÈóÀµ¼°È¯¹ÔÈǤʤΤǡ¢Ì¤Äê¤Ç¤¹¤¬¡Å¡Å¡£¡Ë
+
+    ¤Þ¤¿¡¢¿·¤·¤¤¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ç¤Î¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤ÓÆ°ºî³Îǧ¤¬¤Ç¤­
+    ¤Þ¤·¤¿¤é¡¢¤ªÃΤ餻²¼¤µ¤¤¡£Æ°ºî³Îǧ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¾ðÊó¤ò¹¹¿·
+    ¤·¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
+
+    MACHINES ¤Ë¤³¤ì¤Þ¤ÇÊó¹ð¤Î¤¢¤Ã¤¿¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¥³¥ó¥Ñ¥¤¥ë
+    ¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£
+    (CHANGES.euc ¤Ë¤Ïµ¡¼ï°Í¸¥Þ¥¯¥í¤Î¾ì½ê¤ò SWITCHIES ¤«¤é MACHINE ¤Ë
+    Êѹ¹¤·¤¿¤È¤¢¤ê¤Þ¤¹¤¬¡¢MACHINES.euc ¤ÎÆâÍƤϠSWITCHES ¤Î¤Þ¤Þ¤Ë¤Ê¤Ã¤Æ¤Þ¤¹¡£
+    ÃÖ¤­´¹¤¨¤ÆÆɤó¤Ç¤¯¤À¤µ¤¤¡£)
+    MACHINES2 ¤Ï Ver. 1.14d °Ê¹ß(Ver.1.14c¤â¿¾¯´Þ¤à)¤ËÊó¹ð¤Î¤¢¤Ã¤¿
+    ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó¤Ë¤Ä¤¤¤Æµ­½Ò¤·¤Þ¤·¤¿¡£
+
+    (Ãí°Õ)MACHINE, MACHINE2, SWITCHIES¤Ï¤Ï¾åµ­Ä̤ê¤Ë¤Þ¤À¤Ê¤Ã¤Æ
+    ¤¤¤Ê¤¤¤È¤³¤í¤¬¤¢¤ê¤Þ¤¹¡£1999.6.7
+
+    ¥³¥ó¥Ñ¥¤¥ë¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¾ì¹ç¤Ï¡¢Ver. 1.00 ¤Î Makefile ¤Ç
+    ¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£src/ ¤È man/ ¤Î²¼¤Î
+    ¥Õ¥¡¥¤¥ë¤òÆþ¤ìÂؤ¨¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
+    ¤Ê¤ª¡¢ÅºÉդΠMakefile ¤Ï FreeBSD 3.1ÍѤˤʤäƤª¤ê¤Þ¤¹.
+    (°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤«¤éÊѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£°ÊÁ°¤Ï SunOS ¤Ç¤·¤¿¡£)
+
+    ¤Ê¤ª¡¢Ê¸½ñ¤ÏÁ´¤Æ£Å£Õ£Ã¤Çµ­½Ò¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤ÇÊÑ´¹¤¬É¬ÍפÊÊý¤Ï¤ª¼ê´Ö¤Ç
+    ¤·¤ç¤¦¤¬³Æ¼«ÊÑ´¹¤·¤Æ¤¯¤À¤µ¤¤¡£
+    
+    ¤Ê¤ª¡¢¥Í¥Ã¥È¤Ç¤ÎÇÛÉդϼ«Í³¤Ç¤¹¤¬¡¢¥Í¥Ã¥È¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤Êý¡Ê»¨»ï¤ª¤è¤Ó¡¢
+    CD-ROM ¤Ê¤É¤Ë¤è¤ë¡Ë¤Ø¤ÎÇÛÉդϡ¢ÇÛÉÕÁ°¤Ë¤³¤Á¤é¤Ë Inter-Net ¤ÎÊý¤ËE-Mail
+       ¤ò ¤ª´ê¤¤¤·¤Þ¤¹¡£ ¤É¤³¤½¤³¤Ë¡¢·ÇºÜ¤¹¤ë¤È¤¤¤¦»Ý¤¬¤¢¤ì¤Ð·ë¹½¤Ç¤¹¤Î¤Ç¡£
+    ¤Þ¤¿¡¢¤½¤ì¤â½ÐÍè¤Ê¤¤ºÝ¤Ë¤Ï¡¢¸åÆü E-Mail ¤òɬ¤º¤ª´ê¤¤¤·¤Þ¤¹¡£
+
+
+    LHa for UNIX Ver. 1.00 ¤È¤ÎÊѹ¹ÅÀ
+
+        CHANGES, CHANGE2, change-*.txt ¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡£
+
+    ¤ï¤«¤Ã¤Æ¤¤¤ëÉÔ¶ñ¹ç
+
+        PROBLEMS, change-*.txt ¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡£
+
+    Ï¢ÍíÀè
+
+        E-Mail address:        tsugio@muc.biglobe.ne.jp
+        Home page     : http://www2m.biglobe.ne.jp/~dolphin/index.htm
+            (£±£¹£¹£¹Ç¯¡¡£µ·î£²£µÆü¸½ºß)
+    ¼Õ¼­
+
+        LHarc ¤ª¤è¤Ó LHa ¤Î¸¶ºî¼Ô¤Ç¤¢¤ëµÈºê±ÉÂÙ¤µ¤ó¡¢LHarc UNIX
+        ¤Îºî¼Ô¤Ç¤¢¤ë Y.Tagawa ¤µ¤ó¡¢LHx(arc) for OSK ¤òºîÀ®¤µ¤ì¤¿ 
+        Sakura Tomozou ¤µ¤ó¡¢LHa for UNIX ¤ò¤³¤³¤Þ¤Ç»Å¾å¤²¤Æ¤¯¤À¤µ¤Ã¤¿
+        ²­  ¾¡¤µ¤ó¡¢Ìʺ꽤䤵¤ó¡¢¤µ¤é¤Ë³«È¯¤Ë¤«¤«¤ï¤Ã¤¿Êý¡¹¤ä¶¨ÎϤ·¤Æ
+       ¤¯¤ì¤¿³§Íͤ˴¶¼ÕÃפ·¤Þ¤¹¡£
+
+                                                1999 Ç¯  6 ·î  7 Æü
+                                               ²¬ËÜ  ·ÑÃË
+
+    ¥Ç¡¼¥¿·Á¼°¤Ë¤Ä¤¤¤Æ
+
+        ¤Ê¤ª¡¢¥Ç¡¼¥¿¥Õ¥¡¥¤¥ë¤Ï¡¢tar + gzip ¤Ç¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+        ¤è¤Ã¤Æ¡¢gzip -cd lha-114e.tgz | tar xf - Åù¤ÇŸ³«¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+[eof]
+
diff --git a/change-114e.txt b/change-114e.txt
new file mode 100644 (file)
index 0000000..31bd567
--- /dev/null
@@ -0,0 +1,203 @@
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(1)
+
+¥Ø¥Ã¥À-lhd-¤ò»ý¤Ä½ñ¸Ë¤òŸ³«¤Ç¤­¤Ê¤¤¡£
+
+¢£¸¶°ø
+directory¤ÎŸ³«¤Ïunix¤Î¥Õ¥¡¥¤¥ë°À­¤ò¸«¤Æ
+¹Ô¤¦¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤·¤¿¡£
+¤·¤¿¤¬¤Ã¤Æ¡¢windowsÅù¤ÎUNIX¤Ç¤Ï¤Ê¤¤OS¤Ç
+Ÿ³«¤·¤è¤¦¤È¤¹¤ë¤È¡¢¥Õ¥¡¥¤¥ë°À­¤¬Ìµ¤¤¤¿¤á
+directory¤ò¼¨¤·¤¿¥Ø¥Ã¥À¤òǧ¼±¤Ç¤­¤Ê¤«¤Ã¤¿
+¤¿¤á¤À¤È»×¤ï¤ì¤Þ¤¹¡£
+
+¢£Âнè
+¥Ø¥Ã¥À-lhd-¤ò¤ß¤ÆŸ³«¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
+1999.4.30
+¢£³Îǧ
+ºÑ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(2)
+
+Windows¤ÇºîÀ®¤·¤¿¼«¸ÊŸ³«¼Â¹Ô¥Õ¥¡¥¤¥ë¤Î½ñ¸Ë¤ò
+Ÿ³«¤Ç¤­¤Ê¤¤¡£
+
+¢£¸¶°ø
+LHa for unix¤Ç¤Ï¡¢.exe¤Î¤Ä¤¤¤¿¥Õ¥¡¥¤¥ë¤Ï
+ms-dosÈǤÎlha¤ÇºîÀ®¤µ¤ì¤¿sfx¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë¤Èǧ¼±
+¤¹¤ë¤¿¤á¡£¤Þ¤¿¡¢¥ì¥Ù¥ë£²¤Î¥Ø¥Ã¥À¤ËÂбþ¤·¤Æ¤¤¤Ê¤«
+¤Ã¤¿¤¿¤á¡£
+
+¢£Âнè 1999.5.28
+°µ½Ì¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ÎÁ°¤ËÉղ䵤ì¤Æ¤¤¤ë
+¥µ¥Õ¥£¥Ã¥¯¥¹¥³¡¼¥É¤òms-dosÈÇlha¤ÇºîÀ®¤µ¤ì¤¿
+¥µ¥¤¥º¤è¤ê¤â¿¤¯Æɤà¤è¤¦¤Ë¤·¤¿¡£
+¥ì¥Ù¥ë£²¥Ø¥Ã¥À¤Ë¤âÂбþ¤·¤¿¡£
+
+¢£³Îǧ
+ºÑ
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(3)
+
+AIX 3.2¤Çcgi¤ò»È¤Ã¤Ælha¤òµ¯Æ°¤·¤¿¤È¤­¤Ë¡¢Àµ¾ï½ªÎ»
+¤·¤Ê¤¤ÉÔÅԹ硣lha¤Îe,f¥³¥Þ¥ó¥É¤òÍøÍѤ·¤¿¤È¤­¤Î¤ß
+¤³¤Î¸½¾Ý¤¬È¯À¸¤¹¤ë¡£main()´Ø¿ô¤Îexit(0)¤Þ¤Ç½èÍý¤¬
+½ªÎ»¤·¤Æ¤¤¤ë¤¬¡¢lha¤Ï½ªÎ»¤·¤Ê¤¤¡£
+
+¢£¸½¾Ý¤Î³Îǧ
+»î¤ß¤¿¤¬³Îǧ¤Ç¤­¤Æ¤¤¤Ê¤¤¡£
+¢£Âнè
+¢£³Îǧ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(4)
+
+IBM RS/6000-25T AIX Version 3.2.5(/bin/cc)
+SWITCHES¤Ë-DSYSV_SYSTEM_DIR -BSD_INCLUDES -DAIX¤òÄɲÃ
+MACHINE¤ò-DSYSTIME_HAS_NO_TM -DTZSET¤ËÊѹ¹
+
+slide.cÆâ¤Îtext¤È¡¢lha.h¤ÎEXTERN unsigned char *text¤¬
+¾×Æͤ·¤Æ¤¤¤ë¡£
+
+¢£ÀâÌÀ
+slide.cÆâ¤Ç¥í¡¼¥«¥ë¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë*text¤Ï
+¥°¥í¡¼¥Ð¥ë¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë*text¤òÍøÍѤ·¤Æ¤â
+ÌäÂ꤬¤Ê¤¤¡£
+
+¢£Âнè
+slide.c¤Ç¤Î¥í¡¼¥«¥ëÄêµÁ¤Îtext¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤·¤¿¡£
+
+¢£³Îǧ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(5)
+
+Makefile 5¹ÔÌܤÎǯ¤¬2995¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
+¢£Âнè
+1995¤Ëľ¤·¤¿
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(6)
+
+slide.c¤Çstatic unsigned char *text¤È¤Ê¤Ã¤Æ¤¤¤Æ¡¢
+src/larc.c¤Ç¤â»È¤Ã¤Æ¤¤¤ë¡£
+»È¤¤Êý¤¬ÊѤǤ¢¤ë¡£
+(4)¤È´Ø·¸¤¢¤ê¤È»×¤ï¤ì¤ë¡£
+
+¢£Âнè
+(4)¤ÎÂнè¤ÇÂç¾æÉפǤϡ©
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(7)
+
+src/INSTALL¤¬Ìµ¤¤
+
+¢£Âнè
+¤È¤ê¤¢¤¨¤º¡¢src/INSTALL¤¬Â¸ºß¤¹¤ë¤È¤¤¤¦µ­½Ò¤ò
+̵¤¯¤·¤¿¡£
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(8)
+EWS4800/360PX¤Ë´Ø·¸¤¹¤ëSWITCHES¤Î
+Î㤬¤Ê¤¤¡£
+
+¢£Âнè
+õ¤·¤Þ¤¹¡£
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(9)
+
+WindowsÈÇlha¥Ä¡¼¥ë¤ÇºîÀ®¤µ¤ì¤¿¥ì¥Ù¥ë0¤Î
+¥¢¡¼¥«¥¤¥Ö¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬Ç§¼±¤Ç¤­¤Ê¤¤¡£
+³ÈÄ¥ÎΰèÉôʬ¤¬1¥Ð¥¤¥È¤Î¤ß¡£
+
+¢£¸¶°ø
+¥ì¥Ù¥ë0¤Î³ÈÄ¥²ÄǽÉôʬ¤Îǧ¼±ÊýË¡¤¬´Ö°ã¤¨¤Æ¤¤¤ë¡£
+¡ôCRC¤¬´Þ¤Þ¤ì¤Ê¤¤¥ì¥Ù¥ë1¤Î½ñ¸Ë¤¬¤Á¤ç¤Ã¤È¼«¿È̵¤·
+¢£Âнè
+¿·¤·¤¤¥í¥¸¥Ã¥¯¤ËÆþ¤ì´¹¤¨¤¿¡£
+
+¢£³Îǧ
+ºÑ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(10)
+
+ɸ½àÆþÎϤ¬tty°Ê³°¤Ë¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Æ¤¤¤Æ¡¢
+¤«¤ÄŸ³«¥Õ¥¡¥¤¥ë»ØÄ̵꤬¤¤¤È¤­¤Ï¡¢É¸½àÆþÎϤ«¤é
+Ÿ³«¤¹¤ë¥Õ¥¡¥¤¥ë¤ò¼õ¤±¼è¤ë¤³¤È¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
+(Ÿ³«Æ°ºî¤Î¤È¤­¤Î¤ß)
+
+IBM¤Î¿·ÅçÃÒÇ·¤µ¤ó(poortom@apmisc.ibm.co.jp)¤«¤é
+¤Î¾ðÊó¤Ç¤¹¡£
+
+¢£tips
+¥³¥Þ¥ó¥É¥é¥¤¥ó¤ÈƱÍͤÎÆ°ºî¤ò´üÂÔ¤¹¤ë¤È¤­¤ÏÌÀ¼¨Åª¤Ë¡¢
+       lha -ex hogehoge.lzh < /dev/null
+¤È¤¹¤ë¤ÈÎɤ¤ÍͤǤ¹¡£
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(11)
+
+±¼Ç¯¤Î·×»»ÊýË¡¤¬ÉÔ½½Ê¬¤Ç¡¢2000ǯ3·î°Ê¹ß¤Î
+ÆüÉդΥե¡¥¤¥ë¤òŸ³«¤¹¤ë¤È1Æü¤º¤ì¤ë¶²¤ì¤¬¤¢¤ë¡£
+
+¢£Âнè
+2000ǯ¤â±¼Ç¯¤È°·¤¦¤è¤¦¤Ë¤·¤¿¡£
+(ÆàÎɽ÷»ÒÂç³Ø¤Î¿·½Ð»á¤Î¥Ñ¥Ã¥Á¤òÍøÍѤ·¤Þ¤·¤¿)
+
+¢£³Îǧ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(12)
+¥Õ¥¡¥¤¥ë¤ò°ì¤Ä¤À¤±´Þ¤à¥Õ¥¡¥¤¥ë¤«¤é°ì¤Ä¥Õ¥¡¥¤¥ë¤ò
+ºï½ü¤¹¤ë¤È¡¢1¥Ð¥¤¥È¤Î¥´¥ß¤ò´Þ¤ó¤À¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë
+¤¬¤Ç¤­¤Æ¤·¤Þ¤¦¡£
+
+¢£Âнè
+lhadd.c¤Îcmd_delete()´Ø¿ôÆâ¤Îbuild_backup_file()´Ø¿ô¸Æ¤Ó½Ð¤·¸å¤Ë
+
+if(!noexec && new_archive_size <= 1){
+       unlink(temporary_name);
+       printf("New archive file \"%s\" is not created because it would be empty.\n", new_archive_name);
+       return;
+}
+
+¤òÄɲÃ(½¤Àµ)¤·¤¿¡£
+
+¢£³Îǧ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(13)
+
+¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ»þ¹ï¤Î½¤Àµ¡¢
+¥Õ¥¡¥¤¥ë°À­¤Î½¤Àµ¤ò¤¹¤ë¤È¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯
+¤Ç¤Ï¤Ê¤¯¤Æ¡¢¥ê¥ó¥¯Àè¤Î¥Õ¥¡¥¤¥ë¤¬½¤Àµ¤µ¤ì¤Æ
+¤·¤Þ¤¦¡£
+
+¢£Âнè
+lhext.c¤Îadjust_info()´Ø¿ôÆâ¤Ç»þ¹ï¡¦Â°À­¤ò½¤Àµ¤·¤Æ¤¤¤ë
+²Õ½ê¤Ë¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¤Ï½¤Àµ¤ò¹Ô¤ï¤Ê¤¤ÍͤÊ
+¾ò·ï¤ò¤Ä¤±¤¿¡£
+
+¢£³Îǧ
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(14)
+
+¢£Êѹ¹
+SUPPORT_LH6¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤Ê¤¤¤È
+°µ½Ìmethod -lh6-¤òÁªÂò¤Ç¤­¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
diff --git a/change-114f.txt b/change-114f.txt
new file mode 100644 (file)
index 0000000..4cb1c51
--- /dev/null
@@ -0,0 +1,116 @@
+lha for unix ver 1.14e bugs
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(15)
+
+¢£ÌäÂê
+ls config.* | lha a arc.lzh¤Ç°µ½Ì¤¬¤Ç¤­¤Ê¤¤¡£
+
+¢£¸¶°ø
+ɸ½àÆþÎϤ«¤éfgets¤Çʸ»úÎó¤ò¼è¤ê½Ð¤·¤Æ¤¤¤ë¤¿¤á¡¢
+ʸ»úÎó¤ÎºÇ¸å¤Ë'\n'¤¬´Þ¤Þ¤ì¤Æ¤¤¤¿¡£¤³¤Î·ë²Ì
+Èæ³Ó¤¬Àµ¾ï¤Ë¹Ô¤¨¤Ê¤«¤Ã¤¿¡£
+
+¢£Âнè
+'\n'¤ò¼è¤ê½ü¤¯¤è¤¦¤Ë¥×¥í¥°¥é¥à¥½¡¼¥¹¤òÊѹ¹¤·¤¿¡£
+1999.7.18
+
+¢£Âнè³Îǧ
+ls *.c | lha a tst.lzh ¤Ç°µ½Ì¤Þ¤¿¡¢
+ls *.c | lha l tst.lzh ¤Ç¥ê¥¹¥È¤Ç¤­¤ë¤³¤È¤ò³Îǧ
+¤·¤¿¡£
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(16)
+
+¢£ÌäÂê
+Ÿ³«¤Ç¤­¤Ê¤¤windows¤Îsuffix¥Õ¥¡¥¤¥ë¤¬
+¤Þ¤À¸ºß¤¹¤ë¡£
+
+¢£¸¶°ø
+SFX¥³¡¼¥É¤¬16KB°Ê¾å¤Î¥Õ¥¡¥¤¥ë¤¬Â¿¤¯
+¸ºß¤¹¤ë¤é¤·¤¯¡¢lha for unix¤Ç¤Ï
+16KB°ÊÆ⤷¤«Âбþ¤·¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
+
+¢£Âнè
+64KB¤Þ¤ÇÆɤ߹þ¤à¤è¤¦¤Ë¤·¤¿¡£
+lha_macro.h¤ÎMAXSFXCODE¤Î²Õ½ê
+
+¢£¤½¤Î¾
+64KB¤Ç¥À¥á¤Ê¤é¡¢¤â¤Ã¤ÈÂ礭¤Ê
+ÃͤòÀßÄꤷ¤Æ»î¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
+¤½¤ì¤Ç¤â¥À¥á¤À¤ÈÊ̤ÎÌäÂ꤫¤â¤·¤ì¤Þ¤»¤ó¤¬¡£¡£¡£
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(17)
+
+¢£ÌäÂê
+change-114e.txt¤Î(13)ÈÖ¤ÈƱ¤¸¸¶°ø¤Ë¤è¤ëÌäÂêÅÀ¤Ç¡¢
+lchown()¥·¥¹¥Æ¥à¥³¡¼¥ë¤òchown()¤È¤ÏÊ̤˻ý¤Ã¤Æ¤¤¤ë
+¥·¥¹¥Æ¥à¤Çµ¯¤­¤ëÌäÂ꤬¤¢¤ë¤é¤·¤¤¡£
+
+¢£Âнè
+lchown¤¬¤¢¤ì¤Ðlchown¤ò»È¤¦¤³¤È¤Ë¤·¤¿¡£1999.7.19
+lchown¤¬Ìµ¤¤»þ¤ÏHAVE_NO_LCHOWN¤òÄêµÁ¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(18)
+
+¢£ÌäÂê
+lha filename¤¬lha l filename¤ÎµóÆ°¤ÈƱ¤¸¤Ç¤Ï¤Ê¤¤
+
+¢£¸¶°ø
+¥Õ¥¡¥¤¥ëfilename¤ò»²¾È¤¹¤ë²Õ½ê¤Î´Ö°ã¤¤¡£
+
+¢£Âнè
+½¤Àµ¤·¤¿¡£
+1999.7.18
+
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(19)
+
+¢£ÌäÂê
+main´Ø¿ô¤¬void¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
+warning¤¬¤Ç¤ë¤³¤È¤¬¤¢¤ë¡£
+¢£Âнè
+int¤Ë¤·¤Þ¤·¤¿¡£
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(20)
+
+¢£ÌäÂê
+tab¤¬¥µ¥¤¥º4¤Ç¡¢Æɤߤˤ¯¤¤´Ä¶­¤¬¤¢¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
+
+¢£Âнè
+̤Âнè
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(21)
+
+¢£ÌäÂê
+¤¢¤ë¼ï¤Î¥Õ¥¡¥¤¥ë¤¬CRC¥¨¥é¡¼¤Ë¤Ê¤ë¡£
+
+¢£¸¶°ø
+°µ½Ì¼­½ñ¤Î½é´ü²½¤ÎÈϰϤËÉÔÅԹ礬¤¢¤Ã¤¿¡£
+
+¢£Âнè
+½é´ü»þ¤Î¼­½ñ¤òŬÀڤˤ·¤¿¡£
+1999.7.19
+
+¢£Âнè³Îǧ
+ÉÔÅԹ礬µ¯¤­¤ë¥µ¥ó¥×¥ë¤òÆþ¼ê¤·¡¢
+ÉÔÅԹ礬ȯÀ¸¤·¤Ê¤¤¤³¤È¤ò³Îǧ¤·¤¿¡£
+
+¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£ Êó¹ð ¢£¢£¢£¢£¢£¢£¢£¢£¢£¢£
+(22)
+
+¢£ÌäÂê
+util.c¤Çiskanji()¤ò»È¤Ã¤Æ¤¤¤ëÉôʬ¤¬Â¸ºß¤·¤¿¡£
+
+¢£Âнè
+iskanji()¤ÎÂå¤ï¤ê¤ËMULTIBYTE_FIRST_P¤ò
+»È¤¦»ö¤Ë¤·¤¿¡£1999.7.19
+
diff --git a/config.eng b/config.eng
new file mode 100644 (file)
index 0000000..78f9e0b
--- /dev/null
@@ -0,0 +1,46 @@
+configration of LHa for UNIX ver 1.00 (see Makefile, SWITCHES macro.)
+
+machine independed macros
+
+  NEED_INCREMENTAL_INDICATOR
+  EUC                  if you want to convert kanji-code, define this.
+  ARCHIVENAME_EXTENTION        your default archive suffix. default is ".lzh".
+  BACKUPNAME_EXTENTION back up archive suffix. default is ".bak".
+  TMP_FILENAME_TEMPLATE        temporary file template. default is "/tmp/lhXXXXXX".
+  SUPPORT_LH6          to use the -lh6- method, define SUPPORT_LH6
+
+machine depended macros
+
+--include files
+  USG                  if your machine has no <strings.h>, define this.
+  SYSTIME_HAS_NO_TM    if your sys/time.h has no struct tm, define this.
+
+--string stuff
+  NOBSTRING            if your machine has no bstring(3), define this.
+  NOINDEX              if your machine has no index(3), define this.
+  NOSTRDUP             if your machine has no strdup(3), define this.
+  USESTRCASECMP                if your machine has strcasecmp(3), define this.
+  NOMEMSET             if your machine has no memset(3), define this.
+
+--timezone stuff
+  FTIME                        if your machine use ftime(3C), define this.
+  GETTIMEOFDAY         if your machine use gettimeofday(2), define this.
+  MKTIME               if your machine use mktime(3C), define this.
+  TIMELOCAL            if your machine use timelocal(3V), define this.
+  TZSET                        if your machine use tzset(3C), define this.
+  TIMEZONE_HOOK
+
+--directory stuff
+  NONSYSTEM_DIR_LIBRARY        if your machine has no directory manipulate
+                       functions, define this.  and you should add
+                       lhdir$(O) to LIBRARYOBJS in Makefile.
+  SYSV_SYSTEM_DIR      if your machine has struct dirent, define this.
+  NODIRECTORY          otherwise. (give up..)
+
+--other stuff
+  NOFTRUNCATE          if your machine has no ftruncate(2), define this.
+  NOMKDIR              if your machine has no mkdir(2), define this.
+  MKDIRPATH            to use external mkdir command, define with NOMKDIR.
+  RMDIRPATH            to use external rmdir command, define with NOMKDIR.
+  NOT_COMPATIBLE_MODE
+  HAVE_NO_LCHOWN       if your machine has no lchown(2), define this.
diff --git a/config.jpn.euc b/config.jpn.euc
new file mode 100644 (file)
index 0000000..9ebcda3
--- /dev/null
@@ -0,0 +1,51 @@
+LHa for UNIX ver 1.14 ¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó (Makefile, SWITCHES¥Þ¥¯¥í»²¾È)
+
+µ¡¼ï°Í¸¥Þ¥¯¥í¤Ï¡¢MACHINES ¥Õ¥¡¥¤¥ë¤ËÀßÄêÎ㤬¤¢¤ê¤Þ¤¹¤Î¤Ç»²¾È´ê¤¤¤Þ¤¹¡£
+
+
+µ¡¼ïÈó°Í¸¤Î¥Þ¥¯¥í
+
+  NEED_INCREMENTAL_INDICATOR   ·Ð²áɽ¼¨¥°¥é¥Õ¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
+  EUC                  ´Á»ú¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ê¤¦ e ¥ª¥×¥·¥ç¥ó¤òÍÑ°Õ¤·¤Þ¤¹¡£
+  ARCHIVENAME_EXTENTION        ¥Ç¥Õ¥©¥ë¥È¤Î¥¢¡¼¥«¥¤¥Ö³ÈÄ¥»Ò¡£¥Ç¥Õ¥©¥ë¥È¤Ï ".lzh" ¡£
+  BACKUPNAME_EXTENTION ¥Ð¥Ã¥¯¥¢¥Ã¥×¥¢¡¼¥«¥¤¥Ö¤Î³ÈÄ¥»Ò¡£¥Ç¥Õ¥©¥ë¥È¤Ï ".bak" ¡£
+  TMP_FILENAME_TEMPLATE        ºî¶È¥Õ¥¡¥¤¥ë¤Î¥Æ¥ó¥×¥ì¡¼¥È¡£
+  SUPPORT_LH6          -lh6- method¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+
+µ¡¼ï°Í¸¥Þ¥¯¥í
+
+--¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë´Ø·¸
+  USG                  <strings.h> ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  SYSTIME_HAS_NO_TM    <sys/time.h> ¤Ë struct tm ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+
+--ʸ»úÎó´Ø·¸
+  NOBSTRING            bstring(3) ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  NOINDEX              index(3) ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  NOSTRDUP             strdup(3) ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  USESTRCASECMP                strcasecmp(3) ¤¬¤¢¤ë¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  NOMEMSET             memset(3)¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+
+--timezone ¾ðÊó¤Î¼èÆÀ´Ø·¸
+  FTIME                        ftime(3C) ¤ò»ÈÍѤ·¤¿ÊÑ´¹¤ò¹Ô¤Ê¤¦»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  GETTIMEOFDAY         gettimeofday(2) ¤ò»ÈÍѤ·¤¿ÊÑ´¹¤ò¹Ô¤Ê¤¦»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  MKTIME               mktime(3C) ¤ò»ÈÍѤ·¤¿ÊÑ´¹¤ò¹Ô¤Ê¤¦»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  TIMELOCAL            timelocal(3V) ¤ò»ÈÍѤ·¤¿ÊÑ´¹¤ò¹Ô¤Ê¤¦»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  TZSET                        tzset(3C) ¤ò»ÈÍѤ·¤¿ÊÑ´¹¤ò¹Ô¤Ê¤¦»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  TIMEZONE_HOOK
+
+--¥Ç¥£¥ì¥¯¥È¥êÁàºî´Ø·¸
+  NONSYSTEM_DIR_LIBRARY        ¥Ç¥£¥ì¥¯¥È¥êÁàºî´Ø¿ô(opendir,readdir,closedir)¤¬
+                       ¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£Makefile ¤Î LIBRARYOBJS ¤Ë
+                       lhdir$(O) ¤òÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
+  SYSV_SYSTEM_DIR      struct dirent (direct ¤Ç¤Ï¤Ê¤¤)¤¬¤¢¤ë¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  NODIRECTORY          ¾åµ­¥Þ¥¯¥í¤ò»ÈÍѤ·¤Æ¤â¼ºÇÔ¤¹¤ë»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+
+--¤½¤Î¾
+  NOFTRUNCATE          ftruncate(2) ¤¬¤Ê¤¤»þ¤ËÄêµÁ¤·¤Þ¤¹¡£
+  NOMKDIR              mkdir(2) ¤¬¤Ê¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
+  MKDIRPATH            mkdir ¤Î³°Éô¥³¥Þ¥ó¥É̾¤òÄêµÁ¤·¤Þ¤¹¡£NOMKDIR ¤È
+                       Æ±»þ¤Ëµ¡Ç½¤·¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ï "/bin/mkdir" ¤Ç¤¹¡£
+  RMDIRPATH            rmdir ¤Î³°Éô¥³¥Þ¥ó¥É̾¤òÄêµÁ¤·¤Þ¤¹¡£NOMKDIR ¤È
+                       Æ±»þ¤Ëµ¡Ç½¤·¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ï "/bin/rmdir" ¤Ç¤¹¡£
+  NOT_COMPATIBLE_MODE
+  HAVE_NO_LCHOWN       lchown(2)¤¬Ìµ¤¤¤È¤­¤ËÄêµÁ¤·¤Þ¤¹¡£
diff --git a/header.doc.euc b/header.doc.euc
new file mode 100644 (file)
index 0000000..4ddb477
--- /dev/null
@@ -0,0 +1,180 @@
+/* header.doc (In Japanese) */
+LHa for UNIX ¤Ç»ÈÍѤµ¤ì¤ë¥Ø¥Ã¥À¹½Â¤¤Ë¤Ä¤¤¤Æ    Mar. 2, 1992, Masaru Oki.
+
+----------------------------------------------------------------
+    ËܥС¼¥¸¥ç¥ó¤Ç¤Ï²áÅÏŪ¤ÊÁ¼Ã֤Ȥ·¤Æ3¼ïÎà¤Î¥Ø¥Ã¥À·Á¼°¤òÍÑ°Õ¤·¡¢level-1
+  ¤ò´ûÄêÃͤȤ·¤Æ¤¤¤Þ¤¹¤¬¡¢¾­ÍèŪ¤Ë¤Ï¥Ñ¥¹Ì¾¤Îʸ»ú¿ô¤ËÀ©¸Â¤Î¤Ê¤¤ level-2¤Ë
+  Åý°ì¤¹¤ëÊý¿Ë¤Ç¤¹¡£
+
+
+  A. ¥Ø¥Ã¥À¤Î»ÅÍÍ
+
+-----------------------------------------------------------------------------
+        level-0                 level-1                 level-2
+-----------------------------------------------------------------------------
+      1 header size           1 header size           2 total header size
+      1 header sum            1 header sum
+      5 method ID             5 method ID             5 method ID
+´ð    4 packed size           4 skip size             4 packed size
+      4 original size         4 original size         4 original size
+ËÜ    2 time                  2 time                  4 time(UNIX type)
+      2 date                  2 date
+Éô    1 attribute             1 0x20                  1 RESERVED
+      1 level 0x00            1 level 0x01            1 level 0x02
+ʬ    1 name length           1 name length
+      ? pathname              ? filename
+      2 file crc              2 file crc              2 file crc
+      . ........              1 OS ID 'U'             1 OS ID 'U'
+                              . ........
+                              2 next-header size      2 next-header size
+    *************************************************************************
+     24 + ?                  27 + ?                  26
+-----------------------------------------------------------------------------
+³È                            1 ext-type              1 ext-type
+ĥ                            . ........              . ........
+Éô                            2 next-header size      2 next-header size
+-----------------------------------------------------------------------------
+
+    a. ¥Ø¥Ã¥À¤Î¼ïÎà
+
+      level-0 ¥Ø¥Ã¥À
+          ½¾Íè¤Î LHarc, LArc ¤ÈƱ¤¸·Á¼°¤Ç¤¹¡£¥Ç¥£¥ì¥¯¥È¥ê̾¤Î¶èÀÚ¤ê¤Ï '\'
+        ¤òɸ½à¤È¤·¤Æ¤¤¤Þ¤¹¡£
+
+      level-1 ¥Ø¥Ã¥À
+          ´ûÄêÃͤǤ³¤Î¥Ø¥Ã¥À¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£-x0 ¤ÇºîÀ®¤µ¤ì¤¿ -lh0- ¤Î½ñ¸Ë
+        ¤Ï LHarc ¤Ç²òÅà²Äǽ¤Ç¤¹¤¬¡¢²òÅà»þ¤Ë CRC ¥Á¥§¥Ã¥¯¤Ï¹Ô¤ï¤ì¤Þ¤»¤ó¡£
+
+      level-2 ¥Ø¥Ã¥À
+          Ä¹¤¤¥Õ¥¡¥¤¥ë̾¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤¿¤á¤Î¥Ø¥Ã¥À¤Ç¤¹¡£¾­ÍèŪ¤Ë¤ÏËܥإÃ
+        ¥À¤òɸ½à¤È¤·¤¿¤¤¤Î¤Ç¡¢LH ´ØÏ¢¤Î¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤òºîÀ®¤µ¤ì¤ëÊý¤Ïº£¸å
+        ½àµò¤·¤Æ¤¯¤À¤µ¤ë¤è¤¦¤Ë¤ª´ê¤¤¤·¤Þ¤¹¡£
+
+    b. Åà·ë¡¦²òÅà²Äǽ¤Ê method ID ¤Ë¤Ä¤¤¤Æ
+
+      * ¤ÏºîÀ®²Äǽ¤Ê method
+
+      -lh0- * no compression
+
+      -lh1- * 4k sliding dictionary(max 60 bytes) + dynamic Huffman
+              + fixed encoding of position
+
+      -lh2-   8k sliding dictionary(max 256 bytes) + dynamic Huffman
+
+      -lh3-   8k sliding dictionary(max 256 bytes) + static Huffman
+
+      -lh4- * 4k sliding dictionary(max 256 bytes) + static Huffman
+              + improved encoding of position and trees
+
+      -lh5- * 8k sliding dictionary(max 256 bytes) + static Huffman
+              + improved encoding of position and trees
+
+      -lh6-   32k sliding dictionary(max 256 bytes) + static Huffman
+                         + improved encoding of position and trees
+
+      -lzs-   2k sliding dictionary(max 17 bytes)
+
+      -lz4-   no compression
+
+      -lz5-   4k sliding dictionary(max 17 bytes)
+
+    c. OS ID ¤Ë¤Ä¤¤¤Æ
+
+      ¸½ºß¤Î¤È¤³¤í¡¢°Ê²¼¤Î ID ¤òͽÌ󤷤Ƥ¤¤Þ¤¹¡£
+
+        MS-DOS  'M'
+        OS/2    '2'
+        OS9     '9'
+        OS/68K  'K'
+        OS/386  '3'
+        HUMAN   'H'
+        UNIX    'U'
+        CP/M    'C'
+        FLEX    'F'
+        Mac     'm'
+        Runser  'R'
+
+  B. ³ÈÄ¥Éôʬ
+
+    a. OS Èó°Í¸ (0x00 - 0x3f)
+
+        common header
+         1 0x00
+         2 header crc
+       ( 1 information )
+         2 next-header size
+
+        filename header
+         1 0x01
+         ? filename
+         2 next-header size
+
+        dirname header
+         1 0x02
+         ? dirname
+         2 next-header size
+
+        comment header
+         1 0x3f
+         ? comments
+         2 next-header size
+
+(°Ê¾å¡¢µÈºê»á¤Î lhx.doc ¤è¤ê)
+----------------------------------------------------------------
+LHa for UNIX ³ÈÄ¥¥Ø¥Ã¥À»ÅÍÍ
+
+¡¦°Í¸¾ðÊó¤Î¼ïÎà(³ÊǼ¤¹¤Ù¤­¾ðÊó)
+       UNIX ¤Ë°Í¸¤¹¤ë¾ðÊó¤Çµ­Ï¿¤¹¤Ù¤­¤Ï°Ê²¼¤Î¤â¤Î¤Ç¤¢¤ë¡£
+       (1) ¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó
+       (2) GID,UID
+       (3) ¥°¥ë¡¼¥×̾¡¢¥æ¡¼¥¶Ì¾
+       (4) ºÇ½ªÊѹ¹»þ¹ï(UNIX time)
+
+¡¦°Í¸¾ðÊó¤Î¥¿¥¤¥×(ext-type)
+         ³ÈÄ¥¥Ø¥Ã¥À¤ÎÀèƬ1¥Ð¥¤¥È¤Ë¤Ï¾ðÊ󤬲¿¤ò¼¨¤¹¤â¤Î
+       ¤«¼±Ê̤¹¤ë¤¿¤á¤ÎÃͤ¬³ÊǼ¤µ¤ì¤Æ¤¤¤ë¡£
+       UNIX°Í¸¾ðÊó¤È¤·¤Æ 0x50 - 0x54 ¤ò»ÈÍѤ¹¤ë¡£
+
+¡¦°Í¸¾ðÊó¤Î³ÊǼÊýË¡
+       ¾åµ­ (1) - (4) ¤ò¤½¤ì¤¾¤ìÊ̤Υ¿¥¤¥×¤È¤¹¤ë¡£
+
+       (1)¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó
+               size    ÃÍ
+               1       0x50
+               2       ¥Ñ¡¼¥ß¥Ã¥·¥ç¥óÃÍ
+               2       next-header size
+
+       (2)GID,UID
+               size    ÃÍ
+               1       0x51
+               2       GID
+               2       UID
+               2       next-header size
+
+       (3)-1 ¥°¥ë¡¼¥×̾
+               1       0x52
+               ?       ¥°¥ë¡¼¥×̾ʸ»úÎó
+               2       next-header size
+
+       (3)-2 ¥æ¡¼¥¶Ì¾
+               1       0x53
+               ?       ¥æ¡¼¥¶Ì¾Ê¸»úÎó
+               2       next-header size
+
+       (4) ºÇ½ªÊѹ¹»þ¹ï (for header_level1)
+               1       0x54
+               4       UNIX »þ´Ö
+               2       next-header size
+
+¡¦LHa for UNIX ver 1.14 ¤Ç¤Î¼ÂÁõ¡ÊÌʺê¡Ë
+       ¾åµ­(3)¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
+       (3)¤Î¥°¥ë¡¼¥×̾¡¢¥æ¡¼¥¶Ì¾¤Î¾ðÊó¤ò´Þ¤à½ñ¸Ë¤òºîÀ®¤¹¤ë¤³¤È
+       ¤Ï¤Ê¤¯¡¢Å¸³«»þ¤Ë¤Ï̵»ë¤¹¤ë¡£
+       ¤Þ¤¿¡¢(4)¤Ï¥Ø¥Ã¥À¥ì¥Ù¥ë1¤Î½ñ¸Ë¤Ë¤Î¤ß´Þ¤Þ¤ì¤ë¡£
+----------------------------------------------------------------
+°Ê¾å¡£
+
+°ìÉô²þÊÑ¡§
+Ìʺꡡ½¤Î´ (Nobutaka Watazaki)
+watazaki@shimadzu.co.jp
diff --git a/man/Makefile b/man/Makefile
new file mode 100644 (file)
index 0000000..dc3e0d5
--- /dev/null
@@ -0,0 +1,20 @@
+################################################################
+# Makefile for LHa man directory
+################################################################
+
+NROFF = nroff
+#NROFF = jman
+
+all:   lha.man
+
+lha.man: lha.n
+       $(NROFF) -man lha.n > lha.man
+
+install:
+       $(INSTALL) $(INSTALLMAN) lha.n $(MANDIR)/man$(MANSECT)/lha.$(MANSECT)
+
+clean:
+       rm -f *~
+
+moreclean:
+       rm -f lha.man core *~ *.orig
diff --git a/man/lha.man b/man/lha.man
new file mode 100644 (file)
index 0000000..045148a
--- /dev/null
@@ -0,0 +1,324 @@
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+N\bN\bNA\bA\bAM\bM\bME\bE\bE Ì¾\b\b̾\b\b̾¾Î\b\b¾Î\b\b¾Î
+     LHa - ¹â°µ½Ì¥¢¡¼¥«¥¤¥Ð
+
+S\bS\bSY\bY\bYN\bN\bNO\bO\bOP\bP\bPS\bS\bSI\bI\bIS\bS\bS ·Á\b\b·Á\b\b·Á¼°\b\b¼°\b\b¼°
+     l\bl\blh\bh\bha\ba\ba k\bk\bke\be\bey\by\by [ m\bm\bmo\bo\bod\bd\bdi\bi\bif\bf\bfi\bi\bie\be\ber\br\brs\bs\bs ] _\ba_\br_\bc_\bh_\bi_\bv_\be__\bf_\bi_\bl_\be [ _\bf_\bl_\bi_\be ... ]
+     l\bl\blh\bh\bha\ba\ba _\ba_\br_\bc_\bh_\bi_\bv_\be__\bf_\bi_\bl_\be
+
+D\bD\bDE\bE\bES\bS\bSC\bC\bCR\bR\bRI\bI\bIP\bP\bPT\bT\bTI\bI\bIO\bO\bON\bN\bN ²ò\b\b²ò\b\b²òÀâ\b\bÀâ\b\bÀâ
+     L\bL\bLH\bH\bHa\ba\ba ¤Ï¸úΨ¤Î¹â¤¤°µ½Ìµ¡Ç½¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¥¢¡¼¥«¥¤¥Ð¤Ç¤¹¡£
+     k\bk\bke\be\bey\by\by  ¤Ëµ¡Ç½Ê¸»ú¤ò»ØÄꤷ¡¢file   ¤ÎÄɲᢹ¹¿·¡¢Ãê½Ð¡¢ºï½ü¡¢°ì
+     Í÷ɽ¼¨¤Ê¤É¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£°ú¿ô¤Ë  archive_file  ¤Î¤ß¤ò»ØÄꤷ¤¿
+     ¾ì¹ç¤Ë¤Ï¡¢µ¡Ç½Ê¸»ú¤Ë  l   ¤ò»ØÄꤷ¤¿¤Î¤ÈƱÅù¤ÎÆ°ºî¤ò¹Ô¤Ê¤¤¤Þ
+     ¤¹¡£
+     µ¡Ç½Ê¸»ú¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
+
+     a\ba\ba       Äɲá£file ¤ò archive_file  ¤ËÄɲä·¤Þ¤¹¡£file  ¤¬¥Ç
+             ¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë´Þ¤Þ¤ì¤ë¥Õ¥¡
+             ¥¤¥ë¤ò¤¹¤Ù¤ÆÄɲä·¤Þ¤¹¡£
+
+     u\bu\bu       ¹¹¿·¡£file  ¤¬  archive_file  ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢
+             ¤â¤·¤¯¤Ï³ÊǼ¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤¬¸Å¤±¤ì¤Ð¡¢file        ¤ò
+             archive_file ¤ËÄɲä·¤Þ¤¹¡£
+
+     l\bl\bl ¤Þ\b\b¤Þ\b\b¤Þ¤¿\b\b¤¿\b\b¤¿¤Ï\b\b¤Ï\b\b¤Ï v\bv\bv
+             °ìÍ÷ɽ¼¨¡£archive_file  ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë  file  ¤Î¾ð
+             Êó¤ò°ìÍ÷ɽ¼¨¤·¤Þ¤¹¡£file            ¤Î»ØÄ꤬¤Ê¤±¤ì¤Ð
+             archive_file    Æâ¤ÎÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤òɽ¼¨¤·¤Þ¤¹
+             ¡£v ¤ò»ØÄꤹ¤ë¤È l ¤è¤ê¤â¾Ü¤·¤¤¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡£
+
+     x\bx\bx ¤Þ\b\b¤Þ\b\b¤Þ¤¿\b\b¤¿\b\b¤¿¤Ï\b\b¤Ï\b\b¤Ï e\be\be
+             Ãê½Ð¡£archive_file ¤«¤é file  ¤òÃê½Ð¤·¤Þ¤¹¡£file  ¤Î
+             »ØÄ꤬¤Ê¤±¤ì¤Ð  archive_file  Æâ¤ÎÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤òÃê
+             ½Ð¤·¤Þ¤¹¡£Ãê½Ð¤¹¤Ù¤­¥Õ¥¡¥¤¥ë¤¬¤¹¤Ç¤Ë¸ºß¤·¤Æ¤¤¤ë¾ì
+             ¹ç¤Ë¤Ï¡¢½Å¤Í½ñ¤­¤·¤Æ¤¤¤¤¤«¤ÎÌ䤤¹ç¤ï¤»¤ò¹Ô¤Ê¤¤¤Þ¤¹
+             ¡£
+
+     p\bp\bp       ÆâÍÆɽ¼¨¡£archive_file  ¤«¤é  file  ¤ÎÆâÍƤò¼è¤ê½Ð¤·
+             ¡¢É¸½à½ÐÎϤؤȽÐÎϤ·¤Þ¤¹¡£file    ¤Î»ØÄ꤬¤Ê¤±¤ì¤Ð¡¢
+             Á´¤Æ¤ÎÆâÍƤò½ÐÎϤ·¤Þ¤¹¡£
+
+     d\bd\bd       ºï½ü¡£archive_file ¤«¤é file ¤òºï½ü¤·¤Þ¤¹¡£
+
+     m\bm\bm       °ÜÆ°¡£file ¤ò archive_file  ¤ËÄɲä·¤¿¸å¡¢file  ¤òºï
+             ½ü¤·¤Þ¤¹¡£¤³¤ì¤Ï¡¢key  ¤Ë  a ¤ò¡¢modifiers ¤Ë d ¤ò»Ø
+             Äꤷ¤¿»þ¤ÈƱ¤¸Æ°ºî¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+
+
+                        January 14,1997                         1
+
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+     c\bc\bc       ¿·µ¬ºîÀ®¡£archive_file  ¤ò¿·¤¿¤ËºîÀ®¤·¡¢file  ¤òÄɲÃ
+             ¤·¤Þ¤¹¡£
+
+     µ¡Ç½Êѹ¹Ê¸»ú modifiers ¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤Ã¤Æ  key  ¤ÎÆ°ºî¤Î
+     ¾ÜºÙ¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£modifiers   ¤Ï¡¢°Ê²¼¤ÎÃ椫¤éÊ£
+     ¿ô»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+
+
+
+     q\bq\bq<\b<\b<n\bn\bnu\bu\bum\bm\bm>\b>\b>  É½¼¨¤ÎÍÞÀ©¡£ÂÐÏÃŪ¤Ê¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨¤òÍÞÀ©¤·¤Þ¤¹¡£
+             <num>  ¤ÎÃͤˤè¤Ã¤Æ¡¢INDICATOR  ¤Îɽ¼¨ÊýË¡¤òÊѹ¹¤Ç¤­
+             ¤Þ¤¹¡£
+
+             q\bq\bq0\b0\b0 o\bo\boo\bo\bo.\b.\b..\b.\b..\b.\b..\b.\b. ¤Î\b\b¤Î\b\b¤Îɽ\b\bɽ\b\bɽ¼¨\b\b¼¨\b\b¼¨¤ò\b\b¤ò\b\b¤ò¹Ô\b\b¹Ô\b\b¹Ô¤Ê\b\b¤Ê\b\b¤Ê¤¦\b\b¤¦\b\b¤¦¡£\b\b¡£\b\b¡£
+
+             q\bq\bq1\b1\b1 ¥Õ\b\b¥Õ\b\b¥Õ¥¡\b\b¥¡\b\b¥¡¥¤\b\b¥¤\b\b¥¤¥ë\b\b¥ë\b\b¥ë̾\b\b̾\b\b̾ɽ\b\bɽ\b\bɽ¼¨\b\b¼¨\b\b¼¨¤Î\b\b¤Î\b\b¤Î¤ß\b\b¤ß\b\b¤ß¹Ô\b\b¹Ô\b\b¹Ô¤Ê\b\b¤Ê\b\b¤Ê¤¦\b\b¤¦\b\b¤¦¡£\b\b¡£\b\b¡£
+
+             q\bq\bq2\b2\b2 ²¿\b\b²¿\b\b²¿¤â\b\b¤â\b\b¤âɽ\b\bɽ\b\bɽ¼¨\b\b¼¨\b\b¼¨¤·\b\b¤·\b\b¤·¤Ê\b\b¤Ê\b\b¤Ê¤¤\b\b¤¤\b\b¤¤¡£\b\b¡£\b\b¡£
+
+             ¤Ê¤ª¡¢ÃͤòÆþÎϤ·¤Ê¤«¤Ã¤¿ºÝ¤Ë¤Ï¡¢q2    ¤ÈƱÅù¤Ë¤Ê¤ê¤Þ
+             ¤¹¡£
+
+     v\bv\bv       É½¼¨¤Î¾éĹ²½¡£É½¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸¤ò¾éŤˤ·¤Þ¤¹¡£
+
+     n\bn\bn       ¼Â¹Ô¤·¤Ê¤¤¡£¼ÂºÝ¤Î¹¹¿·¤äÃê½Ð¤ÎÆ°ºî¤ò¹Ô¤Ê¤¤¤Þ¤»¤ó¡£
+             ¼Â¹ÔÆâÍƤγÎǧ¤Î¤¿¤á¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+
+     f\bf\bf       ¶¯À©Åª¤Ê¼Â¹Ô¡£¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ¤Ë¡¢Â¸ºß¤¹¤ë¥Õ¥¡¥¤¥ë
+             ¤Îºï½ü³Îǧ¤ò¹Ô¤Ê¤ï¤º¶¯À©Åª¤Ëºï½ü¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+
+     t\bt\bt       ¥Æ¥­¥¹¥È¥â¡¼¥É¤Ë¤è¤ë³ÊǼ,Ãê½Ð¡£¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë
+             ¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Ë¤Ï¡¢UNIX  ¤«¤é  MS-DOS  ¤Ø¤Î²þ
+             ¹Ô¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ¤Ë¤ÏµÕ¤Ë
+             ¡¢MS-DOS  ¤«¤é  UNIX  ¤Ø¤Î²þ¹Ô¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ê¤¤¤Þ¤¹
+             ¡£
+
+     o\bo\bo{\b{\b{n\bn\bnu\bu\bum\bm\bm}\b}\b}  LHarc   ¸ß´¹¥¢¡¼¥«¥¤¥Ö¤ÎÀ¸À®¡¢¤Þ¤¿¤Ï°µ½Ì¥¢¥ë¥´¥ê¥º¥à
+             ¤ò»ØÄꤹ¤ë¡£µ¡Ç½Ê¸»ú  a,  u,  m ¤È¶¦¤Ë»ØÄꤷ¡¢Ãê½Ð»þ
+             ¤Ë¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£
+
+             o\bo\bo L\bL\bLH\bH\bHa\ba\bar\br\brc\bc\bc ¸ß\b\b¸ß\b\b¸ß´¹\b\b´¹\b\b´¹¥¢\b\b¥¢\b\b¥¢¡¼\b\b¡¼\b\b¡¼¥«\b\b¥«\b\b¥«¥¤\b\b¥¤\b\b¥¤¥Ö\b\b¥Ö\b\b¥Ö¤Î\b\b¤Î\b\b¤ÎÀ¸\b\bÀ¸\b\bÀ¸À®\b\bÀ®\b\bÀ®¤ò\b\b¤ò\b\b¤ò¹Ô\b\b¹Ô\b\b¹Ô¤¦\b\b¤¦\b\b¤¦¡£\b\b¡£\b\b¡£
+
+                  ¸Å¤¤·Á¼°¤Î¥¢¡¼¥«¥¤¥Ö¤òÀ¸À®¤·¤Þ¤¹¡£°µ½Ì¥¢¥ë¥´
+                  ¥ê¥º¥à¤Ï-lh1-¤ò»ÈÍѤ·¤Þ¤¹¡£
+
+
+
+                        January 14,1997                         2
+
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+             o\bo\bo5\b5\b5 °µ\b\b°µ\b\b°µ½Ì\b\b½Ì\b\b½Ì¥¢\b\b¥¢\b\b¥¢¥ë\b\b¥ë\b\b¥ë¥´\b\b¥´\b\b¥´¥ê\b\b¥ê\b\b¥ê¥º\b\b¥º\b\b¥º¥à\b\b¥à\b\b¥à¤Ë\b\b¤Ë\b\b¤Ë -\b-\b-l\bl\blh\bh\bh5\b5\b5- ¤ò\b\b¤ò\b\b¤ò»È\b\b»È\b\b»ÈÍÑ\b\bÍÑ\b\bÍѤ¹\b\b¤¹\b\b¤¹¤ë\b\b¤ë\b\b¤ë¡£\b\b¡£\b\b¡£
+
+             o\bo\bo6\b6\b6 °µ\b\b°µ\b\b°µ½Ì\b\b½Ì\b\b½Ì¥¢\b\b¥¢\b\b¥¢¥ë\b\b¥ë\b\b¥ë¥´\b\b¥´\b\b¥´¥ê\b\b¥ê\b\b¥ê¥º\b\b¥º\b\b¥º¥à\b\b¥à\b\b¥à¤Ë\b\b¤Ë\b\b¤Ë -\b-\b-l\bl\blh\bh\bh6\b6\b6- ¤ò\b\b¤ò\b\b¤ò»È\b\b»È\b\b»ÈÍÑ\b\bÍÑ\b\bÍѤ¹\b\b¤¹\b\b¤¹¤ë\b\b¤ë\b\b¤ë¡£\b\b¡£\b\b¡£
+
+             LHA¤Î¼ïÎà¤Ë¤è¤Ã¤Æ¤Ï¡¢-lh6-¤ÇÀ¸À®¤µ¤ì¤¿¥¢¡¼¥«¥¤¥Ö¤Ï
+             Ãê½Ð¤Ç¤­¤Ê¤¤¶²¤ì¤¬¤¢¤ë¤Î¤Ç¡¢¥¢¡¼¥«¥¤¥Ö¤òÇÛÉÛ¤¹¤ëºÝ
+             ¤Ë¤ÏÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£MSDOSÈǤÎÀµµ¬ÇÛÉÛÈǤǤϠ -lh6-
+             ¤ÎÀ¸À®¤Ï¹Ô¤¤¤Þ¤»¤ó¡£¤Þ¤¿¡¢MSDOSÈÇ  LHA  version 2.5x
+             °Ê¹ß¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï -lh6- ¤ÎÃê½Ð¤Î¤ß¤Ç¤­¤Þ¤¹¡£
+
+     w\bw\bw=\b=\b=<\b<\b</\b/\b/d\bd\bdi\bi\bir\br\br>\b>\b>
+             ³ÊǼ¤ª¤è¤ÓÃê½Ð»þ¤Î¥ï¡¼¥¯Íѥǥ£¥ì¥¯¥È¥ê»ØÄê¡£¥Ç¥Õ¥©
+             ¥ë¥È¤Ç¤Ï¡¢/tmp  ¤Ç¤¹¤¬¡¢/tmp  ¤ÎÂ礭¤µ°Ê¾å¤Î¥Õ¥¡¥¤¥ë
+             ¤ò³ÊǼ¤¹¤ëºÝ¤Ë¤ÏɬÍפǤ¹¡£
+
+     d\bd\bd       ¥Õ¥¡¥¤¥ë³ÊǼ¸å¤Î¥Õ¥¡¥¤¥ë¤Îºï½ü¡£µ¡Ç½Ê¸»ú  a,  ¤â¤·¤¯
+             ¤Ï   u  ¤È¶¦¤ËÍѤ¤¡¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î
+             ³ÊǼ¤Î¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Þ¤¹¡£u   ¤ËÉղä·¤¿¾ì¹ç¡¢
+             ¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ÎÆâÍƤÎÊý¤¬¿·¤·¤¤»þ¤Ë¥Õ¥¡¥¤¥ë¤¬
+             ³ÊǼ¤µ¤ì¤º¤Ëºï½ü¤µ¤ì¤ë¤³¤È¤Ë¤Ê¤ë¤Î¤ÇÃí°Õ¤·¤Æ²¼¤µ¤¤
+             ¡£
+
+     i\bi\bi       Ãê½Ð»þ¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤Î̵¸ú²½¡£Ãê½Ð»þ¤Ë¥Ç¥£¥ì¥¯¥È
+             ¥ê̾¤ò̵¸ú¤Ë¤·¤Þ¤¹¡£
+
+     z\bz\bz       È󰵽̳ÊǼ¡£¥¢¡¼¥«¥¤¥Ö¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Ë°µ½Ì¤ò
+             ¹Ô¤Ê¤¤¤Þ¤»¤ó¡£¤¹¤Ç¤Ë°µ½Ì¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤Æ°µ½Ì¸úΨ¤ò˾
+             ¤á¤Ê¤¤¾ì¹ç¤Ê¤É¤Ë»ÈÍѤ·¤Þ¤¹¡£Ãê½Ð»þ¤Ë¤Ï̵»ë¤µ¤ì¤Þ¤¹
+             ¡£
+
+     g\bg\bg       [generic]¥¢¡¼¥«¥¤¥Ö¤ÎºîÀ®¡£UNIX   ÍѤÎÉղþðÊó¤ò»ý¤¿
+             ¤Ê¤¤¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤Þ¤¹¡£Ãê½Ð»þ¤Ë¤Ï̵»ë
+             ¤µ¤ì¤Þ¤¹¡£
+
+     0\b0\b0/\b/\b/1\b1\b1/\b/\b/2\b2\b2   ¥Ø¥Ã¥À¥ì¥Ù¥ë»ØÄê¡£¥¢¡¼¥«¥¤¥Ö¤ÎÆâÉôɽ¸½¤Î·Á¼°¤ò»ØÄê
+             ¤·¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï 1 ¤Ç¤¹¡£0 ¤Ï  LHarc  ¤ÇÍÑ°Õ¤µ
+             ¤ì¤Æ¤¤¤¿¸Å¤¤·Á¼°¤Ç¤¹¡£¾­Íè¤Ï   2  ¤Î·Á¼°¤ËÅý°ì¤µ¤ì¤ë
+             ¤è¤¦¤Ç¤¹¡£¤³¤ì¤Ï¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Î¤ßÍ­¸ú¤Ç¤¹¡£¥Õ¥¡
+             ¥¤¥ë¤ÎÃê½Ð»þ¤Ë¤Ï¼«Æ°Åª¤Ë·Á¼°¤òȽÃǤ·½èÍý¤·¤Þ¤¹¡£
+
+     _\ba_\br_\bc_\bh_\bi_\bv_\be__\bf_\bi_\bl_\be ¤Ë¤Ï¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Þ¤¹¡£
+
+     _\ba_\br_\bc_\bh_\bi_\bv_\be__\bf_\bi_\bl_\be  ¤Ë-   ¤È½ñ¤¯¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ò
+     É¸½àÆþ½ÐÎϤˤ¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£t\bt\bta\ba\bar\br\br(1)    ¤Î¤è¤¦¤Ë¡¢¥¢¡¼¥«¥¤
+     ¥Ö¤ÎºîÀ®¡¢¹¹¿·»þ¤Ë¤Ïɸ½à½ÐÎϤˡ¢¥¢¡¼¥«¥¤¥Ö¤«¤é¤Î¥Õ¥¡¥¤¥ë¤Î
+
+
+                        January 14,1997                         3
+
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+     Ãê½Ð»þ¤Ë¤Ïɸ½àÆþÎϤˤʤê¤Þ¤¹¡£
+
+     Ãê½Ð»þ¤Ë_\ba_\br_\bc_\bh_\bi_\bv_\be__\bf_\bi_\bl_\be  ¤¬Â¸ºß¤·¤Ê¤¤»þ¤Ë¤Ï¥µ¥Õ¥£¥Ã¥¯¥¹.\b.\b.l\bl\blz\bz\bzh\bh\bh  ¤ò
+     ¥Õ¥¡¥¤¥ë̾¤Î¸å¤í¤ËÉղä·¤ÆÃê½Ð¤ò»î¤ß¤Þ¤¹¡£
+     Æä˵¬Äê¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢±¿ÍѾ奵¥Õ¥£¥Ã¥¯¥¹¤È¤·¤Æ.\b.\b.l\bl\blz\bz\bzh\bh\bh    ¤òÍÑ
+     ¤¤¤ë¤Î¤¬Ë¾¤Þ¤·¤¤¤È»×¤¤¤Þ¤¹¡£ÆüËܰʳ°¤Ç¤Ï  .\b.\b.l\bl\blh\bh\bha\ba\ba  ¤ò»ÈÍѤ·¤Æ¤¤
+     ¤ë¥±¡¼¥¹¤¬¤¢¤ë¤½¤¦¤Ç¤¹¤Î¤Ç¡¢Å¬µ¹Ä´À°¤·¤Æ²¼¤µ¤¤¡£:-)
+     ¥µ¥Õ¥£¥Ã¥¯¥¹¤¬c\bc\bco\bo\bom\bm\bm ¤â¤·¤¯¤Ï.\b.\b.e\be\bex\bx\bxe\be\be  ¤Î¾ì¹ç¤Ë¤Ï¡¢MS-DOS  ÈǤǺîÀ®
+     ¤µ¤ì¤¿_\bS_\bF_\bX(¼«¸ÊŸ³«µ¡Ç½ÉÕ¤­¤Î°µ½Ì¥Õ¥¡¥¤¥ë)   ·Á¼°¤«¤É¤¦¤«¤ò¥Á
+     ¥§¥Ã¥¯¤·¡¢Âбþ¤·¤Þ¤¹¡£
+     ¥µ¥Õ¥£¥Ã¥¯¥¹¤¬.\b.\b.x\bx\bx  ¤Î¾ì¹ç¤Ë¤Ï¡¢ÆüËÜÀ½  SHARP  X68000  ¤Î  OS,
+     Human68k  ÈǤǺîÀ®¤µ¤ì¤¿  SFX ·Á¼°¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤·Âбþ¤·
+     ¤Þ¤¹¡£
+     SFX   ·Á¼°¤Î¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ËÂФ·¤ÆÄɲääºï½ü¤ò¹Ô¤Ã¤¿¾ì¹ç
+     ¤Ë¤Ï¡¢¥µ¥Õ¥£¥Ã¥¯¥¹¤ò.\b.\b.l\bl\blz\bz\bzh\bh\bh   ¤ËÊѹ¹¤·¡¢SFX  ¤Î¾ðÊó¤òºï½ü¤·¤Þ¤¹
+     ¡£
+
+F\bF\bFI\bI\bIL\bL\bLE\bE\bES\bS\bS ¥Õ\b\b¥Õ\b\b¥Õ¥¡\b\b¥¡\b\b¥¡¥¤\b\b¥¤\b\b¥¤¥ë\b\b¥ë\b\b¥ë
+     *.lzh          - LHa/LHarc ¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë
+     *.bak          - ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥¡¥¤¥ë
+     /tmp/lh*       - ¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë
+     *.com *.exe    - MS-DOS SFX ¥Õ¥¡¥¤¥ë
+     *.x            - Human68k SFX ¥Õ¥¡¥¤¥ë
+
+S\bS\bSE\bE\bEE\bE\bE A\bA\bAL\bL\bLS\bS\bSO\bO\bO ´Ø\b\b´Ø\b\b´ØÏ¢\b\bÏ¢\b\bÏ¢¹à\b\b¹à\b\b¹àÌÜ\b\bÌÜ\b\bÌÜ
+     t\bt\bta\ba\bar\br\br(1), a\ba\bar\br\br(1), c\bc\bco\bo\bom\bm\bmp\bp\bpr\br\bre\be\bes\bs\bss\bs\bs(1)
+
+D\bD\bDI\bI\bIS\bS\bST\bT\bTR\bR\bRI\bI\bIB\bB\bBU\bU\bUT\bT\bTI\bI\bIO\bO\bON\bN\bN ºÆ\b\bºÆ\b\bºÆÇÛ\b\bÇÛ\b\bÇÛÉÛ\b\bÉÛ\b\bÉÛ¤Ë\b\b¤Ë\b\b¤Ë¤Ä\b\b¤Ä\b\b¤Ä¤¤\b\b¤¤\b\b¤¤¤Æ\b\b¤Æ\b\b¤Æ
+
+     °Ê²¼¤Î¾ò·ï¤Ç¡¢ºÆÇÛÉÛ¡¢Å¾ºÜ¡¢²þÊѤòµö²Ä¤·¤Þ¤¹¡£
+
+     1.      Ãøºî¸¢É½¼¨¤òºï½ü¤·¤Ê¤¤¤³¤È¡£
+
+     2.      ÇÛÉÛÆâÍƤˤĤ¤¤Æ¤Ï¡¢
+
+     a.      ÇÛÉۤκݤ˸ºß¤¹¤ëÆâÍÆ(¤¹¤Ê¤ï¤Á¥½¡¼¥¹¥³¡¼¥É¡¢¥É¥­
+             ¥å¥á¥ó¥È¡¢¥×¥í¥°¥é¥Þ¡¼¤Ø¤Î¼ê°ú¤­¤Ê¤É)¤¬ºÆÇÛÉÛ¤µ¤ì
+             ¤¿¤â¤Î¤ÎÃæ¤Ëɬ¤ºÂ¸ºß¤¹¤ë¤³¤È¡£²þÊѤµ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð
+             ¡¢¤½¤ì¤òÌÀ¼¨¤·¤¿¥É¥­¥å¥á¥ó¥È¤òÍÑ°Õ¤¹¤ë¤³¤È¡£
+
+     b.      LHa   ¤ËÂФ¹¤ëÉղòÁÃͤ¬ÉÕ¤±¤é¤ì¤ÆºÆÇÛÉÛ¤µ¤ì¤ë¾ì¹ç¤Ë
+             ¤Ï¤½¤ì¤é¤â¤Ç¤­¤ë¤À¤±´Þ¤á¤ë¤è¤¦ÅØÎϤ¹¤ë¤³¤È¡£¤Þ¤¿¡¢
+             ¤½¤ÎºÝ¤Ë¤ÏÉղòÁÃͤ¬ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¤³¤È¤òÌÀ¼¨¤·¤¿¥É
+             ¥­¥å¥á¥ó¥È¤òÍÑ°Õ¤¹¤ë¤³¤È¡£
+
+
+
+                        January 14,1997                         4
+
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+     c.      ¥Ð¥¤¥Ê¥ê¤Î¤ß¤ÎÇÛÉۤϵö¤µ¤ì¤Ê¤¤¡£(ÉղòÁÃͤΤâ¤Î¤â
+             ´Þ¤à)
+
+     3.      ºÇ¿·ÈǤÎÇÛÉÛ¤Ë̳¤á¤ë¤³¤È¡£(µÁ̳¤Ï¤Ê¤¤)
+
+     Ãí.     ¤Ê¤ª¡¢¥Í¥Ã¥È¤Ç¤ÎÇÛÉդϼ«Í³¤Ç¤¢¤ë¤¬¡¢¥Í¥Ã¥È¤Ë¥¢¥¯¥»
+             ¥¹¤Ç¤­¤Ê¤¤Êý¡Ê»¨»ï¤ª¤è¤Ó¡¢CD-ROM    ¤Ê¤É¤Ë¤è¤ë¡ËÇÛÉÕ
+             ¤Ï¡¢ÇÛÉÕÁ°¤Ë¤³¤Á¤é¤Ë  E-Mail  ¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£ÇÛÉÕÁ°
+             ¤Ë½ÐÍè¤Ê¤¤ºÝ¤Ë¤Ï¡¢¸åÆüɬ¤º E-Mail ¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£
+
+     4.      ¤³¤Î¥×¥í¥°¥é¥à¤Î¸ºß¤ä»ÈÍѤ·¤¿¤³¤È¤Ë¤è¤Ã¤ÆÀ¸¤¸¤¿Â»
+             ³²¤ÏÁ´¤¯Êݾڤ·¤Ê¤¤¡£
+
+     5.      ºî¼Ô¤Ï¡¢¤³¤Î¥×¥í¥°¥é¥à¤ËÉÔÈ÷¤¬¤¢¤Ã¤Æ¤â¡¢¤½¤ì¤òÄûÀµ
+             ¤¹¤ëµÁ̳¤òÉé¤ï¤Ê¤¤¡£
+
+     6.      ¤³¤Î¥×¥í¥°¥é¥à¤Î°ìÉô¡¢¤Þ¤¿¤ÏÁ´Éô¤ò¾¤Î¥×¥í¥°¥é¥à¤Ë
+             ÁȤ߹þ¤ó¤ÇÍøÍѤ·¤Æ¤â¤«¤Þ¤ï¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢¤½¤Î¥×¥í
+             ¥°¥é¥à¤Ï LHa ¤Ç¤Ï¤Ê¤¯¡¢LHa ¤È̾¾è¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
+
+     7.      ¾¦ÍøÍѤ˴ؤ·¤Æ¤Ï¡¢¾åµ­¤Î¾ò·ï¤Ë²Ã¤¨¡¢²¼µ­¤Î¾ò·ï¤Î¤â
+             ¤È¤Ë¤³¤ì¤òǧ¤á¤ë¡£
+
+     a.      ¤³¤Î¥×¥í¥°¥é¥à¤ò¥á¥¤¥ó¤È¤¹¤ë¾¦ÍøÍѤ϶ػߤ¹¤ë¡£
+
+     b.      ¾¦ÍøÍѤÎÁê¼ê¤¬¤³¤Î¥×¥í¥°¥é¥à¤Î»ÈÍѼԤȤ·¤ÆÉÔŬÀÚ¤È
+             È½ÃǤ·¤¿¾ì¹ç¤Ë¤ÏÇÛÉÛ¤·¤Ê¤¤¡£
+
+     c.      ¥¤¥ó¥¹¥È¡¼¥ë¤Î¼êÃʤȤ·¤Æ»ÈÍѤ¹¤ë¾ì¹ç¡¢¤³¤Î¥×¥í¥°¥é
+             ¥à¤ò»È¤¦¤³¤È¤òÁê¼ê¤Ë¶¯À©¤·¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢¾¦ÍøÍѼÔ
+             ¤¬ºî¶È¤ò¹Ô¤¦¡£¤Þ¤¿¡¢¤½¤Î¤È¤­¤Î»³²¤Ï¡¢¾¦ÍøÍѼԤ¬Á´
+             ÀÕǤ¤òÉ餦¡£
+
+     d.      ¾¦ÍøÍѤòÉղòÁÃͤȤ·¤Æ¹Ô¤¤¤³¤Î¥×¥í¥°¥é¥à¤ò»ÈÍѤ¹¤ë
+             ¾ì¹ç¡¢¾¦ÍøÍѼԤϡ¢¤½¤Î¥µ¥Ý¡¼¥È¤ò¹Ô¤¦¡£
+
+ºÇ\b\bºÇ\b\bºÇ¸å\b\b¸å\b\b¸å¤Ë\b\b¤Ë\b\b¤Ë(\b(\b(F\bF\bFr\br\bro\bo\bom\bm\bm Y\bY\bY.\b.\b.T\bT\bTa\ba\bag\bg\bga\ba\baw\bw\bwa\ba\ba)\b)\b)
+     LZHUF  Ë¡¤Î´ðÁäȤʤä¿  LZARI  Ë¡¤òȯɽ¤·¤Æ¤¯¤À¤µ¤Ã¤¿±ü¼À²
+     É§»á¡¢¤½¤ì¤ò  NIFTY-Serve  ¤Ë¾Ò²ð¤·¡¢¤Þ¤¿¡¢LArc ¤Îºî¼Ô¤Ç¤â¤¢
+     ¤ë»°ÌÚÏÂɧ»á¡¢¤Þ¤¿¡¢¤³¤ì¤é¤ÎÍ×°ø¤«¤é  LZHUF   Ë¡µÚ¤Ó¡¢MS-DOS
+     ÈÇ  LHarc  ¤òºîÀ®¤·¤¿µÈºê±ÉÂٻᡢLHarc UNIX ¤Î³«È¯¤Ë¶¨ÎϤ·¤¿
+     ¿Íã¡¢¤³¤³¤í¤è¤¯¥á¥Ã¥»¡¼¥¸¤Î¶¶ÅϤ·¤ò¤·¤Æ¤¯¤ì¤¿Àкê°ìÌÀ»á(MIX
+     ID:k.ishi)¡¢¤Þ¤¿¡¢¤¤¤í¤¤¤í¤Ê¥ì¥Ý¡¼¥È¤ò¤¯¤ì¤¿¤ß¤Ê¤µ¤ó¡¢¤½¤ì
+     ¤òÃæ·Ñ¤·¤Æ¤¯¤À¤µ¤Ã¤¿¿¹¸ø°ìϺ»á  (MIX   ID:kmori)¤Ë´¶¼Õ¤·¤Þ¤¹
+     ¡£
+
+
+                        January 14,1997                         5
+
+
+
+LHA(N)              Unix Programmer's Manual               LHA(N)
+
+
+ºÇ\b\bºÇ\b\bºÇ¸å\b\b¸å\b\b¸å¤Ë\b\b¤Ë\b\b¤Ë(\b(\b(F\bF\bFr\br\bro\bo\bom\bm\bm M\bM\bMa\ba\bas\bs\bsa\ba\bar\br\bru\bu\bu O\bO\bOk\bk\bki\bi\bi)\b)\b)
+     ¾åµ­¤ÎÊý¡¹¤Ï¤â¤Á¤í¤ó¡¢²Ã¤¨¤Æ LHarc UNIX ¤òºîÀ®¤·¤¿  Y.Tagawa
+     »á¡¢¤½¤ì¤ò  OSK  ¤Ë°Ü¿¢¤·µÈºê»á¤Î LHx ¤Î¥¢¥ë¥´¥ê¥º¥à¤òÁȤ߹þ
+     ¤ó¤À H.S »á¡¢JUNET ¤Î LHa for  UNIX  MailingList  ¤Ë¤Æ¶¨ÎϤ·
+     ¤Æ¤¯¤À¤µ¤Ã¤¿¤ß¤Ê¤µ¤ó¤Ë´¶¼ÕÃפ·¤Þ¤¹¡£
+
+ºÇ\b\bºÇ\b\bºÇ¸å\b\b¸å\b\b¸å¤Ë\b\b¤Ë\b\b¤Ë(\b(\b(F\bF\bFr\br\bro\bo\bom\bm\bm N\bN\bNo\bo\bob\bb\bbu\bu\but\bt\bta\ba\bak\bk\bka\ba\ba W\bW\bWa\ba\bat\bt\bta\ba\baz\bz\bza\ba\bak\bk\bki\bi\bi)\b)\b)
+     ¤³¤Î¥×¥í¥°¥é¥à¤ÎºîÀ®¤Ë¤«¤«¤ï¤Ã¤¿Êý¡¹¡¢¤µ¤é¤Ë¤³¤³¤Þ¤Ç     LHa
+     ¤ò»Å¾å¤²¤Æ¤¯¤À¤µ¤Ã¤¿ ²­¾¡»á¤Ë´¶¼ÕÃפ·¤Þ¤¹¡£
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                        January 14,1997                         6
+
diff --git a/man/lha.n b/man/lha.n
new file mode 100644 (file)
index 0000000..4af75a8
--- /dev/null
+++ b/man/lha.n
@@ -0,0 +1,299 @@
+.TH LHA N "January 14,1997" "" "LHa for UNIX Users Manual"
+.SH "NAME Ì¾¾Î"
+LHa \- ¹â°µ½Ì¥¢¡¼¥«¥¤¥Ð
+.SH "SYNOPSIS ·Á¼°"
+.B lha
+.B key
+[
+.B modifiers
+]
+.I archive_file
+[
+.I flie
+\&.\|.\|. ]
+.br
+.B lha
+.I archive_file
+.SH "DESCRIPTION ²òÀâ"
+.B LHa
+¤Ï¸úΨ¤Î¹â¤¤°µ½Ìµ¡Ç½¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¥¢¡¼¥«¥¤¥Ð¤Ç¤¹¡£
+.br
+.B key
+¤Ëµ¡Ç½Ê¸»ú¤ò»ØÄꤷ¡¢file ¤ÎÄɲᢹ¹¿·¡¢Ãê½Ð¡¢ºï½ü¡¢°ìÍ÷ɽ¼¨
+¤Ê¤É¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£°ú¿ô¤Ë archive_file ¤Î¤ß¤ò»ØÄꤷ¤¿¾ì¹ç¤Ë¤Ï¡¢
+µ¡Ç½Ê¸»ú¤Ë l ¤ò»ØÄꤷ¤¿¤Î¤ÈƱÅù¤ÎÆ°ºî¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+.br
+µ¡Ç½Ê¸»ú¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
+.TP 8
+.B a
+Äɲá£file ¤ò archive_file ¤ËÄɲä·¤Þ¤¹¡£
+file ¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ì¤Ð¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë´Þ¤Þ¤ì¤ë
+¥Õ¥¡¥¤¥ë¤ò¤¹¤Ù¤ÆÄɲä·¤Þ¤¹¡£
+.TP 8
+.B u
+¹¹¿·¡£file ¤¬ archive_file ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢¤â¤·¤¯¤Ï
+³ÊǼ¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤¬¸Å¤±¤ì¤Ð¡¢file ¤ò archive_file ¤ËÄɲÃ
+¤·¤Þ¤¹¡£
+.TP 8
+.B "l ¤Þ¤¿¤Ï v"
+°ìÍ÷ɽ¼¨¡£archive_file ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë file ¤Î¾ðÊó¤ò°ìÍ÷
+ɽ¼¨¤·¤Þ¤¹¡£file ¤Î»ØÄ꤬¤Ê¤±¤ì¤Ð archive_file Æâ¤ÎÁ´¤Æ¤Î
+¥Õ¥¡¥¤¥ë¤Î¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡£
+v ¤ò»ØÄꤹ¤ë¤È l ¤è¤ê¤â¾Ü¤·¤¤¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡£
+.TP 8
+.B "x ¤Þ¤¿¤Ï e"
+Ãê½Ð¡£archive_file ¤«¤é file ¤òÃê½Ð¤·¤Þ¤¹¡£file ¤Î»ØÄ꤬
+¤Ê¤±¤ì¤Ð archive_file Æâ¤ÎÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤òÃê½Ð¤·¤Þ¤¹¡£
+Ãê½Ð¤¹¤Ù¤­¥Õ¥¡¥¤¥ë¤¬¤¹¤Ç¤Ë¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢½Å¤Í½ñ¤­
+¤·¤Æ¤¤¤¤¤«¤ÎÌ䤤¹ç¤ï¤»¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+.TP 8
+.B p
+ÆâÍÆɽ¼¨¡£archive_file ¤«¤é file ¤ÎÆâÍƤò¼è¤ê½Ð¤·¡¢É¸½à
+½ÐÎϤؤȽÐÎϤ·¤Þ¤¹¡£file ¤Î»ØÄ꤬¤Ê¤±¤ì¤Ð¡¢Á´¤Æ¤ÎÆâÍƤò
+½ÐÎϤ·¤Þ¤¹¡£
+.TP 8
+.B d
+ºï½ü¡£archive_file ¤«¤é file ¤òºï½ü¤·¤Þ¤¹¡£
+.TP 8
+.B m
+°ÜÆ°¡£file ¤ò archive_file ¤ËÄɲä·¤¿¸å¡¢file ¤òºï½ü¤·¤Þ¤¹¡£
+¤³¤ì¤Ï¡¢key ¤Ë a ¤ò¡¢modifiers ¤Ë d ¤ò»ØÄꤷ¤¿»þ¤ÈƱ¤¸Æ°ºî
+¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+.TP 8
+.B c
+¿·µ¬ºîÀ®¡£archive_file ¤ò¿·¤¿¤ËºîÀ®¤·¡¢file ¤òÄɲä·¤Þ¤¹¡£
+.PP
+µ¡Ç½Êѹ¹Ê¸»ú modifiers ¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤Ã¤Æ key ¤ÎÆ°ºî¤Î
+¾ÜºÙ¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£modifiers ¤Ï¡¢°Ê²¼¤ÎÃ椫¤éÊ£
+¿ô»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+
+
+.TP 8
+.B q<num>
+ɽ¼¨¤ÎÍÞÀ©¡£
+ÂÐÏÃŪ¤Ê¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨¤òÍÞÀ©¤·¤Þ¤¹¡£
+<num> ¤ÎÃͤˤè¤Ã¤Æ¡¢INDICATOR ¤Îɽ¼¨ÊýË¡¤òÊѹ¹¤Ç¤­¤Þ¤¹¡£
+.RS
+.IP
+.B q0   oo.... ¤Îɽ¼¨¤ò¹Ô¤Ê¤¦¡£
+
+.B q1   ¥Õ¥¡¥¤¥ë̾ɽ¼¨¤Î¤ß¹Ô¤Ê¤¦¡£
+
+.B q2   ²¿¤âɽ¼¨¤·¤Ê¤¤¡£
+.RE
+.IP
+¤Ê¤ª¡¢ÃͤòÆþÎϤ·¤Ê¤«¤Ã¤¿ºÝ¤Ë¤Ï¡¢q2 ¤ÈƱÅù¤Ë¤Ê¤ê¤Þ¤¹¡£
+.TP 8
+.B v
+ɽ¼¨¤Î¾éĹ²½¡£
+ɽ¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸¤ò¾éŤˤ·¤Þ¤¹¡£
+.TP 8
+.B n
+¼Â¹Ô¤·¤Ê¤¤¡£
+¼ÂºÝ¤Î¹¹¿·¤äÃê½Ð¤ÎÆ°ºî¤ò¹Ô¤Ê¤¤¤Þ¤»¤ó¡£
+¼Â¹ÔÆâÍƤγÎǧ¤Î¤¿¤á¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+.TP 8
+.B f
+¶¯À©Åª¤Ê¼Â¹Ô¡£
+¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ¤Ë¡¢Â¸ºß¤¹¤ë¥Õ¥¡¥¤¥ë¤Îºï½ü³Îǧ¤ò
+¹Ô¤Ê¤ï¤º¶¯À©Åª¤Ëºï½ü¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+.TP 8
+.B t
+¥Æ¥­¥¹¥È¥â¡¼¥É¤Ë¤è¤ë³ÊǼ,Ãê½Ð¡£
+¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Ë¤Ï¡¢
+UNIX ¤«¤é MS-DOS ¤Ø¤Î²þ¹Ô¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ¤Ë¤ÏµÕ¤Ë¡¢MS-DOS ¤«¤é UNIX ¤Ø¤Î
+²þ¹Ô¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+.TP 8
+.B o{num}
+LHarc ¸ß´¹¥¢¡¼¥«¥¤¥Ö¤ÎÀ¸À®¡¢¤Þ¤¿¤Ï°µ½Ì¥¢¥ë¥´¥ê¥º¥à¤ò»ØÄꤹ¤ë¡£
+µ¡Ç½Ê¸»ú a, u, m ¤È¶¦¤Ë»ØÄꤷ¡¢Ãê½Ð»þ¤Ë¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£
+.RS
+.IP
+.B o  LHarc ¸ß´¹¥¢¡¼¥«¥¤¥Ö¤ÎÀ¸À®¤ò¹Ô¤¦¡£
+
+.RS
+¸Å¤¤·Á¼°¤Î¥¢¡¼¥«¥¤¥Ö¤òÀ¸À®¤·¤Þ¤¹¡£°µ½Ì¥¢¥ë¥´¥ê¥º¥à¤Ï-lh1-¤ò»ÈÍѤ·¤Þ¤¹¡£
+.RE
+
+.B o5 °µ½Ì¥¢¥ë¥´¥ê¥º¥à¤Ë -lh5- ¤ò»ÈÍѤ¹¤ë¡£
+
+.B o6 °µ½Ì¥¢¥ë¥´¥ê¥º¥à¤Ë -lh6- ¤ò»ÈÍѤ¹¤ë¡£
+
+LHA¤Î¼ïÎà¤Ë¤è¤Ã¤Æ¤Ï¡¢-lh6-¤ÇÀ¸À®¤µ¤ì¤¿¥¢¡¼¥«¥¤¥Ö¤ÏÃê½Ð¤Ç¤­¤Ê¤¤
+¶²¤ì¤¬¤¢¤ë¤Î¤Ç¡¢¥¢¡¼¥«¥¤¥Ö¤òÇÛÉÛ¤¹¤ëºÝ¤Ë¤ÏÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
+MSDOSÈǤÎÀµµ¬ÇÛÉÛÈǤǤϠ-lh6- ¤ÎÀ¸À®¤Ï¹Ô¤¤¤Þ¤»¤ó¡£
+¤Þ¤¿¡¢MSDOSÈÇ LHA version 2.5x °Ê¹ß¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï -lh6- ¤Î
+Ãê½Ð¤Î¤ß¤Ç¤­¤Þ¤¹¡£
+.RE
+.TP 8
+.B w=</dir>
+³ÊǼ¤ª¤è¤ÓÃê½Ð»þ¤Î¥ï¡¼¥¯Íѥǥ£¥ì¥¯¥È¥ê»ØÄê¡£
+¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢/tmp ¤Ç¤¹¤¬¡¢/tmp ¤ÎÂ礭¤µ°Ê¾å¤Î
+¥Õ¥¡¥¤¥ë¤ò³ÊǼ¤¹¤ëºÝ¤Ë¤ÏɬÍפǤ¹¡£
+.TP 8
+.B d
+¥Õ¥¡¥¤¥ë³ÊǼ¸å¤Î¥Õ¥¡¥¤¥ë¤Îºï½ü¡£
+µ¡Ç½Ê¸»ú a, ¤â¤·¤¯¤Ï u ¤È¶¦¤ËÍѤ¤¡¢¥¢¡¼¥«¥¤¥Ö
+¥Õ¥¡¥¤¥ë¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î³ÊǼ¤Î¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï
+½ü¤·¤Þ¤¹¡£
+u ¤ËÉղä·¤¿¾ì¹ç¡¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ÎÆâÍƤÎÊý¤¬
+¿·¤·¤¤»þ¤Ë¥Õ¥¡¥¤¥ë¤¬³ÊǼ¤µ¤ì¤º¤Ëºï½ü¤µ¤ì¤ë¤³¤È¤Ë
+¤Ê¤ë¤Î¤ÇÃí°Õ¤·¤Æ²¼¤µ¤¤¡£
+.TP 8
+.B i
+Ãê½Ð»þ¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤Î̵¸ú²½¡£
+Ãê½Ð»þ¤Ë¥Ç¥£¥ì¥¯¥È¥ê̾¤ò̵¸ú¤Ë¤·¤Þ¤¹¡£
+.TP 8
+.B z
+È󰵽̳ÊǼ¡£
+¥¢¡¼¥«¥¤¥Ö¤Ø¤Î¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Ë°µ½Ì¤ò¹Ô¤Ê¤¤¤Þ¤»¤ó¡£
+¤¹¤Ç¤Ë°µ½Ì¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤Æ°µ½Ì¸úΨ¤ò˾¤á¤Ê¤¤¾ì¹ç¤Ê¤É¤Ë»ÈÍѤ·¤Þ¤¹¡£
+Ãê½Ð»þ¤Ë¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£
+.TP 8
+.B g
+[generic]¥¢¡¼¥«¥¤¥Ö¤ÎºîÀ®¡£
+UNIX ÍѤÎÉղþðÊó¤ò»ý¤¿¤Ê¤¤¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤Þ¤¹¡£
+Ãê½Ð»þ¤Ë¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£
+.TP 8
+.B 0/1/2
+¥Ø¥Ã¥À¥ì¥Ù¥ë»ØÄê¡£
+¥¢¡¼¥«¥¤¥Ö¤ÎÆâÉôɽ¸½¤Î·Á¼°¤ò»ØÄꤷ¤Þ¤¹¡£
+¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï 1 ¤Ç¤¹¡£0 ¤Ï LHarc ¤ÇÍÑ°Õ¤µ¤ì¤Æ¤¤
+¤¿¸Å¤¤·Á¼°¤Ç¤¹¡£¾­Íè¤Ï 2 ¤Î·Á¼°¤ËÅý°ì¤µ¤ì¤ë¤è¤¦¤Ç¤¹¡£
+¤³¤ì¤Ï¥Õ¥¡¥¤¥ë¤Î³ÊǼ»þ¤Î¤ßÍ­¸ú¤Ç¤¹¡£¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ
+¤Ë¤Ï¼«Æ°Åª¤Ë·Á¼°¤òȽÃǤ·½èÍý¤·¤Þ¤¹¡£
+.PP
+.I archive_file
+¤Ë¤Ï¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Þ¤¹¡£
+.PP
+.I archive_file
+¤Ë
+.I -
+¤È½ñ¤¯¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤òɸ½àÆþ½ÐÎÏ
+¤Ë¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£
+.BR tar (1)
+¤Î¤è¤¦¤Ë¡¢¥¢¡¼¥«¥¤¥Ö¤ÎºîÀ®¡¢¹¹¿·»þ¤Ë¤Ïɸ½à½ÐÎϤˡ¢
+¥¢¡¼¥«¥¤¥Ö¤«¤é¤Î¥Õ¥¡¥¤¥ë¤ÎÃê½Ð»þ¤Ë¤Ïɸ½àÆþÎϤˤʤê¤Þ¤¹¡£
+.PP
+Ãê½Ð»þ¤Ë
+.I archive_file
+¤¬Â¸ºß¤·¤Ê¤¤»þ¤Ë¤Ï¥µ¥Õ¥£¥Ã¥¯¥¹
+.B ".lzh"
+¤ò¥Õ¥¡¥¤¥ë̾¤Î¸å¤í¤ËÉղä·¤ÆÃê½Ð¤ò»î¤ß¤Þ¤¹¡£
+.br
+Æä˵¬Äê¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢±¿ÍѾ奵¥Õ¥£¥Ã¥¯¥¹¤È¤·¤Æ
+.B ".lzh"
+¤òÍѤ¤¤ë¤Î¤¬Ë¾¤Þ¤·¤¤¤È»×¤¤¤Þ¤¹¡£
+ÆüËܰʳ°¤Ç¤Ï 
+.B ".lha"
+¤ò»ÈÍѤ·¤Æ¤¤¤ë¥±¡¼¥¹¤¬¤¢¤ë¤½¤¦¤Ç¤¹¤Î¤Ç¡¢Å¬µ¹Ä´À°
+¤·¤Æ²¼¤µ¤¤¡£:-)
+.br
+¥µ¥Õ¥£¥Ã¥¯¥¹¤¬
+.B "com"
+¤â¤·¤¯¤Ï
+.B ".exe"
+¤Î¾ì¹ç¤Ë¤Ï¡¢MS-DOS ÈǤǺîÀ®¤µ¤ì¤¿
+.IR SFX (¼«¸ÊŸ³«µ¡Ç½ÉÕ¤­¤Î°µ½Ì¥Õ¥¡¥¤¥ë)
+·Á¼°¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤·¡¢Âбþ¤·¤Þ¤¹¡£
+.br
+¥µ¥Õ¥£¥Ã¥¯¥¹¤¬
+.B ".x"
+¤Î¾ì¹ç¤Ë¤Ï¡¢ÆüËÜÀ½ SHARP X68000 ¤Î OS, Human68k ÈǤÇ
+ºîÀ®¤µ¤ì¤¿ SFX ·Á¼°¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤·Âбþ¤·¤Þ¤¹¡£
+.br
+SFX ·Á¼°¤Î¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ËÂФ·¤ÆÄɲääºï½ü¤ò
+¹Ô¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢¥µ¥Õ¥£¥Ã¥¯¥¹¤ò
+.B ".lzh"
+¤ËÊѹ¹¤·¡¢SFX ¤Î¾ðÊó¤òºï½ü¤·¤Þ¤¹¡£
+.PP
+.SH "FILES ¥Õ¥¡¥¤¥ë"
+.ta \w'*.com *.exe    'u
+*.lzh          - LHa/LHarc ¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë
+.br
+*.bak          - ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥¡¥¤¥ë
+.br
+/tmp/lh*       - ¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë
+.br
+*.com *.exe    - MS-DOS SFX ¥Õ¥¡¥¤¥ë
+.br
+*.x            - Human68k SFX ¥Õ¥¡¥¤¥ë
+.PP
+.SH "SEE ALSO ´ØÏ¢¹àÌÜ"
+.BR tar (1),
+.BR ar (1),
+.BR compress (1)
+.SH "DISTRIBUTION ºÆÇÛÉۤˤĤ¤¤Æ"
+.PP
+°Ê²¼¤Î¾ò·ï¤Ç¡¢ºÆÇÛÉÛ¡¢Å¾ºÜ¡¢²þÊѤòµö²Ä¤·¤Þ¤¹¡£
+.IP 1.
+Ãøºî¸¢É½¼¨¤òºï½ü¤·¤Ê¤¤¤³¤È¡£
+.IP 2.
+ÇÛÉÛÆâÍƤˤĤ¤¤Æ¤Ï¡¢
+.RS
+.IP a.
+ÇÛÉۤκݤ˸ºß¤¹¤ëÆâÍÆ(¤¹¤Ê¤ï¤Á¥½¡¼¥¹¥³¡¼¥É¡¢¥É¥­¥å¥á¥ó¥È¡¢
+¥×¥í¥°¥é¥Þ¡¼¤Ø¤Î¼ê°ú¤­¤Ê¤É)¤¬ºÆÇÛÉÛ¤µ¤ì¤¿¤â¤Î¤ÎÃæ¤Ëɬ¤ºÂ¸
+ºß¤¹¤ë¤³¤È¡£²þÊѤµ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢¤½¤ì¤òÌÀ¼¨¤·¤¿¥É¥­¥å¥á
+¥ó¥È¤òÍÑ°Õ¤¹¤ë¤³¤È¡£
+.IP b.
+LHa ¤ËÂФ¹¤ëÉղòÁÃͤ¬ÉÕ¤±¤é¤ì¤ÆºÆÇÛÉÛ¤µ¤ì¤ë¾ì¹ç¤Ë¤Ï¤½¤ì¤é
+¤â¤Ç¤­¤ë¤À¤±´Þ¤á¤ë¤è¤¦ÅØÎϤ¹¤ë¤³¤È¡£¤Þ¤¿¡¢¤½¤ÎºÝ¤Ë¤ÏÉղòÁ
+Ãͤ¬ÉÕ¤±¤é¤ì¤Æ¤¤¤ë¤³¤È¤òÌÀ¼¨¤·¤¿¥É¥­¥å¥á¥ó¥È¤òÍÑ°Õ¤¹¤ë¤³¤È¡£
+.IP c.
+¥Ð¥¤¥Ê¥ê¤Î¤ß¤ÎÇÛÉۤϵö¤µ¤ì¤Ê¤¤¡£(ÉղòÁÃͤΤâ¤Î¤â´Þ¤à)
+.RE
+.IP 3.
+ºÇ¿·ÈǤÎÇÛÉÛ¤Ë̳¤á¤ë¤³¤È¡£(µÁ̳¤Ï¤Ê¤¤)
+.RS
+.IP Ãí.
+¤Ê¤ª¡¢¥Í¥Ã¥È¤Ç¤ÎÇÛÉդϼ«Í³¤Ç¤¢¤ë¤¬¡¢¥Í¥Ã¥È¤Ë¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤Êý¡Ê»¨»ï¤ª¤è¤Ó¡¢
+CD-ROM ¤Ê¤É¤Ë¤è¤ë¡ËÇÛÉդϡ¢ÇÛÉÕÁ°¤Ë¤³¤Á¤é¤Ë E-Mail ¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£
+ÇÛÉÕÁ°¤Ë½ÐÍè¤Ê¤¤ºÝ¤Ë¤Ï¡¢¸åÆüɬ¤º E-Mail ¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£
+.RE
+.IP 4.
+¤³¤Î¥×¥í¥°¥é¥à¤Î¸ºß¤ä»ÈÍѤ·¤¿¤³¤È¤Ë¤è¤Ã¤ÆÀ¸¤¸¤¿Â»³²¤ÏÁ´¤¯ÊÝ
+¾Ú¤·¤Ê¤¤¡£
+.IP 5.
+ºî¼Ô¤Ï¡¢¤³¤Î¥×¥í¥°¥é¥à¤ËÉÔÈ÷¤¬¤¢¤Ã¤Æ¤â¡¢¤½¤ì¤òÄûÀµ¤¹¤ëµÁ̳¤ò
+Éé¤ï¤Ê¤¤¡£
+.IP 6.
+¤³¤Î¥×¥í¥°¥é¥à¤Î°ìÉô¡¢¤Þ¤¿¤ÏÁ´Éô¤ò¾¤Î¥×¥í¥°¥é¥à¤ËÁȤ߹þ¤ó¤Ç
+ÍøÍѤ·¤Æ¤â¤«¤Þ¤ï¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢¤½¤Î¥×¥í¥°¥é¥à¤Ï LHa ¤Ç¤Ï¤Ê¤¯¡¢
+LHa ¤È̾¾è¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
+.IP 7.
+¾¦ÍøÍѤ˴ؤ·¤Æ¤Ï¡¢¾åµ­¤Î¾ò·ï¤Ë²Ã¤¨¡¢²¼µ­¤Î¾ò·ï¤Î¤â¤È¤Ë¤³¤ì¤ò
+ǧ¤á¤ë¡£
+.RS
+.IP a.
+¤³¤Î¥×¥í¥°¥é¥à¤ò¥á¥¤¥ó¤È¤¹¤ë¾¦ÍøÍѤ϶ػߤ¹¤ë¡£
+.IP b.
+¾¦ÍøÍѤÎÁê¼ê¤¬¤³¤Î¥×¥í¥°¥é¥à¤Î»ÈÍѼԤȤ·¤ÆÉÔŬÀÚ¤ÈȽÃǤ·
+¤¿¾ì¹ç¤Ë¤ÏÇÛÉÛ¤·¤Ê¤¤¡£
+.IP c.
+¥¤¥ó¥¹¥È¡¼¥ë¤Î¼êÃʤȤ·¤Æ»ÈÍѤ¹¤ë¾ì¹ç¡¢¤³¤Î¥×¥í¥°¥é¥à¤ò»È
+¤¦¤³¤È¤òÁê¼ê¤Ë¶¯À©¤·¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢¾¦ÍøÍѼԤ¬ºî¶È¤ò¹Ô¤¦¡£
+¤Þ¤¿¡¢¤½¤Î¤È¤­¤Î»³²¤Ï¡¢¾¦ÍøÍѼԤ¬Á´ÀÕǤ¤òÉ餦¡£
+.IP d.
+¾¦ÍøÍѤòÉղòÁÃͤȤ·¤Æ¹Ô¤¤¤³¤Î¥×¥í¥°¥é¥à¤ò»ÈÍѤ¹¤ë¾ì¹ç¡¢
+¾¦ÍøÍѼԤϡ¢¤½¤Î¥µ¥Ý¡¼¥È¤ò¹Ô¤¦¡£
+.RE
+.PP
+.SH "ºÇ¸å¤Ë(From Y.Tagawa)"
+LZHUF Ë¡¤Î´ðÁäȤʤä¿ LZARI Ë¡¤òȯɽ¤·¤Æ¤¯¤À¤µ¤Ã¤¿±ü¼À²É§»á¡¢
+¤½¤ì¤ò NIFTY-Serve ¤Ë¾Ò²ð¤·¡¢¤Þ¤¿¡¢LArc ¤Îºî¼Ô¤Ç¤â¤¢¤ë»°ÌÚÏÂɧ»á¡¢
+¤Þ¤¿¡¢¤³¤ì¤é¤ÎÍ×°ø¤«¤é LZHUF Ë¡µÚ¤Ó¡¢MS-DOS ÈÇ LHarc ¤òºîÀ®¤·¤¿
+µÈºê±ÉÂٻᡢLHarc UNIX ¤Î³«È¯¤Ë¶¨ÎϤ·¤¿¿Íã¡¢¤³¤³¤í¤è¤¯¥á¥Ã¥»¡¼¥¸
+¤Î¶¶ÅϤ·¤ò¤·¤Æ¤¯¤ì¤¿Àкê°ìÌÀ»á(MIX ID:k.ishi)¡¢¤Þ¤¿¡¢¤¤¤í¤¤¤í¤Ê
+¥ì¥Ý¡¼¥È¤ò¤¯¤ì¤¿¤ß¤Ê¤µ¤ó¡¢¤½¤ì¤òÃæ·Ñ¤·¤Æ¤¯¤À¤µ¤Ã¤¿¿¹¸ø°ìϺ
+»á (MIX ID:kmori)¤Ë´¶¼Õ¤·¤Þ¤¹¡£
+.PP
+.SH "ºÇ¸å¤Ë(From Masaru Oki)"
+¾åµ­¤ÎÊý¡¹¤Ï¤â¤Á¤í¤ó¡¢²Ã¤¨¤Æ LHarc UNIX ¤òºîÀ®¤·¤¿ Y.Tagawa »á¡¢
+¤½¤ì¤ò OSK ¤Ë°Ü¿¢¤·µÈºê»á¤Î LHx ¤Î¥¢¥ë¥´¥ê¥º¥à¤òÁȤ߹þ¤ó¤À H.S »á¡¢
+JUNET ¤Î LHa for UNIX MailingList ¤Ë¤Æ¶¨ÎϤ·¤Æ¤¯¤À¤µ¤Ã¤¿¤ß¤Ê¤µ¤ó¤Ë
+´¶¼ÕÃפ·¤Þ¤¹¡£
+.SH "ºÇ¸å¤Ë(From Nobutaka Watazaki)"
+¤³¤Î¥×¥í¥°¥é¥à¤ÎºîÀ®¤Ë¤«¤«¤ï¤Ã¤¿Êý¡¹¡¢¤µ¤é¤Ë¤³¤³¤Þ¤Ç LHa ¤ò»Å
+¾å¤²¤Æ¤¯¤À¤µ¤Ã¤¿ ²­¾¡»á¤Ë´¶¼ÕÃפ·¤Þ¤¹¡£
diff --git a/src/Makefile b/src/Makefile
new file mode 100644 (file)
index 0000000..66c038e
--- /dev/null
@@ -0,0 +1,52 @@
+##############################################################################
+# Makefile for LHarc UNIX Archiver Driver
+#                                      Copyright(C) MCMLXXXIX  Yooichi.Tagawa
+# V0.01  Alpha Version                                 1989.05.28  Y.Tagawa
+# V0.02  Alpha Version R2                              1989.05.29  Y.Tagawa
+# V0.03  Release #3  Beta Version              1989.07.02  Y.Tagawa
+# V0.03b Modified                                              1989.07.13  Y.Tagawa
+# V1.00  Fixed                                                 1989.09.19  Y.Tagawa
+#
+# for OSK
+# V1.08                                                                        1990.10.09  Sakura Tomozou
+# V2.00        + lzhuf4/5                                              1990.10.26  
+#
+# LHa for UNIX
+# V0.01  Alpha Version                                 1991.10.17  Masaru Oki
+# V0.02  Alpha Version Rel.2                   1991.11.26  Masaru Oki
+# V0.03  Beta Version                                  1991.12.03  Masaru Oki
+# V0.04  Beta Version  Rel.2                   1992.01.17  Masaru Oki
+# V0.05  Beta Version  Final                   1992.02.17  Masaru Oki
+##############################################################################
+
+LHOBJS         = lharc$(O) lhadd$(O) lhlist$(O) lhext$(O) header$(O)
+HUFOBJS                = append$(O) crcio$(O) dhuf$(O) extract$(O) huf$(O) \
+                 larc$(O) maketbl$(O) maketree$(O) shuf$(O) slide$(O) \
+                 util$(O)
+
+OBJS           = $(LHOBJS) $(HUFOBJS) $(LIBRARYOBJS)
+
+CFLAGS         = $(OPTIMIZE) $(SWITCHES) $(MACHINE)
+
+all : lha
+
+lha    : $(OBJS)
+       $(CC) -o $@ $(OBJS) $(LDFLAGS) 
+
+$(LHOBJS) append$(O) slide$(O) extract$(O) : lha.h lha_macro.h
+
+$(HUFOBJS) : lha.h lha_macro.h
+crcio$(O) extract$(O) slide$(O) : lha.h lha_macro.h
+
+lhdir$(O) : lhdir.h
+
+$(OBJS) : ../Makefile
+
+clean:
+       rm -f core lha $(OBJS)
+
+moreclean:
+       rm -f core *.o lha.tar lha.tar.Z *~ \#* *.orig
+
+install:
+       $(INSTALL) $(INSTALLBIN) lha $(BINDIR)/lha
diff --git a/src/append.c b/src/append.c
new file mode 100644 (file)
index 0000000..c30526e
--- /dev/null
@@ -0,0 +1,132 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             append.c -- append to archive                                                           */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+int
+encode_lzhuf(infp, outfp, size, original_size_var, packed_size_var,
+            name, hdr_method)
+       FILE           *infp;
+       FILE           *outfp;
+       long            size;
+       long           *original_size_var;
+       long           *packed_size_var;
+       char           *name;
+       char           *hdr_method;
+{
+       static int      method = -1;
+
+       if (method < 0) {
+               method = compress_method;
+               if (method > 0)
+                       method = encode_alloc(method);
+       }
+
+       interface.method = method;
+
+       if (interface.method > 0) {
+               interface.infile = infp;
+               interface.outfile = outfp;
+               interface.original = size;
+               start_indicator(name, size, "Freezing", 1 << dicbit);
+               encode(&interface);
+               *packed_size_var = interface.packed;
+               *original_size_var = interface.original;
+       } else {
+               copyfile(infp, outfp, size, 1);
+               *packed_size_var = *original_size_var = size;
+       }
+       bcopy("-lh -", hdr_method, 5);
+       hdr_method[3] = interface.method + '0';
+
+       finish_indicator2(name, "Frozen",
+                   (int) ((*packed_size_var * 100L) / *original_size_var));
+       return crc;
+}
+/* ------------------------------------------------------------------------ */
+void
+start_indicator(name, size, msg, def_indicator_threshold)
+       char           *name;
+       long            size;
+       char           *msg;
+       long            def_indicator_threshold;
+{
+#ifdef NEED_INCREMENTAL_INDICATOR
+       long            i;
+       int             m;
+#endif
+
+       if (quiet)
+               return;
+
+#ifdef NEED_INCREMENTAL_INDICATOR
+       switch (quiet_mode) {
+       case 0:
+               m = MAX_INDICATOR_COUNT - strlen(name);
+               if (m < 1)              /* Bug Fixed by N.Watazaki */
+                       m = 3;          /* (^_^) */
+               printf("\r%s\t- %s :  ", name, msg);
+               indicator_threshold =
+                       ((size + (m * def_indicator_threshold - 1)) /
+                        (m * def_indicator_threshold) *
+                        def_indicator_threshold);
+               if (indicator_threshold)
+                       i = ((size + (indicator_threshold - 1)) / indicator_threshold);
+               else
+                       i = 0;
+               while (i--)
+                       putchar('.');
+               indicator_count = 0;
+               printf("\r%s\t- %s :  ", name, msg);
+               break;
+       case 1:
+               printf("\r%s :", name);
+               break;
+       }
+#else
+       printf("%s\t- ", name);
+#endif
+       fflush(stdout);
+       reading_size = 0L;
+}
+/* ------------------------------------------------------------------------ */
+void
+finish_indicator2(name, msg, pcnt)
+       char           *name;
+       char           *msg;
+       int             pcnt;
+{
+       if (quiet)
+               return;
+
+       if (pcnt > 100)
+               pcnt = 100;     /* (^_^) */
+#ifdef NEED_INCREMENTAL_INDICATOR
+       printf("\r%s\t- %s(%d%%)\n", name,  msg, pcnt);
+#else
+       printf("%s\n", msg);
+#endif
+       fflush(stdout);
+}
+/* ------------------------------------------------------------------------ */
+void
+finish_indicator(name, msg)
+       char           *name;
+       char           *msg;
+{
+       if (quiet)
+               return;
+
+#ifdef NEED_INCREMENTAL_INDICATOR
+       printf("\r%s\t- %s\n", name, msg);
+#else
+       printf("%s\n", msg);
+#endif
+       fflush(stdout);
+}
diff --git a/src/crcio.c b/src/crcio.c
new file mode 100644 (file)
index 0000000..6f28aa7
--- /dev/null
@@ -0,0 +1,358 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             crcio.c -- crc input / output                                                           */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+static unsigned short crctable[UCHAR_MAX + 1];
+static unsigned char subbitbuf, bitcount;
+#ifdef EUC
+static int      putc_euc_cache;
+#endif
+static int      getc_euc_cache;
+
+/* ------------------------------------------------------------------------ */
+void
+make_crctable( /* void */ )
+{
+       unsigned int    i, j, r;
+
+       for (i = 0; i <= UCHAR_MAX; i++) {
+               r = i;
+               for (j = 0; j < CHAR_BIT; j++)
+                       if (r & 1)
+                               r = (r >> 1) ^ CRCPOLY;
+                       else
+                               r >>= 1;
+               crctable[i] = r;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+#ifdef NEED_INCREMENTAL_INDICATOR
+static void
+put_indicator(count)
+       long int        count;
+{
+       if (!quiet && indicator_threshold) {
+               while (count > indicator_count) {
+                       putchar('o');
+                       fflush(stdout);
+                       indicator_count += indicator_threshold;
+               }
+       }
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+calccrc(p, n)
+       unsigned char  *p;
+       unsigned int    n;
+{
+       reading_size += n;
+#ifdef NEED_INCREMENTAL_INDICATOR
+       put_indicator(reading_size);
+#endif
+       while (n-- > 0)
+               UPDATE_CRC(*p++);
+       return crc;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+fillbuf(n)                     /* Shift bitbuf n bits left, read n bits */
+       unsigned char   n;
+{
+       while (n > bitcount) {
+               n -= bitcount;
+               bitbuf = (bitbuf << bitcount) + (subbitbuf >> (CHAR_BIT - bitcount));
+               if (compsize != 0) {
+                       compsize--;
+                       subbitbuf = (unsigned char) getc(infile);
+               }
+               else
+                       subbitbuf = 0;
+               bitcount = CHAR_BIT;
+       }
+       bitcount -= n;
+       bitbuf = (bitbuf << n) + (subbitbuf >> (CHAR_BIT - n));
+       subbitbuf <<= n;
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+getbits(n)
+       unsigned char   n;
+{
+       unsigned short  x;
+
+       x = bitbuf >> (2 * CHAR_BIT - n);
+       fillbuf(n);
+       return x;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+putcode(n, x)                  /* Write rightmost n bits of x */
+       unsigned char   n;
+       unsigned short  x;
+{
+       while (n >= bitcount) {
+               n -= bitcount;
+               subbitbuf += x >> (USHRT_BIT - bitcount);
+               x <<= bitcount;
+               if (compsize < origsize) {
+            if (fwrite(&subbitbuf, 1, 1, outfile) == 0) {
+                               /* fileerror(WTERR, outfile); */
+                           fatal_error("Write error in crcio.c(putcode)\n");
+                               /* exit(errno); */
+                       }
+                       compsize++;
+               }
+               else
+                       unpackable = 1;
+               subbitbuf = 0;
+               bitcount = CHAR_BIT;
+       }
+       subbitbuf += x >> (USHRT_BIT - bitcount);
+       bitcount -= n;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+putbits(n, x)                  /* Write rightmost n bits of x */
+       unsigned char   n;
+       unsigned short  x;
+{
+       x <<= USHRT_BIT - n;
+       while (n >= bitcount) {
+               n -= bitcount;
+               subbitbuf += x >> (USHRT_BIT - bitcount);
+               x <<= bitcount;
+               if (compsize < origsize) {
+            if (fwrite(&subbitbuf, 1, 1, outfile) == 0) {
+                               /* fileerror(WTERR, outfile); */
+                           fatal_error("Write error in crcio.c(putbits)\n");
+                               /* exit(errno); */
+                       }
+                       compsize++;
+               }
+               else
+                       unpackable = 1;
+               subbitbuf = 0;
+               bitcount = CHAR_BIT;
+       }
+       subbitbuf += x >> (USHRT_BIT - bitcount);
+       bitcount -= n;
+}
+
+/* ------------------------------------------------------------------------ */
+int
+fread_crc(p, n, fp)
+       unsigned char  *p;
+       int             n;
+       FILE           *fp;
+{
+       if (text_mode)
+               n = fread_txt(p, n, fp);
+       else
+               n = fread(p, 1, n, fp);
+
+       calccrc(p, n);
+       return n;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+fwrite_crc(p, n, fp)
+       unsigned char  *p;
+       int             n;
+       FILE           *fp;
+{
+       calccrc(p, n);
+       if (verify_mode)
+               return;
+
+       if (fp) {
+               if (text_mode) {
+                       if (fwrite_txt(p, n, fp))
+                               fatal_error("File write error\n");
+               }
+               else {
+                       if (fwrite(p, 1, n, fp) < n)
+                               fatal_error("File write error\n");
+               }
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+void
+init_code_cache( /* void */ )
+{                              /* called from copyfile() in util.c */
+#ifdef EUC
+       putc_euc_cache = EOF;
+#endif
+       getc_euc_cache = EOF;
+}
+
+void
+init_getbits( /* void */ )
+{
+       bitbuf = 0;
+       subbitbuf = 0;
+       bitcount = 0;
+       fillbuf(2 * CHAR_BIT);
+#ifdef EUC
+       putc_euc_cache = EOF;
+#endif
+}
+
+/* ------------------------------------------------------------------------ */
+void
+init_putbits( /* void */ )
+{
+       bitcount = CHAR_BIT;
+       subbitbuf = 0;
+       getc_euc_cache = EOF;
+}
+
+/* ------------------------------------------------------------------------ */
+#ifdef EUC
+void
+putc_euc(c, fd)
+       int             c;
+       FILE           *fd;
+{
+       int             d;
+
+       if (putc_euc_cache == EOF) {
+               if (!euc_mode || c < 0x81 || c > 0xFC) {
+                       putc(c, fd);
+                       return;
+               }
+               if (c >= 0xA0 && c < 0xE0) {
+                       putc(0x8E, fd); /* single shift */
+                       putc(c, fd);
+                       return;
+               }
+               putc_euc_cache = c;     /* save first byte */
+               return;
+       }
+       d = putc_euc_cache;
+       putc_euc_cache = EOF;
+       if (d >= 0xA0)
+               d -= 0xE0 - 0xA0;
+       if (c > 0x9E) {
+               c = c - 0x9F + 0x21;
+               d = (d - 0x81) * 2 + 0x22;
+       }
+       else {
+               if (c > 0x7E)
+                       c--;
+               c -= 0x1F;
+               d = (d - 0x81) * 2 + 0x21;
+       }
+       putc(0x80 | d, fd);
+       putc(0x80 | c, fd);
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+int
+fwrite_txt(p, n, fp)
+       unsigned char  *p;
+       int             n;
+       FILE           *fp;
+{
+       while (--n >= 0) {
+               if (*p != '\015' && *p != '\032') {
+#ifdef EUC
+                       putc_euc(*p, fp);
+#else
+                       putc(*p, fp);
+#endif
+               }
+
+               prev_char = *p++;
+       }
+       return (ferror(fp));
+}
+
+/* ------------------------------------------------------------------------ */
+int
+fread_txt(p, n, fp)
+       unsigned char  *p;
+       int             n;
+       FILE           *fp;
+{
+       int             c;
+       int             cnt = 0;
+
+       while (cnt < n) {
+               if (getc_euc_cache != EOF) {
+                       c = getc_euc_cache;
+                       getc_euc_cache = EOF;
+               }
+               else {
+                       if ((c = fgetc(fp)) == EOF)
+                               break;
+                       if (c == '\n') {
+                               getc_euc_cache = c;
+                               ++origsize;
+                               c = '\r';
+                       }
+#ifdef EUC
+                       else if (euc_mode && (c == 0x8E || 0xA0 < c && c < 0xFF)) {
+                               int             d = fgetc(fp);
+                               if (d == EOF) {
+                                       *p++ = c;
+                                       cnt++;
+                                       break;
+                               }
+                               if (c == 0x8E) {        /* single shift (KANA) */
+                                       if ((0x20 < d && d < 0x7F) || (0xA0 < d && d < 0xFF))
+                                               c = d | 0x80;
+                                       else
+                                               getc_euc_cache = d;
+                               }
+                               else {
+                                       if (0xA0 < d && d < 0xFF) {     /* if GR */
+                                               c &= 0x7F;      /* convert to MS-kanji */
+                                               d &= 0x7F;
+                                               if (!(c & 1)) {
+                                                       c--;
+                                                       d += 0x7F - 0x21;
+                                               }
+                                               if ((d += 0x40 - 0x21) > 0x7E)
+                                                       d++;
+                                               if ((c = (c >> 1) + 0x71) >= 0xA0)
+                                                       c += 0xE0 - 0xA0;
+                                       }
+                                       getc_euc_cache = d;
+                               }
+                       }
+#endif
+               }
+               *p++ = c;
+               cnt++;
+       }
+       return cnt;
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+calc_header_crc(p, n)          /* Thanks T.Okamoto */
+       unsigned char  *p;
+       unsigned int    n;
+{
+       crc = 0;
+       while (n-- > 0)
+               UPDATE_CRC(*p++);
+       return crc;
+}
diff --git a/src/dhuf.c b/src/dhuf.c
new file mode 100644 (file)
index 0000000..bde60e3
--- /dev/null
@@ -0,0 +1,344 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             dhuf.c -- Dynamic Hufffman routine                                                      */
+/*                                                                                                                                                     */
+/*             Modified                        H.Yoshizaki                                                                     */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+static short    child[TREESIZE], parent[TREESIZE], block[TREESIZE], edge[TREESIZE], stock[TREESIZE],
+                s_node[TREESIZE / 2];  /* Changed N.Watazaki */
+/*     node[..] -> s_node[..] */
+
+static unsigned short freq[TREESIZE];
+
+static unsigned short total_p;
+static int      avail, n1;
+static int      most_p, nn;
+static unsigned long nextcount;
+/* ------------------------------------------------------------------------ */
+void
+start_c_dyn( /* void */ )
+{
+       int             i, j, f;
+
+       n1 = (n_max >= 256 + maxmatch - THRESHOLD + 1) ? 512 : n_max - 1;
+       for (i = 0; i < TREESIZE_C; i++) {
+               stock[i] = i;
+               block[i] = 0;
+       }
+       for (i = 0, j = n_max * 2 - 2; i < n_max; i++, j--) {
+               freq[j] = 1;
+               child[j] = ~i;
+               s_node[i] = j;
+               block[j] = 1;
+       }
+       avail = 2;
+       edge[1] = n_max - 1;
+       i = n_max * 2 - 2;
+       while (j >= 0) {
+               f = freq[j] = freq[i] + freq[i - 1];
+               child[j] = i;
+               parent[i] = parent[i - 1] = j;
+               if (f == freq[j + 1]) {
+                       edge[block[j] = block[j + 1]] = j;
+               }
+               else {
+                       edge[block[j] = stock[avail++]] = j;
+               }
+               i -= 2;
+               j--;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+start_p_dyn( /* void */ )
+{
+       freq[ROOT_P] = 1;
+       child[ROOT_P] = ~(N_CHAR);
+       s_node[N_CHAR] = ROOT_P;
+       edge[block[ROOT_P] = stock[avail++]] = ROOT_P;
+       most_p = ROOT_P;
+       total_p = 0;
+       nn = 1 << dicbit;
+       nextcount = 64;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+decode_start_dyn( /* void */ )
+{
+       n_max = 286;
+       maxmatch = MAXMATCH;
+       init_getbits();
+       start_c_dyn();
+       start_p_dyn();
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+reconst(start, end)
+       int             start;
+       int             end;
+{
+       int             i, j, k, l, b;
+       unsigned int    f, g;
+
+       for (i = j = start; i < end; i++) {
+               if ((k = child[i]) < 0) {
+                       freq[j] = (freq[i] + 1) / 2;
+                       child[j] = k;
+                       j++;
+               }
+               if (edge[b = block[i]] == i) {
+                       stock[--avail] = b;
+               }
+       }
+       j--;
+       i = end - 1;
+       l = end - 2;
+       while (i >= start) {
+               while (i >= l) {
+                       freq[i] = freq[j];
+                       child[i] = child[j];
+                       i--, j--;
+               }
+               f = freq[l] + freq[l + 1];
+               for (k = start; f < freq[k]; k++);
+               while (j >= k) {
+                       freq[i] = freq[j];
+                       child[i] = child[j];
+                       i--, j--;
+               }
+               freq[i] = f;
+               child[i] = l + 1;
+               i--;
+               l -= 2;
+       }
+       f = 0;
+       for (i = start; i < end; i++) {
+               if ((j = child[i]) < 0)
+                       s_node[~j] = i;
+               else
+                       parent[j] = parent[j - 1] = i;
+               if ((g = freq[i]) == f) {
+                       block[i] = b;
+               }
+               else {
+                       edge[b = block[i] = stock[avail++]] = i;
+                       f = g;
+               }
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static int
+swap_inc(p)
+       int             p;
+{
+       int             b, q, r, s;
+
+       b = block[p];
+       if ((q = edge[b]) != p) {       /* swap for leader */
+               r = child[p];
+               s = child[q];
+               child[p] = s;
+               child[q] = r;
+               if (r >= 0)
+                       parent[r] = parent[r - 1] = q;
+               else
+                       s_node[~r] = q;
+               if (s >= 0)
+                       parent[s] = parent[s - 1] = p;
+               else
+                       s_node[~s] = p;
+               p = q;
+               goto Adjust;
+       }
+       else if (b == block[p + 1]) {
+Adjust:
+               edge[b]++;
+               if (++freq[p] == freq[p - 1]) {
+                       block[p] = block[p - 1];
+               }
+               else {
+                       edge[block[p] = stock[avail++]] = p;    /* create block */
+               }
+       }
+       else if (++freq[p] == freq[p - 1]) {
+               stock[--avail] = b;     /* delete block */
+               block[p] = block[p - 1];
+       }
+       return parent[p];
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+update_c(p)
+       int             p;
+{
+       int             q;
+
+       if (freq[ROOT_C] == 0x8000) {
+               reconst(0, n_max * 2 - 1);
+       }
+       freq[ROOT_C]++;
+       q = s_node[p];
+       do {
+               q = swap_inc(q);
+       } while (q != ROOT_C);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+update_p(p)
+       int             p;
+{
+       int             q;
+
+       if (total_p == 0x8000) {
+               reconst(ROOT_P, most_p + 1);
+               total_p = freq[ROOT_P];
+               freq[ROOT_P] = 0xffff;
+       }
+       q = s_node[p + N_CHAR];
+       while (q != ROOT_P) {
+               q = swap_inc(q);
+       }
+       total_p++;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+make_new_node(p)
+       int             p;
+{
+       int             q, r;
+
+       r = most_p + 1;
+       q = r + 1;
+       s_node[~(child[r] = child[most_p])] = r;
+       child[q] = ~(p + N_CHAR);
+       child[most_p] = q;
+       freq[r] = freq[most_p];
+       freq[q] = 0;
+       block[r] = block[most_p];
+       if (most_p == ROOT_P) {
+               freq[ROOT_P] = 0xffff;
+               edge[block[ROOT_P]]++;
+       }
+       parent[r] = parent[q] = most_p;
+       edge[block[q] = stock[avail++]] = s_node[p + N_CHAR] = most_p = q;
+       update_p(p);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+encode_c_dyn(c)
+       int             c;
+{
+       unsigned int    bits;
+       int             p, d, cnt;
+
+       d = c - n1;
+       if (d >= 0) {
+               c = n1;
+       }
+       cnt = bits = 0;
+       p = s_node[c];
+       do {
+               bits >>= 1;
+               if (p & 1) {
+                       bits |= 0x8000;
+               }
+               if (++cnt == 16) {
+                       putcode(16, bits);
+                       cnt = bits = 0;
+               }
+       } while ((p = parent[p]) != ROOT_C);
+       putcode(cnt, bits);
+       if (d >= 0)
+               putbits(8, d);
+       update_c(c);
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_c_dyn( /* void */ )
+{
+       int             c;
+       short           buf, cnt;
+
+       c = child[ROOT_C];
+       buf = bitbuf;
+       cnt = 0;
+       do {
+               c = child[c - (buf < 0)];
+               buf <<= 1;
+               if (++cnt == 16) {
+                       fillbuf(16);
+                       buf = bitbuf;
+                       cnt = 0;
+               }
+       } while (c > 0);
+       fillbuf(cnt);
+       c = ~c;
+       update_c(c);
+       if (c == n1)
+               c += getbits(8);
+       return c;
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_p_dyn( /* void */ )
+{
+       int             c;
+       short           buf, cnt;
+
+       while (count > nextcount) {
+               make_new_node(nextcount / 64);
+               if ((nextcount += 64) >= nn)
+                       nextcount = 0xffffffff;
+       }
+       c = child[ROOT_P];
+       buf = bitbuf;
+       cnt = 0;
+       while (c > 0) {
+               c = child[c - (buf < 0)];
+               buf <<= 1;
+               if (++cnt == 16) {
+                       fillbuf(16);
+                       buf = bitbuf;
+                       cnt = 0;
+               }
+       }
+       fillbuf(cnt);
+       c = (~c) - N_CHAR;
+       update_p(c);
+
+       return (c << 6) + getbits(6);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+output_dyn(code, pos)
+       int             code;
+       unsigned int    pos;
+{
+       encode_c_dyn(code);
+       if (code >= 0x100) {
+               encode_p_st0(pos);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+void
+encode_end_dyn( /* void */ )
+{
+       putcode(7, 0);
+}
diff --git a/src/extract.c b/src/extract.c
new file mode 100644 (file)
index 0000000..ff0fdd8
--- /dev/null
@@ -0,0 +1,61 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             extract.c -- extrcat from archive                                                       */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+int
+decode_lzhuf(infp, outfp, original_size, packed_size, name, method)
+       FILE           *infp;
+       FILE           *outfp;
+       long            original_size;
+       long            packed_size;
+       char           *name;
+       int             method;
+{
+       interface.method = method;
+       interface.dicbit = 13;  /* method + 8; -lh5- */
+       interface.infile = infp;
+       interface.outfile = outfp;
+       interface.original = original_size;
+       interface.packed = packed_size;
+
+       switch (method) {
+       case LZHUFF0_METHOD_NUM:
+       case LARC4_METHOD_NUM:
+               start_indicator(name, original_size
+                             ,verify_mode ? "Testing " : "Melting ", 2048);
+               copyfile(infp, (verify_mode ? NULL : outfp), original_size, 2);
+               break;
+       case LARC_METHOD_NUM:           /* -lzs- */
+               interface.dicbit = 11;
+               start_indicator(name, original_size
+                               ,verify_mode ? "Testing " : "Melting "
+                               ,1 << interface.dicbit);
+               decode(&interface);
+               break;
+       case LZHUFF1_METHOD_NUM:                /* -lh1- */
+       case LZHUFF4_METHOD_NUM:                /* -lh4- */
+       case LARC5_METHOD_NUM:                  /* -lz5- */
+               interface.dicbit = 12;
+               start_indicator(name, original_size
+                               ,verify_mode ? "Testing " : "Melting "
+                               ,1 << interface.dicbit);
+               decode(&interface);
+               break;
+       case LZHUFF6_METHOD_NUM:                /* -lz6- */     /* Added N.Watazaki (^_^) */
+               interface.dicbit = 15;          
+       default:
+               start_indicator(name, original_size
+                               ,verify_mode ? "Testing " : "Melting "
+                               ,1 << interface.dicbit);
+               decode(&interface);
+       }
+       finish_indicator(name, verify_mode ? "Tested  " : "Melted  ");
+
+       return crc;
+}
diff --git a/src/header.c b/src/header.c
new file mode 100644 (file)
index 0000000..ae80731
--- /dev/null
@@ -0,0 +1,865 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             header.c -- header manipulate functions                                         */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Original                                                                                                Y.Tagawa                */
+/*     modified                                                                        1991.12.16      M.Oki                   */
+/*     Ver. 1.10  Symbolic Link added                          1993.10.01      N.Watazaki              */
+/*     Ver. 1.13b Symbolic Link Bug Fix                        1994.08.22      N.Watazaki              */
+/*     Ver. 1.14  Source All chagned                           1995.01.14      N.Watazaki              */
+/*  Ver. 1.14e bug fixed                                               1999.05.27  T.Okamoto       */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+static char    *get_ptr;
+/* ------------------------------------------------------------------------ */
+int
+calc_sum(p, len)
+       register char  *p;
+       register int    len;
+{
+       register int    sum;
+
+       for (sum = 0; len; len--)
+               sum += *p++;
+
+       return sum & 0xff;
+}
+
+/* ------------------------------------------------------------------------ */
+static unsigned short
+get_word()
+{
+       int             b0, b1;
+
+       b0 = get_byte();
+       b1 = get_byte();
+       return (b1 << 8) + b0;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+put_word(v)
+       unsigned int    v;
+{
+       put_byte(v);
+       put_byte(v >> 8);
+}
+
+/* ------------------------------------------------------------------------ */
+static long
+get_longword()
+{
+       long            b0, b1, b2, b3;
+
+       b0 = get_byte();
+       b1 = get_byte();
+       b2 = get_byte();
+       b3 = get_byte();
+       return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+put_longword(v)
+       long            v;
+{
+       put_byte(v);
+       put_byte(v >> 8);
+       put_byte(v >> 16);
+       put_byte(v >> 24);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+msdos_to_unix_filename(name, len)
+       register char  *name;
+       register int    len;
+{
+       register int    i;
+
+#ifdef MULTIBYTE_CHAR
+       for (i = 0; i < len; i++) {
+               if (MULTIBYTE_FIRST_P(name[i]) &&
+                   MULTIBYTE_SECOND_P(name[i + 1]))
+                       i++;
+               else if (name[i] == '\\')
+                       name[i] = '/';
+               else if (isupper(name[i]))
+                       name[i] = tolower(name[i]);
+       }
+#else
+       for (i = 0; i < len; i++) {
+               if (name[i] == '\\')
+                       name[i] = '/';
+               else if (isupper(name[i]))
+                       name[i] = tolower(name[i]);
+       }
+#endif
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+generic_to_unix_filename(name, len)
+       register char  *name;
+       register int    len;
+{
+       register int    i;
+       boolean         lower_case_used = FALSE;
+
+#ifdef MULTIBYTE_CHAR
+       for (i = 0; i < len; i++) {
+               if (MULTIBYTE_FIRST_P(name[i]) &&
+                   MULTIBYTE_SECOND_P(name[i + 1]))
+                       i++;
+               else if (islower(name[i])) {
+                       lower_case_used = TRUE;
+                       break;
+               }
+       }
+       for (i = 0; i < len; i++) {
+               if (MULTIBYTE_FIRST_P(name[i]) &&
+                   MULTIBYTE_SECOND_P(name[i + 1]))
+                       i++;
+               else if (name[i] == '\\')
+                       name[i] = '/';
+               else if (!lower_case_used && isupper(name[i]))
+                       name[i] = tolower(name[i]);
+       }
+#else
+       for (i = 0; i < len; i++)
+               if (islower(name[i])) {
+                       lower_case_used = TRUE;
+                       break;
+               }
+       for (i = 0; i < len; i++) {
+               if (name[i] == '\\')
+                       name[i] = '/';
+               else if (!lower_case_used && isupper(name[i]))
+                       name[i] = tolower(name[i]);
+       }
+#endif
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+macos_to_unix_filename(name, len)
+       register char  *name;
+       register int    len;
+{
+       register int    i;
+
+       for (i = 0; i < len; i++) {
+               if (name[i] == ':')
+                       name[i] = '/';
+               else if (name[i] == '/')
+                       name[i] = ':';
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+unix_to_generic_filename(name, len)
+       register char  *name;
+       register int    len;
+{
+       register int    i;
+
+       for (i = 0; i < len; i++) {
+               if (name[i] == '/')
+                       name[i] = '\\';
+               else if (islower(name[i]))
+                       name[i] = toupper(name[i]);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* Generic stamp format:                                                                                                       */
+/*                                                                                                                                                     */
+/* 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16                                                     */
+/* |<-------- year ------->|<- month ->|<-- day -->|                                           */
+/*                                                                                                                                                     */
+/* 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0                                                     */
+/* |<--- hour --->|<---- minute --->|<- second*2 ->|                                           */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * NOTE : If you don't have `gettimeofday(2)', or your gettimeofday(2)
+ * returns bogus timezone information, try FTIME, MKTIME, TIMELOCAL or TZSET.
+ */
+
+/* choose one */
+#if defined(MKTIME)
+#ifdef TIMELOCAL
+#undef TIMELOCAL
+#endif
+#endif                         /* defined(MKTIME) */
+
+#if defined(MKTIME) || defined(TIMELOCAL)
+#ifdef TZSET
+#undef TZSET
+#endif
+#endif                         /* defined(MKTIME) || defined(TIMELOCAL) */
+
+#if defined(MKTIME) || defined(TIMELOCAL) || defined(TZSET)
+#ifdef FTIME
+#undef FTIME
+#endif
+#endif
+
+#if defined(MKTIME) || defined(TIMELOCAL) || defined(TZSET) || defined(FTIME)
+#ifdef GETTIMEOFDAY
+#undef GETTIMEOFDAY
+#endif
+#else
+#ifndef GETTIMEOFDAY
+#define GETTIMEOFDAY           /* use gettimeofday() */
+#endif
+#endif
+
+#ifdef FTIME
+#include <sys/timeb.h>
+#endif
+
+/*
+ * You may define as : #define TIMEZONE_HOOK           \ extern long
+ * timezone ;  \ extern void tzset();
+ */
+#ifdef TIMEZONE_HOOK
+TIMEZONE_HOOK
+/* Which do you like better, `TIMEZONE_HOOK' or `TIMEZONE_HOOK;' ? */
+#endif
+
+#if defined(TZSET) && defined(_MINIX)
+extern long     timezone;              /* not defined in time.h */
+#endif
+
+/* ------------------------------------------------------------------------ */
+#if defined(FTIME) || defined(GETTIMEOFDAY) || defined(TZSET)
+static long
+gettz()
+#ifdef TZSET
+{
+       tzset();
+       return timezone;
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+#if !defined(TZSET) && defined(FTIME)
+{
+       struct timeb    buf;
+
+       ftime(&buf);
+       return buf.timezone * 60L;
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+#if !defined(TZSET) && !defined(FTIME) /* maybe defined(GETTIMEOFDAY) */
+{
+#ifdef HAVE_TM_ZONE
+        time_t tt;
+
+        time(&tt);
+        return -localtime(&tt)->tm_gmtoff;
+#else /* HAVE_TM_ZONE */
+       struct timeval  tp;
+       struct timezone tzp;
+       gettimeofday(&tp, &tzp);/* specific to 4.3BSD */
+       /*
+        * return (tzp.tz_minuteswest * 60L + (tzp.tz_dsttime != 0 ? 60L *
+        * 60L : 0));
+        */
+       return (tzp.tz_minuteswest * 60L);
+#endif /* HAVE_TM_ZONE */
+}
+#endif
+#endif                         /* defined(FTIME) || defined(GETTIMEOFDAY) ||
+                                * defined(TZSET) */
+
+/* ------------------------------------------------------------------------ */
+#ifdef NOT_USED
+static struct tm *
+msdos_to_unix_stamp_tm(a)
+       long            a;
+{
+       static struct tm t;
+
+       t.tm_sec = (a & 0x1f) * 2;
+       t.tm_min = (a >> 5) & 0x3f;
+       t.tm_hour = (a >> 11) & 0x1f;
+       t.tm_mday = (a >> 16) & 0x1f;
+       t.tm_mon = ((a >> 16 + 5) & 0x0f) - 1;
+       t.tm_year = ((a >> 16 + 9) & 0x7f) + 80;
+       return &t;
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+static          time_t
+generic_to_unix_stamp(t)
+       long            t;
+#if defined(MKTIME) || defined(TIMELOCAL)
+{
+       struct tm       dostm;
+
+       /*
+        * special case:  if MSDOS format date and time were zero, then we
+        * set time to be zero here too.
+        */
+       if (t == 0)
+               return (time_t) 0;
+
+       dostm.tm_sec = (t & 0x1f) * 2;
+       dostm.tm_min = t >> 5 & 0x3f;
+       dostm.tm_hour = t >> 11 & 0x1f;
+       dostm.tm_mday = t >> 16 & 0x1f;
+       dostm.tm_mon = (t >> 16 + 5 & 0x0f) - 1;        /* 0..11 */
+       dostm.tm_year = (t >> 16 + 9 & 0x7f) + 80;
+#if 0
+       dostm.tm_isdst = 0;     /* correct? */
+#endif
+       dostm.tm_isdst = -1;    /* correct? */
+#ifdef MKTIME
+       return (time_t) mktime(&dostm);
+#else                          /* maybe defined(TIMELOCAL) */
+       return (time_t) timelocal(&dostm);
+#endif
+}
+
+#else                          /* defined(MKTIME) || defined(TIMELOCAL) */
+{
+       int             year, month, day, hour, min, sec;
+       long            longtime;
+       static unsigned int dsboy[12] = {0, 31, 59, 90, 120, 151,
+       181, 212, 243, 273, 304, 334};
+       unsigned int    days;
+
+       /*
+        * special case:  if MSDOS format date and time were zero, then we
+        * set time to be zero here too.
+        */
+       if (t == 0)
+               return (time_t) 0;
+
+       year = ((int) (t >> 16 + 9) & 0x7f) + 1980;
+       month = (int) (t >> 16 + 5) & 0x0f;     /* 1..12 means Jan..Dec */
+       day = (int) (t >> 16) & 0x1f;   /* 1..31 means 1st,...31st */
+
+       hour = ((int) t >> 11) & 0x1f;
+       min = ((int) t >> 5) & 0x3f;
+       sec = ((int) t & 0x1f) * 2;
+
+       /* Calculate days since 1970.01.01 */
+       days = (365 * (year - 1970) +   /* days due to whole years */
+               (year - 1970 + 1) / 4 + /* days due to leap years */
+               dsboy[month - 1] +      /* days since beginning of this year */
+               day - 1);       /* days since beginning of month */
+
+       if ((year % 4 == 0) &&
+               (year % 100 != 0 || year % 400 == 0) &&         /* 1999.5.24 t.oka */
+           (month >= 3))       /* if this is a leap year and month */
+               days++;         /* is March or later, add a day */
+
+       /* Knowing the days, we can find seconds */
+       longtime = (((days * 24) + hour) * 60 + min) * 60 + sec;
+       longtime += gettz();    /* adjust for timezone */
+
+       /* LONGTIME is now the time in seconds, since 1970/01/01 00:00:00.  */
+       return (time_t) longtime;
+}
+#endif                         /* defined(MKTIME) || defined(TIMELOCAL) */
+
+/* ------------------------------------------------------------------------ */
+static long
+unix_to_generic_stamp(t)
+       time_t          t;
+{
+       struct tm      *tm = localtime(&t);
+
+       return ((((long) (tm->tm_year - 80)) << 25) +
+               (((long) (tm->tm_mon + 1)) << 21) +
+               (((long) tm->tm_mday) << 16) +
+               (long) ((tm->tm_hour << 11) +
+                       (tm->tm_min << 5) +
+                       (tm->tm_sec / 2)));
+}
+
+/* ------------------------------------------------------------------------ */
+/* build header functions                                                                                                      */
+/* ------------------------------------------------------------------------ */
+boolean
+get_header(fp, hdr)
+       FILE           *fp;
+       register LzHeader *hdr;
+{
+       int             header_size;
+       int             name_length;
+       char            data[LZHEADER_STRAGE];
+       char            dirname[FILENAME_LENGTH];
+       int             dir_length = 0;
+       int             checksum;
+       int             i;
+       char           *ptr;
+       int                             extend_size;
+       int                             dmy;
+
+       bzero(hdr, sizeof(LzHeader));
+
+       if (((header_size = getc(fp)) == EOF) || (header_size == 0)) {
+               return FALSE;   /* finish */
+       }
+
+       if (fread(data + I_HEADER_CHECKSUM,
+                 sizeof(char), header_size - 1, fp) < header_size - 1) {
+               fatal_error("Invalid header (LHarc file ?)");
+               return FALSE;   /* finish */
+       }
+       setup_get(data + I_HEADER_LEVEL);
+       hdr->header_level = get_byte();
+       if (hdr->header_level != 2 &&
+           fread(data + header_size, sizeof(char), 2, fp) < 2) {
+               fatal_error("Invalid header (LHarc file ?)");
+               return FALSE;   /* finish */
+       }
+
+       if (hdr->header_level >= 3) {
+               fatal_error("Unknown level header");
+               return FALSE;
+       }
+
+       setup_get(data + I_HEADER_CHECKSUM);
+       checksum = get_byte();
+
+       hdr->header_size = header_size;
+       bcopy(data + I_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+       setup_get(data + I_PACKED_SIZE);
+       hdr->packed_size = get_longword();
+       hdr->original_size = get_longword();
+       hdr->last_modified_stamp = get_longword();
+       hdr->attribute = get_byte();
+
+       if ((hdr->header_level = get_byte()) != 2) {
+               if (calc_sum(data + I_METHOD, header_size) != checksum)
+                       warning("Checksum error (LHarc file?)", "");
+               name_length = get_byte();
+               for (i = 0; i < name_length; i++)
+                       hdr->name[i] = (char) get_byte();
+               hdr->name[name_length] = '\0';
+       }
+       else {
+               hdr->unix_last_modified_stamp = hdr->last_modified_stamp;
+               name_length = 0;
+       }
+
+       /* defaults for other type */
+       hdr->unix_mode = UNIX_FILE_REGULAR | UNIX_RW_RW_RW;
+       hdr->unix_gid = 0;
+       hdr->unix_uid = 0;
+
+
+       if (hdr->header_level == 0) {
+               extend_size = header_size - name_length -22;
+               if (extend_size < 0) {
+                       if (extend_size == -2) {
+                               hdr->extend_type = EXTEND_GENERIC;
+                               hdr->has_crc = FALSE;
+                       } else {
+                               fatal_error("Unkonwn header (lha file?)");
+                               return FALSE;
+                       }
+               } else {
+                       hdr->has_crc = TRUE;
+                       hdr->crc = get_word();
+               }
+
+               if (extend_size >= 1) {
+                       hdr->extend_type = get_byte();
+                       extend_size--;
+               }
+               if (hdr->extend_type == EXTEND_UNIX) {
+                       if (extend_size >= 11) {
+                               hdr->minor_version = get_byte();
+                               hdr->unix_last_modified_stamp = (time_t) get_longword();
+                               hdr->unix_mode = get_word();
+                               hdr->unix_uid = get_word();
+                               hdr->unix_gid = get_word();
+                               extend_size -= 11;
+                       } else {
+                               hdr->extend_type = EXTEND_GENERIC;
+                       }
+               }
+               while (extend_size-- > 0)
+                       dmy = get_byte();
+               if (hdr->extend_type == EXTEND_UNIX)
+                       return TRUE;
+       } else if (hdr->header_level == 1) {
+               hdr->has_crc = TRUE;
+               extend_size = header_size - name_length-25;
+               hdr->crc = get_word();
+               hdr->extend_type = get_byte();
+               while (extend_size-- > 0)
+                       dmy = get_byte();
+       } else { /* level 2 */
+               hdr->has_crc = TRUE;
+               hdr->crc = get_word();
+               hdr->extend_type = get_byte();
+       }               
+
+       if (hdr->header_level > 0) {
+               /* Extend Header */
+               if (hdr->header_level != 2)
+                       setup_get(data + hdr->header_size);
+               ptr = get_ptr;
+               while ((header_size = get_word()) != 0) {
+                       if (hdr->header_level != 2 &&
+                       ((data + LZHEADER_STRAGE - get_ptr < header_size) ||
+                        fread(get_ptr, sizeof(char), header_size, fp) < header_size)) {
+                               fatal_error("Invalid header (LHa file ?)");
+                               return FALSE;
+                       }
+                       switch (get_byte()) {
+                       case 0:
+                               /*
+                                * header crc
+                                */
+                               setup_get(get_ptr + header_size - 3);
+                               break;
+                       case 1:
+                               /*
+                                * filename
+                                */
+                               for (i = 0; i < header_size - 3; i++)
+                                       hdr->name[i] = (char) get_byte();
+                               hdr->name[header_size - 3] = '\0';
+                               break;
+                       case 2:
+                               /*
+                                * directory
+                                */
+                               for (i = 0; i < header_size - 3; i++)
+                                       dirname[i] = (char) get_byte();
+                               dirname[header_size - 3] = '\0';
+                               convdelim(dirname, DELIM);
+                               dir_length = header_size - 3;
+                               break;
+                       case 0x40:
+                               /*
+                                * MS-DOS attribute
+                                */
+                               if (hdr->extend_type == EXTEND_MSDOS ||
+                                   hdr->extend_type == EXTEND_HUMAN ||
+                                   hdr->extend_type == EXTEND_GENERIC)
+                                       hdr->attribute = get_word();
+                               break;
+                       case 0x50:
+                               /*
+                                * UNIX permission
+                                */
+                               if (hdr->extend_type == EXTEND_UNIX)
+                                       hdr->unix_mode = get_word();
+                               break;
+                       case 0x51:
+                               /*
+                                * UNIX gid and uid
+                                */
+                               if (hdr->extend_type == EXTEND_UNIX) {
+                                       hdr->unix_gid = get_word();
+                                       hdr->unix_uid = get_word();
+                               }
+                               break;
+                       case 0x52:
+                               /*
+                                * UNIX group name
+                                */
+                               setup_get(get_ptr + header_size - 3);
+                               break;
+                       case 0x53:
+                               /*
+                                * UNIX user name
+                                */
+                               setup_get(get_ptr + header_size - 3);
+                               break;
+                       case 0x54:
+                               /*
+                                * UNIX last modified time
+                                */
+                               if (hdr->extend_type == EXTEND_UNIX)
+                                       hdr->unix_last_modified_stamp = (time_t) get_longword();
+                               break;
+                       default:
+                               /*
+                                * other headers
+                                */
+                               setup_get(get_ptr + header_size - 3);
+                               break;
+                       }
+               }
+               if (hdr->header_level != 2 && get_ptr - ptr != 2) {
+                       hdr->packed_size -= get_ptr - ptr - 2;
+                       hdr->header_size += get_ptr - ptr - 2;
+               }
+       }
+       if (dir_length) {
+               strcat(dirname, hdr->name);
+               strcpy(hdr->name, dirname);
+               name_length += dir_length;
+       }
+
+       switch (hdr->extend_type) {
+       case EXTEND_MSDOS:
+               msdos_to_unix_filename(hdr->name, name_length);
+       case EXTEND_HUMAN:
+               if (hdr->header_level == 2)
+                       hdr->unix_last_modified_stamp = hdr->last_modified_stamp;
+               else
+                       hdr->unix_last_modified_stamp =
+                               generic_to_unix_stamp(hdr->last_modified_stamp);
+               break;
+
+#ifdef OSK
+       case EXTEND_OS68K:
+       case EXTEND_XOSK:
+#endif
+       case EXTEND_UNIX:
+               break;
+
+       case EXTEND_MACOS:
+               macos_to_unix_filename(hdr->name, name_length);
+               hdr->unix_last_modified_stamp =
+                       generic_to_unix_stamp(hdr->last_modified_stamp);
+               break;
+
+       default:
+               generic_to_unix_filename(hdr->name, name_length);
+               if (hdr->header_level == 2)
+                       hdr->unix_last_modified_stamp = hdr->last_modified_stamp;
+               else
+                       hdr->unix_last_modified_stamp =
+                               generic_to_unix_stamp(hdr->last_modified_stamp);
+       }
+
+#if 0
+       printf("header level=%d\n", hdr->header_level); fflush(stdout);
+#endif
+
+       return TRUE;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+init_header(name, v_stat, hdr)
+       char           *name;
+       struct stat    *v_stat;
+       LzHeader       *hdr;
+{
+       int             len;
+
+       if (compress_method == LZHUFF5_METHOD_NUM)  /* Changed N.Watazaki */
+               bcopy(LZHUFF5_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+       else if (compress_method)
+               bcopy(LZHUFF1_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+       else
+               bcopy(LZHUFF0_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+
+       hdr->packed_size = 0;
+       hdr->original_size = v_stat->st_size;
+       hdr->last_modified_stamp = unix_to_generic_stamp(v_stat->st_mtime);
+       hdr->attribute = GENERIC_ATTRIBUTE;
+       hdr->header_level = header_level;
+       strcpy(hdr->name, name);
+       len = strlen(name);
+       hdr->crc = 0x0000;
+       hdr->extend_type = EXTEND_UNIX;
+       hdr->unix_last_modified_stamp = v_stat->st_mtime;
+       /* since 00:00:00 JAN.1.1970 */
+#ifdef NOT_COMPATIBLE_MODE
+       /* Please need your modification in this space. */
+#else
+       hdr->unix_mode = v_stat->st_mode;
+#endif
+
+       hdr->unix_uid = v_stat->st_uid;
+       hdr->unix_gid = v_stat->st_gid;
+
+       if (is_directory(v_stat)) {
+               bcopy(LZHDIRS_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+               hdr->attribute = GENERIC_DIRECTORY_ATTRIBUTE;
+               hdr->original_size = 0;
+               if (len > 0 && hdr->name[len - 1] != '/')
+                       strcpy(&hdr->name[len++], "/");
+       }
+
+#ifdef S_IFLNK 
+       if (is_symlink(v_stat)) {
+               char    lkname[257];
+               int             len;    
+               bcopy(LZHDIRS_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+               hdr->attribute = GENERIC_DIRECTORY_ATTRIBUTE;
+               hdr->original_size = 0;
+               len = readlink(name, lkname, 256);
+               lkname[len] = (char)'\0';
+               sprintf(hdr->name, "%s|%s", hdr->name, lkname);
+       }
+#endif
+       if (generic_format)
+               unix_to_generic_filename(hdr->name, len);
+}
+
+/* ------------------------------------------------------------------------ */
+/* Write unix extended header or generic header. */
+void
+write_header(nafp, hdr)
+       FILE           *nafp;
+       LzHeader       *hdr;
+{
+       int             header_size;
+       int             name_length;
+       char            data[LZHEADER_STRAGE];
+       char           *p;
+       char           *headercrc_ptr;
+
+       bzero(data, LZHEADER_STRAGE);
+       bcopy(hdr->method, data + I_METHOD, METHOD_TYPE_STRAGE);
+       setup_put(data + I_PACKED_SIZE);
+       put_longword(hdr->packed_size);
+       put_longword(hdr->original_size);
+
+       if (hdr->header_level == HEADER_LEVEL2)
+               put_longword((long) hdr->unix_last_modified_stamp);
+       else
+               put_longword(hdr->last_modified_stamp);
+
+       switch (hdr->header_level) {
+       case HEADER_LEVEL0:
+               put_byte(hdr->attribute);
+               break;
+       case HEADER_LEVEL1:
+       case HEADER_LEVEL2:
+               put_byte(0x20);
+               break;
+       }
+
+       put_byte(hdr->header_level);
+
+       convdelim(hdr->name, DELIM2);
+       if (hdr->header_level != HEADER_LEVEL2) {
+               if (p = (char *) rindex(hdr->name, DELIM2))
+                       name_length = strlen(++p);
+               else
+                       name_length = strlen(hdr->name);
+               put_byte(name_length);
+               bcopy(p ? p : hdr->name, data + I_NAME, name_length);
+               setup_put(data + I_NAME + name_length);
+       }
+
+       put_word(hdr->crc);
+       if (header_level == HEADER_LEVEL0) {
+               if (generic_format) {
+                       header_size = I_GENERIC_HEADER_BOTTOM - 2 + name_length;
+                       data[I_HEADER_SIZE] = header_size;
+                       data[I_HEADER_CHECKSUM] = calc_sum(data + I_METHOD, header_size);
+               } else {
+                       /* write old-style extend header */
+                       put_byte(EXTEND_UNIX);
+                       put_byte(CURRENT_UNIX_MINOR_VERSION);
+                       put_longword((long) hdr->unix_last_modified_stamp);
+                       put_word(hdr->unix_mode);
+                       put_word(hdr->unix_uid);
+                       put_word(hdr->unix_gid);
+                       header_size = I_UNIX_EXTEND_BOTTOM - 2 + name_length;
+                       data[I_HEADER_SIZE] = header_size;
+                       data[I_HEADER_CHECKSUM] = calc_sum(data + I_METHOD, header_size);
+               }
+       } else {
+               /* write extend header. */
+               char           *ptr;
+
+               if (generic_format)
+                       put_byte(0x00);
+               else
+                       put_byte(EXTEND_UNIX);
+
+               ptr = put_ptr;
+               if (hdr->header_level == HEADER_LEVEL2) {
+                       /* write common header */
+                       put_word(5);
+                       put_byte(0x00);
+                       headercrc_ptr = put_ptr;
+                       put_word(0x0000);
+               }
+
+               if (generic_format) {
+                       header_size = put_ptr - data;   /* +2 for last 0x0000 */
+               } else {
+                       put_word(5);
+                       if (hdr->header_level == HEADER_LEVEL1)
+                               header_size = put_ptr - data - 2;
+                       put_byte(0x50); /* permission */
+                       put_word(hdr->unix_mode);
+                       put_word(7);
+                       put_byte(0x51); /* gid and uid */
+                       put_word(hdr->unix_gid);
+                       put_word(hdr->unix_uid);
+
+                       if (p = (char *) rindex(hdr->name, DELIM2)) {
+                               int             i;
+
+                               name_length = p - hdr->name + 1;
+                               put_word(name_length + 3);
+                               put_byte(2);    /* dirname */
+                               for (i = 0; i < name_length; i++)
+                                       put_byte(hdr->name[i]);
+                       }
+               }               /* if generic .. */
+
+               if (header_level != HEADER_LEVEL2) {
+                       if (!generic_format) {
+                               put_word(7);
+                               put_byte(0x54); /* time stamp */
+                               put_longword(hdr->unix_last_modified_stamp);
+                       }
+                       hdr->packed_size += put_ptr - ptr;
+                       ptr = put_ptr;
+                       setup_put(data + I_PACKED_SIZE);
+                       put_longword(hdr->packed_size);
+                       put_ptr = ptr;
+                       data[I_HEADER_SIZE] = header_size;
+                       data[I_HEADER_CHECKSUM] = calc_sum(data + I_METHOD, header_size);
+               } else {                /* header level 2 */
+                       int             i;
+                       if (p = (char *) rindex(hdr->name, DELIM2))
+                               name_length = strlen(++p);
+                       else {
+                               p = hdr->name;
+                               name_length = strlen(hdr->name);
+                       }
+                       put_word(name_length + 3);
+                       put_byte(1);    /* filename */
+                       for (i = 0; i < name_length; i++)
+                               put_byte(*p++);
+               }               /* if he.. != HEAD_LV2 */
+               header_size = put_ptr - data;
+       }
+
+       if (header_level == HEADER_LEVEL2) {
+               unsigned short  hcrc;
+               setup_put(data + I_HEADER_SIZE);
+               put_word(header_size + 2);
+               /* common header */
+               hcrc = calc_header_crc(data, (unsigned int) header_size + 2);
+               setup_put(headercrc_ptr);
+               put_word(hcrc);
+       }
+
+       if (fwrite(data, sizeof(char), header_size + 2, nafp) == 0)
+               fatal_error("Cannot write to temporary file");
+
+       convdelim(hdr->name, DELIM);
+}
diff --git a/src/huf.c b/src/huf.c
new file mode 100644 (file)
index 0000000..2fb7798
--- /dev/null
+++ b/src/huf.c
@@ -0,0 +1,461 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             huf.c -- new static Huffman                                                                     */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+#ifdef sony_news
+#include <sys/param.h>
+#endif
+
+#if defined(__STDC__) || defined(NEWSOS)
+#include <stdlib.h>
+#endif
+
+/* ------------------------------------------------------------------------ */
+unsigned short  left[2 * NC - 1], right[2 * NC - 1];
+unsigned char   c_len[NC], pt_len[NPT];
+unsigned short  c_freq[2 * NC - 1], c_table[4096], c_code[NC], p_freq[2 * NP - 1],
+                pt_table[256], pt_code[NPT], t_freq[2 * NT - 1];
+
+static unsigned char *buf;
+static unsigned short bufsiz;
+static unsigned short blocksize;
+static unsigned short output_pos, output_mask;
+static                         int       pbit;
+static                         int       np;
+/* ------------------------------------------------------------------------ */
+/*                                                             Encording                                                                       */
+/* ------------------------------------------------------------------------ */
+static void
+count_t_freq(/*void*/)
+{
+       short           i, k, n, count;
+
+       for (i = 0; i < NT; i++)
+               t_freq[i] = 0;
+       n = NC;
+       while (n > 0 && c_len[n - 1] == 0)
+               n--;
+       i = 0;
+       while (i < n) {
+               k = c_len[i++];
+               if (k == 0) {
+                       count = 1;
+                       while (i < n && c_len[i] == 0) {
+                               i++;
+                               count++;
+                       }
+                       if (count <= 2)
+                               t_freq[0] += count;
+                       else if (count <= 18)
+                               t_freq[1]++;
+                       else if (count == 19) {
+                               t_freq[0]++;
+                               t_freq[1]++;
+                       }
+                       else
+                               t_freq[2]++;
+               } else
+                       t_freq[k + 2]++;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+write_pt_len(n, nbit, i_special)
+       short           n;
+       short           nbit;
+       short           i_special;
+{
+       short           i, k;
+
+       while (n > 0 && pt_len[n - 1] == 0)
+               n--;
+       putbits(nbit, n);
+       i = 0;
+       while (i < n) {
+               k = pt_len[i++];
+               if (k <= 6)
+                       putbits(3, k);
+               else
+                       putbits(k - 3, USHRT_MAX << 1);
+               if (i == i_special) {
+                       while (i < 6 && pt_len[i] == 0)
+                               i++;
+                       putbits(2, i - 3);
+               }
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+write_c_len(/*void*/)
+{
+       short           i, k, n, count;
+
+       n = NC;
+       while (n > 0 && c_len[n - 1] == 0)
+               n--;
+       putbits(CBIT, n);
+       i = 0;
+       while (i < n) {
+               k = c_len[i++];
+               if (k == 0) {
+                       count = 1;
+                       while (i < n && c_len[i] == 0) {
+                               i++;
+                               count++;
+                       }
+                       if (count <= 2) {
+                               for (k = 0; k < count; k++)
+                                       putcode(pt_len[0], pt_code[0]);
+                       }
+                       else if (count <= 18) {
+                               putcode(pt_len[1], pt_code[1]);
+                               putbits(4, count - 3);
+                       }
+                       else if (count == 19) {
+                               putcode(pt_len[0], pt_code[0]);
+                               putcode(pt_len[1], pt_code[1]);
+                               putbits(4, 15);
+                       }
+                       else {
+                               putcode(pt_len[2], pt_code[2]);
+                               putbits(CBIT, count - 20);
+                       }
+               }
+               else
+                       putcode(pt_len[k + 2], pt_code[k + 2]);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+encode_c(c)
+       short           c;
+{
+       putcode(c_len[c], c_code[c]);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+encode_p(p)
+       unsigned short  p;
+{
+       unsigned short  c, q;
+
+       c = 0;
+       q = p;
+       while (q) {
+               q >>= 1;
+               c++;
+       }
+       putcode(pt_len[c], pt_code[c]);
+       if (c > 1)
+               putbits(c - 1, p);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+send_block( /* void */ )
+{
+       unsigned char   flags;
+       unsigned short  i, k, root, pos, size;
+
+       root = make_tree(NC, c_freq, c_len, c_code);
+       size = c_freq[root];
+       putbits(16, size);
+       if (root >= NC) {
+               count_t_freq();
+               root = make_tree(NT, t_freq, pt_len, pt_code);
+               if (root >= NT) {
+                       write_pt_len(NT, TBIT, 3);
+               } else {
+                       putbits(TBIT, 0);
+                       putbits(TBIT, root);
+               }
+               write_c_len();
+       } else {
+               putbits(TBIT, 0);
+               putbits(TBIT, 0);
+               putbits(CBIT, 0);
+               putbits(CBIT, root);
+       }
+       root = make_tree(np, p_freq, pt_len, pt_code);
+       if (root >= np) {
+               write_pt_len(np, pbit, -1);
+       }
+       else {
+               putbits(pbit, 0);
+               putbits(pbit, root);
+       }
+       pos = 0;
+       for (i = 0; i < size; i++) {
+               if (i % CHAR_BIT == 0)
+                       flags = buf[pos++];
+               else
+                       flags <<= 1;
+               if (flags & (1 << (CHAR_BIT - 1))) {
+                       encode_c(buf[pos++] + (1 << CHAR_BIT));
+                       k = buf[pos++] << CHAR_BIT;
+                       k += buf[pos++];
+                       encode_p(k);
+               } else
+                       encode_c(buf[pos++]);
+               if (unpackable)
+                       return;
+       }
+       for (i = 0; i < NC; i++)
+               c_freq[i] = 0;
+       for (i = 0; i < np; i++)
+               p_freq[i] = 0;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+output_st1(c, p)
+       unsigned short  c;
+       unsigned short  p;
+{
+       static unsigned short cpos;
+
+       output_mask >>= 1;
+       if (output_mask == 0) {
+               output_mask = 1 << (CHAR_BIT - 1);
+               if (output_pos >= bufsiz - 3 * CHAR_BIT) {
+                       send_block();
+                       if (unpackable)
+                               return;
+                       output_pos = 0;
+               }
+               cpos = output_pos++;
+               buf[cpos] = 0;
+       }
+       buf[output_pos++] = (unsigned char) c;
+       c_freq[c]++;
+       if (c >= (1 << CHAR_BIT)) {
+               buf[cpos] |= output_mask;
+               buf[output_pos++] = (unsigned char) (p >> CHAR_BIT);
+               buf[output_pos++] = (unsigned char) p;
+               c = 0;
+               while (p) {
+                       p >>= 1;
+                       c++;
+               }
+               p_freq[c]++;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned char  *
+alloc_buf( /* void */ )
+{
+       bufsiz = 16 * 1024 *2;  /* 65408U; */ /* t.okamoto */
+       while ((buf = (unsigned char *) malloc(bufsiz)) == NULL) {
+               bufsiz = (bufsiz / 10) * 9;
+               if (bufsiz < 4 * 1024)
+                       break;
+       }
+       return buf;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+encode_start_st1( /* void */ )
+{
+       int             i;
+
+       if (dicbit <= (MAX_DICBIT - 2)) {
+               pbit = 4;       /* lh4,5 etc. */
+               np = 14;
+       } else {
+               pbit = 5;       /* lh6 */
+               np = 16;
+       }
+
+       for (i = 0; i < NC; i++)
+               c_freq[i] = 0;
+       for (i = 0; i < np; i++)
+               p_freq[i] = 0;
+       output_pos = output_mask = 0;
+       init_putbits();
+       buf[0] = 0;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+encode_end_st1( /* void */ )
+{
+       if (!unpackable) {
+               send_block();
+               putbits(CHAR_BIT - 1, 0);       /* flush remaining bits */
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                             decoding                                                                        */
+/* ------------------------------------------------------------------------ */
+static void
+read_pt_len(nn, nbit, i_special)
+       short           nn;
+       short           nbit;
+       short           i_special;
+{
+       short           i, c, n;
+
+       n = getbits(nbit);
+       if (n == 0) {
+               c = getbits(nbit);
+               for (i = 0; i < nn; i++)
+                       pt_len[i] = 0;
+               for (i = 0; i < 256; i++)
+                       pt_table[i] = c;
+       }
+       else {
+               i = 0;
+               while (i < n) {
+                       c = bitbuf >> (16 - 3);
+                       if (c == 7) {
+                               unsigned short  mask = 1 << (16 - 4);
+                               while (mask & bitbuf) {
+                                       mask >>= 1;
+                                       c++;
+                               }
+                       }
+                       fillbuf((c < 7) ? 3 : c - 3);
+                       pt_len[i++] = c;
+                       if (i == i_special) {
+                               c = getbits(2);
+                               while (--c >= 0)
+                                       pt_len[i++] = 0;
+                       }
+               }
+               while (i < nn)
+                       pt_len[i++] = 0;
+               make_table(nn, pt_len, 8, pt_table);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+read_c_len( /* void */ )
+{
+       short           i, c, n;
+
+       n = getbits(CBIT);
+       if (n == 0) {
+               c = getbits(CBIT);
+               for (i = 0; i < NC; i++)
+                       c_len[i] = 0;
+               for (i = 0; i < 4096; i++)
+                       c_table[i] = c;
+       } else {
+               i = 0;
+               while (i < n) {
+                       c = pt_table[bitbuf >> (16 - 8)];
+                       if (c >= NT) {
+                               unsigned short  mask = 1 << (16 - 9);
+                               do {
+                                       if (bitbuf & mask)
+                                               c = right[c];
+                                       else
+                                               c = left[c];
+                                       mask >>= 1;
+                               } while (c >= NT);
+                       }
+                       fillbuf(pt_len[c]);
+                       if (c <= 2) {
+                               if (c == 0)
+                                       c = 1;
+                               else if (c == 1)
+                                       c = getbits(4) + 3;
+                               else
+                                       c = getbits(CBIT) + 20;
+                               while (--c >= 0)
+                                       c_len[i++] = 0;
+                       }
+                       else
+                               c_len[i++] = c - 2;
+               }
+               while (i < NC)
+                       c_len[i++] = 0;
+               make_table(NC, c_len, 12, c_table);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_c_st1( /*void*/ )
+{
+       unsigned short  j, mask;
+
+       if (blocksize == 0) {
+               blocksize = getbits(16);
+               read_pt_len(NT, TBIT, 3);
+               read_c_len();
+               read_pt_len(np, pbit, -1);
+       }
+       blocksize--;
+       j = c_table[bitbuf >> 4];
+       if (j < NC)
+               fillbuf(c_len[j]);
+       else {
+               fillbuf(12);
+               mask = 1 << (16 - 1);
+               do {
+                       if (bitbuf & mask)
+                               j = right[j];
+                       else
+                               j = left[j];
+                       mask >>= 1;
+               } while (j >= NC);
+               fillbuf(c_len[j] - 12);
+       }
+       return j;
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_p_st1( /* void */ )
+{
+       unsigned short  j, mask;
+
+       j = pt_table[bitbuf >> (16 - 8)];
+       if (j < np)
+               fillbuf(pt_len[j]);
+       else {
+               fillbuf(8);
+               mask = 1 << (16 - 1);
+               do {
+                       if (bitbuf & mask)
+                               j = right[j];
+                       else
+                               j = left[j];
+                       mask >>= 1;
+               } while (j >= np);
+               fillbuf(pt_len[j] - 8);
+       }
+       if (j != 0)
+               j = (1 << (j - 1)) + getbits(j - 1);
+       return j;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+decode_start_st1( /* void */ )
+{
+       if (dicbit <= (MAX_DICBIT - 2))  {              /* 13 ... Changed N.Watazaki */
+               np = 14;
+               pbit = 4;
+       } else {
+               np = 16;
+               pbit = 5;
+       }
+       init_getbits();
+       blocksize = 0;
+}
diff --git a/src/larc.c b/src/larc.c
new file mode 100644 (file)
index 0000000..6627cd4
--- /dev/null
@@ -0,0 +1,85 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             larc.c -- extra *.lzs                                                                           */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+static int      flag, flagcnt, matchpos;
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_c_lzs( /*void*/ )
+{
+       if (getbits(1)) {
+               return getbits(8);
+       }
+       else {
+               matchpos = getbits(11);
+               return getbits(4) + 0x100;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_p_lzs( /*void*/ )
+{
+       return (loc - matchpos - MAGIC0) & 0x7ff;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+decode_start_lzs( /*void*/ )
+{
+       init_getbits();
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_c_lz5( /*void*/ )
+{
+       int             c;
+
+       if (flagcnt == 0) {
+               flagcnt = 8;
+               flag = getc(infile);
+       }
+       flagcnt--;
+       c = getc(infile);
+       if ((flag & 1) == 0) {
+               matchpos = c;
+               c = getc(infile);
+               matchpos += (c & 0xf0) << 4;
+               c &= 0x0f;
+               c += 0x100;
+       }
+       flag >>= 1;
+       return c;
+}
+
+/* ------------------------------------------------------------------------ */
+unsigned short
+decode_p_lz5( /*void*/ )
+{
+       return (loc - matchpos - MAGIC5) & 0xfff;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+decode_start_lz5( /*void*/ )
+{
+       int             i;
+
+       flagcnt = 0;
+       for (i = 0; i < 256; i++)
+               memset(&text[i * 13 + 18], i, 13);
+       for (i = 0; i < 256; i++)
+               text[256 * 13 + 18 + i] = i;
+       for (i = 0; i < 256; i++)
+               text[256 * 13 + 256 + 18 + i] = 255 - i;
+       memset(&text[256 * 13 + 512 + 18], 0, 128);
+       memset(&text[256 * 13 + 512 + 128 + 18], ' ', 128 - 18);
+}
diff --git a/src/lha.h b/src/lha.h
new file mode 100644 (file)
index 0000000..52203cc
--- /dev/null
+++ b/src/lha.h
@@ -0,0 +1,312 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX    Archiver Driver                                                                                     */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Soruce All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+/*
+       Included...
+               lharc.h         interface.h             slidehuf.h
+*/
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+
+#include <signal.h>
+
+#include "lha_macro.h"
+
+struct encode_option {
+#if defined(__STDC__) || defined(AIX)
+       void            (*output) ();
+       void            (*encode_start) ();
+       void            (*encode_end) ();
+#else
+       int             (*output) ();
+       int             (*encode_start) ();
+       int             (*encode_end) ();
+#endif
+};
+
+struct decode_option {
+       unsigned short  (*decode_c) ();
+       unsigned short  (*decode_p) ();
+#if defined(__STDC__) || defined(AIX)
+       void            (*decode_start) ();
+#else
+       int             (*decode_start) ();
+#endif
+};
+
+/* ------------------------------------------------------------------------ */
+/*     LHa File Type Definition                                                                                                */
+/* ------------------------------------------------------------------------ */
+struct string_pool {
+       int             used;
+       int             size;
+       int             n;
+       char           *buffer;
+};
+
+typedef struct LzHeader {
+       unsigned char   header_size;
+       char            method[METHOD_TYPE_STRAGE];
+       long            packed_size;
+       long            original_size;
+       long            last_modified_stamp;
+       unsigned char   attribute;
+       unsigned char   header_level;
+       char            name[256];
+       unsigned short  crc;
+       boolean         has_crc;
+       unsigned char   extend_type;
+       unsigned char   minor_version;
+
+       /* extend_type == EXTEND_UNIX  and convert from other type. */
+       time_t          unix_last_modified_stamp;
+       unsigned short  unix_mode;
+       unsigned short  unix_uid;
+       unsigned short  unix_gid;
+}  LzHeader;
+
+struct interfacing {
+       FILE                    *infile;
+       FILE                    *outfile;
+       unsigned long   original;
+       unsigned long   packed;
+       int             dicbit;
+       int             method;
+};
+
+
+/* ------------------------------------------------------------------------ */
+/*     Option switch variable                                                                                                  */
+/* ------------------------------------------------------------------------ */
+/* command line options (common options) */
+EXTERN boolean  quiet;
+EXTERN boolean  text_mode;
+EXTERN boolean  verbose;
+EXTERN boolean  noexec;                /* debugging option */
+EXTERN boolean  force;
+EXTERN boolean  prof;
+EXTERN boolean  delete_after_append;
+EXTERN int             compress_method;
+EXTERN int             header_level;
+/* EXTERN int          quiet_mode; */   /* 1996.8.13 t.okamoto */
+#ifdef EUC
+EXTERN boolean euc_mode;
+#endif
+
+/* list command flags */
+EXTERN boolean  verbose_listing;
+
+/* extract/print command flags */
+EXTERN boolean  output_to_stdout;
+
+/* add/update/delete command flags */
+EXTERN boolean  new_archive;
+EXTERN boolean  update_if_newer;
+EXTERN boolean  generic_format;
+
+EXTERN boolean remove_temporary_at_error;
+EXTERN boolean recover_archive_when_interrupt;
+EXTERN boolean remove_extracting_file_when_interrupt;
+EXTERN boolean get_filename_from_stdin;
+EXTERN boolean ignore_directory;
+EXTERN boolean verify_mode;
+
+/* Indicator flag */
+EXTERN int             quiet_mode;
+
+/* ------------------------------------------------------------------------ */
+/*     Globale Variable                                                                                                                */
+/* ------------------------------------------------------------------------ */
+EXTERN char            **cmd_filev;
+EXTERN int      cmd_filec;
+
+EXTERN char            *archive_name;
+EXTERN char     expanded_archive_name[FILENAME_LENGTH];
+EXTERN char     temporary_name[FILENAME_LENGTH];
+EXTERN char     backup_archive_name[FILENAME_LENGTH];
+
+EXTERN char            *reading_filename, *writting_filename;
+
+/* 1996.8.13 t.okamoto */
+#if 0
+EXTERN boolean  remove_temporary_at_error;
+EXTERN boolean  recover_archive_when_interrupt;
+EXTERN boolean  remove_extracting_file_when_interrupt;
+#endif
+
+EXTERN int      archive_file_mode;
+EXTERN int      archive_file_gid;
+
+EXTERN struct  interfacing interface;
+EXTERN node            *next;
+/* EXTERN unsigned short crc; */  /* 1996.8.13 t.okamoto */
+
+/* slide.c */
+EXTERN int      unpackable;
+EXTERN unsigned long origsize, compsize;
+EXTERN unsigned short dicbit;
+EXTERN unsigned short maxmatch;
+EXTERN unsigned long count;
+EXTERN unsigned long loc;                      /* short -> long .. Changed N.Watazaki */
+EXTERN unsigned char *text;
+EXTERN int             prev_char;
+
+/* huf.c */
+#ifndef LHA_MAIN_SRC  /* t.okamoto 96/2/20 */
+EXTERN unsigned short left[], right[];
+EXTERN unsigned char c_len[], pt_len[];
+EXTERN unsigned short c_freq[], c_table[], c_code[];
+EXTERN unsigned short p_freq[], pt_table[], pt_code[], t_freq[];
+#endif
+
+/* append.c */
+#ifdef NEED_INCREMENTAL_INDICATOR
+EXTERN long            indicator_count;
+EXTERN long            indicator_threshold;
+#endif
+
+/* crcio.c */
+EXTERN FILE            *infile, *outfile;
+EXTERN unsigned short crc, bitbuf;
+EXTERN int      dispflg;
+EXTERN long            reading_size;
+
+/* from dhuf.c */
+EXTERN unsigned int n_max;
+
+/* lhadd.c */
+EXTERN FILE            *temporary_fp;
+
+/* ------------------------------------------------------------------------ */
+/*     Functions                                                                                                                               */
+/* ------------------------------------------------------------------------ */
+/* from lharc.c */
+extern int             patmatch();
+
+extern void            interrupt();
+
+extern void            message();
+extern void            warning();
+extern void            error();
+extern void            fatal_error();
+
+extern boolean need_file();
+extern int             inquire();
+extern FILE            *xfopen();
+
+extern boolean find_files();
+extern void            free_files();
+
+extern void            init_sp();
+extern void            add_sp();
+extern void            finish_sp();
+extern void            free_sp();
+extern void            cleaning_files();
+
+extern void            build_temporary_name();
+extern void            build_backup_file_name();
+extern void            build_standard_archive_name();
+
+extern FILE            *open_old_archive();
+extern void            init_header();
+extern boolean get_header();
+extern boolean archive_is_msdos_sfx1();
+extern boolean skip_msdos_sfx1_code();
+extern void            write_header();
+extern void            write_archive_tail();
+extern void            copy_old_one();
+extern unsigned char *convdelim();
+extern long            copyfile();
+
+extern void            cmd_list(), cmd_extract(), cmd_add(), cmd_delete();
+
+extern boolean ignore_directory;
+extern boolean compress_method;
+extern boolean verify_mode;
+
+extern char            *extract_directory;
+
+/* from slide.c */
+
+extern int             encode_alloc();
+extern void            encode();
+extern void            decode();
+
+/* from append.c */
+extern void     start_indicator();
+extern void     finish_indicator();
+extern void     finish_indicator2();
+
+/* slide.c */
+extern void     output_st1();
+extern unsigned char *alloc_buf();
+extern void     encode_start_st1();
+extern void     encode_end_st1();
+extern unsigned short decode_c_st1();
+extern unsigned short decode_p_st1();
+extern void     decode_start_st1();
+
+/* from shuf.c */
+extern void     decode_start_st0();
+extern void     encode_p_st0( /* unsigned short j */ );
+extern void     encode_start_fix();
+extern void     decode_start_fix();
+extern unsigned short decode_c_st0();
+extern unsigned short decode_p_st0();
+
+/* from dhuf.c */
+extern void     start_c_dyn();
+extern void     decode_start_dyn();
+extern unsigned short decode_c_dyn();
+extern unsigned short decode_p_dyn();
+extern void     output_dyn( /* int code, unsigned int pos */ );
+extern void     encode_end_dyn();
+
+extern int      decode_lzhuf();
+
+/* from larc.c */
+
+extern unsigned short decode_c_lzs();
+extern unsigned short decode_p_lzs();
+extern unsigned short decode_c_lz5();
+extern unsigned short decode_p_lz5();
+extern void                      decode_start_lzs();
+extern void                      decode_start_lz5();
+
+extern void    make_table(     /* int nchar, uchar bitlen[], int tablebits,
+                                                       ushort table[] */ );
+
+/* from maketree.c */
+/*
+ * void make_code(short n, uchar len[], ushort code[]); short make_tree(short
+ * nparm, ushort freqparm[], uchar lenparm[], ushort codeparam[]);
+ */
+extern void            make_code( /* int n, uchar len[], ushort code[] */ );
+extern short   make_tree( /* int nparm, ushort freqparm[], uchar lenparm[],
+                                                               ushort codeparam[] */ );
+
+/* from crcio.c */
+extern void                            make_crctable();
+extern unsigned short  calccrc( /* uchar *p, uint n */ );
+extern void                            fillbuf( /* uchar n */ );
+extern unsigned short  getbits( /* uchar n */ );
+extern void                            putcode( /* uchar n, ushort x */ );
+extern void                            putbits( /* uchar n, ushort x */ );
+extern int                             fread_crc( /* uchar *p, int n, FILE *f */ );
+extern void                            fwrite_crc( /* uchar *p, int n, FILE *f */ );
+extern void                            init_getbits();
+extern void                            init_putbits();
+extern void                    make_crctable();
+extern unsigned                short calccrc();
+
+/* from lhadd.c */
+extern int             encode_lzhuf();
+extern int      encode_stored_crc();
diff --git a/src/lha_macro.h b/src/lha_macro.h
new file mode 100644 (file)
index 0000000..9f1e301
--- /dev/null
@@ -0,0 +1,403 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX    Archiver Driver     macro define                                                    */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Soruce All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+
+/* Most of System V, define SYSTIME_HAS_NO_TM */
+#ifdef SYSTIME_HAS_NO_TM
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif /* SYSTIME_HAS_NO_TM */
+
+/* ------------------------------------------------------------------------ */
+/*     Directory Access Stuff                                                                                                  */
+/* ------------------------------------------------------------------------ */
+#ifndef NODIRECTORY
+#ifdef SYSV_SYSTEM_DIR
+
+#include <dirent.h>
+
+#define DIRENTRY       struct dirent
+#define NAMLEN(p)      strlen (p->d_name)
+
+#else  /* not SYSV_SYSTEM_DIR */
+
+#ifdef NONSYSTEM_DIR_LIBRARY
+#include "lhdir.h"
+#else
+#include <sys/dir.h>
+#endif /* not NONSYSTEM_DIR_LIBRARY */
+
+#define DIRENTRY               struct direct
+#define NAMLEN(p)              p->d_namlen
+
+#endif /* not SYSV_SYSTEM_DIR */
+#endif  /* NODIRECTORY */
+
+/* ------------------------------------------------------------------------ */
+/*     Other Define                                                                                                                    */
+/* ------------------------------------------------------------------------ */
+/* Not support 'void' */
+#ifdef NOVOID
+#define void
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET               0
+#define SEEK_CUR               1
+#define SEEK_END               2
+#endif /* SEEK_SET
+
+
+/* non-integral functions */
+extern struct tm *localtime();
+extern char    *getenv();
+
+#ifndef _MINIX
+#ifndef __STDC__
+extern char    *malloc();
+extern char    *realloc();
+#endif
+#endif
+
+/* external variables */
+extern int      errno;
+
+#define        FALSE                   0
+#define TRUE                   1
+typedef int                            boolean;
+
+/* used by qsort() for alphabetic-sort */
+#define STRING_COMPARE(a,b)            strcmp((a),(b))
+
+#define FILENAME_LENGTH        1024
+
+/* ------------------------------------------------------------------------ */
+/* YOUR CUSTOMIZIES                                                                                                                    */
+/* ------------------------------------------------------------------------ */
+
+#ifndef ARCHIVENAME_EXTENTION
+#define ARCHIVENAME_EXTENTION  ".lzh"
+#endif
+#ifndef BACKUPNAME_EXTENTION
+#define BACKUPNAME_EXTENTION   ".bak"
+#endif
+#ifndef TMP_FILENAME_TEMPLATE
+#define TMP_FILENAME_TEMPLATE  "/tmp/lhXXXXXX"
+#endif
+
+#define SJC_FIRST_P(c)                 \
+  (((unsigned char)(c) >= 0x80) &&     \
+   (((unsigned char)(c) < 0xa0) ||     \
+    ((unsigned char)(c) >= 0xe0) &&    \
+    ((unsigned char)(c) < 0xfd)))
+#define SJC_SECOND_P(c)                        \
+  (((unsigned char)(c) >= 0x40) &&     \
+   ((unsigned char)(c) < 0xfd) &&      \
+   ((ungigned char)(c) != 0x7f))
+
+#ifdef MULTIBYTE_CHAR
+#define MULTIBYTE_FIRST_P      SJC_FIRST_P
+#define MULTIBYTE_SECOND_P     SJC_SECOND_P
+#endif                         /* MULTIBYTE_CHAR */
+
+/* ------------------------------------------------------------------------ */
+/*     LHa File Definitions                                                                                                    */
+/* ------------------------------------------------------------------------ */
+#ifdef S_IFLNK
+#define GETSTAT lstat
+#else
+#define GETSTAT stat
+#endif
+
+#ifdef LHA_MAIN_SRC
+#define EXTERN
+#else
+#define EXTERN                         extern
+#endif /* LHA_MAIN_SRC */
+
+#define LZHUFF0_METHOD                 "-lh0-"
+#define LZHUFF1_METHOD                 "-lh1-"
+#define LZHUFF2_METHOD                 "-lh2-"
+#define LZHUFF3_METHOD                 "-lh3-"
+#define LZHUFF4_METHOD                 "-lh4-"
+#define LZHUFF5_METHOD                 "-lh5-"
+#define LZHUFF6_METHOD                 "-lh6-"
+#define LARC_METHOD                            "-lzs-"
+#define LARC5_METHOD                   "-lz5-"
+#define LARC4_METHOD                   "-lz4-"
+#define LZHDIRS_METHOD                 "-lhd-"
+
+#define METHOD_TYPE_STRAGE             5
+
+/* Added N.Watazaki ..V */
+#define LZHUFF0_METHOD_NUM             0
+#define LZHUFF1_METHOD_NUM             1
+#define LZHUFF2_METHOD_NUM             2
+#define LZHUFF3_METHOD_NUM             3
+#define LZHUFF4_METHOD_NUM             4
+#define LZHUFF5_METHOD_NUM             5
+#define LZHUFF6_METHOD_NUM             6
+#define LARC_METHOD_NUM                        7
+#define LARC5_METHOD_NUM               8
+#define LARC4_METHOD_NUM               9
+#define LZHDIRS_METHOD_NUM             10
+/* Added N.Watazaki ..^ */
+
+#define I_HEADER_SIZE                  0
+#define I_HEADER_CHECKSUM              1
+#define I_METHOD                               2
+#define I_PACKED_SIZE                  7
+#define I_ORIGINAL_SIZE                        11
+#define I_LAST_MODIFIED_STAMP  15
+#define I_ATTRIBUTE                            19
+#define I_HEADER_LEVEL                 20
+#define I_NAME_LENGTH                  21
+#define I_NAME                                 22
+
+#define I_CRC                                          22      /* + name_length */
+#define I_EXTEND_TYPE                          24      /* + name_length */
+#define I_MINOR_VERSION                                25      /* + name_length */
+#define I_UNIX_LAST_MODIFIED_STAMP     26      /* + name_length */
+#define I_UNIX_MODE                                    30      /* + name_length */
+#define I_UNIX_UID                                     32      /* + name_length */
+#define I_UNIX_GID                                     34      /* + name_length */
+#define I_UNIX_EXTEND_BOTTOM           36      /* + name_length */
+
+#define I_GENERIC_HEADER_BOTTOM                I_EXTEND_TYPE
+
+#define EXTEND_GENERIC                 0
+#define EXTEND_UNIX                            'U'
+#define EXTEND_MSDOS                   'M'
+#define EXTEND_MACOS                   'm'
+#define EXTEND_OS9                             '9'
+#define EXTEND_OS2                             '2'
+#define EXTEND_OS68K                   'K'
+#define EXTEND_OS386                   '3'     /* OS-9000??? */
+#define EXTEND_HUMAN                   'H'
+#define EXTEND_CPM                             'C'
+#define EXTEND_FLEX                            'F'
+#define EXTEND_RUNSER                  'R'
+
+/* this OS type is not official */
+
+#define EXTEND_TOWNSOS                 'T'
+#define EXTEND_XOSK                            'X'
+
+/*---------------------------------------------------------------------------*/
+
+#define GENERIC_ATTRIBUTE                              0x20
+#define GENERIC_DIRECTORY_ATTRIBUTE            0x10
+#define HEADER_LEVEL0                                  0x00
+#define HEADER_LEVEL1                                  0x01
+#define HEADER_LEVEL2                                  0x02
+
+#define CURRENT_UNIX_MINOR_VERSION             0x00
+
+#define DELIM          ('/')
+#define DELIM2         (0xff)
+#define DELIMSTR       "/"
+
+#define OSK_RW_RW_RW                   0000033
+#define OSK_FILE_REGULAR               0000000
+#define OSK_DIRECTORY_PERM             0000200
+#define OSK_SHARED_PERM                        0000100
+#define OSK_OTHER_EXEC_PERM            0000040
+#define OSK_OTHER_WRITE_PERM   0000020
+#define OSK_OTHER_READ_PERM            0000010
+#define OSK_OWNER_EXEC_PERM            0000004
+#define OSK_OWNER_WRITE_PERM   0000002
+#define OSK_OWNER_READ_PERM            0000001
+
+#define UNIX_FILE_TYPEMASK             0170000
+#define UNIX_FILE_REGULAR              0100000
+#define UNIX_FILE_DIRECTORY            0040000
+#define UNIX_FILE_SYMLINK              0120000
+#define UNIX_SETUID                            0004000
+#define UNIX_SETGID                            0002000
+#define UNIX_STYCKYBIT                 0001000
+#define UNIX_OWNER_READ_PERM   0000400
+#define UNIX_OWNER_WRITE_PERM  0000200
+#define UNIX_OWNER_EXEC_PERM   0000100
+#define UNIX_GROUP_READ_PERM   0000040
+#define UNIX_GROUP_WRITE_PERM  0000020
+#define UNIX_GROUP_EXEC_PERM   0000010
+#define UNIX_OTHER_READ_PERM   0000004
+#define UNIX_OTHER_WRITE_PERM  0000002
+#define UNIX_OTHER_EXEC_PERM   0000001
+#define UNIX_RW_RW_RW                  0000666
+
+#define LZHEADER_STRAGE                        4096
+
+#define MAX_INDICATOR_COUNT            64
+
+typedef short                                  node;
+
+/* ------------------------------------------------------------------------ */
+/*     Slide relation                                                                                                                  */
+/* ------------------------------------------------------------------------ */
+#if defined(__STDC__) || defined(AIX)
+
+#include <limits.h>
+
+#else
+
+#ifndef CHAR_BIT
+#define CHAR_BIT  8
+#endif
+
+#ifndef UCHAR_MAX
+#define UCHAR_MAX                              ((1<<(sizeof(unsigned char)*8))-1)
+#endif
+
+#ifndef USHRT_MAX
+#define USHRT_MAX                              ((1<<(sizeof(unsigned short)*8))-1)
+#endif
+
+#ifndef SHRT_MAX
+#define SHRT_MAX                               ((1<<(sizeof(short)*8-1))-1)
+#endif
+
+#ifndef SHRT_MIN
+#define SHRT_MIN                               (SHRT_MAX-USHRT_MAX)
+#endif
+
+#ifndef ULONG_MAX
+#define ULONG_MAX      ((1<<(sizeof(unsigned long)*8))-1)
+#endif
+
+#ifndef LONG_MAX
+#define LONG_MAX       ((1<<(sizeof(long)*8-1))-1)
+#endif
+
+#ifndef LONG_MIN
+#define LONG_MIN       (LONG_MAX-ULONG_MAX)
+#endif
+
+#endif /* not __STDC__ */
+
+/* ------------------------------------------------------------------------ */
+/*     FILE Attribute                                                                                                                  */
+/* ------------------------------------------------------------------------ */
+#define is_directory(statp)            (((statp)->st_mode & S_IFMT) == S_IFDIR)
+#define is_symlink(statp)              (((statp)->st_mode & S_IFMT) == S_IFLNK)
+#define is_regularfile(statp)  (((statp)->st_mode & S_IFMT) == S_IFREG)
+
+#ifdef MSDOS
+#define WRITE_BINARY   "wb"
+#define READ_BINARY            "rb"
+#else
+#define WRITE_BINARY   "w"
+#define READ_BINARY            "r"
+#endif
+
+/* ------------------------------------------------------------------------ */
+/*     Memory and String function                                                                                              */
+/* ------------------------------------------------------------------------ */
+#include <string.h>
+
+#ifdef NOINDEX
+#define index                  strchr
+#define rindex                 strrchr
+#endif /* NOINDEX */
+
+#ifdef NOBSTRING
+#define bcmp(a,b,n)            memcmp ((a),(b),(n))
+#define bzero(d,n)             memset((d),0,(n))
+#define bcopy(s,d,n)   memmove((d),(s),(n))
+#endif /* NOBSTRING */
+
+#ifdef USESTRCASECMP
+#define strucmp(p,q)   strcasecmp((p),(q))
+#endif
+
+/* ------------------------------------------------------------------------ */
+/* Individual macro define                                                                                                     */
+/* ------------------------------------------------------------------------ */
+
+/* from crcio.c */
+#define CRCPOLY                        0xA001          /* CRC-16 */
+#define UPDATE_CRC(c)  crc = crctable[(crc ^ (c)) & 0xFF] ^ (crc >> CHAR_BIT)
+
+/* dhuf.c */
+#define N_CHAR      (256 + 60 - THRESHOLD + 1)
+#define TREESIZE_C  (N_CHAR * 2)
+#define TREESIZE_P  (128 * 2)
+#define TREESIZE    (TREESIZE_C + TREESIZE_P)
+#define ROOT_C      0
+#define ROOT_P      TREESIZE_C
+
+/* header.c */
+#define setup_get(PTR) (get_ptr = (PTR))
+#define get_byte()             (*get_ptr++ & 0xff)
+#define put_ptr                        get_ptr
+#define setup_put(PTR) (put_ptr = (PTR))
+#define put_byte(c)            (*put_ptr++ = (char)(c))
+
+/* huf.c */
+#define NP                     (MAX_DICBIT + 1)
+#define NT                     (USHRT_BIT + 3)
+#if 0
+#define PBIT           4               /* smallest integer such that (1 << PBIT) > * NP */
+#define TBIT           5               /* smallest integer such that (1 << TBIT) > * NT */
+#endif
+
+#define PBIT           5               /* smallest integer such that (1 << PBIT) > * NP */
+#define TBIT           5               /* smallest integer such that (1 << TBIT) > * NT */
+
+#define NC                     (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
+
+/*             #if NT > NP #define NPT NT #else #define NPT NP #endif  */
+#define NPT                    0x80
+
+/* larc.c */
+#define MAGIC0         18
+#define MAGIC5         19
+
+/* lharc.c */
+#define CMD_UNKNOWN    0
+#define CMD_EXTRACT    1
+#define CMD_ADD                2
+#define CMD_LIST       3
+#define CMD_DELETE     4
+
+#define STREQU(a,b)    (((a)[0] == (b)[0]) ? (strcmp ((a),(b)) == 0) : FALSE)
+
+/* shuf.c */
+#define N1                     286                             /* alphabet size */
+#define N2                     (2 * N1 - 1)    /* # of nodes in Huffman tree */
+#define EXTRABITS      8                               /* >= log2(F-THRESHOLD+258-N1) */
+#define BUFBITS                16                              /* >= log2(MAXBUF) */
+#define LENFIELD       4                               /* bit size of length field for tree output */
+
+/* util.c */
+#define BUFFERSIZE     2048
+#define MAXSFXCODE     1024*64
+
+#ifndef NULL
+#define NULL           (char *)0
+#endif
+
+/* slide.c */
+/*
+#define PERCOLATE  1
+#define NIL        0
+#define HASH(p, c) ((p) + ((c) << hash1) + hash2)
+*/
+
+/* slide.c */
+#define MAX_DICBIT                     15      /* lh6 use 15bits */
+#define MAX_DICSIZ                     (1 << MAX_DICBIT)
+#define MATCHBIT                       8       /* bits for MAXMATCH - THRESHOLD */
+#define MAXMATCH                       256     /* formerly F (not more than UCHAR_MAX + 1) */
+#define THRESHOLD                      3       /* choose optimal value */
+
+/* from huf.c */
+
+/* alphabet = {0, 1, 2, ..., NC - 1} */
+#define CBIT                           9       /* $\lfloor \log_2 NC \rfloor + 1$ */
+#define USHRT_BIT                      16      /* (CHAR_BIT * sizeof(ushort)) */
diff --git a/src/lhadd.c b/src/lhadd.c
new file mode 100644 (file)
index 0000000..2608ff1
--- /dev/null
@@ -0,0 +1,630 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             lhadd.c -- LHarc Add Command                                                            */
+/*                                                                                                                                                     */
+/*             Copyright (C) MCMLXXXIX Yooichi.Tagawa                                                          */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Source All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+/* ------------------------------------------------------------------------ */
+static void     remove_files();
+
+static char     new_archive_name_buffer[FILENAME_LENGTH];
+static char    *new_archive_name;
+/* ------------------------------------------------------------------------ */
+static void
+add_one(fp, nafp, hdr)
+       FILE           *fp, *nafp;
+       LzHeader       *hdr;
+{
+       long            header_pos, next_pos, org_pos, data_pos;
+       long            v_original_size, v_packed_size;
+       int             mode;
+
+       reading_filename = hdr->name;
+       writting_filename = temporary_name;
+
+       if (!fp && generic_format)      /* [generic] doesn't need directory
+                                        * info. */
+               return;
+       header_pos = ftell(nafp);
+       write_header(nafp, hdr);/* DUMMY */
+
+       if ((hdr->unix_mode & UNIX_FILE_SYMLINK) == UNIX_FILE_SYMLINK) {
+               char            buf[256], *b1, *b2;
+               if (!quiet) {
+                       strcpy(buf, hdr->name);
+                       b1 = strtok(buf, "|");
+                       b2 = strtok(NULL, "|");
+                       printf("%s -> %s\t- Symbolic Link\n", b1, b2);
+               }               /* if quiet .. */
+       }
+
+       if (hdr->original_size == 0)    /* empty file or directory */
+               return;         /* previous write_header is not DUMMY. (^_^) */
+
+       org_pos = ftell(fp);
+       data_pos = ftell(nafp);
+
+       hdr->crc = encode_lzhuf(fp, nafp, hdr->original_size,
+                 &v_original_size, &v_packed_size, hdr->name, hdr->method);
+
+       if (v_packed_size < v_original_size) {
+               next_pos = ftell(nafp);
+       }
+       else {                  /* retry by stored method */
+               fseek(fp, org_pos, SEEK_SET);
+               fseek(nafp, data_pos, SEEK_SET);
+               hdr->crc = encode_stored_crc(fp, nafp, hdr->original_size,
+                                         &v_original_size, &v_packed_size);
+               fflush(nafp);
+               next_pos = ftell(nafp);
+#ifndef NOFTRUNCATE
+               ftruncate(fileno(nafp), next_pos);
+#endif
+               bcopy(LZHUFF0_METHOD, hdr->method, METHOD_TYPE_STRAGE);
+       }
+       hdr->original_size = v_original_size;
+       hdr->packed_size = v_packed_size;
+       fseek(nafp, header_pos, SEEK_SET);
+       write_header(nafp, hdr);
+       fseek(nafp, next_pos, SEEK_SET);
+}
+
+
+/* ------------------------------------------------------------------------ */
+FILE           *
+append_it(name, oafp, nafp)
+       char           *name;
+       FILE           *oafp, *nafp;
+{
+       LzHeader        ahdr, hdr;
+       FILE           *fp;
+       long            old_header;
+       int             cmp;
+       int             filec;
+       char          **filev;
+       int             i;
+       struct stat     stbuf /*, lstbuf*/;
+
+       boolean         directory, symlink;
+
+       if (GETSTAT(name, &stbuf) < 0) {
+               error("Cannot access", name);   /* See cleaning_files, Why? */
+               return oafp;
+       }
+       
+       directory = is_directory(&stbuf);
+#ifdef S_IFLNK
+       symlink = is_symlink(&stbuf);
+#else
+       symlink = 0;
+#endif
+       init_header(name, &stbuf, &hdr);
+
+       if (!directory && !noexec)
+               if (symlink)
+                       fp = NULL;
+               else
+                       fp = xfopen(name, READ_BINARY);
+       else {
+               fp = NULL;
+       }
+
+       while (oafp) {
+               old_header = ftell(oafp);
+               if (!get_header(oafp, &ahdr)) {
+                       fclose(oafp);
+                       oafp = NULL;
+                       break;
+               } else {
+#if 0                  
+                       cmp = STRING_COMPARE(ahdr.name, hdr.name);
+#endif
+                       /* for symbolic link. t.okamoto */
+                       cmp = strcmp_filename(ahdr.name, hdr.name);
+                       if (cmp < 0) {  /* SKIP */
+                               /* copy old to new */
+                               if (!noexec) {
+                                       fseek(oafp, old_header, SEEK_SET);
+                                       copy_old_one(oafp, nafp, &ahdr);
+                               }
+                               else
+                                       fseek(oafp, ahdr.packed_size, SEEK_CUR);
+                       } else if (cmp == 0) {  /* REPLACE */
+                               /* drop old archive's */
+                               fseek(oafp, ahdr.packed_size, SEEK_CUR);
+                               break;
+                       } else {        /* cmp > 0, INSERT */
+                               fseek(oafp, old_header, SEEK_SET);
+                               break;
+                       }
+               }
+       }
+
+       if (update_if_newer) {
+               if (!oafp ||    /* not in archive */
+                   cmp > 0 ||  /* // */
+                   ahdr.unix_last_modified_stamp <     /* newer than archive's */
+                   hdr.unix_last_modified_stamp) {
+                       if (noexec)
+                               printf("ADD %s\n", name);
+                       else
+                               add_one(fp, nafp, &hdr);
+               } else {                /* cmp == 0 *//* copy old to new */
+                       if (!noexec) {
+                               fseek(oafp, old_header, SEEK_SET);
+                               copy_old_one(oafp, nafp, &ahdr);
+                       }
+               }
+       } else {
+               if (!oafp || cmp > 0) { /* not in archive or dropped */
+                       if (noexec)
+                               printf("ADD %s\n", name);
+                       else
+                               add_one(fp, nafp, &hdr);
+               }
+               else {          /* cmp == 0 */
+                       /* replace */
+                       if (noexec)
+                               printf("REPLACE\n");
+                       else
+                               add_one(fp, nafp, &hdr);
+               }
+       }
+
+       if (!directory) {
+               if (!noexec)
+                       if (!symlink)
+                               fclose(fp);
+       }
+       else {                  /* recurcive call */
+               if (find_files(name, &filec, &filev)) {
+                       for (i = 0; i < filec; i++)
+                               oafp = append_it(filev[i], oafp, nafp);
+                       free_files(filec, filev);
+               }
+       }
+       return oafp;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+find_update_files(oafp)
+       FILE           *oafp;   /* old archive */
+{
+       char            name[FILENAME_LENGTH];
+       struct string_pool sp;
+       LzHeader        hdr;
+       long            pos;
+       struct stat     stbuf;
+       int             len;
+
+       pos = ftell(oafp);
+
+       init_sp(&sp);
+       while (get_header(oafp, &hdr)) {
+               if ((hdr.unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_REGULAR) {
+                       if (stat(hdr.name, &stbuf) >= 0)        /* exist ? */
+                               add_sp(&sp, hdr.name, strlen(hdr.name) + 1);
+               }
+               else if ((hdr.unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_DIRECTORY) {
+                       strcpy(name, hdr.name);
+                       len = strlen(name);
+                       if (len > 0 && name[len - 1] == '/')
+                               name[--len] = '\0';     /* strip tail '/' */
+                       if (stat(name, &stbuf) >= 0)    /* exist ? */
+                               add_sp(&sp, name, len + 1);
+               }
+               fseek(oafp, hdr.packed_size, SEEK_CUR);
+       }
+
+       fseek(oafp, pos, SEEK_SET);
+
+       finish_sp(&sp, &cmd_filec, &cmd_filev);
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+delete(oafp, nafp)
+       FILE           *oafp, *nafp;
+{
+       LzHeader        ahdr;
+       long            old_header_pos;
+       char            lpath[256], *b1, *b2;
+
+       old_header_pos = ftell(oafp);
+       while (get_header(oafp, &ahdr)) {
+               strcpy(lpath, ahdr.name);
+               b1 = strtok(lpath, "|");
+               b2 = strtok(NULL, "|");
+               if (need_file(b1)) {    /* skip */
+                       fseek(oafp, ahdr.packed_size, SEEK_CUR);
+                       if (noexec || !quiet)
+                               if (b2 != NULL)
+                                       printf("delete %s -> %s\n", b1, b2);
+                               else
+                                       printf("delete %s\n", b1);
+               }
+               else {          /* copy */
+                       if (noexec) {
+                               fseek(oafp, ahdr.packed_size, SEEK_CUR);
+                       }
+                       else {
+                               fseek(oafp, old_header_pos, SEEK_SET);
+                               copy_old_one(oafp, nafp, &ahdr);
+                       }
+               }
+               old_header_pos = ftell(oafp);
+       }
+       return;
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+static FILE    *
+build_temporary_file()
+{
+       int             old_umask;
+       FILE           *afp;
+
+       build_temporary_name();
+       signal(SIGINT, interrupt);
+       signal(SIGHUP, interrupt);
+
+       old_umask = umask(077);
+       afp = xfopen(temporary_name, WRITE_BINARY);
+       remove_temporary_at_error = TRUE;
+       temporary_fp = afp;
+       umask(old_umask);
+
+       return afp;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+build_backup_file()
+{
+
+       build_backup_name(backup_archive_name, archive_name);
+       if (!noexec) {
+               signal(SIGINT, SIG_IGN);
+               signal(SIGHUP, SIG_IGN);
+               if (rename(archive_name, backup_archive_name) < 0)
+                       fatal_error(archive_name);
+               recover_archive_when_interrupt = TRUE;
+               signal(SIGINT, interrupt);
+               signal(SIGHUP, interrupt);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+report_archive_name_if_different()
+{
+       if (!quiet && new_archive_name == new_archive_name_buffer) {
+               /* warning at old archive is SFX */
+               printf("New archive file is \"%s\"\n", new_archive_name);
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+#ifdef TMP_FILENAME_TEMPLATE
+void
+temporary_to_new_archive_file(new_archive_size)
+       long            new_archive_size;
+{
+       FILE           *oafp, *nafp;
+
+       oafp = xfopen(temporary_name, READ_BINARY);
+       if (!strcmp(new_archive_name, "-")) {
+               nafp = stdout;
+               writting_filename = "starndard output";
+       }
+       else {
+               nafp = xfopen(new_archive_name, WRITE_BINARY);
+               writting_filename = archive_name;
+       }
+       reading_filename = temporary_name;
+       copyfile(oafp, nafp, new_archive_size, 0);
+       if (nafp != stdout)
+               fclose(nafp);
+       fclose(oafp);
+
+       recover_archive_when_interrupt = FALSE;
+       unlink(temporary_name);
+
+       remove_temporary_at_error = FALSE;
+}
+#else
+temporary_to_new_archive_file(new_archive_size)
+       long            new_archive_size;
+{
+       char           *p;
+       p = (char *) rindex(new_archive_name, '/');
+       p = p ? p + 1 : new_archive_name;
+       unlink(new_archive_name);
+       if (rename(temporary_name, p) < 0) {
+               fprintf(stderr, "Can't rename temporary_name '%s'\n", new_archive_name);
+               exit(1);
+       }
+}
+#endif
+
+/* ------------------------------------------------------------------------ */
+static void
+set_archive_file_mode()
+{
+       int             umask_value;
+       struct stat     stbuf;
+
+       if (archive_file_gid < 0) {
+               umask(umask_value = umask(0));
+               archive_file_mode = (~umask_value) & 0666;      /* rw-rw-rw- */
+               if (stat(".", &stbuf) >= 0)
+                       archive_file_gid = stbuf.st_gid;
+       }
+       if (archive_file_gid >= 0)
+               chown(new_archive_name, getuid(), archive_file_gid);
+
+       chmod(new_archive_name, archive_file_mode);
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                     REMOVE FILE/DIRECTORY                                                   */
+/* ------------------------------------------------------------------------ */
+static void
+remove_one(name)
+       char           *name;
+{
+       struct stat     stbuf;
+       int             filec;
+       char          **filev;
+
+       if (GETSTAT(name, &stbuf) < 0) {
+               warning("Cannot access", name);
+       }
+       else if (is_directory(&stbuf)) {
+               if (find_files(name, &filec, &filev)) {
+                       remove_files(filec, filev);
+                       free_files(filec, filev);
+               }
+               else
+                       warning("Cannot open directory", name);
+
+               if (noexec)
+                       printf("REMOVE DIRECTORY %s\n", name);
+               else if (rmdir(name) < 0)
+                       warning("Cannot remove directory", name);
+               else if (verbose)
+                       printf("Removed %s.\n", name);
+       }
+       else if (is_regularfile(&stbuf)) {
+               if (noexec)
+                       printf("REMOVE FILE %s.\n", name);
+               else if (unlink(name) < 0)
+                       warning("Cannot remove", name);
+               else if (verbose)
+                       printf("Removed %s.\n", name);
+       }
+#ifdef S_IFLNK
+       else if (is_symlink(&stbuf)) {
+               if (noexec)
+                       printf("REMOVE SYMBOLIC LINK %s.\n", name);
+               else if (unlink(name) < 0)
+                       warning("Cannot remove", name);
+               else if (verbose)
+                       printf("Removed %s.\n", name);
+       }
+#endif
+       else {
+               error("Cannot remove (not a file or directory)", name);
+       }
+}
+
+static void
+remove_files(filec, filev)
+       int             filec;
+       char          **filev;
+{
+       int             i;
+
+       for (i = 0; i < filec; i++)
+               remove_one(filev[i]);
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+void
+cmd_add()
+{
+       LzHeader        ahdr;
+       FILE           *oafp, *nafp;
+       int             i;
+       long            old_header;
+       boolean         old_archive_exist;
+       long            new_archive_size;
+
+       /* exit if no operation */
+       if (!update_if_newer && cmd_filec == 0) {
+               error("No files given in argument, do nothing.", "");
+               return;
+       }
+
+       /* open old archive if exist */
+       if ((oafp = open_old_archive()) == NULL)
+               old_archive_exist = FALSE;
+       else
+               old_archive_exist = TRUE;
+
+       if (update_if_newer && cmd_filec == 0 && !oafp)
+               fatal_error(archive_name);      /* exit if cannot execute
+                                                * automatic update */
+       errno = 0;
+
+       if (new_archive && old_archive_exist) {
+               fclose(oafp);
+               oafp = NULL;
+       }
+
+       if (oafp && archive_is_msdos_sfx1(archive_name)) {
+               skip_msdos_sfx1_code(oafp);
+               build_standard_archive_name(new_archive_name_buffer, archive_name);
+               new_archive_name = new_archive_name_buffer;
+       }
+       else {
+               new_archive_name = archive_name;
+       }
+
+       /* build temporary file */
+       if (!noexec)
+               nafp = build_temporary_file();
+
+       /* find needed files when automatic update */
+       if (update_if_newer && cmd_filec == 0)
+               find_update_files(oafp);
+
+       /* build new archive file */
+       /* cleaning arguments */
+       cleaning_files(&cmd_filec, &cmd_filev);
+       if (cmd_filec == 0) {
+               if (oafp)
+                       fclose(oafp);
+               if (!noexec)
+                       fclose(nafp);
+               return;
+       }
+
+       for (i = 0; i < cmd_filec; i++)
+               oafp = append_it(cmd_filev[i], oafp, nafp);
+       if (oafp) {
+               old_header = ftell(oafp);
+               while (get_header(oafp, &ahdr)) {
+                       if (noexec)
+                               fseek(oafp, ahdr.packed_size, SEEK_CUR);
+                       else {
+                               fseek(oafp, old_header, SEEK_SET);
+                               copy_old_one(oafp, nafp, &ahdr);
+                       }
+                       old_header = ftell(oafp);
+               }
+               fclose(oafp);
+       }
+       if (!noexec) {
+               write_archive_tail(nafp);
+               new_archive_size = ftell(nafp);
+               fclose(nafp);
+       }
+
+       /* build backup archive file */
+       if (old_archive_exist)
+               build_backup_file();
+
+       report_archive_name_if_different();
+
+       /* copy temporary file to new archive file */
+       if (!noexec && (!strcmp(new_archive_name, "-") ||
+                       rename(temporary_name, new_archive_name) < 0))
+               temporary_to_new_archive_file(new_archive_size);
+
+       /* set new archive file mode/group */
+       set_archive_file_mode();
+
+       /* remove archived files */
+       if (delete_after_append)
+               remove_files(cmd_filec, cmd_filev);
+
+       return;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+cmd_delete()
+{
+       FILE           *oafp, *nafp;
+       long            new_archive_size;
+
+       /* open old archive if exist */
+       if ((oafp = open_old_archive()) == NULL)
+               fatal_error(archive_name);
+       errno = 0;
+
+       /* exit if no operation */
+       if (cmd_filec == 0) {
+               fclose(oafp);
+               warning("No files given in argument, do nothing.", "");
+               return;
+       }
+
+       if (archive_is_msdos_sfx1(archive_name)) {
+               skip_msdos_sfx1_code(oafp);
+               build_standard_archive_name(new_archive_name_buffer, archive_name);
+               new_archive_name = new_archive_name_buffer;
+       }
+       else {
+               new_archive_name = archive_name;
+       }
+
+       /* build temporary file */
+       if (!noexec)
+               nafp = build_temporary_file();
+
+       /* build new archive file */
+       delete(oafp, nafp);
+       fclose(oafp);
+
+       if (!noexec) {
+               write_archive_tail(nafp);
+               new_archive_size = ftell(nafp);
+               fclose(nafp);
+       }
+
+       /* build backup archive file */
+       build_backup_file();
+
+       /* 1999.5.24 t.oka */
+       if(!noexec && new_archive_size <= 1){
+               unlink(temporary_name);
+               printf("New archive file \"%s\" is not created because it would be empty.\n", new_archive_name);
+               return;
+       }
+
+       report_archive_name_if_different();
+
+       /* copy temporary file to new archive file */
+       if (!noexec && rename(temporary_name, new_archive_name) < 0)
+               temporary_to_new_archive_file(new_archive_size);
+
+       /* set new archive file mode/group */
+       set_archive_file_mode();
+
+       return;
+}
+
+/* for symbolic link name. t.okamoto 96/2/20 */
+int strcmp_filename( str1, str2 )
+char *str1;
+char *str2;
+{
+       char *p, *q;
+
+       p = str1; q = str2;
+       
+       while (*p != 0 && *q != 0) {
+               if (*p == '|') {
+                       if (*q == 0) return 0;
+                       else return -1;
+               } else if (*q == '|') {
+                       if (*p == 0) return 0;
+                       else return 1;
+               } else if (*p != *q) break;
+               p++; q++;
+       }
+       return (int)*p-(int)*q;
+}
+
+               
diff --git a/src/lharc.c b/src/lharc.c
new file mode 100644 (file)
index 0000000..1181592
--- /dev/null
@@ -0,0 +1,1087 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             lharc.c -- append to archive                                                            */
+/*                                                                                                                                                     */
+/*             Copyright (C) MCMLXXXIX Yooichi.Tagawa                                                          */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                     Thanks to H.Yoshizaki. (MS-DOS LHarc)                   */
+/*                                                                                                                                                     */
+/*  Ver. 0.00  Original                                                        1988.05.23  Y.Tagawa            */
+/*  Ver. 0.01  Alpha Version (for 4.2BSD)              1989.05.28  Y.Tagawa            */
+/*  Ver. 0.02  Alpha Version Rel.2                             1989.05.29  Y.Tagawa            */
+/*  Ver. 0.03  Release #3  Beta Version                        1989.07.02  Y.Tagawa            */
+/*  Ver. 0.03a Debug                                                   1989.07.03  Y.Tagawa            */
+/*  Ver. 0.03b Modified                                                        1989.07.13  Y.Tagawa            */
+/*  Ver. 0.03c Debug (Thanks to void@rena.dit.junet)                                           */
+/*                                                                                             1989.08.09  Y.Tagawa            */
+/*  Ver. 0.03d Modified (quiet and verbose)            1989.09.14  Y.Tagawa            */
+/*  V1.00  Fixed                                                               1989.09.22  Y.Tagawa            */
+/*  V1.01  Bug Fixed                                                   1989.12.25  Y.Tagawa            */
+/*                                                                                                                                                     */
+/*  DOS-Version Original LHx V C2.01           (C) H.Yohizaki                                  */
+/*                                                                                                                                                     */
+/*  V2.00  UNIX Lharc + DOS LHx -> OSK LHx             1990.11.01  Momozou                     */
+/*  V2.01  Minor Modified                                              1990.11.24  Momozou                     */
+/*                                                                                                                                                     */
+/*  Ver. 0.02  LHx for UNIX                                            1991.11.18  M.Oki                       */
+/*  Ver. 0.03  LHa for UNIX                                            1991.12.17  M.Oki                       */
+/*  Ver. 0.04  LHa for UNIX    beta version            1992.01.20  M.Oki                       */
+/*  Ver. 1.00  LHa for UNIX    Fixed                           1992.03.19  M.Oki                       */
+/*                                                                                                                                                     */
+/*  Ver. 1.10  for Symblic Link                                        1993.06.25  N.Watazaki          */
+/*  Ver. 1.11  for Symblic Link        Bug Fixed               1993.08.18  N.Watazaki          */
+/*  Ver. 1.12  for File Date Check                             1993.10.28  N.Watazaki          */
+/*  Ver. 1.13  Bug Fixed (Idicator calcurate)  1994.02.21  N.Watazaki          */
+/*  Ver. 1.13a Bug Fixed (Sym. Link delete)            1994.03.11  N.Watazaki          */
+/*     Ver. 1.13b Bug Fixed (Sym. Link delete)         1994.07.29  N.Watazaki          */
+/*     Ver. 1.14  Source All chagned                           1995.01.14      N.Watazaki              */
+/*     Ver. 1.14b,c  Bug Fixed                     1996.03.07  t.okamoto               */
+/*  Ver. 1.14d Version up                       1997.01.12  t.okamoto       */
+/*  Ver. 1.14f Bug Fixed                        1999.07.19  t.okamoto       */
+/* ------------------------------------------------------------------------ */
+#define LHA_MAIN_SRC
+
+#include "lha.h"
+
+/* ------------------------------------------------------------------------ */
+/*                                                             PROGRAM                                                                         */
+/* ------------------------------------------------------------------------ */
+static int      cmd = CMD_UNKNOWN;
+
+/* 1996.8.13 t.okamoto */
+#if 0
+char          **cmd_filev;
+int             cmd_filec;
+
+char           *archive_name;
+char            expanded_archive_name[FILENAME_LENGTH];
+char            temporary_name[FILENAME_LENGTH];
+char            backup_archive_name[FILENAME_LENGTH];
+#endif
+
+/* static functions */
+static void     sort_files();
+
+char               *extract_directory = NULL;
+char             **xfilev;
+int             xfilec = 257;
+
+/* 1996.8.13 t.okamoto */
+#if 0
+char           *writting_filename;
+char           *reading_filename;
+
+int             archive_file_mode;
+int             archive_file_gid;
+#endif
+/* ------------------------------------------------------------------------ */
+static void
+init_variable()                /* Added N.Watazaki */
+{
+/* options */
+       quiet                   = FALSE;
+       text_mode               = FALSE;
+       verbose                 = FALSE;
+       noexec                  = FALSE;        /* debugging option */
+       force                   = FALSE;
+       prof                    = FALSE;
+#ifndef SUPPORT_LH6
+       compress_method = LZHUFF5_METHOD_NUM;
+#endif
+#ifdef SUPPORT_LH6
+       compress_method = LZHUFF6_METHOD_NUM;
+#endif
+       header_level    = HEADER_LEVEL1;
+       quiet_mode              = 0;
+
+#ifdef EUC
+       euc_mode                = FALSE;
+#endif
+
+/* view command flags */
+       verbose_listing = FALSE;
+
+/* extract command flags */
+       output_to_stdout = FALSE;
+
+/* append command flags */
+       new_archive                     = FALSE;
+       update_if_newer         = FALSE;
+       delete_after_append = FALSE;
+       generic_format          = FALSE;
+
+       remove_temporary_at_error                               = FALSE;
+       recover_archive_when_interrupt                  = FALSE;
+       remove_extracting_file_when_interrupt   = FALSE;
+       get_filename_from_stdin                                 = FALSE;
+       ignore_directory                                                = FALSE;
+       verify_mode                                                             = FALSE;
+
+       extract_directory = NULL;
+       xfilec = 257;
+}
+
+/* ------------------------------------------------------------------------ */
+/* NOTES :                     Text File Format                                                                                */
+/* GENERATOR           NewLine                                                                                                 */
+/* [generic]           0D 0A                                                                                                   */
+/* [MS-DOS]                    0D 0A                                                                                                   */
+/* [OS9][MacOS]                0D                                                                                                              */
+/* [UNIX]                      0A                                                                                                              */
+/* ------------------------------------------------------------------------ */
+static void
+print_tiny_usage_and_exit()
+{
+       fprintf(stderr, "\
+LHarc    for UNIX  V 1.02  Copyright(C) 1989  Y.Tagawa\n\
+LHx      for MSDOS V C2.01 Copyright(C) 1990  H.Yoshizaki\n\
+LHx(arc) for OSK   V 2.01  Modified     1990  Momozou\n\
+LHa      for UNIX  V 1.00  Copyright(C) 1992  Masaru Oki\n\
+LHa      for UNIX  V 1.14  Modified     1995  Nobutaka Watazaki\n\
+LHa      for UNIX  V 1.14f Modified     1999  Tsugio Okamoto\n\
+");
+       fprintf(stderr, "\
+usage: lha [-]{axelvudmcp[q[num]][vnfodizg012]}[w=<dir>] archive_file [file...]\n\
+commands:                           options:\n\
+ a   Add(or replace) to archive      q{num} quiet (num:quiet mode)\n\
+ x,e EXtract from archive            v  verbose\n\
+ l,v List / Verbose List             n  not execute\n\
+ u   Update newer files to archive   f  force (over write at extract)\n\
+ d   Delete from archive             t  FILES are TEXT file\n");
+#ifdef SUPPORT_LH6
+       fprintf(stderr, "\
+ m   Move to archive (means 'ad')    o[56] compression method (a/u)\n\
+");
+#endif
+#ifndef SUPPORT_LH6
+       fprintf(stderr, "\
+ m   Move to archive (means 'ad')    o  use LHarc compatible method (a/u)\n\
+");
+#endif
+       fprintf(stderr, "\
+ c   re-Construct new archive        w=<dir> specify extract directory (a/u/m/x/e)\n\
+ p   Print to STDOUT from archive    d  delete FILES after (a/u/c)\n\
+ t   Test file CRC in archive        i  ignore directory path (x/e)\n\
+                                     z  files not compress (a/u)\n\
+                                     g  [Generic] format (for compatibility)\n\
+                                     0/1/2 header level (a/u)\n\
+");
+#ifdef EUC
+       fprintf(stderr, "\
+                                     e  TEXT code convert from/to EUC\n\
+");
+#endif
+       exit(1);
+}
+
+/* ------------------------------------------------------------------------ */
+int
+main(argc, argv)
+       int             argc;
+       char           *argv[];
+{
+       char           *p, inpbuf[256];
+
+       int i;
+       int  ac;
+       char **av, *m;
+
+       init_variable();                /* Added N.Watazaki */
+
+       ac = argc;
+       av = (char **)malloc( sizeof(char*)*argc );
+       if (av == NULL) fatal_error("not enough memory\n");
+       for (i=0; i<argc; i++) {
+         if ((av[i] = strdup( argv[i] )) == NULL)
+               fatal_error("not enough memory\n");
+       }
+
+       if (ac < 2)
+               print_tiny_usage_and_exit();
+       if (ac < 3) {
+               cmd = CMD_LIST;
+               av--; /* argv--; */ /* 1999.7.18 */
+               ac++; /* argc++; */
+               goto work;
+       }
+
+       m = av[1];
+
+       if (m[0] == '-')
+               m++;
+       /* commands */
+       switch (*m) {
+       case 'x':
+       case 'e':
+               cmd = CMD_EXTRACT;
+               break;
+
+       case 'p':
+               output_to_stdout = TRUE;
+               cmd = CMD_EXTRACT;
+               break;
+
+       case 'c':
+               new_archive = TRUE;
+               cmd = CMD_ADD;
+               break;
+
+       case 'a':
+               cmd = CMD_ADD;
+               break;
+
+       case 'd':
+               cmd = CMD_DELETE;
+               break;
+
+       case 'u':
+               update_if_newer = TRUE;
+               cmd = CMD_ADD;
+               break;
+
+       case 'm':
+               delete_after_append = TRUE;
+               cmd = CMD_ADD;
+               break;
+
+       case 'v':
+               verbose_listing = TRUE;
+               cmd = CMD_LIST;
+               break;
+
+       case 'l':
+               cmd = CMD_LIST;
+               break;
+
+       case 't':
+               cmd = CMD_EXTRACT;
+               verify_mode = TRUE;
+               break;
+
+       default:
+               print_tiny_usage_and_exit();
+
+       }
+
+       /* options */
+       /* p = &argv[1][1]; */
+       p = m+1;
+       while ( *p != 0 ) {
+               switch ((*p++)) {
+               case 'q':
+                       switch (*p) {
+                       case '0':
+                       case '1':
+                               quiet_mode = *p - '0';
+                               ++p;
+                               break;
+                       case '2':
+                       default:
+                               quiet = TRUE;
+                               break;
+                       }
+               case 'f':
+                       force = TRUE;
+                       break;
+               case 'p':
+                       prof = TRUE;
+                       break;
+               case 'v':
+                       verbose = TRUE;
+                       break;
+               case 't':
+                       text_mode = TRUE;
+                       break;
+#ifdef EUC
+               case 'e':
+                       text_mode = TRUE;
+                       euc_mode = TRUE;
+                       break;
+#endif
+               case 'n':
+                       noexec = TRUE;
+                       break;
+               case 'g':
+                       generic_format = TRUE;
+                       header_level = 0;
+                       break;
+               case 'd':
+                       delete_after_append = TRUE;
+                       break;
+               case 'o':
+                       switch (*p) {
+                       case 0:
+                compress_method = LZHUFF1_METHOD_NUM;
+                header_level = 0;
+                break;
+                       case '5':
+                compress_method = LZHUFF5_METHOD_NUM;
+                p++;
+                break;
+#ifdef SUPPORT_LH6
+                       case '6':
+                compress_method = LZHUFF6_METHOD_NUM;
+                p++;
+                break;
+#endif
+                       default:
+                fprintf(stderr, "LHa: error option o%c\n", p[-1]);
+                exit(1);
+                       }
+               break;
+               case 'z':
+                       compress_method = LZHUFF0_METHOD_NUM;   /* Changed N.Watazaki */
+                       break;
+               case 'i':
+                       ignore_directory = TRUE;
+                       break;
+               case 'w':
+                       if (*p == '=')
+                               p++;
+                       extract_directory = p;
+                       while (*p)
+                               p++;
+                       break;
+               case '0':
+                       header_level = HEADER_LEVEL0;
+                       break;
+               case '1':
+                       header_level = HEADER_LEVEL1;
+                       break;
+               case '2':
+                       header_level = HEADER_LEVEL2;
+                       break;
+               default:
+                       fprintf(stderr, "LHa: Unknown option '%c'.\n", p[-1]);
+                       exit(1);
+               }
+       }
+
+work:
+       /* archive file name */
+       archive_name = av[2];
+
+       if (!strcmp(archive_name, "-")) {
+               if (!isatty(1) && cmd == CMD_ADD)
+                       quiet = TRUE;
+       }
+       else {
+               if (ac == 3 && !isatty(0)) { /* 1999.7.18 */
+                       get_filename_from_stdin = TRUE;
+               }
+       }
+
+       /* target file name */
+       if (get_filename_from_stdin) {
+               cmd_filec = 0;
+               if ((xfilev = (char **) malloc(sizeof(char *) * xfilec)) == NULL)
+                       fatal_error("Virtual memory exhausted\n");
+               while (fgets(inpbuf, sizeof(inpbuf), stdin)) {
+                   /* delete \n if it exist */
+            i=0; p=inpbuf;
+                       while (i < sizeof(inpbuf) && p != 0) {
+                           if (*p == '\n') {
+                                   *p = 0;
+                                       break;
+                               }
+                               p++; i++;
+                       }
+
+                       if (cmd_filec >= xfilec) {
+                               xfilec += 256;
+                               cmd_filev = (char **) realloc(xfilev,
+                                                  sizeof(char *) * xfilec);
+                               if (cmd_filev == NULL)
+                                       fatal_error("Virtual memory exhausted\n");
+                               xfilev = cmd_filev;
+                       }
+                       if (strlen(inpbuf) < 1)
+                               continue;
+                       if ((xfilev[cmd_filec++] = (char *) strdup(inpbuf)) == NULL)
+                               fatal_error("Virtual memory exhausted\n");
+               }
+               xfilev[cmd_filec] = NULL;
+               cmd_filev = xfilev;
+       } else {
+               cmd_filec = ac - 3;
+               cmd_filev = av + 3;
+       }
+       sort_files();
+
+       /* make crc table */
+       make_crctable();
+
+       switch (cmd) {
+       case CMD_EXTRACT:
+               cmd_extract();
+               break;
+       case CMD_ADD:
+               cmd_add();
+               break;
+       case CMD_LIST:
+               cmd_list();
+               break;
+       case CMD_DELETE:
+               cmd_delete();
+               break;
+       }
+
+#ifdef USE_PROF
+       if (!prof)
+               exit(0);
+#endif
+
+       return 0;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+message_1(title, subject, name)
+       char           *title, *subject, *name;
+{
+       fprintf(stderr, "LHa: %s%s ", title, subject);
+       fflush(stderr);
+
+       if (errno == 0)
+               fprintf(stderr, "%s\n", name);
+       else
+               perror(name);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+message(subject, name)
+       char           *subject, *name;
+{
+       message_1("", subject, name);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+warning(subject, name)
+       char           *subject, *name;
+{
+       message_1("Warning: ", subject, name);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+error(subject, msg)
+       char           *subject, *msg;
+{
+       message_1("Error: ", subject, msg);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+fatal_error(msg)
+       char           *msg;
+{
+       message_1("Fatal error:", "", msg);
+
+       if (remove_temporary_at_error)
+               unlink(temporary_name);
+
+       exit(1);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+write_error()
+{
+       fatal_error(writting_filename);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+read_error()
+{
+       fatal_error(reading_filename);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+interrupt(signo)
+       int             signo;
+{
+       errno = 0;
+       message("Interrupted\n", "");
+
+       if (temporary_fp)
+               fclose(temporary_fp);
+       unlink(temporary_name);
+       if (recover_archive_when_interrupt)
+               rename(backup_archive_name, archive_name);
+       if (remove_extracting_file_when_interrupt) {
+               errno = 0;
+               message("Removing", writting_filename);
+               unlink(writting_filename);
+       }
+       signal(SIGINT, SIG_DFL);
+       signal(SIGHUP, SIG_DFL);
+       kill(getpid(), signo);
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+static int
+sort_by_ascii(a, b)
+       char          **a, **b;
+{
+       register char  *p, *q;
+       register int    c1, c2;
+
+       p = *a, q = *b;
+       if (generic_format) {
+               do {
+                       c1 = *(unsigned char *) p++;
+                       c2 = *(unsigned char *) q++;
+                       if (!c1 || !c2)
+                               break;
+                       if (islower(c1))
+                               c1 = toupper(c1);
+                       if (islower(c2))
+                               c2 = toupper(c2);
+               }
+               while (c1 == c2);
+               return c1 - c2;
+       }
+       else {
+               while (*p == *q && *p != '\0')
+                       p++, q++;
+               return *(unsigned char *) p - *(unsigned char *) q;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+sort_files()
+{
+       if (cmd_filec > 1)
+               qsort(cmd_filev, cmd_filec, sizeof(char *), sort_by_ascii);
+}
+
+/* ------------------------------------------------------------------------ */
+char           *
+xmalloc(size)
+       int             size;
+{
+       char           *p = (char *) malloc(size);
+       if (!p)
+               fatal_error("Not enough memory");
+       return p;
+}
+
+/* ------------------------------------------------------------------------ */
+char           *
+xrealloc(old, size)
+       char           *old;
+       int             size;
+{
+       char           *p = (char *) realloc(old, size);
+       if (!p)
+               fatal_error("Not enough memory");
+       return p;
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                             STRING POOL                                                                     */
+/* ------------------------------------------------------------------------ */
+/*
+  string pool :
+       +-------------+-------------+------+-------------+----------+
+       | N A M E 1 \0| N A M E 2 \0| .... | N A M E n \0|                      |
+       +-------------+-------------+------+-------------+----------+
+         ^ ^            ^ buffer+0 buffer+used buffer+size
+
+  vector :
+       +---------------+---------------+------------- -----------------+
+       | pointer to    | pointer to    | pointer to   ...  pointer to  |
+       |  stringpool   |  N A M E 1    |  N A M E 2   ...   N A M E n  |
+       +---------------+---------------+-------------     -------------+
+       ^ malloc base      returned
+*/
+
+/* ------------------------------------------------------------------------ */
+void
+init_sp(sp)
+       struct string_pool *sp;
+{
+       sp->size = 1024 - 8;    /* any ( >=0 ) */
+       sp->used = 0;
+       sp->n = 0;
+       sp->buffer = (char *) xmalloc(sp->size * sizeof(char));
+}
+
+/* ------------------------------------------------------------------------ */
+void
+add_sp(sp, name, len)
+       struct string_pool *sp;
+       char           *name;   /* stored '\0' at tail */
+       int             len;    /* include '\0' */
+{
+       while (sp->used + len > sp->size) {
+               sp->size *= 2;
+               sp->buffer = (char *) xrealloc(sp->buffer, sp->size * sizeof(char));
+       }
+       bcopy(name, sp->buffer + sp->used, len);
+       sp->used += len;
+       sp->n++;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+finish_sp(sp, v_count, v_vector)
+       register struct string_pool *sp;
+       int            *v_count;
+       char         ***v_vector;
+{
+       int             i;
+       register char  *p;
+       char          **v;
+
+       v = (char **) xmalloc((sp->n + 1) * sizeof(char *));
+       *v++ = sp->buffer;
+       *v_vector = v;
+       *v_count = sp->n;
+       p = sp->buffer;
+       for (i = sp->n; i; i--) {
+               *v++ = p;
+               if (i - 1)
+                       p += strlen(p) + 1;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+void
+free_sp(vector)
+       char          **vector;
+{
+       vector--;
+       free(*vector);          /* free string pool */
+       free(vector);
+}
+
+
+/* ------------------------------------------------------------------------ */
+/*                                                     READ DIRECTORY FILES                                                    */
+/* ------------------------------------------------------------------------ */
+static          boolean
+include_path_p(path, name)
+       char           *path, *name;
+{
+       char           *n = name;
+       while (*path)
+               if (*path++ != *n++)
+                       return (path[-1] == '/' && *n == '\0');
+       return (*n == '/' || (n != name && path[-1] == '/' && n[-1] == '/'));
+}
+
+/* ------------------------------------------------------------------------ */
+void
+cleaning_files(v_filec, v_filev)
+       int            *v_filec;
+       char         ***v_filev;
+{
+       char           *flags;
+       struct stat     stbuf;
+
+       register char **filev = *v_filev;
+       register int    filec = *v_filec;
+       register char  *p;
+       register int    i, j;
+
+       if (filec == 0)
+               return;
+
+       flags = xmalloc(filec * sizeof(char));
+
+       /* flags & 0x01 :       1: ignore */
+       /* flags & 0x02 :       1: directory, 0 : regular file */
+       /* flags & 0x04 :       1: need delete */
+
+       
+       for (i = 0; i < filec; i++)
+               if (GETSTAT(filev[i], &stbuf) < 0) {
+                       flags[i] = 0x04;
+                       fprintf(stderr,
+                        "LHa: Cannot access \"%s\", ignored.\n", filev[i]);
+               }
+               else {
+                       if (is_regularfile(&stbuf))
+                               flags[i] = 0x00;
+                       else if (is_directory(&stbuf))
+                               flags[i] = 0x02;
+#ifdef S_IFLNK
+                       else if (is_symlink(&stbuf)) /* t.okamoto */
+                               flags[i] = 0x00;
+#endif                 
+                       else {
+                               flags[i] = 0x04;
+                               fprintf(stderr,
+                                       "LHa: Cannot archive \"%s\", ignored.\n", filev[i]);
+                       }
+               }
+       errno = 0;
+
+       for (i = 0; i < filec; i++) {
+               p = filev[i];
+               if ((flags[i] & 0x07) == 0x00) {        /* regular file, not
+                                                        * deleted/ignored */
+                       for (j = i + 1; j < filec; j++) {
+                               if ((flags[j] & 0x07) == 0x00) {        /* regular file, not
+                                                                        * deleted/ignored */
+                                       if (STREQU(p, filev[j]))
+                                               flags[j] = 0x04;        /* delete */
+                               }
+                       }
+               }
+               else if ((flags[i] & 0x07) == 0x02) {   /* directory, not
+                                                        * deleted/ignored */
+                       for (j = i + 1; j < filec; j++) {
+                               if ((flags[j] & 0x07) == 0x00) {        /* regular file, not
+                                                                        * deleted/ignored */
+                                       if (include_path_p(p, filev[j]))
+                                               flags[j] = 0x04;        /* delete */
+                               }
+                               else if ((flags[j] & 0x07) == 0x02) {   /* directory, not
+                                                                        * deleted/ignored */
+                                       if (include_path_p(p, filev[j]))
+                                               flags[j] = 0x04;        /* delete */
+                               }
+                       }
+               }
+       }
+
+       for (i = j = 0; i < filec; i++) {
+               if ((flags[i] & 0x04) == 0) {
+                       if (i != j)
+                               filev[j] = filev[i];
+                       j++;
+               }
+       }
+       *v_filec = j;
+
+       free(flags);
+}
+
+/* ------------------------------------------------------------------------ */
+#ifdef NODIRECTORY
+/* please need your imprementation */
+boolean
+find_files(name, v_filec, v_filev)
+       char           *name;
+       int            *v_filec;
+       char         ***v_filev;
+{
+       return FALSE;           /* DUMMY */
+}
+
+/* ------------------------------------------------------------------------ */
+void
+free_files(filec, filev)
+       int             filec;
+       char          **filev;
+{
+       /* do nothing */
+}
+/* ------------------------------------------------------------------------ */
+#else
+boolean
+find_files(name, v_filec, v_filev)
+       char           *name;
+       int            *v_filec;
+       char         ***v_filev;
+{
+       struct string_pool sp;
+       char            newname[FILENAME_LENGTH];
+       int             len, n;
+       DIR            *dirp;
+       DIRENTRY       *dp;
+       struct stat     tmp_stbuf, arc_stbuf, fil_stbuf;
+
+       strcpy(newname, name);
+       len = strlen(name);
+       if (len > 0 && newname[len - 1] != '/')
+               newname[len++] = '/';
+
+       dirp = opendir(name);
+       if (!dirp)
+               return FALSE;
+
+       init_sp(&sp);
+
+       GETSTAT(temporary_name, &tmp_stbuf);
+       GETSTAT(archive_name, &arc_stbuf);
+
+       for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
+               n = NAMLEN(dp);
+               strncpy(newname + len, dp->d_name, n);
+               newname[len + n] = '\0';
+               if (GETSTAT(newname, &fil_stbuf) < 0)
+                       continue;
+#ifdef NO_INODE
+               if ( dp->d_name[0] != '.' ||
+                       (n != 1 &&
+                        (dp->d_name[1] != '.' ||
+                         n != 2))  ) {
+                       add_sp(&sp, newname, len+n+1);
+               }
+#else          
+               if ((dp->d_ino != 0) &&
+               /* exclude '.' and '..' */
+                   ((dp->d_name[0] != '.') ||
+                    ((n != 1) &&
+                     ((dp->d_name[1] != '.') ||
+                      (n != 2)))) &&
+                   ((tmp_stbuf.st_dev != fil_stbuf.st_dev ||
+                     tmp_stbuf.st_ino != fil_stbuf.st_ino) &&
+                    (arc_stbuf.st_dev != fil_stbuf.st_dev ||
+                     arc_stbuf.st_ino != fil_stbuf.st_ino))) {
+                       add_sp(&sp, newname, len + n + 1);
+               }
+#endif
+       }
+       closedir(dirp);
+       finish_sp(&sp, v_filec, v_filev);
+       if (*v_filec > 1)
+               qsort(*v_filev, *v_filec, sizeof(char *), sort_by_ascii);
+       cleaning_files(v_filec, v_filev);
+
+       return TRUE;
+}
+
+/* ------------------------------------------------------------------------ */
+void
+free_files(filec, filev)
+       int             filec;
+       char          **filev;
+{
+       free_sp(filev);
+}
+#endif
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+/* Build temporary file name and store to TEMPORARY_NAME */
+void
+build_temporary_name()
+{
+#ifdef TMP_FILENAME_TEMPLATE
+       /* "/tmp/lhXXXXXX" etc. */
+       if (extract_directory == NULL) {
+               strcpy(temporary_name, TMP_FILENAME_TEMPLATE);
+       }
+       else {
+               sprintf(temporary_name, "%s/lhXXXXXX", extract_directory);
+       }
+       mktemp(temporary_name);
+#else
+       char           *p, *s;
+
+       strcpy(temporary_name, archive_name);
+       for (p = temporary_name, s = (char *) 0; *p; p++)
+               if (*p == '/')
+                       s = p;
+       strcpy((s ? s + 1 : temporary_name), "lhXXXXXX");
+       mktemp(temporary_name);
+#endif
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+modify_filename_extention(buffer, ext)
+       char           *buffer;
+       char           *ext;
+{
+       register char  *p, *dot;
+
+       for (p = buffer, dot = (char *) 0; *p; p++) {
+               if (*p == '.')
+                       dot = p;
+               else if (*p == '/')
+                       dot = (char *) 0;
+       }
+
+       if (dot)
+               p = dot;
+
+       strcpy(p, ext);
+}
+
+/* ------------------------------------------------------------------------ */
+/* build backup file name */
+void
+build_backup_name(buffer, original)
+       char           *buffer;
+       char           *original;
+{
+       strcpy(buffer, original);
+       modify_filename_extention(buffer, BACKUPNAME_EXTENTION);        /* ".bak" */
+}
+
+/* ------------------------------------------------------------------------ */
+void
+build_standard_archive_name(buffer, orginal)
+       char           *buffer;
+       char           *orginal;
+{
+       strcpy(buffer, orginal);
+       modify_filename_extention(buffer, ARCHIVENAME_EXTENTION);       /* ".lzh" */
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+boolean
+need_file(name)
+       char           *name;
+{
+       int             i;
+
+       if (cmd_filec == 0)
+               return TRUE;
+
+       for (i = 0; i < cmd_filec; i++) {
+               if (patmatch(cmd_filev[i], name, 0))
+                       return TRUE;
+       }
+
+       return FALSE;
+}
+
+FILE           *
+xfopen(name, mode)
+       char           *name, *mode;
+{
+       FILE           *fp;
+
+       if ((fp = fopen(name, mode)) == NULL)
+               fatal_error(name);
+
+       return fp;
+}
+
+/* ------------------------------------------------------------------------ */
+/*                                                                                                                                                     */
+/* ------------------------------------------------------------------------ */
+static          boolean
+open_old_archive_1(name, v_fp)
+       char           *name;
+       FILE          **v_fp;
+{
+       FILE           *fp;
+       struct stat     stbuf;
+
+       if (stat(name, &stbuf) >= 0 &&
+           is_regularfile(&stbuf) &&
+           (fp = fopen(name, READ_BINARY)) != NULL) {
+               *v_fp = fp;
+               archive_file_gid = stbuf.st_gid;
+               archive_file_mode = stbuf.st_mode;
+               return TRUE;
+       }
+
+       *v_fp = NULL;
+       archive_file_gid = -1;
+       return FALSE;
+}
+
+/* ------------------------------------------------------------------------ */
+FILE           *
+open_old_archive()
+{
+       FILE           *fp;
+       char           *p;
+
+       if (!strcmp(archive_name, "-")) {
+               if (cmd == CMD_EXTRACT || cmd == CMD_LIST)
+                       return stdin;
+               else
+                       return NULL;
+       }
+       if (p = (char *) rindex(archive_name, '.')) {
+               if (strucmp(".LZH", p) == 0
+                   || strucmp(".LZS", p) == 0
+                   || strucmp(".COM", p) == 0  /* DOS SFX */
+                   || strucmp(".EXE", p) == 0
+                   || strucmp(".X", p) == 0    /* HUMAN SFX */
+                   || strucmp(".BAK", p) == 0) {       /* for BackUp */
+                       open_old_archive_1(archive_name, &fp);
+                       return fp;
+               }
+       }
+
+       if (open_old_archive_1(archive_name, &fp))
+               return fp;
+       sprintf(expanded_archive_name, "%s.lzh", archive_name);
+       if (open_old_archive_1(expanded_archive_name, &fp)) {
+               archive_name = expanded_archive_name;
+               return fp;
+       }
+       /*
+        * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
+        * expanded_archive_name; return NULL; }
+        */
+       sprintf(expanded_archive_name, "%s.lzs", archive_name);
+       if (open_old_archive_1(expanded_archive_name, &fp)) {
+               archive_name = expanded_archive_name;
+               return fp;
+       }
+       /*
+        * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
+        * expanded_archive_name; return NULL; }
+        */
+       /*
+        * sprintf( expanded_archive_name , "%s.lzh",archive_name);
+        * archive_name = expanded_archive_name;
+        */
+       return NULL;
+}
+
+/* ------------------------------------------------------------------------ */
+int
+inquire(msg, name, selective)
+       char           *msg, *name, *selective;
+{
+       char            buffer[1024];
+       char           *p;
+
+       for (;;) {
+               fprintf(stderr, "%s %s ", name, msg);
+               fflush(stderr);
+
+               fgets(buffer, 1024, stdin);
+
+               for (p = selective; *p; p++)
+                       if (buffer[0] == *p)
+                               return p - selective;
+       }
+       /* NOTREACHED */
+}
+
+/* ------------------------------------------------------------------------ */
+void
+write_archive_tail(nafp)
+       FILE           *nafp;
+{
+       putc(0x00, nafp);
+}
+
+/* ------------------------------------------------------------------------ */
+void
+copy_old_one(oafp, nafp, hdr)
+       FILE           *oafp, *nafp;
+       LzHeader       *hdr;
+{
+       if (noexec) {
+               fseek(oafp, (long) (hdr->header_size + 2) + hdr->packed_size, SEEK_CUR);
+       }
+       else {
+               reading_filename = archive_name;
+               writting_filename = temporary_name;
+               copyfile(oafp, nafp, (long) (hdr->header_size + 2) + hdr->packed_size, 0);
+       }
+}
+
diff --git a/src/lhdir.c b/src/lhdir.c
new file mode 100644 (file)
index 0000000..aa5efa9
--- /dev/null
@@ -0,0 +1,98 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             lhdir.c -- Directory access routine                                                     */
+/*                                                                                                                                                     */
+/*             Copyright (C) MCMLXXXIX Yooichi.Tagawa                                                          */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*     Emulate opendir(),readdir(),closedir() function for LHarc                               */
+/*                                                                                                                                                     */
+/*     Ver. 0.00  Original                                                             1988.05.31  Y.Tagawa    */
+/*     Ver. 0.03  Release #3 for LHarc UNIX                    1988.07.02  Y.Tagawa    */
+/*     Ver. 1.00  Fixed                                                                1989.09.22  Y.Tagawa    */
+/*     Ver. 1.14  Source All chagned                                   1995.01.14      N.Watazaki      */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+
+/* Where is O_RDONLY ? (^_^) */
+#include <sys/file.h>
+
+#ifndef O_RDONLY
+#include <fcntl.h>
+#endif
+
+#define direct old_direct
+
+#include <sys/dir.h>
+
+#undef direct
+
+#ifndef DIRSIZ
+/* Warning :  Are you sure? (normally defined in <sys/dir.h> */
+#define DIRSIZ 14
+#endif
+
+#include "lhdir.h"
+
+/* ------------------------------------------------------------------------ */
+DIR            *
+opendir(name)
+       char           *name;
+{
+       register DIR   *dirp;
+       register int    fd;
+
+       if ((fd = open(name, O_RDONLY)) >= 0) {
+               if ((dirp = (DIR *) malloc(sizeof(DIR))) != (DIR *) 0) {
+                       dirp->dd_fd = fd;
+                       dirp->dd_loc = 0;
+                       dirp->dd_size = 0;
+                       return dirp;
+               }
+
+               close(fd);
+       }
+
+       return (DIR *) 0;
+}
+
+/* ------------------------------------------------------------------------ */
+struct direct  *
+readdir(dirp)
+       register DIR   *dirp;
+{
+       static struct direct lhdir;
+       register struct old_direct *dp;
+
+       do {
+               if (dirp->dd_loc >= dirp->dd_size) {
+                       dirp->dd_loc = 0;
+                       if ((dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ)) <= 0)
+                               return (struct direct *) 0;
+               }
+
+               dp = (struct old_direct *) (dirp->dd_buf + dirp->dd_loc);
+
+               if (dirp->dd_loc + sizeof(struct old_direct) > dirp->dd_size)
+                       return (struct direct *) 0;
+
+               dirp->dd_loc += sizeof(struct old_direct);
+
+       } while (dp->d_ino == 0);
+
+       /* construct new format */
+       lhdir.d_ino = dp->d_ino;
+       strncpy(lhdir.d_name, dp->d_name, DIRSIZ);
+       lhdir.d_name[DIRSIZ] = '\0';
+       lhdir.d_namlen = strlen(lhdir.d_name);
+
+       return &lhdir;
+}
+
+/* ------------------------------------------------------------------------ */
+closedir(dirp)
+       DIR            *dirp;
+{
+       close(dirp->dd_fd);
+       free(dirp);
+}
diff --git a/src/lhdir.h b/src/lhdir.h
new file mode 100644 (file)
index 0000000..6abefcf
--- /dev/null
@@ -0,0 +1,35 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX    Directory access routine                                                                    */
+/*                                                                                                                                                     */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/* Emulate opendir(), readdir(), closedir() function for LHa                           */
+/*                                                                                                                                                     */
+/*     Ver. 1.14       Soruce All chagned                              1995.01.14      N.Watazaki              */
+/* ------------------------------------------------------------------------ */
+
+#ifndef DIRBLKSIZ
+#define DIRBLKSIZ      512
+#endif
+
+/* ------------------------------------------------------------------------ */
+/*     Type Definition                                                                                                                 */
+/* ------------------------------------------------------------------------ */
+struct direct {
+       int             d_ino;
+       int             d_namlen;
+       char            d_name[256];
+};
+
+typedef struct {
+       int             dd_fd;
+       int             dd_loc;
+       int             dd_size;
+       char            dd_buf[DIRBLKSIZ];
+}               DIR;
+
+/* ------------------------------------------------------------------------ */
+/*     Functions                                                                                                                               */
+/* ------------------------------------------------------------------------ */
+extern DIR                      *opendir();
+extern struct direct *readdir();
+extern int                      closedir();
diff --git a/src/lhext.c b/src/lhext.c
new file mode 100644 (file)
index 0000000..76adc3c
--- /dev/null
@@ -0,0 +1,421 @@
+/* ------------------------------------------------------------------------ */
+/* LHa for UNIX                                                                                                                        */
+/*                             lhext.c -- LHarc extract                                                                        */
+/*                                                                                                                                                     */
+/*             Copyright (C) MCMLXXXIX Yooichi.Tagawa                                                          */
+/*             Modified                        Nobutaka Watazaki                                                       */
+/*                                                                                                                                                     */
+/*  Ver. 0.00  Original                                                                1988.05.23  Y.Tagawa    */
+/*  Ver. 1.00  Fixed                                                           1989.09.22  Y.Tagawa    */
+/*  Ver. 0.03  LHa for UNIX                                                    1991.12.17  M.Oki               */
+/*  Ver. 1.12  LHa for UNIX                                                    1993.10.01      N.Watazaki      */
+/*  Ver. 1.13b Symbolic Link Update Bug Fix                    1994.06.21      N.Watazaki      */
+/*     Ver. 1.14  Source All chagned                                   1995.01.14      N.Watazaki      */
+/*  Ver. 1.14e bugfix                               1999.04.30  T.Okamoto   */
+/* ------------------------------------------------------------------------ */
+#include "lha.h"
+/* ------------------------------------------------------------------------ */
+static int      skip_flg = FALSE;      /* FALSE..No Skip , TRUE..Skip */
+static char       *methods[] =
+{
+       LZHUFF0_METHOD, LZHUFF1_METHOD, LZHUFF2_METHOD, LZHUFF3_METHOD,
+       LZHUFF4_METHOD, LZHUFF5_METHOD, LZHUFF6_METHOD,
+       LARC_METHOD, LARC5_METHOD, LARC4_METHOD,
+       LZHDIRS_METHOD,
+       NULL
+};
+
+/* ------------------------------------------------------------------------ */
+static          boolean
+inquire_extract(name)
+       char           *name;
+{
+       struct stat     stbuf;
+
+       skip_flg = FALSE;
+       if (stat(name, &stbuf) >= 0) {
+               if (!is_regularfile(&stbuf)) {
+                       error("Already exist (not a file)", name);
+                       return FALSE;
+               }
+
+               if (noexec) {
+                       printf("EXTRACT %s but file is exist.\n", name);
+                       return FALSE;
+               }
+               else if (!force) {
+                       if (!isatty(0))
+                               return FALSE;
+
+                       switch (inquire("OverWrite ?(Yes/[No]/All/Skip)", name, "YyNnAaSs\n")) {
+                       case 0:
+                       case 1:/* Y/y */
+                               break;
+                       case 2:
+                       case 3:/* N/n */
+                       case 8:/* Return */
+                               return FALSE;
+                       case 4:
+                       case 5:/* A/a */
+                               force = TRUE;
+                               break;
+                       case 6:
+                       case 7:/* S/s */
+                               skip_flg = TRUE;
+                               break;
+                       }
+               }
+       }
+       if (noexec)
+               printf("EXTRACT %s\n", name);
+
+       return TRUE;
+}
+
+/* ------------------------------------------------------------------------ */
+static          boolean
+make_parent_path(name)
+       char           *name;
+{
+       char            path[FILENAME_LENGTH];
+       struct stat     stbuf;
+       register char  *p;
+
+       /* make parent directory name into PATH for recursive call */
+       strcpy(path, name);
+       for (p = path + strlen(path); p > path; p--)
+               if (p[-1] == '/') {
+                       *--p = '\0';
+                       break;
+               }
+
+       if (p == path) {
+               message("Why?", "ROOT");
+               return FALSE;   /* no more parent. */
+       }
+
+       if (GETSTAT(path, &stbuf) >= 0) {
+               if (is_directory(&stbuf))
+                       return TRUE;
+               error("Not a directory", path);
+               return FALSE;
+       }
+       errno = 0;
+
+       if (verbose)
+               printf("Making directory \"%s\".\n", path);
+
+       if (mkdir(path, 0777) >= 0)     /* try */
+               return TRUE;    /* successful done. */
+       errno = 0;
+
+       if (!make_parent_path(path))
+               return FALSE;
+
+       if (mkdir(path, 0777) < 0) {    /* try again */
+               message("Cannot make directory", path);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+/* ------------------------------------------------------------------------ */
+static FILE    *
+open_with_make_path(name)
+       char           *name;
+{
+       FILE           *fp;
+
+       if ((fp = fopen(name, WRITE_BINARY)) == NULL) {
+               errno = 0;
+               if (!make_parent_path(name) ||
+                   (fp = fopen(name, WRITE_BINARY)) == NULL)
+                       error("Cannot extract", name);
+               errno = 0;
+       }
+       return fp;
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+adjust_info(name, hdr)
+       char           *name;
+       LzHeader       *hdr;
+{
+       time_t          utimebuf[2];
+
+       /* adjust file stamp */
+       utimebuf[0] = utimebuf[1] = hdr->unix_last_modified_stamp;
+
+       if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
+               utime(name, utimebuf);
+
+       if (hdr->extend_type == EXTEND_UNIX
+           || hdr->extend_type == EXTEND_OS68K
+           || hdr->extend_type == EXTEND_XOSK) {
+#ifdef NOT_COMPATIBLE_MODE
+               Please need your modification in this space.
+#else
+               if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
+                       chmod(name, hdr->unix_mode);
+#endif
+               if (!getuid()) {
+#ifndef HAVE_NO_LCHOWN
+            if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
+                           lchown(name, hdr->unix_uid, hdr->unix_gid);
+                       else
+#endif /* HAVE_NO_LCHWON */
+                           chown(name, hdr->unix_uid, hdr->unix_gid);
+               }
+               errno = 0;
+       }
+}
+
+/* ------------------------------------------------------------------------ */
+static void
+extract_one(afp, hdr)
+       FILE           *afp;    /* archive file */
+       LzHeader       *hdr;
+{
+       FILE           *fp;     /* output file */
+       struct stat     stbuf;
+       char            name[257];
+       int             crc;
+       int             method;
+       boolean         save_quiet, save_verbose, up_flag;
+       char           *q = hdr->name, c;
+
+       if (ignore_directory && rindex(hdr->name, '/')) {
+               q = (char *) rindex(hdr->name, '/') + 1;
+       }
+       else {
+               if (*q == '/') {
+                       q++;
+                       /*
+                        * if OSK then strip device name
+                        */
+                       if (hdr->extend_type == EXTEND_OS68K
+                           || hdr->extend_type == EXTEND_XOSK) {
+                               do
+                                       c = (*q++);
+                               while (c && c != '/');
+                               if (!c || !*q)
+                                       q = ".";        /* if device name only */
+                       }
+               }
+       }
+
+       if (extract_directory)
+               sprintf(name, "%s/%s", extract_directory, q);
+       else
+               strcpy(name, q);
+
+
+       /* LZHDIRS_METHOD¤ò»ý¤Ä¥Ø¥Ã¥À¤ò¥Á¥§¥Ã¥¯¤¹¤ë */
+       /* 1999.4.30 t.okamoto */
+       for (method = 0;; method++) {
+               if (methods[method] == NULL) {
+                       error("Unknown method skiped ...", name);
+                       return;
+               }
+               if (bcmp(hdr->method, methods[method], 5) == 0)