Browse Source

Import upstream version 3.26

Christos Zoulas 26 years ago
parent
commit
53d59582a7
51 changed files with 961 additions and 179 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. 38 4
      Magdir/bsdi
  8. 39 0
      Magdir/compress
  9. 7 1
      Magdir/database
  10. 40 5
      Magdir/elf
  11. 26 0
      Magdir/filesystems
  12. 10 0
      Magdir/flash
  13. 1 0
      Magdir/frame
  14. 32 0
      Magdir/gimp
  15. 9 0
      Magdir/gnu
  16. 4 1
      Magdir/images
  17. 14 2
      Magdir/linux
  18. 14 1
      Magdir/msdos
  19. 4 0
      Magdir/octave
  20. 97 0
      Magdir/olf
  21. 23 0
      Magdir/os2
  22. 10 0
      Magdir/pdp
  23. 10 0
      Magdir/printer
  24. 93 0
      Magdir/riff
  25. 4 0
      Magdir/teapot
  26. 11 0
      Magdir/tex
  27. 6 6
      Magdir/timezone
  28. 0 26
      Magdir/vgetty
  29. 16 0
      Magdir/vicar
  30. 91 0
      Magdir/wordperfect
  31. 8 8
      Makefile.in
  32. 7 7
      Makefile.std
  33. 16 8
      apprentice.c
  34. 1 2
      ascmagic.c
  35. 8 5
      compress.c
  36. 3 0
      config.h.in
  37. 44 1
      configure
  38. 3 0
      configure.in
  39. 19 12
      file.c
  40. 12 3
      file.h
  41. 1 2
      fsmagic.c
  42. 4 0
      internat.c
  43. 6 1
      is_tar.c
  44. 6 4
      magic.man
  45. 58 9
      names.h
  46. 15 2
      patchlevel.h
  47. 6 7
      print.c
  48. 55 19
      readelf.c
  49. 11 3
      readelf.h
  50. 24 11
      softmagic.c
  51. 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)
-		echo "# Magic file created `date` by `who am i`" > $@
-		cat $(ALL) >> $@

+ 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
 0	string	MThd			Standard MIDI data
 >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	SBI			SoundBlaster instrument data
 0	string	Creative\ Voice\ File	Creative Labs voice data
@@ -57,17 +57,6 @@
 0	belong		0x4e54524b	MultiTrack sound data
 >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
 # [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
 0	string		EMOD		Extended MOD sound data,

+ 38 - 4
Magdir/bsdi

@@ -1,7 +1,41 @@
-
 #------------------------------------------------------------------------------
 # 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)

+ 39 - 0
Magdir/compress

@@ -104,3 +104,42 @@
 >3	string		=7		\b, compression block size 700k
 >3	string		=8		\b, compression block size 800k
 >3	string		=9		\b, compression block size 900k
+
+# lzop from <markus.oberhumer@jk.uni-linz.ac.at>
+0	string		\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a	lzop compressed data
+>9	beshort		<0x0940
+>>9	byte&0xf0	=0x00		- version 0.
+>>9	beshort&0x0fff	x		\b%03x,
+>>13	byte		1		LZO1X-1,
+>>13	byte		2		LZO1X-1(15),
+>>13	byte		3		LZO1X-999,
+## >>22	bedate		>0		last modified: %s,
+>>14	byte		=0x00		os: MS-DOS
+>>14	byte		=0x01		os: Amiga
+>>14	byte		=0x02		os: VMS
+>>14	byte		=0x03		os: Unix
+>>14	byte		=0x05		os: Atari
+>>14	byte		=0x06		os: OS/2
+>>14	byte		=0x07		os: MacOS
+>>14	byte		=0x0A		os: Tops/20
+>>14	byte		=0x0B		os: WinNT
+>>14	byte		=0x0E		os: Win32
+>9	beshort		>0x0939
+>>9	byte&0xf0	=0x00		- version 0.
+>>9	byte&0xf0	=0x10		- version 1.
+>>9	byte&0xf0	=0x20		- version 2.
+>>9	beshort&0x0fff	x		\b%03x,
+>>15	byte		1		LZO1X-1,
+>>15	byte		2		LZO1X-1(15),
+>>15	byte		3		LZO1X-999,
+## >>25	bedate		>0		last modified: %s,
+>>17	byte		=0x00		os: MS-DOS
+>>17	byte		=0x01		os: Amiga
+>>17	byte		=0x02		os: VMS
+>>17	byte		=0x03		os: Unix
+>>17	byte		=0x05		os: Atari
+>>17	byte		=0x06		os: OS/2
+>>17	byte		=0x07		os: MacOS
+>>17	byte		=0x0A		os: Tops/20
+>>17	byte		=0x0B		os: WinNT
+>>17	byte		=0x0E		os: Win32

+ 7 - 1
Magdir/database

@@ -30,9 +30,15 @@
 >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,
 >8	belong	x		Page Size %d,
 >12	belong	x		Free Page %d,
 >16	belong	x		Number of Records %d,
 >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		15		PA-RISC - invalid byte order,
 >>18	leshort		16		nCUBE,
->>18	leshort		17		VPP500,
+>>18	leshort		17		Fujitsu VPP500,
 >>18	leshort		18		SPARC32PLUS,
 >>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		1		version 1
 >>36	lelong		1		MathCoPro/FPU/MAU Required
@@ -70,14 +88,31 @@
 >>18	beshort		11		RS6000,
 >>18	beshort		15		PA-RISC,
 >>18	beshort		16		nCUBE,
->>18	beshort		17		VPP500,
+>>18	beshort		17		Fujitsu 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,
+>>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		1		version 1
 >>36	belong		1		MathCoPro/FPU/MAU Required

+ 26 - 0
Magdir/filesystems

@@ -33,4 +33,30 @@
 >>0x36	string	FAT			\b, %s
 >>>0x39	string	12			(%s bit)
 >>>0x39	string	16			(%s bit)
+>>>43	string		>NO\ NAME	label: %.11s,
+>>>43	string		<NO\ NAME	label: %.11s,
+>>>43	string		NO\ NAME	unlabeled,
+>>>19	leshort		>0		%d sectors
+>>>19	leshort		0		
+>>>>32	lelong		x		%d sectors
 >0x200	lelong	0x82564557		\b, BSD disklabel
+
+# Minix filesystems - Juan Cespedes <cespedes@debian.org>
+0x410	leshort		0x137f		Minix filesystem
+0x410	leshort		0x138f		Minix filesystem, 30 char names
+0x410	leshort		0x2468		Minix filesystem, version 2
+0x410	leshort		0x2478		Minix filesystem, version 2, 30 char names
+
+# romfs filesystems - Juan Cespedes <cespedes@debian.org>
+0	string		-rom1fs-\0	romfs filesystem, version 1
+>8	belong	x			%d bytes,
+>16	string	x			named %s.
+
+# netboot image - Juan Cespedes <cespedes@debian.org>
+0	lelong		0x1b031336L	Netboot image,
+>4	lelong&0xFFFFFF00	0
+>>4	lelong&0x100	0x000		mode 2
+>>4	lelong&0x100	0x100		mode 3
+>4	lelong&0xFFFFFF00	!0	unknown mode
+
+0x18b	string	OS/2	OS/2 Boot Manager

+ 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:
 #
 0	string		\<MakerFile	FrameMaker document
+>11	string		5.5		 (5.5
 >11	string		5.0		 (5.0
 >11	string		4.0		 (4.0
 >11	string		3.0		 (3.0

+ 32 - 0
Magdir/gimp

@@ -0,0 +1,32 @@
+#------------------------------------------------------------------------------
+# GIMP Gradient: file(1) magic for the GIMP's gradient data files
+# by Federico Mena <federico@nuclecu.unam.mx>
+
+0       string          GIMP\ Gradient  GIMP gradient data
+
+#------------------------------------------------------------------------------
+# XCF:  file(1) magic for the XCF image format used in the GIMP developed
+#       by Spencer Kimball and Peter Mattis
+#       ('Bucky' LaDieu, nega@vt.edu)
+
+0       string          gimp\ xcf\ file GIMP XCF image data,
+>14     belong          x               %ld x
+>18     belong          x               %ld,
+>22     belong          0               RGB Color
+>22     belong          1               Greyscale
+>22     belong          2               Indexed Color
+
+#------------------------------------------------------------------------------
+# XCF:  file(1) magic for the patterns used in the GIMP, developed
+#       by Spencer Kimball and Peter Mattis
+#       ('Bucky' LaDieu, nega@vt.edu)
+
+20      string          GPAT            GIMP pattern data,
+>24     string          x               %s
+
+#------------------------------------------------------------------------------
+# XCF:  file(1) magic for the brushes used in the GIMP, developed
+#       by Spencer Kimball and Peter Mattis
+#       ('Bucky' LaDieu, nega@vt.edu)
+
+20      string          GIMP            GIMP brush data

+ 9 - 0
Magdir/gnu

@@ -0,0 +1,9 @@
+#
+# GNU nlsutils message catalog file format
+#
+0	string		\336\22\4\225	GNU message catalog (little endian),
+>4	lelong		x		revision %d,
+>8	lelong		x		%d messages
+0	string		\225\4\22\336	GNU message catalog (big endian),
+>4	belong		x		revision %d,
+>8	belong		x		%d messages

+ 4 - 1
Magdir/images

@@ -192,7 +192,10 @@
 #>28	belong		>0		colormap is %d bytes long
 
 # 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
 #>2	byte		0		\b, verbatim
 >2	byte		1		\b, RLE

+ 14 - 2
Magdir/linux

@@ -23,6 +23,18 @@
 #
 0	string		\007\001\000	Linux/i386 object file
 >20	lelong		>0x1020		\b, DLL library
+# Linux-8086 stuff:
+0	string		\01\03\020\04	Linux-8086 impure executable
+>28	long		!0		not stripped
+0	string		\01\03\040\04	Linux-8086 executable
+>28	long		!0		not stripped
+#
+0	string		\243\206\001\0	Linux-8086 object file
+#
+0	string		\01\03\020\20	Minix-386 impure executable
+>28	long		!0		not stripped
+0	string		\01\03\040\20	Minix-386 executable
+>28	long		!0		not stripped
 # message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
 0	string		*nazgul*	Linux compiled message catalog
 >8	lelong		>0		\b, version %ld
@@ -66,7 +78,7 @@
 #
 # Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
 # and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
-# and Nicolas Lichtmaier <nick@debian.org>
+# and Nicolás Lichtmaier <nick@debian.org>
 # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
 514		string	HdrS		Linux kernel
 >518		leshort	>0
@@ -88,5 +100,5 @@
 0		belong	0xb8c0078e	Linux kernel
 >0x1e3		string	Loading		version 1.3.79 or older
 >0x1e9		string	Loading		from prehistoric times
-# LSM entries - Nicolas Lichtmaier <nick@feedback.com.ar>
+# LSM entries - Nicolás Lichtmaier <nick@feedback.net.ar>
 0	string	Begin3	Linux Software Map entry text

+ 14 - 1
Magdir/msdos

@@ -85,6 +85,15 @@
 #
 0	string	MZ		MS-DOS executable (EXE)
 >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
 >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
 # two dozen different one-byte "magics".
 #0	byte		0xe9		MS-DOS executable (COM)
+#>6	string	SFX\ of\ LHarc	(%s)
 #0	byte		0x8c		MS-DOS executable (COM)
 # 0xeb conflicts with "sequent" magic
 #0	byte		0xeb		MS-DOS executable (COM)
@@ -162,4 +172,7 @@
 
 # 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

+ 4 - 0
Magdir/octave

@@ -0,0 +1,4 @@
+#------------------------------------------------------------------------------
+# octave binary data file(1) magic, from Dirk Eddelbuettel <edd@debian.org>
+0	string		Octave-1-L	Octave binary data (little endian)
+0	string		Octave-1-B	Octave binary data (big endian)

+ 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
 
 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		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
 #       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		\\documentstyle	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
 # Added new official magic number for recent versions of the Olson code
 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

+ 91 - 0
Magdir/wordperfect

@@ -0,0 +1,91 @@
+#WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
+0	string	\377WPC\020\000\000\000\022\012\001\001\000\000\000\000	(WP) loadable text
+>15	byte	0	Optimized for Intel
+>15	byte	1	Optimized for Non-Intel
+1	string	WPC	(Corel/WP)
+>8	short	257	WordPerfect macro
+>8	short	258	WordPerfect help file
+>8	short	259	WordPerfect keyboard file
+>8	short	266	WordPerfect document
+>8	short	267	WordPerfect dictionary
+>8	short	268	WordPerfect thesaurus
+>8	short	269	WordPerfect block
+>8	short	270	WordPerfect rectangular block
+>8	short	271	WordPerfect column block
+>8	short	272	WordPerfect printer data
+>8	short	275	WordPerfect printer data
+>8	short	276	WordPerfect driver resource data
+>8	short	279	WordPerfect hyphenation code
+>8	short	280	WordPerfect hyphenation data
+>8	short	281	WordPerfect macro resource data
+>8	short	283	WordPerfect hyphenation lex
+>8	short	285	WordPerfect wordlist
+>8	short	286	WordPerfect equation resource data
+>8	short	289	WordPerfect spell rules
+>8	short	290	WordPerfect dictionary rules
+>8	short	295	WordPerfect spell rules (Microlytics)
+>8	short	299	WordPerfect settings file
+>8	short	301	WordPerfect 4.2 document
+>8	short	325	WordPerfect dialog file
+>8	short	332	WordPerfect button bar
+>8	short	513	Shell macro
+>8	short	522	Shell definition
+>8	short	769	Notebook macro
+>8	short	770	Notebook help file
+>8	short	771	Notebook keyboard file
+>8	short	778	Notebook definition
+>8	short	1026	Calculator help file
+>8	short 	1538	Calendar help file
+>8	short 	1546	Calendar data file
+>8	short	1793	Editor macro
+>8	short	1794	Editor help file
+>8	short	1795	Editor keyboard file
+>8	short	1817	Editor macro resource file
+>8	short 	2049	Macro editor macro
+>8	short 	2050	Macro editor help file
+>8	short	2051	Macro editor keyboard file
+>8	short	2305	PlanPerfect macro
+>8	short	2306	PlanPerfect help file
+>8	short	2307	PlanPerfect keyboard file
+>8	short	2314	PlanPerfect worksheet
+>8	short	2319	PlanPerfect printer definition
+>8	short	2322	PlanPerfect graphic definition
+>8	short	2323	PlanPerfect data
+>8	short	2324	PlanPerfect temporary printer
+>8	short	2329	PlanPerfect macro resource data
+>8	byte	11	Mail
+>8	short	2818	help file
+>8	short	2821	distribution list
+>8	short	2826	out box
+>8	short	2827	in box
+>8	short	2836	users archived mailbox
+>8	short	2837	archived message database
+>8	short	2838	archived attachments
+>8	short	3083	Printer temporary file
+>8	short	3330	Scheduler help file
+>8	short	3338	Scheduler in file
+>8	short	3339	Scheduler out file
+>8	short	3594	GroupWise settings file
+>8	short	3601	GroupWise directory services
+>8	short	3627	GroupWise settings file
+>8	short	4362	Terminal resource data
+>8	short	4363	Terminal resource data
+>8	short	4395	Terminal resource data
+>8	short	4619	GUI loadable text
+>8	short	4620	graphics resource data
+>8	short	4621	printer settings file
+>8	short	4622	port definition file
+>8	short	4623	print queue parameters
+>8	short	4624	compressed file
+>8	short	5130	Network service msg file
+>8	short	5131	Network service msg file
+>8	short	5132	Async gateway login msg
+>8	short	5134	GroupWise message file
+>8	short	7956	GroupWise admin domain database
+>8	short	7957	GroupWise admin host database
+>8	short	7959	GroupWise admin remote host database
+>8	short	7960	GroupWise admin ADS deferment data file
+>8	short	8458	IntelliTAG (SGML) compiled DTD
+>8	long	18219264	WordPerfect graphic image (1.0)
+>8	long	18219520	WordPerfect graphic image (2.0)
+#end of WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE

+ 8 - 8
Makefile.in

@@ -1,6 +1,6 @@
 # Makefile for file(1) cmd. 
 # 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
 # and Telegraph Company or of the Regents of the University of California.
@@ -21,14 +21,14 @@
 #    ever read sources, credits must appear in the documentation.
 #
 # 4. This notice may not be removed or altered.
-VERSION	= 3.24
+VERSION	= 3.26
 SHELL	= /bin/sh
 #MAGIC	= /etc/magic
 prefix = @prefix@
 INSTALLCMD = @INSTALL@
 MAGICDIR = @datadir@
 MAGIC	= $(MAGICDIR)/magic
-DEFS	= -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF -DHAVE_CONFIG_H
+DEFS	= -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H
 CPPFLAGS = $(DEFS)
 CC	= @CC@
 #COPTS	= -O -g		# newer compilers allow both; else drop -O
@@ -84,8 +84,9 @@ HDRS = file.h names.h patchlevel.h readelf.h tar.h
 
 AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
 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}
 
@@ -101,9 +102,8 @@ file:		$(OBJS)
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 lint:		$(SRCS)
 		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
 

+ 7 - 7
Makefile.std

@@ -1,6 +1,6 @@
 # Makefile for file(1) cmd. 
 # 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
 # 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.
 #
 # 4. This notice may not be removed or altered.
-VERSION	= 3.24
+VERSION	= 3.26
 SHELL	= /bin/sh
 #MAGIC	= /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
 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}
 
@@ -96,9 +97,8 @@ file:		$(OBJS)
 		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
 lint:		$(SRCS)
 		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
 

+ 16 - 8
apprentice.c

@@ -33,8 +33,7 @@
 #include "file.h"
 
 #ifndef	lint
-static char *moduleid = 
-	"@(#)$Id: apprentice.c,v 1.25 1997/01/15 17:23:24 christos Exp $";
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.28 1998/09/12 13:17:52 christos Exp $")
 #endif	/* lint */
 
 #define	EATAB {while (isascii((unsigned char) *l) && \
@@ -51,11 +50,11 @@ static void eatsize	__P((char **));
 
 static int maxmagic = 0;
 
-static int apprentice_1	__P((char *, int));
+static int apprentice_1	__P((const char *, int));
 
 int
 apprentice(fn, check)
-char *fn;			/* list of magic files */
+const char *fn;			/* list of magic files */
 int check;			/* non-zero? checking-only run. */
 {
 	char *p, *mfn;
@@ -94,7 +93,7 @@ int check;			/* non-zero? checking-only run. */
 
 static int
 apprentice_1(fn, check)
-char *fn;			/* name of magic file */
+const char *fn;			/* name of magic file */
 int check;			/* non-zero? checking-only run. */
 {
 	static const char hdr[] =
@@ -229,16 +228,25 @@ int *ndx, check;
 		 */
 		if (*l == '.') {
 			l++;
-			switch (LOWCASE(*l)) {
+			switch (*l) {
 			case 'l':
-				m->in.type = LONG;
+				m->in.type = LELONG;
+				break;
+			case 'L':
+				m->in.type = BELONG;
 				break;
 			case 'h':
 			case 's':
-				m->in.type = SHORT;
+				m->in.type = LESHORT;
+				break;
+			case 'H':
+			case 'S':
+				m->in.type = BESHORT;
 				break;
 			case 'c':
 			case 'b':
+			case 'C':
+			case 'B':
 				m->in.type = BYTE;
 				break;
 			default:

+ 1 - 2
ascmagic.c

@@ -36,8 +36,7 @@
 #include "names.h"
 
 #ifndef	lint
-static char *moduleid = 
-	"@(#)$Id: ascmagic.c,v 1.22 1998/02/15 23:18:53 christos Exp $";
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.23 1998/06/27 13:23:39 christos Exp $");
 #endif	/* lint */
 
 			/* an optimisation over plain strcmp() */

+ 8 - 5
compress.c

@@ -4,7 +4,6 @@
  *		   information if recognized
  *	uncompress(method, old, n, newch) - uncompress old into new, 
  *					    using method, return sizeof new
- * $Id: compress.c,v 1.10 1998/02/15 23:18:53 christos Exp $
  */
 #include <stdio.h>
 #include <stdlib.h>
@@ -16,13 +15,16 @@
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #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 {
-   char *magic;
+   const char *magic;
    int   maglen;
-   char *argv[3];
+   const char *const argv[3];
    int	 silent;
 } compr[] = {
     { "\037\235", 2, { "uncompress", "-c", NULL }, 0 },	/* compressed */
@@ -95,7 +97,8 @@ int n;
 		if (compr[method].silent)
 		    (void) close(2);
 
-		execvp(compr[method].argv[0], compr[method].argv);
+		execvp(compr[method].argv[0],
+		       (char *const *)compr[method].argv);
 		error("could not execute `%s' (%s).\n", 
 		      compr[method].argv[0], strerror(errno));
 		/*NOTREACHED*/

+ 3 - 0
config.h.in

@@ -6,6 +6,9 @@
 /* Define if your struct stat has st_rdev.  */
 #undef HAVE_ST_RDEV
 
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
 /* Define to `long' if <sys/types.h> doesn't define.  */
 #undef off_t
 

+ 44 - 1
configure

@@ -181,7 +181,7 @@ Features and packages:
   --x-libraries=DIR       X library files are in DIR
 EOF
     if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
+      echo "--enable and --with options known (Default: + yes, - no, s system-specific):$ac_help"
     fi
     exit 0 ;;
 
@@ -1131,6 +1131,49 @@ EOF
 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
+
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure

+ 3 - 0
configure.in

@@ -12,4 +12,7 @@ AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_STRUCT_ST_RDEV
 
+dnl Checks for headers
+AC_HEADER_SYS_WAIT
+
 AC_OUTPUT(Makefile config.h)

+ 19 - 12
file.c

@@ -24,11 +24,6 @@
  *
  * 4. This notice may not be removed or altered.
  */
-#ifndef	lint
-static char *moduleid = 
-	"@(#)$Id: file.c,v 1.39 1998/02/15 23:18:53 christos Exp $";
-#endif	/* lint */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -36,13 +31,15 @@ static char *moduleid =
 #include <sys/param.h>	/* for MAXPATHLEN */
 #include <sys/stat.h>
 #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
-#  include <utime.h>
+#  ifdef USE_UTIMES
+#   include <sys/time.h>
+#  else
+#   include <utime.h>
+#  endif
 # endif
 #endif
 #include <unistd.h>	/* for read() */
@@ -52,6 +49,11 @@ static char *moduleid =
 #include "patchlevel.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
 # define USAGE  "Usage: %s [-vbczL] [-f namefile] [-m magicfiles] file...\n"
 #else
@@ -73,7 +75,7 @@ int			/* Misc globals				*/
 
 struct  magic *magic;	/* array of magic entries		*/
 
-char *magicfile;	/* where magic be found 		*/
+const char *magicfile;	/* where magic be found 		*/
 
 char *progname;		/* used throughout 			*/
 int lineno;		/* line number in the magic file	*/
@@ -85,6 +87,8 @@ static int	byteconv4	__P((int, int, int));
 static short	byteconv2	__P((int, int, int));
 #endif
 
+int main __P((int, char *[]));
+
 /*
  * main - parse arguments and handle options
  */
@@ -354,6 +358,9 @@ int wid;
 #ifdef RESTORE_TIME
 		/*
 		 * 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
 		struct timeval  utsbuf[2];

+ 12 - 3
file.h

@@ -1,6 +1,6 @@
 /*
  * 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.
  * Written by Ian F. Darwin.
@@ -88,7 +88,7 @@ struct magic {
 # endif
 #endif
 
-extern int   apprentice		__P((char *, int));
+extern int   apprentice		__P((const char *, int));
 extern int   ascmagic		__P((unsigned char *, int));
 extern void  error		__P((const char *, ...));
 extern void  ckfputs		__P((const char *, FILE *));
@@ -112,7 +112,7 @@ extern void tryelf		__P((int, char *, int));
 extern int errno;		/* Some unixes don't define this..	*/
 
 extern char *progname;		/* the program name 			*/
-extern 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 struct magic *magic;	/* array of magic entries		*/
@@ -147,4 +147,13 @@ extern char *sys_errlist[];
 #define	MAXPATHLEN	512
 #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__ */

+ 1 - 2
fsmagic.c

@@ -53,8 +53,7 @@
 #include "file.h"
 
 #ifndef	lint
-static char *moduleid = 
-	"@(#)$Id: fsmagic.c,v 1.26 1998/02/15 23:18:53 christos Exp $";
+FILE_RCSID("@(#)$Id: fsmagic.c,v 1.27 1998/06/27 13:23:39 christos Exp $")
 #endif	/* lint */
 
 int

+ 4 - 0
internat.c

@@ -12,6 +12,10 @@
 #include <string.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 T 1
 

+ 6 - 1
is_tar.c

@@ -5,7 +5,7 @@
  * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!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
  * for file command by Ian Darwin.
@@ -15,6 +15,11 @@
 #include <ctype.h>
 #include <sys/types.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') )
 

+ 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
 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:
-.BI (( x [.[bsl]][+-][ y ]).
+.BI (( x [.[bslBSL]][+-][ y ]).
 The value of 
 .I x
 is used as an offset in the file. A byte, short or long is read at that offset
 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
 is added and the result is used as an offset in the file. The default type
 if one is not specified is long.
@@ -203,4 +205,4 @@ indirect offsets.
 .\" the changes I posted to the S5R2 version.
 .\"
 .\" 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 $

+ 58 - 9
names.h

@@ -10,22 +10,25 @@
  *
  * 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! */
-#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_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_MAIL	8		/* Electronic mail */
 #define	L_NEWS	9		/* Usenet Netnews */
+#define	L_JAVA	10		/* Java code */
+#define	L_HTML	11		/* HTML */
+#define	L_BCPL	12		/* BCPL */
 
-static char *types[] = {
+static const char *types[] = {
 	"C program text",
 	"C++ program text",
 	"FORTRAN program text",
@@ -36,15 +39,57 @@ static char *types[] = {
 	"Pascal program text",
 	"mail text",
 	"news text",
+	"Java program text",
+	"HTML document text",
+	"BCPL program text",
 	"can't happen error on names.h/types",
 	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 {
-	char *name;
+	const char *name;
 	short type;
 } names[] = {
 	/* These must be sorted by eye for optimal hit rate */
 	/* Add to this list only after substantial meditation */
+	{"import",	L_JAVA},
+	{"\"libhdr\"",	L_BCPL},
+	{"\"LIBHDR\"",	L_BCPL},
 	{"//",		L_CC},
 	{"template",	L_CC},
 	{"virtual",	L_CC},
@@ -94,6 +139,10 @@ static struct names {
 	{"Newsgroups:",	L_NEWS},
 	{"Path:",	L_NEWS},
 	{"Organization:",L_NEWS},
+	{"href=",	L_HTML},
+	{"HREF=",	L_HTML},
+	{"<body",	L_HTML},
+	{"<BODY",	L_HTML},
 	{NULL,		0}
 };
 #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)

+ 15 - 2
patchlevel.h

@@ -1,11 +1,24 @@
 #define	FILE_VERSION_MAJOR	3
-#define	patchlevel		24
+#define	patchlevel		26
 
 /*
  * 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 $
+ * 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
  * Autoconf patch: Felix von Leitner <leitner@math.fu-berlin.de>
  * More magic fixes

+ 6 - 7
print.c

@@ -39,8 +39,7 @@
 #include "file.h"
 
 #ifndef lint
-static char *moduleid =
-	"@(#)$Id: print.c,v 1.24 1997/04/13 18:28:30 christos Exp $";
+FILE_RCSID("@(#)$Id: print.c,v 1.26 1998/06/27 13:57:23 christos Exp $")
 #endif  /* lint */
 
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
@@ -49,10 +48,10 @@ void
 mdump(m)
 struct magic *m;
 {
-	static 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) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7),
 		       m->offset);
@@ -68,7 +67,7 @@ struct magic *m;
 		       (m->type >= 0 && m->type < SZOF(typ)) ? 
 				typ[(unsigned char) m->type] : 
 				"*bad*");
-	if (m->mask != ~0L)
+	if (m->mask != ~((uint32)0))
 		(void) fprintf(stderr, " & %.8x", m->mask);
 
 	(void) fprintf(stderr, ",%c", m->reln);

+ 55 - 19
readelf.c

@@ -9,11 +9,21 @@
 #include <errno.h>
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 #include "readelf.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
 doshn(fd, off, num, size, buf)
 	int fd;
@@ -61,6 +71,8 @@ dophn_exec(fd, off, num, size, buf)
 {
 	/* I am not sure if this works for 64 bit elf formats */
 	Elf32_Phdr *ph = (Elf32_Phdr *) buf;
+	char *linking_style = "statically";
+	char *shared_libraries = "";
 
 	if (lseek(fd, off, SEEK_SET) == -1)
 		error("lseek failed (%s).\n", strerror(errno));
@@ -68,18 +80,20 @@ dophn_exec(fd, off, num, size, buf)
   	for ( ; num; num--) {
   		if (read(fd, buf, size) == -1)
   			error("read failed (%s).\n", strerror(errno));
-		if (ph->p_type == PT_INTERP) {
-			/*
-			 * Has an interpreter - must be a dynamically-linked
-			 * executable.
-			 */
-			printf(", dynamically linked");
-			return;
+
+		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[] = {
 	84,		/* SunOS 5.x */
 	32,		/* Linux */
@@ -217,6 +231,7 @@ dophn_core(fd, off, num, size, buf)
 		}
 	}
 }
+#endif
 
 void
 tryelf(fd, buf, nbytes)
@@ -235,7 +250,8 @@ tryelf(fd, buf, nbytes)
 	 * Instead we traverse thru all section headers until a symbol table
 	 * 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)
 	    return;
 
@@ -257,13 +273,18 @@ tryelf(fd, buf, nbytes)
 		 */
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
 			if (elfhdr.e_type == ET_CORE) 
+#ifdef ELFCORE
 				dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum, 
 				      elfhdr.e_phentsize, buf);
+#else
+				;
+#endif
 			else {
 				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,
 				      elfhdr.e_shentsize, buf);
@@ -289,22 +310,37 @@ tryelf(fd, buf, nbytes)
 		 * byte order....
 		 */
 		if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
-#ifdef notyet
 			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_phentsize, buf);
-			else
+#else
+				;
 #endif
+			else
 			{
-#ifdef notyet
 				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_phentsize, buf);
 				}
+				doshn(fd,
+#ifndef __GNUC__
+				      elfhdr.e_shoff[1],
+#else
+				      elfhdr.e_shoff,
 #endif
-				doshn(fd, elfhdr.e_shoff[1],
 				      elfhdr.e_shnum,
 				      elfhdr.e_shentsize, buf);
 			}

+ 11 - 3
readelf.h

@@ -1,6 +1,6 @@
 /*
  * 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
  * non-elf hosts to determine if an elf binary is stripped.
@@ -10,15 +10,20 @@
 #define __fake_elf_h__
 
 typedef unsigned int	Elf32_Addr;
-typedef unsigned short	Elf32_Half;
 typedef unsigned int	Elf32_Off;
+typedef unsigned short	Elf32_Half;
 typedef unsigned int	Elf32_Word;
 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 */
 typedef unsigned int	Elf64_Addr[2];
-typedef unsigned short	Elf64_Half;
 typedef unsigned int	Elf64_Off[2];
+#endif
+typedef unsigned short	Elf64_Half;
 typedef unsigned int	Elf64_Word;
 typedef unsigned char	Elf64_Char;
 
@@ -92,6 +97,9 @@ typedef struct {
 #define	ELFMAG3		'F'
 #define	ELFMAG		"\177ELF"
 
+#define	OLFMAG1		'O'
+#define	OLFMAG		"\177OLF"
+
 typedef struct {
     Elf32_Word	p_type;
     Elf32_Off	p_offset;

+ 24 - 11
softmagic.c

@@ -37,8 +37,7 @@
 #include "file.h"
 
 #ifndef	lint
-static 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 */
 
 static int match	__P((unsigned char *, int));
@@ -199,7 +198,7 @@ struct magic *m;
 {
 	char *pp, *rt;
 	uint32 v;
-	time_t time;
+	time_t curtime;
 	int32 t=0 ;
 
 
@@ -248,8 +247,8 @@ struct magic *m;
 	case DATE:
 	case BEDATE:
 	case LEDATE:
-		time = p->l;
-		pp = ctime(&time);
+		curtime = p->l;
+		pp = ctime(&curtime);
 		if ((rt = strchr(pp, '\n')) != NULL)
 			*rt = '\0';
 		(void) printf(m->desc, pp);
@@ -350,18 +349,33 @@ int nbytes;
 		mdump(m);
 	}
 
-	if (!mconvert(p, m))
-		return 0;
-
 	if (m->flag & INDIR) {
 
 		switch (m->in.type) {
 		case BYTE:
 			offset = p->b + m->in.offset;
 			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:
 			offset = p->h + m->in.offset;
 			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:
 			offset = p->l + m->in.offset;
 			break;
@@ -376,10 +390,9 @@ int nbytes;
 			mdebug(offset, (char *) p, sizeof(union VALUETYPE));
 			mdump(m);
 		}
-
-		if (!mconvert(p, m))
-			return 0;
 	}
+	if (!mconvert(p, m))
+	  return 0;
 	return 1;
 }
 

+ 3 - 1
tar.h

@@ -5,7 +5,7 @@
  *
  * 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;
 
 
+#if 0
 /*
  * Declarations of functions available to the world.
  */
@@ -177,3 +178,4 @@ union record *endofrecs();
 void anno();
 #define	 annorec(stream, msg)	anno(stream, msg, 0)	/* Cur rec */
 #define	annofile(stream, msg)	anno(stream, msg, 1)	/* Saved rec */
+#endif