[unix-pc.sources] Compressed file magic entries

mml@magnus.UUCP (Mike Levin) (11/04/88)

Somebody recently posted an /etc/magic file addendum to allow 'file'
to recognize compressed files.  That was really SLICK, but it didn't
work on the unix-pc.  So, I got to thinking- what could be wrong?? I
finally figured it out- when dealing with 'byte' types, the unix-pc
treats them as signed, and so things get all screwy.  In any case,
after a bit of messing around, I got the following working.  Just
append it onto /etc/magic, and it should do it for your system too.
If somebody out there has a better one, please email it to me.

Just unshar the file- it should drop into /tmp/magic.  Then, use vi to
simply append it to your /etc/magic file.

Have fun!

*----------cut here and go for it---------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  /tmp/magic
# Wrapped by mml@magnus on Thu Nov  3 22:52:59 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f '/tmp/magic' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'/tmp/magic'\"
else
echo shar: Extracting \"'/tmp/magic'\" \(158 characters\)
sed "s/^X//" >'/tmp/magic' <<'END_OF_FILE'
X0	short		0x1f9d		compressed data
X>2	byte		-116		- 12 bits
X>2	byte		-115		- 13 bits
X>2	byte		-114		- 14 bits
X>2	byte		-113		- 15 bits
X>2	byte		-112		- 16 bits
END_OF_FILE
if test 158 -ne `wc -c <'/tmp/magic'`; then
    echo shar: \"'/tmp/magic'\" unpacked with wrong size!
fi
# end of '/tmp/magic'
fi
echo shar: End of shell archive.
exit 0