v05i028: /etc/magic lines for compress

Dik T. Winter dik at cwi.nl
Wed Nov 16 06:46:15 AEST 1988


In article <454 at auspex.UUCP> guy at auspex.UUCP (Guy Harris) writes:
 > >>If you have a file(1) compatible with the one in sysVr3
 > >>adding the following lines to /etc/magic will make it
 > >>recognize compressed files.
 > >>
 > >>0	short		40223		compressed data
 > >>
 > >We have SysVr2.2 and the 40223 needed to be changed to 8093 (1F9D hex).
 > 
 > Person "A" had a little-endian machine (40223 is 9D1F hex) and person
 > "B" had a big-endian machine; the S5 release had nothing to do with it. 
 > 
 > Unfortunately, "strings" in "/etc/magic" cannot, in the standard S5
 > version, contain C-language escapes, so you can't do this:
 > 
 > 	0	string		\037\235	compressed data
 > 
 > which the SunOS version of the S5 'file" supports; this obviates the need
 > for byte-order-dependent versions of "/etc/magic".

It is clear that byte order dependencies are a pain, on the other hand
if for some system some format is specified as 0177767 it appears to be
backward to have to specify it in the form of a string.
Wouldn't it be better to allow specification like AR16W, AR32W and
AR32WR as happens in so many places in SysV (COFF comes to mind)?
Then each system can specify in its favourite order its own /etc/magic
part.  Of course file(1) would have to compose the words and longs
itself, but that is only minor.  (Note: this could also make a truely
portable file(1)).
-- 
dik t. winter, cwi, amsterdam, nederland
INTERNET   : dik at cwi.nl
BITNET/EARN: dik at mcvax



More information about the Comp.sources.bugs mailing list