Browse Source

Merge upstream version 3.26, import Debian version 3.26-1

Nicolás Lichtmaier 26 years ago
parent
commit
3c28670a98
49 changed files with 1053 additions and 321 deletions
  1. 0 0
      Header
  2. 0 0
      Localstuff
  3. 0 16
      Magdir/Makefile
  4. 39 0
      Magdir/adventure
  5. 12 0
      Magdir/applix
  6. 1 12
      Magdir/audio
  7. 111 0
      Magdir/audio.orig
  8. 38 4
      Magdir/bsdi
  9. 3 3
      Magdir/commands
  10. 7 1
      Magdir/database
  11. 40 5
      Magdir/elf
  12. 3 3
      Magdir/filesystems
  13. 10 0
      Magdir/flash
  14. 1 0
      Magdir/frame
  15. 4 1
      Magdir/images
  16. 14 1
      Magdir/msdos
  17. 97 0
      Magdir/olf
  18. 23 0
      Magdir/os2
  19. 10 0
      Magdir/pdp
  20. 10 0
      Magdir/printer
  21. 93 0
      Magdir/riff
  22. 4 0
      Magdir/teapot
  23. 11 0
      Magdir/tex
  24. 6 6
      Magdir/timezone
  25. 0 26
      Magdir/vgetty
  26. 16 0
      Magdir/vicar
  27. 9 9
      Makefile.in
  28. 7 7
      Makefile.std
  29. 17 6
      apprentice.c
  30. 5 3
      ascmagic.c
  31. 13 8
      compress.c
  32. 10 0
      config.h.in
  33. 192 110
      configure
  34. 3 1
      configure.in
  35. 1 1
      debian/README.debian
  36. 1 1
      debian/control
  37. 21 11
      file.c
  38. 11 22
      file.h
  39. 7 3
      fsmagic.c
  40. 7 0
      internat.c
  41. 9 1
      is_tar.c
  42. 6 4
      magic.man
  43. 50 11
      names.h
  44. 15 2
      patchlevel.h
  45. 10 8
      print.c
  46. 59 20
      readelf.c
  47. 11 3
      readelf.h
  48. 33 11
      softmagic.c
  49. 3 1
      tar.h

Magdir/Header → Header


Magdir/Localstuff → Localstuff


+ 0 - 16
Magdir/Makefile

@@ -1,16 +0,0 @@
-#
-# Makefile for /etc/magic file for Ian Darwin's file(1) command.
-# Copyright (c) 1989 Ian F. Darwin, Toronto, Canada.
-# $Id: Makefile,v 1.8 1993/01/05 13:22:31 ian Exp $
-#
-#
-SHELL		= /bin/sh
-HEADER		= Header
-LOCALSTUFF	= Localstuff
-
-ALL		=  $(HEADER) $(LOCALSTUFF) [a-z]*
-
-install:	../magic
-../magic:	$(ALL)
-		cat $(ALL) >> $@
-		touch --reference $$(ls -tr | tail -1) $@

+ 39 - 0
Magdir/adventure

@@ -0,0 +1,39 @@
+
+#------------------------------------------------------------------------------
+# adventure: file(1) magic for Adventure game files
+#
+# from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
+# Edited by Dave Chapeskie <dchapes@ddm.on.ca> Jun 28, 1998
+#
+# ALAN
+# I assume there are other, lower versions, but these are the only ones I
+# saw in the archive.
+0	beshort	0x0206	ALAN text adventure code data
+>2	byte	<10	version 2.6%d
+
+# Conflicts with too much other stuff!
+# Infocom
+# (Note: to avoid false matches Z-machine version 1 and 2 are not
+# recognized since only the oldest Zork I and II used them.  Similarly
+# there are 4 Infocom games that use verion 4 that are not recognized.)
+#0	byte	3	Infocom game data (Z-machine 3,
+#>2	beshort	<0x7fff	Release %3d,
+#>26	beshort >0	Size %d*2
+#>18	string	>\0	Serial %.6s)
+#0	byte	5	Infocom game data (Z-machine 5,
+#>2	beshort	<0x7fff	Release %3d,
+#>26	beshort >0	Size %d*4
+#>18	string	>\0	Serial %.6s)
+#0	byte	6	Infocom game data (Z-machine 6,
+#>2	beshort	<0x7fff	Release %3d,
+#>26	beshort >0	Size %d*8
+#>18	string	>\0	Serial %.6s)
+#0	byte	8	Infocom game data (Z-machine 8,
+#>2	beshort	<0x7fff	Release %3d,
+#>26	beshort >0	Size %d*8
+#>18	string	>\0	Serial %.6s)
+
+# TADS (Text Adventure Development System)
+0	string	TADS	TADS game data
+>13	string	>\0	(ver. %.6s,
+>22	string	>\0	date %s)

+ 12 - 0
Magdir/applix

@@ -0,0 +1,12 @@
+
+#------------------------------------------------------------------------------
+# applix:  file(1) magic for Applixware
+# From: Peter Soos <sp@osb.hu>
+#
+0	string		*BEGIN		Applixware
+>7	string		WORDS			Words Document
+>7	string		GRAPHICS		Graphic
+>7	string		RASTER			Bitmap
+>7	string		SPREADSHEETS		Spreadsheet
+>7	string		MACRO			Macro
+>7	string		BUILDER			Builder Object

+ 1 - 12
Magdir/audio

@@ -44,7 +44,7 @@
 # Creative Labs AUDIO stuff
 # Creative Labs AUDIO stuff
 0	string	MThd			Standard MIDI data
 0	string	MThd			Standard MIDI data
 >9 	byte	>0			(format %d)
 >9 	byte	>0			(format %d)
->11	byte	>1			using %d channels
+>11	byte	>1			using %d tracks
 0	string	CTMF			Creative Music (CMF) data
 0	string	CTMF			Creative Music (CMF) data
 0	string	SBI			SoundBlaster instrument data
 0	string	SBI			SoundBlaster instrument data
 0	string	Creative\ Voice\ File	Creative Labs voice data
 0	string	Creative\ Voice\ File	Creative Labs voice data
@@ -57,17 +57,6 @@
 0	belong		0x4e54524b	MultiTrack sound data
 0	belong		0x4e54524b	MultiTrack sound data
 >4	belong		x		- version %ld
 >4	belong		x		- version %ld
 
 
-# Microsoft WAVE format (*.wav)
-0	string		RIFF		Microsoft RIFF
->8	string		WAVE		\b, WAVE audio data
->>34	leshort		>0		\b, %d bit
->>22	leshort		=1		\b, mono
->>22	leshort		=2		\b, stereo
->>22	leshort		>2		\b, %d channels
->>24	lelong		>0		%d Hz
-# AVI == Audio Video Interleave
->8      string          AVI\            \b, AVI data
-
 # Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED
 # Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED
 # [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
 # [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
 0	string		EMOD		Extended MOD sound data,
 0	string		EMOD		Extended MOD sound data,

+ 111 - 0
Magdir/audio.orig

@@ -0,0 +1,111 @@
+
+#------------------------------------------------------------------------------
+# audio:  file(1) magic for sound formats (see also "iff")
+#
+# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
+# and others
+#
+
+# Sun/NeXT audio data
+0	string		.snd		Sun/NeXT audio data:
+>12	belong		1		8-bit ISDN u-law,
+>12	belong		2		8-bit linear PCM [REF-PCM],
+>12	belong		3		16-bit linear PCM,
+>12	belong		4		24-bit linear PCM,
+>12	belong		5		32-bit linear PCM,
+>12	belong		6		32-bit IEEE floating point,
+>12	belong		7		64-bit IEEE floating point,
+>12	belong		23		8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12	belong		24		compressed (8-bit G.722 ADPCM)
+>12	belong		25		compressed (3-bit G.723 ADPCM),
+>12	belong		26		compressed (5-bit G.723 ADPCM),
+>12	belong		27		8-bit A-law,
+>20	belong		1		mono,
+>20	belong		2		stereo,
+>20	belong		4		quad,
+>16	belong		>0		%d Hz
+
+# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format
+# that uses little-endian encoding and has a different magic number
+0	lelong		0x0064732E	DEC audio data:
+>12	lelong		1		8-bit ISDN u-law,
+>12	lelong		2		8-bit linear PCM [REF-PCM],
+>12	lelong		3		16-bit linear PCM,
+>12	lelong		4		24-bit linear PCM,
+>12	lelong		5		32-bit linear PCM,
+>12	lelong		6		32-bit IEEE floating point,
+>12	lelong		7		64-bit IEEE floating point,
+>12	lelong		23		8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding),
+>20	lelong		1		mono,
+>20	lelong		2		stereo,
+>20	lelong		4		quad,
+>16	lelong		>0		%d Hz
+
+# Creative Labs AUDIO stuff
+0	string	MThd			Standard MIDI data
+>9 	byte	>0			(format %d)
+>11	byte	>1			using %d tracks
+0	string	CTMF			Creative Music (CMF) data
+0	string	SBI			SoundBlaster instrument data
+0	string	Creative\ Voice\ File	Creative Labs voice data
+# is this next line right?  it came this way...
+>19	byte	0x1A
+>23	byte	>0			- version %d
+>22	byte	>0			\b.%d
+
+# first entry is also the string "NTRK"
+0	belong		0x4e54524b	MultiTrack sound data
+>4	belong		x		- version %ld
+
+# Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED
+# [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
+0	string		EMOD		Extended MOD sound data,
+>4	byte&0xf0	x		version %d
+>4	byte&0x0f	x		\b.%d,
+>45	byte		x		%d instruments
+>83	byte		0		(module)
+>83	byte		1		(song)
+
+# Real Audio (Magic .ra\0375)
+0	belong		0x2e7261fd	realaudio sound file
+
+# MTM/669/FAR/S3M/ULT/XM format checking [Aaron Eppert, aeppert@dialin.ind.net]
+# Oct 31, 1995
+0	string		MTM		MultiTracker Module sound file
+0	string		if		Composer 669 Module sound data
+0	string		FAR		Module sound data
+0	string		MAS_U		ULT(imate) Module sound data
+0x2c	string		SCRM		ScreamTracker III Module sound data
+0	string		Extended Module	Extended Module sound data
+
+# Gravis UltraSound patches
+# From <ache@nagual.ru>
+
+0	string		GF1PATCH110\0ID#000002\0	GUS patch
+0	string		GF1PATCH100\0ID#000002\0	Old GUS	patch
+
+#
+# Taken from loader code from mikmod version 2.14
+# by Steve McIntyre (stevem@chiark.greenend.org.uk)
+0	string	JN		extended 669 module data
+0	string	MAS_UTrack_V00
+>14	string	>/0		ultratracker V1.%.1s module sound data
+0	string	UN05		MikMod UNI format module sound data
+0	string	Extended\ Module: Fasttracker II module sound data
+21	string	!SCREAM!	Screamtracker 2 module sound data
+1080	string	M.K.		4-channel Protracker module sound data
+1080	string	M!K!		4-channel Protracker module sound data
+1080	string	FLT4		4-channel Startracker module sound data
+1080	string	4CHN		4-channel Fasttracker module sound data
+1080	string	6CHN		6-channel Fasttracker module sound data
+1080	string	8CHN		8-channel Fasttracker module sound data
+1080	string	CD81		8-channel Oktalyzer module sound data
+1080	string	OKTA		8-channel Oktalyzer module sound data
+1082	string	CH
+>1080	string	>/0		%.2s-channel Fasttracker "oktalyzer" module sound data
+1080	string	16CN		16-channel Taketracker module sound data
+1080	string	32CN		32-channel Taketracker module sound data
+
+# TOC sound files -Trevor Johnson <trevor@jpj.net>
+#
+0       string          TOC             TOC sound file

+ 38 - 4
Magdir/bsdi

@@ -1,7 +1,41 @@
-
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # bsdi:  file(1) magic for BSD/OS (from BSDI) objects
 # bsdi:  file(1) magic for BSD/OS (from BSDI) objects
 #
 #
-0	lelong			000000314	BSD/OS i386 compact demand paged executable
->16	lelong			>0		not stripped
->32	byte			0x6a		(uses shared libs)
+
+0	lelong		0314		386 compact demand paged pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses shared libs)
+
+0	lelong		0407		386 executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses shared libs)
+
+0	lelong		0410		386 pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses shared libs)
+
+0	lelong		0413		386 demand paged pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses shared libs)
+
+# same as in SunOS 4.x, except for static shared libraries
+0	belong&077777777	0600413		sparc demand paged
+>0	byte		&0x80
+>>20	belong		<4096		shared library
+>>20	belong		=4096		dynamically linked executable
+>>20	belong		>4096		dynamically linked executable
+>0	byte		^0x80		executable
+>16	belong		>0		not stripped
+>36	belong		0xb4100001	(uses shared libs)
+
+0	belong&077777777	0600410		sparc pure
+>0	byte		&0x80		dynamically linked executable
+>0	byte		^0x80		executable
+>16	belong		>0		not stripped
+>36	belong		0xb4100001	(uses shared libs)
+
+0	belong&077777777	0600407		sparc
+>0	byte		&0x80		dynamically linked executable
+>0	byte		^0x80		executable
+>16	belong		>0		not stripped
+>36	belong		0xb4100001	(uses shared libs)

+ 3 - 3
Magdir/commands

@@ -90,10 +90,10 @@
 
 
 # generic shell magic
 # generic shell magic
 0	string		#!\ /			a
 0	string		#!\ /			a
->3	string		>\0			%s script text
+>3	string		>\n			%s script text
 0	string		#!\	/		a
 0	string		#!\	/		a
->3	string		>\0			%s script text
+>3	string		>\n			%s script text
 0	string		#!/			a
 0	string		#!/			a
->2	string		>\0			%s script text
+>2	string		>\n			%s script text
 0	string		#!\ 			script text
 0	string		#!\ 			script text
 >3	string		>\0			for %s
 >3	string		>\0			for %s

+ 7 - 1
Magdir/database

@@ -30,9 +30,15 @@
 >56	belong	x		Number of Keys %d)
 >56	belong	x		Number of Keys %d)
 #
 #
 #
 #
-0	belong	0x053162	Berkeley DB Btree file
+0	belong	0x053162	Berkeley DB Btree file/Big Endian
 >4	belong	>0		(Version %d,
 >4	belong	>0		(Version %d,
 >8	belong	x		Page Size %d,
 >8	belong	x		Page Size %d,
 >12	belong	x		Free Page %d,
 >12	belong	x		Free Page %d,
 >16	belong	x		Number of Records %d,
 >16	belong	x		Number of Records %d,
 >20	belong	x		Flags 0x%x)
 >20	belong	x		Flags 0x%x)
+0	lelong	0x053162	Berkeley DB Btree file/Little Endian
+>4	lelong	>0		(Version %d,
+>8	lelong	x		Page Size %d,
+>12	lelong	x		Free Page %d,
+>16	lelong	x		Number of Records %d,
+>20	lelong	x		Flags 0x%x)

+ 40 - 5
Magdir/elf

@@ -39,10 +39,28 @@
 >>18	leshort		11		RS6000 - invalid byte order,
 >>18	leshort		11		RS6000 - invalid byte order,
 >>18	leshort		15		PA-RISC - invalid byte order,
 >>18	leshort		15		PA-RISC - invalid byte order,
 >>18	leshort		16		nCUBE,
 >>18	leshort		16		nCUBE,
->>18	leshort		17		VPP500,
+>>18	leshort		17		Fujitsu VPP500,
 >>18	leshort		18		SPARC32PLUS,
 >>18	leshort		18		SPARC32PLUS,
 >>18	leshort		20		PowerPC,
 >>18	leshort		20		PowerPC,
->>18	leshort		0x9026		Alpha,
+>>18	leshort		36		NEC V800,
+>>18	leshort		37		Fujitsu FR20,
+>>18	leshort		38		TRW RH-32,
+>>18	leshort		39		Motorola RCE,
+>>18	leshort		40		Advanced RISC Machines ARM,
+>>18	leshort		41		Alpha,
+>>18	leshort		42		Hitachi SH,
+>>18	leshort		43		SPARC V9 - invalid byte order,
+>>18	leshort		44		Siemens Tricore Embedded Processor,
+>>18	leshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
+>>18	leshort		46		Hitachi H8/300,
+>>18	leshort		47		Hitachi H8/300H,
+>>18	leshort		48		Hitachi H8S,
+>>18	leshort		49		Hitachi H8/500,
+>>18	leshort		50		Intel Merced Processor,
+>>18	leshort		51		Stanford MIPS-X,
+>>18	leshort		52		Motorola Coldfire,
+>>18	leshort		53		Motorola M68HC12,
+>>18	leshort		0x9026		Alpha (unofficial),
 >>20	lelong		0		invalid version
 >>20	lelong		0		invalid version
 >>20	lelong		1		version 1
 >>20	lelong		1		version 1
 >>36	lelong		1		MathCoPro/FPU/MAU Required
 >>36	lelong		1		MathCoPro/FPU/MAU Required
@@ -70,14 +88,31 @@
 >>18	beshort		11		RS6000,
 >>18	beshort		11		RS6000,
 >>18	beshort		15		PA-RISC,
 >>18	beshort		15		PA-RISC,
 >>18	beshort		16		nCUBE,
 >>18	beshort		16		nCUBE,
->>18	beshort		17		VPP500,
+>>18	beshort		17		Fujitsu VPP500,
 >>18	beshort		18		SPARC32PLUS,
 >>18	beshort		18		SPARC32PLUS,
 >>18	beshort		20		PowerPC or cisco 4500,
 >>18	beshort		20		PowerPC or cisco 4500,
 >>18	beshort		21		cisco 7500,
 >>18	beshort		21		cisco 7500,
 >>18	beshort		24		cisco SVIP,
 >>18	beshort		24		cisco SVIP,
 >>18	beshort		25		cisco 7200,
 >>18	beshort		25		cisco 7200,
->>18	beshort		36		cisco 12000,
->>18	beshort		0x9026		Alpha,
+>>18	beshort		36		NEC V800 or cisco 12000,
+>>18	beshort		37		Fujitsu FR20,
+>>18	beshort		38		TRW RH-32,
+>>18	beshort		39		Motorola RCE,
+>>18	beshort		40		Advanced RISC Machines ARM,
+>>18	beshort		41		Alpha,
+>>18	leshort		42		Hitachi SH,
+>>18	beshort		43		SPARC V9 - invalid byte order,
+>>18	beshort		44		Siemens Tricore Embedded Processor,
+>>18	beshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
+>>18	beshort		46		Hitachi H8/300,
+>>18	beshort		47		Hitachi H8/300H,
+>>18	beshort		48		Hitachi H8S,
+>>18	beshort		49		Hitachi H8/500,
+>>18	beshort		50		Intel Merced Processor,
+>>18	beshort		51		Stanford MIPS-X,
+>>18	beshort		52		Motorola Coldfire,
+>>18	beshort		53		Motorola M68HC12,
+>>18	beshort		0x9026		Alpha (unofficial),
 >>20	belong		0		invalid version
 >>20	belong		0		invalid version
 >>20	belong		1		version 1
 >>20	belong		1		version 1
 >>36	belong		1		MathCoPro/FPU/MAU Required
 >>36	belong		1		MathCoPro/FPU/MAU Required

+ 3 - 3
Magdir/filesystems

@@ -41,18 +41,18 @@
 >>>>32	lelong		x		%d sectors
 >>>>32	lelong		x		%d sectors
 >0x200	lelong	0x82564557		\b, BSD disklabel
 >0x200	lelong	0x82564557		\b, BSD disklabel
 
 
-# Minix filesystems - Juan Cespedes <cespedes@debian.org>
+# Minix filesystems - Juan Céspedes <cespedes@debian.org>
 0x410	leshort		0x137f		Minix filesystem
 0x410	leshort		0x137f		Minix filesystem
 0x410	leshort		0x138f		Minix filesystem, 30 char names
 0x410	leshort		0x138f		Minix filesystem, 30 char names
 0x410	leshort		0x2468		Minix filesystem, version 2
 0x410	leshort		0x2468		Minix filesystem, version 2
 0x410	leshort		0x2478		Minix filesystem, version 2, 30 char names
 0x410	leshort		0x2478		Minix filesystem, version 2, 30 char names
 
 
-# romfs filesystems - Juan Cespedes <cespedes@debian.org>
+# romfs filesystems - Juan Céspedes <cespedes@debian.org>
 0	string		-rom1fs-\0	romfs filesystem, version 1
 0	string		-rom1fs-\0	romfs filesystem, version 1
 >8	belong	x			%d bytes,
 >8	belong	x			%d bytes,
 >16	string	x			named %s.
 >16	string	x			named %s.
 
 
-# netboot image - Juan Cespedes <cespedes@debian.org>
+# netboot image - Juan Céspedes <cespedes@debian.org>
 0	lelong		0x1b031336L	Netboot image,
 0	lelong		0x1b031336L	Netboot image,
 >4	lelong&0xFFFFFF00	0
 >4	lelong&0xFFFFFF00	0
 >>4	lelong&0x100	0x000		mode 2
 >>4	lelong&0x100	0x000		mode 2

+ 10 - 0
Magdir/flash

@@ -0,0 +1,10 @@
+
+#------------------------------------------------------------------------------
+# flash:	file(1) magic for Macromedia Flash file format
+#
+# See
+#
+#	http://www.macromedia.com/software/flash/open/
+#
+0	string		FWS		Macromedia Flash data,
+>3	byte		x		version %d

+ 1 - 0
Magdir/frame

@@ -6,6 +6,7 @@
 # copyright, but this file is "published" as witness the following:
 # copyright, but this file is "published" as witness the following:
 #
 #
 0	string		\<MakerFile	FrameMaker document
 0	string		\<MakerFile	FrameMaker document
+>11	string		5.5		 (5.5
 >11	string		5.0		 (5.0
 >11	string		5.0		 (5.0
 >11	string		4.0		 (4.0
 >11	string		4.0		 (4.0
 >11	string		3.0		 (3.0
 >11	string		3.0		 (3.0

+ 4 - 1
Magdir/images

@@ -192,7 +192,10 @@
 #>28	belong		>0		colormap is %d bytes long
 #>28	belong		>0		colormap is %d bytes long
 
 
 # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
 # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
-# file://sgi.com/graphics/SGIIMAGESPEC
+#
+# See
+#	http://reality.sgi.com/grafica/sgiimage.html
+#
 0	beshort		474		SGI image data
 0	beshort		474		SGI image data
 #>2	byte		0		\b, verbatim
 #>2	byte		0		\b, verbatim
 >2	byte		1		\b, RLE
 >2	byte		1		\b, RLE

+ 14 - 1
Magdir/msdos

@@ -85,6 +85,15 @@
 #
 #
 0	string	MZ		MS-DOS executable (EXE)
 0	string	MZ		MS-DOS executable (EXE)
 >24	string	@		\b, OS/2 or MS Windows
 >24	string	@		\b, OS/2 or MS Windows
+>>0xe7	string	LH/2\ Self-Extract	\b, %s
+>>0xe9	string	PKSFX2		\b, %s
+>0x1c	string	RJSX\xff\xff	\b, ARJ SFX
+>0x1c	string	diet\xf9\x9c	\b, diet compressed
+>0x1e	string	Copyright\ 1989-1990\ PKWARE\ Inc.	\b, PKSFX
+# JM: 0x1e "PKLITE Copr. 1990-92 PKWARE Inc. All Rights Reserved\7\0\0\0"
+>0x1e	string	PKLITE\ Copr.	\b, %.6s compressed
+>0x24	string	LHa's\ SFX	\b, %.15s
+>0x24	string	LHA's\ SFX	\b, %.15s
 >1638	string	-lh5-		\b, LHa SFX archive v2.13S
 >1638	string	-lh5-		\b, LHa SFX archive v2.13S
 >7195	string	Rar!		\b, RAR self-extracting archive
 >7195	string	Rar!		\b, RAR self-extracting archive
 #
 #
@@ -120,6 +129,7 @@
 # but it isn't feasible to match all COM files since there must be at least
 # but it isn't feasible to match all COM files since there must be at least
 # two dozen different one-byte "magics".
 # two dozen different one-byte "magics".
 #0	byte		0xe9		MS-DOS executable (COM)
 #0	byte		0xe9		MS-DOS executable (COM)
+#>6	string	SFX\ of\ LHarc	(%s)
 #0	byte		0x8c		MS-DOS executable (COM)
 #0	byte		0x8c		MS-DOS executable (COM)
 # 0xeb conflicts with "sequent" magic
 # 0xeb conflicts with "sequent" magic
 #0	byte		0xeb		MS-DOS executable (COM)
 #0	byte		0xeb		MS-DOS executable (COM)
@@ -162,4 +172,7 @@
 
 
 # WordPerfect documents - Trevor Johnson <trevor@jpj.net>
 # WordPerfect documents - Trevor Johnson <trevor@jpj.net>
 #
 #
-1       string          WPC             WordPerfect document
+1	string	WPC		WordPerfect document
+
+# Help files
+0	string	?_\3\0		MS Windows Help Data

+ 97 - 0
Magdir/olf

@@ -0,0 +1,97 @@
+
+#------------------------------------------------------------------------------
+# olf:  file(1) magic for OLF executables
+#
+# We have to check the byte order flag to see what byte order all the
+# other stuff in the header is in.
+#
+# MIPS R3000 may also be for MIPS R2000.
+# What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
+#
+# Created by Erik Theisen <etheisen@openbsd.org>
+# Based on elf from Daniel Quinlan <quinlan@yggdrasil.com>
+0	string		\177OLF		OLF
+>4	byte		0		invalid class
+>4	byte		1		32-bit
+>4	byte		2		64-bit
+>7	byte		0		invalid os
+>7	byte		1		OpenBSD
+>7	byte		2		NetBSD
+>7	byte		3		FreeBSD
+>7	byte		4		4.4BSD
+>7	byte		5		Linux
+>7	byte		6		SVR4
+>7	byte		7		esix
+>7	byte		8		Solaris
+>7	byte		9		Irix
+>7	byte		10		SCO
+>7	byte		11		Dell
+>7	byte		12		NCR
+>5	byte		0		invalid byte order
+>5	byte		1		LSB
+>>16	leshort		0		no file type,
+>>16	leshort		1		relocatable,
+>>16	leshort		2		executable,
+>>16	leshort		3		shared object,
+# Core handling from Peter Tobias <tobias@server.et-inf.fho-emden.de>
+# corrections by Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de>
+>>16	leshort		4		core file
+>>>(0x38+0xcc) string	>\0		of '%s'
+>>>(0x38+0x10) lelong	>0		(signal %d),
+>>16	leshort		&0xff00		processor-specific,
+>>18	leshort		0		no machine,
+>>18	leshort		1		AT&T WE32100 - invalid byte order,
+>>18	leshort		2		SPARC - invalid byte order,
+>>18	leshort		3		Intel 80386,
+>>18	leshort		4		Motorola 68000 - invalid byte order,
+>>18	leshort		5		Motorola 88000 - invalid byte order,
+>>18	leshort		6		Intel 80486,
+>>18	leshort		7		Intel 80860,
+>>18	leshort		8		MIPS R3000_BE - invalid byte order,
+>>18	leshort		9		Amdahl - invalid byte order,
+>>18	leshort		10		MIPS R3000_LE,
+>>18	leshort		11		RS6000 - invalid byte order,
+>>18	leshort		15		PA-RISC - invalid byte order,
+>>18	leshort		16		nCUBE,
+>>18	leshort		17		VPP500,
+>>18	leshort		18		SPARC32PLUS,
+>>18	leshort		20		PowerPC,
+>>18	leshort		0x9026		Alpha,
+>>20	lelong		0		invalid version
+>>20	lelong		1		version 1
+>>36	lelong		1		MathCoPro/FPU/MAU Required
+>8	string		>\0		(%s)
+>5	byte		2		MSB
+>>16	beshort		0		no file type,
+>>16	beshort		1		relocatable,
+>>16	beshort		2		executable,
+>>16	beshort		3		shared object,
+>>16	beshort		4		core file,
+>>>(0x38+0xcc) string	>\0		of '%s'
+>>>(0x38+0x10) belong	>0		(signal %d),
+>>16	beshort		&0xff00		processor-specific,
+>>18	beshort		0		no machine,
+>>18	beshort		1		AT&T WE32100,
+>>18	beshort		2		SPARC,
+>>18	beshort		3		Intel 80386 - invalid byte order,
+>>18	beshort		4		Motorola 68000,
+>>18	beshort		5		Motorola 88000,
+>>18	beshort		6		Intel 80486 - invalid byte order,
+>>18	beshort		7		Intel 80860,
+>>18	beshort		8		MIPS R3000_BE,
+>>18	beshort		9		Amdahl,
+>>18	beshort		10		MIPS R3000_LE - invalid byte order,
+>>18	beshort		11		RS6000,
+>>18	beshort		15		PA-RISC,
+>>18	beshort		16		nCUBE,
+>>18	beshort		17		VPP500,
+>>18	beshort		18		SPARC32PLUS,
+>>18	beshort		20		PowerPC or cisco 4500,
+>>18	beshort		21		cisco 7500,
+>>18	beshort		24		cisco SVIP,
+>>18	beshort		25		cisco 7200,
+>>18	beshort		36		cisco 12000,
+>>18	beshort		0x9026		Alpha,
+>>20	belong		0		invalid version
+>>20	belong		1		version 1
+>>36	belong		1		MathCoPro/FPU/MAU Required

+ 23 - 0
Magdir/os2

@@ -0,0 +1,23 @@
+
+#------------------------------------------------------------------------------
+# os2:  file(1) magic for OS/2 files
+#
+
+# Provided 1998/08/22 by
+# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net>
+1	string	InternetShortcut	MS Windows 95 Internet shortcut text
+>24	string	>\			(URL=<%s>)
+
+# OS/2 URL objects
+# Provided 1998/08/22 by
+# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net>
+0	string	http:			OS/2 URL object text
+>5	string	>\			(WWW) <http:%s>
+0	string	mailto:			OS/2 URL object text
+>7	string	>\			(email) <%s>
+0	string	news:			OS/2 URL object text
+>5	string	>\			(Usenet) <%s>
+0	string	ftp:			OS/2 URL object text
+>4	string	>\			(FTP) <ftp:%s>
+0	string	file:			OS/2 URL object text
+>5	string	>\			(Local file) <%s>

+ 10 - 0
Magdir/pdp

@@ -23,3 +23,13 @@
 >15	byte		>0		- version %ld
 >15	byte		>0		- version %ld
 
 
 0	leshort		0437		PDP-11 kernel overlay
 0	leshort		0437		PDP-11 kernel overlay
+
+# These last three are derived from 2.11BSD file(1)
+0	leshort		0413		PDP-11 demand-paged pure executable
+>8	leshort		>0		not stripped
+
+0	leshort		0430		PDP-11 overlaid pure executable
+>8	leshort		>0		not stripped
+
+0	leshort		0431		PDP-11 overlaid separate executable
+>8	leshort		>0		not stripped

+ 10 - 0
Magdir/printer

@@ -18,6 +18,16 @@
 >>>16	string		Query		- type %s
 >>>16	string		Query		- type %s
 >>>16	string		ExitServer	- type %s
 >>>16	string		ExitServer	- type %s
 
 
+# DOS EPS Binary File Header
+# From: Ed Sznyter <ews@Black.Market.NET>
+0       belong          0xC5D0D3C6      DOS EPS Binary File
+>4      long            >0              Postscript starts at byte %d
+>>8     long            >0              length %d
+>>>12   long            >0              Metafile starts at byte %d
+>>>>16  long            >0              length %d
+>>>20   long            >0              TIFF starts at byte %d
+>>>>24  long            >0              length %d
+
 # Adobe's PostScript Printer Description (PPD) files
 # Adobe's PostScript Printer Description (PPD) files
 #       Yves Arrouye <arrouye@marin.fdn.fr>
 #       Yves Arrouye <arrouye@marin.fdn.fr>
 #
 #

+ 93 - 0
Magdir/riff

@@ -0,0 +1,93 @@
+
+#------------------------------------------------------------------------------
+# riff:  file(1) magic for RIFF format
+# See
+#
+#	http://www.seanet.com/users/matts/riffmci/riffmci.htm
+#
+# and
+#
+#	http://www.ora.com/centers/gff/formats/micriff/index.htm
+#
+# and
+#
+#	http://www.jtauber.com/music/encoding/niff/spec/
+#
+0	string		RIFF		RIFF (little-endian) data
+# RIFF Palette format
+>8	string		PAL		\b, palette
+>>16	leshort		x		\b, version %d
+>>18	leshort		x		\b, %d entries
+# RIFF Device Independent Bitmap format
+>8	string		RDIB		\b, device-independent bitmap
+>>16	string		BM		
+>>>30	leshort		12		\b, OS/2 1.x format
+>>>>34	leshort		x		\b, %d x
+>>>>36	leshort		x		%d
+>>>30	leshort		64		\b, OS/2 2.x format
+>>>>34	leshort		x		\b, %d x
+>>>>36	leshort		x		%d
+>>>30	leshort		40		\b, Windows 3.x format
+>>>>34	lelong		x		\b, %d x
+>>>>38	lelong		x		%d x
+>>>>44	leshort		x		%d
+# RIFF MIDI format
+>8	string		RMID		\b, MIDI
+# RIFF Multimedia Movie File format
+>8	string		RMMP		\b, multimedia movie
+# Microsoft WAVE format (*.wav)
+>8	string		WAVE		\b, WAVE audio
+>>20	leshort		1		\b, Microsoft PCM
+>>>34	leshort		>0		\b, %d bit
+>>22	leshort		=1		\b, mono
+>>22	leshort		=2		\b, stereo
+>>22	leshort		>2		\b, %d channels
+>>24	lelong		>0		%d Hz
+# AVI == Audio Video Interleave
+>8      string          AVI\            \b, AVI
+# Animated Cursor format
+>8	string		ACON		\b, animated cursor
+
+#
+# XXX - some of the below may only appear in little-endian form.
+#
+# Also "MV93" appears to be for one form of Macromedia Director
+# files, and "GDMF" appears to be another multimedia format.
+#
+0	string		RIFX		RIFF (big-endian) data
+# RIFF Palette format
+>8	string		PAL		\b, palette
+>>16	beshort		x		\b, version %d
+>>18	beshort		x		\b, %d entries
+# RIFF Device Independent Bitmap format
+>8	string		RDIB		\b, device-independent bitmap
+>>16	string		BM		
+>>>30	beshort		12		\b, OS/2 1.x format
+>>>>34	beshort		x		\b, %d x
+>>>>36	beshort		x		%d
+>>>30	beshort		64		\b, OS/2 2.x format
+>>>>34	beshort		x		\b, %d x
+>>>>36	beshort		x		%d
+>>>30	beshort		40		\b, Windows 3.x format
+>>>>34	belong		x		\b, %d x
+>>>>38	belong		x		%d x
+>>>>44	beshort		x		%d
+# RIFF MIDI format
+>8	string		RMID		\b, MIDI
+# RIFF Multimedia Movie File format
+>8	string		RMMP		\b, multimedia movie
+# Microsoft WAVE format (*.wav)
+>8	string		WAVE		\b, WAVE audio
+>>20	leshort		1		\b, Microsoft PCM
+>>>34	leshort		>0		\b, %d bit
+>>22	beshort		=1		\b, mono
+>>22	beshort		=2		\b, stereo
+>>22	beshort		>2		\b, %d channels
+>>24	belong		>0		%d Hz
+# AVI == Audio Video Interleave
+>8      string          AVI\            \b, AVI
+# Animated Cursor format
+>8	string		ACON		\b, animated cursor
+# Notation Interchange File Format (big-endian only)
+>8	string		NIFF		\b, Notation Interchange File Format
+

+ 4 - 0
Magdir/teapot

@@ -0,0 +1,4 @@
+#------------------------------------------------------------------------------
+# teapot:  file(1) magic for "teapot" spreadsheet
+#
+0       string          #!teapot\012xdr      teapot work sheet (XDR format)

+ 11 - 0
Magdir/tex

@@ -34,3 +34,14 @@
 0	string		\\setlength	LaTeX document text
 0	string		\\setlength	LaTeX document text
 0	string		\\documentstyle	LaTeX document text
 0	string		\\documentstyle	LaTeX document text
 0	string		\\chapter	LaTeX document text
 0	string		\\chapter	LaTeX document text
+0	string		\\documentclass	LaTeX 2e document text
+0	string		\\relax		LaTeX auxiliary file
+0	string		\\contentsline	LaTeX  table of contents
+
+# Index and glossary files
+0	string		\\indexentry	LaTeX raw index file
+0	string		\\begin{theindex}	LaTeX sorted index
+0	string		\\glossaryentry	LaTeX raw glossary
+0	string		\\begin{theglossary}	LaTeX sorted glossary
+0	string		This\ is\ makeindex	Makeindex log file
+# End of TeX

+ 6 - 6
Magdir/timezone

@@ -6,9 +6,9 @@
 # this should work on Linux, SunOS, and maybe others
 # this should work on Linux, SunOS, and maybe others
 # Added new official magic number for recent versions of the Olson code
 # Added new official magic number for recent versions of the Olson code
 0	string	TZif	timezone data
 0	string	TZif	timezone data
-0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0	timezone data
-0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0	timezone data
-0	string  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0	timezone data
-0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0	timezone data
-0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0	timezone data
-0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0	timezone data
+0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0	old timezone data
+0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0	old timezone data
+0	string  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0	old timezone data
+0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0	old timezone data
+0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0	old timezone data
+0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0	old timezone data

+ 0 - 26
Magdir/vgetty

@@ -1,26 +0,0 @@
-#
-# Magic data for vgetty voice formats
-# (Martin Seine & Marc Eberhard)
-#
-
-#
-# raw modem data version 1
-#
-
-0    string    RMD1      raw modem data
->4   string    >\0       (%s /
->20  short     >0        compression type 0x%04x)
-
-#
-# portable voice format 1
-#
-
-0    string    PVF1\n         portable voice format
->5   string    >\0       (binary %s)
-
-#
-# portable voice format 2
-#
-
-0    string    PVF2\n         portable voice format
->5   string >\0          (ascii %s)

+ 16 - 0
Magdir/vicar

@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# vicar:  file(1) magic for VICAR files.
+#
+# From: Ossama Othman <othman@astrosun.tn.cornell.edu
+# VICAR is JPL's in-house spacecraft image processing program
+# VICAR image
+0	string	LBLSIZE=	VICAR image data
+>32	string	BYTE		\b, 8 bits  = VAX byte
+>32	string	HALF		\b, 16 bits = VAX word     = Fortran INTEGER*2
+>32	string	FULL		\b, 32 bits = VAX longword = Fortran INTEGER*4
+>32	string	REAL		\b, 32 bits = VAX longword = Fortran REAL*4
+>32	string	DOUB		\b, 64 bits = VAX quadword = Fortran REAL*8
+>32	string	COMPLEX		\b, 64 bits = VAX quadword = Fortran COMPLEX*8
+# VICAR label file
+43	string	SFDU_LABEL	VICAR label file

+ 9 - 9
Makefile.in

@@ -1,6 +1,6 @@
 # Makefile for file(1) cmd. 
 # Makefile for file(1) cmd. 
 # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
 # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
-# @(#)$Id: Makefile.in,v 1.3 1998/02/15 23:21:17 christos Exp $
+# @(#)$Id: Makefile.in,v 1.5 1998/09/12 13:17:52 christos Exp $
 #
 #
 # This software is not subject to any license of the American Telephone
 # This software is not subject to any license of the American Telephone
 # and Telegraph Company or of the Regents of the University of California.
 # and Telegraph Company or of the Regents of the University of California.
@@ -21,7 +21,7 @@
 #    ever read sources, credits must appear in the documentation.
 #    ever read sources, credits must appear in the documentation.
 #
 #
 # 4. This notice may not be removed or altered.
 # 4. This notice may not be removed or altered.
-VERSION	= 3.24
+VERSION	= 3.26
 SHELL	= /bin/sh
 SHELL	= /bin/sh
 #MAGIC	= /etc/magic
 #MAGIC	= /etc/magic
 prefix = @prefix@
 prefix = @prefix@
@@ -30,14 +30,14 @@ INSTALL_DATA = @INSTALL_DATA@
 MAGICDIR = @datadir@/misc
 MAGICDIR = @datadir@/misc
 MAGIC	= $(MAGICDIR)/magic
 MAGIC	= $(MAGICDIR)/magic
 LOCALMAGIC	= $(DESTDIR)/etc/magic
 LOCALMAGIC	= $(DESTDIR)/etc/magic
-DEFS	= -DMAGIC='"$(LOCALMAGIC):$(MAGIC)"' -DBUILTIN_ELF -DHAVE_CONFIG_H
+DEFS	= -DMAGIC='"$(LOCALMAGIC):$(MAGIC)"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H
 CPPFLAGS = $(DEFS)
 CPPFLAGS = $(DEFS)
 CC	= @CC@
 CC	= @CC@
 #COPTS	= -O -g		# newer compilers allow both; else drop -O
 #COPTS	= -O -g		# newer compilers allow both; else drop -O
 # For truly antique environments, use this for (dummy) include files:
 # For truly antique environments, use this for (dummy) include files:
 #COPTS	= -O # -Ilocalinc
 #COPTS	= -O # -Ilocalinc
 #CFLAGS	= $(COPTS) $(DEFS)
 #CFLAGS	= $(COPTS) $(DEFS)
-CFLAGS = @CFLAGS@
+CFLAGS = -I. @CFLAGS@
 #LDFLAGS	= $(COPTS) # -Bstatic	# older gdb couldn't handle shared libs
 #LDFLAGS	= $(COPTS) # -Bstatic	# older gdb couldn't handle shared libs
 SHAR	= bundle
 SHAR	= bundle
 OFILE	= /usr/bin/file		# old or distributed version, for comparison
 OFILE	= /usr/bin/file		# old or distributed version, for comparison
@@ -86,8 +86,9 @@ HDRS = file.h names.h patchlevel.h readelf.h tar.h
 
 
 AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
 AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
 ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \
 ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \
-	 Makefile.std file.man magic.man magic2mime $(AUTOSRC)
-ALLMAGIC =   Magdir/Makefile Magdir/Localstuff Magdir/Header Magdir/[a-z]*
+	 Makefile.std file.man magic.man magic2mime $(AUTOSRC) \
+	 Localstuff Header
+ALLMAGIC =   Magdir/[a-z]*
 
 
 all:		file magic file.${MANCEXT} magic.${MANFEXT}
 all:		file magic file.${MANCEXT} magic.${MANFEXT}
 
 
@@ -103,9 +104,8 @@ file:		$(OBJS)
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 lint:		$(SRCS)
 lint:		$(SRCS)
 		lint -ha $(DEFS) $(SRCS) | tee $@
 		lint -ha $(DEFS) $(SRCS) | tee $@
-magic:		Magdir
-#		Magdir/Makefile's "install" mv's magic to here for testing.
-		cd Magdir; $(MAKE) install
+magic:		Header Localstuff Magdir
+		cat Header Localstuff Magdir/[a-z]* > $@
 
 
 ascmagic.o:	names.h
 ascmagic.o:	names.h
 
 

+ 7 - 7
Makefile.std

@@ -1,6 +1,6 @@
 # Makefile for file(1) cmd. 
 # Makefile for file(1) cmd. 
 # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
 # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
-# @(#)$Id: Makefile.std,v 1.3 1998/02/15 23:21:17 christos Exp $
+# @(#)$Id: Makefile.std,v 1.5 1998/09/12 13:17:52 christos Exp $
 #
 #
 # This software is not subject to any license of the American Telephone
 # This software is not subject to any license of the American Telephone
 # and Telegraph Company or of the Regents of the University of California.
 # and Telegraph Company or of the Regents of the University of California.
@@ -21,7 +21,7 @@
 #    ever read sources, credits must appear in the documentation.
 #    ever read sources, credits must appear in the documentation.
 #
 #
 # 4. This notice may not be removed or altered.
 # 4. This notice may not be removed or altered.
-VERSION	= 3.24
+VERSION	= 3.26
 SHELL	= /bin/sh
 SHELL	= /bin/sh
 #MAGIC	= /etc/magic
 #MAGIC	= /etc/magic
 MAGIC	= /usr/local/etc/magic
 MAGIC	= /usr/local/etc/magic
@@ -79,8 +79,9 @@ HDRS = file.h names.h patchlevel.h readelf.h tar.h
 
 
 AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
 AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
 ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \
 ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \
-	 Makefile.std file.man magic.man magic2mime $(AUTOSRC)
-ALLMAGIC =   Magdir/Makefile Magdir/Localstuff Magdir/Header Magdir/[a-z]*
+	 Makefile.std file.man magic.man magic2mime $(AUTOSRC) \
+	 Localstuff Header
+ALLMAGIC =   Magdir/[a-z]*
 
 
 all:		file magic file.${MANCEXT} magic.${MANFEXT}
 all:		file magic file.${MANCEXT} magic.${MANFEXT}
 
 
@@ -96,9 +97,8 @@ file:		$(OBJS)
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 lint:		$(SRCS)
 lint:		$(SRCS)
 		lint -ha $(DEFS) $(SRCS) | tee $@
 		lint -ha $(DEFS) $(SRCS) | tee $@
-magic:		Magdir
-#		Magdir/Makefile's "install" mv's magic to here for testing.
-		cd Magdir; $(MAKE) install
+magic:		Localstuff Header Magdir
+		cat Header Localstuff Magdir/[a-z] > $@
 
 
 ascmagic.o:	names.h
 ascmagic.o:	names.h
 
 

+ 17 - 6
apprentice.c

@@ -25,6 +25,9 @@
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
@@ -32,9 +35,8 @@
 #include <errno.h>
 #include <errno.h>
 #include "file.h"
 #include "file.h"
 
 
-#if 0
-static char *moduleid = 
-	"@(#)$Id: apprentice.c,v 1.25 1997/01/15 17:23:24 christos Exp $";
+#ifndef	lint
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.28 1998/09/12 13:17:52 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #define	EATAB {while (isascii((unsigned char) *l) && \
 #define	EATAB {while (isascii((unsigned char) *l) && \
@@ -229,16 +231,25 @@ int *ndx, check;
 		 */
 		 */
 		if (*l == '.') {
 		if (*l == '.') {
 			l++;
 			l++;
-			switch (LOWCASE(*l)) {
+			switch (*l) {
 			case 'l':
 			case 'l':
-				m->in.type = LONG;
+				m->in.type = LELONG;
+				break;
+			case 'L':
+				m->in.type = BELONG;
 				break;
 				break;
 			case 'h':
 			case 'h':
 			case 's':
 			case 's':
-				m->in.type = SHORT;
+				m->in.type = LESHORT;
+				break;
+			case 'H':
+			case 'S':
+				m->in.type = BESHORT;
 				break;
 				break;
 			case 'c':
 			case 'c':
 			case 'b':
 			case 'b':
+			case 'C':
+			case 'B':
 				m->in.type = BYTE;
 				m->in.type = BYTE;
 				break;
 				break;
 			default:
 			default:

+ 5 - 3
ascmagic.c

@@ -26,6 +26,9 @@
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 #include <memory.h>
 #include <memory.h>
@@ -35,9 +38,8 @@
 #include "file.h"
 #include "file.h"
 #include "names.h"
 #include "names.h"
 
 
-#if 0
-static char *moduleid = 
-	"@(#)$Id: ascmagic.c,v 1.22 1998/02/15 23:18:53 christos Exp $";
+#ifndef	lint
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.23 1998/06/27 13:23:39 christos Exp $");
 #endif	/* lint */
 #endif	/* lint */
 
 
 			/* an optimisation over plain strcmp() */
 			/* an optimisation over plain strcmp() */

+ 13 - 8
compress.c

@@ -5,17 +5,22 @@
  *		   information if recognized
  *		   information if recognized
  *	uncompress(method, old, n, newch) - uncompress old into new, 
  *	uncompress(method, old, n, newch) - uncompress old into new, 
  *					    using method, return sizeof new
  *					    using method, return sizeof new
- * $Id: compress.c,v 1.10 1998/02/15 23:18:53 christos Exp $
  */
  */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <string.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/types.h>
-#include "file.h"
 #ifdef HAVE_SYS_WAIT_H
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #include <sys/wait.h>
 #endif
 #endif
+#include "file.h"
+#ifndef lint
+FILE_RCSID("@(#)$Id: compress.c,v 1.12 1998/06/27 13:57:23 christos Exp $")
+#endif
 
 
 
 
 static struct {
 static struct {
@@ -26,7 +31,6 @@ static struct {
 } compr[] = {
 } compr[] = {
     { "\037\235", 2, { "uncompress", "-c", NULL }, 0 },	/* compressed */
     { "\037\235", 2, { "uncompress", "-c", NULL }, 0 },	/* compressed */
     { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 },	/* gzipped */
     { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 },	/* gzipped */
-/*  { "BZh",      3, { "bzip2","-ds" , NULL }, 0 },	   bzip2 */
     { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 },	/* frozen */
     { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 },	/* frozen */
     { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 },	/* SCO LZH */
     { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 },	/* SCO LZH */
     /* the standard pack utilities do not accept standard input */
     /* the standard pack utilities do not accept standard input */
@@ -95,19 +99,20 @@ int n;
 		if (compr[method].silent)
 		if (compr[method].silent)
 		    (void) close(2);
 		    (void) close(2);
 
 
-		execvp(compr[method].argv[0], (char *const*)compr[method].argv);
-		error("could not execute `%s' (%m).\n", 
-		      compr[method].argv[0]);
+		execvp(compr[method].argv[0],
+		       (char *const *)compr[method].argv);
+		error("could not execute `%s' (%s).\n", 
+		      compr[method].argv[0], strerror(errno));
 		/*NOTREACHED*/
 		/*NOTREACHED*/
 	case -1:
 	case -1:
-		error("could not fork (%m).\n");
+		error("could not fork (%s).\n", strerror(errno));
 		/*NOTREACHED*/
 		/*NOTREACHED*/
 
 
 	default: /* parent */
 	default: /* parent */
 		(void) close(fdin[0]);
 		(void) close(fdin[0]);
 		(void) close(fdout[1]);
 		(void) close(fdout[1]);
 		if (write(fdin[1], old, n) != n) {
 		if (write(fdin[1], old, n) != n) {
-			error("write failed (%m).\n");
+			error("write failed (%s).\n", strerror(errno));
 			/*NOTREACHED*/
 			/*NOTREACHED*/
 		}
 		}
 		(void) close(fdin[1]);
 		(void) close(fdin[1]);

+ 10 - 0
config.h.in

@@ -23,3 +23,13 @@
 
 
 /* The number of bytes in a long.  */
 /* The number of bytes in a long.  */
 #undef SIZEOF_LONG
 #undef SIZEOF_LONG
+
+#if(SIZEOF_INT==4)
+typedef int int32;
+typedef unsigned int uint32;
+#elif(SIZEOF_LONG==4)
+typedef long int32;
+typedef unsigned long uint32;
+#else
+#error "Can't find 32 bit types!!"
+#endif

+ 192 - 110
configure

@@ -1,7 +1,7 @@
 #! /bin/sh
 #! /bin/sh
 
 
 # Guess values for system-dependent variables and create Makefiles.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.12.2 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
 # This configure script is free software; the Free Software Foundation
@@ -49,6 +49,7 @@ mandir='${prefix}/man'
 # Initialize some other variables.
 # Initialize some other variables.
 subdirs=
 subdirs=
 MFLAGS= MAKEFLAGS=
 MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
 # Maximum number of lines to put in a shell here document.
 # Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 ac_max_here_lines=12
 
 
@@ -332,7 +333,7 @@ EOF
     verbose=yes ;;
     verbose=yes ;;
 
 
   -version | --version | --versio | --versi | --vers)
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.12.2"
     exit 0 ;;
     exit 0 ;;
 
 
   -with-* | --with-*)
   -with-* | --with-*)
@@ -502,9 +503,11 @@ ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 cross_compiling=$ac_cv_prog_cc_cross
 
 
+ac_exeext=
+ac_objext=o
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -523,15 +526,16 @@ fi
 # Extract the first word of "gcc", so it can be a program name with args.
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:527: checking for $ac_word" >&5
+echo "configure:530: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   if test -n "$CC"; then
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_CC="gcc"
       ac_cv_prog_CC="gcc"
@@ -552,16 +556,17 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:556: checking for $ac_word" >&5
+echo "configure:560: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   if test -n "$CC"; then
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
   ac_prog_rejected=no
-  for ac_dir in $PATH; do
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
     if test -f $ac_dir/$ac_word; then
       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -596,25 +601,61 @@ else
   echo "$ac_t""no" 1>&6
   echo "$ac_t""no" 1>&6
 fi
 fi
 
 
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:611: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 fi
 
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:643: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 
 ac_ext=c
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 cross_compiling=$ac_cv_prog_cc_cross
 
 
-cat > conftest.$ac_ext <<EOF
-#line 614 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 654 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
+
 main(){return(0);}
 main(){return(0);}
 EOF
 EOF
-if { (eval echo configure:618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
   if (./conftest; exit) 2>/dev/null; then
@@ -628,18 +669,24 @@ else
   ac_cv_prog_cc_works=no
   ac_cv_prog_cc_works=no
 fi
 fi
 rm -fr conftest*
 rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:638: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 cross_compiling=$ac_cv_prog_cc_cross
 
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:643: checking whether we are using GNU C" >&5
+echo "configure:690: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -648,7 +695,7 @@ else
   yes;
   yes;
 #endif
 #endif
 EOF
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
   ac_cv_prog_gcc=yes
 else
 else
   ac_cv_prog_gcc=no
   ac_cv_prog_gcc=no
@@ -659,11 +706,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
 
 if test $ac_cv_prog_gcc = yes; then
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
   GCC=yes
-  ac_test_CFLAGS="${CFLAGS+set}"
-  ac_save_CFLAGS="$CFLAGS"
-  CFLAGS=
-  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:667: checking whether ${CC-cc} accepts -g" >&5
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:718: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -678,16 +729,20 @@ rm -f conftest*
 fi
 fi
 
 
 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-  if test "$ac_test_CFLAGS" = set; then
-    CFLAGS="$ac_save_CFLAGS"
-  elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
     CFLAGS="-g -O2"
     CFLAGS="-g -O2"
   else
   else
-    CFLAGS="-O2"
+    CFLAGS="-g"
   fi
   fi
 else
 else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
 fi
 fi
 
 
 ac_aux_dir=
 ac_aux_dir=
@@ -716,28 +771,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 # SunOS /usr/etc/install
 # SunOS /usr/etc/install
 # IRIX /sbin/install
 # IRIX /sbin/install
 # AIX /bin/install
 # AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:724: checking for a BSD compatible install" >&5
+echo "configure:780: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
-    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
   for ac_dir in $PATH; do
   for ac_dir in $PATH; do
     # Account for people who put trailing slashes in PATH elements.
     # Account for people who put trailing slashes in PATH elements.
     case "$ac_dir/" in
     case "$ac_dir/" in
     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
     *)
     *)
       # OSF1 and SCO ODT 3.0 have their own names for install.
       # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in ginstall installbsd scoinst install; do
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
         if test -f $ac_dir/$ac_prog; then
         if test -f $ac_dir/$ac_prog; then
 	  if test $ac_prog = install &&
 	  if test $ac_prog = install &&
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    # AIX install.  It has an incompatible calling convention.
-	    # OSF/1 installbsd also uses dspmsg, but is usable.
 	    :
 	    :
 	  else
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -767,10 +824,12 @@ echo "$ac_t""$INSTALL" 1>&6
 # It thinks the first close brace ends the variable substitution.
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
 
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:774: checking whether ln -s works" >&5
+echo "configure:833: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -792,12 +851,12 @@ fi
 
 
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:796: checking for working const" >&5
+echo "configure:855: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 801 "configure"
+#line 860 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 
 
 int main() {
 int main() {
@@ -846,7 +905,7 @@ ccp = (char const *const *) p;
 
 
 ; return 0; }
 ; return 0; }
 EOF
 EOF
-if { (eval echo configure:850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   rm -rf conftest*
   ac_cv_c_const=yes
   ac_cv_c_const=yes
 else
 else
@@ -867,7 +926,7 @@ EOF
 fi
 fi
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:871: checking how to run the C preprocessor" >&5
+echo "configure:930: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
   CPP=
@@ -882,14 +941,14 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 886 "configure"
+#line 945 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <assert.h>
 #include <assert.h>
 Syntax Error
 Syntax Error
 EOF
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
 if test -z "$ac_err"; then
   :
   :
 else
 else
@@ -899,14 +958,31 @@ else
   rm -rf conftest*
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 903 "configure"
+#line 962 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <assert.h>
 #include <assert.h>
 Syntax Error
 Syntax Error
 EOF
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 979 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
 if test -z "$ac_err"; then
   :
   :
 else
 else
@@ -919,6 +995,8 @@ fi
 rm -f conftest*
 rm -f conftest*
 fi
 fi
 rm -f conftest*
 rm -f conftest*
+fi
+rm -f conftest*
   ac_cv_prog_CPP="$CPP"
   ac_cv_prog_CPP="$CPP"
 fi
 fi
   CPP="$ac_cv_prog_CPP"
   CPP="$ac_cv_prog_CPP"
@@ -928,12 +1006,12 @@ fi
 echo "$ac_t""$CPP" 1>&6
 echo "$ac_t""$CPP" 1>&6
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:932: checking for ANSI C header files" >&5
+echo "configure:1010: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 937 "configure"
+#line 1015 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdarg.h>
@@ -941,8 +1019,8 @@ else
 #include <float.h>
 #include <float.h>
 EOF
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
 if test -z "$ac_err"; then
   rm -rf conftest*
   rm -rf conftest*
   ac_cv_header_stdc=yes
   ac_cv_header_stdc=yes
@@ -958,7 +1036,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 cat > conftest.$ac_ext <<EOF
-#line 962 "configure"
+#line 1040 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <string.h>
 #include <string.h>
 EOF
 EOF
@@ -976,7 +1054,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 cat > conftest.$ac_ext <<EOF
-#line 980 "configure"
+#line 1058 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdlib.h>
 EOF
 EOF
@@ -997,7 +1075,7 @@ if test "$cross_compiling" = yes; then
   :
   :
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1001 "configure"
+#line 1079 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <ctype.h>
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1008,7 +1086,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 exit (0); }
 
 
 EOF
 EOF
-if { (eval echo configure:1012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
 then
   :
   :
 else
 else
@@ -1032,12 +1110,12 @@ EOF
 fi
 fi
 
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1036: checking for off_t" >&5
+echo "configure:1114: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1041 "configure"
+#line 1119 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/types.h>
 #if STDC_HEADERS
 #if STDC_HEADERS
@@ -1046,7 +1124,7 @@ else
 #endif
 #endif
 EOF
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   rm -rf conftest*
   ac_cv_type_off_t=yes
   ac_cv_type_off_t=yes
 else
 else
@@ -1065,12 +1143,12 @@ EOF
 fi
 fi
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1069: checking for size_t" >&5
+echo "configure:1147: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1074 "configure"
+#line 1152 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/types.h>
 #if STDC_HEADERS
 #if STDC_HEADERS
@@ -1079,7 +1157,7 @@ else
 #endif
 #endif
 EOF
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   rm -rf conftest*
   ac_cv_type_size_t=yes
   ac_cv_type_size_t=yes
 else
 else
@@ -1098,12 +1176,12 @@ EOF
 fi
 fi
 
 
 echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
 echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:1102: checking for st_rdev in struct stat" >&5
+echo "configure:1180: checking for st_rdev in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1107 "configure"
+#line 1185 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
@@ -1111,7 +1189,7 @@ int main() {
 struct stat s; s.st_rdev;
 struct stat s; s.st_rdev;
 ; return 0; }
 ; return 0; }
 EOF
 EOF
-if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   rm -rf conftest*
   ac_cv_struct_st_rdev=yes
   ac_cv_struct_st_rdev=yes
 else
 else
@@ -1131,50 +1209,8 @@ EOF
 
 
 fi
 fi
 
 
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1136: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1141 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-; return 0; }
-EOF
-if { (eval echo configure:1157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_header_sys_wait_h=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_sys_wait_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
-if test $ac_cv_header_sys_wait_h = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_WAIT_H 1
-EOF
-
-fi
-
 echo $ac_n "checking size of int""... $ac_c" 1>&6
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:1178: checking size of int" >&5
+echo "configure:1214: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -1182,7 +1218,7 @@ else
   ac_cv_sizeof_int=4
   ac_cv_sizeof_int=4
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1186 "configure"
+#line 1222 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <stdio.h>
 #include <stdio.h>
 main()
 main()
@@ -1193,7 +1229,7 @@ main()
   exit(0);
   exit(0);
 }
 }
 EOF
 EOF
-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
 then
   ac_cv_sizeof_int=`cat conftestval`
   ac_cv_sizeof_int=`cat conftestval`
 else
 else
@@ -1213,7 +1249,7 @@ EOF
 
 
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:1217: checking size of long" >&5
+echo "configure:1253: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -1221,7 +1257,7 @@ else
   ac_cv_sizeof_long=4
   ac_cv_sizeof_long=4
 else
 else
   cat > conftest.$ac_ext <<EOF
   cat > conftest.$ac_ext <<EOF
-#line 1225 "configure"
+#line 1261 "configure"
 #include "confdefs.h"
 #include "confdefs.h"
 #include <stdio.h>
 #include <stdio.h>
 main()
 main()
@@ -1232,7 +1268,7 @@ main()
   exit(0);
   exit(0);
 }
 }
 EOF
 EOF
-if { (eval echo configure:1236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
 then
   ac_cv_sizeof_long=`cat conftestval`
   ac_cv_sizeof_long=`cat conftestval`
 else
 else
@@ -1252,6 +1288,49 @@ EOF
 
 
 
 
 
 
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1293: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1298 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:1314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+
 trap '' 1 2 15
 trap '' 1 2 15
 cat > confcache <<\EOF
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
 # This file is a shell script that caches the results of configure
@@ -1275,7 +1354,7 @@ EOF
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
 # and sets the high bit in the cache file unless we assign to the vars.
 (set) 2>&1 |
 (set) 2>&1 |
-  case `(ac_space=' '; set) 2>&1` in
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
   *ac_space=\ *)
   *ac_space=\ *)
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # turns \\\\ into \\, and sed turns \\ into \).
     # turns \\\\ into \\, and sed turns \\ into \).
@@ -1342,7 +1421,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.12.2"
     exit 0 ;;
     exit 0 ;;
   -help | --help | --hel | --he | --h)
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -1362,9 +1441,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $ac_vpsub
 $extrasub
 $extrasub
+s%@SHELL@%$SHELL%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
 s%@DEFS@%$DEFS%g
 s%@DEFS@%$DEFS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LIBS@%$LIBS%g
 s%@LIBS@%$LIBS%g
@@ -1385,6 +1466,7 @@ s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
 s%@mandir@%$mandir%g
 s%@CC@%$CC%g
 s%@CC@%$CC%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@LN_S@%$LN_S%g
 s%@LN_S@%$LN_S%g
 s%@CPP@%$CPP%g
 s%@CPP@%$CPP%g

+ 3 - 1
configure.in

@@ -12,8 +12,10 @@ AC_C_CONST
 AC_TYPE_OFF_T
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_TYPE_SIZE_T
 AC_STRUCT_ST_RDEV
 AC_STRUCT_ST_RDEV
-AC_HEADER_SYS_WAIT
 AC_CHECK_SIZEOF(int,4)
 AC_CHECK_SIZEOF(int,4)
 AC_CHECK_SIZEOF(long,4)
 AC_CHECK_SIZEOF(long,4)
 
 
+dnl Checks for headers
+AC_HEADER_SYS_WAIT
+
 AC_OUTPUT(Makefile)
 AC_OUTPUT(Makefile)

+ 1 - 1
debian/README.debian

@@ -2,7 +2,7 @@ This is Debian Linux's prepackaged version of file, a program to
 determine file type using "magic" numbers.
 determine file type using "magic" numbers.
 
 
 This package was assembled by Nicolás Lichtmaier <nick@feedback.net.ar> with
 This package was assembled by Nicolás Lichtmaier <nick@feedback.net.ar> with
-sources from ftp://ftp.astron.com/pub/file/file-3.24.tar.gz .
+sources from ftp://ftp.astron.com/pub/file/file-3.26.tar.gz .
 
 
 This package was previously maintained by Darren Stalder <torin@daft.com>
 This package was previously maintained by Darren Stalder <torin@daft.com>
 and Bill Mitchell <mitchell@debian.org>.
 and Bill Mitchell <mitchell@debian.org>.

+ 1 - 1
debian/control

@@ -1,7 +1,7 @@
 Source: file
 Source: file
 Section: utils
 Section: utils
 Priority: standard
 Priority: standard
-Maintainer: Nicolás Lichtmaier <nick@feedback.net.ar>
+Maintainer: Nicolás Lichtmaier <nick@debian.org>
 Standards-Version: 2.4.0.0
 Standards-Version: 2.4.0.0
 
 
 Package: file
 Package: file

+ 21 - 11
file.c

@@ -24,11 +24,9 @@
  *
  *
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
-#if 0
-static char *moduleid = 
-	"@(#)$Id: file.c,v 1.39 1998/02/15 23:18:53 christos Exp $";
-#endif	/* lint */
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
@@ -36,13 +34,15 @@ static char *moduleid =
 #include <sys/param.h>	/* for MAXPATHLEN */
 #include <sys/param.h>	/* for MAXPATHLEN */
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <fcntl.h>	/* for open() */
 #include <fcntl.h>	/* for open() */
-#if (__COHERENT__ >= 0x420)
-# include <sys/utime.h>
-#else
-# ifdef USE_UTIMES
-#  include <sys/time.h>
+#ifdef RESTORE_TIME
+# if (__COHERENT__ >= 0x420)
+#  include <sys/utime.h>
 # else
 # else
-#  include <utime.h>
+#  ifdef USE_UTIMES
+#   include <sys/time.h>
+#  else
+#   include <utime.h>
+#  endif
 # endif
 # endif
 #endif
 #endif
 #include <unistd.h>	/* for read() */
 #include <unistd.h>	/* for read() */
@@ -53,6 +53,11 @@ static char *moduleid =
 #include "patchlevel.h"
 #include "patchlevel.h"
 #include "file.h"
 #include "file.h"
 
 
+#ifndef	lint
+FILE_RCSID("@(#)$Id: file.c,v 1.42 1998/09/12 13:17:52 christos Exp $")
+#endif	/* lint */
+
+
 #ifdef S_IFLNK
 #ifdef S_IFLNK
 # define USAGE  "Usage: %s [-vbczL] [-f namefile] [-m magicfiles] file...\n"
 # define USAGE  "Usage: %s [-vbczL] [-f namefile] [-m magicfiles] file...\n"
 #else
 #else
@@ -86,6 +91,8 @@ static int	byteconv4	__P((int, int, int));
 static short	byteconv2	__P((int, int, int));
 static short	byteconv2	__P((int, int, int));
 #endif
 #endif
 
 
+int main __P((int, char *[]));
+
 void help()
 void help()
 {
 {
 	puts(
 	puts(
@@ -393,6 +400,9 @@ int wid;
 #ifdef RESTORE_TIME
 #ifdef RESTORE_TIME
 		/*
 		/*
 		 * Try to restore access, modification times if read it.
 		 * Try to restore access, modification times if read it.
+		 * This is really *bad* because it will modify the status
+		 * time of the file... And of course this will affect
+		 * backup programs
 		 */
 		 */
 # ifdef USE_UTIMES
 # ifdef USE_UTIMES
 		struct timeval  utsbuf[2];
 		struct timeval  utsbuf[2];

+ 11 - 22
file.h

@@ -1,6 +1,6 @@
 /*
 /*
  * file.h - definitions for file(1) program
  * file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.25 1997/01/15 19:28:35 christos Exp $
+ * @(#)$Id: file.h,v 1.27 1998/06/27 13:57:23 christos Exp $
  *
  *
  * Copyright (c) Ian F. Darwin, 1987.
  * Copyright (c) Ian F. Darwin, 1987.
  * Written by Ian F. Darwin.
  * Written by Ian F. Darwin.
@@ -29,24 +29,6 @@
 #ifndef __file_h__
 #ifndef __file_h__
 #define __file_h__
 #define __file_h__
 
 
-#if HAVE_CONFIG_H
-#include "config.h"
-
-#if(SIZEOF_INT==4)
-typedef int int32;
-typedef unsigned int uint32;
-#elif(SIZEOF_LONG==4)
-typedef long int32;
-typedef unsigned long uint32;
-#else
-#error "Can't find 32 bit types!!"
-#endif
-
-#else
-typedef int int32;
-typedef unsigned int uint32;
-#endif
-
 #ifndef HOWMANY
 #ifndef HOWMANY
 # define HOWMANY 8192		/* how much of the file to look at */
 # define HOWMANY 8192		/* how much of the file to look at */
 #endif
 #endif
@@ -125,12 +107,10 @@ extern int internatmagic	__P((unsigned char *, int));
 extern void tryelf		__P((int, char *, int));
 extern void tryelf		__P((int, char *, int));
 
 
 
 
-#if 0
 extern int errno;		/* Some unixes don't define this..	*/
 extern int errno;		/* Some unixes don't define this..	*/
-#endif
 
 
 extern char *progname;		/* the program name 			*/
 extern char *progname;		/* the program name 			*/
-extern const char *magicfile;		/* name of the magic file		*/
+extern const char *magicfile;	/* name of the magic file		*/
 extern int lineno;		/* current line number in magic file	*/
 extern int lineno;		/* current line number in magic file	*/
 
 
 extern struct magic *magic;	/* array of magic entries		*/
 extern struct magic *magic;	/* array of magic entries		*/
@@ -167,4 +147,13 @@ extern char *sys_errlist[];
 #define	MAXPATHLEN	512
 #define	MAXPATHLEN	512
 #endif
 #endif
 
 
+#ifdef __STDC__
+#define FILE_RCSID(id) \
+static const char *rcsid(const char *p) { \
+	return rcsid(p = id); \
+}
+#else
+#define FILE_RCSID(id) static char *rcsid[] = id;
+#endif
+
 #endif /* __file_h__ */
 #endif /* __file_h__ */

+ 7 - 3
fsmagic.c

@@ -25,6 +25,9 @@
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/types.h>
@@ -48,9 +51,10 @@
 		to point at the file that defines the "major" macro.
 		to point at the file that defines the "major" macro.
 #endif	/*major*/
 #endif	/*major*/
 
 
-#if 0
-static char *moduleid = 
-	"@(#)$Id: fsmagic.c,v 1.26 1998/02/15 23:18:53 christos Exp $";
+#include "file.h"
+
+#ifndef	lint
+FILE_RCSID("@(#)$Id: fsmagic.c,v 1.27 1998/06/27 13:23:39 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 int
 int

+ 7 - 0
internat.c

@@ -7,11 +7,18 @@
  * ----------------------------------------------------------------------------
  * ----------------------------------------------------------------------------
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include "file.h"
 #include "file.h"
 
 
 #include <string.h>
 #include <string.h>
 #include <memory.h>
 #include <memory.h>
 
 
+#ifndef lint
+FILE_RCSID("@(#)$Id: internat.c,v 1.4 1998/06/27 13:23:39 christos Exp $")
+#endif
+
 #define F 0
 #define F 0
 #define T 1
 #define T 1
 
 

+ 9 - 1
is_tar.c

@@ -5,16 +5,24 @@
  * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
  * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
  *
  *
  * @(#)list.c 1.18 9/23/86 Public Domain - gnu
  * @(#)list.c 1.18 9/23/86 Public Domain - gnu
- * $Id: is_tar.c,v 1.9 1997/01/15 17:23:24 christos Exp $
+ * $Id: is_tar.c,v 1.10 1998/06/27 13:23:39 christos Exp $
  *
  *
  * Comments changed and some code/comments reformatted
  * Comments changed and some code/comments reformatted
  * for file command by Ian Darwin.
  * for file command by Ian Darwin.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <string.h>
 #include <string.h>
 #include <ctype.h>
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include "tar.h"
 #include "tar.h"
+#include "file.h"
+
+#ifndef lint
+FILE_RCSID("@(#)$Id: is_tar.c,v 1.10 1998/06/27 13:23:39 christos Exp $")
+#endif
 
 
 #define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
 #define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
 
 

+ 6 - 4
magic.man

@@ -149,13 +149,15 @@ then the string after the parenthesis is interpreted as an indirect offset.
 That means that the number after the parenthesis is used as an offset in
 That means that the number after the parenthesis is used as an offset in
 the file. The value at that offset is read, and is used again as an offset
 the file. The value at that offset is read, and is used again as an offset
 in the file. Indirect offsets are of the form:
 in the file. Indirect offsets are of the form:
-.BI (( x [.[bsl]][+-][ y ]).
+.BI (( x [.[bslBSL]][+-][ y ]).
 The value of 
 The value of 
 .I x
 .I x
 is used as an offset in the file. A byte, short or long is read at that offset
 is used as an offset in the file. A byte, short or long is read at that offset
 depending on the 
 depending on the 
-.B [bsl] 
-type specifier. To that number the value of
+.B [bslBSL] 
+type specifier. The capitalized types interpret the number as a big endian
+value, whereas the small letter versions interpet the number as a little
+endian value. To that number the value of
 .I y
 .I y
 is added and the result is used as an offset in the file. The default type
 is added and the result is used as an offset in the file. The default type
 if one is not specified is long.
 if one is not specified is long.
@@ -203,4 +205,4 @@ indirect offsets.
 .\" the changes I posted to the S5R2 version.
 .\" the changes I posted to the S5R2 version.
 .\"
 .\"
 .\" Modified for Ian Darwin's version of the file command.
 .\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.14 1996/06/22 22:05:07 christos Exp $
+.\" @(#)$Id: magic.man,v 1.15 1998/08/13 17:32:24 christos Exp $

+ 50 - 11
names.h

@@ -10,22 +10,23 @@
  *
  *
  * See LEGAL.NOTICE
  * See LEGAL.NOTICE
  *
  *
- * $Id: names.h,v 1.13 1997/01/15 17:23:24 christos Exp $
+ * $Id: names.h,v 1.15 1998/09/12 13:17:52 christos Exp $
  */
  */
 
 
 /* these types are used to index the table 'types': keep em in sync! */
 /* these types are used to index the table 'types': keep em in sync! */
-#define L_C	0		/* first and foremost on UNIX */
-#define L_CC	1		/* Bjarne's postincrement */
+#define	L_C	0		/* first and foremost on UNIX */
+#define	L_CC	1		/* Bjarne's postincrement */
 #define	L_FORT	2		/* the oldest one */
 #define	L_FORT	2		/* the oldest one */
-#define L_MAKE	3		/* Makefiles */
-#define L_PLI	4		/* PL/1 */
-#define L_MACH	5		/* some kinda assembler */
-#define L_ENG	6		/* English */
+#define	L_MAKE	3		/* Makefiles */
+#define	L_PLI	4		/* PL/1 */
+#define	L_MACH	5		/* some kinda assembler */
+#define	L_ENG	6		/* English */
 #define	L_PAS	7		/* Pascal */
 #define	L_PAS	7		/* Pascal */
 #define	L_MAIL	8		/* Electronic mail */
 #define	L_MAIL	8		/* Electronic mail */
 #define	L_NEWS	9		/* Usenet Netnews */
 #define	L_NEWS	9		/* Usenet Netnews */
-#define L_JAVA 10		/* Java code */
-#define L_HTML 11		/* HTML */
+#define	L_JAVA	10		/* Java code */
+#define	L_HTML	11		/* HTML */
+#define	L_BCPL	12		/* BCPL */
 
 
 static const char *types[] = {
 static const char *types[] = {
 	"C program text",
 	"C program text",
@@ -40,15 +41,55 @@ static const char *types[] = {
 	"news text",
 	"news text",
 	"Java program text",
 	"Java program text",
 	"HTML document text",
 	"HTML document text",
+	"BCPL program text",
 	"can't happen error on names.h/types",
 	"can't happen error on names.h/types",
 	0};
 	0};
 
 
+/*
+ * XXX - how should we distinguish Java from C++?
+ * The trick used in a Debian snapshot, of having "extends" or "implements"
+ * as tags for Java, doesn't work very well, given that those keywords
+ * are often preceded by "class", which flags it as C++.
+ *
+ * Perhaps we need to be able to say
+ *
+ *	If "class" then
+ *
+ *		if "extends" or "implements" then
+ *			Java
+ *		else
+ *			C++
+ *	endif
+ *
+ * Or should we use other keywords, such as "package" or "import"?
+ * Unfortunately, Ada95 uses "package", and Modula-3 uses "import",
+ * although I infer from the language spec at
+ *
+ *	http://www.research.digital.com/SRC/m3defn/html/m3.html
+ *
+ * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be
+ * in all caps.
+ *
+ * So, for now, we go with "import".  We must put it before the C++
+ * stuff, so that we don't misidentify Java as C++.  Not using "package"
+ * means we won't identify stuff that defines a package but imports
+ * nothing; hopefully, very little Java code imports nothing (one of the
+ * reasons for doing OO programming is to import as much as possible
+ * and write only what you need to, right?).
+ *
+ * Unfortunately, "import" may cause us to misidentify English text
+ * as Java, as it comes after "the" and "The".  Perhaps we need a fancier
+ * heuristic to identify Java?
+ */
 static struct names {
 static struct names {
 	const char *name;
 	const char *name;
 	short type;
 	short type;
 } names[] = {
 } names[] = {
 	/* These must be sorted by eye for optimal hit rate */
 	/* These must be sorted by eye for optimal hit rate */
 	/* Add to this list only after substantial meditation */
 	/* Add to this list only after substantial meditation */
+	{"import",	L_JAVA},
+	{"\"libhdr\"",	L_BCPL},
+	{"\"LIBHDR\"",	L_BCPL},
 	{"//",		L_CC},
 	{"//",		L_CC},
 	{"template",	L_CC},
 	{"template",	L_CC},
 	{"virtual",	L_CC},
 	{"virtual",	L_CC},
@@ -98,8 +139,6 @@ static struct names {
 	{"Newsgroups:",	L_NEWS},
 	{"Newsgroups:",	L_NEWS},
 	{"Path:",	L_NEWS},
 	{"Path:",	L_NEWS},
 	{"Organization:",L_NEWS},
 	{"Organization:",L_NEWS},
-	{"extends",	L_JAVA},
-	{"implements",	L_JAVA},
 	{"href=",	L_HTML},
 	{"href=",	L_HTML},
 	{"HREF=",	L_HTML},
 	{"HREF=",	L_HTML},
 	{"<body",	L_HTML},
 	{"<body",	L_HTML},

+ 15 - 2
patchlevel.h

@@ -1,11 +1,24 @@
 #define	FILE_VERSION_MAJOR	3
 #define	FILE_VERSION_MAJOR	3
-#define	patchlevel		24
+#define	patchlevel		26
 
 
 /*
 /*
  * Patchlevel file for Ian Darwin's MAGIC command.
  * Patchlevel file for Ian Darwin's MAGIC command.
- * $Id: patchlevel.h,v 1.24 1998/02/15 23:20:38 christos Exp $
+ * $Id: patchlevel.h,v 1.26 1998/09/12 13:19:39 christos Exp $
  *
  *
  * $Log: patchlevel.h,v $
  * $Log: patchlevel.h,v $
+ * Revision 1.26  1998/09/12 13:19:39  christos
+ * - add support for bi-endian indirect offsets (Richard Verhoeven)
+ * - add recognition for bcpl (Joseph Myers)
+ * - remove non magic files from Magdir to avoid difficulties building
+ *   on os2 where files are case independent
+ * - magic fixes.
+ *
+ * Revision 1.25  1998/06/27 14:04:04  christos
+ * OLF patch Guy Harris
+ * Recognize java/html (debian linux)
+ * Const poisoning (debian linux)
+ * More magic!
+ *
  * Revision 1.24  1998/02/15 23:20:38  christos
  * Revision 1.24  1998/02/15 23:20:38  christos
  * Autoconf patch: Felix von Leitner <leitner@math.fu-berlin.de>
  * Autoconf patch: Felix von Leitner <leitner@math.fu-berlin.de>
  * More magic fixes
  * More magic fixes

+ 10 - 8
print.c

@@ -25,6 +25,9 @@
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 #if __STDC__
 #if __STDC__
@@ -37,9 +40,8 @@
 #include <time.h>
 #include <time.h>
 #include "file.h"
 #include "file.h"
 
 
-#if 0
-static char *moduleid =
-	"@(#)$Id: print.c,v 1.24 1997/04/13 18:28:30 christos Exp $";
+#ifndef lint
+FILE_RCSID("@(#)$Id: print.c,v 1.26 1998/06/27 13:57:23 christos Exp $")
 #endif  /* lint */
 #endif  /* lint */
 
 
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
@@ -48,10 +50,10 @@ void
 mdump(m)
 mdump(m)
 struct magic *m;
 struct magic *m;
 {
 {
-	static const char *typ[] = {   "invalid", "byte", "short", "invalid",
-				 "long", "string", "date", "beshort",
-				 "belong", "bedate", "leshort", "lelong",
-				 "ledate" };
+	static const char *typ[] = { "invalid", "byte", "short", "invalid",
+				     "long", "string", "date", "beshort",
+				     "belong", "bedate", "leshort", "lelong",
+				     "ledate" };
 	(void) fputc('[', stderr);
 	(void) fputc('[', stderr);
 	(void) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7),
 	(void) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7),
 		       m->offset);
 		       m->offset);
@@ -67,7 +69,7 @@ struct magic *m;
 		       (m->type >= 0 && m->type < SZOF(typ)) ? 
 		       (m->type >= 0 && m->type < SZOF(typ)) ? 
 				typ[(unsigned char) m->type] : 
 				typ[(unsigned char) m->type] : 
 				"*bad*");
 				"*bad*");
-	if (m->mask != ~0L)
+	if (m->mask != ~((uint32)0))
 		(void) fprintf(stderr, " & %.8x", m->mask);
 		(void) fprintf(stderr, " & %.8x", m->mask);
 
 
 	(void) fprintf(stderr, ",%c", m->reln);
 	(void) fprintf(stderr, ",%c", m->reln);

+ 59 - 20
readelf.c

@@ -1,5 +1,8 @@
 
 
 #ifdef BUILTIN_ELF
 #ifdef BUILTIN_ELF
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <sys/types.h>
 #include <sys/types.h>
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -11,6 +14,16 @@
 #include "readelf.h"
 #include "readelf.h"
 #include "file.h"
 #include "file.h"
 
 
+#ifndef lint
+FILE_RCSID("@(#)$Id: readelf.c,v 1.9 1998/09/12 13:21:01 christos Exp $")
+#endif
+
+#ifdef	ELFCORE
+static void dophn_core __P((int, off_t, int, size_t, char *));
+#endif
+static void dophn_exec __P((int, off_t, int, size_t, char *));
+static void doshn __P((int, off_t, int, size_t, char *));
+
 static void
 static void
 doshn(fd, off, num, size, buf)
 doshn(fd, off, num, size, buf)
 	int fd;
 	int fd;
@@ -58,25 +71,29 @@ dophn_exec(fd, off, num, size, buf)
 {
 {
 	/* I am not sure if this works for 64 bit elf formats */
 	/* I am not sure if this works for 64 bit elf formats */
 	Elf32_Phdr *ph = (Elf32_Phdr *) buf;
 	Elf32_Phdr *ph = (Elf32_Phdr *) buf;
+	char *linking_style = "statically";
+	char *shared_libraries = "";
 
 
 	if (lseek(fd, off, SEEK_SET) == -1)
 	if (lseek(fd, off, SEEK_SET) == -1)
-		error("lseek failed (%m).\n");
+		error("lseek failed (%s).\n", strerror(errno));
 
 
   	for ( ; num; num--) {
   	for ( ; num; num--) {
   		if (read(fd, buf, size) == -1)
   		if (read(fd, buf, size) == -1)
-  			error("read failed (%m).\n");
-		if (ph->p_type == PT_INTERP) {
-			/*
-			 * Has an interpreter - must be a dynamically-linked
-			 * executable.
-			 */
-			printf(", dynamically linked");
-			return;
+  			error("read failed (%s).\n", strerror(errno));
+
+		switch (ph->p_type) {
+		case PT_DYNAMIC:
+			linking_style = "dynamically";
+			break;
+		case PT_INTERP:
+			shared_libraries = " (uses shared libs)";
+			break;
 		}
 		}
 	}
 	}
-	printf(", statically linked");
+	printf(", %s linked%s", linking_style, shared_libraries);
 }
 }
 
 
+#ifdef ELFCORE
 size_t	prpsoffsets[] = {
 size_t	prpsoffsets[] = {
 	84,		/* SunOS 5.x */
 	84,		/* SunOS 5.x */
 	32,		/* Linux */
 	32,		/* Linux */
@@ -214,6 +231,7 @@ dophn_core(fd, off, num, size, buf)
 		}
 		}
 	}
 	}
 }
 }
+#endif
 
 
 void
 void
 tryelf(fd, buf, nbytes)
 tryelf(fd, buf, nbytes)
@@ -232,7 +250,8 @@ tryelf(fd, buf, nbytes)
 	 * Instead we traverse thru all section headers until a symbol table
 	 * Instead we traverse thru all section headers until a symbol table
 	 * one is found or else the binary is stripped.
 	 * one is found or else the binary is stripped.
 	 */
 	 */
-	if (buf[EI_MAG0] != ELFMAG0 || buf[EI_MAG1] != ELFMAG1
+	if (buf[EI_MAG0] != ELFMAG0
+	    || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
 	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
 	    || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
 	    return;
 	    return;
 
 
@@ -254,13 +273,18 @@ tryelf(fd, buf, nbytes)
 		 */
 		 */
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
 			if (elfhdr.e_type == ET_CORE) 
 			if (elfhdr.e_type == ET_CORE) 
+#ifdef ELFCORE
 				dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum, 
 				dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum, 
 				      elfhdr.e_phentsize, buf);
 				      elfhdr.e_phentsize, buf);
+#else
+				;
+#endif
 			else {
 			else {
 				if (elfhdr.e_type == ET_EXEC) {
 				if (elfhdr.e_type == ET_EXEC) {
-					dophn_exec(fd, elfhdr.e_phoff,
-					    elfhdr.e_phnum, 
-					      elfhdr.e_phentsize, buf);
+					dophn_exec(fd,
+						   elfhdr.e_phoff,
+						   elfhdr.e_phnum, 
+						   elfhdr.e_phentsize, buf);
 				}
 				}
 				doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum,
 				doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum,
 				      elfhdr.e_shentsize, buf);
 				      elfhdr.e_shentsize, buf);
@@ -286,22 +310,37 @@ tryelf(fd, buf, nbytes)
 		 * byte order....
 		 * byte order....
 		 */
 		 */
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
-#ifdef notyet
 			if (elfhdr.e_type == ET_CORE) 
 			if (elfhdr.e_type == ET_CORE) 
-				dophn_core(fd, elfhdr.e_phoff[1],
+#ifdef ELFCORE
+				dophn_core(fd,
+#ifndef __GNUC__
+					   elfhdr.e_phoff[1],
+#else
+					   elfhdr.e_phoff,
+#endif
 					   elfhdr.e_phnum, 
 					   elfhdr.e_phnum, 
 					   elfhdr.e_phentsize, buf);
 					   elfhdr.e_phentsize, buf);
-			else
+#else
+				;
 #endif
 #endif
+			else
 			{
 			{
-#ifdef notyet
 				if (elfhdr.e_type == ET_EXEC) {
 				if (elfhdr.e_type == ET_EXEC) {
-					dophn_exec(fd, elfhdr.e_phoff[1],
+					dophn_exec(fd,
+#ifndef __GNUC__
+						   elfhdr.e_phoff[1],
+#else
+						   elfhdr.e_phoff,
+#endif
 						   elfhdr.e_phnum, 
 						   elfhdr.e_phnum, 
 						   elfhdr.e_phentsize, buf);
 						   elfhdr.e_phentsize, buf);
 				}
 				}
+				doshn(fd,
+#ifndef __GNUC__
+				      elfhdr.e_shoff[1],
+#else
+				      elfhdr.e_shoff,
 #endif
 #endif
-				doshn(fd, elfhdr.e_shoff[1],
 				      elfhdr.e_shnum,
 				      elfhdr.e_shnum,
 				      elfhdr.e_shentsize, buf);
 				      elfhdr.e_shentsize, buf);
 			}
 			}

+ 11 - 3
readelf.h

@@ -1,6 +1,6 @@
 /*
 /*
  * readelf.h 
  * readelf.h 
- * @(#)$Id: readelf.h,v 1.4 1997/01/15 17:23:24 christos Exp $
+ * @(#)$Id: readelf.h,v 1.6 1998/09/12 13:21:01 christos Exp $
  *
  *
  * Provide elf data structures for non-elf machines, allowing file
  * Provide elf data structures for non-elf machines, allowing file
  * non-elf hosts to determine if an elf binary is stripped.
  * non-elf hosts to determine if an elf binary is stripped.
@@ -10,15 +10,20 @@
 #define __fake_elf_h__
 #define __fake_elf_h__
 
 
 typedef unsigned int	Elf32_Addr;
 typedef unsigned int	Elf32_Addr;
-typedef unsigned short	Elf32_Half;
 typedef unsigned int	Elf32_Off;
 typedef unsigned int	Elf32_Off;
+typedef unsigned short	Elf32_Half;
 typedef unsigned int	Elf32_Word;
 typedef unsigned int	Elf32_Word;
 typedef unsigned char	Elf32_Char;
 typedef unsigned char	Elf32_Char;
 
 
+#ifdef __GNUC__
+typedef	unsigned long long Elf64_Addr;
+typedef	unsigned long long Elf64_Off;
+#else
 /* XXX: We need 64 bit numbers here */
 /* XXX: We need 64 bit numbers here */
 typedef unsigned int	Elf64_Addr[2];
 typedef unsigned int	Elf64_Addr[2];
-typedef unsigned short	Elf64_Half;
 typedef unsigned int	Elf64_Off[2];
 typedef unsigned int	Elf64_Off[2];
+#endif
+typedef unsigned short	Elf64_Half;
 typedef unsigned int	Elf64_Word;
 typedef unsigned int	Elf64_Word;
 typedef unsigned char	Elf64_Char;
 typedef unsigned char	Elf64_Char;
 
 
@@ -92,6 +97,9 @@ typedef struct {
 #define	ELFMAG3		'F'
 #define	ELFMAG3		'F'
 #define	ELFMAG		"\177ELF"
 #define	ELFMAG		"\177ELF"
 
 
+#define	OLFMAG1		'O'
+#define	OLFMAG		"\177OLF"
+
 typedef struct {
 typedef struct {
     Elf32_Word	p_type;
     Elf32_Word	p_type;
     Elf32_Off	p_offset;
     Elf32_Off	p_offset;

+ 33 - 11
softmagic.c

@@ -25,6 +25,9 @@
  * 4. This notice may not be removed or altered.
  * 4. This notice may not be removed or altered.
  */
  */
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>
@@ -34,8 +37,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-static const char *moduleid = 
-	"@(#)$Id: softmagic.c,v 1.36 1998/02/15 23:18:53 christos Exp $";
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.38 1998/09/12 13:21:01 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 static int match	__P((unsigned char *, int));
 static int match	__P((unsigned char *, int));
@@ -196,7 +198,7 @@ struct magic *m;
 {
 {
 	char *pp, *rt;
 	char *pp, *rt;
 	uint32 v;
 	uint32 v;
-	time_t the_time;
+	time_t curtime;
 	int32 t=0 ;
 	int32 t=0 ;
 
 
 
 
@@ -232,7 +234,11 @@ struct magic *m;
 			t = m->offset + strlen(m->value.s);
 			t = m->offset + strlen(m->value.s);
 		}
 		}
 		else {
 		else {
+#ifdef DEBUG_BUG_22854
 			if (*m->value.s == '\0') {
 			if (*m->value.s == '\0') {
+#else
+                       if (*m->value.s == '\n') {
+#endif
 				char *cp = strchr(p->s,'\n');
 				char *cp = strchr(p->s,'\n');
 				if (cp)
 				if (cp)
 					*cp = '\0';
 					*cp = '\0';
@@ -245,8 +251,8 @@ struct magic *m;
 	case DATE:
 	case DATE:
 	case BEDATE:
 	case BEDATE:
 	case LEDATE:
 	case LEDATE:
-		the_time = p->l;
-		pp = ctime(&the_time);
+		curtime = p->l;
+		pp = ctime(&curtime);
 		if ((rt = strchr(pp, '\n')) != NULL)
 		if ((rt = strchr(pp, '\n')) != NULL)
 			*rt = '\0';
 			*rt = '\0';
 		(void) printf(m->desc, pp);
 		(void) printf(m->desc, pp);
@@ -280,8 +286,10 @@ struct magic *m;
 
 
 			/* Null terminate and eat the return */
 			/* Null terminate and eat the return */
 			p->s[sizeof(p->s) - 1] = '\0';
 			p->s[sizeof(p->s) - 1] = '\0';
+#if DEBIAN_BUG_22854
 			if ((ptr = strchr(p->s, '\n')) != NULL)
 			if ((ptr = strchr(p->s, '\n')) != NULL)
 				*ptr = '\0';
 				*ptr = '\0';
+#endif
 			return 1;
 			return 1;
 		}
 		}
 	case BESHORT:
 	case BESHORT:
@@ -347,18 +355,33 @@ int nbytes;
 		mdump(m);
 		mdump(m);
 	}
 	}
 
 
-	if (!mconvert(p, m))
-		return 0;
-
 	if (m->flag & INDIR) {
 	if (m->flag & INDIR) {
 
 
 		switch (m->in.type) {
 		switch (m->in.type) {
 		case BYTE:
 		case BYTE:
 			offset = p->b + m->in.offset;
 			offset = p->b + m->in.offset;
 			break;
 			break;
+		case BESHORT:
+		        offset = (short)((p->hs[0]<<8)|(p->hs[1]))+
+			          m->in.offset;
+			break;
+		case LESHORT:
+		        offset = (short)((p->hs[1]<<8)|(p->hs[0]))+
+			         m->in.offset;
+			break;
 		case SHORT:
 		case SHORT:
 			offset = p->h + m->in.offset;
 			offset = p->h + m->in.offset;
 			break;
 			break;
+		case BELONG:
+		        offset = (int32)((p->hl[0]<<24)|(p->hl[1]<<16)|
+					 (p->hl[2]<<8)|(p->hl[3]))+
+			         m->in.offset;
+			break;
+		case LELONG:
+		        offset = (int32)((p->hl[3]<<24)|(p->hl[2]<<16)|
+					 (p->hl[1]<<8)|(p->hl[0]))+
+			         m->in.offset;
+			break;
 		case LONG:
 		case LONG:
 			offset = p->l + m->in.offset;
 			offset = p->l + m->in.offset;
 			break;
 			break;
@@ -373,10 +396,9 @@ int nbytes;
 			mdebug(offset, (char *) p, sizeof(union VALUETYPE));
 			mdebug(offset, (char *) p, sizeof(union VALUETYPE));
 			mdump(m);
 			mdump(m);
 		}
 		}
-
-		if (!mconvert(p, m))
-			return 0;
 	}
 	}
+	if (!mconvert(p, m))
+	  return 0;
 	return 1;
 	return 1;
 }
 }
 
 

+ 3 - 1
tar.h

@@ -5,7 +5,7 @@
  *
  *
  * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
  * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
  *
  *
- * $Id: tar.h,v 1.3 1992/09/08 15:32:41 ian Exp $ # checkin only
+ * $Id: tar.h,v 1.4 1998/06/27 13:57:23 christos Exp $ # checkin only
  */
  */
 
 
 /*
 /*
@@ -167,6 +167,7 @@ TAR_EXTERN struct link	*linklist;	/* Points to first link in list */
 TAR_EXTERN char		read_error_flag;
 TAR_EXTERN char		read_error_flag;
 
 
 
 
+#if 0
 /*
 /*
  * Declarations of functions available to the world.
  * Declarations of functions available to the world.
  */
  */
@@ -177,3 +178,4 @@ union record *endofrecs();
 void anno();
 void anno();
 #define	 annorec(stream, msg)	anno(stream, msg, 0)	/* Cur rec */
 #define	 annorec(stream, msg)	anno(stream, msg, 0)	/* Cur rec */
 #define	annofile(stream, msg)	anno(stream, msg, 1)	/* Saved rec */
 #define	annofile(stream, msg)	anno(stream, msg, 1)	/* Saved rec */
+#endif