/etc/magic entries for compress(1) & pack(1)

Chris Lent chris at cooper.UUCP
Mon Nov 24 11:32:30 AEST 1986


# Hi,
# 	Here's the necessary lines to ADD to /etc/magic
# to allow file(1) to recognize files produced by compress(1) and pack(1).
# This has been tested on System V Releases 2.0 and 3.0 (3B5 and 3B2,
# respectively.)  Note that the file will also tell how many bits
# the code lengths are for compressed files.
# 
#  To test:
# 	$ # extract the archive
# 	$ sh magic.shar
# 	$ shar: extracting 'compress.magic' (388 characters)
# 	$ cp compress.magic /tmp/x
# 	$ compress /tmp/x
# 	$ # Test file(1) with compress.magic instead of /etc/magic
# 	$ file -m compress.magic /tmp/x.Z
# 	/tmp/x.Z:	compressed data     - with 16 bits
# 	$ rm -f /tmp/x.Z
# 
# Enjoy,
# Chris Lent
# ihnp4!philabs!phri!cooper!chris
# 
# Enc: shar archive of compress.magic
# ------------------------Cut here----------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	compress.magic
# This archive created: Sun Nov 23 20:09:46 1986
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'compress.magic'" '(388 characters)'
if test -f 'compress.magic'
then
	echo shar: "will not over-write existing file 'compress.magic'"
else
cat << \SHAR_EOF > 'compress.magic'
# CPL	- added compress to /etc/magic
#	- added number of bits in compressed file to /etc/magic
#P.S. Fields must be seperated by tabs ('\t').
0	short		017635		compressed data
>2	byte		0214		- with 12 bits
>2	byte		0215		- with 13 bits
>2	byte		0216		- with 14 bits
>2	byte		0217		- with 15 bits
>2	byte		0220		- with 16 bits
# CPL 	- added pack to /etc/magic
0	short		017436		packed data
SHAR_EOF
if test 388 -ne "`wc -c < 'compress.magic'`"
then
	echo shar: "error transmitting 'compress.magic'" '(should have been 388 characters)'
fi
fi
exit 0
#	End of shell archive
-- 
Chris Lent 	ihnp4!allegra!phri!cooper!chris



More information about the Comp.unix.wizards mailing list