comp.sources.misc v05i028: /etc/magic lines for compress

Paul Lew lew at gsg.UUCP
Wed Nov 2 07:12:50 AEST 1988


In article <2643 at nuchat.UUCP>, steve at nuchat.UUCP (Steve Nuchia) 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.  I was motivated to add this
> when I imported a bunch of files from BSD systems and the .Zs
> all got lopped off.
> 
> 0	short		40223		compressed data
> >2	byte		<0200		- %d bits
> >2	byte		0214		- 12 bits
> >2	byte		0215		- 13 bits
> >2	byte		0220		- 16 bits
> 

I found out on Pyramid the magic value should be represented as:

	017635 instead of 40223

apparently this is yet another byte swapping problem.  Maybe all the fields
in /etc/magic should use byte instead of short?  Otherwise, /etc/magic is not
portable to other machine.  Change the short to 2 bytes solve the problem:

	0	byte		0037		compressed data
	>1	byte		0235
	>2	byte		<0200		- %d bits
	>2	byte		0214		- 12 bits
	>2	byte		0215		- 13 bits
	>2	byte		0220		- 16 bits

By browsing thru the /etc/magic file on the Pyramid, I found a lot of places
where long and short were used.  If this file is used on other machine like
Vax it probably will not work properly.  Is there a portable version of
/etc/magic somewhere?
-- 
Paul Lew			{oliveb,harvard,decvax}!gsg!lew	(UUCP)
General Systems Group, 5 Manor Parkway, Salem, NH 03079	(603) 893-1000



More information about the Comp.sources.bugs mailing list