Path: utzoo!attcan!uunet!munnari.oz.au!uhccux!ames!uakari.primate.wisc.edu!uwm.edu!cs.utexas.edu!oakhill!dover!digital!chen From: chen@digital.sps.mot.com (Jinfu Chen) Newsgroups: comp.sys.atari.st Subject: Re: lharc/arc/zoo/compress Keywords: archives Message-ID: <47fb17d2.81da@digital.sps.mot.com> Date: 12 Jan 90 01:31:52 GMT References: <47f0d326.81da@digital.sps.mot.com> <21701@uflorida.cis.ufl.EDU> <21723@uflorida.cis.ufl.EDU> Reply-To: chen@digital.sps.MOT.COM (Jinfu Chen) Organization: Motorola, Inc. Logic IC Div, Mesa, AZ Lines: 37 In article <21723@uflorida.cis.ufl.EDU> rs0@beach.cis.ufl.edu () writes: > >I would _really love to see a super-smart program that can use any of >these formats, and allow you to unarchive _anything_. Then the choice >of archive format would become less of a problem in the present and >the future. > It's possible to write such program. However, it's pretty hard to write a program to handle multiple format by itself with comfortable speed. It's much easier to write a program to identify the compression format and call appropriate compression program to handle the data file. Under UNIX, this is trival as each of these four compression schemes has an unique 'magic' number. The UNIX command `file' can be used for such application. If you add following lines in the 'magic' file (/etc/magic), the command should be able to identify the format of an compressed file: 0 short 0x1f9d compress(l) output 0 byte 0x1a arc(l) archive output 2 string -l lharc(l) archive output 20 long 0xdca7c4fd zoo(l) archive output Note that the magic number for zoo is for Motorola 680x0 chips, the Intell chips and VAX family (?) store the long integer in normal order. So the number should 0xfdc4a7dc instead. I'm not 100% sure the lharc magic string covers every format of lharc. Inside lharc.c, there are four of them listed: #define LZHUFF0_METHOD "-lh0-" #define LZHUFF1_METHOD "-lh1-" #define LARC4_METHOD "-lz4-" #define LARC5_METHOD "-lz5-" Alternatively, one can add these information to the magic file so `file' command can even tell you which archive method lharc uses.