Browse Source

Import upstream version 4.12

Christos Zoulas 19 years ago
parent
commit
927e10538d
100 changed files with 31141 additions and 6501 deletions
  1. 193 0
      ChangeLog
  2. 2 7
      LEGAL.NOTICE
  3. 1 1
      MAINT
  4. 0 39
      Magdir/adventure
  5. 0 10
      Magdir/amigaos
  6. 0 170
      Magdir/animation
  7. 0 144
      Magdir/audio
  8. 0 13
      Magdir/c-lang
  9. 0 74
      Magdir/database
  10. 0 118
      Magdir/filesystems
  11. 0 12
      Magdir/gnu
  12. 0 61
      Magdir/jpeg
  13. 0 101
      Magdir/linux
  14. 0 335
      Magdir/macintosh
  15. 0 31
      Magdir/mcrypt
  16. 0 15
      Magdir/palm
  17. 0 5
      Magdir/python
  18. 0 104
      Magdir/riff
  19. 0 20
      Magdir/sgml
  20. 0 36
      Magdir/ti-8x
  21. 0 65
      Magdir/vorbis
  22. 2 79
      Makefile.am
  23. 315 410
      Makefile.in
  24. 0 167
      Makefile.std
  25. 0 0
      PORTING
  26. 16 12
      README
  27. 0 48
      acconfig.h
  28. 186 26
      acinclude.m4
  29. 4459 111
      aclocal.m4
  30. 0 1145
      apprentice.c
  31. 0 192
      compress.c
  32. 1354 0
      config.guess
  33. 155 62
      config.h.in
  34. 1460 0
      config.sub
  35. 11016 1647
      configure
  36. 54 13
      configure.in
  37. 423 0
      depcomp
  38. 32 0
      doc/Makefile.am
  39. 428 0
      doc/Makefile.in
  40. 97 45
      file.man
  41. 226 0
      doc/libmagic.man
  42. 55 34
      magic.man
  43. 0 476
      file.c
  44. 0 194
      file.h
  45. 0 251
      fsmagic.c
  46. 36 23
      install-sh
  47. 0 101
      is_tar.c
  48. 805 0
      ltcf-c.sh
  49. 2797 0
      ltconfig
  50. 5064 0
      ltmain.sh
  51. 0 0
      magic/Header
  52. 1 1
      Localstuff
  53. 32 0
      magic/Magdir/acorn
  54. 0 0
      magic/Magdir/adi
  55. 63 0
      magic/Magdir/adventure
  56. 0 0
      magic/Magdir/allegro
  57. 0 0
      magic/Magdir/alliant
  58. 0 0
      magic/Magdir/alpha
  59. 0 0
      magic/Magdir/amanda
  60. 56 0
      magic/Magdir/amigaos
  61. 656 0
      magic/Magdir/animation
  62. 0 0
      magic/Magdir/apl
  63. 28 0
      Magdir/apple
  64. 0 0
      magic/Magdir/applix
  65. 80 10
      Magdir/archive
  66. 0 0
      magic/Magdir/asterix
  67. 0 0
      magic/Magdir/att3b
  68. 411 0
      magic/Magdir/audio
  69. 12 0
      magic/Magdir/bFLT
  70. 0 0
      magic/Magdir/blender
  71. 0 0
      magic/Magdir/blit
  72. 9 0
      magic/Magdir/bout
  73. 0 0
      magic/Magdir/bsdi
  74. 24 0
      magic/Magdir/c-lang
  75. 27 0
      magic/Magdir/c64
  76. 36 0
      magic/Magdir/cad
  77. 11 0
      magic/Magdir/cddb
  78. 0 0
      magic/Magdir/chi
  79. 9 0
      magic/Magdir/chord
  80. 0 0
      magic/Magdir/cisco
  81. 0 0
      magic/Magdir/citrus
  82. 1 1
      Magdir/claris
  83. 0 0
      magic/Magdir/clipper
  84. 10 19
      Magdir/commands
  85. 21 0
      magic/Magdir/communications
  86. 51 25
      Magdir/compress
  87. 76 1
      Magdir/console
  88. 0 0
      magic/Magdir/convex
  89. 1 1
      Magdir/ctags
  90. 10 0
      magic/Magdir/dact
  91. 203 0
      magic/Magdir/database
  92. 0 0
      magic/Magdir/diamond
  93. 0 5
      Magdir/diff
  94. 0 0
      magic/Magdir/digital
  95. 57 0
      magic/Magdir/dolby
  96. 0 0
      magic/Magdir/dump
  97. 0 0
      magic/Magdir/dyadic
  98. 4 0
      Magdir/editors
  99. 76 41
      Magdir/elf
  100. 0 0
      Magdir/encore

+ 193 - 0
ChangeLog

@@ -0,0 +1,193 @@
+2004-11-24 12:39  Christos Zoulas  <christos@zoulas.com>
+
+	* Stack smash fix, and ELF more conservative reading.
+	  Jakub Bogusz <qboosh@pld-linux.org>
+
+2004-11-20 18:50  Christos Zoulas  <christos@zoulas.com>
+
+	* New FreeBSD version parsing code:
+	  Jon Noack <noackjr@alumni.rice.edu>
+
+	* Hackish support for ucs16 strings <christos@zoulas.com>
+
+2004-11-13 03:07  Christos Zoulas  <christos@zoulas.com>
+
+	* print the file name and line number in syntax errors.
+
+2004 10-12 10:50  Christos Zoulas  <christos@zoulas.com>
+
+	* Fix stack overwriting on 0 length strings: Tim Waugh
+	    <twaugh@redhat.com> Ned Ludd <solar@gentoo.org>
+
+2004-09-27 11:30  Christos Zoulas  <christos@zoulas.com>
+
+	* Remove 3rd and 4th copyright clause; approved by Ian Darwin.
+
+	* Fix small memory leaks; caught by: Tamas Sarlos 
+	    <stamas@csillag.ilab.sztaki.hu>
+
+2004-07-24 16:33  Christos Zoulas  <christos@zoulas.com>
+
+	* magic.mime update Danny Milosavljevic <danny.milo@gmx.net> 
+
+	* FreeBSD version update Oliver Eikemeier <eikemeier@fillmore-labs.com>
+
+	* utime/utimes detection Ian Lance Taylor <ian@wasabisystems.com>
+
+  	* errors reading elf magic Jakub Bogusz <qboosh@pld-linux.org>
+
+2004-04-12 10:55  Christos Zoulas  <christos@zoulas.com>
+
+	* make sure that magic formats match magic types during compilation
+
+	* fix broken sgi magic file
+
+2004-04-06 20:36  Christos Zoulas  <christos@zoulas.com>
+
+	* detect present of mbstate_t Petter Reinholdtsen <pere@hungry.com>
+
+	* magic fixes
+
+2004-03-22 15:25  Christos Zoulas  <christos@zoulas.com>
+
+	* Lots of mime fixes
+	  (Joerg Ostertag) <ostertag@rechengilde.de>
+
+	* FreeBSD ELF version handling
+	  (Edwin Groothuis) <edwin@mavetju.org>
+
+	* correct cleanup in all cases; don't just close the file.
+	  (Christos Zoulas) <christos@zoulas.com>
+
+	* add gettext message catalogue support
+	  (Michael Piefel) <piefel@debian.org>
+
+	* better printout for unreadable files
+	  (Michael Piefel) <piefel@debian.org>
+
+	* compensate for missing MAXPATHLEN
+	  (Michael Piefel) <piefel@debian.org>
+
+	* add wide character string length computation
+	  (Michael Piefel) <piefel@debian.org>
+
+	* Avoid infinite loops caused by bad elf alignments
+	  or name and description note sizes. Reported by
+	  (Mikael Magnusson) <mmikael@comhem.se>
+
+2004-03-09 13:55  Christos Zoulas  <christos@zoulas.com>
+
+	* Fix possible memory leak on error and add missing regfree
+	  (Dmitry V. Levin) <ldv@altlinux.org>
+
+2003-12-23 12:12  Christos Zoulas  <christos@zoulas.com>
+
+	* fix -k flag (Maciej W. Rozycki)
+
+2003-11-18 14:10  Christos Zoulas  <christos@zoulas.com>
+
+	* Try to give us much info as possible on corrupt elf files.
+	  (Willy Tarreau) <willy@w.ods.org>
+	* Updated python bindings (Brett Funderburg)
+	   <brettf@deepfile.com>
+
+2003-11-11 15:03  Christos Zoulas  <christos@zoulas.com>
+
+	* Include file.h first, because it includes config.h
+	  breaks largefile test macros otherwise.
+	  (Paul Eggert <eggert@CS.UCLA.EDU> via
+	   Lars Hecking <lhecking@nmrc.ie>)
+
+2003-10-14 21:39  Christos Zoulas  <christos@zoulas.com>
+
+	* Python bindings (Brett Funderburg) <brettf@deepfile.com>
+	* Don't lookup past the end of the buffer
+	  (Chad Hanson) <chanson@tcs-sec.com>
+	* Add MAGIC_ERROR and api on magic_errno()
+
+2003-10-08 12:40  Christos Zoulas  <christos@zoulas.com>
+
+	* handle error conditions from compile as fatal
+	  (Antti Kantee) <pooka@netbsd.org>
+	* handle magic filename parsing sanely
+	* more magic fixes.
+	* fix a memory leak (Illes Marton) <illes.marton@balabit.hu>
+	* describe magic file handling
+	  (Bryan Henderson) <bryanh@giraffe-data.com>
+
+2003-09-12 15:09  Christos Zoulas  <christos@zoulas.com>
+
+	* update magic files.
+	* remove largefile support from file.h; it breaks things on most OS's
+
+2003-08-10 10:25  Christos Zoulas  <christos@zoulas.com>
+
+	* fix unmapping'ing of mmaped files.
+
+2003-07-10 12:03  Christos Zoulas  <christos@zoulas.com>
+
+	* don't exit with -1 on error; always exit 1 (Marty Leisner)
+	* restore utimes code.
+
+2003-06-10 17:03  Christos Zoulas  <christos@zoulas.com>
+
+	* make sure we don't access uninitialized memory.
+	* pass lint
+	* #ifdef __cplusplus in magic.h
+
+2003-05-25 19:23  Christos Zoulas  <christos@zoulas.com>
+
+	* rename cvs magic file to revision to deal with
+	  case insensitive filesystems.
+
+2003-05-23 17:03  Christos Zoulas  <christos@zoulas.com>
+
+	* documentation fixes from Michael Piefel <piefel@debian.org>
+	* magic fixes (various)
+	* revert basename magic in .mgc name determination
+	* buffer protection in uncompress,
+	  signness issues,
+	  close files
+	  Maciej W. Rozycki <macro@ds2.pg.gda.pl
+
+2003-04-21 20:12  Christos Zoulas  <christos@zoulas.com>
+
+	* fix zsh magic
+
+2003-04-04 16:59  Christos Zoulas  <christos@zoulas.com>
+
+	* fix operand sort order in string.
+
+2003-04-02 17:30  Christos Zoulas  <christos@zoulas.com>
+
+	* cleanup namespace in magic.h
+
+2003-04-02 13:50  Christos Zoulas  <christos@zoulas.com>
+
+	* Magic additions (Alex Ott)
+	* Fix bug that broke VPATH compilation (Peter Breitenlohner)
+
+2003-03-28 16:03  Christos Zoulas  <christos@zoulas.com>
+
+	* remove packed attribute from magic struct.
+	* make the magic struct properly aligned.
+	* bump version number of compiled files to 2.
+
+2003-03-27 13:10  Christos Zoulas  <christos@zoulas.com>
+
+	* separate tar detection and run it before softmagic.
+	* fix reversed symlink test.
+	* fix version printing.
+	* make separator a string instead of a char.
+	* update manual page and sort options.
+
+2003-03-26 11:00  Christos Zoulas  <christos@zoulas.com>
+
+	* Pass lint
+	* make NULL in magic_file mean stdin
+	* Fix "-" argument to file to pass NULL to magic_file
+	* avoid pointer casts by using memcpy
+	* rename magic_buf -> magic_buffer
+	* keep only the first error
+	* manual page: new sentence, new line
+	* fix typo in api function (magic_buf -> magic_buffer)

+ 2 - 7
LEGAL.NOTICE

@@ -1,7 +1,7 @@
-$Id: LEGAL.NOTICE,v 1.11 1999/01/14 16:30:12 christos Exp $
+$Id: LEGAL.NOTICE,v 1.14 2004/09/11 19:15:56 christos Exp $
 Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
 Software written by Ian F. Darwin and others;
-maintained 1994-1999 Christos Zoulas.
+maintained 1994-2004 Christos Zoulas.
 
 This software is not subject to any export provision of the United States
 Department of Commerce, and may be exported to any country or planet.
@@ -15,11 +15,6 @@ are met:
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement:
-   This product includes software developed by Ian F. Darwin and others.
-4. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
  
 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

+ 1 - 1
MAINT

@@ -1,4 +1,4 @@
-$Id: MAINT,v 1.4 2000/04/11 02:43:51 christos Exp $
+$Id: MAINT,v 1.5 2003/03/23 04:36:37 christos Exp $
 
 Maintenance notes:
 

+ 0 - 39
Magdir/adventure

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

+ 0 - 10
Magdir/amigaos

@@ -1,10 +0,0 @@
-#------------------------------------------------------------------------------
-# amigaos:  file(1) magic for AmigaOS binary formats:
-
-#
-# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
-# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG
-# (the others should be separate, anyway)
-#
-0	belong		0x000003f3	AmigaOS loadseg()ble executable/binary
-0	belong		0x000003e7	AmigaOS object/library data

+ 0 - 170
Magdir/animation

@@ -1,170 +0,0 @@
-
-#------------------------------------------------------------------------------
-# animation:  file(1) magic for animation/movie formats
-#
-# animation formats
-# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
-# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
-
-# MPEG animation format
-0	belong		0x000001b3		MPEG video stream data
-#>4	beshort&0xfff0	x			(%d x
-#>5	beshort&0x0fff  x			%d)
-0	belong		0x000001ba		MPEG system stream data
-
-# MPEG Audio (*.mpx)
-# from dreesen@math.fu-berlin.de
-
-# XXX
-# This conflicts with the FF FE signature for UTF-16-encoded Unicode
-# text, which will be identified as an MP3 file.  I don't have any MP3s
-# so I don't know how to (or even if it's possible to) change this to
-# tell the two apart.    enf@pobox.com
-
-0       beshort         &0xfff0         MP
-# MPEG 1.0
->1      byte&0x08       =0x08           \b
-# Layer 3
->>1     byte            &0x02           \b3
->>>2    byte&0xf0       =0x10           \b,  32 kBits
->>>2    byte&0xf0       =0x20           \b,  40 kBits
->>>2    byte&0xf0       =0x30           \b,  48 kBits
->>>2    byte&0xf0       =0x40           \b,  56 kBits
->>>2    byte&0xf0       =0x50           \b,  64 kBits
->>>2    byte&0xf0       =0x60           \b,  80 kBits
->>>2    byte&0xf0       =0x70           \b,  96 kBits
->>>2    byte&0xf0       =0x80           \b, 112 kBits
->>>2    byte&0xf0       =0x90           \b, 128 kBits
->>>2    byte&0xf0       =0xA0           \b, 160 kBits
->>>2    byte&0xf0       =0xB0           \b, 192 kBits
->>>2    byte&0xf0       =0xC0           \b, 224 kBits
->>>2    byte&0xf0       =0xD0           \b, 256 kBits
->>>2    byte&0xf0       =0xE0           \b, 320 kBits
-# Layer 2
->>1     byte            &0x04           \b2
->>>2    byte&0xf0       =0x10           \b,  32 kBits
->>>2    byte&0xf0       =0x20           \b,  48 kBits
->>>2    byte&0xf0       =0x30           \b,  56 kBits
->>>2    byte&0xf0       =0x40           \b,  64 kBits
->>>2    byte&0xf0       =0x50           \b,  80 kBits
->>>2    byte&0xf0       =0x60           \b,  96 kBits
->>>2    byte&0xf0       =0x70           \b, 112 kBits
->>>2    byte&0xf0       =0x80           \b, 128 kBits
->>>2    byte&0xf0       =0x90           \b, 160 kBits
->>>2    byte&0xf0       =0xA0           \b, 192 kBits
->>>2    byte&0xf0       =0xB0           \b, 224 kBits
->>>2    byte&0xf0       =0xC0           \b, 256 kBits
->>>2    byte&0xf0       =0xD0           \b, 320 kBits
->>>2    byte&0xf0       =0xE0           \b, 384 kBits
-# freq
->>2     byte&0x0C       =0x00           \b, 44.1 kHz
->>2     byte&0x0C       =0x04           \b, 48 kHz
->>2     byte&0x0C       =0x08           \b, 32 kHz
-# MPEG 2.0
->1      byte&0x08       =0x00           \b
-# Layer 3
->>1     byte            &0x02           \b3
-# Layer 2
->>1     byte            &0x04           \b2
->>2     byte&0xf0       =0x10           \b,   8 kBits
->>2     byte&0xf0       =0x20           \b,  16 kBits
->>2     byte&0xf0       =0x30           \b,  24 kBits
->>2     byte&0xf0       =0x40           \b,  32 kBits
->>2     byte&0xf0       =0x50           \b,  40 kBits
->>2     byte&0xf0       =0x60           \b,  48 kBits
->>2     byte&0xf0       =0x70           \b,  56 kBits
->>2     byte&0xf0       =0x80           \b,  64 kBits
->>2     byte&0xf0       =0x90           \b,  80 kBits
->>2     byte&0xf0       =0xA0           \b,  96 kBits
->>2     byte&0xf0       =0xB0           \b, 112 kBits
->>2     byte&0xf0       =0xC0           \b, 128 kBits
->>2     byte&0xf0       =0xD0           \b, 144 kBits
->>2     byte&0xf0       =0xE0           \b, 160 kBits
-# freq
->>2     byte&0x0C       =0x00           \b, 22.05 kHz
->>2     byte&0x0C       =0x04           \b, 24 kHz
->>2     byte&0x0C       =0x08           \b, 16 kHz
-# misc
->3      byte&0xC0       =0x00           \b, Stereo
->3      byte&0xC0       =0x40           \b, JStereo
->3      byte&0xC0       =0x80           \b, Dual-Ch
->3      byte&0xC0       =0xC0           \b, Mono
-#>1     byte&0x01       =0x00           \b, Error Protection
-#>2     byte&0x02       =0x02           \b, Padding
-#>2     byte&0x01       =0x01           \b, Private
-#>3     byte&0x08       =0x08           \b, Copyright
-#>3     byte&0x04       =0x04           \b, Original
-#>3     byte&0x03       1               \b, Emphasis 5
-#>3     byte&0x03       3               \b, Emphasis c
-
-# FLI animation format
-4	leshort		0xAF11			FLI file
->6	leshort		x			- %d frames,
->8	leshort		x			width=%d pixels,
->10	leshort		x			height=%d pixels,
->12	leshort		x			depth=%d,
->16	leshort		x			ticks/frame=%d
-# FLC animation format
-4	leshort		0xAF12			FLC file
->6	leshort		x			- %d frames
->8	leshort		x			width=%d pixels,
->10	leshort		x			height=%d pixels,
->12	leshort		x			depth=%d,
->16	leshort		x			ticks/frame=%d
-
-# DL animation format
-# XXX - collision with most `mips' magic
-#
-# I couldn't find a real magic number for these, however, this
-# -appears- to work.  Note that it might catch other files, too, so be
-# careful!
-#
-# Note that title and author appear in the two 20-byte chunks
-# at decimal offsets 2 and 22, respectively, but they are XOR'ed with
-# 255 (hex FF)!  The DL format is really bad.
-#
-#0	byte	1	DL version 1, medium format (160x100, 4 images/screen)
-#>42	byte	x	- %d screens,
-#>43	byte	x	%d commands
-#0	byte	2	DL version 2
-#>1	byte	1	- large format (320x200,1 image/screen),
-#>1	byte	2	- medium format (160x100,4 images/screen),
-#>1	byte	>2	- unknown format,
-#>42	byte	x	%d screens,
-#>43	byte	x	%d commands
-# Based on empirical evidence, DL version 3 have several nulls following the
-# \003.  Most of them start with non-null values at hex offset 0x34 or so.
-#0	string	\3\0\0\0\0\0\0\0\0\0\0\0	DL version 3
-
-# SGI and Apple formats
-0	string		MOVI		Silicon Graphics movie file
-4	string		moov		Apple QuickTime movie file (moov)
-4	string		mdat		Apple QuickTime movie file (mdat)
-
-# iso 13818 transport stream
-#
-# from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
-# (the following is a little bit restrictive and works fine for a stream
-#  that starts with PAT properly. it won't work for stream data, that is
-#  cut from an input device data right in the middle, but this shouldn't
-#  disturb)
-# syncbyte      8 bit	0x47
-# error_ind     1 bit	-
-# payload_start 1 bit	1
-# priority      1 bit	-
-# PID          13 bit	0x0000
-# scrambling    2 bit	-
-# adaptfld_ctrl 2 bit	1 or 3
-# conti_count   4 bit	0
-0	belong&0xFF5FFF1F	0x47400010	MPEG transport stream data
->188	byte			!0x47		CORRUPTED
-
-# DIF digital video file format <mpruett@sgi.com>
-0	belong&0xffffff00	0x1f070000      DIF
->4	byte			&0x01		(DVCPRO) movie file
->4	byte			^0x01		(DV) movie file
->3	byte			&0x80		(PAL)
->3	byte			^0x80		(NTSC)
-
-# Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
-0	belong			0x3026b275	Microsoft ASF

+ 0 - 144
Magdir/audio

@@ -1,144 +0,0 @@
-
-#------------------------------------------------------------------------------
-# 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
-0	string		.RMF		RealMedia 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
-# Not good enough.
-#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
-
-# sidfiles <pooka@iki.fi>
-0	string		SIDPLAY\ INFOFILE	Sidplay info file
-0	string		PSID			PlaySID v2.2+ (AMIGA) sidtune
->4	beshort		>0			w/ header v%d,
->14	beshort		=1			single song,
->14	beshort		>1			%d songs,
->16	beshort		>0			default song: %d
-
-# IRCAM <mpruett@sgi.com>
-# VAX and MIPS files are little-endian; Sun and NeXT are big-endian
-0	belong		0x64a30100		IRCAM file (VAX)
-0	belong		0x64a30200		IRCAM file (Sun)
-0	belong		0x64a30300		IRCAM file (MIPS little-endian)
-0	belong		0x64a30400		IRCAM file (NeXT)
-
-# NIST SPHERE <mpruett@sgi.com>
-0	string		NIST_1A\n\ \ \ 1024\n	NIST SPHERE file
-
-# Sample Vision <mpruett@sgi.com>
-0	string		SOUND\ SAMPLE\ DATA\ 	Sample Vision file
-
-# Audio Visual Research <mpruett@sgi.com>
-0	string		2BIT			Audio Visual Research file
-
-# From Felix von Leitner <leitner@fefe.de>
-0	string		OggS	Ogg-Vorbis compressed sound file
-
-# SGI SoundTrack <mpruett@sgi.com>
-0	string		_SGI_SoundTrack		SGI SoundTrack project file
-0	string		ID3	mp3 file with ID3 2.0 tag

+ 0 - 13
Magdir/c-lang

@@ -1,13 +0,0 @@
-
-#------------------------------------------------------------------------------
-# c-lang:  file(1) magic for C programs (or REXX)
-#
-
-# XPM icons (Greg Roelofs, newt@uchicago.edu)
-# if you uncomment "/*" for C/REXX below, also uncomment this entry
-#0	string		/*\ XPM\ */	X pixmap image data
-
-# this first will upset you if you're a PL/1 shop...
-# in which case rm it; ascmagic will catch real C programs
-#0	string		/*		C or REXX program text
-0	string		//		C++ program text

+ 0 - 74
Magdir/database

@@ -1,74 +0,0 @@
-
-#------------------------------------------------------------------------------
-# database:  file(1) magic for various databases
-#
-# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
-#
-#
-# GDBM magic numbers
-#  Will be maintained as part of the GDBM distribution in the future.
-#  <downsj@teeny.org>
-0	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian
-0	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian
-0	string	GDBM		GNU dbm 2.x database
-#
-# Berkeley DB
-#
-# Ian Darwin's file /etc/magic files: big/little-endian version.
-#
-# Hash 1.85/1.86 databases store metadata in network byte order.
-# Btree 1.85/1.86 databases store the metadata in host byte order.
-# Hash and Btree 2.X and later databases store the metadata in host byte order.
-
-0	long	0x00061561	Berkeley DB
->8	belong	4321
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, native byte-order)
->8	belong	1234
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, little-endian)
-
-0	belong	0x00061561	Berkeley DB
->8	belong	4321
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, big-endian)
->8	belong	1234
->>4	belong	>2		1.86
->>4	belong	<3		1.85
->>4	belong	>0		(Hash, version %d, native byte-order)
-
-0	long	0x00053162	Berkeley DB 1.85/1.86
->4	long	>0		(Btree, version %d, native byte-order)
-0	belong	0x00053162	Berkeley DB 1.85/1.86
->4	belong	>0		(Btree, version %d, big-endian)
-0	lelong	0x00053162	Berkeley DB 1.85/1.86
->4	lelong	>0		(Btree, version %d, little-endian)
-
-12	long	0x00061561	Berkeley DB
->16	long	>0		(Hash, version %d, native byte-order)
-12	belong	0x00061561	Berkeley DB
->16	belong	>0		(Hash, version %d, big-endian)
-12	lelong	0x00061561	Berkeley DB
->16	lelong	>0		(Hash, version %d, little-endian)
-
-12	long	0x00053162	Berkeley DB
->16	long	>0		(Btree, version %d, native byte-order)
-12	belong	0x00053162	Berkeley DB
->16	belong	>0		(Btree, version %d, big-endian)
-12	lelong	0x00053162	Berkeley DB
->16	lelong	>0		(Btree, version %d, little-endian)
-
-12	long	0x00042253	Berkeley DB
->16	long	>0		(Queue, version %d, native byte-order)
-12	belong	0x00042253	Berkeley DB
->16	belong	>0		(Queue, version %d, big-endian)
-12	lelong	0x00042253	Berkeley DB
->16	lelong	>0		(Queue, version %d, little-endian)
-#
-#
-# Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
-0	string	RRD		RRDTool DB
->4	string	x		version %s

+ 0 - 118
Magdir/filesystems

@@ -1,118 +0,0 @@
-
-#------------------------------------------------------------------------------
-# filesystems:  file(1) magic for different filesystems
-#
-0	string	\366\366\366\366	PC formatted floppy with no filesystem
-# Sun disk labels
-# From /usr/include/sun/dklabel.h:
-0774	beshort		0xdabe		Sun disk label
->0	string		x		'%s
->>31  	string		>\0		\b%s
->>>63  	string		>\0		\b%s
->>>>95 	string		>\0		\b%s
->0	string		x		\b'
->0734	short		>0		%d rpm,
->0736	short		>0		%d phys cys,
->0740	short		>0		%d alts/cyl,
->0746	short		>0		%d interleave,
->0750	short		>0		%d data cyls,
->0752	short		>0		%d alt cyls,
->0754	short		>0		%d heads/partition,
->0756	short		>0		%d sectors/track,
->0764	long		>0		start cyl %ld,
->0770	long		x		%ld blocks
-# Is there a boot block written 1 sector in?
->512    belong&077777777	0600407	\b, boot block present
-0x1FE	leshort	0xAA55			x86 boot sector
->2	string	OSBS			\b, OS/BS MBR
->0x8C	string	Invalid\ partition\ table	\b, MS-DOS MBR
->0	string	\0\0\0\0		\b, extended partition table
->0	leshort 0x3CEB			\b, system
->>3	string	>\0			%s
->>0x36	string	FAT			\b, %s
->>>0x39	string	12			(%s bit)
->>>0x39	string	16			(%s bit)
->0x52	string	FAT32			\b, FAT (32 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
-
-9564	lelong		0x00011954	Unix Fast File system (little-endian),
->8404	string		x		last mounted on %s,
-#>9504	ledate		x		last checked at %s,
->8224	ledate		x		last written at %s,
->8401	byte		x		clean flag %d,
->8228	lelong		x		number of blocks %d,
->8232	lelong		x		number of data blocks %d,
->8236	lelong		x		number of cylinder groups %d,
->8240	lelong		x		block size %d,
->8244	lelong		x		fragment size %d,
->8252	lelong		x		minimum percentage of free blocks %d,
->8256	lelong		x		rotational delay %dms,
->8260	lelong		x		disk rotational speed %drps,
->8320	lelong		0		TIME optimization
->8320	lelong		1		SPACE optimization
-
-9564	belong		0x00011954	Unix Fast File system (big-endian),
->8404	string		x		last mounted on %s,
-#>9504	bedate		x		last checked at %s,
->8224	bedate		x		last written at %s,
->8401	byte		x		clean flag %d,
->8228	belong		x		number of blocks %d,
->8232	belong		x		number of data blocks %d,
->8236	belong		x		number of cylinder groups %d,
->8240	belong		x		block size %d,
->8244	belong		x		fragment size %d,
->8252	belong		x		minimum percentage of free blocks %d,
->8256	belong		x		rotational delay %dms,
->8260	belong		x		disk rotational speed %drps,
->8320	belong		0		TIME optimization
->8320	belong		1		SPACE optimization
-
-# ext2/ext3 filesystems - Andreas Dilger <adilger@turbolabs.com>
-0x438	leshort		0xEF53		Linux
->0x44c	lelong		x		rev %d
->0x43e	leshort		x		\b.%d
->0x45c	lelong		^0x0000004	ext2 filesystem data
->>0x43a	leshort		^0x0000001	(mounted or unclean)
->0x45c	lelong		&0x0000004	ext3 filesystem data
->>0x460	lelong		&0x0000004	(needs journal recovery)
->0x43a	leshort		&0x0000002	(errors)
->0x460	lelong		&0x0000001	(compressed)
-#>0x460	lelong		&0x0000002	(filetype)
-#>0x464	lelong		&0x0000001	(sparse_super)
->0x464	lelong		&0x0000002	(large files)
-
-# SGI disk labels - Nathan Scott <nathans@debian.org>
-0	belong		0x0BE5A941	SGI disk label (volume header)
-
-# SGI XFS filesystem - Nathan Scott <nathans@debian.org>
-0	belong		0x58465342	SGI XFS filesystem data
->0x4	belong		x		(blksz=3D%d,
->0x68	beshort		x		inosz=3D%d,
->0x64	beshort		^0x2004		v1 dirs)
->0x64	beshort		&0x2004		v2 dirs)

+ 0 - 12
Magdir/gnu

@@ -1,12 +0,0 @@
-#
-# 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
-# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
-0	string		*nazgul*	Nazgul style compiled message catalog
->8	lelong		>0		\b, version %ld

+ 0 - 61
Magdir/jpeg

@@ -1,61 +0,0 @@
-
-#------------------------------------------------------------------------------
-# JPEG images
-# SunOS 5.5.1 had
-#
-#	0	string		\377\330\377\340	JPEG file
-#	0	string		\377\330\377\356	JPG file
-#
-# both of which turn into "JPEG image data" here.
-#
-0	beshort		0xffd8		JPEG image data
->6	string		JFIF		\b, JFIF standard
->6	string		Exif		\b, EXIF standard
-# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
-# in a vain attempt to add image size reporting for JFIF.  Note that these
-# tests are not fool-proof since some perfectly valid JPEGs are currently
-# impossible to specify in magic(4) format.
-# First, a little JFIF version info:
->11	byte		x		\b %d.
->12	byte		x		\b%02d
-# Next, the resolution or aspect ratio of the image:
->13	byte		0		\b, aspect ratio
->13	byte		1		\b, resolution (DPI)
->13	byte		2		\b, resolution (DPCM)
-#>4	beshort		x		\b, segment length %d
-# Next, show thumbnail info, if it exists:
->18	byte		!0		\b, thumbnail %dx
->>19	byte		x		\b%d
-# Here things get sticky.  We can do ONE MORE marker segment with
-# indirect addressing, and that's all.  It would be great if we could
-# do pointer arithemetic like in an assembler language.  Christos?
-# And if there was some sort of looping construct to do searches, plus a few
-# named accumulators, it would be even more effective...
-# At least we can show a comment if no other segments got inserted before:
->(4.S+5)	byte		0xFE
->>(4.S+8)	string		>\0		\b, "%s"
-#>(4.S+5)	byte		0xFE		\b, comment
-#>>(4.S+6)	beshort		x		\b length=%d
-#>>(4.S+8)	string		>\0		\b, "%s"
-# Or, we can show the encoding type (I've included only the three most common)
-# and image dimensions if we are lucky and the SOFn (image segment) is here:
->(4.S+5)	byte		0xC0		\b, baseline
->>(4.S+6)	byte		x		\b, precision %d
->>(4.S+7)	beshort		x		\b, %dx
->>(4.S+9)	beshort		x		\b%d
->(4.S+5)	byte		0xC1		\b, extended sequential
->>(4.S+6)	byte		x		\b, precision %d
->>(4.S+7)	beshort		x		\b, %dx
->>(4.S+9)	beshort		x		\b%d
->(4.S+5)	byte		0xC2		\b, progressive
->>(4.S+6)	byte		x		\b, precision %d
->>(4.S+7)	beshort		x		\b, %dx
->>(4.S+9)	beshort		x		\b%d
-# I've commented-out quantisation table reporting.  I doubt anyone cares yet.
-#>(4.S+5)	byte		0xDB		\b, quantisation table
-#>>(4.S+6)	beshort		x		\b length=%d
->14	beshort		x		\b, %d x
->16	beshort		x		\b %d
-
-# HSI is Handmade Software's proprietary JPEG encoding scheme
-0	string		hsi1		JPEG image data, HSI proprietary

+ 0 - 101
Magdir/linux

@@ -1,101 +0,0 @@
-
-#------------------------------------------------------------------------------
-# linux:  file(1) magic for Linux files
-#
-# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
-# The following basic Linux magic is useful for reference, but using
-# "long" magic is a better practice in order to avoid collisions.
-#
-# 2	leshort		100		Linux/i386
-# >0	leshort		0407		impure executable (OMAGIC)
-# >0	leshort		0410		pure executable (NMAGIC)
-# >0	leshort		0413		demand-paged executable (ZMAGIC)
-# >0	leshort		0314		demand-paged executable (QMAGIC)
-#
-0	lelong		0x00640107	Linux/i386 impure executable (OMAGIC)
->16	lelong		0		\b, stripped
-0	lelong		0x00640108	Linux/i386 pure executable (NMAGIC)
->16	lelong		0		\b, stripped
-0	lelong		0x0064010b	Linux/i386 demand-paged executable (ZMAGIC)
->16	lelong		0		\b, stripped
-0	lelong		0x006400cc	Linux/i386 demand-paged executable (QMAGIC)
->16	lelong		0		\b, stripped
-#
-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
-# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
-216	lelong		0421		Linux/i386 core file
->220	string		>\0		of '%s'
->200	lelong		>0		(signal %d)
-#
-# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com>
-# this can be overridden by the DOS executable (COM) entry
-2	string		LILO		Linux/i386 LILO boot/chain loader
-#
-# Debian Packages, from Peter Tobias <tobias@server.et-inf.fho-emden.de>
-0	string		0.9
->8	byte		0x0a		old Debian Binary Package
->>3	byte		>0		\b, created by dpkg 0.9%c
->>4	byte		>0		pl%c
-# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
-0	leshort		0x0436		Linux/i386 PC Screen Font data,
->2	byte		0		256 characters, no directory,
->2	byte		1		512 characters, no directory,
->2	byte		2		256 characters, Unicode directory,
->2	byte		3		512 characters, Unicode directory,
->3	byte		>0		8x%d
-# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
-4086	string		SWAP-SPACE	Linux/i386 swap file
-# ECOFF magic for OSF/1 and Linux (only tested under Linux though)
-#
-#	from Erik Troan (ewt@redhat.com) examining od dumps, so this
-#		could be wrong
-#      updated by David Mosberger (davidm@azstarnet.com) based on
-#      GNU BFD and MIPS info found below.
-#
-0	leshort		0x0183		ECOFF alpha
->24	leshort		0407		executable
->24	leshort		0410		pure
->24	leshort		0413		demand paged
->8	long		>0		not stripped
->8	long		0		stripped
->23	leshort		>0		- version %ld.
-#
-# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
-# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
-# 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
->>529		byte	0		zImage data,
->>529		byte	1		bzImage data,
->0x048c		byte	0x31
->>0x048c	string	x		version %s
->0x0493		byte	0x31
->>0x0493	string	x		version %s
->0x048c		byte	0x32
->>0x048c	string	x		version %s
->0x0493		byte	0x32
->>0x0493	string	x		version %s
->0x04df		byte	0x32
->>0x04df	string	x		version %s
->0x04fb		byte	0x32
->>0x04fb	string	x		version %s
-# This also matches new kernels, which were caught above by "HdrS".
-0		belong	0xb8c0078e	Linux kernel
->0x1e3		string	Loading		version 1.3.79 or older
->0x1e9		string	Loading		from prehistoric times
-# LSM entries - Nicolás Lichtmaier <nick@feedback.net.ar>
-0	string	Begin3	Linux Software Map entry text

+ 0 - 335
Magdir/macintosh

@@ -1,335 +0,0 @@
-
-#------------------------------------------------------------------------------
-# macintosh description
-#
-# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
-# Daniel Quinlan, quinlan@yggdrasil.com
-11	string	must\ be\ converted\ with\ BinHex	BinHex binary text
->41	string	x					\b, version %.3s
-
-# Stuffit archives are the de facto standard of compression for Macintosh
-# files obtained from most archives. (franklsm@tuns.ca)
-0	string		SIT!			StuffIt Archive (data)
->2	string		x			: %s
-0	string		SITD			StuffIt Deluxe (data)
->2	string		x			: %s
-0	string		Seg			StuffIt Deluxe Segment (data)
->2	string		x			: %s
-
-# Macintosh Applications and Installation binaries (franklsm@tuns.ca)
-0	string		APPL			Macintosh Application (data)
->2	string		x			\b: %s
-
-# Macintosh System files (franklsm@tuns.ca)
-0	string		zsys			Macintosh System File (data)
-0	string		FNDR			Macintosh Finder (data)
-0	string		libr			Macintosh Library (data)
->2	string		x			: %s
-0	string		shlb			Macintosh Shared Library (data)
->2	string		x			: %s
-0	string		cdev			Macintosh Control Panel (data)
->2	string		x			: %s
-0	string		INIT			Macintosh Extension (data)
->2	string		x			: %s
-0	string		FFIL			Macintosh Truetype Font (data)
->2	string		x			: %s
-0	string		LWFN			Macintosh Postscript Font (data)
->2	string		x			: %s
-
-# Additional Macintosh Files (franklsm@tuns.ca)
-0	string		PACT			Macintosh Compact Pro Archive (data)
->2	string		x			: %s
-0	string		ttro			Macintosh TeachText File (data)
->2	string		x			: %s
-0	string		TEXT			Macintosh TeachText File (data)
->2	string		x			: %s
-0	string		PDF			Macintosh PDF File (data)
->2	string		x			: %s
-
-# MacBinary format (Eric Fischer, enf@pobox.com)
-#
-# Unfortunately MacBinary doesn't really have a magic number prior
-# to the MacBinary III format.  The checksum is really the way to
-# do it, but the magic file format isn't up to the challenge.
-#
-# 0	byte		0
-# 1	byte				# filename length
-# 2	string				# filename
-# 65    string				# file type
-# 69	string				# file creator
-# 73	byte				# Finder flags
-# 74	byte		0
-# 75	beshort				# vertical posn in window
-# 77	beshort				# horiz posn in window
-# 79	beshort				# window or folder ID
-# 81    byte				# protected?
-# 82	byte		0
-# 83	belong				# length of data segment
-# 87	belong				# length of resource segment
-# 91	belong				# file creation date
-# 95	belong				# file modification date
-# 99	beshort				# length of comment after resource
-# 101	byte				# new Finder flags
-# 102	string		mBIN		# (only in MacBinary III)
-# 106	byte				# char. code of file name
-# 107	byte				# still more Finder flags
-# 116	belong				# total file length
-# 120	beshort				# length of add'l header
-# 122	byte		129		# for MacBinary II
-# 122	byte		130		# for MacBinary III
-# 123	byte		129		# minimum version that can read fmt
-# 124	beshort				# checksum
-#
-# This attempts to use the version numbers as a magic number, requiring
-# that the first one be 0x80, 0x81, 0x82, or 0x83, and that the second
-# be 0x81.  This works for the files I have, but maybe not for everyone's.
-
-122	beshort&0xFCFF	0x8081		Macintosh MacBinary data
-
-# MacBinary I doesn't have the version number field at all, but MacBinary II
-# has been in use since 1987 so I hope there aren't many really old files
-# floating around that this will miss.  The original spec calls for using
-# the nulls in 0, 74, and 82 as the magic number.
-#
-# Another possibility, that would also work for MacBinary I, is to use
-# the assumption that 65-72 will all be ASCII (0x20-0x7F), that 73 will
-# have bits 1 (changed), 2 (busy), 3 (bozo), and 6 (invisible) unset,
-# and that 74 will be 0.  So something like
-# 
-# 71 	belong&0x80804EFF 0x00000000 	Macintosh MacBinary data
-# 
-# >73	byte&0x01	0x01		\b, inited
-# >73	byte&0x02	0x02		\b, changed
-# >73	byte&0x04	0x04		\b, busy
-# >73	byte&0x08	0x08		\b, bozo
-# >73	byte&0x10	0x10		\b, system
-# >73	byte&0x10	0x20		\b, bundle
-# >73	byte&0x10	0x40		\b, invisible
-# >73	byte&0x10	0x80		\b, locked
-
->65	string		x		\b, type "%4.4s"
-
->65	string		8BIM		(PhotoShop)
->65	string		ALB3		(PageMaker 3)
->65	string		ALB4		(PageMaker 4)
->65	string		ALT3		(PageMaker 3)
->65	string		APPL		(application)
->65	string		AWWP		(AppleWorks word processor)
->65	string		CIRC		(simulated circuit)
->65	string		DRWG		(MacDraw)
->65	string		EPSF		(Encapsulated PostScript)
->65	string		FFIL		(font suitcase)
->65	string		FKEY		(function key)
->65	string		FNDR		(Macintosh Finder)
->65	string		GIFf		(GIF image)
->65	string		Gzip		(GNU gzip)
->65	string		INIT		(system extension)
->65	string		LIB\ 		(library)
->65	string		LWFN		(PostScript font)
->65	string		MSBC		(Microsoft BASIC)
->65	string		PACT		(Compact Pro archive)
->65	string		PDF\ 		(Portable Document Format)
->65	string		PICT		(picture)
->65	string		PNTG		(MacPaint picture)
->65	string		PREF		(preferences)
->65	string		PROJ		(Think C project)
->65	string		QPRJ		(Think Pascal project)
->65	string		SCFL		(Defender scores)
->65	string		SCRN		(startup screen)
->65	string		SITD		(StuffIt Deluxe)
->65	string		SPn3		(SuperPaint)
->65	string		STAK		(HyperCard stack)
->65	string		Seg\ 		(StuffIt segment)
->65	string		TARF		(Unix tar archive)
->65	string		TEXT		(ASCII)
->65	string		TIFF		(TIFF image)
->65	string		TOVF		(Eudora table of contents)
->65	string		WDBN		(Microsoft Word word processor)
->65	string		WORD		(MacWrite word processor)
->65	string		XLS\ 		(Microsoft Excel)
->65	string		ZIVM		(compress (.Z))
->65	string		ZSYS		(Pre-System 7 system file)
->65	string		acf3		(Aldus FreeHand)
->65	string		cdev		(control panel)
->65	string		dfil		(Desk Acessory suitcase)
->65	string		libr		(library)
->65	string		nX^d		(WriteNow word processor)
->65	string		nX^w		(WriteNow dictionary)
->65	string		rsrc		(resource)
->65	string		scbk		(Scrapbook)
->65	string		shlb		(shared library)
->65	string		ttro		(SimpleText read-only)
->65	string		zsys		(system file)
-
->69	string		x		\b, creator "%4.4s"
-
-# Somewhere, Apple has a repository of registered Creator IDs.  These are
-# just the ones that I happened to have files from and was able to identify.
-
->69	string		8BIM		(Adobe Photoshop)
->69	string		ALD3		(PageMaker 3)
->69	string		ALD4		(PageMaker 4)
->69	string		ALFA		(Alpha editor)
->69	string		APLS		(Apple Scanner)
->69	string		APSC		(Apple Scanner)
->69	string		BRKL		(Brickles)
->69	string		BTFT		(BitFont)
->69	string		CCL2 		(Common Lisp 2)
->69	string		CCL\ 		(Common Lisp)
->69	string		CDmo		(The Talking Moose)
->69	string		CPCT		(Compact Pro)
->69	string		CSOm		(Eudora)
->69	string		DMOV		(Font/DA Mover)
->69	string		DSIM		(DigSim)
->69	string		EDIT		(Macintosh Edit)
->69	string		ERIK		(Macintosh Finder)
->69	string		EXTR		(self-extracting archive)
->69	string		Gzip		(GNU gzip)
->69	string		KAHL		(Think C)
->69	string		LWFU		(LaserWriter Utility)
->69	string		LZIV		(compress)
->69	string		MACA		(MacWrite)
->69	string		MACS		(Macintosh operating system)
->69	string		MAcK		(MacKnowledge terminal emulator)
->69	string		MLND		(Defender)
->69	string		MPNT		(MacPaint)
->69	string		MSBB		(Microsoft BASIC (binary))
->69	string		MSWD		(Microsoft Word)
->69	string		NCSA		(NCSA Telnet)
->69	string		PJMM		(Think Pascal)
->69	string		PSAL		(Hunt the Wumpus)
->69	string		PSI2		(Apple File Exchange)
->69	string		R*ch		(BBEdit)
->69	string		RMKR		(Resource Maker)
->69	string		RSED		(Resource Editor)
->69	string		Rich		(BBEdit)
->69	string		SIT!		(StuffIt)
->69	string		SPNT		(SuperPaint)
->69	string		Unix		(NeXT Mac filesystem)
->69	string		VIM!		(Vim editor)
->69	string		WILD		(HyperCard)
->69	string		XCEL		(Microsoft Excel)
->69	string		aCa2		(Fontographer)
->69	string		aca3		(Aldus FreeHand)
->69	string		dosa		(Macintosh MS-DOS file system)
->69	string		movr		(Font/DA Mover)
->69	string		nX^n		(WriteNow)
->69	string		pdos		(Apple ProDOS file system)
->69	string		scbk		(Scrapbook)
->69	string		ttxt		(SimpleText)
->69	string		ufox		(Foreign File Access)
-
-# Just in case...
-
-102	string		mBIN		MacBinary III data with surprising version number
-
-# sas magic from Bruce Foster (bef@nwu.edu)
-#
-#0	string		SAS		SAS
-#>8	string		x		%s
-0	string		SAS		SAS
->24	string		DATA		data file
->24	string		CATALOG		catalog
->24	string		INDEX		data file index
->24	string		VIEW		data view
-# spss magic for SPSS system and portable files, 
-#	 from Bruce Foster (bef@nwu.edu).
-
-0	long		0xc1e2c3c9	SPSS Portable File
->40	string 		x		%s
-
-0	string		$FL2		SPSS System File
->24	string		x		%s
-
-# Macintosh filesystem data
-# From "Tom N Harris" <telliamed@mac.com>
-# The MacOS epoch begins on 1 Jan 1904 instead of 1 Jan 1970, so these
-# entries depend on the data arithmetic added after v.35
-# There's also some Pascal strings in here, ditto...
-
-# The boot block signature, according to IM:Files, is 
-# "for HFS volumes, this field always contains the value 0x4C4B."
-# But if this is true for MFS or HFS+ volumes, I don't know.
-# Alternatively, the boot block is supposed to be zeroed if it's
-# unused, so a simply >0 should suffice.
-
-0x400	beshort			0xD2D7		Macintosh MFS data
->0	beshort			0x4C4B		(bootable)
->0x40a	beshort			&0x8000		(locked)
->0x402	beldate-0x7C25B080	x		created: %s,
->0x406	beldate-0x7C25B080	>0		last backup: %s,
->0x414	belong			x		block size: %d,
->0x412	beshort			x		number of blocks: %d,
->0x424	pstring			x		volume name: %s
-
-0x400	beshort			0x4244		Macintosh HFS data
->0	beshort			0x4C4B		(bootable)
->0x40a	beshort			&0x8000		(locked)
->0x40a	beshort			^0x0100		(mounted)
->0x40a	beshort			&0x0800		(unclean)
->0x402	beldate-0x7C25B080	x		created: %s,
->0x406	beldate-0x7C25B080	x		last modified: %s,
->0x440	beldate-0x7C25B080	>0		last backup: %s,
->0x414	belong			x		block size: %d,
->0x412	beshort			x		number of blocks: %d,
->0x424	pstring			x		volume name: %s
-#>0x480	beshort			=0x482B		Embedded HFS+ Volume:
-#>>((0x482*(0x414))+(0x41c*512))	x	\b
-# Well, this is (theoretically) how we could do this. But it occurs to
-# me that we likely don't read in a large enough chunk. I don't have any
-# HFS+ volumes to see what a typical offset would be.
-
-0x400	beshort			0x482B		Macintosh HFS Extended
->&2	beshort			x		version %d data
->0	beshort			0x4C4B		(bootable)
->&4	belong			^0x00000100	(mounted)
->&4	belong			&0x00000800	(unclean)
->&4	belong			&0x00008000	(locked)
->&8	string			x		last mounted by: '%.4s',
-# really, that should be treated as a belong and we print a string
-# based on the value. TN1150 only mentions '8.10' for "MacOS 8.1"
->&16	beldate-0x7C25B080	x		created: %s,
->&20	beldate-0x7C25B080	x		last modified: %s,
->&24	beldate-0x7C25B080	>0		last backup: %s,
->&28	beldate-0x7C25B080	>0		last checked: %s,
->&40	belong			x		block size: %d,
->&44	belong			x		number of blocks: %d,
->&48	belong			x		free blocks: %d
-
-# I don't think this is really necessary since it doesn't do much and 
-# anything with a valid driver descriptor will also have a valid
-# partition map
-#0		beshort		0x4552		Apple Device Driver data
-#>&24		beshort		=1		\b, MacOS
-
-# Is that the partition type a cstring or a pstring? Well, IM says "strings 
-# shorter than 32 bytes must be terminated with NULL" so I'll treat it as a 
-# cstring. Of course, partitions can contain more than four entries, but 
-# what're you gonna do?
-0x200		beshort		0x504D		Apple Partition data
->&2		beshort		x		block size: %d
->&48		string		x		first type: %s,
->&12		belong		x		number of blocks: %d,
->(&0x2.S)	beshort		0x504D		
->>&48		string		x		second type: %s
->>&12		belong		x		number of blocks: %d,
->>(&0x2.S)	beshort		0x504D		
->>>&48		string		x		third type: %s
->>>&12		belong		x		number of blocks: %d,
->>>(&0x2.S)	beshort		0x504D		
->>>>&48		string		x		fourth type: %s
->>>>&12		belong		x		number of blocks: %d,
-# AFAIK, only the signature is different
-0x200		beshort		0x5453		Apple Old Partition data
->&2		beshort		x		block size: %d
->&48		string		x		first type: %s,
->&12		belong		x		number of blocks: %d,
->(&0x2.S)	beshort		0x504D		
->>&48		string		x		second type: %s
->>&12		belong		x		number of blocks: %d,
->>(&0x2.S)	beshort		0x504D		
->>>&48		string		x		third type: %s
->>>&12		belong		x		number of blocks: %d,
->>>(&0x2.S)	beshort		0x504D		
->>>>&48		string		x		fourth type: %s
->>>>&12		belong		x		number of blocks: %d,

+ 0 - 31
Magdir/mcrypt

@@ -1,31 +0,0 @@
-#------------------------------------------------------------------------------
-# Mavroyanopoulos Nikos <nmav@hellug.gr>
-# mcrypt:   file(1) magic for mcrypt 2.2.x;
-0      string          \0m\2           mcrypt 2.2 encrypted data,
->3     byte            0               algorithm: blowfish-448,
->3     byte            1               algorithm: DES,
->3     byte            2               algorithm: 3DES,
->3     byte            3               algorithm: 3-WAY,
->3     byte            4               algorithm: GOST,
->3     byte            6               algorithm: SAFER-SK64,
->3     byte            7               algorithm: SAFER-SK128,
->3     byte            8               algorithm: CAST-128,
->3     byte            9               algorithm: xTEA,
->3     byte            10              algorithm: TWOFISH-128,
->3     byte            11              algorithm: RC2,
->3     byte            12              algorithm: TWOFISH-192,
->3     byte            13              algorithm: TWOFISH-256,
->3     byte            14              algorithm: blowfish-128,
->3     byte            15              algorithm: blowfish-192,
->3     byte            16              algorithm: blowfish-256,
->3     byte            100             algorithm: RC6,
->3     byte            101             algorithm: IDEA,
->4     byte            0               mode: CBC,
->4     byte            1               mode: ECB,
->4     byte            2               mode: CFB,
->4     byte            3               mode: OFB,
->4     byte            4               mode: nOFB,
->5     byte            0               keymode: 8bit
->5     byte            1               keymode: 4bit
->5     byte            2               keymode: SHA-1 hash
->5     byte            3               keymode: MD5 hash

+ 0 - 15
Magdir/palm

@@ -1,15 +0,0 @@
-
-#------------------------------------------------------------------------------
-# palm:  file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
-#
-# Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
-
-# appl
-60      belong                  0x6170706c      PalmOS application
->0      string                  >\0             "%s"
-# TEXt
-60      belong                  0x54455874      AportisDoc file
->0      string                  >\0             "%s"
-# HACK
-60      belong                  0x4841434b      HackMaster hack
->0      string                  >\0             "%s"

+ 0 - 5
Magdir/python

@@ -1,5 +0,0 @@
-# often the module starts with a multiline string
-0	string		"""	a python script text executable
-# MAGIC as specified in Python/import.c (1.5.2/1.6)
-# 20121  ( YEAR - 1995 ) + MONTH  + DAY (little endian followed by "\r\n"
-0	belong		0x994e0d0a	python compiled

+ 0 - 104
Magdir/riff

@@ -1,104 +0,0 @@
-
-#------------------------------------------------------------------------------
-# 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
->>20	leshort		2		\b, Microsoft ADPCM
->>20	leshort		6		\b, ITU G.711 a-law
->>20	leshort		7		\b, ITU G.711 u-law
->>20	leshort		17		\b, IMA ADPCM
->>20	leshort		20		\b, ITU G.723 ADPCM (Yamaha)
->>20	leshort		49		\b, GSM 6.10
->>20	leshort		64		\b, ITU G.721 ADPCM
->>20	leshort		80		\b, MPEG
->>20	leshort		85		\b, MPEG Layer 3
->>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
-
-# SoundFont 2 <mpruett@sgi.com>
->8	string		sfbk		SoundFont 2

+ 0 - 20
Magdir/sgml

@@ -1,20 +0,0 @@
-
-#------------------------------------------------------------------------------
-# sgml:  file(1) magic for Standard Generalized Markup Language
-# HyperText Markup Language (HTML) is an SGML document type,
-# from Daniel Quinlan (quinlan@yggdrasil.com)
-# adapted to string extenstions by Anthon van der Neut <anthon@mnt.org)
-0   string/cB	\<!doctype\ html	HTML document text
-0   string/c	\<head			HTML document text
-0   string/c	\<title			HTML document text
-0   string/c	\<html			HTML document text
-
-# Extensible markup language (XML), a subset of SGML
-# from Marc Prud'hommeaux (marc@apocalypse.org)
-0   string/c	\<?xml			XML document text
-
-
-# SGML, mostly from rph@sq
-0   string/c	\<!doctype		exported SGML document text
-0   string/c	\<!subdoc		exported SGML subdocument text
-0   string	\<!--			exported SGML document text

+ 0 - 36
Magdir/ti-8x

@@ -1,36 +0,0 @@
-# ------------------------------------------------------------------------
-# ti-8x: file(1) magic for the TI-8x and TI-92 Graphing Calculators.
-#
-# From: Ryan McGuire (rmcguire@freenet.columbus.oh.us).
-#
-# NOTE: This list is not complete.
-#
-# Magic Numbers for the TI-82
-#
-0               string          **TI82**        TI-82 Graphing Calculator
->0x000037       byte            0x0B            TI-BASIC Group/Program File.
-#
-# Magic Numbers for the TI-83
-#
-0               string          **TI83**        TI-83 Graphing Calculator
->0x000037       byte            0x0B            TI-BASIC Group/Program File.
-#
-# Magic Numbers for the TI-85
-#
-0               string          **TI85**        TI-85 Graphing Calculator
->11             string          Backup          Backup File.
->0x000032       string          ZS4             - ZShell Version 4 File.
->0x000032       string          ZS3             - ZShell Version 3 File.
->0x00000B       string          GDatabase       Graphics Database.
->0x00003B       byte            0x12            TI-BASIC Group/Program File.
-#
-# Magic Numbers for the TI-92
-#
-0               string          **TI92**        TI-92 Graphing Calculator
->0x000058       byte            0x12            TI-BASIC Group File.
->0x000012       string          Function        Function.
->0x000048       byte            0x12            TI-BASIC Program.
-# Files for the TI-80 and TI-81 are pretty rare. I'm not going to put the
-# program/group magic numbers in here because I cannot find any.
-0               string          **TI80**        TI-80 Graphing Calculator File.
-0               string          **TI81**        TI-81 Graphing Calculator File.

+ 0 - 65
Magdir/vorbis

@@ -1,65 +0,0 @@
-
-#------------------------------------------------------------------------------
-# vorbis:  file(1) magic for Ogg/Vorbis files
-#
-# From Felix von Leitner <leitner@fefe.de>
-# Extended by Beni Cherniavsky <cben@crosswinds.net>
-#
-# Most (everything but the number of channels and bitrate) is commented
-# out with `##' as it's not interesting to the average user.  The most
-# probable things advanced users would want to uncomment are probably
-# the number of comments and the encoder version.
-#
-# --- Ogg Framing ---
-0		string		OggS		Ogg data
->4		byte		!0		UNKNOWN REVISION %u
-##>4		byte		0		revision 0
->4		byte		0
-##>>14		lelong		x		(Serial %lX)
-# --- First vorbis packet - general header ---
->>28		string		\x01vorbis	\b, Vorbis audio,
->>>35		lelong		!0		UNKNOWN VERSION %lu,
-##>>>35		lelong		0		version 0,
->>>35		lelong		0
->>>>39		ubyte		1		mono,
->>>>39		ubyte		2		stereo,
->>>>39		ubyte		>2		%u channels,
->>>>40		lelong		x		%lu Hz
-# Minimal, nominal and maximal bitrates specified when encoding
->>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	\b,
-# The above tests if at least one of these is specified:
->>>>>44		lelong		!-1
->>>>>>44	lelong		x		>%lu
->>>>>48		lelong		!-1
->>>>>>48	lelong		x		~%lu
->>>>>52		lelong		!-1
->>>>>>52	lelong		x		<%lu
->>>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	kbps
-# -- Second vorbis header packet - the comments
->>>102		string		\x03vorbis
-# A kludge to read the vendor string.  It's a counted string, not a
-# zero-terminated one, so file(1) can't read it in a generic way.
-# libVorbis is the only one existing currently, so I detect specifically
-# it.  The interesting value is the cvs date (8 digits decimal).
-##>>>>113		string/c	Xiphophorus\ libVorbis\ I	\b, created by: Xiphophorus libVorbis I
-##>>>>>137	string		>00000000	%.8s
-# Map to beta version numbers:
-##>>>>>>137	string		<20000508	(<beta1 - prepublic)
-# The string has not changed from beta1 to 2 - they are indistinguishable.
-##>>>>>>137	string		20000508	(beta1/2)
-##>>>>>>137	string		>20000508
-##>>>>>>>137	string		<20001031	(beta2-3)
-##>>>>>>137	string		20001031	(beta3)
-##>>>>>>137	string		>20001031
-##>>>>>>>137	string		<20010225	(beta3-4)
-##>>>>>>137	string		20010225	(beta4)
-##>>>>>>137	string		>20010225
-##>>>>>>>137	string		<20010615	(beta4-RC1)
-##>>>>>>137	string		20010615	(RC1)
-##>>>>>>137	string		>20010615	(>RC1)
-# Then come the comments, again length-counted (and number-counted).
-# Some looping constructs and registers would allow reading them but now
-# it's impossible.  However we can print the number of comments present
-# (skipping by the vendor string length):
-##>>>>(109.l.113)	lelong		0		\b, no comments
-##>>>>(109.l+113)	lelong		>0		\b, %lu comments

+ 2 - 79
Makefile.am

@@ -1,83 +1,6 @@
 # don't enforce GNU packaging standards
 AUTOMAKE_OPTIONS = foreign no-dependencies
 
-bin_PROGRAMS = file
+EXTRA_DIST = LEGAL.NOTICE MAINT PORTING
 
-data_DATA = magic magic.mime magic.mgc
-
-MAGIC	 = @datadir@/magic
-CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-
-if FSECT5
-man_MAGIC = magic.5
-else
-man_MAGIC = magic.4
-endif
-fsect = @fsect@
-man_MANS = file.1 $(man_MAGIC)
-
-file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
-	compress.c is_tar.c readelf.c print.c \
-	file.h names.h patchlevel.h readelf.h tar.h
-
-EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime \
-	Localstuff Header $(magic_FRAGMENTS) file.man magic.man
-
-CLEANFILES = $(man_MANS) magic magic.mgc
-
-magic: Header Localstuff $(magic_FRAGMENTS)
-	cat $(srcdir)/Header $(srcdir)/Localstuff > $@
-	for frag in $(magic_FRAGMENTS); do \
-	  if test -f $(srcdir)/$$frag; then \
-	    f=$(srcdir)/$$frag; \
-	  else \
-	    f=$$frag; \
-	  fi; \
-          cat $$f; \
-	done >> $@
-
-magic.mgc: magic file
-	./file -C -m magic
-
-file.1:	Makefile file.man
-	@rm -f $@
-	sed -e s@__CSECTION__@1@g \
-	    -e s@__FSECTION__@${fsect}@g \
-	    -e s@__VERSION__@${VERSION}@g \
-	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
-
-magic.${fsect}: Makefile magic.man
-	@rm -f $@
-	sed -e s@__CSECTION__@1@g \
-	    -e s@__FSECTION__@${fsect}@g \
-	    -e s@__VERSION__@${VERSION}@g \
-	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
-
-magic_FRAGMENTS = Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant \
-    Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation \
-    Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix \
-    Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi \
-    Magdir/c-lang Magdir/chi Magdir/cisco Magdir/claris Magdir/clipper \
-    Magdir/commands Magdir/compress Magdir/console Magdir/convex \
-    Magdir/database Magdir/diamond Magdir/diff Magdir/digital \
-    Magdir/dump Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems \
-    Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav \
-    Magdir/gimp Magdir/gnu Magdir/grace Magdir/hp Magdir/ibm370 \
-    Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel \
-    Magdir/interleaf Magdir/island Magdir/ispell Magdir/java \
-    Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif \
-    Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic \
-    Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt \
-    Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem \
-    Magdir/motorola Magdir/msdos Magdir/msvc Magdir/ncr Magdir/netbsd \
-    Magdir/netscape Magdir/news Magdir/octave Magdir/olf Magdir/os2 \
-    Magdir/os9 Magdir/osf1 Magdir/palm Magdir/pbm Magdir/pdf Magdir/pdp \
-    Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project \
-    Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm \
-    Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent \
-    Magdir/sgml Magdir/sketch Magdir/sniffer Magdir/softquad Magdir/spectrum \
-    Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x \
-    Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown \
-    Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx \
-    Magdir/vms Magdir/vmware Magdir/wordperfect Magdir/xdelta Magdir/xenix \
-    Magdir/zilog Magdir/zyxel
+SUBDIRS = src magic doc python

File diff suppressed because it is too large
+ 315 - 410
Makefile.in


+ 0 - 167
Makefile.std

@@ -1,167 +0,0 @@
-# Makefile for file(1) cmd. 
-# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
-# @(#)$Id: Makefile.std,v 1.12 2001/09/03 14:44:21 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.
-#
-# Permission is granted to anyone to use this software for any purpose on
-# any computer system, and to alter it and redistribute it freely, subject
-# to the following restrictions:
-#
-# 1. The author is not responsible for the consequences of use of this
-#    software, no matter how awful, even if they arise from flaws in it.
-#
-# 2. The origin of this software must not be misrepresented, either by
-#    explicit claim or by omission.  Since few users ever read sources,
-#    credits must appear in the documentation.
-#
-# 3. Altered versions must be plainly marked as such, and must not be
-#    misrepresented as being the original software.  Since few users
-#    ever read sources, credits must appear in the documentation.
-#
-# 4. This notice may not be removed or altered.
-#
-VERSION	= 3.37
-SHELL	= /bin/sh
-#MAGIC	= /etc/magic
-MAGIC	= /usr/local/etc/magic
-DEFS	= -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF # -Dvoid=int
-CC	= cc
-COPTS	= -O -g		# newer compilers allow both; else drop -O
-# For truly antique environments, use this for (dummy) include files:
-COPTS	= -O # -Ilocalinc
-CFLAGS	= $(COPTS) $(DEFS)
-LDFLAGS	= $(COPTS) # -Bstatic	# older gdb couldn't handle shared libs
-SHAR	= bundle
-OFILE	= /usr/bin/file		# old or distributed version, for comparison
-# Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG).
-BINDIR	= /usr/local/bin
-# For installing our man pages; 
-# MANCxxx is manual section for Commands, MANFxxx is section for file formats.
-# MANxDIR is directory names; MANxEXT is the filename extention. Usual values:
-# Variable	V7		4BSD		Sys V
-# MANCDIR 	/usr/man/man1	/usr/man/man1	/usr/man/u_man/man1
-# MANFDIR 	/usr/man/man5	/usr/man/man5	/usr/man/u_man/man4
-# MANCEXT	1		1		1
-# MANFEXT	5		5		4
-# --- possible alternative for 4BSD ---
-# MANCDIR			/usr/local/man/man1
-# MANCEXT			1
-# or
-# MANCDIR			/usr/man/manl
-# MANCEXT			l
-# --- possible alternative for USG ---
-# MANCDIR			/usr/man/local/man1
-# MANCEXT			1
-
-MANCDIR	= /usr/local/man/man1
-MANCEXT	= 1
-MANFDIR	= /usr/local/man/man4
-MANFEXT	= 4
-
-# There are no system-dependant configuration options (except maybe CFLAGS).
-# Uncomment any of these that is missing from your "standard" library.
-LOCALSRCS = # localsrc/getopt.c localsrc/strtol.c \
-#		localsrc/strtok.c localsrc/strchr.c
-LOCALOBJS = # localsrc/getopt.o localsrc/strtol.o \
-#		localsrc/strtok.o localsrc/strchr.o
-# These are not compiled in unless you use -Ilocalinc, but
-# are not commented out as "make dist" &c use them.
-LOCALINC = # localinc/*.h localinc/sys/*.h
-
-SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
-	compress.c is_tar.c readelf.c internat.c \
-	print.c $(LOCALSRCS) $(LOCALINC)
-OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \
-	compress.o is_tar.o readelf.o internat.o \
-	print.o $(LOCALOBJS)
-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) \
-	 Localstuff Header
-ALLMAGIC =   Magdir/[a-z]*
-
-all:		file magic file.${MANCEXT} magic.${MANFEXT}
-
-TESTFILES = * tst/*
-try:		all $(OFILE)
-		cd tst; $(MAKE)
-		time $(OFILE) $(TESTFILES) >/tmp/t1 # can't use ./magic
-		time ./file -m ./magic $(TESTFILES) >/tmp/t2
-		-diff -b /tmp/t[12]
-		what ./file >lastnocore
-
-file:		$(OBJS)
-		$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
-lint:		$(SRCS)
-		lint -ha $(DEFS) $(SRCS) | tee $@
-magic:		Localstuff Header Magdir
-		cat Header Localstuff Magdir/[a-z] > $@
-
-ascmagic.o:	names.h
-
-compress.o apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h
-
-install:	file magic
-		cp file	$(BINDIR)/file
-		cp magic $(MAGIC)
-
-install.man: file.${MANCEXT} magic.${MANFEXT}
-		cp file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT)
-		cp magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT)
-
-clean:
-		rm -f *.o core file magic lint dist.* MANIFEST \
-		      magic.${MANFEXT} file.${MANCEXT} \
-		      config.h config.status config.cache config.log
-clobber:
-		cd tst; $(MAKE) clean
-
-
-magic.${MANFEXT} :	Makefile magic.man
-		@rm -f $@
-		sed -e s@__CSECTION__@${MANCEXT}@g \
-		    -e s@__FSECTION__@${MANFEXT}@g \
-		    -e s@__VERSION__@${VERSION}@g \
-		    -e s@__MAGIC__@${MAGIC}@g magic.man > $@
-
-file.${MANCEXT} :	Makefile file.man
-		@rm -f $@
-		sed -e s@__CSECTION__@${MANCEXT}@g \
-		    -e s@__FSECTION__@${MANFEXT}@g \
-		    -e s@__VERSION__@${VERSION}@g \
-		    -e s@__MAGIC__@${MAGIC}@g file.man > $@
-
-send:		dist
-		ftp ftp.cs
-
-dist:		dist.src dist.magic
-		@echo Now check this patchlevel!
-		ident patchlevel.h
-
-dist.src:	$(ALLSRC) MANIFEST
-#		Some versions of shar can't handle a single file from
-#		a subdirectory, so we manually insert mkdir as needed.
-#		The point is to exclude all the generable targets in tst.
-		(echo mkdir localinc localinc/sys localsrc tst; \
-			$(SHAR) $(ALLSRC) MANIFEST) > $@
-
-rcsdiff:	$(ALLSRC)
-		rcsdiff -q RCS/*
-
-MANIFEST:	$(ALLSRC)
-		ident $(ALLSRC) > MANIFEST
-dist.magic:	Magdir
-#		As above, but to exclude Magdir/RCS from being shipped.
-		(echo mkdir Magdir; $(SHAR) $(ALLMAGIC)) >$@
-
-tar:		$(ALLSRC) $(ALLMAGIC)
-		-rm -fr file-${VERSION}
-		-mkdir file-${VERSION} file-${VERSION}/Magdir
-		ln $(ALLSRC) file-${VERSION}
-		ln ${ALLMAGIC} file-${VERSION}/Magdir
-		tar cvf file-${VERSION}.tar file-${VERSION}
-		-rm -fr file-${VERSION}

+ 0 - 0
PORTING


+ 16 - 12
README

@@ -1,14 +1,20 @@
 ** README for file(1) Command **
-@(#) $Id: README,v 1.25 2001/07/23 21:30:22 christos Exp $
+@(#) $Id: README,v 1.33 2003/05/23 21:31:56 christos Exp $
 
-This is Release 3.x of Ian Darwin's (copyright but distributable)
+This is Release 4.x of Ian Darwin's (copyright but distributable)
 file(1) command. This version is the standard "file" command for Linux,
 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
 
+The major feature of 4.x is the refactoring of the code into a library,
+and the re-write of the file command in terms of that library. The library
+itself, libmagic can be used by 3rd party programs that wish to identify
+file types without having to fork() and exec() file. The prime contributor
+for 4.0 was M\xe5ns Rullg\xe5rd.
+
 UNIX is a trademark of UNIX System Laboratories.
 
 The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
-including byte-order independance.
+including byte-order independence.
 
 The prime contributor to Release 3.0 was Christos Zoulas, who put
 in hundreds of lines of source code changes, including his own
@@ -33,7 +39,7 @@ In addition, the /etc/magic file is built from a subdirectory
 for easier(?) maintenance.  I will act as a clearinghouse for
 magic numbers assigned to all sorts of data files that
 are in reasonable circulation. Send your magic numbers,
-in magic(4) format please, to the maintainer, Christos Zoulas.
+in magic(5) format please, to the maintainer, Christos Zoulas.
 
 LEGAL.NOTICE - read this first.
 README - read this second (you are currently reading this file).
@@ -43,7 +49,7 @@ Makefile - read this next, adapt it as needed (particularly
 	the man page layouts), type "make" to compile, 
 	"make try" to try it out against your old version.
 	Expect some diffs, particularly since your original
-	file(1) may not grok the imbedded-space ("\ ") in
+	file(1) may not grok the embedded-space ("\ ") in
 	the current magic file, or may even not use the
 	magic file.
 apprentice.c - parses /etc/magic to learn magic
@@ -61,9 +67,8 @@ magdir - directory of /etc/magic pieces
 	magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION
 names.h - header file for ascmagic.c
 softmagic.c - 2nd set of tests, based on /etc/magic
-readelf.[ch] - Standalone elf parsing code.
+readelf.[ch] - Stand-alone elf parsing code.
 compress.c - on-the-fly decompression.
-internat.c - recognize international `text' files.
 print.c - print results, errors, warnings.
 
 If your gzip sometimes fails to decompress things complaining about a short
@@ -84,11 +89,10 @@ E-mail: christos@astron.com
 
 Phone: Do not even think of telephoning me about this program. Send cash first!
 
-Parts of this software were developed at SoftQuad Inc., 56 Aberfoyle
-Cres, # 810, Toronto, Ontario CANADA M8X 2W4.  Phone: 416-239-4801 or
-800-387-2777. Email: mail@sq.com.  Call for information on SGML editing
-and browsing, Unix text processing, and customised products on Unix,
-DOS and Mac.
+Parts of this software were developed at SoftQuad Inc., developers
+of SGML/HTML/XML publishing software, in Toronto, Canada.
+SoftQuad was swallowed up by Corel in 2002
+and does not exist any longer.
 
 From: Kees Zeelenberg
 

+ 0 - 48
acconfig.h

@@ -1,48 +0,0 @@
-/* Autoheader needs me */
-#undef PACKAGE
-
-/* Autoheader needs me */
-#undef VERSION
-
-/* Define if builtin ELF support is enabled.  */
-#undef BUILTIN_ELF
-
-/* Define if ELF core file support is enabled.  */
-#undef ELFCORE
-
-/* Define if the `long long' type works.  */
-#undef HAVE_LONG_LONG
-
-/* Define if we have "tm_isdst" in "struct tm".  */
-#undef HAVE_TM_ISDST
-
-/* Define if we have a global "int" variable "daylight".  */
-#undef HAVE_DAYLIGHT
-
-/* Define to `unsigned char' if standard headers don't define.  */
-#undef uint8_t
-
-/* Define to `unsigned short' if standard headers don't define.  */
-#undef uint16_t
-
-/* Define to `unsigned int' if standard headers don't define.  */
-#undef uint32_t
-
-/* Define to `unsigned long long', if available, or `unsigned long', if
-   standard headers don't define.  */
-#undef uint64_t
-
-/* FIXME: These have to be added manually because autoheader doesn't know
-   about AC_CHECK_SIZEOF_INCLUDES.  */
-
-/* The number of bytes in a uint8_t.  */
-#define SIZEOF_UINT8_T 0
-
-/* The number of bytes in a uint16_t.  */
-#define SIZEOF_UINT16_T 0
-
-/* The number of bytes in a uint32_t.  */
-#define SIZEOF_UINT32_T 0
-
-/* The number of bytes in a uint64_t.  */
-#define SIZEOF_UINT64_T 0

+ 186 - 26
acinclude.m4

@@ -1,5 +1,5 @@
 dnl cloned from autoconf 2.13 acspecific.m4
-AC_DEFUN(AC_C_LONG_LONG,
+AC_DEFUN([AC_C_LONG_LONG],
 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
 [if test "$GCC" = yes; then
   ac_cv_c_long_long=yes
@@ -14,23 +14,16 @@ if test $ac_cv_c_long_long = yes; then
 fi
 ])
 
-dnl from autoconf 2.13 acgeneral.m4, with patch:
-dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
-dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
-dnl From: eggert@twinsun.com (Paul Eggert)
-dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
-dnl Newsgroups: gnu.utils.bug
-
 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
 
-AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
+AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
 [AC_REQUIRE([AC_STRUCT_TM])dnl
 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
 if test "$ac_cv_struct_tm_zone" = yes; then
-  AC_DEFINE(HAVE_TM_ZONE)
+  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
 fi
 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
 [AC_TRY_LINK(
@@ -42,7 +35,7 @@ extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
 changequote([, ])dnl
 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
   if test $ac_cv_var_tzname = yes; then
-    AC_DEFINE(HAVE_TZNAME)
+    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
   fi
 
 AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
@@ -66,15 +59,27 @@ changequote([, ])dnl
   fi
 ])
 
-dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
-AC_DEFUN(AC_CHECK_TYPE2,
+dnl from autoconf 2.13 acgeneral.m4, with patch:
+dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
+dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
+dnl From: eggert@twinsun.com (Paul Eggert)
+dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
+dnl Newsgroups: gnu.utils.bug
+dnl
+dnl now include <stdint.h> if available
+
+dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE2_STDC],
 [AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL(ac_cv_type_$1,
 [AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -88,14 +93,12 @@ fi
 ])
 
 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
-dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
-AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
+dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
+AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
+[dnl The name to #define.
+define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
 dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
+define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
 AC_MSG_CHECKING(size of $1)
 AC_CACHE_VAL(AC_CV_NAME,
 [AC_TRY_RUN([$3
@@ -114,11 +117,168 @@ undefine([AC_CV_NAME])dnl
 ])
 
 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
-AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
-[AC_CHECK_SIZEOF_INCLUDES($1, $2,
-[#include <sys/types.h>
+AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_CHECK_SIZEOF_INCLUDES($1, $2,
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
 ])
 ])
+
+
+dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE_STDC],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_EGREP_CPP(dnl
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+AC_MSG_RESULT($ac_cv_type_$1)
+if test $ac_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])
+
+dnl AC_HEADER_STDINT
+AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
+
+#serial 19
+
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert@twinsun.com>.
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_TEST_INCLUDES
+AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
+  [[#include <sys/types.h>
+    /* Check that off_t can represent 2**63 - 1 correctly.
+       We can't simply "#define LARGE_OFF_T 9223372036854775807",
+       since some C++ compilers masquerading as C compilers
+       incorrectly reject 9223372036854775807.  */
+#   define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+			&& LARGE_OFF_T % 2147483647 == 1)
+		       ? 1 : -1];
+  ]])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
+DES, FUNCTION-BODY)
+AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
+  [AC_CACHE_CHECK([for $1 value needed for large files], $3,
+     [$3=no
+      AC_TRY_COMPILE([$5],
+	[$6],
+	,
+	[AC_TRY_COMPILE([#define $1 $2]
+[$5]
+	   ,
+	   [$6],
+	   [$3=$2])])])
+   if test "[$]$3" != no; then
+     AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
+   fi])
+
+AC_DEFUN([AC_SYS_LARGEFILE],
+  [AC_REQUIRE([AC_PROG_CC])
+   AC_ARG_ENABLE(largefile,
+     [  --disable-largefile     omit support for large files])
+   if test "$enable_largefile" != no; then
+
+     AC_CACHE_CHECK([for special C compiler options needed for large files=
+],
+       ac_cv_sys_largefile_CC,
+       [ac_cv_sys_largefile_CC=no
+        if test "$GCC" != yes; then
+	  # IRIX 6.2 and later do not support large files by default,
+	  # so use the C compiler's -n32 option if that helps.
+	  AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
+	    [ac_save_CC="$CC"
+	     CC="$CC -n32"
+	     AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
+	       ac_cv_sys_largefile_CC=' -n32')
+	     CC="$ac_save_CC"])
+        fi])
+     if test "$ac_cv_sys_largefile_CC" != no; then
+       CC="$CC$ac_cv_sys_largefile_CC"
+     fi
+
+     AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+       ac_cv_sys_file_offset_bits,
+       [Number of bits in a file offset, on hosts where this is settable.],
+       AC_SYS_LARGEFILE_TEST_INCLUDES)
+     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+       ac_cv_sys_large_files,
+       [Define for large files, on AIX-style hosts.],
+       AC_SYS_LARGEFILE_TEST_INCLUDES)
+   fi
+  ])
+
+AC_DEFUN([AC_FUNC_FSEEKO],
+  [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+     ac_cv_sys_largefile_source,
+     [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
+     [#include <stdio.h>], [return !fseeko;])
+   # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+   # in glibc 2.1.3, but that breaks too many other things.
+   # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+
+   AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
+     [ac_cv_func_fseeko=no
+      AC_TRY_LINK([#include <stdio.h>],
+        [return fseeko && fseeko (stdin, 0, 0);],
+	[ac_cv_func_fseeko=yes])])
+   if test $ac_cv_func_fseeko != no; then
+     AC_DEFINE(HAVE_FSEEKO, 1,
+       [Define if fseeko (and presumably ftello) exists and is declared.])
+   fi])
+
+# serial 9
+
+# From Paul Eggert.
+
+# BeOS 5 has <wchar.h> but does not define mbstate_t,
+# so you can't declare an object of that type.
+# Check for this incompatibility with Standard C.
+
+# Include stdlib.h first, because otherwise this test would fail on Linux
+# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
+# a syntax error in wchar.h due to the use of undefined __int32_t.
+AC_DEFUN([AC_MBSTATE_T],
+  [
+   AC_CHECK_HEADERS(stdlib.h)
+  
+   AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+    [AC_TRY_COMPILE([
+#if HAVE_STDLIB_H 
+# include <stdlib.h>
+#endif
+#include <wchar.h>],
+      [mbstate_t x; return sizeof x;],
+      ac_cv_type_mbstate_t=yes,
+      ac_cv_type_mbstate_t=no)])
+   if test $ac_cv_type_mbstate_t = no; then
+     AC_DEFINE(mbstate_t, int,
+               [Define to a type if <wchar.h> does not define.])
+   fi])
+
+

File diff suppressed because it is too large
+ 4459 - 111
aclocal.m4


File diff suppressed because it is too large
+ 0 - 1145
apprentice.c


+ 0 - 192
compress.c

@@ -1,192 +0,0 @@
-/*
- * compress routines:
- *	zmagic() - returns 0 if not recognized, uncompresses and prints
- *		   information if recognized
- *	uncompress(method, old, n, newch) - uncompress old into new, 
- *					    using method, return sizeof new
- */
-#include "file.h"
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#ifndef lint
-FILE_RCSID("@(#)$Id: compress.c,v 1.20 2001/07/22 21:04:15 christos Exp $")
-#endif
-
-
-static struct {
-	const char *magic;
-	int   maglen;
-	const char *const argv[3];
-	int	 silent;
-} compr[] = {
-	{ "\037\235", 2, { "gzip", "-cdq", NULL }, 1 },		/* compressed */
-	/* Uncompress can get stuck; so use gzip first if we have it
-	 * Idea from Damien Clark, thanks! */
-	{ "\037\235", 2, { "uncompress", "-c", NULL }, 1 },	/* compressed */
-	{ "\037\213", 2, { "gzip", "-cdq", NULL }, 1 },		/* gzipped */
-	{ "\037\236", 2, { "gzip", "-cdq", NULL }, 1 },		/* frozen */
-	{ "\037\240", 2, { "gzip", "-cdq", NULL }, 1 },		/* SCO LZH */
-	/* the standard pack utilities do not accept standard input */
-	{ "\037\036", 2, { "gzip", "-cdq", NULL }, 0 },		/* packed */
-	{ "BZh",      3, { "bzip2", "-cd", NULL }, 1 },		/* bzip2-ed */
-};
-
-static int ncompr = sizeof(compr) / sizeof(compr[0]);
-
-
-static int uncompress __P((int, const unsigned char *, unsigned char **, int));
-static int swrite __P((int, const void *, size_t));
-static int sread __P((int, void *, size_t));
-
-int
-zmagic(buf, nbytes)
-	unsigned char *buf;
-	int nbytes;
-{
-	unsigned char *newbuf;
-	int newsize;
-	int i;
-
-	for (i = 0; i < ncompr; i++) {
-		if (nbytes < compr[i].maglen)
-			continue;
-		if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 &&
-		    (newsize = uncompress(i, buf, &newbuf, nbytes)) != 0) {
-			tryit(newbuf, newsize, 1);
-			free(newbuf);
-			printf(" (");
-			tryit(buf, nbytes, 0);
-			printf(")");
-			return 1;
-		}
-	}
-
-	if (i == ncompr)
-		return 0;
-
-	return 1;
-}
-
-/*
- * `safe' write for sockets and pipes.
- */
-static int
-swrite(fd, buf, n)
-	int fd;
-	const void *buf;
-	size_t n;
-{
-	int rv;
-	size_t rn = n;
-
-	do
-		switch (rv = write(fd, buf, n)) {
-		case -1:
-			if (errno == EINTR)
-				continue;
-			return -1;
-		default:
-			n -= rv;
-			buf = ((char *)buf) + rv;
-			break;
-		}
-	while (n > 0);
-	return rn;
-}
-
-
-/*
- * `safe' read for sockets and pipes.
- */
-static int
-sread(fd, buf, n)
-	int fd;
-	void *buf;
-	size_t n;
-{
-	int rv;
-	size_t rn = n;
-
-	do
-		switch (rv = read(fd, buf, n)) {
-		case -1:
-			if (errno == EINTR)
-				continue;
-			return -1;
-		default:
-			n -= rv;
-			buf = ((char *)buf) + rv;
-			break;
-		}
-	while (n > 0);
-	return rn;
-}
-
-static int
-uncompress(method, old, newch, n)
-	int method;
-	const unsigned char *old;
-	unsigned char **newch;
-	int n;
-{
-	int fdin[2], fdout[2];
-
-	if (pipe(fdin) == -1 || pipe(fdout) == -1) {
-		error("cannot create pipe (%s).\n", strerror(errno));	
-		/*NOTREACHED*/
-	}
-	switch (fork()) {
-	case 0:	/* child */
-		(void) close(0);
-		(void) dup(fdin[0]);
-		(void) close(fdin[0]);
-		(void) close(fdin[1]);
-
-		(void) close(1);
-		(void) dup(fdout[1]);
-		(void) close(fdout[0]);
-		(void) close(fdout[1]);
-		if (compr[method].silent)
-			(void) close(2);
-
-		execvp(compr[method].argv[0],
-		       (char *const *)compr[method].argv);
-		exit(1);
-		/*NOTREACHED*/
-	case -1:
-		error("could not fork (%s).\n", strerror(errno));
-		/*NOTREACHED*/
-
-	default: /* parent */
-		(void) close(fdin[0]);
-		(void) close(fdout[1]);
-		if (swrite(fdin[1], old, n) != n) {
-			n = 0;
-			goto err;
-		}
-		(void) close(fdin[1]);
-		fdin[1] = -1;
-		if ((*newch = (unsigned char *) malloc(n)) == NULL) {
-			n = 0;
-			goto err;
-		}
-		if ((n = sread(fdout[0], *newch, n)) <= 0) {
-			free(*newch);
-			n = 0;
-			goto err;
-		}
-err:
-		if (fdin[1] != -1)
-			(void) close(fdin[1]);
-		(void) close(fdout[0]);
-		(void) wait(NULL);
-		return n;
-	}
-}

File diff suppressed because it is too large
+ 1354 - 0
config.guess


+ 155 - 62
config.h.in

@@ -1,100 +1,193 @@
-/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
 
-/* Define to empty if the keyword does not work.  */
-#undef const
+/* Use the builtin ELF recognition code */
+#undef BUILTIN_ELF
 
-/* Define if your struct stat has st_rdev.  */
-#undef HAVE_ST_RDEV
+/* Recognize ELF core files */
+#undef ELFCORE
 
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
-#undef HAVE_SYS_WAIT_H
+/* */
+#undef HAVE_DAYLIGHT
 
-/* Define if your struct tm has tm_zone.  */
-#undef HAVE_TM_ZONE
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
 
-/* Define if you don't have tm_zone but do have the external array
-   tzname.  */
-#undef HAVE_TZNAME
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
 
-/* Define if major, minor, and makedev are declared in <mkdev.h>.  */
-#undef MAJOR_IN_MKDEV
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
 
-/* Define if major, minor, and makedev are declared in <sysmacros.h>.  */
-#undef MAJOR_IN_SYSMACROS
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
 
-/* Define to `long' if <sys/types.h> doesn't define.  */
-#undef off_t
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-#undef size_t
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
 
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
 
-/* Define if your <sys/time.h> declares struct tm.  */
-#undef TM_IN_SYS_TIME
+/* */
+#undef HAVE_LONG_LONG
 
-/* Define if builtin ELF support is enabled.  */
-#undef BUILTIN_ELF
+/* Define to 1 if you have the `mbrtowc' function. */
+#undef HAVE_MBRTOWC
 
-/* Define if ELF core file support is enabled.  */
-#undef ELFCORE
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
 
-/* Define if the `long long' type works.  */
-#undef HAVE_LONG_LONG
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
 
-/* Define if we have "tm_isdst" in "struct tm".  */
-#undef HAVE_TM_ISDST
+/* Define to 1 if you have the `mmap' function. */
+#undef HAVE_MMAP
 
-/* Define if we have a global "int" variable "daylight".  */
-#undef HAVE_DAYLIGHT
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
 
-/* Define to `unsigned char' if standard headers don't define.  */
-#undef uint8_t
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
 
-/* Define to `unsigned short' if standard headers don't define.  */
-#undef uint16_t
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
 
-/* Define to `unsigned int' if standard headers don't define.  */
-#undef uint32_t
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
 
-/* Define to `unsigned long long', if available, or `unsigned long', if
-   standard headers don't define.  */
-#undef uint64_t
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if `st_rdev' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_RDEV
 
-/* The number of bytes in a uint8_t.  */
-#define SIZEOF_UINT8_T 0
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#undef HAVE_ST_RDEV
 
-/* The number of bytes in a uint16_t.  */
-#define SIZEOF_UINT16_T 0
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
 
-/* The number of bytes in a uint32_t.  */
-#define SIZEOF_UINT32_T 0
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
 
-/* The number of bytes in a uint64_t.  */
-#define SIZEOF_UINT64_T 0
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
 
-/* Define if you have the mmap function.  */
-#undef HAVE_MMAP
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#undef HAVE_SYS_UTIME_H
 
-/* Define if you have the strerror function.  */
-#undef HAVE_STRERROR
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
 
-/* Define if you have the strtoul function.  */
-#undef HAVE_STRTOUL
+/* */
+#undef HAVE_TM_ISDST
 
-/* Define if you have the <locale.h> header file.  */
-#undef HAVE_LOCALE_H
+/* HAVE_TM_ZONE */
+#undef HAVE_TM_ZONE
 
-/* Define if you have the <sys/mman.h> header file.  */
-#undef HAVE_SYS_MMAN_H
+/* HAVE_TZNAME */
+#undef HAVE_TZNAME
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `utime' function. */
+#undef HAVE_UTIME
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
+/* Define to 1 if you have the `wcwidth' function. */
+#undef HAVE_WCWIDTH
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+   */
+#undef MAJOR_IN_MKDEV
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+   <sysmacros.h>. */
+#undef MAJOR_IN_SYSMACROS
+
 /* Name of package */
 #undef PACKAGE
 
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* */
+#undef SIZEOF_UINT16_T
+
+/* */
+#undef SIZEOF_UINT32_T
+
+/* */
+#undef SIZEOF_UINT64_T
+
+/* */
+#undef SIZEOF_UINT8_T
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
 /* Version number of package */
 #undef VERSION
 
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* */
+#undef int32_t
+
+/* Define to a type if <wchar.h> does not define. */
+#undef mbstate_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* */
+#undef uint16_t
+
+/* */
+#undef uint32_t
+
+/* */
+#undef uint64_t
+
+/* */
+#undef uint8_t

File diff suppressed because it is too large
+ 1460 - 0
config.sub


File diff suppressed because it is too large
+ 11016 - 1647
configure


+ 54 - 13
configure.in

@@ -1,7 +1,9 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file.c)
-AM_INIT_AUTOMAKE(file, 3.37)
-AM_CONFIG_HEADER(config.h)
+AC_INIT
+AC_CONFIG_SRCDIR([src/file.c])
+AM_INIT_AUTOMAKE(file, 4.12)
+AM_CONFIG_HEADER([config.h])
+dnl AM_MAINTAINER_MODE
 
 AC_MSG_CHECKING(for builtin ELF support)
 AC_ARG_ENABLE(elf,
@@ -52,27 +54,62 @@ dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LN_S
+AC_PROG_LIBTOOL
+
+dnl Templates for autoheader
+AH_TEMPLATE([BUILTIN_ELF],
+	    [Use the builtin ELF recognition code])
+AH_TEMPLATE([ELFCORE],
+	    [Recognize ELF core files])
+AH_TEMPLATE([HAVE_DAYLIGHT], [])
+AH_TEMPLATE([HAVE_LONG_LONG], [])
+AH_TEMPLATE([HAVE_TM_ISDST], [])
+AH_TEMPLATE([SIZEOF_UINT16_T], [])
+AH_TEMPLATE([SIZEOF_UINT32_T], [])
+AH_TEMPLATE([SIZEOF_UINT64_T], [])
+AH_TEMPLATE([SIZEOF_UINT8_T], [])
+AH_TEMPLATE([int32_t], [])
+AH_TEMPLATE([uint16_t], [])
+AH_TEMPLATE([uint32_t], [])
+AH_TEMPLATE([uint64_t], [])
+AH_TEMPLATE([uint8_t], [])
 
 dnl Checks for headers
 AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
+AC_HEADER_STDINT
+AC_CHECK_HEADERS(fcntl.h locale.h)
+AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h)
+AC_CHECK_HEADERS(stdint.h inttypes.h)
 AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_HEADERS(getopt.h)
 AC_CHECK_HEADERS(locale.h)
-AC_CHECK_HEADERS(sys/mman.h)
+AC_CHECK_HEADERS(utime.h)
+AC_CHECK_HEADERS(sys/utime.h)
+AC_CHECK_HEADERS(wchar.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
-AC_STRUCT_ST_RDEV
-AC_STRUCT_TIMEZONE_DAYLIGHT
+AC_DIAGNOSE([obsolete],[AC_STRUCT_ST_RDEV:
+	your code should no longer depend upon `HAVE_ST_RDEV', but
+	`HAVE_STRUCT_STAT_ST_RDEV'.  Remove this warning and
+	the `AC_DEFINE' when you adjust the code.])
+AC_CHECK_MEMBERS([struct stat.st_rdev],[AC_DEFINE(HAVE_ST_RDEV, 1,
+			    [Define to 1 if your `struct stat' has `st_rdev'.
+			     Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV'
+			     instead.])])
 
-dnl FIXME: only found in standard headers!
-AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(uint16_t, unsigned short)
-AC_CHECK_TYPE(uint32_t, unsigned int)
+AC_STRUCT_TIMEZONE_DAYLIGHT
+AC_SYS_LARGEFILE
+AC_MBSTATE_T
 
+AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
+AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
+AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
+AC_CHECK_TYPE_STDC(int32_t, int)
 AC_C_LONG_LONG
 if test $ac_cv_c_long_long = yes; then
   long64='unsigned long long';
@@ -80,7 +117,7 @@ else
   long64='unsigned long';
 fi
 dnl This needs a patch to autoconf 2.13 acgeneral.m4
-AC_CHECK_TYPE2(uint64_t, $long64)
+AC_CHECK_TYPE2_STDC(uint64_t, $long64)
 
 AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
@@ -88,6 +125,10 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
 
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strtoul)
+AC_CHECK_FUNCS(mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth)
+
+dnl Checks for libraries
+AC_CHECK_LIB(z,gzopen)
 
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile doc/Makefile python/Makefile])
+AC_OUTPUT

+ 423 - 0
depcomp

@@ -0,0 +1,423 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      tmpdepfile1="$dir.libs/$base.lo.d"
+      tmpdepfile2="$dir.libs/$base.d"
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1="$dir$base.o.d"
+      tmpdepfile2="$dir$base.d"
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.  We will use -o /dev/null later,
+  # however we can't do the remplacement now because
+  # `-o $object' might simply not be used
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    -*)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0

+ 32 - 0
doc/Makefile.am

@@ -0,0 +1,32 @@
+MAGIC	 = $(pkgdatadir)/magic
+if FSECT5
+man_MAGIC = magic.5
+else
+man_MAGIC = magic.4
+endif
+fsect = @fsect@
+man_MANS = file.1 $(man_MAGIC) libmagic.3
+
+EXTRA_DIST = file.man magic.man libmagic.man
+CLEANFILES = $(man_MANS)
+
+file.1:	Makefile file.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
+
+magic.${fsect}: Makefile magic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+
+libmagic.3: Makefile libmagic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/libmagic.man > $@

+ 428 - 0
doc/Makefile.in

@@ -0,0 +1,428 @@
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+OBJDUMP = @OBJDUMP@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+fsect = @fsect@
+install_sh = @install_sh@
+MAGIC = $(pkgdatadir)/magic
+@FSECT5_TRUE@man_MAGIC = magic.5
+@FSECT5_FALSE@man_MAGIC = magic.4
+man_MANS = file.1 $(man_MAGIC) libmagic.3
+
+EXTRA_DIST = file.man magic.man libmagic.man
+CLEANFILES = $(man_MANS)
+subdir = doc
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+NROFF = nroff
+MANS = $(man_MANS)
+DIST_COMMON = Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  doc/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+man1dir = $(mandir)/man1
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man1dir)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man1dir)/$$inst; \
+	done
+
+man3dir = $(mandir)/man3
+install-man3: $(man3_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man3dir)
+	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.3*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    3*) ;; \
+	    *) ext='3' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst; \
+	done
+uninstall-man3:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.3*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man3dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man3dir)/$$inst; \
+	done
+
+man4dir = $(mandir)/man4
+install-man4: $(man4_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man4dir)
+	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.4*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    4*) ;; \
+	    *) ext='4' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man4dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man4dir)/$$inst; \
+	done
+uninstall-man4:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.4*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man4dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man4dir)/$$inst; \
+	done
+
+man5dir = $(mandir)/man5
+install-man5: $(man5_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man5dir)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
+	done
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man5dir)/$$inst; \
+	done
+tags: TAGS
+TAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@list='$(DISTFILES)'; for file in $$list; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(man1dir) $(DESTDIR)$(man3dir) $(DESTDIR)$(man4dir) $(DESTDIR)$(man5dir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man1 install-man3 install-man4 install-man5
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+uninstall-am: uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
+	uninstall-man5
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-man1 install-man3 \
+	install-man4 install-man5 install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool uninstall uninstall-am uninstall-info-am \
+	uninstall-man uninstall-man1 uninstall-man3 uninstall-man4 \
+	uninstall-man5
+
+
+file.1:	Makefile file.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
+
+magic.${fsect}: Makefile magic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@
+
+libmagic.3: Makefile libmagic.man
+	@rm -f $@
+	sed -e s@__CSECTION__@1@g \
+	    -e s@__FSECTION__@${fsect}@g \
+	    -e s@__VERSION__@${VERSION}@g \
+	    -e s@__MAGIC__@${MAGIC}@g $(srcdir)/libmagic.man > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

+ 97 - 45
file.man

@@ -1,18 +1,22 @@
 .TH FILE __CSECTION__ "Copyright but distributable"
-.\" $Id: file.man,v 1.39 2001/04/27 22:48:33 christos Exp $
+.\" $Id: file.man,v 1.54 2003/10/27 18:09:08 christos Exp $
 .SH NAME
 file
 \- determine file type
 .SH SYNOPSIS
 .B file
 [
-.B \-bciknsvzL
+.B \-bcikLnNprsvz
 ]
 [
 .B \-f
 .I namefile
 ]
 [
+.B \-F
+.I separator
+]
+[
 .B \-m 
 .I magicfiles
 ]
@@ -149,20 +153,20 @@ Any file that cannot be identified as having been written
 in any of the character sets listed above is simply said to be ``data''.
 .SH OPTIONS
 .TP 8
-.B \-b
+.B "\-b, \-\-brief"
 Do not prepend filenames to output lines (brief mode).
 .TP 8
-.B \-c
+.B "\-c, \-\-checking\-printout"
 Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with 
 .B \-m
 to debug a new magic file before installing it.
 .TP 8
-.B \-C
+.B "\-C, \-\-compile"
 Write a magic.mgc output file that contains a pre-parsed version of
 file.
 .TP 8
-.BI \-f " namefile"
+.BI "\-f, \-\-files\-from" " namefile"
 Read the names of the files to be examined from 
 .I namefile
 (one per line) 
@@ -172,41 +176,60 @@ Either
 or at least one filename argument must be present;
 to test the standard input, use ``\-'' as a filename argument.
 .TP 8
-.B \-i
+.BI "\-F, \-\-separator" " separator"
+Use the specified string as the separator between the filename and the
+file result returned. Defaults to ``:''.
+.TP 8
+.B "\-i, \-\-mime"
 Causes the file command to output mime type strings rather than the more
 traditional human readable ones. Thus it may say
 ``text/plain; charset=us-ascii''
 rather
-than ``ASCII text''. In order for this option to work, file changes the way
+than ``ASCII text''.
+In order for this option to work, file changes the way
 it handles files recognised by the command itself (such as many of the
 text file types, directories etc), and makes use of an alternative
 ``magic'' file.
 (See ``FILES'' section, below).
 .TP 8
-.B \-k
+.B "\-k, \-\-keep\-going"
 Don't stop at the first match, keep going.
 .TP 8
-.BI \-m " list"
+.B "\-L, \-\-dereference"
+option causes symlinks to be followed, as the like-named option in
+.BR ls (1).
+(on systems that support symbolic links).
+.TP 8
+.BI "\-m, \-\-magic\-file" " list"
 Specify an alternate list of files containing magic numbers.
 This can be a single file, or a colon-separated list of files.
+If a compiled magic file is found alongside, it will be used instead.
+With the \-i or \-\-mime option, the program adds ".mime" to each file name.
 .TP 8
-.B \-n
-Force stdout to be flushed after checking each file. This is only useful if
-checking a list of files. It is intended to be used by programs that want
-filetype output from a pipe.
+.B "\-n, \-\-no\-buffer"
+Force stdout to be flushed after checking each file.
+This is only useful if checking a list of files.
+It is intended to be used by programs that want filetype output from a pipe.
 .TP 8
-.B \-v
-Print the version of the program and exit.
+.B "\-N, \-\-no\-pad"
+Don't pad filenames so that they align in the output.
 .TP 8
-.B \-z
-Try to look inside compressed files.
+.B "\-p, \-\-preserve\-date"
+On systems that support
+.BR utime (2)
+or
+.BR utimes(2),
+attempt to preserve the access time of files analyzed, to pretend that
+.BR file (2)
+never read them.
 .TP 8
-.B \-L
-option causes symlinks to be followed, as the like-named option in
-.BR ls (1).
-(on systems that support symbolic links).
+.B "\-r, \-\-raw"
+Don't translate unprintable characters to \eooo.
+Normally
+.B file
+translates unprintable characters to their octal representation.
 .TP 8
-.B \-s
+.B "\-s, \-\-special\-files"
 Normally,
 .B file
 only attempts to read and determine the type of argument files which
@@ -226,21 +249,40 @@ This option also causes
 to disregard the file size as reported by
 .BR stat (2)
 since on some systems it reports a zero size for raw disk partitions.
+.TP 8
+.B "\-v, \-\-version"
+Print the version of the program and exit.
+.TP 8
+.B "\-z, \-\-uncompress"
+Try to look inside compressed files.
+.TP 8
+.B "\-\-help"
+Print a help message and exit.
 .SH FILES
+.TP
 .I __MAGIC__.mgc
-\- defaults compiled list of magic numbers
-.PP
+Default compiled list of magic numbers
+.TP
 .I __MAGIC__
-\- default list of magic numbers
-.PP
+Default list of magic numbers
+.TP
+.I __MAGIC__.mime.mgc
+Default compiled list of magic numbers, used to output mime types when
+the -i option is specified.
+.TP
 .I __MAGIC__.mime
-\- default list of magic numbers, used to output mime types when the -i option
+Default list of magic numbers, used to output mime types when the -i option
 is specified.
+.TP
+.I /etc/magic
+Local additions to magic wisdom.
 
 .SH ENVIRONMENT
 The environment variable
 .B MAGIC
-can be used to set the default magic number files.
+can be used to set the default magic number file name.
+.B file
+adds ".mime" and/or ".mgc" to the value of this variable as appropriate.
 .SH SEE ALSO
 .BR magic (__FSECTION__)
 \- description of magic file format.
@@ -268,7 +310,8 @@ in an existing magic file would have to be changed to
 >10	string	language\e impress	(imPRESS data)
 .br
 In addition, in this version, if a pattern string contains a backslash,
-it must be escaped.  For example
+it must be escaped.
+For example
 .br
 0	string		\ebegindata	Andrew Toolkit document
 .br
@@ -304,12 +347,15 @@ keep the old magic file around for comparison purposes
 .IR __MAGIC__.orig ).
 .SH EXAMPLES
 .nf
-$ file file.c file /dev/hda
+$ file file.c file /dev/{wd0a,hda}
 file.c:   C program text
-file:     ELF 32-bit LSB executable, Intel 80386, version 1,
-          dynamically linked, not stripped
-/dev/hda: block special
-
+file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
+          dynamically linked (uses shared libs), stripped
+/dev/wd0a: block special (0/0)
+/dev/hda: block special (3/0)
+$ file -s /dev/wd0{b,d}
+/dev/wd0b: data
+/dev/wd0d: x86 boot sector
 $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda:   x86 boot sector
 /dev/hda1:  Linux/i386 ext2 filesystem
@@ -323,17 +369,19 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda9:  empty
 /dev/hda10: empty
 
-$ file -i file.c file /dev/hda
+$ file -i file.c file /dev/{wd0a,hda}
 file.c:      text/x-c
-file:        application/x-executable, dynamically linked (uses shared libs), not stripped
+file:        application/x-executable, dynamically linked (uses shared libs),
+not stripped
 /dev/hda:    application/x-not-regular-file
+/dev/wd0a:   application/x-not-regular-file
 
 .fi
 .SH HISTORY
 There has been a 
 .B file
-command in every \s-1UNIX\s0 since at least Research Version 6
-(man page dated January 16, 1975).
+command in every \s-1UNIX\s0 since at least Research Version 4
+(man page dated November, 1973).
 The System V version introduced one significant major change:
 the external list of magic number types.
 This slowed the program down slightly but made it a lot more flexible.
@@ -363,7 +411,8 @@ of non-ASCII files.
 .PP
 The list of contributors to the "Magdir" directory (source for the
 /etc/magic
-file) is too long to include here. You know who you are; thank you.
+file) is too long to include here.
+You know who you are; thank you.
 .SH LEGAL NOTICE
 Copyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.
 Covered by the standard Berkeley Software Distribution copyright; see the file
@@ -378,7 +427,8 @@ were written by John Gilmore from his public-domain
 program, and are not covered by the above license.
 .SH BUGS
 There must be a better way to automate the construction of the Magic
-file from all the glop in Magdir. What is it?
+file from all the glop in magdir.
+What is it?
 Better yet, the magic file should be compiled into binary (say,
 .BR ndbm (3)
 or, better yet, fixed-length
@@ -425,7 +475,8 @@ This could be done by using some keyword like `*' for the offset value.
 Another optimisation would be to sort
 the magic file so that we can just run down all the
 tests for the first byte, first word, first long, etc, once we
-have fetched it.  Complain about conflicts in the magic file entries.
+have fetched it.
+Complain about conflicts in the magic file entries.
 Make a rule that the magic entries sort based on file offset rather
 than position within the magic file?
 .PP
@@ -433,8 +484,9 @@ The program should provide a way to give an estimate
 of ``how good'' a guess is.
 We end up removing guesses (e.g. ``From '' as first 5 chars of file) because
 they are not as good as other guesses (e.g. ``Newsgroups:'' versus
-``Return-Path:'').  Still, if the others don't pan out, it should be
-possible to use the first guess.  
+``Return-Path:'').
+Still, if the others don't pan out, it should be possible to use the
+first guess.  
 .PP
 This program is slower than some vendors' file commands.
 The new support for multiple character codes makes it even slower.
@@ -445,4 +497,4 @@ You can obtain the original author's latest version by anonymous FTP
 on
 .B ftp.astron.com
 in the directory
-.I /pub/file/file-X.YY.tar.gz
+.I /pub/file/file-X.YZ.tar.gz

+ 226 - 0
doc/libmagic.man

@@ -0,0 +1,226 @@
+.\"
+.\" Copyright (c) Christos Zoulas 2003.
+.\" All Rights Reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice immediately at the beginning of the file, without modification,
+.\"    this list of conditions, and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd March 22, 2003
+.Dt MAGIC 3
+.Os
+.Sh NAME
+.Nm magic_open ,
+.Nm magic_close ,
+.Nm magic_error ,
+.Nm magic_file ,
+.Nm magic_buffer ,
+.Nm magic_setflags ,
+.Nm magic_check ,
+.Nm magic_compile ,
+.Nm magic_load
+.Nd Magic number recognition library.
+.Sh LIBRARY
+.Lb libmagic
+.Sh SYNOPSIS
+.In magic.h
+.Ft magic_t
+.Fn magic_open "int flags"
+.Ft void
+.Fn magic_close "magic_t cookie"
+.Ft const char *
+.Fn magic_error "magic_t cookie"
+.Ft int
+.Fn magic_errno "magic_t cookie"
+.Ft const char *
+.Fn magic_file "magic_t cookie, const char *filename"
+.Ft const char *
+.Fn magic_buffer "magic_t cookie, const void *buffer, size_t length"
+.Ft int
+.Fn magic_setflags "magic_t cookie, int flags"
+.Ft int
+.Fn magic_check "magic_t cookie, const char *filename"
+.Ft int
+.Fn magic_compile "magic_t cookie, const char *filename"
+.Ft int
+.Fn magic_load "magic_t cookie, const char *filename"
+.Sh DESCRIPTION
+These functions
+operate on the magic database file
+which is described
+in
+.Xr magic __FSECTION__ .
+.Pp
+The function
+.Fn magic_open
+creates a magic cookie pointer and returns it. It returns NULL if
+there was an error allocating the magic cookie. The 
+.Ar flags
+argument specifies how the other magic functions should behave:
+.Bl -tag -width MAGIC_COMPRESS
+.It Dv MAGIC_NONE
+No special handling.
+.It Dv MAGIC_DEBUG
+Print debugging messages to stderr.
+.It Dv MAGIC_SYMLINK
+If the file queried is a symlink, follow it.
+.It Dv MAGIC_COMPRESS
+If the file is compressed, unpack it and look at the contents.
+.It Dv MAGIC_DEVICES
+If the file is a block or character special device, then open the device
+and try to look in its contents.
+.It Dv MAGIC_MIME
+Return a mime string, instead of a textual description.
+.It Dv MAGIC_CONTINUE
+Return all matches, not just the first.
+.It Dv MAGIC_CHECK
+Check the magic database for consistency and print warnings to stderr.
+.It Dv MAGIC_PRESERVE_ATIME
+On systems that support
+.Xr utime 2
+or
+.Xr utimes 2 ,
+attempt to preserve the access time of files analyzed.
+.It Dv MAGIC_RAW
+Don't translate unprintable characters to a \eooo octal representation.
+.It Dv MAGIC_ERROR
+Treat operating system errors while trying to open files and follow symlinks
+as real errors, instead of printing them in the magic buffer.
+.El
+.Pp
+The
+.Fn magic_close
+function closes the
+.Xr magic __FSECTION__
+database and deallocates any resources used.
+.Pp
+The
+.Fn magic_error
+function returns a textual explanation of the last error, or NULL if there was
+no error.
+.Pp
+The
+.Fn magic_errno
+function returns the last operating system error number (
+.Xr errno 3 )
+that was encountered by a system call.
+.Pp
+The
+.Fn magic_file
+function returns a textual description of the contents of the
+.Ar filename
+argument, or NULL if an error occurred.
+If the
+.Ar filename
+is NULL, then stdin is used.
+.Pp
+The
+.Fn magic_buffer
+function returns a textual description of the contents of the
+.Ar buffer
+argument with
+.Ar length
+bytes size.
+.Pp
+The
+.Fn magic_setflags
+function, sets the 
+.Ar flags
+described above.
+.Pp
+The
+.Fn magic_check
+function can be used to check the validity of entries in the colon
+separated database files passed in as
+.Ar filename ,
+or NULL for the default database. It returns 0 on success and -1 on
+failure.
+.Pp
+The
+.Fn magic_compile
+function can be used to compile the the colon
+separated list of database files passed in as
+.Ar filename ,
+or NULL for the default database. It returns 0 on success and -1 on
+failure. The compiled files created are named from the
+.Xr basename 1
+of each file argument with ".mgc" appended to it.
+.Pp
+The
+.Fn magic_load
+function must be used to load the the colon
+separated list of database files passed in as
+.Ar filename ,
+or NULL for the default database file
+before any magic queries can performed.
+.Pp
+The default database file is named by the MAGIC environment variable.  If
+that variable is not set, the default database file name is __MAGIC__.
+.Pp
+.Fn magic_load
+adds ".mime" and/or ".mgc" to the database filename as appropriate.
+.Sh RETURN VALUES
+The function
+.Fn magic_open
+returns a magic cookie on success and NULL on failure setting errno to
+an appropriate value. It will set errno to EINVAL if an unsupported
+value for flags was given.
+The
+.Fn magic_load ,
+.Fn magic_compile ,
+and
+.Fn magic_check
+functions return 0 on success and -1 on failure.
+The
+.Fn magic_file ,
+and
+.Fn magic_buffer 
+functions return a string on success and NULL on failure. The
+.Fn magic_error
+function returns a textual description of the errors of the above
+functions, or NULL if there was no error.
+Finally,
+.Fn magic_setflags
+returns -1 on systems that don't support
+.Xr utime 2 ,
+or
+.Xr utimes 2
+when
+.Dv MAGIC_PRESERVE_ATIME
+is set.
+.Sh FILES
+.Bl -tag -width __MAGIC__.mime.mgc -compact
+.It Pa __MAGIC__.mime
+The non-compiled default magic mime database.
+.It Pa __MAGIC__.mime.mgc
+The compiled default magic mime database.
+.It Pa __MAGIC__
+The non-compiled default magic database.
+.It Pa __MAGIC__.mgc
+The compiled default magic database.
+.El
+.Sh SEE ALSO
+.Xr file __CSECTION__ ,
+.Xr magic __FSECTION__ 
+.Sh AUTHORS
+Måns Rullgård Initial libmagic implementation,
+and configuration.
+Christos Zoulas API cleanup, error code and allocation handling.

+ 55 - 34
magic.man

@@ -6,8 +6,9 @@ magic \- file command's magic number file
 This manual page documents the format of the magic file as
 used by the
 .BR file (__CSECTION__)
-command, version __VERSION__. The
-.B file
+command, version __VERSION__.
+The
+.BR file
 command identifies the type of a file using,
 among other tests,
 a test for whether the file begins with a certain
@@ -21,13 +22,15 @@ and additional information to extract from the file.
 Each line of the file specifies a test to be performed.
 A test compares the data starting at a particular offset
 in the file with a 1-byte, 2-byte, or 4-byte numeric value or
-a string.  If the test succeeds, a message is printed.
+a string.
+If the test succeeds, a message is printed.
 The line consists of the following fields:
 .IP offset \w'message'u+2n
 A number specifying the offset, in bytes, into the file of the data
 which is to be tested.
 .IP type
-The type of the data to be tested.  The possible values are:
+The type of the data to be tested.
+The possible values are:
 .RS
 .IP byte \w'message'u+2n
 A one-byte value.
@@ -36,14 +39,21 @@ A two-byte value (on most systems) in this machine's native byte order.
 .IP long
 A four-byte value (on most systems) in this machine's native byte order.
 .IP string
-A string of bytes. The string type specification can be optionally followed
-by /[Bbc]*. The ``B'' flag compacts whitespace in the target, which must
-contain at least one whitespace character. If the magic has "n" consecutive
-blanks, the target needs at least "n" consecutive blanks to match. The ``b''
-flag treats every blank in the target as an optional blank. Finally the ``c''
-flag, specifies case insensitive matching: lowercase characters in the magic
-match both lower and upper case characters in the targer, whereas upper case
-characters in the magic, only much uppercase characters in the target.
+A string of bytes.
+The string type specification can be optionally followed
+by /[Bbc]*.
+The ``B'' flag compacts whitespace in the target, which must
+contain at least one whitespace character.
+If the magic has
+.I n
+consecutive blanks, the target needs at least
+.I n
+consecutive blanks to match.
+The ``b'' flag treats every blank in the target as an optional blank.
+Finally the ``c'' flag, specifies case insensitive matching: lowercase
+characters in the magic match both lower and upper case characters in the
+targer, whereas upper case characters in the magic, only much uppercase
+characters in the target.
 .IP date
 A four-byte value interpreted as a UNIX date.
 .IP ldate
@@ -55,7 +65,7 @@ A two-byte value (on most systems) in big-endian byte order.
 A four-byte value (on most systems) in big-endian byte order.
 .IP bedate
 A four-byte value (on most systems) in big-endian byte order,
-interpreted as a unix date.
+interpreted as a Unix date.
 .IP leshort
 A two-byte value (on most systems) in little-endian byte order.
 .IP lelong
@@ -73,11 +83,13 @@ The numeric types may optionally be followed by
 .B &
 and a numeric value,
 to specify that the value is to be AND'ed with the
-numeric value before any comparisons are done.  Prepending a
+numeric value before any comparisons are done.
+Prepending a
 .B u
 to the type indicates that ordered comparisons should be unsigned.
 .IP test
-The value to be compared with the value from the file.  If the type is
+The value to be compared with the value from the file.
+If the type is
 numeric, this value
 is specified in C form; if it is a string, it is specified as a C string
 with the usual escapes permitted (e.g. \en for new-line).
@@ -100,8 +112,8 @@ that are set in the specified value,
 to specify that the value from the file must have clear any of the bits 
 that are set in the specified value, or
 .BR x ,
-to specify that any value will match. If the character is omitted,
-it is assumed to be
+to specify that any value will match.
+If the character is omitted, it is assumed to be
 .BR = .
 .IP
 Numeric values are specified in C form; e.g.
@@ -123,21 +135,24 @@ and
 .BR & )
 can be applied to strings.
 The length used for matching is that of the string argument
-in the magic file.  This means that a line can match any string, and
+in the magic file.
+This means that a line can match any string, and
 then presumably print that string, by doing
 .B >\e0
 (because all strings are greater than the null string).
 .IP message
 The message to be printed if the comparison succeeds.  If the string
 contains a
-.BR printf (3S)
+.BR printf (3)
 format specification, the value from the file (with any specified masking
 performed) is printed using the message as the format string.
 .PP
 Some file formats contain additional information which is to be printed
-along with the file type.  A line which begins with the character
+along with the file type.
+A line which begins with the character
 .B >
-indicates additional tests and messages to be printed.  The number of
+indicates additional tests and messages to be printed.
+The number of
 .B >
 on the line indicates the level of the test; a line with no
 .B >
@@ -151,8 +166,8 @@ If the test on a line at level
 .I n
 succeeds, the tests specified in all the subsequent lines at level
 .IB n \(pl1
-are performed, and the messages printed if the tests succeed.  The next
-line at level
+are performed, and the messages printed if the tests succeed.
+The next line at level
 .I n
 terminates this.
 If the first character following the last
@@ -161,27 +176,33 @@ is a
 .B (
 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 [.[bslBSL]][+-][ y ]).
+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 [.[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 [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
+type specifier.
+The capitalized types interpret the number as a big endian
+value, whereas the small letter versions interpret 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.
+is added and the result is used as an offset in the file.
+The default type if one is not specified is long.
 .PP
 Sometimes you do not know the exact offset as this depends on the length of
-preceding fields. You can specify an offset relative to the end of the
+preceding fields.
+You can specify an offset relative to the end of the
 last uplevel field (of course this may only be done for sublevel tests, i.e.
 test beginning with 
 .B >
-). Such a relative offset is specified using
+).
+Such a relative offset is specified using
 .B &
 as a prefix to the offset.
 .SH BUGS
@@ -219,4 +240,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.17 2001/08/07 15:38:42 christos Exp $
+.\" @(#)$Id: magic.man,v 1.27 2003/09/12 19:43:30 christos Exp $

+ 0 - 476
file.c

@@ -1,476 +0,0 @@
-/*
- * file - find type of a file or files - main program.
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of this
- *    software, no matter how awful, even if they arise from flaws in it.
- *
- * 2. The origin of this software must not be misrepresented, either by
- *    explicit claim or by omission.  Since few users ever read sources,
- *    credits must appear in the documentation.
- *
- * 3. Altered versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.  Since few users
- *    ever read sources, credits must appear in the documentation.
- *
- * 4. This notice may not be removed or altered.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/param.h>	/* for MAXPATHLEN */
-#include <sys/stat.h>
-#include <fcntl.h>	/* for open() */
-#ifdef RESTORE_TIME
-# if (__COHERENT__ >= 0x420)
-#  include <sys/utime.h>
-# else
-#  ifdef USE_UTIMES
-#   include <sys/time.h>
-#  else
-#   include <utime.h>
-#  endif
-# endif
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>	/* for read() */
-#endif
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#include <netinet/in.h>		/* for byte swapping */
-
-#include "file.h"
-#include "patchlevel.h"
-
-#ifndef	lint
-FILE_RCSID("@(#)$Id: file.c,v 1.59 2001/07/23 00:02:32 christos Exp $")
-#endif	/* lint */
-
-
-#ifdef S_IFLNK
-# define USAGE  "Usage: %s [-bciknsvzL] [-f namefile] [-m magicfiles] file...\n"
-#else
-# define USAGE  "Usage: %s [-bciknsvz] [-f namefile] [-m magicfiles] file...\n"
-#endif
-
-#ifndef MAGIC
-# define MAGIC "/etc/magic"
-#endif
-
-#ifndef MAXPATHLEN
-#define	MAXPATHLEN	512
-#endif
-
-int 			/* Global command-line options 		*/
-	debug = 0, 	/* debugging 				*/
-	lflag = 0,	/* follow Symlinks (BSD only) 		*/
-	bflag = 0,	/* brief output format	 		*/
-	zflag = 0,	/* follow (uncompress) compressed files */
-	sflag = 0,	/* read block special files		*/
-	iflag = 0,
-	nobuffer = 0,   /* Do not buffer stdout */
-	kflag = 0;	/* Keep going after the first match	*/
-
-int			/* Misc globals				*/
-	nmagic = 0;	/* number of valid magic[]s 		*/
-
-struct  magic *magic;	/* array of magic entries		*/
-
-const char *magicfile = 0;	/* where the magic is		*/
-const char *default_magicfile = MAGIC;
-
-char *progname;		/* used throughout 			*/
-int lineno;		/* line number in the magic file	*/
-
-
-static void	unwrap		__P((char *fn));
-static void	usage		__P((void));
-#if 0
-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
- */
-int
-main(argc, argv)
-	int argc;
-	char *argv[];
-{
-	int c;
-	int action = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0;
-	char *mime, *home, *usermagic;
-	struct stat sb;
-
-#ifdef LC_CTYPE
-	setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */
-#endif
-
-	if ((progname = strrchr(argv[0], '/')) != NULL)
-		progname++;
-	else
-		progname = argv[0];
-
-	magicfile = default_magicfile;
-	if ((usermagic = getenv("MAGIC")) != NULL)
-		magicfile = usermagic;
-	else
-		if ((home = getenv("HOME")) != NULL) {
-			if ((usermagic = malloc(strlen(home) + 8)) != NULL) {
-				(void)strcpy(usermagic, home);
-				(void)strcat(usermagic, "/.magic");
-				if (stat(usermagic, &sb)<0) 
-					free(usermagic);
-				else
-					magicfile = usermagic;
-			}
-		}
-
-	while ((c = getopt(argc, argv, "bcdf:ikm:nsvzCL")) != EOF)
-		switch (c) {
-		case 'b':
-			++bflag;
-			break;
-		case 'c':
-			action = CHECK;
-			break;
-		case 'C':
-			action = COMPILE;
-			break;
-		case 'd':
-			++debug;
-			break;
-		case 'f':
-			if (!app) {
-				ret = apprentice(magicfile, action);
-				if (action)
-					exit(ret);
-				app = 1;
-			}
-			unwrap(optarg);
-			++didsomefiles;
-			break;
-		case 'i':
-			iflag++;
-			if ((mime = malloc(strlen(magicfile) + 6)) != NULL) {
-				(void)strcpy(mime, magicfile);
-				(void)strcat(mime, ".mime");
-				magicfile = mime;
-			}
-			break;
-		case 'k':
-			kflag = 1;
-			break;
-		case 'm':
-			magicfile = optarg;
-			break;
-		case 'n':
-			++nobuffer;
-			break;
-		case 's':
-			sflag++;
-			break;
-		case 'v':
-			(void) fprintf(stdout, "%s-%d.%d\n", progname,
-				       FILE_VERSION_MAJOR, patchlevel);
-			(void) fprintf(stdout, "magic file from %s\n",
-				       magicfile);
-			return 1;
-		case 'z':
-			zflag++;
-			break;
-#ifdef S_IFLNK
-		case 'L':
-			++lflag;
-			break;
-#endif
-		case '?':
-		default:
-			errflg++;
-			break;
-		}
-
-	if (errflg) {
-		usage();
-	}
-
-	if (!app) {
-		ret = apprentice(magicfile, action);
-		if (action)
-			exit(ret);
-		app = 1;
-	}
-
-	if (optind == argc) {
-		if (!didsomefiles) {
-			usage();
-		}
-	}
-	else {
-		int i, wid, nw;
-		for (wid = 0, i = optind; i < argc; i++) {
-			nw = strlen(argv[i]);
-			if (nw > wid)
-				wid = nw;
-		}
-		for (; optind < argc; optind++)
-			process(argv[optind], wid);
-	}
-
-	return 0;
-}
-
-
-/*
- * unwrap -- read a file of filenames, do each one.
- */
-static void
-unwrap(fn)
-	char *fn;
-{
-	char buf[MAXPATHLEN];
-	FILE *f;
-	int wid = 0, cwid;
-
-	if (strcmp("-", fn) == 0) {
-		f = stdin;
-		wid = 1;
-	} else {
-		if ((f = fopen(fn, "r")) == NULL) {
-			error("Cannot open `%s' (%s).\n", fn, strerror(errno));
-			/*NOTREACHED*/
-		}
-
-		while (fgets(buf, MAXPATHLEN, f) != NULL) {
-			cwid = strlen(buf) - 1;
-			if (cwid > wid)
-				wid = cwid;
-		}
-
-		rewind(f);
-	}
-
-	while (fgets(buf, MAXPATHLEN, f) != NULL) {
-		buf[strlen(buf)-1] = '\0';
-		process(buf, wid);
-		if(nobuffer)
-			(void) fflush(stdout);
-	}
-
-	(void) fclose(f);
-}
-
-
-#if 0
-/*
- * byteconv4
- * Input:
- *	from		4 byte quantity to convert
- *	same		whether to perform byte swapping
- *	big_endian	whether we are a big endian host
- */
-static int
-byteconv4(from, same, big_endian)
-	int from;
-	int same;
-	int big_endian;
-{
-	if (same)
-		return from;
-	else if (big_endian) {		/* lsb -> msb conversion on msb */
-		union {
-			int i;
-			char c[4];
-		} retval, tmpval;
-
-		tmpval.i = from;
-		retval.c[0] = tmpval.c[3];
-		retval.c[1] = tmpval.c[2];
-		retval.c[2] = tmpval.c[1];
-		retval.c[3] = tmpval.c[0];
-
-		return retval.i;
-	}
-	else
-		return ntohl(from);	/* msb -> lsb conversion on lsb */
-}
-
-/*
- * byteconv2
- * Same as byteconv4, but for shorts
- */
-static short
-byteconv2(from, same, big_endian)
-	int from;
-	int same;
-	int big_endian;
-{
-	if (same)
-		return from;
-	else if (big_endian) {		/* lsb -> msb conversion on msb */
-		union {
-			short s;
-			char c[2];
-		} retval, tmpval;
-
-		tmpval.s = (short) from;
-		retval.c[0] = tmpval.c[1];
-		retval.c[1] = tmpval.c[0];
-
-		return retval.s;
-	}
-	else
-		return ntohs(from);	/* msb -> lsb conversion on lsb */
-}
-#endif
-
-/*
- * process - process input file
- */
-void
-process(inname, wid)
-	const char	*inname;
-	int wid;
-{
-	int	fd = 0;
-	static  const char stdname[] = "standard input";
-	unsigned char	buf[HOWMANY+1];	/* one extra for terminating '\0' */
-	struct stat	sb;
-	int nbytes = 0;	/* number of bytes read from a datafile */
-	char match = '\0';
-
-	if (strcmp("-", inname) == 0) {
-		if (fstat(0, &sb)<0) {
-			error("cannot fstat `%s' (%s).\n", stdname,
-			      strerror(errno));
-			/*NOTREACHED*/
-		}
-		inname = stdname;
-	}
-
-	if (wid > 0 && !bflag)
-	     (void) printf("%s:%*s ", inname, 
-			   (int) (wid - strlen(inname)), "");
-
-	if (inname != stdname) {
-		/*
-		 * first try judging the file based on its filesystem status
-		 */
-		if (fsmagic(inname, &sb) != 0) {
-			putchar('\n');
-			return;
-		}
-
-		if ((fd = open(inname, O_RDONLY)) < 0) {
-			/* We can't open it, but we were able to stat it. */
-			if (sb.st_mode & 0002) ckfputs("writeable, ", stdout);
-			if (sb.st_mode & 0111) ckfputs("executable, ", stdout);
-			ckfprintf(stdout, "can't read `%s' (%s).\n",
-			    inname, strerror(errno));
-			return;
-		}
-	}
-
-
-	/*
-	 * try looking at the first HOWMANY bytes
-	 */
-	if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) {
-		error("read failed (%s).\n", strerror(errno));
-		/*NOTREACHED*/
-	}
-
-	if (nbytes == 0)
-		ckfputs(iflag ? "application/x-empty" : "empty", stdout);
-	else {
-		buf[nbytes++] = '\0';	/* null-terminate it */
-		match = tryit(buf, nbytes, zflag);
-	}
-
-#ifdef BUILTIN_ELF
-	if (match == 's' && nbytes > 5) {
-		/*
-		 * We matched something in the file, so this *might*
-		 * be an ELF file, and the file is at least 5 bytes long,
-		 * so if it's an ELF file it has at least one byte
-		 * past the ELF magic number - try extracting information
-		 * from the ELF headers that can't easily be extracted
-		 * with rules in the magic file.
-		 */
-		tryelf(fd, buf, nbytes);
-	}
-#endif
-
-	if (inname != stdname) {
-#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];
-		utsbuf[0].tv_sec = sb.st_atime;
-		utsbuf[1].tv_sec = sb.st_mtime;
-
-		(void) utimes(inname, utsbuf); /* don't care if loses */
-# else
-		struct utimbuf  utbuf;
-
-		utbuf.actime = sb.st_atime;
-		utbuf.modtime = sb.st_mtime;
-		(void) utime(inname, &utbuf); /* don't care if loses */
-# endif
-#endif
-		(void) close(fd);
-	}
-	(void) putchar('\n');
-}
-
-
-int
-tryit(buf, nb, zflag)
-	unsigned char *buf;
-	int nb, zflag;
-{
-	/* try compression stuff */
-	if (zflag && zmagic(buf, nb))
-		return 'z';
-
-	/* try tests in /etc/magic (or surrogate magic file) */
-	if (softmagic(buf, nb))
-		return 's';
-
-	/* try known keywords, check whether it is ASCII */
-	if (ascmagic(buf, nb))
-		return 'a';
-
-	/* abandon hope, all ye who remain here */
-	ckfputs("data", stdout);
-		return '\0';
-}
-
-static void
-usage()
-{
-	(void)fprintf(stderr, USAGE, progname);
-	(void)fprintf(stderr, "Usage: %s -C [-m magic]\n", progname);
-	exit(1);
-}

+ 0 - 194
file.h

@@ -1,194 +0,0 @@
-/*
- * file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.37 2001/07/22 21:04:15 christos Exp $
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of this
- *    software, no matter how awful, even if they arise from flaws in it.
- *
- * 2. The origin of this software must not be misrepresented, either by
- *    explicit claim or by omission.  Since few users ever read sources,
- *    credits must appear in the documentation.
- *
- * 3. Altered versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.  Since few users
- *    ever read sources, credits must appear in the documentation.
- *
- * 4. This notice may not be removed or altered.
- */
-
-#ifndef __file_h__
-#define __file_h__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-typedef int int32;
-typedef unsigned int uint32;
-typedef short int16;
-typedef unsigned short uint16;
-typedef char int8;
-typedef unsigned char uint8;
-
-#ifndef HOWMANY
-# define HOWMANY 16384		/* how much of the file to look at */
-#endif
-#define MAXMAGIS 1000		/* max entries in /etc/magic */
-#define MAXDESC	50		/* max leng of text description */
-#define MAXstring 32		/* max leng of "string" types */
-
-#define MAGICNO		0xF11E041C
-#define VERSIONNO	1
-
-#define CHECK	1
-#define COMPILE	2
-
-struct magic {
-	uint16 cont_level;/* level of ">" */
-	uint8 nospflag;	/* supress space character */
-	uint8 flag;
-#define INDIR	1		/* if '>(...)' appears,  */
-#define	UNSIGNED 2		/* comparison is unsigned */
-#define OFFADD	4		/* if '>&' appears,  */
-	uint8 reln;		/* relation (0=eq, '>'=gt, etc) */
-	uint8 vallen;		/* length of string value, if any */
-	uint8 type;		/* int, short, long or string. */
-	uint8 in_type;		/* type of indirrection */
-#define 			BYTE	1
-#define				SHORT	2
-#define				LONG	4
-#define				STRING	5
-#define				DATE	6
-#define				BESHORT	7
-#define				BELONG	8
-#define				BEDATE	9
-#define				LESHORT	10
-#define				LELONG	11
-#define				LEDATE	12
-#define				PSTRING	13
-#define				LDATE	14
-#define				BELDATE	15
-#define				LELDATE	16
-	uint8 in_op;		/* operator for indirection */
-	uint8 mask_op;		/* operator for mask */
-#define				OPAND	1
-#define				OPOR	2
-#define				OPXOR	3
-#define				OPADD	4
-#define				OPMINUS	5
-#define				OPMULTIPLY	6
-#define				OPDIVIDE	7
-#define				OPMODULO	8
-#define				OPINVERSE	0x80
-	int32 offset;		/* offset to magic number */
-	int32 in_offset;	/* offset from indirection */
-	union VALUETYPE {
-		unsigned char b;
-		unsigned short h;
-		uint32 l;
-		char s[MAXstring];
-		unsigned char hs[2];	/* 2 bytes of a fixed-endian "short" */
-		unsigned char hl[4];	/* 4 bytes of a fixed-endian "long" */
-	} value;		/* either number or string */
-	uint32 mask;	/* mask before comparison with value */
-	char desc[MAXDESC];	/* description */
-};
-
-#define BIT(A)   (1 << (A))
-#define STRING_IGNORE_LOWERCASE		BIT(0)
-#define STRING_COMPACT_BLANK		BIT(1)
-#define STRING_COMPACT_OPTIONAL_BLANK	BIT(2)
-#define CHAR_IGNORE_LOWERCASE		'c'
-#define CHAR_COMPACT_BLANK		'B'
-#define CHAR_COMPACT_OPTIONAL_BLANK	'b'
-
-
-/* list of magic entries */
-struct mlist {
-	struct magic *magic;		/* array of magic entries */
-	uint32 nmagic;			/* number of entries in array */
-	struct mlist *next, *prev;
-};
-
-#include <stdio.h>	/* Include that here, to make sure __P gets defined */
-#include <errno.h>
-
-#ifndef __P
-# if defined(__STDC__) || defined(__cplusplus)
-#  define __P(a) a
-# else
-#  define __P(a) ()
-#  define const
-# endif
-#endif
-
-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 *));
-struct stat;
-extern int   fsmagic		__P((const char *, struct stat *));
-extern char *fmttime		__P((long, int));
-extern int   is_compress	__P((const unsigned char *, int *));
-extern int   is_tar		__P((unsigned char *, int));
-extern void  magwarn		__P((const char *, ...));
-extern void  mdump		__P((struct magic *));
-extern void  process		__P((const char *, int));
-extern void  showstr		__P((FILE *, const char *, int));
-extern int   softmagic		__P((unsigned char *, int));
-extern int   tryit		__P((unsigned char *, int, int));
-extern int   zmagic		__P((unsigned char *, int));
-extern void  ckfprintf		__P((FILE *, const char *, ...));
-extern uint32 signextend	__P((struct magic *, unsigned int32));
-extern void tryelf		__P((int, unsigned char *, int));
-
-extern char *progname;		/* the program name 			*/
-extern const char *magicfile;	/* name of the magic file		*/
-extern int lineno;		/* current line number in magic file	*/
-
-extern struct mlist mlist;	/* list of arrays of magic entries	*/
-
-extern int debug;		/* enable debugging?			*/
-extern int zflag;		/* process compressed files?		*/
-extern int lflag;		/* follow symbolic links?		*/
-extern int sflag;		/* read/analyze block special files?	*/
-extern int iflag;		/* Output types as mime-types		*/
-
-extern int optind;		/* From getopt(3)			*/
-extern char *optarg;
-
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-extern char *sys_errlist[];
-#define strerror(e) \
-	(((e) >= 0 && (e) < sys_nerr) ? sys_errlist[(e)] : "Unknown error")
-#endif
-
-#ifndef HAVE_STRTOUL
-#define strtoul(a, b, c)	strtol(a, b, c)
-#endif
-
-#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
-#define QUICK
-#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__ */

+ 0 - 251
fsmagic.c

@@ -1,251 +0,0 @@
-/*
- * fsmagic - magic based on filesystem info - directory, special files, etc.
- *
- * Copyright (c) Ian F. Darwin, 1987.
- * Written by Ian F. Darwin.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of this
- *    software, no matter how awful, even if they arise from flaws in it.
- *
- * 2. The origin of this software must not be misrepresented, either by
- *    explicit claim or by omission.  Since few users ever read sources,
- *    credits must appear in the documentation.
- *
- * 3. Altered versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.  Since few users
- *    ever read sources, credits must appear in the documentation.
- *
- * 4. This notice may not be removed or altered.
- */
-
-#include "file.h"
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-/* Since major is a function on SVR4, we can't use `ifndef major'.  */
-#ifdef MAJOR_IN_MKDEV
-# include <sys/mkdev.h>
-# define HAVE_MAJOR
-#endif
-#ifdef MAJOR_IN_SYSMACROS
-# include <sys/sysmacros.h>
-# define HAVE_MAJOR
-#endif
-#ifdef major			/* Might be defined in sys/types.h.  */
-# define HAVE_MAJOR
-#endif
-  
-#ifndef HAVE_MAJOR
-# define major(dev)  (((dev) >> 8) & 0xff)
-# define minor(dev)  ((dev) & 0xff)
-#endif
-#undef HAVE_MAJOR
-
-#ifndef	lint
-FILE_RCSID("@(#)$Id: fsmagic.c,v 1.33 2000/08/05 17:36:48 christos Exp $")
-#endif	/* lint */
-
-int
-fsmagic(fn, sb)
-	const char *fn;
-	struct stat *sb;
-{
-	int ret = 0;
-
-	/*
-	 * Fstat is cheaper but fails for files you don't have read perms on.
-	 * On 4.2BSD and similar systems, use lstat() to identify symlinks.
-	 */
-#ifdef	S_IFLNK
-	if (!lflag)
-		ret = lstat(fn, sb);
-	else
-#endif
-	ret = stat(fn, sb);	/* don't merge into if; see "ret =" above */
-
-	if (ret) {
-		ckfprintf(stdout,
-			/* Yes, I do mean stdout. */
-			/* No \n, caller will provide. */
-			"can't stat `%s' (%s).", fn, strerror(errno));
-		return 1;
-	}
-
-	if (iflag) {
-		if ((sb->st_mode & S_IFMT) != S_IFREG) {
-			ckfputs("application/x-not-regular-file", stdout);
-			return 1;
-		}
-	}
-	else {
-#ifdef S_ISUID
-		if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout);
-#endif
-#ifdef S_ISGID
-		if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout);
-#endif
-#ifdef S_ISVTX
-		if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout);
-#endif
-	}
-	
-	switch (sb->st_mode & S_IFMT) {
-	case S_IFDIR:
-		ckfputs("directory", stdout);
-		return 1;
-#ifdef S_IFCHR
-	case S_IFCHR:
-		/* 
-		 * If -s has been specified, treat character special files
-		 * like ordinary files.  Otherwise, just report that they
-		 * are block special files and go on to the next file.
-		 */
-		if (sflag)
-			break;
-#ifdef HAVE_ST_RDEV
-# ifdef dv_unit
-		(void) printf("character special (%d/%d/%d)",
-			major(sb->st_rdev),
-			dv_unit(sb->st_rdev),
-			dv_subunit(sb->st_rdev));
-# else
-		(void) printf("character special (%ld/%ld)",
-			(long) major(sb->st_rdev), (long) minor(sb->st_rdev));
-# endif
-#else
-		(void) printf("character special");
-#endif
-		return 1;
-#endif
-#ifdef S_IFBLK
-	case S_IFBLK:
-		/* 
-		 * If -s has been specified, treat block special files
-		 * like ordinary files.  Otherwise, just report that they
-		 * are block special files and go on to the next file.
-		 */
-		if (sflag)
-			break;
-#ifdef HAVE_ST_RDEV
-# ifdef dv_unit
-		(void) printf("block special (%d/%d/%d)",
-			major(sb->st_rdev),
-			dv_unit(sb->st_rdev),
-			dv_subunit(sb->st_rdev));
-# else
-		(void) printf("block special (%ld/%ld)",
-			(long) major(sb->st_rdev), (long) minor(sb->st_rdev));
-# endif
-#else
-		(void) printf("block special");
-#endif
-		return 1;
-#endif
-	/* TODO add code to handle V7 MUX and Blit MUX files */
-#ifdef	S_IFIFO
-	case S_IFIFO:
-		ckfputs("fifo (named pipe)", stdout);
-		return 1;
-#endif
-#ifdef	S_IFDOOR
-	case S_IFDOOR:
-		ckfputs("door", stdout);
-		return 1;
-#endif
-#ifdef	S_IFLNK
-	case S_IFLNK:
-		{
-			char buf[BUFSIZ+4];
-			int nch;
-			struct stat tstatbuf;
-
-			if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) {
-				ckfprintf(stdout, "unreadable symlink (%s).", 
-				      strerror(errno));
-				return 1;
-			}
-			buf[nch] = '\0';	/* readlink(2) forgets this */
-
-			/* If broken symlink, say so and quit early. */
-			if (*buf == '/') {
-			    if (stat(buf, &tstatbuf) < 0) {
-				ckfprintf(stdout,
-					"broken symbolic link to %s", buf);
-				return 1;
-			    }
-			}
-			else {
-			    char *tmp;
-			    char buf2[BUFSIZ+BUFSIZ+4];
-
-			    if ((tmp = strrchr(fn,  '/')) == NULL) {
-				tmp = buf; /* in current directory anyway */
-			    }
-			    else {
-				strcpy (buf2, fn);  /* take directory part */
-				buf2[tmp-fn+1] = '\0';
-				strcat (buf2, buf); /* plus (relative) symlink */
-				tmp = buf2;
-			    }
-			    if (stat(tmp, &tstatbuf) < 0) {
-				ckfprintf(stdout,
-					"broken symbolic link to %s", buf);
-				return 1;
-			    }
-                        }
-
-			/* Otherwise, handle it. */
-			if (lflag) {
-				process(buf, strlen(buf));
-				return 1;
-			} else { /* just print what it points to */
-				ckfputs("symbolic link to ", stdout);
-				ckfputs(buf, stdout);
-			}
-		}
-		return 1;
-#endif
-#ifdef	S_IFSOCK
-#ifndef __COHERENT__
-	case S_IFSOCK:
-		ckfputs("socket", stdout);
-		return 1;
-#endif
-#endif
-	case S_IFREG:
-		break;
-	default:
-		error("invalid mode 0%o.\n", sb->st_mode);
-		/*NOTREACHED*/
-	}
-
-	/*
-	 * regular file, check next possibility
-	 *
-	 * If stat() tells us the file has zero length, report here that
-	 * the file is empty, so we can skip all the work of opening and 
-	 * reading the file.
-	 * But if the -s option has been given, we skip this optimization,
-	 * since on some systems, stat() reports zero size for raw disk
-	 * partitions.  (If the block special device really has zero length,
-	 * the fact that it is empty will be detected and reported correctly
-	 * when we read the file.)
-	 */
-	if (!sflag && sb->st_size == 0) {
-		ckfputs(iflag ? "application/x-empty" : "empty", stdout);
-		return 1;
-	}
-	return 0;
-}

+ 36 - 23
install-sh

@@ -1,15 +1,27 @@
-#! /bin/sh
+#!/bin/sh
 #
 # install - install a program, script, or datafile
-# This comes from X11R5.
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
 # `make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.
-#
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
 
 
 # set DOITPROG to echo to test this script
@@ -29,7 +41,7 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-tranformbasename=""
+transformbasename=""
 transform_arg=""
 instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
@@ -97,7 +109,7 @@ then
 	echo "install:	no input file specified"
 	exit 1
 else
-	true
+	:
 fi
 
 if [ x"$dir_arg" != x ]; then
@@ -106,8 +118,9 @@ if [ x"$dir_arg" != x ]; then
 	
 	if [ -d $dst ]; then
 		instcmd=:
+		chmodcmd=""
 	else
-		instcmd=mkdir
+		instcmd=$mkdirprog
 	fi
 else
 
@@ -115,9 +128,9 @@ else
 # might cause directories to be created, which would be especially bad 
 # if $src (and thus $dsttmp) contains '*'.
 
-	if [ -f $src -o -d $src ]
+	if [ -f "$src" ] || [ -d "$src" ]
 	then
-		true
+		:
 	else
 		echo "install:  $src does not exist"
 		exit 1
@@ -128,7 +141,7 @@ else
 		echo "install:	no destination specified"
 		exit 1
 	else
-		true
+		:
 	fi
 
 # If destination is a directory, append the input filename; if your system
@@ -138,7 +151,7 @@ else
 	then
 		dst="$dst"/`basename $src`
 	else
-		true
+		:
 	fi
 fi
 
@@ -150,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
 # Skip lots of stat calls in the usual case.
 if [ ! -d "$dstdir" ]; then
-defaultIFS='	
-'
+defaultIFS='
+	'
 IFS="${IFS-${defaultIFS}}"
 
 oIFS="${IFS}"
@@ -170,7 +183,7 @@ while [ $# -ne 0 ] ; do
         then
 		$mkdirprog "${pathcomp}"
 	else
-		true
+		:
 	fi
 
 	pathcomp="${pathcomp}/"
@@ -181,10 +194,10 @@ if [ x"$dir_arg" != x ]
 then
 	$doit $instcmd $dst &&
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
 else
 
 # If we're going to rename the final executable, determine the name now.
@@ -203,7 +216,7 @@ else
 	then
 		dstfile=`basename $dst`
 	else
-		true
+		:
 	fi
 
 # Make a temp file name in the proper directory.
@@ -222,10 +235,10 @@ else
 # ignore errors from any of these, just make sure not to ignore
 # errors from the above "$doit $instcmd $src $dsttmp" command.
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
 
 # Now rename the file to the real destination.
 

+ 0 - 101
is_tar.c

@@ -1,101 +0,0 @@
-/*
- * is_tar() -- figure out whether file is a tar archive.
- *
- * Stolen (by the author!) from the public domain tar program:
- * Public 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.13 2000/08/05 17:36:48 christos Exp $
- *
- * Comments changed and some code/comments reformatted
- * for file command by Ian Darwin.
- */
-
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include "tar.h"
-#include "file.h"
-
-#ifndef lint
-FILE_RCSID("@(#)$Id: is_tar.c,v 1.13 2000/08/05 17:36:48 christos Exp $")
-#endif
-
-#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
-
-static int from_oct __P((int, char *));	/* Decode octal number */
-
-/*
- * Return 
- *	0 if the checksum is bad (i.e., probably not a tar archive), 
- *	1 for old UNIX tar file,
- *	2 for Unix Std (POSIX) tar file.
- */
-int
-is_tar(buf, nbytes)
-	unsigned char *buf;
-	int nbytes;
-{
-	union record *header = (union record *)buf;
-	int	i;
-	int	sum, recsum;
-	char	*p;
-
-	if (nbytes < sizeof(union record))
-		return 0;
-
-	recsum = from_oct(8,  header->header.chksum);
-
-	sum = 0;
-	p = header->charptr;
-	for (i = sizeof(union record); --i >= 0;) {
-		/*
-		 * We can't use unsigned char here because of old compilers,
-		 * e.g. V7.
-		 */
-		sum += 0xFF & *p++;
-	}
-
-	/* Adjust checksum to count the "chksum" field as blanks. */
-	for (i = sizeof(header->header.chksum); --i >= 0;)
-		sum -= 0xFF & header->header.chksum[i];
-	sum += ' '* sizeof header->header.chksum;	
-
-	if (sum != recsum)
-		return 0;	/* Not a tar archive */
-	
-	if (0==strcmp(header->header.magic, TMAGIC)) 
-		return 2;		/* Unix Standard tar archive */
-
-	return 1;			/* Old fashioned tar archive */
-}
-
-
-/*
- * Quick and dirty octal conversion.
- *
- * Result is -1 if the field is invalid (all blank, or nonoctal).
- */
-static int
-from_oct(digs, where)
-	int	digs;
-	char	*where;
-{
-	int	value;
-
-	while (isspace((unsigned char)*where)) {	/* Skip spaces */
-		where++;
-		if (--digs <= 0)
-			return -1;		/* All blank field */
-	}
-	value = 0;
-	while (digs > 0 && isodigit(*where)) {	/* Scan til nonoctal */
-		value = (value << 3) | (*where++ - '0');
-		--digs;
-	}
-
-	if (digs > 0 && *where && !isspace((unsigned char)*where))
-		return -1;			/* Ended on non-space/nul */
-
-	return value;
-}

+ 805 - 0
ltcf-c.sh

@@ -0,0 +1,805 @@
+#### This script is meant to be sourced by ltconfig.
+
+# ltcf-c.sh - Create a C compiler specific configuration
+#
+# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='main(){return(0);}'
+
+## Linker Characteristics
+case $host_os in
+cygwin* | mingw*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$with_gcc" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+        cp $export_symbols $output_objdir/$soname-def;
+      else
+        echo EXPORTS > $output_objdir/$soname-def;
+        _lt_hint=1;
+        cat $export_symbols | while read symbol; do
+         set dummy \$symbol;
+         case \[$]# in
+           2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+           *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
+         esac;
+         _lt_hint=`expr 1 + \$_lt_hint`;
+        done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    hardcode_direct=yes
+    hardcode_libdir_separator=':'
+    link_all_deplibs=yes
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+    if test "$with_gcc" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+        collect2name=`${CC} -print-prog-name=collect2`
+        if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+        then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+        else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+        fi
+      esac
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+        shared_flag='${wl}-G'
+      else
+        shared_flag='${wl}-bM:SRE'
+      fi
+    fi
+
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      # Test if we are trying to use run time linking, or normal AIX style linking.
+      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
+      aix_use_runtimelinking=no
+      for ld_flag in $LDFLAGS; do
+        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
+          aix_use_runtimelinking=yes
+          break
+        fi
+      done
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+    # -bexpall does not export symbols beginning with underscore (_)
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other run time loading flags (-brtl), -berok will
+      #           link without error, but may produce a broken library.
+      allow_undefined_flag=' ${wl}-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+    else
+      if test "$host_cpu" = ia64; then
+        hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        allow_undefined_flag="-z nodefs"
+        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+        allow_undefined_flag=' ${wl}-berok'
+        # -bexpall does not export symbols beginning with underscore (_)
+        always_export_symbols=yes
+        # Exported symbols can be pulled into shared objects from archives
+        whole_archive_flag_spec=' '
+        build_libtool_need_lc=yes
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+        # This is similar to how AIX traditionally builds it's shared libraries.
+        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    archive_cmds='$CC $(if test .$module = .yes; then echo -bundle; else echo -dynamiclib; fi) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname $verstring'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6*)
+    if test "$with_gcc" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      # cc supports -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    ;;
+
+  solaris*)
+    no_undefined_flag=' -z defs'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+
+## Compiler Characteristics: PIC flags, static flags, etc
+if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
+  :
+else
+  ac_cv_prog_cc_pic=
+  ac_cv_prog_cc_shlib=
+  ac_cv_prog_cc_wl=
+  ac_cv_prog_cc_static=
+  ac_cv_prog_cc_no_builtin=
+  ac_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$with_gcc" = yes; then
+    ac_cv_prog_cc_wl='-Wl,'
+    ac_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+        # AIX 5 now supports IA64 processor
+        lt_cv_prog_cc_static='-Bstatic'
+      else
+        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    cygwin* | mingw* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      ac_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      ac_cv_prog_cc_pic='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      ac_cv_prog_cc_pic=
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 ac_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      ac_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix*)
+     # All AIX code is PIC.
+      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+      ac_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6*)
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      ac_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      ac_cv_prog_cc_pic='-KPIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      ac_cv_prog_cc_pic='-Kpic'
+      ac_cv_prog_cc_static='-dn'
+      ac_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      ac_cv_prog_cc_pic='-KPIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      ac_cv_prog_cc_pic='-PIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      ac_cv_prog_cc_pic='-KPIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      ac_cv_prog_cc_pic='-pic'
+      ac_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	ac_cv_prog_cc_pic='-Kconform_pic'
+	ac_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      ac_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+  case "$host_os" in
+      # Platforms which do not suport PIC and -DPIC is meaningless
+      # on them:
+      *djgpp*)
+        ac_cv_prog_cc_pic=
+        ;;
+      *)
+        ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
+        ;;
+  esac
+fi
+
+need_lc=yes
+if test "$enable_shared" = yes && test "$with_gcc" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
+    if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
+      echo $ac_n "(cached) $ac_c" 1>&6
+      need_lc=$ac_cv_archive_cmds_needs_lc
+    else
+      $rm conftest*
+      echo "static int dummy;" > conftest.$ac_ext
+      if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+	# Append any warnings to the config.log.
+	cat conftest.err 1>&5
+	soname=conftest
+	lib=conftest
+	libobjs=conftest.$ac_objext
+	deplibs=
+	wl=$ac_cv_prog_cc_wl
+	compiler_flags=-v
+	linker_flags=-v
+	verstring=
+	output_objdir=.
+	libname=conftest
+	save_allow_undefined_flag=$allow_undefined_flag
+	allow_undefined_flag=
+	if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
+	  need_lc=no
+	fi
+	allow_undefined_flag=$save_allow_undefined_flag
+      else
+	cat conftest.err 1>&5
+      fi
+    fi
+    $rm conftest*
+    echo "$ac_t$need_lc" 1>&6
+    ;;
+  esac
+fi
+ac_cv_archive_cmds_needs_lc=$need_lc

File diff suppressed because it is too large
+ 2797 - 0
ltconfig


File diff suppressed because it is too large
+ 5064 - 0
ltmain.sh


Header → magic/Header


+ 1 - 1
Localstuff

@@ -2,6 +2,6 @@
 #------------------------------------------------------------------------------
 # Localstuff:  file(1) magic for locally observed files
 #
-# $Id: Localstuff,v 1.3 1995/01/21 21:09:00 christos Exp $
+# $Id: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
 # Add any locally observed files here.  Remember:
 # text if readable, executable if runnable binary, data if unreadable.

+ 32 - 0
magic/Magdir/acorn

@@ -0,0 +1,32 @@
+#------------------------------------------------------------------------------
+# acorn:  file(1) magic for files found on Acorn systems
+#
+
+# RISC OS Chunk File Format
+# From RISC OS Programmer's Reference Manual, Appendix D
+# We guess the file type from the type of the first chunk.
+0	lelong		0xc3cbc6c5	RISC OS Chunk data
+>12	string		OBJ_		\b, AOF object
+>12	string		LIB_		\b, ALF library
+
+# RISC OS AIF, contains "SWI OS_Exit" at offset 16.
+16	lelong		0xef000011	RISC OS AIF executable
+
+# RISC OS Draw files
+# From RISC OS Programmer's Reference Manual, Appendix E
+0	string 		Draw		RISC OS Draw file data
+
+# RISC OS new format font files
+# From RISC OS Programmer's Reference Manual, Appendix E
+0	string		FONT\0		RISC OS outline font data,
+>5	byte		x		version %d
+0	string		FONT\1		RISC OS 1bpp font data,
+>5	byte		x		version %d
+0	string		FONT\4		RISC OS 4bpp font data
+>5	byte		x		version %d
+
+# RISC OS Music files
+# From RISC OS Programmer's Reference Manual, Appendix E
+0	string		Maestro\r	RISC OS music file
+>8	byte		x		version %d
+

Magdir/adi → magic/Magdir/adi


+ 63 - 0
magic/Magdir/adventure

@@ -0,0 +1,63 @@
+
+#------------------------------------------------------------------------------
+# 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
+# Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
+#
+# ALAN
+# I assume there are other, lower versions, but these are the only ones I
+# saw in the archive.
+0	beshort	0x0206	ALAN game 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 version 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)
+#  All files are machine-independent (games compile to byte-code) and are tagged
+#  with a version string of the form "V2.<digit>.<digit>\0" (but TADS 3 is
+#  on the way).
+#  Game files start with "TADS2 bin\n\r\032\0" then the compiler version.
+0	string	TADS2\ bin	TADS
+>9	belong  !0x0A0D1A00	game data, CORRUPTED
+>9	belong	 0x0A0D1A00
+>>13	string	>\0		%s game data
+#  Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version.
+0	string	TADS2\ rsc	TADS
+>9	belong  !0x0A0D1A00	resource data, CORRUPTED
+>9	belong	 0x0A0D1A00
+>>13	string	>\0		%s resource data
+#  Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian
+#  2-byte length N, the N-char name of the game file *without* a NUL (darn!),
+# "TADS2 save\n\r\032\0" and the interpreter version. 
+0	string	TADS2\ save/g	TADS
+>12	belong	!0x0A0D1A00	saved game data, CORRUPTED
+>12	belong	 0x0A0D1A00
+>>(16.s+32) string >\0		%s saved game data
+#  Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter
+#  version.
+0	string	TADS2\ save	TADS
+>10	belong	!0x0A0D1A00	saved game data, CORRUPTED
+>10	belong	 0x0A0D1A00
+>>14	string	>\0		%s saved game data

Magdir/allegro → magic/Magdir/allegro


Magdir/alliant → magic/Magdir/alliant


Magdir/alpha → magic/Magdir/alpha


Magdir/amanda → magic/Magdir/amanda


+ 56 - 0
magic/Magdir/amigaos

@@ -0,0 +1,56 @@
+#------------------------------------------------------------------------------
+# amigaos:  file(1) magic for AmigaOS binary formats:
+
+#
+# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
+#
+0	belong		0x000003fa	AmigaOS shared library
+0	belong		0x000003f3	AmigaOS loadseg()ble executable/binary
+0	belong		0x000003e7	AmigaOS object/library data
+#
+0	beshort		0xe310		Amiga Workbench
+>2	beshort		1		
+>>48	byte		1		disk icon
+>>48	byte		2		drawer icon
+>>48	byte		3		tool icon
+>>48	byte		4		project icon
+>>48	byte		5		garbage icon
+>>48	byte		6		device icon
+>>48	byte		7		kickstart icon
+>>48	byte		8		workbench application icon
+>2	beshort		>1		icon, vers. %d
+#
+# various sound formats from the Amiga
+# G=F6tz Waschk <waschk@informatik.uni-rostock.de>
+#
+0	string		FC14		Future Composer 1.4 Module sound file
+0	string		SMOD		Future Composer 1.3 Module sound file
+0	string		AON4artofnoise	Art Of Noise Module sound file
+1	string		MUGICIAN/SOFTEYES Mugician Module sound file
+58	string		SIDMON\ II\ -\ THE	Sidmon 2.0 Module sound file
+0	string		Synth4.0	Synthesis Module sound file
+0	string		ARP.		The Holy Noise Module sound file
+0	string		BeEp\0		JamCracker Module sound file
+0	string		COSO\0		Hippel-COSO Module sound file
+# Too simple (short, pure ASCII, deep), MPi
+#26	string		V.3		Brian Postma's Soundmon Module sound file v3
+#26	string		BPSM		Brian Postma's Soundmon Module sound file v3
+#26	string		V.2		Brian Postma's Soundmon Module sound file v2
+
+# The following are from: "Stefan A. Haubenthal" <polluks@web.de>
+0	beshort		0x0f00		AmigaOS bitmap font
+0	beshort		0x0f03		AmigaOS outline font
+0	belong		0x80001001	AmigaOS outline tag
+0	string		##\ version	catalog translation
+
+# Amiga disk types
+# 
+0	string		RDSK		Rigid Disk Block
+>160	string		x		on %.24s
+0	string		DOS\0		Amiga DOS disk
+0	string		DOS\1		Amiga FFS disk
+0	string		DOS\2		Amiga Inter DOS disk
+0	string		DOS\3		Amiga Inter FFS disk
+0	string		DOS\4		Amiga Fastdir DOS disk
+0	string		DOS\5		Amiga Fastdir FFS disk
+0	string		KICK		Kickstart disk

+ 656 - 0
magic/Magdir/animation

@@ -0,0 +1,656 @@
+
+#------------------------------------------------------------------------------
+# animation:  file(1) magic for animation/movie formats
+#
+# animation formats
+# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
+# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
+
+# MPEG sequences
+# Scans for all common MPEG header start codes
+0        belong&0xFFFFFF00  0x00000100     MPEG sequence
+>3       byte               0xBA
+>>4      byte               &0x40          \b, v2, program multiplex
+>>4      byte               ^0x40          \b, v1, system multiplex
+>3       byte               0xBB           \b, v1/2, multiplex (missing pack header)
+>3       byte               0xB0           \b, v4
+>>5      belong             0x000001B5
+>>>9     byte               &0x80
+>>>>10   byte&0xF0          16             \b, video
+>>>>10   byte&0xF0          32             \b, still texture
+>>>>10   byte&0xF0          48             \b, mesh
+>>>>10   byte&0xF0          64             \b, face
+>>>9     byte               ^0x80
+>>>>9    byte&0xF8          8              \b, video
+>>>>9    byte&0xF8          16             \b, still texture
+>>>>9    byte&0xF8          24             \b, mesh
+>>>>9    byte&0xF8          32             \b, face
+>>4      byte               1              \b, simple @ L1
+>>4      byte               2              \b, simple @ L2
+>>4      byte               3              \b, simple @ L3
+>>4      byte               4              \b, simple @ L0
+>>4      byte               17             \b, simple scalable @ L1
+>>4      byte               18             \b, simple scalable @ L2
+>>4      byte               33             \b, core @ L1
+>>4      byte               34             \b, core @ L2
+>>4      byte               50             \b, main @ L2
+>>4      byte               51             \b, main @ L3
+>>4      byte               53             \b, main @ L4
+>>4      byte               66             \b, n-bit @ L2
+>>4      byte               81             \b, scalable texture @ L1
+>>4      byte               97             \b, simple face animation @ L1
+>>4      byte               98             \b, simple face animation @ L2
+>>4      byte               99             \b, simple face basic animation @ L1
+>>4      byte               100            \b, simple face basic animation @ L2
+>>4      byte               113            \b, basic animation text @ L1
+>>4      byte               114            \b, basic animation text @ L2
+>>4      byte               129            \b, hybrid @ L1
+>>4      byte               130            \b, hybrid @ L2
+>>4      byte               145            \b, advanced RT simple @ L!
+>>4      byte               146            \b, advanced RT simple @ L2
+>>4      byte               147            \b, advanced RT simple @ L3
+>>4      byte               148            \b, advanced RT simple @ L4
+>>4      byte               161            \b, core scalable @ L1
+>>4      byte               162            \b, core scalable @ L2
+>>4      byte               163            \b, core scalable @ L3
+>>4      byte               177            \b, advanced coding efficiency @ L1
+>>4      byte               178            \b, advanced coding efficiency @ L2
+>>4      byte               179            \b, advanced coding efficiency @ L3
+>>4      byte               180            \b, advanced coding efficiency @ L4
+>>4      byte               193            \b, advanced core @ L1
+>>4      byte               194            \b, advanced core @ L2
+>>4      byte               209            \b, advanced scalable texture @ L1
+>>4      byte               210            \b, advanced scalable texture @ L2
+>>4      byte               211            \b, advanced scalable texture @ L3
+>>4      byte               225            \b, simple studio @ L1
+>>4      byte               226            \b, simple studio @ L2
+>>4      byte               227            \b, simple studio @ L3
+>>4      byte               228            \b, simple studio @ L4
+>>4      byte               229            \b, core studio @ L1
+>>4      byte               230            \b, core studio @ L2
+>>4      byte               231            \b, core studio @ L3
+>>4      byte               232            \b, core studio @ L4
+>>4      byte               240            \b, advanced simple @ L0
+>>4      byte               241            \b, advanced simple @ L1
+>>4      byte               242            \b, advanced simple @ L2
+>>4      byte               243            \b, advanced simple @ L3
+>>4      byte               244            \b, advanced simple @ L4
+>>4      byte               245            \b, advanced simple @ L5
+>>4      byte               247            \b, advanced simple @ L3b
+>>4      byte               248            \b, FGS @ L0
+>>4      byte               249            \b, FGS @ L1
+>>4      byte               250            \b, FGS @ L2
+>>4      byte               251            \b, FGS @ L3
+>>4      byte               252            \b, FGS @ L4
+>>4      byte               253            \b, FGS @ L5
+>3       byte               0xB5           \b, v4
+>>4      byte               &0x80
+>>>5     byte&0xF0          16             \b, video (missing profile header)
+>>>5     byte&0xF0          32             \b, still texture (missing profile header)
+>>>5     byte&0xF0          48             \b, mesh (missing profile header)
+>>>5     byte&0xF0          64             \b, face (missing profile header)
+>>4      byte               ^0x80
+>>>4     byte&0xF8          8              \b, video (missing profile header)
+>>>4     byte&0xF8          16             \b, still texture (missing profile header)
+>>>4     byte&0xF8          24             \b, mesh (missing profile header)
+>>>4     byte&0xF8          32             \b, face (missing profile header)
+>3       byte               0xB3
+>>12     belong             0x000001B8     \b, v1, progressive Y'CbCr 4:2:0 video
+>>12     belong             0x000001B2     \b, v1, progressive Y'CbCr 4:2:0 video
+>>12     belong             0x000001B5     \b, v2,
+>>>16    byte&0x0F          1              \b HP
+>>>16    byte&0x0F          2              \b Spt
+>>>16    byte&0x0F          3              \b SNR
+>>>16    byte&0x0F          4              \b MP
+>>>16    byte&0x0F          5              \b SP
+>>>17    byte&0xF0          64             \b@HL
+>>>17    byte&0xF0          96             \b@H-14
+>>>17    byte&0xF0          128            \b@ML
+>>>17    byte&0xF0          160            \b@LL
+>>>17    byte               &0x08          \b progressive
+>>>17    byte               ^0x08          \b interlaced
+>>>17    byte&0x06          2              \b Y'CbCr 4:2:0 video
+>>>17    byte&0x06          4              \b Y'CbCr 4:2:2 video
+>>>17    byte&0x06          6              \b Y'CbCr 4:4:4 video
+>>11     byte               &0x02
+>>>75    byte               &0x01
+>>>>140  belong             0x000001B8     \b, v1, progressive Y'CbCr 4:2:0 video
+>>>>140  belong             0x000001B2     \b, v1, progressive Y'CbCr 4:2:0 video
+>>>>140  belong             0x000001B5     \b, v2,
+>>>>>144 byte&0x0F          1              \b HP
+>>>>>144 byte&0x0F          2              \b Spt
+>>>>>144 byte&0x0F          3              \b SNR
+>>>>>144 byte&0x0F          4              \b MP
+>>>>>144 byte&0x0F          5              \b SP
+>>>>>145 byte&0xF0          64             \b@HL
+>>>>>145 byte&0xF0          96             \b@H-14
+>>>>>145 byte&0xF0          128            \b@ML
+>>>>>145 byte&0xF0          160            \b@LL
+>>>>>145 byte               &0x08          \b progressive
+>>>>>145 byte               ^0x08          \b interlaced
+>>>>>145 byte&0x06          2              \b Y'CbCr 4:2:0 video
+>>>>>145 byte&0x06          4              \b Y'CbCr 4:2:2 video
+>>>>>145 byte&0x06          6              \b Y'CbCr 4:4:4 video
+>>>76    belong             0x000001B8     \b, v1, progressive Y'CbCr 4:2:0 video
+>>>76    belong             0x000001B2     \b, v1, progressive Y'CbCr 4:2:0 video
+>>>76    belong             0x000001B5     \b, v2,
+>>>80    byte&0x0F          1              \b HP
+>>>80    byte&0x0F          2              \b Spt
+>>>80    byte&0x0F          3              \b SNR
+>>>80    byte&0x0F          4              \b MP
+>>>80    byte&0x0F          5              \b SP
+>>>81    byte&0xF0          64             \b@HL
+>>>81    byte&0xF0          96             \b@H-14
+>>>81    byte&0xF0          128            \b@ML
+>>>81    byte&0xF0          160            \b@LL
+>>>81    byte               &0x08          \b progressive
+>>>81    byte               ^0x08          \b interlaced
+>>>81    byte&0x06          2              \b Y'CbCr 4:2:0 video
+>>>81    byte&0x06          4              \b Y'CbCr 4:2:2 video
+>>>81    byte&0x06          6              \b Y'CbCr 4:4:4 video
+>>4      belong&0xFFFFFF00  0x78043800     \b, HD-TV 1920P
+>>>7     byte&0xF0          0x10           \b, 16:9
+>>4      belong&0xFFFFFF00  0x50002D00     \b, SD-TV 1280I
+>>>7     byte&0xF0          0x10           \b, 16:9
+>>4      belong&0xFFFFFF00  0x30024000     \b, PAL Capture
+>>>7     byte&0xF0          0x10           \b, 4:3
+>>4      beshort&0xFFF0     0x2C00         \b, 4CIF
+>>>5     beshort&0x0FFF     0x01E0         \b NTSC
+>>>5     beshort&0x0FFF     0x0240         \b PAL
+>>>7     byte&0xF0          0x20           \b, 4:3
+>>>7     byte&0xF0          0x30           \b, 16:9
+>>>7     byte&0xF0          0x40           \b, 11:5
+>>>7     byte&0xF0          0x80           \b, PAL 4:3
+>>>7     byte&0xF0          0xC0           \b, NTSC 4:3
+>>4      belong&0xFFFFFF00  0x2801E000     \b, LD-TV 640P
+>>>7     byte&0xF0          0x10           \b, 4:3
+>>4      belong&0xFFFFFF00  0x1400F000     \b, 320x240
+>>>7     byte&0xF0          0x10           \b, 4:3
+>>4      belong&0xFFFFFF00  0x0F00A000     \b, 240x160
+>>>7     byte&0xF0          0x10           \b, 4:3
+>>4      belong&0xFFFFFF00  0x0A007800     \b, 160x120
+>>>7     byte&0xF0          0x10           \b, 4:3
+>>4      beshort&0xFFF0     0x1600         \b, CIF
+>>>5     beshort&0x0FFF     0x00F0         \b NTSC
+>>>5     beshort&0x0FFF     0x0120         \b PAL
+>>>7     byte&0xF0          0x20           \b, 4:3
+>>>7     byte&0xF0          0x30           \b, 16:9
+>>>7     byte&0xF0          0x40           \b, 11:5
+>>>7     byte&0xF0          0x80           \b, PAL 4:3
+>>>7     byte&0xF0          0xC0           \b, NTSC 4:3
+>>>5     beshort&0x0FFF     0x0240         \b PAL 625
+>>>>7    byte&0xF0          0x20           \b, 4:3
+>>>>7    byte&0xF0          0x30           \b, 16:9
+>>>>7    byte&0xF0          0x40           \b, 11:5
+>>4      beshort&0xFFF0     0x2D00         \b, CCIR/ITU
+>>>5     beshort&0x0FFF     0x01E0         \b NTSC 525
+>>>5     beshort&0x0FFF     0x0240         \b PAL 625
+>>>7     byte&0xF0          0x20           \b, 4:3
+>>>7     byte&0xF0          0x30           \b, 16:9
+>>>7     byte&0xF0          0x40           \b, 11:5
+>>4      beshort&0xFFF0     0x1E00         \b, SVCD
+>>>5     beshort&0x0FFF     0x01E0         \b NTSC 525
+>>>5     beshort&0x0FFF     0x0240         \b PAL 625
+>>>7     byte&0xF0          0x20           \b, 4:3
+>>>7     byte&0xF0          0x30           \b, 16:9
+>>>7     byte&0xF0          0x40           \b, 11:5
+>>7      byte&0x0F          1              \b, 23.976 fps
+>>7      byte&0x0F          2              \b, 24 fps
+>>7      byte&0x0F          3              \b, 25 fps
+>>7      byte&0x0F          4              \b, 29.97 fps
+>>7      byte&0x0F          5              \b, 30 fps
+>>7      byte&0x0F          6              \b, 50 fps
+>>7      byte&0x0F          7              \b, 59.94 fps
+>>7      byte&0x0F          8              \b, 60 fps
+>>11     byte               &0x04          \b, Constrained
+
+# MPEG ADTS Audio (*.mpx/mxa/aac)
+# from dreesen@math.fu-berlin.de
+# modified to fully support MPEG ADTS
+
+# MP3, M1A
+0       beshort&0xFFFE  0xFFFA         MPEG ADTS, layer III, v1
+# rates
+>2      byte&0xF0       0x10           \b,  32 kBits
+>2      byte&0xF0       0x20           \b,  40 kBits
+>2      byte&0xF0       0x30           \b,  48 kBits
+>2      byte&0xF0       0x40           \b,  56 kBits
+>2      byte&0xF0       0x50           \b,  64 kBits
+>2      byte&0xF0       0x60           \b,  80 kBits
+>2      byte&0xF0       0x70           \b,  96 kBits
+>2      byte&0xF0       0x80           \b, 112 kBits
+>2      byte&0xF0       0x90           \b, 128 kBits
+>2      byte&0xF0       0xA0           \b, 160 kBits
+>2      byte&0xF0       0xB0           \b, 192 kBits
+>2      byte&0xF0       0xC0           \b, 224 kBits
+>2      byte&0xF0       0xD0           \b, 256 kBits
+>2      byte&0xF0       0xE0           \b, 320 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 44.1 kHz
+>2      byte&0x0C       0x04           \b, 48 kHz
+>2      byte&0x0C       0x08           \b, 32 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MP2, M1A
+0       beshort&0xFFFE  0xFFFC         MPEG ADTS, layer II, v1
+# rates
+>2      byte&0xF0       0x10           \b,  32 kBits
+>2      byte&0xF0       0x20           \b,  48 kBits
+>2      byte&0xF0       0x30           \b,  56 kBits
+>2      byte&0xF0       0x40           \b,  64 kBits
+>2      byte&0xF0       0x50           \b,  80 kBits
+>2      byte&0xF0       0x60           \b,  96 kBits
+>2      byte&0xF0       0x70           \b, 112 kBits
+>2      byte&0xF0       0x80           \b, 128 kBits
+>2      byte&0xF0       0x90           \b, 160 kBits
+>2      byte&0xF0       0xA0           \b, 192 kBits
+>2      byte&0xF0       0xB0           \b, 224 kBits
+>2      byte&0xF0       0xC0           \b, 256 kBits
+>2      byte&0xF0       0xD0           \b, 320 kBits
+>2      byte&0xF0       0xE0           \b, 384 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 44.1 kHz
+>2      byte&0x0C       0x04           \b, 48 kHz
+>2      byte&0x0C       0x08           \b, 32 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MPA, M1A
+0       beshort&0xFFFE  0xFFFE         MPEG ADTS, layer I, v1
+# rate
+>2      byte&0xF0       0x10           \b,  32 kBits
+>2      byte&0xF0       0x20           \b,  64 kBits
+>2      byte&0xF0       0x30           \b,  96 kBits
+>2      byte&0xF0       0x40           \b, 128 kBits
+>2      byte&0xF0       0x50           \b, 160 kBits
+>2      byte&0xF0       0x60           \b, 192 kBits
+>2      byte&0xF0       0x70           \b, 224 kBits
+>2      byte&0xF0       0x80           \b, 256 kBits
+>2      byte&0xF0       0x90           \b, 288 kBits
+>2      byte&0xF0       0xA0           \b, 320 kBits
+>2      byte&0xF0       0xB0           \b, 352 kBits
+>2      byte&0xF0       0xC0           \b, 384 kBits
+>2      byte&0xF0       0xD0           \b, 416 kBits
+>2      byte&0xF0       0xE0           \b, 448 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 44.1 kHz
+>2      byte&0x0C       0x04           \b, 48 kHz
+>2      byte&0x0C       0x08           \b, 32 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MP3, M2A
+0       beshort&0xFFFE  0xFFF2         MPEG ADTS, layer III, v2
+# rate
+>2      byte&0xF0       0x10           \b,   8 kBits
+>2      byte&0xF0       0x20           \b,  16 kBits
+>2      byte&0xF0       0x30           \b,  24 kBits
+>2      byte&0xF0       0x40           \b,  32 kBits
+>2      byte&0xF0       0x50           \b,  40 kBits
+>2      byte&0xF0       0x60           \b,  48 kBits
+>2      byte&0xF0       0x70           \b,  56 kBits
+>2      byte&0xF0       0x80           \b,  64 kBits
+>2      byte&0xF0       0x90           \b,  80 kBits
+>2      byte&0xF0       0xA0           \b,  96 kBits
+>2      byte&0xF0       0xB0           \b, 112 kBits
+>2      byte&0xF0       0xC0           \b, 128 kBits
+>2      byte&0xF0       0xD0           \b, 144 kBits
+>2      byte&0xF0       0xE0           \b, 160 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 22.05 kHz
+>2      byte&0x0C       0x04           \b, 24 kHz
+>2      byte&0x0C       0x08           \b, 16 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MP2, M2A
+0       beshort&0xFFFE  0xFFF4         MPEG ADTS, layer II, v2
+# rate 
+>2      byte&0xF0       0x10           \b,   8 kBits
+>2      byte&0xF0       0x20           \b,  16 kBits 
+>2      byte&0xF0       0x30           \b,  24 kBits
+>2      byte&0xF0       0x40           \b,  32 kBits
+>2      byte&0xF0       0x50           \b,  40 kBits
+>2      byte&0xF0       0x60           \b,  48 kBits
+>2      byte&0xF0       0x70           \b,  56 kBits
+>2      byte&0xF0       0x80           \b,  64 kBits
+>2      byte&0xF0       0x90           \b,  80 kBits
+>2      byte&0xF0       0xA0           \b,  96 kBits
+>2      byte&0xF0       0xB0           \b, 112 kBits
+>2      byte&0xF0       0xC0           \b, 128 kBits
+>2      byte&0xF0       0xD0           \b, 144 kBits
+>2      byte&0xF0       0xE0           \b, 160 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 22.05 kHz
+>2      byte&0x0C       0x04           \b, 24 kHz
+>2      byte&0x0C       0x08           \b, 16 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MPA, M2A
+0       beshort&0xFFFE  0xFFF6         MPEG ADTS, layer I, v2
+# rate
+>2      byte&0xF0       0x10           \b,  32 kBits
+>2      byte&0xF0       0x20           \b,  48 kBits
+>2      byte&0xF0       0x30           \b,  56 kBits
+>2      byte&0xF0       0x40           \b,  64 kBits
+>2      byte&0xF0       0x50           \b,  80 kBits
+>2      byte&0xF0       0x60           \b,  96 kBits
+>2      byte&0xF0       0x70           \b, 112 kBits
+>2      byte&0xF0       0x80           \b, 128 kBits
+>2      byte&0xF0       0x90           \b, 144 kBits
+>2      byte&0xF0       0xA0           \b, 160 kBits
+>2      byte&0xF0       0xB0           \b, 176 kBits
+>2      byte&0xF0       0xC0           \b, 192 kBits
+>2      byte&0xF0       0xD0           \b, 224 kBits
+>2      byte&0xF0       0xE0           \b, 256 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 22.05 kHz
+>2      byte&0x0C       0x04           \b, 24 kHz
+>2      byte&0x0C       0x08           \b, 16 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# MP3, M25A
+0       beshort&0xFFFE  0xFFE2         MPEG ADTS, layer III,  v2.5
+# rate  
+>2      byte&0xF0       0x10           \b,   8 kBits
+>2      byte&0xF0       0x20           \b,  16 kBits
+>2      byte&0xF0       0x30           \b,  24 kBits
+>2      byte&0xF0       0x40           \b,  32 kBits
+>2      byte&0xF0       0x50           \b,  40 kBits
+>2      byte&0xF0       0x60           \b,  48 kBits
+>2      byte&0xF0       0x70           \b,  56 kBits
+>2      byte&0xF0       0x80           \b,  64 kBits
+>2      byte&0xF0       0x90           \b,  80 kBits
+>2      byte&0xF0       0xA0           \b,  96 kBits
+>2      byte&0xF0       0xB0           \b, 112 kBits
+>2      byte&0xF0       0xC0           \b, 128 kBits
+>2      byte&0xF0       0xD0           \b, 144 kBits
+>2      byte&0xF0       0xE0           \b, 160 kBits
+# timing
+>2      byte&0x0C       0x00           \b, 11.025 kHz
+>2      byte&0x0C       0x04           \b, 12 kHz
+>2      byte&0x0C       0x08           \b, 8 kHz
+# channels/options
+>3      byte&0xC0       0x00           \b, Stereo
+>3      byte&0xC0       0x40           \b, JntStereo
+>3      byte&0xC0       0x80           \b, 2x Monaural
+>3      byte&0xC0       0xC0           \b, Monaural
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Packet Pad
+#>2     byte            &0x01           \b, Custom Flag
+#>3     byte            &0x08           \b, Copyrighted
+#>3     byte            &0x04           \b, Original Source
+#>3     byte&0x03       1               \b, NR: 50/15 ms
+#>3     byte&0x03       3               \b, NR: CCIT J.17
+
+# AAC (aka MPEG-2 NBC audio) and MPEG-4 audio
+
+# Stored AAC streams (instead of the MP4 format)
+0       string          ADIF           MPEG ADIF, AAC
+>4      byte            &0x80
+>>13    byte            &0x10          \b, VBR
+>>13    byte            ^0x10          \b, CBR
+>>16    byte&0x1E       0x02           \b, single stream
+>>16    byte&0x1E       0x04           \b, 2 streams
+>>16    byte&0x1E       0x06           \b, 3 streams
+>>16    byte            &0x08          \b, 4 or more streams
+>>16    byte            &0x10          \b, 8 or more streams
+>>4    byte            &0x80          \b, Copyrighted
+>>13   byte            &0x40          \b, Original Source
+>>13   byte            &0x20          \b, Home Flag
+>4      byte            ^0x80
+>>4     byte            &0x10          \b, VBR
+>>4     byte            ^0x10          \b, CBR
+>>7     byte&0x1E       0x02           \b, single stream
+>>7     byte&0x1E       0x04           \b, 2 streams
+>>7     byte&0x1E       0x06           \b, 3 streams
+>>7     byte            &0x08          \b, 4 or more streams
+>>7     byte            &0x10          \b, 8 or more streams
+>>4    byte            &0x40          \b, Original Stream(s)
+>>4    byte            &0x20          \b, Home Source
+
+# Live or stored single AAC stream (used with MPEG-2 systems)
+0       beshort&0xFFF6  0xFFF0         MPEG ADTS, AAC
+>1      byte            ^0x08          \b, v2
+>1      byte            &0x08          \b, v4
+# profile
+>>2     byte            &0xC0          \b LTP
+>2      byte&0xc0       0x00           \b, Main
+>2      byte&0xc0       0x40           \b, LC
+>2      byte&0xc0       0x80           \b, SSR
+# timing
+>2      byte&0x3c       0x00           \b, 96 kHz
+>2      byte&0x3c       0x04           \b, 88.2 kHz
+>2      byte&0x3c       0x08           \b, 64 kHz
+>2      byte&0x3c       0x0c           \b, 48 kHz
+>2      byte&0x3c       0x10           \b, 44.1 kHz
+>2      byte&0x3c       0x14           \b, 32 kHz
+>2      byte&0x3c       0x18           \b, 24 kHz
+>2      byte&0x3c       0x1c           \b, 22.05 kHz
+>2      byte&0x3c       0x20           \b, 16 kHz
+>2      byte&0x3c       0x24           \b, 12 kHz
+>2      byte&0x3c       0x28           \b, 11.025 kHz
+>2      byte&0x3c       0x2c           \b, 8 kHz
+# channels/options
+>2      beshort&0x01c0  0x0040         \b, monaural
+>2      beshort&0x01c0  0x0080         \b, stereo
+>2      beshort&0x01c0  0x00c0         \b, stereo + center
+>2      beshort&0x01c0  0x0100         \b, stereo+center+LFE
+>2      beshort&0x01c0  0x0140         \b, surround
+>2      beshort&0x01c0  0x0180         \b, surround + LFE
+>2      beshort         &0x01C0        \b, surround + side
+#>1     byte            ^0x01           \b, Data Verify
+#>2     byte            &0x02           \b, Custom Flag
+#>3     byte            &0x20           \b, Original Stream
+#>3     byte            &0x10           \b, Home Source
+#>3     byte            &0x08           \b, Copyrighted
+
+# Live MPEG-4 audio streams (instead of RTP FlexMux)
+0       beshort&0xFFE0  0x56E0         MPEG-4 LOAS
+#>1     beshort&0x1FFF  x              \b, %u byte packet
+>3      byte&0xE0       0x40
+>>4     byte&0x3C       0x04           \b, single stream
+>>4     byte&0x3C       0x08           \b, 2 streams
+>>4     byte&0x3C       0x0C           \b, 3 streams
+>>4     byte            &0x08          \b, 4 or more streams
+>>4     byte            &0x20          \b, 8 or more streams
+>3      byte&0xC0       0
+>>4     byte&0x78       0x08           \b, single stream
+>>4     byte&0x78       0x10           \b, 2 streams
+>>4     byte&0x78       0x18           \b, 3 streams
+>>4     byte            &0x20          \b, 4 or more streams
+>>4     byte            &0x40          \b, 8 or more streams
+0       beshort         0x4DE1         MPEG-4 LO-EP audio stream
+
+# FLI animation format
+4	leshort		0xAF11			FLI file
+>6	leshort		x			- %d frames,
+>8	leshort		x			width=%d pixels,
+>10	leshort		x			height=%d pixels,
+>12	leshort		x			depth=%d,
+>16	leshort		x			ticks/frame=%d
+# FLC animation format
+4	leshort		0xAF12			FLC file
+>6	leshort		x			- %d frames
+>8	leshort		x			width=%d pixels,
+>10	leshort		x			height=%d pixels,
+>12	leshort		x			depth=%d,
+>16	leshort		x			ticks/frame=%d
+
+# DL animation format
+# XXX - collision with most `mips' magic
+#
+# I couldn't find a real magic number for these, however, this
+# -appears- to work.  Note that it might catch other files, too, so be
+# careful!
+#
+# Note that title and author appear in the two 20-byte chunks
+# at decimal offsets 2 and 22, respectively, but they are XOR'ed with
+# 255 (hex FF)!  The DL format is really bad.
+#
+#0	byte	1	DL version 1, medium format (160x100, 4 images/screen)
+#>42	byte	x	- %d screens,
+#>43	byte	x	%d commands
+#0	byte	2	DL version 2
+#>1	byte	1	- large format (320x200,1 image/screen),
+#>1	byte	2	- medium format (160x100,4 images/screen),
+#>1	byte	>2	- unknown format,
+#>42	byte	x	%d screens,
+#>43	byte	x	%d commands
+# Based on empirical evidence, DL version 3 have several nulls following the
+# \003.  Most of them start with non-null values at hex offset 0x34 or so.
+#0	string	\3\0\0\0\0\0\0\0\0\0\0\0	DL version 3
+
+# SGI formats
+0	string		MOVI		Silicon Graphics movie file
+
+# Apple Quicktime and ISO types
+4       string          moov            Apple QuickTime
+>12     string          mvhd            \b movie (fast start)
+>12     string          mdra            \b URL
+>12     string          cmov            \b movie (fast start, compressed header)
+>12     string          rmra            \b multiple URLs
+4       string          mdat            Apple QuickTime movie (unoptimized)
+4       string          wide            Apple QuickTime movie (unoptimized)
+4       string          skip            Apple QuickTime movie (modified)
+4       string          free            Apple QuickTime movie (modified)
+4       string          idsc            Apple QuickTime image (fast start)
+4       string          idat            Apple QuickTime image (unoptimized)
+4       string          pckg            Apple QuickTime compressed archive
+4       string/B        jP              JPEG 2000 image
+4       string          ftyp            ISO Media
+>8      string          isom            \b, MPEG v4 system
+>8      string          mp41            \b, MPEG v4 system, version 1
+>8      string          mp42            \b, MPEG v4 system, version 2
+>8      string/B        jp2             \b, JPEG 2000 image
+>8      string          3gp             \b, MPEG v4 system, 3GPP (H.263/AMR)
+>8      string          mmp4            \b, MPEG v4 system, Mobile
+>8      string/B        M4A             \b, MPEG v4 system, iTunes AAC-LC
+>8      string/B        M4P             \b, MPEG v4 system, ISMA encrypted AAC-LC
+>8      string/B        M4B             \b, MPEG v4 system, iTunes AAC-LC/AMR
+>8      string/B        qt              \b, Apple QuickTime movie
+
+# iso 13818 transport stream
+#
+# from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
+# (the following is a little bit restrictive and works fine for a stream
+#  that starts with PAT properly. it won't work for stream data, that is
+#  cut from an input device data right in the middle, but this shouldn't
+#  disturb)
+# syncbyte      8 bit	0x47
+# error_ind     1 bit	-
+# payload_start 1 bit	1
+# priority      1 bit	-
+# PID          13 bit	0x0000
+# scrambling    2 bit	-
+# adaptfld_ctrl 2 bit	1 or 3
+# conti_count   4 bit	0
+0	belong&0xFF5FFF1F	0x47400010	MPEG transport stream data
+>188	byte			!0x47		CORRUPTED
+
+# DIF digital video file format <mpruett@sgi.com>
+0	belong&0xffffff00	0x1f070000      DIF
+>4	byte			&0x01		(DVCPRO) movie file
+>4	byte			^0x01		(DV) movie file
+>3	byte			&0x80		(PAL)
+>3	byte			^0x80		(NTSC)
+
+# Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
+0	belong			0x3026b275	Microsoft ASF
+
+# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
+0	string			\x8aMNG		MNG video data,
+>4	belong			!0x0d0a1a0a	CORRUPTED,
+>4	belong			0x0d0a1a0a
+>>16    belong	x				%ld x
+>>20    belong	x				%ld
+
+# JNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
+0	string			\x8bJNG		JNG video data,
+>4	belong			!0x0d0a1a0a	CORRUPTED,
+>4	belong			0x0d0a1a0a
+>>16    belong	x				%ld x
+>>20    belong	x				%ld
+
+# Vivo video (Wolfram Kleff)
+3	string		\x0D\x0AVersion:Vivo	Vivo video data
+
+# VRML (Virtual Reality Modelling Language)
+0       string/b        #VRML\ V1.0\ ascii	VRML 1 file
+0	string/b	#VRML\ V2.0\ utf8	ISO/IEC 14772 VRML 97 file
+
+#---------------------------------------------------------------------------
+# HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
+# From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
+#
+0	string		HVQM4		%s
+>6	string		>\0		v%s
+>0	byte		x		GameCube movie,
+>0x34	ubeshort	x		%d x
+>0x36	ubeshort	x		%d,
+>0x26	ubeshort	x		%dµs,
+>0x42	ubeshort	0		no audio
+>0x42	ubeshort	>0		%dHz audio

Magdir/apl → magic/Magdir/apl


+ 28 - 0
Magdir/apple

@@ -28,6 +28,13 @@
 >12	belong	&0x02000000	UseFasterCompression,
 >16	belong	x		version %d
 
+0	string	package4	Newton package,
+>8	byte	8		NOS 1.x,
+>8	byte	9		NOS 2.x,
+>12	belong	&0x80000000	AutoRemove,
+>12	belong	&0x40000000	CopyProtect,
+>12	belong	&0x10000000	NoCompression,
+
 # The following entries for the Apple II are for files that have
 # been transferred as raw binary data from an Apple, without having
 # been encapsulated by any of the above archivers.
@@ -120,3 +127,24 @@
 # Beagle Bros. Apple Mechanic fonts
 
 0	belong&0xFF00FFFF	0x6400D000	Apple Mechanic font
+
+# Apple Universal Disk Image Format (UDIF) - dmg files.
+# From Johan Gade.
+# These entries are disabled for now until we fix the following issues.
+#
+# Note there might be some problems with the "VAX COFF executable" 
+# entry. Note this entry should be placed before the mac filesystem section, 
+# particularly the "Apple Partition data" entry.
+#
+# The intended meaning of these tests is, that the file is only of the 
+# specified type if both of the lines are correct - i.e. if the first
+# line matches and the second doesn't then it is not of that type.
+#
+#0	long	0x7801730d
+#>4	long	0x62626060	UDIF read-only zlib-compressed image (UDZO)
+#
+# Note that this entry is recognized correctly by the "Apple Partition 
+# data" entry - however since this entry is more specific - this
+# information seems to be more useful.
+#0	long	0x45520200
+#>0x410	string	disk\ image	UDIF read/write image (UDRW)

Magdir/applix → magic/Magdir/applix


+ 80 - 10
Magdir/archive

@@ -32,8 +32,10 @@
 0	string		!<arch>\ndebian
 >8	string		debian-split	part of multipart Debian package
 >8	string		debian-binary	Debian binary package
->68	string		>\n		(format %s)
->136	ledate		x		created: %s
+>68	string		>\0		(format %s)
+>81	string		bz2		\b, uses bzip2 compression
+>84	string		gz		\b, uses gzip compression
+#>136	ledate		x		created: %s
 
 # other archives
 0	long		0177555		very old archive
@@ -126,7 +128,9 @@
 #  version (not tested)]
 #0	byte		0x1a		RISC OS archive
 #>1	string		archive		(ArcFS format)
-0	string		\032archive	RISC OS archive (ArcFS format)
+#0	string		\032archive	RISC OS archive (ArcFS format)
+0       string          \032            RISC OS archive (spark format)
+0       string          Archive\000     RISC OS archive (ArcFS format)
 
 # ARJ archiver (jason@jarthur.Claremont.EDU)
 0	leshort		0xea60		ARJ archive data
@@ -187,7 +191,12 @@
 >20	byte		x		- header level %d
 
 # RAR archiver (Greg Roelofs, newt@uchicago.edu)
-0	string		Rar!		RAR archive data
+0	string		Rar!		RAR archive data,
+>44	byte		x		v%0x,
+>35	byte		0		os: MS-DOS
+>35	byte		1		os: OS/2
+>35	byte		2		os: Win32
+>35	byte		3		os: Unix
 
 # SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
 0	string		SQSH		squished archive data (Acorn RISCOS)
@@ -231,17 +240,19 @@
 2       string          -pms-           PMarc SFX archive (CP/M, DOS)
 5       string          -pc1-           PopCom compressed executable (CP/M)
 
-# From rafael@icp.inpg.fr (Rafael Laboissiere) 
+# From Rafael Laboissiere <rafael@laboissiere.net>
 # The Project Revision Control System (see
-# http://www.XCF.Berkeley.EDU/~jmacd/prcs.html) generates a packaged project
-# file which is recognized by the following entry:
+# http://prcs.sourceforge.net) generates a packaged project
+# file which is recognized by the following entry: 
 0	leshort		0xeb81	PRCS packaged project
 
 # Microsoft cabinets 
 # by David Necas (Yeti) <yeti@physics.muni.cz>
-0	string	MSCF\0\0\0\0	Microsoft cabinet file data,
->25	byte	x		v%d
->24	byte	x		\b.%d
+#0	string	MSCF\0\0\0\0	Microsoft cabinet file data,
+#>25	byte	x		v%d
+#>24	byte	x		\b.%d
+# MPi: All CABs have version 1.3, so this is pointless.
+# Better magic in debian-additions.
 
 # GTKtalog catalogs 
 # by David Necas (Yeti) <yeti@physics.muni.cz>
@@ -250,3 +261,62 @@
 >>14	beshort	0x677a		(gzipped)
 >>14	beshort	!0x677a		(not gzipped)
 >13	string	>3		version %s
+
+############################################################################
+# Parity archive reconstruction file, the 'par' file format now used on Usenet.
+0       string          PAR\0	PARity archive data
+>48	leshort		=0	- Index file
+>48	leshort		>0	- file number %d
+
+# Felix von Leitner <felix-file@fefe.de>
+0	string	d8:announce	BitTorrent file
+
+# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
+0       beshort 0x0e0f          Atari MSA archive data
+>2      beshort x       	\b, %d sectors per track
+>4      beshort 0       	\b, 1 sided
+>4      beshort 1       	\b, 2 sided
+>6      beshort x       	\b, starting track: %d
+>8      beshort x       	\b, ending track: %d
+
+# Alternate ZIP string (amc@arwen.cs.berkeley.edu)
+0	string	PK00PK\003\004	Zip archive data
+
+# ACE archive (from http://www.wotsit.org/download.asp?f=ace)
+# by Stefan `Sec` Zehl <sec@42.org>
+7	string		**ACE**		ACE compressed archive
+>15	byte	>0		version %d
+>16	byte	=0x00		\b, from MS-DOS
+>16	byte	=0x01		\b, from OS/2
+>16	byte	=0x02		\b, from Win/32
+>16	byte	=0x03		\b, from Unix
+>16	byte	=0x04		\b, from MacOS
+>16	byte	=0x05		\b, from WinNT
+>16	byte	=0x06		\b, from Primos
+>16	byte	=0x07		\b, from AppleGS
+>16	byte	=0x08		\b, from Atari
+>16	byte	=0x09		\b, from Vax/VMS
+>16	byte	=0x0A		\b, from Amiga
+>16	byte	=0x0B		\b, from Next
+>14	byte	x		\b, version %d to extract
+>5	leshort &0x0080		\b, multiple volumes,
+>>17	byte	x		\b (part %d),
+>5	leshort &0x0002		\b, contains comment
+>5	leshort	&0x0200		\b, sfx
+>5	leshort	&0x0400		\b, small dictionary
+>5	leshort	&0x0800		\b, multi-volume
+>5	leshort	&0x1000		\b, contains AV-String
+>>30	string\x16*UNREGISTERED\x20VERSION*	(unregistered)
+>5	leshort &0x2000		\b, with recovery record
+>5	leshort &0x4000		\b, locked
+>5	leshort &0x8000		\b, solid
+# Date in MS-DOS format (whatever that is)
+#>18	lelong	x		Created on
+
+# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
+# <doj@cubic.org>
+0x1A	string	sfArk		sfArk compressed Soundfont
+>0x15	string	2
+>>0x1	string	>\0		Version %s
+>>0x2A	string	>\0		: %s
+

Magdir/asterix → magic/Magdir/asterix


Magdir/att3b → magic/Magdir/att3b


+ 411 - 0
magic/Magdir/audio

@@ -0,0 +1,411 @@
+
+#------------------------------------------------------------------------------
+# 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 mu-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		8		Fragmented sample data,
+>12	belong		10		DSP program,
+>12	belong		11		8-bit fixed point,
+>12	belong		12		16-bit fixed point,
+>12	belong		13		24-bit fixed point,
+>12	belong		14		32-bit fixed point,
+>12	belong		18		16-bit linear with emphasis,
+>12	belong		19		16-bit linear compressed,
+>12	belong		20		16-bit linear with emphasis and compression,
+>12	belong		21		Music kit DSP commands,
+>12	belong		23		8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12	belong		24		compressed (8-bit CCITT G.722 ADPCM)
+>12	belong		25		compressed (3-bit CCITT G.723.3 ADPCM),
+>12	belong		26		compressed (5-bit CCITT G.723.5 ADPCM),
+>12	belong		27		8-bit A-law (CCITT G.711),
+>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 mu-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	belong		8		Fragmented sample data,
+>12	belong		10		DSP program,
+>12	belong		11		8-bit fixed point,
+>12	belong		12		16-bit fixed point,
+>12	belong		13		24-bit fixed point,
+>12	belong		14		32-bit fixed point,
+>12	belong		18		16-bit linear with emphasis,
+>12	belong		19		16-bit linear compressed,
+>12	belong		20		16-bit linear with emphasis and compression,
+>12	belong		21		Music kit DSP commands,
+>12	lelong		23		8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12	belong		24		compressed (8-bit CCITT G.722 ADPCM)
+>12	belong		25		compressed (3-bit CCITT G.723.3 ADPCM),
+>12	belong		26		compressed (5-bit CCITT G.723.5 ADPCM),
+>12	belong		27		8-bit A-law (CCITT G.711),
+>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
+>8 	beshort	x			(format %d)
+>10	beshort	x			using %d track
+>10	beshort		>1		\bs
+>12	beshort&0x7fff	x		at 1/%d
+>12	beshort&0x8000	>0		SMPTE
+
+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
+0	string		.RMF		RealMedia file
+
+# MTM/669/FAR/S3M/ULT/XM format checking [Aaron Eppert, aeppert@dialin.ind.net]
+# Oct 31, 1995
+# fixed by <doj@cubic.org> 2003-06-24
+# Too short...
+#0	string		MTM		MultiTracker Module sound file
+#0	string		if		Composer 669 Module sound data
+#0	string		JN		Composer 669 Module sound data (extended format)
+0	string		MAS_U		ULT(imate) Module sound data
+
+#0	string		FAR		Module sound data
+#>4	string		>\15		Title: "%s"
+
+0x2c	string		SCRM		ScreamTracker III Module sound data
+>0	string		>\0		Title: "%s"
+
+# 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)
+# <doj@cubic.org> added title printing on 2003-06-24
+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
+>17	string	>\0		Title: "%s"
+
+21	string/c	!SCREAM!	Screamtracker 2 module sound data
+21	string	BMOD2STM	Screamtracker 2 module sound data
+1080	string	M.K.		4-channel Protracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	M!K!		4-channel Protracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	FLT4		4-channel Startracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	FLT8		8-channel Startracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	4CHN		4-channel Fasttracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	6CHN		6-channel Fasttracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	8CHN		8-channel Fasttracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	CD81		8-channel Octalyser module sound data
+>0	string	>\0		Title: "%s"
+1080	string	OKTA		8-channel Oktalyzer module sound data
+>0	string	>\0		Title: "%s"
+# Not good enough.
+#1082	string	CH
+#>1080	string	>/0		%.2s-channel Fasttracker "oktalyzer" module sound data
+1080	string	16CN		16-channel Taketracker module sound data
+>0	string	>\0		Title: "%s"
+1080	string	32CN		32-channel Taketracker module sound data
+>0	string	>\0		Title: "%s"
+
+# TOC sound files -Trevor Johnson <trevor@jpj.net>
+#
+0       string          TOC             TOC sound file
+
+# sidfiles <pooka@iki.fi>
+# added name,author,(c) and new RSID type by <doj@cubic.org> 2003-06-24
+0	string		SIDPLAY\ INFOFILE	Sidplay info file
+
+0	string		PSID			PlaySID v2.2+ (AMIGA) sidtune
+>4	beshort		>0			w/ header v%d,
+>14	beshort		=1			single song,
+>14	beshort		>1			%d songs,
+>16	beshort		>0			default song: %d
+>0x16	string		>\0			name: "%s"
+>0x36	string		>\0			author: "%s"
+>0x56	string		>\0			copyright: "%s"
+
+0	string		RSID			RSID sidtune PlaySID compatible
+>4	beshort		>0			w/ header v%d,
+>14	beshort		=1			single song,
+>14	beshort		>1			%d songs,
+>16	beshort		>0			default song: %d
+>0x16	string		>\0			name: "%s"
+>0x36	string		>\0			author: "%s"
+>0x56	string		>\0			copyright: "%s"
+
+# IRCAM <mpruett@sgi.com>
+# VAX and MIPS files are little-endian; Sun and NeXT are big-endian
+0	belong		0x64a30100		IRCAM file (VAX)
+0	belong		0x64a30200		IRCAM file (Sun)
+0	belong		0x64a30300		IRCAM file (MIPS little-endian)
+0	belong		0x64a30400		IRCAM file (NeXT)
+
+# NIST SPHERE <mpruett@sgi.com>
+0	string		NIST_1A\n\ \ \ 1024\n	NIST SPHERE file
+
+# Sample Vision <mpruett@sgi.com>
+0	string		SOUND\ SAMPLE\ DATA\ 	Sample Vision file
+
+# Audio Visual Research <tonigonenstein@users.sourceforge.net>
+0	string		2BIT			Audio Visual Research file,
+>12	beshort		=0			mono,
+>12	beshort		=-1			stereo,
+>14	beshort		x			%d bits
+>16	beshort		=0			unsigned,
+>16	beshort		=-1			signed,
+>22	belong&0x00ffffff	x		%d Hz,
+>18	beshort		=0			no loop,
+>18	beshort		=-1			loop,
+>21	ubyte		<=127			note %d,
+>22	byte		=0			replay 5.485 KHz
+>22	byte		=1			replay 8.084 KHz
+>22	byte		=2			replay 10.971 Khz
+>22	byte		=3			replay 16.168 Khz
+>22	byte		=4			replay 21.942 KHz
+>22	byte		=5			replay 32.336 KHz
+>22	byte		=6			replay 43.885 KHz
+>22	byte		=7			replay 47.261 KHz
+
+# SGI SoundTrack <mpruett@sgi.com>
+0	string		_SGI_SoundTrack		SGI SoundTrack project file
+# ID3 version 2 tags <waschk@informatik.uni-rostock.de>
+0	string		ID3	MP3 file with ID3 version 2.
+>3	ubyte	<0xff	\b%d.
+>4	ubyte	<0xff	\b%d tag
+
+# NSF (NES sound file) magic
+0	string		NESM\x1a	NES Sound File
+>14	string		>\0		("%s" by
+>46	string		>\0		%s, copyright
+>78	string		>\0		%s),
+>5	byte		x		version %d,
+>6	byte		x		%d tracks,
+>122	byte&0x2	=1		dual PAL/NTSC
+>122	byte&0x1	=1		PAL
+>122	byte&0x1	=0		NTSC
+
+# Impuse tracker module (audio/x-it)
+0	string		IMPM		Impulse Tracker module sound data -
+>4	string		>\0		"%s"
+>40	leshort		!0		compatible w/ITv%x
+>42	leshort		!0		created w/ITv%x
+
+# Imago Orpheus module (audio/x-imf)
+60	string		IM10		Imago Orpheus module sound data -
+>0	string		>\0		"%s"
+
+# From <collver1@attbi.com>
+# These are the /etc/magic entries to decode modules, instruments, and
+# samples in Impulse Tracker's native format.
+
+0	string		IMPS		Impulse Tracker Sample
+>18	byte		&2		16 bit
+>18	byte		^2		8 bit
+>18	byte		&4		stereo
+>18	byte		^4		mono
+0	string		IMPI		Impulse Tracker Instrument
+>28	leshort		!0		ITv%x
+>30	byte		!0		%d samples
+
+# Yamaha TX Wave:  file(1) magic for Yamaha TX Wave audio files
+# From <collver1@attbi.com>
+0	string		LM8953		Yamaha TX Wave
+>22	byte		0x49		looped
+>22	byte		0xC9		non-looped
+>23	byte		1		33kHz
+>23	byte		2		50kHz
+>23	byte		3		16kHz
+
+# scream tracker:  file(1) magic for Scream Tracker sample files
+#
+# From <collver1@attbi.com>
+76	string		SCRS		Scream Tracker Sample
+>0	byte		1		sample
+>0	byte		2		adlib melody
+>0	byte		>2		adlib drum
+>31	byte		&2		stereo
+>31	byte		^2		mono
+>31	byte		&4		16bit little endian
+>31	byte		^4		8bit
+>30	byte		0		unpacked
+>30	byte		1		packed
+
+# audio
+# From: Cory Dikkers <cdikkers@swbell.net>
+0	string		MMD0		MED music file, version 0
+0	string		MMD1		OctaMED Pro music file, version 1
+0	string		MMD3		OctaMED Soundstudio music file, version 3
+0	string		OctaMEDCmpr	OctaMED Soundstudio compressed file
+0	string		MED		MED_Song
+0	string		SymM		Symphonie SymMOD music file
+#
+0	string		THX		AHX version
+>3	byte		=0		1 module data
+>3	byte		=1		2 module data
+#
+0	string		OKTASONG	Oktalyzer module data
+#
+0	string		DIGI\ Booster\ module\0	%s
+>20	byte		>0		%c
+>>21	byte		>0		\b%c
+>>>22	byte		>0		\b%c
+>>>>23	byte		>0		\b%c
+>610	string		>\0		\b, "%s"
+#
+0	string		DBM0	   	DIGI Booster Pro Module
+>4	byte		>0		V%X.
+>>5	byte		x		\b%02X
+>16	string		>\0		\b, "%s"
+#
+0	string		FTMN		FaceTheMusic module
+>16	string		>\0d		\b, "%s"
+
+# From: <doj@cubic.org> 2003-06-24
+0	string		AMShdr\32	Velvet Studio AMS Module v2.2
+0	string		Extreme		Extreme Tracker AMS Module v1.3
+0	string		DDMF		Xtracker DMF Module
+>4	byte		x		v%i
+>0xD	string		>\0		Title: "%s"
+>0x2B	string		>\0		Composer: "%s"
+0	string		DSM\32		Dynamic Studio Module DSM
+0	string		SONG		DigiTrekker DTM Module
+0	string		DMDL		DigiTrakker MDL Module
+0	string		PSM\32		Protracker Studio PSM Module
+44	string		PTMF		Poly Tracker PTM Module
+>0	string		>\32		Title: "%s"
+0	string		MT20		MadTracker 2.0 Module MT2
+0	string		RAD\40by\40REALiTY!! RAD Adlib Tracker Module RAD
+0	string		RTMM		RTM Module
+0x426	string		MaDoKaN96	XMS Adlib Module
+>0	string		>\0		Composer: "%s"
+0	string		AMF		AMF Module
+>4	string		>\0		Title: "%s"
+0	string		MODINFO1	Open Cubic Player Module Inforation MDZ
+0	string		Extended\40Instrument: Fast Tracker II Instrument
+
+# From: Takeshi Hamasaki <hma@syd.odn.ne.jp>
+# NOA Nancy Codec file
+0	string		\210NOA\015\012\032	NOA Nancy Codec Movie file
+# Yamaha SMAF format
+0	string		MMMD		Yamaha SMAF file
+# Sharp Jisaku Melody format for PDC
+0	string		\001Sharp\040JisakuMelody	SHARP Cell-Phone ringing Melody
+>20	string		Ver01.00	Ver. 1.00
+>>32	byte		x		, %d tracks
+
+# Free lossless audio codec <http://flac.sourceforge.net>
+# From: Przemyslaw Augustyniak <silvathraec@rpg.pl>
+0	string			fLaC		FLAC audio bitstream data
+>4	byte&0x7f		>0		\b, unknown version
+>4	byte&0x7f		0		\b
+# some common bits/sample values
+>>20	beshort&0x1f0		0x030		\b, 4 bit
+>>20	beshort&0x1f0		0x050		\b, 6 bit
+>>20	beshort&0x1f0		0x070		\b, 8 bit
+>>20	beshort&0x1f0		0x0b0		\b, 12 bit
+>>20	beshort&0x1f0		0x0f0		\b, 16 bit
+>>20	beshort&0x1f0		0x170		\b, 24 bit
+>>20	byte&0xe		0x0		\b, mono
+>>20	byte&0xe		0x2		\b, stereo
+>>20	byte&0xe		0x4		\b, 3 channels
+>>20	byte&0xe		0x6		\b, 4 channels
+>>20	byte&0xe		0x8		\b, 5 channels
+>>20	byte&0xe		0xa		\b, 6 channels
+>>20	byte&0xe		0xc		\b, 7 channels
+>>20	byte&0xe		0xe		\b, 8 channels
+# some common sample rates
+>>17	belong&0xfffff0		0x0ac440	\b, 44.1 kHz
+>>17	belong&0xfffff0		0x0bb800	\b, 48 kHz
+>>17	belong&0xfffff0		0x07d000	\b, 32 kHz
+>>17	belong&0xfffff0		0x056220	\b, 22.05 kHz
+>>17	belong&0xfffff0		0x05dc00	\b, 24 kHz
+>>17	belong&0xfffff0		0x03e800	\b, 16 kHz
+>>17	belong&0xfffff0		0x02b110	\b, 11.025 kHz
+>>17	belong&0xfffff0		0x02ee00	\b, 12 kHz
+>>17	belong&0xfffff0		0x01f400	\b, 8 kHz
+>>17	belong&0xfffff0		0x177000	\b, 96 kHz
+>>17	belong&0xfffff0		0x0fa000	\b, 64 kHz
+>>21	byte&0xf		>0		\b, >4G samples
+>>21	byte&0xf		0		\b
+>>>22	belong			>0		\b, %u samples
+>>>22	belong			0		\b, length unknown
+
+# (ISDN) VBOX voice message file (Wolfram Kleff)
+0       string          VBOX            VBOX voice message data
+
+# ReBorn Song Files (.rbs)
+# David J. Singer <doc@deadvirgins.org.uk>
+8       string          RB40             RBS Song file
+>29     string          ReBorn           created by ReBorn
+>37     string          Propellerhead    created by ReBirth
+
+# Synthesizer Generator and Kimwitu share their file format
+0	string		A#S#C#S#S#L#V#3	    Synthesizer Generator or Kimwitu data
+# Kimwitu++ uses a slightly different magic
+0	string		A#S#C#S#S#L#HUB	    Kimwitu++ data
+
+# From "Simon Hosie
+0       string  TFMX-SONG       TFMX module sound data
+
+# From danny.milo@gmx.net (Danny Milosavljevic)
+# monkeysaudio for magic.mime
+0	string	MAC\	X/Monkey audio,
+>4	leshort >0	version %d,
+>6	leshort >0	compression level %d,
+>8	leshort >0	flags %x,
+>10	leshort >0	channels %d,
+>12	lelong	>0	samplerate %d,
+>24	lelong	>0	frames %d
+

+ 12 - 0
magic/Magdir/bFLT

@@ -0,0 +1,12 @@
+#------------------------------------------------------------------------------
+# bFLT: file(1) magic for BFLT uclinux binary files
+#
+# From Philippe De Muyter <phdm@macqel.be>
+#
+0	string		bFLT		BFLT executable
+>4	belong		x		- version %ld
+>4	belong		4
+>>36	belong&0x1	0x1		ram
+>>36	belong&0x2	0x2		gotpic
+>>36	belong&0x4	0x4		gzip
+>>36	belong&0x8	0x8		gzdata

Magdir/blender → magic/Magdir/blender


Magdir/blit → magic/Magdir/blit


+ 9 - 0
magic/Magdir/bout

@@ -0,0 +1,9 @@
+#
+# i80960 b.out objects and archives
+#
+0	long		0x10d		i960 b.out relocatable object
+>16	long		>0		not stripped
+#
+# b.out archive (hp-rt on i960)
+0	string		!<bout>		b.out archive
+>8	string		__.SYMDEF	random library

Magdir/bsdi → magic/Magdir/bsdi


+ 24 - 0
magic/Magdir/c-lang

@@ -0,0 +1,24 @@
+
+#------------------------------------------------------------------------------
+# c-lang:  file(1) magic for C programs (or REXX)
+#
+
+# XPM icons (Greg Roelofs, newt@uchicago.edu)
+# if you uncomment "/*" for C/REXX below, also uncomment this entry
+#0	string		/*\ XPM\ */	X pixmap image data
+
+# this first will upset you if you're a PL/1 shop...
+# in which case rm it; ascmagic will catch real C programs
+#0	string		/*		C or REXX program text
+#0	string		//		C++ program text
+
+# From: Mikhail Teterin <mi@aldan.algebra.com> 
+0	string		cscope		cscope reference data
+>7	string		x		version %.2s
+# We skip the path here, because it is often long (so file will
+# truncate it) and mostly redundant.
+# The inverted index functionality was added some time betwen
+# versions 11 and 15, so look for -q if version is above 14:
+>7	string		>14
+>>10	regex		.+\ -q\		with inverted index
+>10	regex		.+\ -c\		text (non-compressed)

+ 27 - 0
magic/Magdir/c64

@@ -0,0 +1,27 @@
+
+#------------------------------------------------------------------------------
+# c64:  file(1) magic for various commodore 64 related files
+#
+# From <doj@cubic.org>
+
+0x16500	belong		0x12014100	D64 Image
+0x16500	belong		0x12014180	D71 Image
+0x61800 belong		0x28034400	D81 Image
+0	string		C64\40CARTRIDGE	CCS C64 Emultar Cartridge Image
+0	belong		0x43154164	X64 Image
+
+0	string		GCR-1541	GCR Image
+>8	byte		x		version: $i
+>9	byte		x		tracks: %i
+
+9	string		PSUR		ARC archive (c64)
+2	string		-LH1-		LHA archive (c64)
+
+0	string		C64File		PC64 Emulator file
+>8	string		>\0		"%s"
+0	string		C64Image	PC64 Freezer Image
+
+0	beshort		0x38CD		C64 PCLink Image
+0	string		CBM\144\0\0	Power 64 C64 Emulator Snapshot
+
+0	belong		0xFF424CFF	WRAptor packer (c64)

+ 36 - 0
magic/Magdir/cad

@@ -0,0 +1,36 @@
+
+#------------------------------------------------------------------------------
+# autocad:  file(1) magic for cad files
+#
+
+# AutoCAD DWG versions R13/R14 (www.autodesk.com)
+# Written December 01, 2003 by Lester Hightower
+# Based on the DWG File Format Specifications at http://www.opendwg.org/
+0	string	       \101\103\061\060\061		   AutoCAD
+>5	string	       \062\000\000\000\000		   DWG ver. R13
+>5	string	       \064\000\000\000\000		   DWG ver. R14
+
+# Microstation DGN/CIT Files (www.bentley.com)
+# Written October 30, 2003 by Lester Hightower
+# DGN is the default file extension of Microstation/Intergraph CAD files.
+# CIT is the proprietary raster format (similar to TIFF) used to attach
+# raster underlays to Microstation DGN (vector) drawings.
+# 
+# http://www.wotsit.org/search.asp
+# http://filext.com/detaillist.php?extdetail=DGN
+# http://filext.com/detaillist.php?extdetail=CIT
+#
+# http://www.bentley.com/products/default.cfm?objectid=97F351F5-9C35-4E5E-89C2
+# 3F86C928&method=display&p_objectid=97F351F5-9C35-4E5E-89C280A93F86C928
+# http://www.bentley.com/products/default.cfm?objectid=A5C2FD43-3AC9-4C71-B682
+# 721C479F&method=display&p_objectid=A5C2FD43-3AC9-4C71-B682C7BE721C479F
+0	string	       \010\011\376			   Microstation
+>3	string	       \002
+>>30	string	       \372\104				   DGN File
+>>30	string	       \172\104				   DGN File
+>>30	string	       \026\105				   DGN File
+>4	string	       \030\000\000			   CIT File
+
+# AutoCad, from Nahuel Greco
+0	string AC1012	AutoCad (release 12)
+0	string AC1014	AutoCad (release 14)

+ 11 - 0
magic/Magdir/cddb

@@ -0,0 +1,11 @@
+
+#------------------------------------------------------------------------------
+# CDDB: file(1) magic for CDDB(tm) format CD text data files
+#
+# From <steve@gracenote.com>
+#
+# This is the /etc/magic entry to decode datafiles as used by
+# CDDB-enabled CD player applications.
+#
+
+0       string/b        #\040xmcd               CDDB(tm) format CD text data

Magdir/chi → magic/Magdir/chi


+ 9 - 0
magic/Magdir/chord

@@ -0,0 +1,9 @@
+
+#------------------------------------------------------------------------------
+# chord: file(1) magic for Chord music sheet typesetting utility input files
+#
+# From Philippe De Muyter <phdm@macqel.be>
+# File format is actually free, but many distributed files begin with `{title'
+#
+0	string		{title		Chord text file
+

Magdir/cisco → magic/Magdir/cisco


Magdir/citrus → magic/Magdir/citrus


+ 1 - 1
Magdir/claris

@@ -32,7 +32,7 @@
 #          a   t   r   i   s   t  sp   ^   S  cr  nl   d   i   v  sp   #
 
 # .mth Thesaurus
-# statrts with \0 but no magic header
+# starts with \0 but no magic header
 
 # .chy Hyphenation file
 # I am not sure: 000 210 034 000 000

Magdir/clipper → magic/Magdir/clipper


+ 10 - 19
Magdir/commands

@@ -13,6 +13,8 @@
 
 #
 # zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
+0	string/b	#!\ /bin/zsh		Paul Falstad's zsh script text executable
+0	string/b	#!\ /usr/bin/zsh	Paul Falstad's zsh script text executable
 0	string/b	#!\ /usr/local/bin/zsh	Paul Falstad's zsh script text executable
 0	string/b	#!\ /usr/local/bin/ash	Neil Brown's ash script text executable
 0	string/b	#!\ /usr/local/bin/ae	Neil Brown's ae script text executable
@@ -27,16 +29,6 @@
 0	string/b	#!\ /usr/bin/awk	awk script text executable
 0	string		BEGIN			awk script text
 
-# For Larry Wall's perl language.  The ``eval'' line recognizes an
-# outrageously clever hack for USG systems.
-#				Keith Waclena <keith@cerberus.uchicago.edu>
-0	string/b	#!\ /bin/perl			perl script text executable
-0	string		eval\ "exec\ /bin/perl		perl script text
-0	string/b	#!\ /usr/bin/perl		perl script text executable
-0	string		eval\ "exec\ /usr/bin/perl	perl script text
-0	string/b	#!\ /usr/local/bin/perl		perl script text
-0	string		eval\ "exec\ /usr/local/bin/perl	perl script text executable
-
 # AT&T Bell Labs' Plan 9 shell
 0	string/b	#!\ /bin/rc	Plan 9 rc shell script text executable
 
@@ -50,13 +42,12 @@
 0	string		#!\ /usr/bin/env	a
 >16	string		>\0			%s script text executable
 
+# PHP scripts
+# Ulf Harnhammar <ulfh@update.uu.se>
+0	string/c	=<?php			PHP script text
+0	string		=<?\n			PHP script text
+0	string		=<?\r			PHP script text
+0	string/b	#!\ /usr/local/bin/php	PHP script text executable
+0	string/b	#!\ /usr/bin/php	PHP script text executable
 
-# generic shell magic
-0	string		#!\ /			a
->3	string		>\0			%s script text executable
-0	string		#!\	/		a
->3	string		>\0			%s script text executable
-0	string		#!/			a
->2	string		>\0			%s script text executable
-0	string		#!\ 			script text executable
->3	string		>\0			for %s
+0	string		Zend\x00		PHP script Zend Optimizer data

+ 21 - 0
magic/Magdir/communications

@@ -0,0 +1,21 @@
+
+#----------------------------------------------------------------------------
+# communication
+
+# TTCN is the Tree and Tabular Combined Notation described in ISO 9646-3.
+# It is used for conformance testing of communication protocols.
+# Added by W. Borgert <debacle@debian.org>.
+0	string		$Suite			TTCN Abstract Test Suite
+>&1	string		$SuiteId
+>>&1	string		>\n			%s
+>&2	string		$SuiteId
+>>&1	string		>\n			%s
+>&3	string		$SuiteId
+>>&1	string		>\n			%s
+
+# MSC (message sequence charts) are a formal description technique,
+# described in ITU-T Z.120, mainly used for communication protocols.
+# Added by W. Borgert <debacle@debian.org>.
+0	string		mscdocument	Message Sequence Chart (document)
+0	string		msc		Message Sequence Chart (chart)
+0	string		submsc		Message Sequence Chart (subchart)

+ 51 - 25
Magdir/compress

@@ -14,38 +14,40 @@
 >2	byte&0x1f	x		%d bits
 
 # gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver)
+#   Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
+#	* Original filename is only at offset 10 if "extra field" absent
+#	* Produce shorter output - notably, only report compression methods
+#	  other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
->2      byte            <8              \b, reserved method,
->2      byte            8               \b, deflated,
->3	byte		&0x01		ASCII,
->3	byte		&0x02		continuation,
->3	byte		&0x04		extra field,
->3	byte		&0x08		original filename,
->>10    string          x               `%s',
->3	byte		&0x10		comment,
->3	byte		&0x20		encrypted,
->4	ledate		x		last modified: %s,
->8	byte		2		max compression,
->8	byte		4		max speed,
->9	byte		=0x00		os: MS-DOS
->9	byte		=0x01		os: Amiga
->9	byte		=0x02		os: VMS
->9	byte		=0x03		os: Unix
->9	byte		=0x05		os: Atari
->9	byte		=0x06		os: OS/2
->9	byte		=0x07		os: MacOS
->9	byte		=0x0A		os: Tops/20
->9	byte		=0x0B		os: Win/32
+>2	byte		<8		\b, reserved method
+>2	byte		>8		\b, unknown method
+>3	byte		&0x01		\b, ASCII
+>3	byte		&0x02		\b, continuation
+>3	byte		&0x04		\b, extra field
+>3	byte&0xC	=0x08
+>>10	string		x		\b, was "%s"
+>9	byte		=0x00		\b, from MS-DOS
+>9	byte		=0x01		\b, from Amiga
+>9	byte		=0x02		\b, from VMS
+>9	byte		=0x03		\b, from Unix
+>9	byte		=0x05		\b, from Atari
+>9	byte		=0x06		\b, from OS/2
+>9	byte		=0x07		\b, from MacOS
+>9	byte		=0x0A		\b, from Tops/20
+>9	byte		=0x0B		\b, from Win/32
+>3	byte		&0x10		\b, comment
+>3	byte		&0x20		\b, encrypted
+### >4	ledate		x		last modified: %s,
+>8	byte		2		\b, max compression
+>8	byte		4		\b, max speed
 
 # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
 0	string		\037\036	packed data
 >2	belong		>1		\b, %d characters originally
 >2	belong		=1		\b, %d character originally
 #
-# This magic number is byte-order-independent.  XXX - Does that mean this
-# is big-endian, little-endian, either, or that you can't tell?
-# this short is valid for SunOS
-0	short		017437		old packed data
+# This magic number is byte-order-independent.
+0	short		0x1f1f		old packed data
 
 # XXX - why *two* entries for "compacted data", one of which is
 # byte-order independent, and one of which is byte-order dependent?
@@ -144,3 +146,27 @@
 >>17	byte		=0x0A		os: Tops/20
 >>17	byte		=0x0B		os: WinNT
 >>17	byte		=0x0E		os: Win32
+
+# 4.3BSD-Quasijarus Strong Compression
+# http://minnie.tuhs.org/Quasijarus/compress.html
+0	string		\037\241	Quasijarus strong compressed data
+
+# From: Cory Dikkers <cdikkers@swbell.net>
+0	string		XPKF		Amiga xpkf.library compressed data
+0	string		PP11		Power Packer 1.1 compressed data
+0	string		PP20		Power Packer 2.0 compressed data,
+>4	belong		0x09090909	fast compression
+>4	belong		0x090A0A0A	mediocre compression
+>4	belong		0x090A0B0B	good compression
+>4	belong		0x090A0C0C	very good compression
+>4	belong		0x090A0C0D	best compression
+
+# 7z archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at)
+# http://www.7-zip.org or DOC/7zFormat.txt 
+#
+0	string		7z\274\257\047\034	7z archive data,
+>6	byte		x			version %d
+>7	byte		x			\b.%d
+
+# AFX compressed files (Wolfram Kleff)
+2	string		-afx-		AFX compressed file data

+ 76 - 1
Magdir/console

@@ -119,4 +119,79 @@
 
 #------------------------------------------------------------------------------
 # msx: file(1) magic for MSX game cartridge dumps
-0 beshort 0x4142 MSX game cartridge dump 
+# Too simple - MPi
+#0 beshort 0x4142 MSX game cartridge dump 
+
+#------------------------------------------------------------------------------
+# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
+0	string	PS-X\ EXE	Sony Playstation executable
+#  Area:
+>113	string	x		(%s)
+
+#------------------------------------------------------------------------------
+# Microsoft Xbox executables .xbe (Esa Hyytiä <ehyytia@cc.hut.fi>)
+0       string          XBEH            XBE, Microsoft Xbox executable
+# probabilistic checks whether signed or not
+>0x0004 ulelong =0x0
+>>&2    ulelong =0x0
+>>>&2   ulelong =0x0  \b, not signed
+>0x0004 ulelong >0
+>>&2    ulelong >0
+>>>&2   ulelong >0    \b, signed
+# expect base address of 0x10000
+>0x0104               ulelong =0x10000
+>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
+>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
+>>>(0x0118-0x0FF60)   ulelong >0           (regions:
+>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
+>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
+>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
+>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
+>>>(0x0118-0x0FF60)   ulelong >0           \b)
+
+# --------------------------------
+# Microsoft Xbox data file formats
+0       string          XIP0            XIP, Microsoft Xbox data
+0       string          XTF0            XTF, Microsoft Xbox data
+
+# Atari Lynx cartridge dump (EXE/BLL header)
+# From: "Stefan A. Haubenthal" <polluks@web.de>
+
+0	beshort		0x8008		Lynx cartridge,
+>2	beshort		x		RAM start $%04x
+>6	string		BS93
+
+#------------------------------------------------------------------------------
+# Z-machine:  file(1) magic for Z-machine binaries.
+#
+# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which
+# appears to be a version-0 Z-machine binary.
+#
+# The (false match) message is to correct that behavior.  Perhaps it is
+# not needed.
+#
+>16	belong&0xfe00f0f0	0x3030	Infocom game data
+>0	ubyte			0	(false match)
+>0	ubyte			>0	(Z-machine %d,
+>>2	ubeshort		x	Release %d /
+>>18	string			>\0	Serial %.6s)
+
+#------------------------------------------------------------------------------
+# Glulx:  file(1) magic for Glulx binaries.
+#
+# I haven't checked for false matches yet.
+#
+0	string			Glul	Glulx game data
+
+
+
+# These go at the end of the iff rules
+#
+# I don't see why these might collide with anything else.
+#
+# Interactive Fiction related formats
+#
+>8	string		IFRS		\b, Blorb Interactive Fiction
+>>24	string		Exec		with executable chunk
+>8	string          IFZS		\b, Z-machine or Glulx saved game file (Quetzal)
+

Magdir/convex → magic/Magdir/convex


+ 1 - 1
Magdir/ctags

@@ -2,4 +2,4 @@
 # ----------------------------------------------------------------------------
 # ctags:  file (1) magic for Exuberant Ctags files
 # From: Alexander Mai <mai@migdal.ikp.physik.tu-darmstadt.de>
-0       string  !_TAG   Exuberant Ctags tag file
+0       string  !_TAG   Exuberant Ctags tag file text

+ 10 - 0
magic/Magdir/dact

@@ -0,0 +1,10 @@
+
+#------------------------------------------------------------------------------
+# dact:  file(1) magic for DACT compressed files
+#
+0	long		0x444354C3	DACT compressed data
+>4	byte		>-1		(version %i.
+>5	byte		>-1		$BS%i.
+>6	byte		>-1		$BS%i)
+>7	long		>0		$BS, original size: %i bytes
+>15	long		>30		$BS, block size: %i bytes

+ 203 - 0
magic/Magdir/database

@@ -0,0 +1,203 @@
+
+#------------------------------------------------------------------------------
+# database:  file(1) magic for various databases
+#
+# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
+#
+#
+# GDBM magic numbers
+#  Will be maintained as part of the GDBM distribution in the future.
+#  <downsj@teeny.org>
+0	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian
+0	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian
+0	string	GDBM		GNU dbm 2.x database
+#
+# Berkeley DB
+#
+# Ian Darwin's file /etc/magic files: big/little-endian version.
+#
+# Hash 1.85/1.86 databases store metadata in network byte order.
+# Btree 1.85/1.86 databases store the metadata in host byte order.
+# Hash and Btree 2.X and later databases store the metadata in host byte order.
+
+0	long	0x00061561	Berkeley DB
+>8	belong	4321
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, native byte-order)
+>8	belong	1234
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, little-endian)
+
+0	belong	0x00061561	Berkeley DB
+>8	belong	4321
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, big-endian)
+>8	belong	1234
+>>4	belong	>2		1.86
+>>4	belong	<3		1.85
+>>4	belong	>0		(Hash, version %d, native byte-order)
+
+0	long	0x00053162	Berkeley DB 1.85/1.86
+>4	long	>0		(Btree, version %d, native byte-order)
+0	belong	0x00053162	Berkeley DB 1.85/1.86
+>4	belong	>0		(Btree, version %d, big-endian)
+0	lelong	0x00053162	Berkeley DB 1.85/1.86
+>4	lelong	>0		(Btree, version %d, little-endian)
+
+12	long	0x00061561	Berkeley DB
+>16	long	>0		(Hash, version %d, native byte-order)
+12	belong	0x00061561	Berkeley DB
+>16	belong	>0		(Hash, version %d, big-endian)
+12	lelong	0x00061561	Berkeley DB
+>16	lelong	>0		(Hash, version %d, little-endian)
+
+12	long	0x00053162	Berkeley DB
+>16	long	>0		(Btree, version %d, native byte-order)
+12	belong	0x00053162	Berkeley DB
+>16	belong	>0		(Btree, version %d, big-endian)
+12	lelong	0x00053162	Berkeley DB
+>16	lelong	>0		(Btree, version %d, little-endian)
+
+12	long	0x00042253	Berkeley DB
+>16	long	>0		(Queue, version %d, native byte-order)
+12	belong	0x00042253	Berkeley DB
+>16	belong	>0		(Queue, version %d, big-endian)
+12	lelong	0x00042253	Berkeley DB
+>16	lelong	>0		(Queue, version %d, little-endian)
+#
+#
+# Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
+0	string	RRD		RRDTool DB
+>4	string	x		version %s
+#----------------------------------------------------------------------
+# ROOT: file(1) magic for ROOT databases
+#
+0       string  root\0  ROOT file
+>4      belong  x       Version %d
+>33     belong  x       (Compression: %d)
+
+# XXX: Weak magic.
+# Alex Ott <ott@jet.msk.su>
+## Paradox file formats
+#2	  leshort	0x0800	Paradox 
+#>0x39	  byte		3	v. 3.0 
+#>0x39	  byte		4	v. 3.5 
+#>0x39	  byte		9	v. 4.x 
+#>0x39	  byte		10	v. 5.x 
+#>0x39	  byte		11	v. 5.x 
+#>0x39	  byte		12	v. 7.x 
+#>>0x04	  byte		0	indexed .DB data file 
+#>>0x04	  byte		1	primary index .PX file 
+#>>0x04	  byte		2	non-indexed .DB data file 
+#>>0x04	  byte		3	non-incrementing secondary index .Xnn file 
+#>>0x04	  byte		4	secondary index .Ynn file 
+#>>0x04	  byte		5	incrementing secondary index .Xnn file 
+#>>0x04	  byte		6	non-incrementing secondary index .XGn file 
+#>>0x04	  byte		7	secondary index .YGn file 
+#>>>0x04	  byte		8	incrementing secondary index .XGn file 
+## XBase database files
+#0      byte       0x02	
+#>8     leshort	  >0
+#>>12   leshort    0	FoxBase 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x03	
+#>8     leshort	  >0
+#>>12   leshort    0	FoxBase+, FoxPro, dBaseIII+, dBaseIV, no memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x04	
+#>8     leshort	  >0
+#>>12   leshort    0	dBASE IV no memo file 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x05	
+#>8     leshort	  >0
+#>>12   leshort    0	dBASE V no memo file 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x30
+#>8     leshort	  >0
+#>>12   leshort    0	Visual FoxPro 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x43
+#>8     leshort	  >0
+#>>12   leshort    0	FlagShip with memo var size 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x7b
+#>8     leshort	  >0
+#>>12   leshort    0	dBASEIV with memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x83	
+#>8     leshort	  >0
+#>>12   leshort    0	FoxBase+, dBaseIII+ with memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x8b
+#>8     leshort	  >0
+#>>12   leshort    0	dBaseIV with memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0x8e	
+#>8     leshort	  >0
+#>>12   leshort    0	dBaseIV with SQL Table 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0xb3
+#>8     leshort	  >0
+#>>12   leshort    0	FlagShip with .dbt memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0      byte       0xf5
+#>8     leshort	  >0
+#>>12   leshort    0	FoxPro with memo 
+#>>>0x04	lelong		0		(no records)
+#>>>0x04	lelong		>0		(%ld records)
+#
+#0	leshort		0x0006		DBase 3 index file
+
+# MS Access database
+4	  string	Standard\ Jet\ DB	Microsoft Access Database
+
+# TDB database from Samba et al - Martin Pool <mbp@samba.org>
+0	string	TDB\ file		TDB database
+>32	lelong	0x2601196D		version 6, little-endian
+>>36	lelong	x			hash size %d bytes
+
+# SE Linux policy database
+0       lelong  0xf97cff8c      SE Linux policy
+>16     lelong  x               v%d
+>20     lelong  1      MLS
+>24     lelong  x       %d symbols
+>28     lelong  x       %d ocons
+
+# ICE authority file data (Wolfram Kleff)
+2	string		ICE		ICE authority data
+
+# X11 Xauthority file (Wolfram Kleff)
+10	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+11	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+12	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+13	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+14	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+15	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data

Magdir/diamond → magic/Magdir/diamond


+ 0 - 5
Magdir/diff

@@ -6,8 +6,3 @@
 0	string		***\ 		'diff' output text
 0	string		Only\ in\ 	'diff' output text
 0	string		Common\ subdirectories:\ 	'diff' output text
-
-# xdelta is like diff(1) for binary files (works for text, too).
-# Available from: ftp://ftp.xcf.berkeley.edu/pub/xdelta/
-0       string          %XDZ            xdelta diff file
->4      string          >%              version %.3s

Magdir/digital → magic/Magdir/digital


+ 57 - 0
magic/Magdir/dolby

@@ -0,0 +1,57 @@
+# ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
+# from http://www.atsc.org/standards/a_52a.pdf
+# corrections, additions, etc. are always welcome!
+#
+# syncword
+0       beshort         0x0b77  ATSC A/52 aka AC-3 aka Dolby Digital stream,
+# fscod
+>4      byte&0xc0       0x00    48 kHz,
+>4      byte&0xc0       0x40    44.1 kHz,
+>4      byte&0xc0       0x80    32 kHz,
+# is this one used for 96 kHz?
+>4      byte&0xc0       0xc0    reserved frequency,
+#
+>5	byte&7 = 0		\b, complete main (CM)
+>5	byte&7 = 1		\b, music and effects (ME)
+>5	byte&7 = 2		\b, visually impaired (VI)
+>5	byte&7 = 3		\b, hearing impaired (HI)
+>5	byte&7 = 4		\b, dialogue (D)
+>5	byte&7 = 5		\b, commentary (C)
+>5	byte&7 = 6		\b, emergency (E)
+# acmod
+>6      byte&0xe0       0x00    1+1 front,
+>6      byte&0xe0       0x20    1 front/0 rear,
+>6      byte&0xe0       0x40    2 front/0 rear,
+>6      byte&0xe0       0x60    3 front/0 rear,
+>6      byte&0xe0       0x80    2 front/1 rear,
+>6      byte&0xe0       0xa0    3 front/1 rear,
+>6      byte&0xe0       0xc0    2 front/2 rear,
+>6      byte&0xe0       0xe0    3 front/2 rear,
+# lfeon (these may be incorrect)
+>7      byte&0x40       0x00    LFE off,
+>7      byte&0x40       0x40    LFE on,
+#
+>4	byte&0x3e = 0x00	\b, 32 kbit/s
+>4	byte&0x3e = 0x02        \b, 40 kbit/s
+>4	byte&0x3e = 0x04        \b, 48 kbit/s
+>4	byte&0x3e = 0x06        \b, 56 kbit/s
+>4	byte&0x3e = 0x08        \b, 64 kbit/s
+>4	byte&0x3e = 0x0a        \b, 80 kbit/s
+>4	byte&0x3e = 0x0c        \b, 96 kbit/s
+>4	byte&0x3e = 0x0e        \b, 112 kbit/s
+>4	byte&0x3e = 0x10        \b, 128 kbit/s
+>4	byte&0x3e = 0x12        \b, 160 kbit/s
+>4	byte&0x3e = 0x14        \b, 192 kbit/s
+>4	byte&0x3e = 0x16        \b, 224 kbit/s
+>4	byte&0x3e = 0x18        \b, 256 kbit/s
+>4	byte&0x3e = 0x1a        \b, 320 kbit/s
+>4	byte&0x3e = 0x1c        \b, 384 kbit/s
+>4	byte&0x3e = 0x1e        \b, 448 kbit/s
+>4	byte&0x3e = 0x20        \b, 512 kbit/s
+>4	byte&0x3e = 0x22        \b, 576 kbit/s
+>4	byte&0x3e = 0x24        \b, 640 kbit/s
+# dsurmod (these may be incorrect)
+>6      beshort&0x0180  0x0000  Dolby Surround not indicated
+>6      beshort&0x0180  0x0080  not Dolby Surround encoded
+>6      beshort&0x0180  0x0100  Dolby Surround encoded
+>6      beshort&0x0180  0x0180  reserved Dolby Surround mode

Magdir/dump → magic/Magdir/dump


Magdir/dyadic → magic/Magdir/dyadic


+ 4 - 0
Magdir/editors

@@ -7,3 +7,7 @@
 >4	string	1	CP 852
 >4	string	2	KOI8-CS
 >4	string	>2	unknown encoding
+
+# Vi IMproved Encrypted file 
+# by David Necas <yeti@physics.muni.cz>
+0	string	VimCrypt~	Vim encrypted file data

+ 76 - 41
Magdir/elf

@@ -5,38 +5,50 @@
 # 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?
 #
 # updated by Daniel Quinlan (quinlan@yggdrasil.com)
 0	string		\177ELF		ELF
 >4	byte		0		invalid class
 >4	byte		1		32-bit
-# only for MIPS
+# only for MIPS - in the future, the ABI field of e_flags should be used.
+>>18	leshort		8
+>>>36	lelong		&0x20		N32
+>>18	leshort		10
+>>>36	lelong		&0x20		N32
 >>18	beshort		8
+>>>36	belong		&0x20		N32
 >>18	beshort		10
->>>36   belong          &0x20           N32
+>>>36	belong		&0x20		N32
 >4	byte		2		64-bit
 >5	byte		0		invalid byte order
 >5	byte		1		LSB
-# only for MIPS R3000_BE
+# The official e_machine number for MIPS is now #8, regardless of endianness.
+# The second number (#10) will be deprecated later. For now, we still
+# say something if #10 is encountered, but only gory details for #8.
 >>18    leshort		8
 # only for 32-bit
 >>>4	byte		1
->>>>36  lelong&0xf0000000       0x00000000      mips-1
->>>>36  lelong&0xf0000000       0x10000000      mips-2
->>>>36  lelong&0xf0000000       0x20000000      mips-3
->>>>36  lelong&0xf0000000       0x30000000      mips-4
->>>>36  lelong&0xf0000000       0x40000000      mips-5
->>>>36  lelong&0xf0000000       0x50000000      mips-6
+>>>>36  lelong&0xf0000000	0x00000000	MIPS-I
+>>>>36  lelong&0xf0000000	0x10000000	MIPS-II
+>>>>36  lelong&0xf0000000	0x20000000	MIPS-III
+>>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>>36  lelong&0xf0000000	0x40000000	MIPS-V
+>>>>36  lelong&0xf0000000	0x60000000	MIPS32
+>>>>36  lelong&0xf0000000	0x70000000	MIPS64
+>>>>36  lelong&0xf0000000	0x80000000	MIPS32 rel2
+>>>>36  lelong&0xf0000000	0x90000000	MIPS64 rel2
 # only for 64-bit
 >>>4	byte		2
->>>>48  lelong&0xf0000000       0x00000000      mips-1
->>>>48  lelong&0xf0000000       0x10000000      mips-2
->>>>48  lelong&0xf0000000       0x20000000      mips-3
->>>>48  lelong&0xf0000000       0x30000000      mips-4
->>>>48  lelong&0xf0000000       0x40000000      mips-5
->>>>48  lelong&0xf0000000       0x50000000      mips-6
+>>>>48  lelong&0xf0000000	0x00000000	MIPS-I
+>>>>48  lelong&0xf0000000	0x10000000	MIPS-II
+>>>>48  lelong&0xf0000000	0x20000000	MIPS-III
+>>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>>48  lelong&0xf0000000	0x40000000	MIPS-V
+>>>>48  lelong&0xf0000000	0x60000000	MIPS32
+>>>>48  lelong&0xf0000000	0x70000000	MIPS64 
+>>>>48  lelong&0xf0000000	0x80000000	MIPS32 rel2
+>>>>48  lelong&0xf0000000	0x90000000	MIPS64 rel2
 >>16	leshort		0		no file type,
 >>16	leshort		1		relocatable,
 >>16	leshort		2		executable,
@@ -44,21 +56,24 @@
 # 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),
+# Core file detection is not reliable.
+#>>>(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		4		Motorola
+>>>36	lelong		&0x01000000	68000 - invalid byte order,
+>>>36	lelong		&0x00810000	CPU32 - invalid byte order,
+>>>36	lelong		0		68020 - invalid byte order,
 >>18	leshort		5		Motorola 88000 - invalid byte order,
 >>18	leshort		6		Intel 80486,
 >>18	leshort		7		Intel 80860,
-# "officially" big endian, but binutils bfd only emits magic #8 for MIPS.
->>18	leshort		8		MIPS R3000_LE [bfd bug],
+>>18	leshort		8		MIPS,
 >>18	leshort		9		Amdahl - invalid byte order,
->>18	leshort		10		MIPS R3000_LE,
+>>18	leshort		10		MIPS (deprecated),
 >>18	leshort		11		RS6000 - invalid byte order,
 >>18	leshort		15		PA-RISC - invalid byte order,
 >>>50	leshort		0x0214		2.0
@@ -67,12 +82,14 @@
 >>18	leshort		17		Fujitsu VPP500,
 >>18	leshort		18		SPARC32PLUS,
 >>18	leshort		20		PowerPC,
+>>18	leshort		22		IBM S/390,
 >>18	leshort		36		NEC V800,
 >>18	leshort		37		Fujitsu FR20,
 >>18	leshort		38		TRW RH-32,
 >>18	leshort		39		Motorola RCE,
 >>18	leshort		40		ARM,
 >>18	leshort		41		Alpha,
+>>18	leshort		0xa390		IBM S/390 (obsolete),
 >>18	leshort		42		Hitachi SH,
 >>18	leshort		43		SPARC V9 - invalid byte order,
 >>18	leshort		44		Siemens Tricore Embedded Processor,
@@ -87,48 +104,59 @@
 >>18	leshort		53		Motorola M68HC12,
 >>18	leshort		62		AMD x86-64,
 >>18	leshort		75		Digital VAX,
+>>18	leshort		88		Renesas M32R,
+>>18	leshort		97		NatSemi 32k,
 >>18	leshort		0x9026		Alpha (unofficial),
 >>20	lelong		0		invalid version
 >>20	lelong		1		version 1
 >>36	lelong		1		MathCoPro/FPU/MAU Required
 >5	byte		2		MSB
-# only for MIPS R3000_BE
+# only for MIPS - see comment in little-endian section above.
 >>18    beshort		8
 # only for 32-bit
 >>>4	byte		1
->>>>36  belong&0xf0000000       0x00000000      mips-1
->>>>36  belong&0xf0000000       0x10000000      mips-2
->>>>36  belong&0xf0000000       0x20000000      mips-3
->>>>36  belong&0xf0000000       0x30000000      mips-4
->>>>36  belong&0xf0000000       0x40000000      mips-5
->>>>36  belong&0xf0000000       0x50000000      mips-6
+>>>>36  belong&0xf0000000	0x00000000	MIPS-I
+>>>>36  belong&0xf0000000	0x10000000	MIPS-II
+>>>>36  belong&0xf0000000	0x20000000	MIPS-III
+>>>>36  belong&0xf0000000	0x30000000	MIPS-IV
+>>>>36  belong&0xf0000000	0x40000000	MIPS-V
+>>>>36  belong&0xf0000000	0x60000000	MIPS32
+>>>>36  belong&0xf0000000	0x70000000	MIPS64
+>>>>36  belong&0xf0000000	0x80000000	MIPS32 rel2
+>>>>36  belong&0xf0000000	0x90000000	MIPS64 rel2
 # only for 64-bit
 >>>4	byte		2
->>>>48  belong&0xf0000000       0x00000000      mips-1
->>>>48  belong&0xf0000000       0x10000000      mips-2
->>>>48  belong&0xf0000000       0x20000000      mips-3
->>>>48  belong&0xf0000000       0x30000000      mips-4
->>>>48  belong&0xf0000000       0x40000000      mips-5
->>>>48  belong&0xf0000000       0x50000000      mips-6
+>>>>48	belong&0xf0000000	0x00000000	MIPS-I
+>>>>48	belong&0xf0000000	0x10000000	MIPS-II
+>>>>48	belong&0xf0000000	0x20000000	MIPS-III
+>>>>48	belong&0xf0000000	0x30000000	MIPS-IV
+>>>>48	belong&0xf0000000	0x40000000	MIPS-V
+>>>>48	belong&0xf0000000	0x60000000	MIPS32
+>>>>48	belong&0xf0000000	0x70000000	MIPS64 
+>>>>48	belong&0xf0000000	0x80000000	MIPS32 rel2
+>>>>48	belong&0xf0000000	0x90000000	MIPS64 rel2
 >>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),
+#>>>(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		4		Motorola
+>>>36	belong		&0x01000000	68000,
+>>>36	belong		&0x00810000	CPU32,
+>>>36	belong		0		68020,
 >>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		8		MIPS,
 >>18	beshort		9		Amdahl,
->>18	beshort		10		MIPS R3000_LE - invalid byte order,
+>>18	beshort		10		MIPS (deprecated),
 >>18	beshort		11		RS6000,
 >>18	beshort		15		PA-RISC
 >>>50	beshort		0x0214		2.0
@@ -142,6 +170,7 @@
 >>>36	belong&0xffff00	&0x000800	Sun UltraSPARC3 Extensions Required,
 >>18	beshort		20		PowerPC or cisco 4500,
 >>18	beshort		21		cisco 7500,
+>>18	beshort		22		IBM S/390,
 >>18	beshort		24		cisco SVIP,
 >>18	beshort		25		cisco 7200,
 >>18	beshort		36		NEC V800 or cisco 12000,
@@ -164,11 +193,17 @@
 >>18	beshort		53		Motorola M68HC12,
 >>18	beshort		73		Cray NV1,
 >>18	beshort		75		Digital VAX,
+>>18	beshort		88		Renesas M32R,
+>>18	beshort		97		NatSemi 32k,
 >>18	beshort		0x9026		Alpha (unofficial),
+>>18	beshort		0xa390		IBM S/390 (obsolete),
 >>20	belong		0		invalid version
 >>20	belong		1		version 1
 >>36	belong		1		MathCoPro/FPU/MAU Required
->8	string		>\0		(%s)
+# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
+# like proper ELF, but extracting the string had bad results.
+>4      byte            <0x80
+>>8	string		>\0		(%s)
 >8	string		\0
 >>7	byte		0		(SYSV)
 >>7	byte		1		(HP-UX)

+ 0 - 0
Magdir/encore


Some files were not shown because too many files changed in this diff