Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!public!thad From: thad@public.BTR.COM (Thaddeus P. Floryan) Newsgroups: comp.sys.3b1 Subject: Re: zoo magic Keywords: magic Message-ID: <2988@public.BTR.COM> Date: 8 Jun 91 11:01:26 GMT References: <378@unx-pc.UUCP> Organization: BTR Public Access UNIX, Mountain View CA Lines: 64 In article <378@unx-pc.UUCP> steve@unx-pc.UUCP (Stephen Hess) writes: >[...] >Here is a line to add to /etc/magic so that when you type file * >it identifies those zoo files. > >20 long 0xdcatc4fd zoo archive >[...] ^ | (BTW, should be a "7" here instead of the "t") Another (more obvious? :-) way to determine an archive's ZOO-ness is based on the fact the first 16 bytes in a ZOO archive will be a string of the form: "ZOO d.dd Archive" where each "d" corresponds to a decimal digit of the creating ZOO's version number (i.e. "1.50", "2.00", "2.01", etc.) which suggests the following magic entry may be more useful: 0 string ZOO %s >4 string 1 V1 >4 string 2 V2 >9 string Archive %s per: thadlabs ksh 13827/14006> file * zoo1v50.zoo: ZOO V1 Archive zoo2v00.zoo: ZOO V2 Archive thadlabs ksh 13827/14006> It appears the string comparison performed by file(1) uses strncmp(3C) so any attempt to extract out the other digits of the version is tedious, besides which a "bug" (or at least an idiosyncracy) causes a space to be output after every displayed string which would cause, for example, "1 . 5 0" to be shown as the version number if one attempted to match digit positions explicitly using something like the following in the /etc/magic entry: >6 string 0 %s >6 string 1 %s [...] >6 string 8 %s >6 string 9 %s >7 string 0 %s >7 string 1 %s [...] >7 string 8 %s >7 string 9 %s BTW, here's another entry that you may find useful in the event a compressed file copied from another system loses its ".Z" due to SysV 14-char filename limits: 0 short &0xFFFF 0x1F9D compressed file >2 short &0x8000 0x8000 block compressed >2 short &0x1F00 0x0C00 12 bit LZW >2 short &0x1F00 0x0D00 13 bit LZW >2 short &0x1F00 0x0E00 14 bit LZW >2 short &0x1F00 0x0F00 15 bit LZW >2 short &0x1F00 0x1000 16 bit LZW Thad Floryan [ thad@btr.com (OR) {decwrl, mips, fernwood}!btr!thad ]