Browse Source

Merge upstream version 5.08

Daniel Baumann 12 years ago
parent
commit
7ed4a72e31
100 changed files with 29530 additions and 34870 deletions
  1. 159 0
      ChangeLog
  2. 165 34
      INSTALL
  3. 1 1
      Makefile.am
  4. 179 84
      Makefile.in
  5. 15 31
      README
  6. 5 14
      TODO
  7. 11 8
      acinclude.m4
  8. 238 6752
      aclocal.m4
  9. 11 10
      compile
  10. 146 148
      config.guess
  11. 59 8
      config.h.in
  12. 119 33
      config.sub
  13. 10365 20291
      configure
  14. 22 5
      configure.ac
  15. 81 35
      depcomp
  16. 224 183
      doc/Makefile.in
  17. 146 134
      doc/file.man
  18. 84 46
      doc/libmagic.man
  19. 70 26
      doc/magic.man
  20. 243 459
      install-sh
  21. 7337 5977
      ltmain.sh
  22. 7357 0
      m4/libtool.m4
  23. 368 0
      m4/ltoptions.m4
  24. 123 0
      m4/ltsugar.m4
  25. 23 0
      m4/ltversion.m4
  26. 92 0
      m4/lt~obsolete.m4
  27. 3 3
      magic/Header
  28. 33 13
      magic/Magdir/adventure
  29. 0 32
      magic/Magdir/alpha
  30. 19 3
      magic/Magdir/animation
  31. 2 2
      magic/Magdir/apple
  32. 103 43
      magic/Magdir/archive
  33. 26 7
      magic/Magdir/audio
  34. 25 0
      magic/Magdir/blcr
  35. 9 0
      magic/Magdir/bsi
  36. 49 4
      magic/Magdir/cad
  37. 6 1
      magic/Magdir/chord
  38. 46 32
      magic/Magdir/commands
  39. 24 14
      magic/Magdir/compress
  40. 12 4
      magic/Magdir/console
  41. 20 1
      magic/Magdir/database
  42. 12 2
      magic/Magdir/diff
  43. 30 16
      magic/Magdir/digital
  44. 35 2
      magic/Magdir/dyadic
  45. 8 0
      magic/Magdir/ebml
  46. 3 1
      magic/Magdir/erlang
  47. 111 32
      magic/Magdir/filesystems
  48. 13 1
      magic/Magdir/fonts
  49. 19 9
      magic/Magdir/games
  50. 105 0
      magic/Magdir/geo
  51. 2 1
      magic/Magdir/gimp
  52. 111 13
      magic/Magdir/images
  53. 6 1
      magic/Magdir/intel
  54. 15 0
      magic/Magdir/isz
  55. 3 8
      magic/Magdir/jpeg
  56. 4 4
      magic/Magdir/kde
  57. 3 3
      magic/Magdir/kml
  58. 99 33
      magic/Magdir/linux
  59. 4 2
      magic/Magdir/llvm
  60. 14 2
      magic/Magdir/macintosh
  61. 2 2
      magic/Magdir/magic
  62. 26 15
      magic/Magdir/mail.news
  63. 9 1
      magic/Magdir/matroska
  64. 8 0
      magic/Magdir/metastore
  65. 3 3
      magic/Magdir/mime
  66. 18 14
      magic/Magdir/mips
  67. 11 1
      magic/Magdir/misctools
  68. 4 4
      magic/Magdir/modem
  69. 319 161
      magic/Magdir/msdos
  70. 33 0
      magic/Magdir/msooxml
  71. 12 0
      magic/Magdir/oasis
  72. 3 3
      magic/Magdir/ocaml
  73. 1 8
      magic/Magdir/os9
  74. 22 0
      magic/Magdir/parrot
  75. 5 1
      magic/Magdir/printer
  76. 34 4
      magic/Magdir/python
  77. 34 2
      magic/Magdir/revision
  78. 31 1
      magic/Magdir/riff
  79. 44 0
      magic/Magdir/rinex
  80. 31 17
      magic/Magdir/rpm
  81. 13 1
      magic/Magdir/ruby
  82. 34 1
      magic/Magdir/scientific
  83. 24 0
      magic/Magdir/selinux
  84. 2 2
      magic/Magdir/sgi
  85. 20 20
      magic/Magdir/sgml
  86. 18 0
      magic/Magdir/sisu
  87. 30 1
      magic/Magdir/sniffer
  88. 12 8
      magic/Magdir/spectrum
  89. 8 0
      magic/Magdir/ssh
  90. 7 0
      magic/Magdir/ssl
  91. 3 1
      magic/Magdir/sun
  92. 29 0
      magic/Magdir/tcl
  93. 25 15
      magic/Magdir/tex
  94. 3 4
      magic/Magdir/tgif
  95. 2 2
      magic/Magdir/unicode
  96. 6 3
      magic/Magdir/varied.out
  97. 5 5
      magic/Magdir/varied.script
  98. 10 1
      magic/Magdir/warc
  99. 12 1
      magic/Magdir/wordprocessors
  100. 0 0
      magic/Magdir/wsdl

+ 159 - 0
ChangeLog

@@ -1,3 +1,162 @@
+2011-07-12  12:32  Reuben Thomas <rrt@sc3d.org>
+
+	* Fix detection of Zip files (Mantis #128).
+	* Make some minor improvements to file(1).
+	* Rename MIME types for filesystem objects for consistency with
+	  xdg-utils. Typically this means that application/x-foo becomes
+	  inode/foo, but some names also change slightly, e.g.
+	  application/x-character-device becomes inode/chardevice.
+
+2011-05-10  20:57  Christos Zoulas <christos@zoulas.com>
+
+	* fix mingw compilation (Abradoks)
+
+2011-05-10  20:57  Christos Zoulas <christos@zoulas.com>
+
+	* remove patchlevel.h
+	* Fix read past allocated memory caused by double-incrementing
+	  a pointer in a loop (reported by Roberto Maar)
+
+2011-03-30  15:45  Christos Zoulas <christos@zoulas.com>
+
+	* Fix cdf string buffer setting (Sven Anders)
+
+2011-03-20  16:35  Christos Zoulas <christos@zoulas.com>
+
+	* Eliminate MAXPATHLEN and use dynamic allocation for
+	  path and file buffers.
+
+2011-03-15  18:15  Christos Zoulas <christos@zoulas.com>
+
+	* binary tests on magic entries with masks could spuriously
+	  get converted to ascii.
+
+2011-03-12  18:06  Reuben Thomas <rrt@sc3d.org>
+
+	* Improve file.man (remove BUGS, present email addresses consistently).
+
+2011-03-07  19:38  Christos Zoulas <christos@zoulas.com>
+
+	* add lrzip support (from Ville Skytta)
+
+2011-02-10  16:36  Christos Zoulas <christos@zoulas.com>
+
+	* fix CDF bounds checking (Guy Helmer)
+
+2011-02-10  12:03  Christos Zoulas <christos@zoulas.com>
+
+	* add cdf_ctime() that prints a meaningful error when time cannot
+	  be converted.
+
+2011-02-02  20:40  Christos Zoulas <christos@zoulas.com>
+
+	* help and version output to stdout.
+
+	* When matching softmagic for ascii files, don't just print
+	  the softmagic classification, keep going and print the
+	  text classification too. This fixes broken troff files when
+	  we moved them from keyword recognition to softmagic
+	  (they stopped printing "with CRLF" etc.)
+	  Reported by Doug McIlroy.
+
+2011-01-16  19:31  Reuben Thomas <rrt@sc3d.org>
+
+	* Fix two potential buffer overruns in apprentice_list.
+
+2011-01-14  22:33  Reuben Thomas <rrt@sc3d.org>
+
+	* New Python binding in pure Python.
+	* Update libmagic(3).
+
+2011-01-06  21:40  Reuben Thomas <rrt@sc3d.org>
+
+	* Fix Python bindings (including recent Python 3 compatibility
+	  update).
+
+2011-01-04  18:43  Reuben Thomas <rrt@sc3d.org>
+
+	* magic/Makefile.am: make it easier to recover from magic build failures.
+	* Fix pstring length specifier parsing to avoid generating invalid
+	  magic files.
+	* Add pstring length "J" (for "JPEG") to specify that the length
+	  include itself.
+	* Fix JPEG comment parsing at last using pstring/HJ!
+	* Ignore section 5 man pages in doc/.cvsignore.
+
+2010-12-22  13:12  Christos Zoulas <christos@zoulas.com>
+
+	* Add pstring/BHhLl to specify the type of the length of pascal
+	  strings.
+
+2010-11-26  18:39  Reuben Thomas <rrt@sc3d.org>
+
+	* Fix "-e soft": it was ignored when softmagic was called
+	  during asciimagic.
+	* Improve comments and use "unsigned char" in tar.h/is_tar.c.
+
+2010-11-05  17:26  Reuben Thomas <rrt@sc3d.org>
+
+	* Make bug reporting addresses more visible.
+
+2010-11-01  18:35  Reuben Thomas <rrt@sc3d.org>
+
+	* Add tcl magic from Gustaf Neumann
+
+2010-10-24  10:42  Christos Zoulas <christos@zoulas.com>
+
+	* Fix the whitespace comparing code (Christopher Chittleborough)
+
+2010-10-06  21:05  Christos Zoulas <christos@zoulas.com>
+
+	* allow string/t to work (Jan Kaluza)
+
+2010-09-20  22:11  Reuben Thomas <rrt@sc3d.org>
+
+	* Apply some patches from Ubuntu and Fedora.
+
+2010-09-20  21:16  Reuben Thomas <rrt@sc3d.org>
+
+	* Apply all patches from Debian package 5.04-6 which have not
+	  already been applied and are not Debian-specific.
+
+2010-09-20  15:24  Reuben Thomas <rrt@sc3d.org>
+
+	* Minor security fix to softmagic.c (don't use untrusted
+	  string as printf format).
+
+2010-07-21  12:20  Christos Zoulas <christos@zoulas.com>
+
+	* MINGW32 portability from LRN
+
+	* Don't warn about escaping magic regex chars when we are in a regex.
+
+2010-07-19  10:55  Christos Zoulas <christos@zoulas.com>
+
+	* Only try to print prpsinfo for core files. (Jan Kaluza)
+
+2010-04-22  12:55  Christos Zoulas <christos@zoulas.com>
+
+	* Try more elf offsets for Debian core files.  (Arnaud Giersch)
+
+2010-02-20  15:18  Reuben Thomas <rrt@sc3d.org>
+
+	* Clarify which sort of CDF we mean.
+
+2010-02-14  22:58  Reuben Thomas <rrt@sc3d.org>
+
+	* Re-jig Zip file type magic so that unsupported special
+	  Zip types (those with "mimetype" at offset 30) can be
+	  recognized.
+
+2010-02-02  21:50  Reuben Thomas <rrt@sc3d.org>
+
+	* Add support for OCF (EPUB) files (application/epub+zip)
+
+2010-01-28  18:25  Christos Zoulas <christos@zoulas.com>
+
+	* Fix core-dump from unbound loop:
+	  https://bugzilla.redhat.com/show_bug.cgi?id=533245
+
 2010-01-22  15:45  Christos Zoulas <christos@zoulas.com>
 
 	* print proper mime for crystal reports file

+ 165 - 34
INSTALL

@@ -2,18 +2,24 @@ Installation Instructions
 *************************
 
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
 
 Basic Installation
 ==================
 
-Briefly, the shell commands `./configure; make; make install' should
+   Briefly, the shell commands `./configure; make; make install' should
 configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -42,7 +48,7 @@ may remove or edit it.
 you want to change it or regenerate `configure' using a newer version
 of `autoconf'.
 
-The simplest way to compile this package is:
+   The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
      `./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
   2. Type `make' to compile the package.
 
   3. Optionally, type `make check' to run any self-tests that come with
-     the package.
+     the package, generally using the just-built uninstalled binaries.
 
   4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
      source code directory by typing `make clean'.  To also remove the
      files that `configure' created (so you can compile the package for
      a different kind of computer), type `make distclean'.  There is
@@ -67,12 +83,22 @@ The simplest way to compile this package is:
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -85,25 +111,41 @@ is an example:
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
 
    With a non-GNU `make', it is safer to compile the package for one
 architecture at a time in the source code directory.  After you have
 installed the package for one architecture, use `make distclean' before
 reconfiguring for another architecture.
 
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
 Installation Names
 ==================
 
-By default, `make install' installs the package's commands under
+   By default, `make install' installs the package's commands under
 `/usr/local/bin', include files under `/usr/local/include', etc.  You
 can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
@@ -114,16 +156,47 @@ Documentation and other data files still use the regular prefix.
    In addition, if you use an unusual directory layout you can give
 options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
 
    If the package supports it, you can cause programs to be installed
 with an extra prefix or suffix on their names by giving `configure' the
 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
 
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
+   Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -135,14 +208,53 @@ find the X include and library files automatically, but if it doesn't,
 you can use the `configure' options `--x-includes=DIR' and
 `--x-libraries=DIR' to specify their locations.
 
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
 Specifying the System Type
 ==========================
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -150,7 +262,8 @@ type, such as `sun4', or a canonical name which has the form:
 
 where SYSTEM can have one of these forms:
 
-     OS KERNEL-OS
+     OS
+     KERNEL-OS
 
    See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
@@ -168,9 +281,9 @@ eventually be run) with `--host=TYPE'.
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -179,7 +292,7 @@ A warning: not all `configure' scripts look for a site script.
 Defining Variables
 ==================
 
-Variables not defined in a site shell script can be set in the
+   Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -198,11 +311,19 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'
-     Print a summary of the options to `configure', and exit.
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
 
 `--version'
 `-V'
@@ -229,6 +350,16 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
 

+ 1 - 1
Makefile.am

@@ -1,4 +1,4 @@
-#ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST = MAINT
 

+ 179 - 84
Makefile.in

@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -13,11 +14,10 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
-#ACLOCAL_AMFLAGS = -I m4
 VPATH = @srcdir@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -39,8 +39,10 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	TODO compile config.guess config.sub depcomp install-sh \
 	ltmain.sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -48,6 +50,13 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo "  GEN   " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
 SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -59,6 +68,9 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	ps-recursive uninstall-recursive
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir dist dist-all distcheck
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
@@ -66,9 +78,34 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
+  { test ! -d "$(distdir)" \
+    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr "$(distdir)"; }; }
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
@@ -76,6 +113,7 @@ distcleancheck_listfiles = find . -type f -print
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -86,43 +124,46 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
@@ -137,8 +178,7 @@ abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -170,6 +210,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -182,8 +223,10 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = MAINT
 SUBDIRS = src magic tests doc python
 all: config.h
@@ -196,15 +239,15 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
-	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
 		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -220,9 +263,10 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
 	$(SHELL) ./config.status --recheck
 
 $(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(srcdir) && $(AUTOCONF)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
 
 config.h: stamp-h1
 	@if test ! -f $@; then \
@@ -234,7 +278,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	cd $(top_builddir) && $(SHELL) ./config.status config.h
 $(srcdir)/config.h.in:  $(am__configure_deps) 
-	cd $(top_srcdir) && $(AUTOHEADER)
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
 
@@ -248,7 +292,7 @@ clean-libtool:
 	-rm -rf .libs _libs
 
 distclean-libtool:
-	-rm -f libtool
+	-rm -f libtool config.lt
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -257,7 +301,7 @@ distclean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -274,7 +318,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -282,7 +326,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -308,16 +352,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -325,14 +369,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -344,46 +388,50 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
-	test -d $(distdir) || mkdir $(distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -399,38 +447,55 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
 	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
 	done
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
-	|| chmod -R a+r $(distdir)
+	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
@@ -439,6 +504,14 @@ dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
+
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+	$(am__remove_distdir)
+
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
@@ -462,13 +535,17 @@ dist dist-all: distdir
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
@@ -476,9 +553,11 @@ distcheck: dist
 	mkdir $(distdir)/_build
 	mkdir $(distdir)/_inst
 	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-	  && cd $(distdir)/_build \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
@@ -500,13 +579,15 @@ distcheck: dist
 	  && rm -rf "$$dc_destdir" \
 	  && $(MAKE) $(AM_MAKEFLAGS) dist \
 	  && rm -rf $(DIST_ARCHIVES) \
-	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
 	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@cd $(distuninstallcheck_dir) \
+	@$(am__cd) '$(distuninstallcheck_dir)' \
 	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
@@ -548,6 +629,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -568,6 +650,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -576,18 +660,28 @@ install-data-am:
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -610,24 +704,25 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+	ctags-recursive install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
-	distclean-generic distclean-hdr distclean-libtool \
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs installdirs-am \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am
+	dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+	distcheck distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am
+
 
 # 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.

+ 15 - 31
README

@@ -1,15 +1,26 @@
 ** README for file(1) Command **
-@(#) $File: README,v 1.42 2009/02/14 15:16:24 christos Exp $
+@(#) $File: README,v 1.44 2011/03/24 13:03:39 rrt Exp $
 
-E-mail: christos@astron.com
 Mailing List: file@mx.gw.com
+Bug tracker: http://bugs.gw.com/
+E-mail: christos@astron.com
 
 Phone: Do not even think of telephoning me about this program. Send cash first!
 
 This is Release 5.x of Ian Darwin's (copyright but distributable)
-file(1) command. This version is the standard "file" command for Linux,
+file(1) command, an implementation of the Unix File(1) command.
+It knows the 'magic number' of several thousands of file types.
+This version is the standard "file" command for Linux,
 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
 
+You can download the latest version of file from:
+
+	ftp://ftp.astron.com/pub/file/
+
+A public read-only git repository is available at:
+
+	https://github.com/glensc/file
+
 The major changes for 5.x are CDF file parsing, indirect magic, and
 overhaul in mime and ascii encoding handling.
 
@@ -102,33 +113,6 @@ guidelines:
 
 ------------------------------------------------------------------------------
 
-You can download the latest version of file from:
-
-	ftp://ftp.astron.com/pub/file/
-
-If your gzip sometimes fails to decompress things complaining about a short
-file, apply this patch [which is going to be in the next version of gzip]:
-*** -   Tue Oct 29 02:06:35 1996
---- util.c      Sun Jul 21 21:51:38 1996
-*** 106,111 ****
---- 108,114 ----
-  
-      if (insize == 0) {
-        if (eof_ok) return EOF;
-+       flush_window();
-        read_error();
-      }
-      bytes_in += (ulg)insize;
-
 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
-
-An MS-Windows (Win32) port of File-4.17 is available from
-http://gnuwin32.sourceforge.net/
-
-File is an implementation of the Unix File(1) command.
-It knows the 'magic number' of several thousands of file types.
+SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.

+ 5 - 14
TODO

@@ -1,15 +1,6 @@
-Fix output so that tests for MIME and APPLE flags are not needed all
-over the place, and actual output is only done in one place. This
-needs a design. Suggestion: push possible outputs on to a list, then
-pick the last-pushed (most specific, one hopes) value at the end, or
-use a default if the list is empty.
+TODOs live in the TODO section of doc/file.man (i.e. file(1)). They
+are more visible there, so please add any further TODOs to that file,
+not here.
 
-Continue to squash all magic bugs. See Debian BTS for a good source.
-
-Store arbitrarily long strings, for example for %s patterns, so that
-they can be printed out. Fixes Debian bug #271672.
-
-Add syntax for other sorts of counted string (Debian bug #466032). Use
-to fix bug #283760.
-
-Add syntax for relative offsets after current level (Debian bug #466037).
+(This change was made when Reuben Thomas noticed that all the bugs
+listed in the BUGS section of the man page had been fixed!)

+ 11 - 8
acinclude.m4

@@ -10,15 +10,16 @@ if test "$ac_cv_struct_tm_zone" = yes; then
   AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
 fi
 
+# On SGI, apparently tzname is a #define, but that's ok, AC_CHECK_DECL will
+# consider it declared and we won't give our own extern.
+AC_CHECK_DECLS([tzname], , , [#include <time.h>])
 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
 [AC_TRY_LINK(
-changequote(<<, >>)dnl
-<<#include <time.h>
-#ifndef tzname /* For SGI.  */
-extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
-#endif>>,
-changequote([, ])dnl
-[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
+[#include <time.h>
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif],
+[return tzname[0][0];], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
   if test $ac_cv_var_tzname = yes; then
     AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
   fi
@@ -31,11 +32,13 @@ if test "$ac_cv_struct_tm_isdst" = yes; then
   AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
 fi
 
+
+AC_CHECK_DECLS([daylight], , , [#include <time.h>])
 AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
 [AC_TRY_LINK(
 changequote(<<, >>)dnl
 <<#include <time.h>
-#ifndef daylight /* In case IRIX #defines this, too  */
+#if !HAVE_DECL_DAYLIGHT
 extern int daylight;
 #endif>>,
 changequote([, ])dnl

File diff suppressed because it is too large
+ 238 - 6752
aclocal.m4


+ 11 - 10
compile

@@ -1,9 +1,10 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.
 
-scriptversion=2005-05-14.22
+scriptversion=2009-10-06.20; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
+# Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,8 +18,7 @@ scriptversion=2005-05-14.22
 # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -103,13 +103,13 @@ if test -z "$ofile" || test -z "$cfile"; then
 fi
 
 # Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
 
 # Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
+# Note: use `[/\\:.-]' here to ensure that we don't use the same name
 # that we are using for the .o file.  Also, base the name on the expected
 # object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
 while true; do
   if mkdir "$lockdir" >/dev/null 2>&1; then
     break
@@ -124,9 +124,9 @@ trap "rmdir '$lockdir'; exit 1" 1 2 15
 ret=$?
 
 if test -f "$cofile"; then
-  mv "$cofile" "$ofile"
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
 elif test -f "${cofile}bj"; then
-  mv "${cofile}bj" "$ofile"
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
 fi
 
 rmdir "$lockdir"
@@ -138,5 +138,6 @@ exit $ret
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:

+ 146 - 148
config.guess

@@ -1,13 +1,10 @@
 #! /bin/sh
-#
-# $NetBSD: config.guess,v 1.9 2006/10/29 23:50:54 wiz Exp $
-#
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
 
-timestamp='2006-07-02'
+timestamp='2009-12-30'
 
 # 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
@@ -30,16 +27,16 @@ timestamp='2006-07-02'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -59,8 +56,9 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -173,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -327,14 +325,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
@@ -535,7 +552,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -643,7 +660,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -784,7 +801,7 @@ EOF
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
-    i*:MINGW*:*)
+    *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
     i*:windows32*:*)
@@ -794,15 +811,24 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[3456]*)
-	echo i586-pc-interix${UNAME_RELEASE}
-	exit ;;
-    EM64T:Interix*:[3456]*)
-	echo x86_64-unknown-interix${UNAME_RELEASE}
-	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -832,8 +858,29 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -847,6 +894,17 @@ EOF
     frv:Linux:*:*)
     	echo frv-unknown-linux-gnu
 	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
@@ -856,74 +914,33 @@ EOF
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips64
-	#undef mips64el
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
 	echo or32-unknown-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
 	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
@@ -933,8 +950,11 @@ EOF
 	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
@@ -954,69 +974,9 @@ EOF
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1045,7 +1005,7 @@ EOF
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
@@ -1089,8 +1049,11 @@ EOF
     pc:*:*:*)
 	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
         exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
@@ -1128,6 +1091,16 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
@@ -1140,7 +1113,7 @@ EOF
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1203,6 +1176,9 @@ EOF
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
 	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1212,6 +1188,15 @@ EOF
     SX-6:SUPER-UX:*:*)
 	echo sx6-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1221,6 +1206,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1302,6 +1297,9 @@ EOF
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1462,9 +1460,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be

+ 59 - 8
config.h.in

@@ -12,6 +12,14 @@
 /* HAVE_DAYLIGHT */
 #undef HAVE_DAYLIGHT
 
+/* Define to 1 if you have the declaration of `daylight', and to 0 if you
+   don't. */
+#undef HAVE_DECL_DAYLIGHT
+
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+   */
+#undef HAVE_DECL_TZNAME
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
@@ -21,9 +29,15 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 #undef HAVE_FSEEKO
 
+/* Define to 1 if you have the `getline' function. */
+#undef HAVE_GETLINE
+
 /* Define to 1 if you have the <getopt.h> header file. */
 #undef HAVE_GETOPT_H
 
@@ -39,6 +53,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `gnurx' library (-lgnurx). */
+#undef HAVE_LIBGNURX
+
 /* Define to 1 if you have the `z' library (-lz). */
 #undef HAVE_LIBZ
 
@@ -96,13 +113,13 @@
 /* HAVE_STRUCT_OPTION */
 #undef HAVE_STRUCT_OPTION
 
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_RDEV
 
-/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */
+/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
 #undef HAVE_STRUCT_TM_TM_GMTOFF
 
-/* Define to 1 if `tm_zone' is member of `struct tm'. */
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */
 #undef HAVE_STRUCT_TM_TM_ZONE
 
 /* Define to 1 if you have the <sys/mman.h> header file. */
@@ -171,6 +188,10 @@
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
    */
 #undef MAJOR_IN_MKDEV
@@ -197,6 +218,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -209,23 +233,50 @@
 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME
 
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
 /* Version number of package */
 #undef VERSION
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #undef _LARGEFILE_SOURCE
 
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 

+ 119 - 33
config.sub

@@ -1,13 +1,10 @@
 #! /bin/sh
-#
-# $NetBSD: config.sub,v 1.8 2006/10/29 23:52:55 wiz Exp $
-#
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
 
-timestamp='2006-09-20'
+timestamp='2009-12-31'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -35,13 +32,16 @@ timestamp='2006-09-20'
 
 
 # Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -75,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -125,6 +126,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -151,10 +153,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -248,17 +253,20 @@ case $basic_machine in
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
+	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore \
+	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
+	| mips64octeon | mips64octeonel \
 	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
@@ -271,6 +279,7 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
+	| moxie \
 	| mt \
 	| msp430 \
 	| nios | nios2 \
@@ -279,20 +288,22 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
+	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -327,19 +338,22 @@ case $basic_machine in
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
+	| mips64octeon-* | mips64octeonel-* \
 	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
@@ -360,21 +374,26 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
+	| ubicom32-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
-	| z8k-*)
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -438,6 +457,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -446,10 +469,26 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -478,8 +517,8 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -517,6 +556,10 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
 	djgpp)
 		basic_machine=i586-pc
 		os=-msdosdjgpp
@@ -671,6 +714,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -682,10 +733,17 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -812,6 +870,14 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -1020,6 +1086,10 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1095,6 +1165,10 @@ case $basic_machine in
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1133,7 +1207,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1183,6 +1257,9 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1203,10 +1280,11 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1215,7 +1293,7 @@ case $os in
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1225,7 +1303,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1355,6 +1433,11 @@ case $os in
 	-zvmoe)
 		os=-zvmoe
 		;;
+	-dicos*)
+		os=-dicos
+		;;
+        -nacl*)
+	        ;;
 	-none)
 		;;
 	*)
@@ -1420,6 +1503,9 @@ case $basic_machine in
 	m68*-cisco)
 		os=-aout
 		;;
+        mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;
@@ -1549,7 +1635,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)

File diff suppressed because it is too large
+ 10365 - 20291
configure


+ 22 - 5
configure.ac

@@ -1,8 +1,10 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file, 5.04, christos@astron.com)
-AM_INIT_AUTOMAKE
+AC_INIT(file, 5.08, christos@astron.com)
+AM_INIT_AUTOMAKE()
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
 AM_CONFIG_HEADER(config.h)
-#AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_MSG_CHECKING(for builtin ELF support)
 AC_ARG_ENABLE(elf,
@@ -47,6 +49,18 @@ fi], [
   fsect=4
 ])
 
+AC_CANONICAL_HOST
+case "$host_os" in
+   mingw32*)
+      MINGW=1
+      ;;
+   *)
+      MINGW=0
+      ;;
+esac
+AC_SUBST(MINGW)
+AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
+
 AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
 AC_SUBST(fsect)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
@@ -142,13 +156,16 @@ else
 fi])
 
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
+AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof fork)
 
 dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline)
 
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)
+if test "$MINGW" = 1; then
+  AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
+fi
 
 dnl See if we are cross-compiling
 AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)

+ 81 - 35
depcomp

@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2006-10-15.18
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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
@@ -17,9 +17,7 @@ scriptversion=2006-10-15.18
 # 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., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
    depmode=dashmstdout
 fi
 
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u="sed s,\\\\\\\\,/,g"
+   depmode=msvisualcpp
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
 ' < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
     tr '
-' ' ' >> $depfile
-    echo >> $depfile
+' ' ' >> "$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
+   >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -215,34 +222,39 @@ aix)
   # current directory.  Also, the AIX compiler puts `$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
+  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$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
   stat=$?
 
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile"
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
 
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
   if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
     # 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"
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -323,7 +335,12 @@ hp2)
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+    sed -ne '2,${
+	       s/^ *//
+	       s/ \\*$//
+	       s/$/:/
+	       p
+	     }' "$tmpdepfile" >> "$depfile"
   else
     echo "#dummy" > "$depfile"
   fi
@@ -399,7 +416,7 @@ dashmstdout)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -450,32 +467,39 @@ makedepend)
   "$@" || exit $?
   # Remove any Libtool call
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
   fi
   # X makedepend
   shift
-  cleared=no
-  for arg in "$@"; do
+  cleared=no eat=no
+  for arg
+  do
     case $cleared in
     no)
       set ""; shift
       cleared=yes ;;
     esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
     case "$arg" in
     -D*|-I*)
       set fnord "$@" "$arg"; shift ;;
     # Strip any option that makedepend may not understand.  Remove
     # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
     -*|$object)
       ;;
     *)
       set fnord "$@" "$arg"; shift ;;
     esac
   done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
@@ -495,7 +519,7 @@ cpp)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -533,13 +557,27 @@ cpp)
 
 msvisualcpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the preprocessed file to stdout.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
   IFS=" "
   for arg
   do
     case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 	set fnord "$@"
 	shift
@@ -552,16 +590,23 @@ msvisualcpp)
 	;;
     esac
   done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
+msvcmsys)
+  # 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
+  ;;
+
 none)
   exec "$@"
   ;;
@@ -580,5 +625,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:

+ 224 - 183
doc/Makefile.in

@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -14,8 +15,9 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -33,15 +35,45 @@ host_triplet = @host@
 subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo "  GEN   " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
 SOURCES =
 DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
 man1dir = $(mandir)/man1
 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
 	"$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"
@@ -54,6 +86,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -64,43 +97,46 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
@@ -115,8 +151,7 @@ abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -148,6 +183,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -160,6 +196,7 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 MAGIC = $(pkgdatadir)/magic
@@ -175,14 +212,14 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  doc/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu doc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -200,192 +237,165 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
-install-man1: $(man1_MANS) $(man_MANS)
+install-man1: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man1dir)" || $(MKDIR_P) "$(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; \
+	@list=''; test -n "$(man1dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.1[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+	  fi; \
 	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
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+	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/^.*\\.//'`; \
-	  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 " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
-	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
-	done
-install-man3: $(man3_MANS) $(man_MANS)
+	@list=''; test -n "$(man1dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.1[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+install-man3: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man3dir)" || $(MKDIR_P) "$(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; \
+	@list=''; test -n "$(man3dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.3[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
+	  fi; \
 	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
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
+	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/^.*\\.//'`; \
-	  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 " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
-	  rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
-	done
-install-man4: $(man4_MANS) $(man_MANS)
+	@list=''; test -n "$(man3dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.3[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man3dir)" && rm -f $$files; }
+install-man4: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man4dir)" || $(MKDIR_P) "$(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; \
+	@list=''; test -n "$(man4dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.4[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man4dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man4dir)/$$inst" || exit $$?; \
+	  fi; \
 	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
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man4dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man4dir)" || exit $$?; }; \
+	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/^.*\\.//'`; \
-	  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 " rm -f '$(DESTDIR)$(man4dir)/$$inst'"; \
-	  rm -f "$(DESTDIR)$(man4dir)/$$inst"; \
-	done
-install-man5: $(man5_MANS) $(man_MANS)
+	@list=''; test -n "$(man4dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.4[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man4dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man4dir)" && rm -f $$files; }
+install-man5: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man5dir)" || $(MKDIR_P) "$(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; \
+	@list=''; test -n "$(man5dir)" || exit 0; \
+	{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.5[a-z]*$$/p'; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
+	  fi; \
 	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
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
+	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/^.*\\.//'`; \
-	  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 " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
-	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
-	done
+	@list=''; test -n "$(man5dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+	  sed -n '/\.5[a-z]*$$/p'; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
 tags: TAGS
 TAGS:
 
@@ -394,6 +404,19 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -409,13 +432,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -447,6 +474,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -465,6 +493,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -473,18 +503,28 @@ install-data-am: install-man
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man: install-man1 install-man3 install-man4 install-man5
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -545,6 +585,7 @@ libmagic.3: Makefile libmagic.man
 	    -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:

+ 146 - 134
doc/file.man

@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.82 2009/11/04 22:30:34 christos Exp $
-.Dd October 9, 2008
+.\" $File: file.man,v 1.96 2011/07/12 11:23:38 rrt Exp $
+.Dd April 20, 2011
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -8,21 +8,21 @@
 .Sh SYNOPSIS
 .Nm
 .Bk -words
-.Op Fl bchikLNnprsvz0
-.Op Fl -apple
-.Op Fl -mime-encoding
-.Op Fl -mime-type
+.Op Fl bchiklLNnprsvz0
+.Op Fl Fl apple
+.Op Fl Fl mime-encoding
+.Op Fl Fl mime-type
 .Op Fl e Ar testname
 .Op Fl F Ar separator
 .Op Fl f Ar namefile
 .Op Fl m Ar magicfiles
 .Ar
-.Ek -words
+.Ek
 .Nm
 .Fl C
 .Op Fl m Ar magicfiles
 .Nm
-.Op Fl -help
+.Op Fl Fl help
 .Sh DESCRIPTION
 This manual page documents version __VERSION__ of the
 .Nm
@@ -46,12 +46,12 @@ terminal),
 .Em executable
 (the file contains the result of compiling a program
 in a form understandable to some
-.Dv UNIX
+.Tn UNIX
 kernel or another),
 or
 .Em data
 meaning anything else (data is usually
-.Sq binary
+.Dq binary
 or non-printable).
 Exceptions are well-known file formats (core files, tar archives)
 that are known to contain binary data.
@@ -59,12 +59,12 @@ When modifying magic files or the program itself, make sure to
 .Em "preserve these keywords" .
 Users depend on knowing that all the readable files in a directory
 have the word
-.Sq text
+.Dq text
 printed.
 Don't do as Berkeley did and change
-.Sq shell commands text
+.Dq shell commands text
 to
-.Sq shell script .
+.Dq shell script .
 .Pp
 The filesystem tests are based on examining the return from a
 .Xr stat 2
@@ -74,8 +74,7 @@ or if it's some sort of special file.
 Any known file types appropriate to the system you are running on
 (sockets, symbolic links, or named pipes (FIFOs) on those systems that
 implement them)
-are intuited if they are defined in
-the system header file
+are intuited if they are defined in the system header file
 .In sys/stat.h .
 .Pp
 The magic tests are used to check for files with data in
@@ -89,13 +88,14 @@ and possibly
 .In exec.h
 in the standard include directory.
 These files have a
-.Sq "magic number"
+.Dq "magic number"
 stored in a particular place
 near the beginning of the file that tells the
-.Dv UNIX operating system
+.Tn UNIX
+operating system
 that the file is a binary executable, and which of several types thereof.
 The concept of a
-.Sq "magic"
+.Dq "magic"
 has been applied by extension to data files.
 Any file with some invariant identifier at a small fixed
 offset into the file can usually be described in this way.
@@ -104,7 +104,8 @@ magic file
 .Pa __MAGIC__.mgc ,
 or the files in the directory
 .Pa __MAGIC__
-if the compiled file does not exist. In addition, if
+if the compiled file does not exist.
+In addition, if
 .Pa $HOME/.magic.mgc
 or
 .Pa $HOME/.magic
@@ -121,10 +122,10 @@ in each set.
 If a file passes any of these tests, its character set is reported.
 ASCII, ISO-8859-x, UTF-8, and extended-ASCII files are identified
 as
-.Sq text
+.Dq text
 because they will be mostly readable on nearly any terminal;
 UTF-16 and EBCDIC are only
-.Sq character data
+.Dq character data
 because, while
 they contain text, it is text that will require translation
 before it can be read.
@@ -142,8 +143,8 @@ has determined the character set used in a text-type file,
 it will
 attempt to determine in what language the file is written.
 The language tests look for particular strings (cf.
-.In names.h
-) that can appear anywhere in the first few blocks of a file.
+.In names.h )
+that can appear anywhere in the first few blocks of a file.
 For example, the keyword
 .Em .br
 indicates that the file is most likely a
@@ -160,31 +161,32 @@ archives).
 .Pp
 Any file that cannot be identified as having been written
 in any of the character sets listed above is simply said to be
-.Sq data .
+.Dq data .
 .Sh OPTIONS
 .Bl -tag -width indent
-.It Fl b , -brief
+.It Fl b , Fl Fl brief
 Do not prepend filenames to output lines (brief mode).
-.It Fl C , -compile
+.It Fl C , Fl Fl compile
 Write a
 .Pa magic.mgc
 output file that contains a pre-parsed version of the magic file or directory.
-.It Fl c , -checking-printout
+.It Fl c , Fl Fl checking-printout
 Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with the
 .Fl m
 flag to debug a new magic file before installing it.
-.It Fl e , -exclude Ar testname
+.It Fl e , Fl Fl exclude Ar testname
 Exclude the test named in
 .Ar testname
-from the list of tests made to determine the file type. Valid test names
-are:
+from the list of tests made to determine the file type.
+Valid test names are:
 .Bl -tag -width compress
 .It apptype
 .Dv EMX
 application type (only on EMX).
-.It text
-Various types of text files (this test will try to guess the text encoding, irrespective of the setting of the
+.It ascii
+Various types of text files (this test will try to guess the text
+encoding, irrespective of the setting of the
 .Sq encoding
 option).
 .It encoding
@@ -202,11 +204,12 @@ Consults magic files.
 .It tar
 Examines tar files.
 .El
-.It Fl F , -separator Ar separator
+.It Fl F , Fl Fl separator Ar separator
 Use the specified string as the separator between the filename and the
-file result returned. Defaults to
+file result returned.
+Defaults to
 .Sq \&: .
-.It Fl f , -files-from Ar namefile
+.It Fl f , Fl Fl files-from Ar namefile
 Read the names of the files to be examined from
 .Ar namefile
 (one per line)
@@ -217,67 +220,68 @@ or at least one filename argument must be present;
 to test the standard input, use
 .Sq -
 as a filename argument.
-.It Fl h , -no-dereference
+.It Fl h , Fl Fl no-dereference
 option causes symlinks not to be followed
-(on systems that support symbolic links). This is the default if the
-environment variable
+(on systems that support symbolic links).
+This is the default if the environment variable
 .Dv POSIXLY_CORRECT
 is not defined.
-.It Fl i , -mime
+.It Fl i , Fl Fl mime
 Causes the file command to output mime type strings rather than the more
-traditional human readable ones. Thus it may say
+traditional human readable ones.
+Thus it may say
 .Sq text/plain; charset=us-ascii
 rather than
-.Sq ASCII text .
-In order for this option to work, file changes the way
-it handles files recognized by the command itself (such as many of the
-text file types, directories etc), and makes use of an alternative
-.Sq magic
-file.
-(See the FILES section, below).
-.It Fl -mime-type , -mime-encoding
+.Dq ASCII text .
+.It Fl Fl mime-type , Fl Fl mime-encoding
 Like
 .Fl i ,
 but print only the specified element(s).
-.It Fl k , -keep-going
-Don't stop at the first match, keep going. Subsequent matches will be
+.It Fl k , Fl Fl keep-going
+Don't stop at the first match, keep going.
+Subsequent matches will be
 have the string
 .Sq "\[rs]012\- "
 prepended.
 (If you want a newline, see the
-.Sq "\-r"
+.Fl r
 option.)
-.It Fl L , -dereference
+.It Fl l , Fl Fl list
+Print information about the strength of each magic pattern.
+.It Fl L , Fl Fl dereference
 option causes symlinks to be followed, as the like-named option in
 .Xr ls 1
 (on systems that support symbolic links).
 This is the default if the environment variable
-.Dv POSIXLY_CORRECT
+.Ev POSIXLY_CORRECT
 is defined.
-.It Fl m , -magic-file Ar magicfiles
+.It Fl l
+Shows sorted patterns list in the order which is used for the matching.
+.It Fl m , Fl Fl magic-file Ar magicfiles
 Specify an alternate list of files and directories containing magic.
 This can be a single item, or a colon-separated list.
-If a compiled magic file is found alongside a file or directory, it will be used instead.
-.It Fl N , -no-pad
+If a compiled magic file is found alongside a file or directory,
+it will be used instead.
+.It Fl N , Fl Fl no-pad
 Don't pad filenames so that they align in the output.
-.It Fl n , -no-buffer
+.It Fl n , Fl Fl 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.
-.It Fl p , -preserve-date
+.It Fl p , Fl Fl preserve-date
 On systems that support
-.Xr utime 2
+.Xr utime 3
 or
 .Xr utimes 2 ,
 attempt to preserve the access time of files analyzed, to pretend that
 .Nm
 never read them.
-.It Fl r , -raw
+.It Fl r , Fl Fl raw
 Don't translate unprintable characters to \eooo.
 Normally
 .Nm
 translates unprintable characters to their octal representation.
-.It Fl s , -special-files
+.It Fl s , Fl Fl special-files
 Normally,
 .Nm
 only attempts to read and determine the type of argument files which
@@ -297,16 +301,18 @@ This option also causes
 to disregard the file size as reported by
 .Xr stat 2
 since on some systems it reports a zero size for raw disk partitions.
-.It Fl v , -version
+.It Fl v , Fl Fl version
 Print the version of the program and exit.
-.It Fl z , -uncompress
+.It Fl z , Fl Fl uncompress
 Try to look inside compressed files.
-.It Fl 0 , -print0
+.It Fl 0 , Fl Fl print0
 Output a null character
 .Sq \e0
-after the end of the filename. Nice to
+after the end of the filename.
+Nice to
 .Xr cut 1
-the output. This does not affect the separator which is still printed.
+the output.
+This does not affect the separator which is still printed.
 .It Fl -help
 Print a help message and exit.
 .El
@@ -319,7 +325,7 @@ Directory containing default magic files.
 .El
 .Sh ENVIRONMENT
 The environment variable
-.Dv MAGIC
+.Ev MAGIC
 can be used to set the default magic file name.
 If that variable is set, then
 .Nm
@@ -327,26 +333,31 @@ will not attempt to open
 .Pa $HOME/.magic .
 .Nm
 adds
-.Sq .mgc
+.Dq Pa .mgc
 to the value of this variable as appropriate.
+However,
+.Pa file
+has to exist in order for
+.Pa file.mime
+to be considered.
 The environment variable
-.Dv POSIXLY_CORRECT
+.Ev POSIXLY_CORRECT
 controls (on systems that support symbolic links), whether
 .Nm
-will attempt to follow symlinks or not. If set, then
+will attempt to follow symlinks or not.
+If set, then
 .Nm
-follows symlink, otherwise it does not. This is also controlled
-by the
+follows symlink, otherwise it does not.
+This is also controlled by the
 .Fl L
 and
 .Fl h
 options.
 .Sh SEE ALSO
 .Xr magic __FSECTION__ ,
-.Xr strings 1 ,
+.Xr hexdump 1 ,
 .Xr od 1 ,
-.Xr hexdump 1,
-.Xr file 1posix
+.Xr strings 1 ,
 .Sh STANDARDS CONFORMANCE
 This program is believed to exceed the System V Interface Definition
 of FILE(CMD), as near as one can determine from the vague language
@@ -362,12 +373,12 @@ is that this version treats any white space
 as a delimiter, so that spaces in pattern strings must be escaped.
 For example,
 .Bd -literal -offset indent
->10	string	language impress\ 	(imPRESS data)
+\*[Gt]10	string	language impress\ 	(imPRESS data)
 .Ed
 .Pp
 in an existing magic file would have to be changed to
 .Bd -literal -offset indent
->10	string	language\e impress	(imPRESS data)
+\*[Gt]10	string	language\e impress	(imPRESS data)
 .Ed
 .Pp
 In addition, in this version, if a pattern string contains a backslash,
@@ -385,13 +396,13 @@ in an existing magic file would have to be changed to
 SunOS releases 3.2 and later from Sun Microsystems include a
 .Nm
 command derived from the System V one, but with some extensions.
-My version differs from Sun's only in minor ways.
+This version differs from Sun's only in minor ways.
 It includes the extension of the
-.Sq &
+.Sq \*[Am]
 operator, used as,
 for example,
 .Bd -literal -offset indent
->16	long&0x7fffffff	>0		not stripped
+\*[Gt]16	long\*[Am]0x7fffffff	\*[Gt]0		not stripped
 .Ed
 .Sh MAGIC DIRECTORY
 The magic file entries have been collected from various sources,
@@ -409,13 +420,13 @@ If your old
 command uses a magic file,
 keep the old magic file around for comparison purposes
 (rename it to
-.Pa __MAGIC__.orig ).
+.Pa __MAGIC__.orig ) .
 .Sh EXAMPLES
 .Bd -literal -offset indent
 $ file file.c file /dev/{wd0a,hda}
 file.c:   C program text
 file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
-	  dynamically linked (uses shared libs), stripped
+          dynamically linked (uses shared libs), stripped
 /dev/wd0a: block special (0/0)
 /dev/hda: block special (3/0)
 
@@ -454,33 +465,48 @@ the external list of magic types.
 This slowed the program down slightly but made it a lot more flexible.
 .Pp
 This program, based on the System V version,
-was written by Ian Darwin <ian@darwinsys.com>
+was written by Ian Darwin
+.Aq ian@darwinsys.com
 without looking at anybody else's source code.
 .Pp
 John Gilmore revised the code extensively, making it better than
 the first version.
 Geoff Collyer found several inadequacies
 and provided some magic file entries.
-Contributions by the `&' operator by Rob McMahon, cudcv@warwick.ac.uk, 1989.
+Contributions by the
+.Sq \*[Am]
+operator by Rob McMahon, 
+.Aq cudcv@warwick.ac.uk ,
+1989.
 .Pp
-Guy Harris, guy@netapp.com, made many changes from 1993 to the present.
+Guy Harris, 
+.Aq guy@netapp.com ,
+made many changes from 1993 to the present.
+1989.
 .Pp
 Primary development and maintenance from 1990 to the present by
-Christos Zoulas (christos@astron.com).
+Christos Zoulas
+.Aq christos@astron.com .
 .Pp
-Altered by Chris Lowth, chris@lowth.com, 2000:
-Handle the
+Altered by Chris Lowth
+.Aq chris@lowth.com ,
+2000: handle the
 .Fl i
 option to output mime type strings, using an alternative
 magic file and internal logic.
 .Pp
-Altered by Eric Fischer (enf@pobox.com), July, 2000,
+Altered by Eric Fischer
+.Aq enf@pobox.com ,
+July, 2000,
 to identify character codes and attempt to identify the languages
 of non-ASCII files.
 .Pp
-Altered by Reuben Thomas (rrt@sc3d.org), 2007 to 2008, to improve MIME
-support and merge MIME and non-MIME magic, support directories as well
-as files of magic, apply many bug fixes and improve the build system.
+Altered by Reuben Thomas
+.Aq rrt@sc3d.org ,
+2007-2011, to improve MIME support, merge MIME and non-MIME magic,
+support directories as well as files of magic, apply many bug fixes,
+update and fix a lot of magic, improve the build system, improve the
+documentation, and rewrite the Python bindings in pure Python.
 .Pp
 The list of contributors to the
 .Sq magic
@@ -491,63 +517,49 @@ Many contributors are listed in the source files.
 .Sh LEGAL NOTICE
 Copyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.
 Covered by the standard Berkeley Software Distribution copyright; see the file
-LEGAL.NOTICE in the source distribution.
+COPYING in the source distribution.
 .Pp
 The files
-.Dv tar.h
+.Pa tar.h
 and
-.Dv is_tar.c
+.Pa is_tar.c
 were written by John Gilmore from his public-domain
 .Xr tar 1
 program, and are not covered by the above license.
+.Sh RETURN CODE
+.Nm
+returns 0 on success, and non-zero on error.
 .Sh BUGS
 .Pp
-There must be a better way to automate the construction of the Magic
-file from all the glop in Magdir.
-What is it?
+Please report bugs and send patches to the bug tracker at
+.Pa http://bugs.gw.com/
+or the mailing list at
+.Aq file@mx.gw.com .
+.Sh TODO
 .Pp
-.Nm
-uses several algorithms that favor speed over accuracy,
-thus it can be misled about the contents of
-text
-files.
+Fix output so that tests for MIME and APPLE flags are not needed all
+over the place, and actual output is only done in one place. This
+needs a design. Suggestion: push possible outputs on to a list, then
+pick the last-pushed (most specific, one hopes) value at the end, or
+use a default if the list is empty. This should not slow down evaluation.
 .Pp
-The support for text files (primarily for programming languages)
-is simplistic, inefficient and requires recompilation to update.
+Continue to squash all magic bugs. See Debian BTS for a good source.
 .Pp
-The list of keywords in
-.Dv ascmagic
-probably belongs in the Magic file.
-This could be done by using some keyword like
-.Sq *
-for the offset value.
+Store arbitrarily long strings, for example for %s patterns, so that
+they can be printed out. Fixes Debian bug #271672. Would require more
+complex store/load code in apprentice.
 .Pp
-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?
+Add syntax for relative offsets after current level (Debian bug #466037).
 .Pp
-The program should provide a way to give an estimate
-of
-.Sq how good
-a guess is.
-We end up removing guesses (e.g.
-.Sq From\
-as first 5 chars of file) because
-they are not as good as other guesses (e.g.
-.Sq Newsgroups:
-versus
-.Sq Return-Path:
-).
-Still, if the others don't pan out, it should be possible to use the
-first guess.
+Make file -ki work, i.e. give multiple MIME types.
 .Pp
-This manual page, and particularly this section, is too long.
-.Sh RETURN CODE
-.Nm
-returns 0 on success, and non-zero on error.
+Add a zip library so we can peek inside Office2007 documents to
+figure out what they are.
+.Pp
+Add an option to print URLs for the sources of the file descriptions.
 .Sh AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP
 on
-.Dv ftp.astron.com
+.Pa ftp.astron.com
 in the directory
-.Dv /pub/file/file-X.YZ.tar.gz
+.Pa /pub/file/file-X.YZ.tar.gz .

+ 84 - 46
doc/libmagic.man

@@ -1,4 +1,4 @@
-.\" $File: libmagic.man,v 1.21 2009/11/24 21:16:14 christos Exp $
+.\" $File: libmagic.man,v 1.24 2011/05/13 22:11:44 christos Exp $
 .\"
 .\" Copyright (c) Christos Zoulas 2003.
 .\" All Rights Reserved.
@@ -25,20 +25,20 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 24, 2009
+.Dd January 14, 2011
 .Dt LIBMAGIC 3
 .Os
 .Sh NAME
 .Nm magic_open ,
 .Nm magic_close ,
 .Nm magic_error ,
-.Nm magic_file ,
+.Nm magic_descriptor ,
 .Nm magic_buffer ,
 .Nm magic_setflags ,
 .Nm magic_check ,
 .Nm magic_compile ,
 .Nm magic_load
-.Nd Magic number recognition library.
+.Nd Magic number recognition library
 .Sh LIBRARY
 .Lb libmagic
 .Sh SYNOPSIS
@@ -52,17 +52,19 @@
 .Ft int
 .Fn magic_errno "magic_t cookie"
 .Ft const char *
+.Fn magic_descriptor "magic_t cookie, "int fd"
+.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"
+.Fn magic_buffer "magic_t cookie" "const void *buffer" "size_t length"
 .Ft int
-.Fn magic_setflags "magic_t cookie, int flags"
+.Fn magic_setflags "magic_t cookie" "int flags"
 .Ft int
-.Fn magic_check "magic_t cookie, const char *filename"
+.Fn magic_check "magic_t cookie" "const char *filename"
 .Ft int
-.Fn magic_compile "magic_t cookie, const char *filename"
+.Fn magic_compile "magic_t cookie" "const char *filename"
 .Ft int
-.Fn magic_load "magic_t cookie, const char *filename"
+.Fn magic_load "magic_t cookie" "const char *filename"
 .Sh DESCRIPTION
 These functions
 operate on the magic database file
@@ -72,8 +74,11 @@ in
 .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
+creates a magic cookie pointer and returns it.
+It returns
+.Dv 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
@@ -92,41 +97,45 @@ and try to look in its contents.
 Return a MIME type string, instead of a textual description.
 .It Dv MAGIC_MIME_ENCODING
 Return a MIME encoding, instead of a textual description.
+.It Dv MAGIC_MIME
+A shorthand for MAGIC_MIME_TYPE | MAGIC_MIME_ENCODING.
 .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
+.Xr utime 3
 or
 .Xr utimes 2 ,
-attempt to preserve the access time of files analyzed.
+attempt to preserve the access time of files analysed.
 .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.
+.It Dv MAGIC_APPLE
+Return the Apple creator and type.
 .It Dv MAGIC_NO_CHECK_APPTYPE
-Check for
+Don't check for
 .Dv EMX
 application type (only on EMX).
-.It Dv MAGIC_NO_CHECK_ASCII
-Check for various types of ascii files.
+.It Dv MAGIC_NO_CHECK_CDF
+Don't get extra information on MS Composite Document Files.
 .It Dv MAGIC_NO_CHECK_COMPRESS
-Don't look for, or inside compressed files.
+Don't look inside compressed files.
 .It Dv MAGIC_NO_CHECK_ELF
-Don't print elf details.
-.It Dv MAGIC_NO_CHECK_FORTRAN
-Don't look for fortran sequences inside ascii files.
+Don't print ELF details.
+.It Dv NO_CHECK_ENCODING
+Don't check text encodings.
 .It Dv MAGIC_NO_CHECK_SOFT
 Don't consult magic files.
 .It Dv MAGIC_NO_CHECK_TAR
 Don't examine tar files.
+.It Dv MAGIC_NO_CHECK_TEXT
+Don't check for various types of text files.
 .It Dv MAGIC_NO_CHECK_TOKENS
 Don't look for known tokens inside ascii files.
-.It Dv MAGIC_NO_CHECK_TROFF
-Don't look for troff sequences inside ascii files.
 .El
 .Pp
 The
@@ -137,8 +146,9 @@ 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.
+function returns a textual explanation of the last error, or
+.Dv NULL
+if there was no error.
 .Pp
 The
 .Fn magic_errno
@@ -150,10 +160,22 @@ The
 .Fn magic_file
 function returns a textual description of the contents of the
 .Ar filename
-argument, or NULL if an error occurred.
+argument, or
+.Dv NULL
+if an error occurred.
 If the
 .Ar filename
-is NULL, then stdin is used.
+is
+.Dv NULL ,
+then stdin is used.
+.Pp
+The
+.Fn magic_descriptor
+function returns a textual description of the contents of the
+.Ar fd
+argument, or
+.Dv NULL
+if an error occurred.
 .Pp
 The
 .Fn magic_buffer
@@ -167,7 +189,8 @@ The
 .Fn magic_setflags
 function sets the
 .Ar flags
-described above. Note that using both MIME flags together can also
+described above.
+Note that using both MIME flags together can also
 return extra information on the charset.
 .Pp
 The
@@ -175,16 +198,21 @@ The
 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.
+or
+.Dv 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
+or
+.Dv 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
 .Dq .mgc
@@ -195,11 +223,12 @@ The
 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.
+or
+.Dv 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__.
+The default database file is named by the MAGIC environment variable.
+If that variable is not set, the default database file name is __MAGIC__.
 .Fn magic_load
 adds
 .Dq .mgc
@@ -207,27 +236,35 @@ 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.
+returns a magic cookie on success and
+.Dv NULL
+on failure setting errno to an appropriate value.
+It will set errno to
+.Er 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.
+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
+functions return a string on success and
+.Dv 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.
+functions, or
+.Dv NULL
+if there was no error.
 Finally,
 .Fn magic_setflags
-returns -1 on systems that don't support
-.Xr utime 2 ,
+returns \-1 on systems that don't support
+.Xr utime 3 ,
 or
 .Xr utimes 2
 when
@@ -244,6 +281,7 @@ The compiled default magic database.
 .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.
+.An M\(oans Rullg\(oard
+Initial libmagic implementation, and configuration.
+.An Christos Zoulas
+API cleanup, error code and allocation handling.

+ 70 - 26
doc/magic.man

@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.60 2009/05/08 23:02:44 christos Exp $
-.Dd August 30, 2008
+.\" $File: magic.man,v 1.69 2011/05/13 22:11:44 christos Exp $
+.Dd April 20, 2011
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -51,9 +51,9 @@ A 64-bit double precision IEEE floating point number in this machine's native by
 .It Dv string
 A string of bytes.
 The string type specification can be optionally followed
-by /[Bbc]*.
+by /[WwcCtb]*.
 The
-.Dq B
+.Dq W
 flag compacts whitespace in the target, which must
 contain at least one whitespace character.
 If the magic has
@@ -62,18 +62,55 @@ consecutive blanks, the target needs at least
 .Dv n
 consecutive blanks to match.
 The
-.Dq b
+.Dq w
 flag treats every blank in the target as an optional blank.
-Finally the
+The
 .Dq c
-flag, specifies case insensitive matching: lowercase
+flag, specifies case insensitive matching: lower case
+characters in the magic match both lower and upper case characters in the
+target, whereas upper case characters in the magic only match upper case
+characters in the target.
+The
+.Dq C
+flag, specifies case insensitive matching: upper case
 characters in the magic match both lower and upper case characters in the
-target, whereas upper case characters in the magic only match uppercase
+target, whereas lower case characters in the magic only match upper case
 characters in the target.
+To do a complete case insensitive match, specify both
+.Dq c
+and
+.Dq C .
+The
+.Dq t
+flag, forces the test to be done for text files, while the
+.Dq b
+flag, forces the test to be done for binary files.
 .It Dv pstring
-A Pascal-style string where the first byte is interpreted as the an
+A Pascal-style string where the first byte/short/int is interpreted as the an
 unsigned length.
+The length defaults to byte and can be specified as a modifier.
+The following modifiers are supported:
+.Bl -tag -compact -width B
+.It B
+A byte length (default).
+.It H
+A 2 byte big endian length.
+.It h
+A 2 byte big little length.
+.It L
+A 4 byte big endian length.
+.It l
+A 4 byte big little length.
+.It J
+The length includes itself in its count.
+.El
 The string is not NUL terminated.
+.Dq J
+is used rather than the more
+valuable
+.Dq I
+because this type of length is a feature of the JPEG
+format.
 .It Dv date
 A four-byte value interpreted as a UNIX date.
 .It Dv qdate
@@ -153,11 +190,12 @@ than UTC.
 Starting at the given offset, consult the magic database again.
 .It Dv regex
 A regular expression match in extended POSIX regular expression syntax
-(like egrep). Regular expressions can take exponential time to
-process, and their performance is hard to predict, so their use is
-discouraged. When used in production environments, their performance
-should be carefully checked. The type specification can be optionally
-followed by
+(like egrep).
+Regular expressions can take exponential time to process, and their
+performance is hard to predict, so their use is discouraged.
+When used in production environments, their performance
+should be carefully checked.
+The type specification can be optionally followed by
 .Dv /[c][s] .
 The
 .Dq c
@@ -176,15 +214,17 @@ and
 match the beginning and end of individual lines, respectively,
 not beginning and end of file.
 .It Dv search
-A literal string search starting at the given offset. The same
-modifier flags can be used as for string patterns. The modifier flags
-(if any) must be followed by
+A literal string search starting at the given offset.
+The same modifier flags can be used as for string patterns.
+The modifier flags (if any) must be followed by
 .Dv /number
 the range, that is, the number of positions at which the match will be
-attempted, starting from the start offset. This is suitable for
+attempted, starting from the start offset.
+This is suitable for
 searching larger binary expressions with variable offsets, using
 .Dv \e
-escapes for special characters. The offset works as for regex.
+escapes for special characters.
+The offset works as for regex.
 .It Dv default
 This is intended to be used with the test
 .Em x
@@ -193,14 +233,18 @@ no other matches.
 .El
 .Pp
 Each top-level magic pattern (see below for an explanation of levels)
-is classified as text or binary according to the types used. Types
+is classified as text or binary according to the types used.
+Types
 .Dq regex
 and
 .Dq search
 are classified as text tests, unless non-printable characters are used
-in the pattern. All other tests are classified as binary. A top-level
+in the pattern.
+All other tests are classified as binary.
+A top-level
 pattern is considered to be a test text when all its patterns are text
-patterns; otherwise, it is considered to be a binary pattern. When
+patterns; otherwise, it is considered to be a binary pattern.
+When
 matching a file, binary patterns are tried first; if no match is
 found, and the file looks like text, then its encoding is determined
 and the text patterns are tried.
@@ -283,7 +327,7 @@ then print the string), with
 The special test
 .Em x
 always evaluates to true.
-.Dv message
+.It Dv message
 The message to be printed if the comparison succeeds.
 If the string contains a
 .Xr printf 3
@@ -344,11 +388,11 @@ on the line indicates the level of the test; a line with no
 .Em \*[Gt]
 at the beginning is considered to be at level 0.
 Tests are arranged in a tree-like hierarchy:
-If a the test on a line at level
+if the test on a line at level
 .Em n
 succeeds, all following tests at level
 .Em n+1
-are performed, and the messages printed if the tests succeed, untile a line
+are performed, and the messages printed if the tests succeed, until a line
 with level
 .Em n
 (or less) appears.
@@ -365,7 +409,7 @@ being examined.
 If the first character following the last
 .Em \*[Gt]
 is a
-.Em (
+.Em \&(
 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.

+ 243 - 459
install-sh

@@ -1,38 +1,23 @@
 #!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-10-14.15
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
 #
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
+# $NetBSD: install-sh.in,v 1.5 2010/10/08 19:57:05 tez Exp $
+# This script now also installs multiple files, but might choke on installing
+# multiple files with spaces in the file names.
 #
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
 #
+# Copyright 1991 by the Massachusetts Institute of Technology
 #
-# FSF changes to this file are in the public domain.
+# 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
@@ -41,23 +26,15 @@ scriptversion=2006-10-14.15
 # This script is compatible with the BSD install script, but was written
 # from scratch.
 
-nl='
-'
-IFS=" ""	$nl"
-
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
 
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
 
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+awkprog="${AWKPROG-awk}"
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
 chmodprog="${CHMODPROG-chmod}"
@@ -67,441 +44,248 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-posix_glob=
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chmodcmd=$chmodprog
-chowncmd=
-chgrpcmd=
-stripcmd=
+instcmd="$cpprog"
+pathcompchmodcmd="$chmodprog 755"
+chmodcmd="$chmodprog 755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+stripflags=""
 rmcmd="$rmprog -f"
 mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) shift
-        continue;;
-
-    -d) dir_arg=true
-        shift
-        continue;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-        shift
-        shift
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-        continue;;
-
-    -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
-
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
-
-    -t) dstarg=$2
-	shift
-	shift
-	continue;;
+src=""
+msrc=""
+dst=""
+dir_arg=""
+suffix=""
+suffixfmt=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-b) suffix=".old"
+	    shift
+	    continue;;
+
+	-B) suffixfmt="$2"
+	    shift
+	    shift
+	    continue;;
+
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-S) stripcmd="$stripprog"
+	    stripflags="-S $2 $stripflags"
+	    shift
+	    shift
+	    continue;;
+
+	*)  if [ x"$msrc" = x ]
+	    then
+		msrc="$dst"
+	    else
+		msrc="$msrc $dst"
+	    fi
+	    src="$dst"
+	    dst="$1"
+	    shift
+	    continue;;
+    esac
+done
 
-    -T) no_target_directory=true
-	shift
-	continue;;
+if [ x"$dir_arg" = x ]
+then
+	dstisfile=""
+	if [ ! -d "$dst" ]
+	then
+		if [ x"$msrc" = x"$src" ]
+		then
+			dstisfile=true
+		else
+			echo "install: destination is not a directory"
+			exit 1
+		fi
+	fi
+else
+	msrc="$msrc $dst"
+fi
 
-    --version) echo "$0 $scriptversion"; exit $?;;
+if [ x"$msrc" = x ]
+then
+	echo "install: no destination specified"
+	exit 1
+fi      
 
-    --)	shift
-	break;;
+for srcarg in $msrc; do
 
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
+if [ x"$dir_arg" != x ]; then
 
-    *)  break;;
-  esac
-done
+	dstarg="$srcarg"
+else
+	dstarg="$dst"
+
+# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f "$srcarg" ]
+	then
+		doinst="$instcmd"
+	elif [ -d "$srcarg" ]
+	then
+		echo "install: $srcarg: not a regular file"
+		exit 1
+	elif [ "$srcarg" = "/dev/null" ]
+	then
+		doinst="$cpprog"
+	else
+		echo "install:  $srcarg does not exist"
+		exit 1
+	fi
+	
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
 
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dstarg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
-      shift # fnord
-    fi
-    shift # arg
-    dstarg=$arg
-  done
+	if [ -d "$dstarg" ]
+	then
+		dstarg="$dstarg"/`basename "$srcarg"`
+	fi
 fi
 
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
+## this sed command emulates the dirname command
+dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
 
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src ;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dstarg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dstarg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst ;;
-    esac
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$doit $mkdirprog "${pathcomp}"
+        	if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
+        	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
+        	if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dstarg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
 	else
-	  mkdir_mode=
+		true
 	fi
 
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
+	pathcomp="${pathcomp}/"
+done
+fi
 
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix=/ ;;
-	-*) prefix=./ ;;
-	*)  prefix= ;;
-      esac
-
-      case $posix_glob in
-        '')
-	  if (set -f) 2>/dev/null; then
-	    posix_glob=true
-	  else
-	    posix_glob=false
-	  fi ;;
-      esac
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob && set -f
-      set fnord $dstdir
-      shift
-      $posix_glob && set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
+	if [ x"$dir_arg" != x ]
+	then
+		if [ -d "$dstarg" ]; then
+			true
+		else
+			$doit $mkdirprog "$dstarg" &&
+
+			if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
+			if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
+			if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
+		fi
 	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
+
+		if [ x"$dstisfile" = x ]
+		then
+			file=$srcarg
+		else
+			file=$dst
+		fi
+
+		dstfile=`basename "$file"`
+		dstfinal="$dstdir/$dstfile"
+
+# Make a temp file name in the proper directory.
+
+		dsttmp=$dstdir/#inst.$$#
+
+# Make a backup file name in the proper directory.
+		case x$suffixfmt in
+		*%*)	suffix=`echo x |
+			$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
+			{ cnt = 0;
+			  do {
+				sfx = sprintf(fmt, cnt++);
+				name = bname sfx;
+			  } while (system("test -f " name) == 0);
+			  print sfx; }' -`;;
+		x)	;;
+		*)	suffix="$suffixfmt";;
+		esac
+		dstbackup="$dstfinal$suffix"
+
+# Move or copy the file name to the temp name
+
+		$doit $doinst $srcarg "$dsttmp" &&
+
+		trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# 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 $stripflags "$dsttmp"; else true;fi &&
+		if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
+
+# Now rename the file to the real destination.
+
+		if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
+		then
+			$doit $mvcmd "$dstfinal" "$dstbackup"
+		else
+			$doit $rmcmd -f "$dstfinal"
+		fi &&
+		$doit $mvcmd "$dsttmp" "$dstfinal"
 	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
-      || {
-	   # The rename failed, perhaps because mv can't rename something else
-	   # to itself, or perhaps because mv is so ancient that it does not
-	   # support -f.
-
-	   # Now remove or move aside any old file at destination location.
-	   # We try this two ways since rm can't unlink itself on some
-	   # systems and the destination file might be busy for other
-	   # reasons.  In this case, the final cleanup might fail but the new
-	   # file should still install successfully.
-	   {
-	     if test -f "$dst"; then
-	       $doit $rmcmd -f "$dst" 2>/dev/null \
-	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
-	       || {
-		 echo "$0: cannot unlink or rename $dst" >&2
-		 (exit 1); exit 1
-	       }
-	     else
-	       :
-	     fi
-	   } &&
-
-	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dst"
-	 }
-    } || exit 1
-
-    trap '' 0
-  fi
-done
 
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+done &&
+
+
+exit 0

File diff suppressed because it is too large
+ 7337 - 5977
ltmain.sh


File diff suppressed because it is too large
+ 7357 - 0
m4/libtool.m4


+ 368 - 0
m4/ltoptions.m4

@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file 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.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])

+ 123 - 0
m4/ltsugar.m4

@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file 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.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])

+ 23 - 0
m4/ltversion.m4

@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file 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.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])

+ 92 - 0
m4/lt~obsolete.m4

@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file 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.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])

+ 3 - 3
magic/Header

@@ -1,5 +1,5 @@
-# Magic
 # Magic data for file(1) command.
-# Machine-generated from src/cmd/file/magdir/*; edit there only!
 # Format is described in magic(files), where:
-# files is 5 on V7 and BSD, 4 on SV, and ?? in the SVID.
+# files is 5 on V7 and BSD, 4 on SV, and ?? on SVID.
+# Don't edit this file, edit /etc/magic or send your magic improvements
+# to the maintainers, at file@mx.gw.com

+ 33 - 13
magic/Magdir/adventure

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: adventure,v 1.10 2009/09/19 16:28:07 christos Exp $
+# $File: adventure,v 1.13 2010/12/31 16:32:54 christos Exp $
 # adventure: file(1) magic for Adventure game files
 #
 # from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
@@ -17,18 +17,26 @@
 # Infocom (see z-machine)
 #------------------------------------------------------------------------------
 # Z-machine:  file(1) magic for Z-machine binaries.
+# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
 #
-# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which
-# appears to be a version-0 Z-machine binary.
+#http://www.gnelson.demon.co.uk/zspec/sect11.html
+#http://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt
+#http://en.wikipedia.org/wiki/Z-machine
+# The first byte is the Z-machine revision; it is always between 1 and 8. We
+# had false matches (for instance, inbig5.ocp from the Omega TeX extension as
+# well as an occasional MP3 file), so we sanity-check the version number.
 #
-# The (false match) message is to correct that behavior.  Perhaps it is
-# not needed.
+# It might be possible to sanity-check the release number as well, as it seems
+# (at least in classic Infocom games) to always be a relatively small number,
+# always under 150 or so, but as this isn't rigorous, we'll wait on that until
+# it becomes clear that it's 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)
+0	ubyte			>0
+>0	ubyte			<9
+>>16	belong&0xfe00f0f0	0x3030	Infocom game data
+>>>0	ubyte			x	(Z-machine %d,
+>>>>2	ubeshort		x	Release %d /
+>>>>18	string			>\0	Serial %.6s)
 
 #------------------------------------------------------------------------------
 # Glulx:  file(1) magic for Glulx binaries.
@@ -46,10 +54,9 @@
 # For Quetzal and blorb magic see iff
 
 
-# TADS (Text Adventure Development System)
+# TADS (Text Adventure Development System) version 2
 #  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).
+#  with a version string of the form "V2.<digit>.<digit>\0".
 #  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
@@ -74,6 +81,19 @@
 >10	belong	 0x0A0D1A00
 >>14	string	>\0		%s saved game data
 
+# TADS (Text Adventure Development System) version 3
+#  Game files start with "T3-image\015\012\032"
+0	string	T3-image\015\012\032
+>11	leshort	x		TADS 3 game data (format version %d)
+#  Saved game files start with "T3-state-v####\015\012\032"
+#  where #### is a format version number
+0	string	T3-state-v
+>14	string	\015\012\032	TADS 3 saved game data (format version
+>>10	byte	x		%c
+>>11	byte	x		\b%c
+>>12	byte	x		\b%c
+>>13	byte	x		\b%c)
+
 # Danny Milosavljevic <danny.milo@gmx.net>
 # this are adrift (adventure game standard) game files, extension .taf
 # depending on version magic continues with 0x93453E6139FA (V 4.0)

+ 0 - 32
magic/Magdir/alpha

@@ -1,32 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: alpha,v 1.7 2009/09/19 16:28:07 christos Exp $
-# alpha architecture description
-#
-
-0	leshort		0603		COFF format alpha
->22	leshort&030000	!020000		executable
->24	leshort		0410		pure
->24	leshort		0413		paged
->22	leshort&020000	!0		dynamically linked
->16	lelong		!0		not stripped
->16	lelong		0		stripped
->22	leshort&030000	020000		shared library
->24	leshort		0407		object
->27	byte		x		- version %d
->26	byte		x		.%d
->28	byte		x		-%d
-
-# Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk>
-#
-# The actual magic number is just "Core", followed by a 2-byte version
-# number; however, treating any file that begins with "Core" as a Digital
-# UNIX core dump file may produce too many false hits, so we include one
-# byte of the version number as well; DU 5.0 appears only to be up to
-# version 2.
-#
-0	string		Core\001	Alpha COFF format core dump (Digital UNIX)
->24	string		>\0		\b, from '%s'
-0	string		Core\002	Alpha COFF format core dump (Digital UNIX)
->24	string		>\0		\b, from '%s'
-

+ 19 - 3
magic/Magdir/animation

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.39 2009/09/27 19:02:12 christos Exp $
+# $File: animation,v 1.44 2010/11/25 15:00:12 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -44,8 +44,16 @@
 >8	string		mp7b		\b, MPEG v4 system, MPEG v7 binary XML
 >8	string/W	jp2		\b, JPEG 2000
 !:mime	image/jp2
+>8	string		3ge		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>8	string		3gg		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
 >8	string		3gp		\b, MPEG v4 system, 3GPP
 !:mime	video/3gpp
+>8	string		3gs		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>8	string		3g2		\b, MPEG v4 system, 3GPP2
+!:mime	video/3gpp2
 >>11	byte		4		\b v4 (H.263/AMR GSM 6.10)
 >>11	byte		5		\b v5 (H.263/AMR GSM 6.10)
 >>11	byte		6		\b v6 (ITU H.264/AMR GSM 6.10)
@@ -152,6 +160,7 @@
 >>4      byte               252            \b, FGS @ L4
 >>4      byte               253            \b, FGS @ L5
 >3       byte               0xB5           MPEG sequence, v4
+!:mime  video/mpeg4-generic
 >>4      byte               &0x80
 >>>5     byte&0xF0          16             \b, video (missing profile header)
 >>>5     byte&0xF0          32             \b, still texture (missing profile header)
@@ -162,6 +171,7 @@
 >>4      byte&0xF8          24             \b, mesh (missing profile header)
 >>4      byte&0xF8          32             \b, face (missing profile header)
 >3       byte               0xB3           MPEG sequence
+!:mime  video/mpeg
 >>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,
@@ -731,7 +741,7 @@
 
 # X3D (Extensible 3D) [http://www.web3d.org/specifications/x3d-3.0.dtd]
 # From Michel Briand <michelbriand@free.fr>
-0	string		\<?xml\ version="
+0	string/t		\<?xml\ version="
 !:strength +1
 >20	search/1000/cw  \<!DOCTYPE\ X3D		X3D (Extensible 3D) model xml text
 !:mime model/x3d
@@ -800,7 +810,8 @@
 !:mime	video/h264
 
 # Type: Bink Video
-# URL:  http://wiki.multimedia.cx/index.php?title=3DBink_Container
+# Extension: .bik
+# URL:  http://wiki.multimedia.cx/index.php?title=Bink_Container
 # From: <hoehle@users.sourceforge.net>  2008-07-18
 0	string		BIK	Bink Video
 >3	regex		=[a-z]	rev.%s
@@ -819,3 +830,8 @@
 >>51	byte&0x20	!0	stereo
 #>>51	byte&0x10	0	FFT
 #>>51	byte&0x10	!0	DCT
+
+# Type:	NUT Container
+# URL:	http://wiki.multimedia.cx/index.php?title=NUT
+# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
+0	string	nut/multimedia\ container\0	NUT multimedia container

+ 2 - 2
magic/Magdir/apple

@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.23 2009/09/19 16:28:08 christos Exp $
+# $File: apple,v 1.24 2010/11/25 15:00:12 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
-0	search/1	FiLeStArTfIlEsTaRt	binscii (apple ][) text
+0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
 0	string		\x0aGL			Binary II (apple ][) data
 0	string		\x76\xff		Squeezed (apple ][) data
 0	string		NuFile			NuFile archive (apple ][) data

+ 103 - 43
magic/Magdir/archive

@@ -1,6 +1,5 @@
-
 #------------------------------------------------------------------------------
-# $File: archive,v 1.55 2009/12/04 15:00:47 christos Exp $
+# $File: archive,v 1.67 2011/07/12 11:31:09 rrt Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -245,13 +244,13 @@
 # MS Compress
 4	string	\x88\xf0\x27 MS Compress archive data
 # updated by Joerg Jenderek
->9	string	\0		
->>0	string	KWAJ		
+>9	string	\0
+>>0	string	KWAJ
 >>>7	string	\321\003	MS Compress archive data
 >>>>14	ulong	>0		\b, original size: %ld bytes
->>>>18		ubyte	>0x65  	
->>>>>18		string	x    	\b, was %.8s
->>>>>(10.b-4)	string	x    	\b.%.3s
+>>>>18		ubyte	>0x65
+>>>>>18		string	x       \b, was %.8s
+>>>>>(10.b-4)	string	x       \b.%.3s
 # MP3 (archiver, not lossy audio compression)
 0	string	MP3\x1a MP3-Archiver archive data
 # ZET
@@ -276,7 +275,7 @@
 # Splint
 0	string	\x93\xb9\x06 Splint archive data
 # InstallShield
-0	string	 \x13\x5d\x65\x8c InstallShield Z archive Data
+0	string	\x13\x5d\x65\x8c InstallShield Z archive Data
 # Gather
 1	string	GTH Gather archive data
 # BOA
@@ -535,7 +534,7 @@
 >20	byte		x		- header level %d
 # taken from idarc [JW]
 2   string      -lZ         PUT archive data
-2   string      -lz         LZS archive data 
+2   string      -lz         LZS archive data
 2   string      -sw1-       Swag archive data
 
 # RAR archiver (Greg Roelofs, newt@uchicago.edu)
@@ -566,29 +565,20 @@
 0	string		PK\x07\x08PK\x03\x04	Zip multi-volume archive data, at least PKZIP v2.50 to extract
 !:mime	application/zip
 
-# ZIP archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+# Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 0	string		PK\003\004
->30	ubelong		!0x6d696d65
->>4	byte		0x00		Zip archive data
-!:mime	application/zip
->>4	byte		0x09		Zip archive data, at least v0.9 to extract
-!:mime	application/zip
->>4	byte		0x0a		Zip archive data, at least v1.0 to extract
-!:mime	application/zip
->>4	byte		0x0b		Zip archive data, at least v1.1 to extract
-!:mime	application/zip
->>0x161	string		WINZIP          Zip archive data, WinZIP self-extracting
-!:mime	application/zip
->>4	byte		0x14		Zip archive data, at least v2.0 to extract
-!:mime	application/zip
 
-# OpenOffice.org / KOffice / StarOffice documents
-# Listed here because they ARE zip files
-#
-# From: Abel Cheung <abel@oaka.org>
->30	string		mimetype
+# Specialised zip formats which start with a member named 'mimetype'
+# (stored uncompressed, with no 'extra field') containing the file's MIME type.
+# Check for have 8-byte name, 0-byte extra field, name "mimetype", and
+#  contents starting with "application/":
+>26	string		\x8\0\0\0mimetypeapplication/
 
-# KOffice (1.2 or above) formats
+#  KOffice / OpenOffice & StarOffice / OpenDocument formats
+#    From: Abel Cheung <abel@oaka.org>
+
+#   KOffice (1.2 or above) formats
+#    (mimetype contains "application/vnd.kde.<SUBTYPE>")
 >>50	string	vnd.kde.		KOffice (>=1.2)
 >>>58	string	karbon			Karbon document
 >>>58	string	kchart			KChart document
@@ -599,7 +589,8 @@
 >>>58	string	kspread			KSpread document
 >>>58	string	kword			KWord document
 
-# OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
+#   OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
+#    (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
 >>50	string	vnd.sun.xml.		OpenOffice.org 1.x
 >>>62	string	writer			Writer
 >>>>68	byte	!0x2e			document
@@ -617,8 +608,9 @@
 >>>62	string	math			Math document
 >>>62	string	base			Database file
 
-# OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
-# http://lists.oasis-open.org/archives/office/200505/msg00006.html
+#   OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
+#    http://lists.oasis-open.org/archives/office/200505/msg00006.html
+#    (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
 >>50	string	vnd.oasis.opendocument.	OpenDocument
 >>>73	string	text
 >>>>77	byte	!0x2d			Text
@@ -662,6 +654,48 @@
 >>>>78	string	-template		Template
 !:mime	application/vnd.oasis.opendocument.image-template
 
+#  EPUB (OEBPS) books using OCF (OEBPS Container Format)
+#    From: Adam Buchbinder <adam.buchbinder@gmail.com>
+#    http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
+#    (mimetype contains "application/epub+zip")
+>>50	string	epub+zip		EPUB ebook data
+!:mime	application/epub+zip
+
+#  Catch other ZIP-with-mimetype formats
+#	In a ZIP file, the bytes immediately after a member's contents are
+#	always "PK". The 2 regex rules here print the "mimetype" member's
+#	contents up to the first 'P'. Luckily, most MIME types don't contain
+#	any capital 'P's. This is a kludge.
+#    (mimetype contains "application/<OTHER>")
+>>50		string	!epub+zip
+>>>50		string	!vnd.oasis.opendocument.
+>>>>50		string	!vnd.sun.xml.
+>>>>>50		string	!vnd.kde.
+>>>>>>38	regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
+!:mime	application/zip
+#    (mimetype contents other than "application/*")
+>26		string	\x8\0\0\0mimetype
+>>38		string	!application/
+>>>38		regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
+!:mime	application/zip
+
+# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+#   Next line excludes specialized formats:
+>26    string          !\x8\0\0\0mimetype	Zip archive data
+!:mime	application/zip
+>>4	byte		0x09		\b, at least v0.9 to extract
+>>4	byte		0x0a		\b, at least v1.0 to extract
+>>4	byte		0x0b		\b, at least v1.1 to extract
+>>4	byte		0x14		\b, at least v2.0 to extract
+>>4	byte		0x2d		\b, at least v3.0 to extract
+>>0x161	string		WINZIP		\b, WinZIP self-extracting
+
+# StarView Metafile
+# From Pierre Ducroquet <pinaraf@pinaraf.info>
+0	string	VCLMTF	StarView MetaFile
+>6	beshort	x	\b, version %d
+>8	belong	x	\b, size %d
+
 # Zoo archiver
 20	lelong		0xfdc4a7dc	Zoo archive data
 !:mime	application/x-zoo
@@ -679,7 +713,7 @@
 !:mime	application/octet-stream
 
 #
-# LBR. NB: May conflict with the questionable 
+# LBR. NB: May conflict with the questionable
 #          "binary Computer Graphics Metafile" format.
 #
 0       string  \0\ \ \ \ \ \ \ \ \ \ \ \0\0    LBR archive data
@@ -695,10 +729,10 @@
 # From Rafael Laboissiere <rafael@laboissiere.net>
 # The Project Revision Control System (see
 # http://prcs.sourceforge.net) generates a packaged project
-# file which is recognized by the following entry: 
+# file which is recognized by the following entry:
 0	leshort		0xeb81	PRCS packaged project
 
-# Microsoft cabinets 
+# 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
@@ -706,7 +740,7 @@
 # MPi: All CABs have version 1.3, so this is pointless.
 # Better magic in debian-additions.
 
-# GTKtalog catalogs 
+# GTKtalog catalogs
 # by David Necas (Yeti) <yeti@physics.muni.cz>
 4	string	gtktalog\ 	GTKtalog catalog data,
 >13	string	3		version 3
@@ -725,12 +759,12 @@
 !:mime	application/x-bittorrent
 
 # 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
+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
@@ -775,7 +809,7 @@
 
 # DR-DOS 7.03 Packed File *.??_
 0	string	Packed\ File\ 	Personal NetWare Packed File
->12	string	x    		\b, was "%.12s"
+>12	string	x		\b, was "%.12s"
 
 # EET archive
 # From: Tilman Sauerbeck <tilman@code-monkey.de>
@@ -830,3 +864,29 @@
 >24	belong	0		no checksum
 >24	belong	1		SHA-1 checksum
 >24	belong	2		MD5 checksum
+
+# Type: Parity Archive
+# From: Daniel van Eeden <daniel_e@dds.nl>
+0	string	PAR2		Parity Archive Volume Set
+
+# Bacula volume format. (Volumes always start with a block header.)
+# URL: http://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+12	string	BB02		Bacula volume
+>20	bedate	x		\b, started %s
+
+# ePub is XHTML + XML inside a ZIP archive.  The first member of the
+#   archive must be an uncompressed file called 'mimetype' with contents
+#   'application/epub+zip'
+
+# start by checking that this is a ZIP archive, then check for the
+#   proper mimetype file
+# From: Ralf Brown <ralf.brown@gmail.com>
+0	string	PK\003\004
+>0x1E	string	mimetypeapplication/epub+zip	EPUB document
+!:mime application/epub+zip
+
+# From: "Michał Górny" <mgorny@gentoo.org>
+# ZPAQ: http://mattmahoney.net/dc/zpaq.html
+0	string	zPQ	ZPAQ stream
+>3	byte	x	\b, level %d

+ 26 - 7
magic/Magdir/audio

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.59 2009/11/04 17:27:37 christos Exp $
+# $File: audio,v 1.62 2011/04/05 20:27:13 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -118,7 +118,7 @@
 # Real Audio (Magic .ra\0375)
 0	belong		0x2e7261fd	RealAudio sound file
 !:mime	audio/x-pn-realaudio
-0	string		.RMF		RealMedia file
+0	string		.RMF\0\0\0	RealMedia file
 !:mime	application/vnd.rn-realmedia
 #video/x-pn-realvideo
 #video/vnd.rn-realvideo
@@ -252,12 +252,17 @@
 >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)
+# IRCAM sound files - Michael Pruett <michael@68k.org>
+# http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/IRCAM/IRCAM.html
+0	belong		0x64a30100		IRCAM file (VAX little-endian)
+0	belong		0x0001a364		IRCAM file (VAX big-endian)
+0	belong		0x64a30200		IRCAM file (Sun big-endian)
+0	belong		0x0002a364		IRCAM file (Sun little-endian)
 0	belong		0x64a30300		IRCAM file (MIPS little-endian)
-0	belong		0x64a30400		IRCAM file (NeXT)
+0	belong		0x0003a364		IRCAM file (MIPS big-endian)
+0	belong		0x64a30400		IRCAM file (NeXT big-endian)
+0	belong		0x64a30400		IRCAM file (NeXT big-endian)
+0	belong		0x0004a364		IRCAM file (NeXT little-endian)
 
 # NIST SPHERE <mpruett@sgi.com>
 0	string		NIST_1A\n\ \ \ 1024\n	NIST SPHERE file
@@ -308,6 +313,15 @@
 >122	byte&0x1	=1		PAL
 >122	byte&0x1	=0		NTSC
 
+# Type: SNES SPC700 sound files
+# From: Josh Triplett <josh@freedesktop.org>
+0	string	SNES-SPC700\ Sound\ File\ Data\ v	SNES SPC700 sound file
+>&0	string	0.30					\b, version %s
+>>0x23	byte	0x1B					\b, without ID666 tag
+>>0x23	byte	0x1A					\b, with ID666 tag
+>>>0x2E	string	>\0					\b, song "%.32s"
+>>>0x4E	string	>\0					\b, game "%.32s"
+
 # Impulse tracker module (audio/x-it)
 0	string		IMPM		Impulse Tracker module sound data -
 !:mime	audio/x-mod
@@ -606,3 +620,8 @@
 # URL:  http://filext.com/detaillist.php?extdetail=AMR
 # From: Russell Coker <russell@coker.com.au>
 0	string	#!AMR		Adaptive Multi-Rate Codec (GSM telephony)
+
+# Type: SuperCollider 3 Synth Definition File Format
+# From: Mario Lang <mlang@debian.org>
+0	string	SCgf	SuperCollider3 Synth Definition file,
+>4	belong	x	version %d

+ 25 - 0
magic/Magdir/blcr

@@ -0,0 +1,25 @@
+# Berkeley Lab Checkpoint Restart (BLCR) checkpoint context files
+# http://ftg.lbl.gov/checkpoint
+0	string	C\0\0\0R\0\0\0	BLCR
+>16	lelong	1	x86
+>16	lelong	3	alpha
+>16	lelong	5	x86-64
+>16	lelong	7	ARM
+>8	lelong	x	context data (little endian, version %d)
+# Uncomment the following only of your "file" program supports "search"
+#>0	search/1024	VMA\06	for kernel
+#>>&1	byte	x	%d.
+#>>&2	byte	x	%d.
+#>>&3	byte	x	%d
+0	string	\0\0\0C\0\0\0R	BLCR
+>16	belong	2	SPARC
+>16	belong	4	ppc
+>16	belong	6	ppc64
+>16	belong	7	ARMEB
+>16	belong	8	SPARC64
+>8	belong	x	context data (big endian, version %d)
+# Uncomment the following only of your "file" program supports "search"
+#>0	search/1024	VMA\06	for kernel
+#>>&1	byte	x	%d.
+#>>&2	byte	x	\b%d.
+#>>&3	byte	x	\b%d

+ 9 - 0
magic/Magdir/bsi

@@ -0,0 +1,9 @@
+# Chiasmus is a encryption standard developed by the German Federal
+# Office for Information Security (Bundesamt fuer Sicherheit in der
+# Informationstechnik).
+
+# Extension: .xia
+0	string	XIA1	Chiasmus encrypted data
+
+# Extension: .xis
+0	string	XIS	Chiasmus key

+ 49 - 4
magic/Magdir/cad

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: cad,v 1.9 2009/09/19 16:28:08 christos Exp $
+# $File: cad,v 1.10 2010/12/25 14:33:43 christos Exp $
 # autocad:  file(1) magic for cad files
 #
 
@@ -51,9 +51,54 @@
 
 # AutoCad, from Nahuel Greco
 # AutoCAD DWG versions R12/R13/R14 (www.autodesk.com)
-0	string AC1012	AutoCad (release 12)
-0	string AC1013	AutoCad (release 13)
-0	string AC1014	AutoCad (release 14)
+0	string	AC1012		DWG AutoDesk AutoCad (release 12)
+0	string	AC1013		DWG AutoDesk AutoCad (release 13)
+0	string	AC1014		DWG AutoDesk AutoCad (release 14)
+# A new version of AutoCAD DWG
+# Sergey Zaykov (mail_of_sergey@mail.ru, sergey_zaikov@rambler.ru,
+# ICQ 358572321)
+# From various sources like:
+# http://autodesk.blogs.com/between_the_lines/autocad-release-history.html
+0	string	AC1018 		DWG AutoDesk AutoCAD 2004/2005/2006
+0	string	AC1021 		DWG AutoDesk AutoCAD 2007/2008/2009
+0	string	AC1024 		DWG AutoDesk AutoCAD 2010/2011
+
+# KOMPAS 2D drawing from ASCON 
+# This is KOMPAS 2D drawing or fragment of drawing but is not detailed nor
+# gathered nor specification
+# ASCON http://ascon.net/main/ in English,
+#	http://ascon.ru/ main site in Russian
+# Extension is CDW for drawing and FRW for fragment of drawing 
+# Sergey Zaykov (mail_of_sergey@mail.ru, sergey_zaikov@rambler.ru,
+# ICQ 358572321, http://vkontakte.ru/id16076543)
+# From:
+# http://sd.ascon.ru/otrs/customer.pl?Action=CustomerFAQ&CategoryID=4&ItemID=292
+# (in russian) and my experiments
+0	string	KF
+>2	belong	0x4E00000C	Kompas drawing 12.0 SP1 
+>2	belong	0x4D00000C	Kompas drawing 12.0 
+>2	belong	0x3200000B	Kompas drawing 11.0 SP1 
+>2	belong	0x3100000B	Kompas drawing 11.0 
+>2	belong	0x2310000A	Kompas drawing 10.0 SP1 
+>2	belong	0x2110000A	Kompas drawing 10.0 
+>2	belong	0x08000009	Kompas drawing 9.0 SP1 
+>2	belong	0x05000009	Kompas drawing 9.0 
+>2	belong	0x33010008	Kompas drawing 8+ 
+>2	belong	0x1A000008	Kompas drawing 8.0 
+>2	belong	0x2C010107	Kompas drawing 7+ 
+>2	belong	0x05000007	Kompas drawing 7.0 
+>2	belong	0x32000006	Kompas drawing 6+ 
+>2	belong	0x09000006	Kompas drawing 6.0 
+>2	belong	0x5C009005	Kompas drawing 5.11R03 
+>2	belong	0x54009005	Kompas drawing 5.11R02 
+>2	belong	0x51009005	Kompas drawing 5.11R01 
+>2	belong	0x22009005	Kompas drawing 5.10R03 
+>2	belong	0x22009005	Kompas drawing 5.10R02 mar 
+>2	belong	0x21009005	Kompas drawing 5.10R02 febr 
+>2	belong	0x19009005	Kompas drawing 5.10R01 
+>2	belong	0xF4008005	Kompas drawing 5.9R01.003 
+>2	belong	0x1C008005	Kompas drawing 5.9R01.002 
+>2	belong	0x11008005	Kompas drawing 5.8R01.003 
 
 # CAD: file(1) magic for computer aided design files
 # Phillip Griffith <phillip dot griffith at gmail dot com>

+ 6 - 1
magic/Magdir/chord

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: chord,v 1.4 2009/09/19 16:28:08 christos Exp $
+# $File: chord,v 1.5 2010/09/20 19:19:16 rrt Exp $
 # chord: file(1) magic for Chord music sheet typesetting utility input files
 #
 # From Philippe De Muyter <phdm@macqel.be>
@@ -8,3 +8,8 @@
 #
 0	string		{title		Chord text file
 
+# Type:	PowerTab file format
+# URL:	http://www.power-tab.net/
+# From:	Jelmer Vernooij <jelmer@samba.org>
+0	string		ptab\003\000	Power-Tab v3 Tablature File
+0	string		ptab\004\000	Power-Tab v4 Tablature File

+ 46 - 32
magic/Magdir/commands

@@ -1,70 +1,74 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.36 2010/01/24 18:41:11 christos Exp $
+# $File: commands,v 1.41 2011/05/02 12:36:41 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
-#0	string		:			shell archive or script for antique kernel text
-0	string/w	#!\ /bin/sh		POSIX shell script text executable
+#0	string/w	:			shell archive or script for antique kernel text
+0	string/wt	#!\ /bin/sh		POSIX shell script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /bin/csh		C shell script text executable
+0	string/wt	#!\ /bin/csh		C shell script text executable
 !:mime	text/x-shellscript
 # korn shell magic, sent by George Wu, gwu@clyde.att.com
-0	string/w	#!\ /bin/ksh		Korn shell script text executable
+0	string/wt	#!\ /bin/ksh		Korn shell script text executable
 !:mime	text/x-shellscript
-0	string/w 	#!\ /bin/tcsh		Tenex C shell script text executable
+0	string/wt 	#!\ /bin/tcsh		Tenex C shell script text executable
 !:mime	text/x-shellscript
-0	string/w 	#!\ /usr/local/tcsh	Tenex C shell script text executable
+0	string/wt	#!\ /usr/bin/tcsh	Tenex C shell script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/local/bin/tcsh	Tenex C shell script text executable
+0	string/wt 	#!\ /usr/local/tcsh	Tenex C shell script text executable
+!:mime	text/x-shellscript
+0	string/wt	#!\ /usr/local/bin/tcsh	Tenex C shell script text executable
 !:mime	text/x-shellscript
 
 #
 # zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
-0	string/w	#!\ /bin/zsh		Paul Falstad's zsh script text executable
+0	string/wt	#!\ /bin/zsh		Paul Falstad's zsh script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/bin/zsh	Paul Falstad's zsh script text executable
+0	string/wt	#!\ /usr/bin/zsh	Paul Falstad's zsh script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/local/bin/zsh	Paul Falstad's zsh script text executable
+0	string/wt	#!\ /usr/local/bin/zsh	Paul Falstad's zsh script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/local/bin/ash	Neil Brown's ash script text executable
+0	string/wt	#!\ /usr/local/bin/ash	Neil Brown's ash script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/local/bin/ae	Neil Brown's ae script text executable
+0	string/wt	#!\ /usr/local/bin/ae	Neil Brown's ae script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /bin/nawk		new awk script text executable
+0	string/wt	#!\ /bin/nawk		new awk script text executable
 !:mime	text/x-nawk
-0	string/w	#!\ /usr/bin/nawk	new awk script text executable
+0	string/wt	#!\ /usr/bin/nawk	new awk script text executable
 !:mime	text/x-nawk
-0	string/w	#!\ /usr/local/bin/nawk	new awk script text executable
+0	string/wt	#!\ /usr/local/bin/nawk	new awk script text executable
 !:mime	text/x-nawk
-0	string/w	#!\ /bin/gawk		GNU awk script text executable
+0	string/wt	#!\ /bin/gawk		GNU awk script text executable
 !:mime	text/x-gawk
-0	string/w	#!\ /usr/bin/gawk	GNU awk script text executable
+0	string/wt	#!\ /usr/bin/gawk	GNU awk script text executable
 !:mime	text/x-gawk
-0	string/w	#!\ /usr/local/bin/gawk	GNU awk script text executable
+0	string/wt	#!\ /usr/local/bin/gawk	GNU awk script text executable
 !:mime	text/x-gawk
 #
-0	string/w	#!\ /bin/awk		awk script text executable
+0	string/wt	#!\ /bin/awk		awk script text executable
 !:mime	text/x-awk
-0	string/w	#!\ /usr/bin/awk	awk script text executable
+0	string/wt	#!\ /usr/bin/awk	awk script text executable
 !:mime	text/x-awk
-# update to distinguish from *.vcf files
-# this is broken because postscript has /EBEGIN{ for example.
-#0	search/Ww	BEGIN {			awk script text
+0	regex		=^\\s*BEGIN\\s*[{]	awk script text
 
 # AT&T Bell Labs' Plan 9 shell
-0	string/w	#!\ /bin/rc	Plan 9 rc shell script text executable
+0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable
 
 # bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de)
-0	string/w	#!\ /bin/bash	Bourne-Again shell script text executable
+0	string/wt	#!\ /bin/bash	Bourne-Again shell script text executable
+!:mime	text/x-shellscript
+0	string/wt	#!\ /usr/bin/bash	Bourne-Again shell script text executable
+!:mime	text/x-shellscript
+0	string/wt	#!\ /usr/local/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
-0	string/w	#!\ /usr/local/bin/bash	Bourne-Again shell script text executable
+0	string/wt	#!\ /usr/local/bin/bash	Bourne-Again shell script text executable
 !:mime	text/x-shellscript
 
 # using env
-0	string		#!/usr/bin/env		a
->15	string		>\0			%s script text executable
-0	string		#!\ /usr/bin/env	a
->16	string		>\0			%s script text executable
+0	string/t	#!/usr/bin/env		a
+>15	string/t	>\0			%s script text executable
+0	string/t	#!\ /usr/bin/env	a
+>16	string/t	>\0			%s script text executable
 
 # PHP scripts
 # Ulf Harnhammar <ulfh@update.uu.se>
@@ -78,7 +82,17 @@
 !:mime	text/x-php
 0	search/1/w	#!\ /usr/bin/php	PHP script text executable
 !:mime	text/x-php
+# Smarty compiled template, http://www.smarty.net/
+# Elan Ruusamäe <glen@delfi.ee>
+0	string	=<?php\ /*\ Smarty\ version	Smarty compiled template
+>24	regex	[0-9.]+				\b, version %s
+!:mime	text/x-php
 
 0	string		Zend\x00		PHP script Zend Optimizer data
 
-0	string		$!			DCL command file
+0	string/t	$!			DCL command file
+
+# Type: Pdmenu
+# URL:  http://packages.debian.org/pdmenu
+# From: Edward Betts <edward@debian.org>
+0	string		#!/usr/bin/pdmenu	Pdmenu configuration file text

+ 24 - 14
magic/Magdir/compress

@@ -1,6 +1,5 @@
-
 #------------------------------------------------------------------------------
-# $File: compress,v 1.42 2009/09/19 16:28:08 christos Exp $
+# $File: compress,v 1.47 2011/03/08 00:39:46 christos Exp $
 # compress:  file(1) magic for pure-compression formats (no archives)
 #
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -20,7 +19,7 @@
 #   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).
+#         other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
 !:mime	application/x-gzip
 >2	byte		<8		\b, reserved method
@@ -183,23 +182,29 @@
 >4	belong		0x090A0C0D	best compression
 
 # 7-zip archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at)
-# http://www.7-zip.org or DOC/7zFormat.txt 
+# http://www.7-zip.org or DOC/7zFormat.txt
 #
 0	string		7z\274\257\047\034	7-zip archive data,
 >6	byte		x			version %d
 >7	byte		x			\b.%d
+!:mime	application/x-7z-compressed
 
 # Type: LZMA
-# URL:  http://www.7-zip.org/sdk.html
-# From: Robert Millan <rmh@aybabtu.com> and Reuben Thomas <rrt@sc3d.org>
-# Commented out because apparently not reliable (according to Debian
-# bug #364260)
-#0	string		]\000\000\200\000	LZMA compressed data
+0	lelong		0x8000005d		LZMA compressed data,
+>5	lequad		=0xffffffffffffffff	streamed
+>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
+!:mime	application/x-lzma
 
 # http://tukaani.org/xz/xz-file-format.txt
-0	ustring		\xFD7zXZ\x00		xz compressed data
+0	ustring		\xFD7zXZ\x00		XZ compressed data
 !:mime	application/x-xz
 
+# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
+0	string		LRZI			LRZIP compressed data
+>4	byte		x			- version %d
+>5	byte		x			\b.%d
+!:mime	application/x-lrzip
+
 # AFX compressed files (Wolfram Kleff)
 2	string		-afx-		AFX compressed file data
 
@@ -214,7 +219,12 @@
 >5	byte		x		\b.%d
 >6	belong		x		(%d bytes)
 
-# Type: XZ
-# URL: http://tukaani.org/xz/
-0	string		\xfd\x37\x7a\x58\x5a\x00	XZ compressed data
-!:mime application/x-xz
+0	string		ArC\x01		FreeArc archive <http://freearc.org>
+
+# Type:	DACT compressed files
+0	long	0x444354C3	DACT compressed data
+>4	byte	>-1		(version %i.
+>5	byte	>-1		%i.
+>6	byte	>-1		%i)
+>7	long	>0		, original size: %i bytes
+>15	long	>30		, block size: %i bytes

+ 12 - 4
magic/Magdir/console

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: console,v 1.16 2009/09/19 16:28:08 christos Exp $
+# $File: console,v 1.18 2010/09/20 19:19:17 rrt Exp $
 # Console game magic
 # Toby Deshane <hac@shoelace.digivill.net>
 #    ines:  file(1) magic for Marat's iNES Nintendo Entertainment System
@@ -165,9 +165,13 @@
 # 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
+# Double-check that the image type matches too, 0x8008 conflicts with
+# 8 character OMF-86 object file headers.
+0	beshort		0x8008		
+>6	string		BS93		Lynx homebrew cartridge
+>>2	beshort		x		\b, RAM start $%04x
+>6	string		LYNX		Lynx cartridge
+>>2	beshort		x		\b, RAM start $%04x
 
 # Opera file system that is used on the 3DO console
 # From: Serge van den Boom <svdb@stack.nl>
@@ -254,3 +258,7 @@
 >>>(0x18.l-26)	lelong		x	CRC32 0x%08x
 >>>(0x18.l-23)	string		x	"%s"
 
+# Type: scummVM savegame files
+# From: Sven Hartge <debian@ds9.argh.org>
+0	string	SCVM	ScummVM savegame
+>12	string	>\0	"%s"

+ 20 - 1
magic/Magdir/database

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: database,v 1.24 2009/09/19 16:28:08 christos Exp $
+# $File: database,v 1.26 2010/12/26 23:10:59 christos Exp $
 # database:  file(1) magic for various databases
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@@ -268,3 +268,22 @@
 >40	lequad		x			\b, bnum=%lld
 >48	lequad		x			\b, rnum=%lld
 >56	lequad		x			\b, fsiz=%lld
+
+# G-IR database made by gobject-introspect toolset,
+# http://live.gnome.org/GObjectIntrospection
+0	string		GOBJ\nMETADATA\r\n\032	G-IR binary database
+>16	byte		x			\b, v%d
+>17	byte		x			\b.%d
+>20	leshort		x			\b, %d entries
+>22	leshort		x			\b/%d local
+
+# Type:	QDBM Quick Database Manager
+# From:	Benoit Sibaud <bsibaud@april.org>
+0	string		\\[depot\\]\n\f		Quick Database Manager, little endian
+0	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
+
+# Type:	TokyoCabinet database
+# URL:	http://tokyocabinet.sourceforge.net/
+# From:	Benoit Sibaud <bsibaud@april.org>
+0	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
+>14	string		x			(version %s)

+ 12 - 2
magic/Magdir/diff

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: diff,v 1.10 2009/09/19 16:28:08 christos Exp $
+# $File: diff,v 1.12 2010/12/07 16:52:52 christos Exp $
 # diff:  file(1) magic for diff(1) output
 #
 0	search/1	diff\ 		diff output text
@@ -16,4 +16,14 @@
 !:mime	text/x-diff
 
 # bsdiff:  file(1) magic for bsdiff(1) output
-0	string		BSDIFF40	bsdiff(1) patch file
+0	string/t		BSDIFF40	bsdiff(1) patch file
+
+
+# unified diff
+0	search/4096	---\ 
+>&0	search/1024 \n
+>>&0	search/1 +++\ 
+>>>&0	search/1024 \n
+>>>>&0	search/1 @@	unified diff output text
+!:mime	text/x-diff
+!:strength + 90

+ 30 - 16
magic/Magdir/digital

@@ -1,26 +1,40 @@
 
 #------------------------------------------------------------------------------
-# $File: digital,v 1.8 2009/09/19 16:28:08 christos Exp $
+# $File: digital,v 1.10 2011/05/03 01:44:17 christos Exp $
 #  Digital UNIX - Info
 #
 0	string	=!<arch>\n________64E	Alpha archive
 >22	string	X			-- out of date
 #
-# Alpha COFF Based Executables
-# The stripped stuff really needs to be an 8 byte (64 bit) compare,
-# but this works
-0	leshort		0x183		COFF format alpha
->22	leshort&020000	&010000		sharable library,
->22	leshort&020000	^010000		dynamically linked,
->24	leshort		0410		pure
->24	leshort		0413		demand paged
->8	lelong		>0		executable or object module, not stripped
->8	lelong		0
->>12	lelong		0		executable or object module, stripped
->>12	lelong		>0		executable or object module, not stripped
->27     byte            >0              - version %d.
->26     byte            >0              %d-
->28     leshort         >0              %d
+
+0	leshort		0603
+>>24	leshort		0410		COFF format alpha pure
+>>24	leshort		0413		COFF format alpha demand paged
+>>>22	leshort&030000	!020000		executable
+>>>22	leshort&020000	!0		dynamically linked
+>>>16	lelong		!0		not stripped
+>>>16	lelong		0		stripped
+>>>27	byte		x		- version %d
+>>>26	byte		x		\b.%d
+>>>28	byte		x		\b-%d
+>>24	leshort		0407		COFF format alpha object
+>>>22	leshort&030000	020000		shared library
+>>>27	byte		x		- version %d
+>>>26	byte		x		\b.%d
+>>>28	byte		x		\b-%d
+
+# Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk>
+#
+# The actual magic number is just "Core", followed by a 2-byte version
+# number; however, treating any file that begins with "Core" as a Digital
+# UNIX core dump file may produce too many false hits, so we include one
+# byte of the version number as well; DU 5.0 appears only to be up to
+# version 2.
+#
+0	string		Core\001	Alpha COFF format core dump (Digital UNIX)
+>24	string		>\0		\b, from '%s'
+0	string		Core\002	Alpha COFF format core dump (Digital UNIX)
+>24	string		>\0		\b, from '%s'
 #
 # The next is incomplete, we could tell more about this format,
 # but its not worth it.

+ 35 - 2
magic/Magdir/dyadic

@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: dyadic,v 1.4 2009/09/19 16:28:09 christos Exp $
+# $File: dyadic,v 1.5 2010/09/20 18:55:20 rrt Exp $
 # Dyadic: file(1) magic for Dyalog APL.
 #
-0 	byte	0xaa
+0	byte	0xaa
 >1	byte	<4		Dyalog APL
 >>1	byte	0x00		incomplete workspace
 >>1	byte	0x01		component file
@@ -11,3 +11,36 @@
 >>1	byte	0x03		workspace
 >>2	byte	x		version %d
 >>3	byte	x		.%d
+
+0	beshort		0xaa03		Dyalog APL
+>2	byte		x		workspace type %d
+>3	byte		x		subtype %d
+>7	byte&0x28	0x00		32-bit
+>7	byte&0x28	0x20		64-bit
+>7	byte&0x0c	0x00		classic
+>7	byte&0x0c	0x04		unicode
+>7	byte&0x88	0x00		big-endian
+>7	byte&0x88	0x80		little-endian
+
+0	byte		0xaa		Dyalog APL
+>1	byte		0x00		aplcore
+>1	byte		0x01		component file 32-bit non-journaled non-checksummed
+>1	byte		0x02		external variable exclusive
+>1	byte		0x06		external variable shared
+>1	byte		0x07		session
+>1	byte		0x08		mapped file 32-bit
+>1	byte		0x09		component file 64-bit non-journaled non-checksummed
+>1	byte		0x0a		mapped file 64-bit
+>1	byte		0x0b		component file 32-bit level 1 journaled non-checksummed
+>1	byte		0x0c		component file 64-bit level 1 journaled non-checksummed
+>1	byte		0x0d		component file 32-bit level 1 journaled checksummed
+>1	byte		0x0e		component file 64-bit level 1 journaled checksummed
+>1	byte		0x0f		component file 32-bit level 2 journaled checksummed
+>1	byte		0x10		component file 64-bit level 2 journaled checksummed
+>1	byte		0x11		component file 32-bit level 3 journaled checksummed
+>1	byte		0x12		component file 64-bit level 3 journaled checksummed
+>1	byte		0x13		component file 32-bit non-journaled checksummed
+>1	byte		0x14		component file 64-bit non-journaled checksummed
+>1	byte		0x80		DDB
+
+0	short		0x6060		Dyalog APL transfer

+ 8 - 0
magic/Magdir/ebml

@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: ebml,v 1.1 2010/07/02 00:07:03 christos Exp $
+# ebml:  file(1) magic for various Extensible Binary Meta Language
+# http://www.matroska.org/technical/specs/index.html#track
+0	belong	0x1a45dfa3	EBML file
+>4	search/b/100	\102\202
+>>&1	string	x		\b, creator %.8s

+ 3 - 1
magic/Magdir/erlang

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: erlang,v 1.5 2009/09/19 16:28:09 christos Exp $
+# $File: erlang,v 1.6 2010/09/20 19:19:17 rrt Exp $
 # erlang:  file(1) magic for Erlang JAM and BEAM files
 # URL:  http://www.erlang.org/faq/x779.html#AEN812
 
@@ -17,3 +17,5 @@
 79	string	Tue\ Jan\ 22\ 14:32:44\ MET\ 1991	Erlang JAM file - version 4.2
 
 4	string	1.0\ Fri\ Feb\ 3\ 09:55:56\ MET\ 1995	Erlang JAM file - version 4.3
+
+0	bequad	0x0000000000ABCDEF	Erlang DETS file

+ 111 - 32
magic/Magdir/filesystems

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.55 2010/01/16 17:45:12 chl Exp $
+# $File: filesystems,v 1.61 2011/01/10 14:01:10 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
@@ -884,15 +884,19 @@
 
 # Minix filesystems - Juan Cespedes <cespedes@debian.org>
 0x410	leshort		0x137f
+!:strength / 2
 >0x402	beshort		< 100		Minix filesystem, V1, %d zones
 >0x1e	string		minix		\b, bootable
 0x410	beshort		0x137f
+!:strength / 2
 >0x402	beshort		< 100		Minix filesystem, V1 (big endian), %d zones
 >0x1e	string		minix		\b, bootable
 0x410	leshort		0x138f
+!:strength / 2
 >0x402	beshort		< 100		Minix filesystem, V1, 30 char names, %d zones
 >0x1e	string		minix		\b, bootable
 0x410	beshort		0x138f
+!:strength / 2
 >0x402	beshort		< 100		Minix filesystem, V1, 30 char names (big endian), %d zones
 >0x1e	string		minix		\b, bootable
 0x410	leshort		0x2468
@@ -1109,6 +1113,8 @@
 
 # ext2/ext3 filesystems - Andreas Dilger <adilger@dilger.ca>
 # ext4 filesystem - Eric Sandeen <sandeen@sandeen.net>
+# volume label and UUID Russell Coker
+# http://etbe.coker.com.au/2008/07/08/label-vs-uuid-vs-device/
 0x438   leshort         0xEF53          Linux
 >0x44c  lelong          x               rev %d
 >0x43e  leshort         x               \b.%d
@@ -1124,25 +1130,32 @@
 #   else large RO_COMPAT?
 >>>0x464 lelong         >0x0000007      ext4 filesystem data
 #  else large INCOMPAT?
->>0x460 lelong          >0x000003f      ext4 filesystem data
+>>0x460	lelong          >0x000003f      ext4 filesystem data
+>0x468	belong		x		\b, UUID=%08x
+>0x46c	beshort		x		\b-%04x
+>0x46e	beshort		x		\b-%04x
+>0x470	beshort		x		\b-%04x
+>0x472	belong		x		\b-%08x
+>0x476	beshort		x		\b%04x
+>0x478	string		>0		\b, volume name "%s"
 # General flags for any ext* fs
->0x460  lelong          &0x0000004      (needs journal recovery)
->0x43a  leshort         &0x0000002      (errors)
+>0x460	lelong          &0x0000004      (needs journal recovery)
+>0x43a	leshort         &0x0000002      (errors)
 # INCOMPAT flags
->0x460  lelong          &0x0000001      (compressed)
-#>0x460 lelong          &0x0000002      (filetype)
-#>0x460 lelong          &0x0000010      (meta bg)
->0x460  lelong          &0x0000040      (extents)
->0x460  lelong          &0x0000080      (64bit)
-#>0x460 lelong          &0x0000100      (mmp)
-#>0x460 lelong          &0x0000200      (flex bg)
+>0x460	lelong          &0x0000001      (compressed)
+#>0x460	lelong          &0x0000002      (filetype)
+#>0x460	lelong          &0x0000010      (meta bg)
+>0x460	lelong          &0x0000040      (extents)
+>0x460	lelong          &0x0000080      (64bit)
+#>0x460	lelong          &0x0000100      (mmp)
+#>0x460	lelong          &0x0000200      (flex bg)
 # RO_INCOMPAT flags
-#>0x464 lelong          &0x0000001      (sparse super)
->0x464  lelong          &0x0000002      (large files)
->0x464  lelong          &0x0000008      (huge files)
-#>0x464 lelong          &0x0000010      (gdt checksum)
-#>0x464 lelong          &0x0000020      (many subdirs)
-#>0x463 lelong          &0x0000040      (extra isize)
+#>0x464	lelong          &0x0000001      (sparse super)
+>0x464	lelong          &0x0000002      (large files)
+>0x464	lelong          &0x0000008      (huge files)
+#>0x464	lelong          &0x0000010      (gdt checksum)
+#>0x464	lelong          &0x0000020      (many subdirs)
+#>0x463	lelong          &0x0000040      (extra isize)
 
 # SGI disk labels - Nathan Scott <nathans@debian.org>
 0	belong		0x0BE5A941	SGI disk label (volume header)
@@ -1220,7 +1233,7 @@
 
 # CDROM Filesystems
 # Modified for UDF by gerardo.cacciari@gmail.com
-32769	string    CD001
+32769	string    CD001     #
 !:mime	application/x-iso9660-image
 >38913	string   !NSR0      ISO 9660 CD-ROM filesystem data
 >38913	string    NSR0      UDF filesystem data
@@ -1263,6 +1276,7 @@
 # reiserfs - russell@coker.com.au
 0x10034		string	ReIsErFs	ReiserFS V3.5
 0x10034		string	ReIsEr2Fs	ReiserFS V3.6
+0x10034		string	ReIsEr3Fs	ReiserFS V3.6.19
 >0x1002c 	leshort	x		block size %d
 >0x10032	leshort	&2		(mounted or unclean)
 >0x10000	lelong	x		num blocks %d
@@ -1359,28 +1373,46 @@
 >28	beshort <3
 >>8	belong	x	%d bytes,
 >28	beshort >2
->>63	bequad x	%lld bytes,
+>>28 beshort <4
+>>>63	bequad x	%lld bytes,
+>>28 beshort >3
+>>>40	bequad x	%lld bytes,
 #>>67	belong	x	%d bytes,
 >4	belong	x	%d inodes,
 >28	beshort <2
 >>32	beshort	x	blocksize: %d bytes,
 >28	beshort >1
->>51	belong	x	blocksize: %d bytes,
->39	bedate	x	created: %s
+>>28 beshort <4
+>>>51	belong	x	blocksize: %d bytes,
+>>28 beshort >3
+>>>12	belong	x	blocksize: %d bytes,
+>28 beshort <4
+>>39	bedate	x	created: %s
+>28 beshort >3
+>>8	bedate	x	created: %s
 0	string	hsqs	Squashfs filesystem, little endian,
 >28	leshort	x	version %d.
 >30	leshort	x	\b%d,
 >28	leshort <3
 >>8	lelong	x	%d bytes,
 >28	leshort >2
->>63	lequad x	%lld bytes,
+>>28 leshort <4
+>>>63	lequad x	%lld bytes,
+>>28 leshort >3
+>>>40	lequad x	%lld bytes,
 #>>63	lelong	x	%d bytes,
 >4	lelong	x	%d inodes,
 >28	leshort <2
 >>32	leshort	x	blocksize: %d bytes,
 >28	leshort >1
->>51	lelong	x	blocksize: %d bytes,
->39	ledate	x	created: %s
+>>28 leshort <4
+>>>51	lelong	x	blocksize: %d bytes,
+>>28 leshort >3
+>>>12	lelong	x	blocksize: %d bytes,
+>28 leshort <4
+>>39	ledate	x	created: %s
+>28 leshort >3
+>>8	ledate	x	created: %s
 
 0	string		td\000		floppy image data (TeleDisk)
 
@@ -1447,13 +1479,17 @@
 0	string	CPQRFBLO	Compaq/HP RILOE floppy image
 
 #------------------------------------------------------------------------------
-# Files-11 On-Disk Structure (OpenVMS file system) - gerardo.cacciari@gmail.com
-# These bits come from LBN 1 (home block) of ODS-2 and ODS-5 volumes, which is
-# mapped to VBN 2 of [000000]INDEXF.SYS;1
+# Files-11 On-Disk Structure (File system for various RSX-11 and VMS flavours).
+# These bits come from LBN 1 (home block) of ODS-1, ODS-2 and ODS-5 volumes,
+# which is mapped to VBN 2 of [000000]INDEXF.SYS;1 - gerardo.cacciari@gmail.com
 #
-1008    string          DECFILE11B      Files-11 On-Disk Structure
+1008    string          DECFILE11       Files-11 On-Disk Structure
 >525    byte            x               Level %d
->525    byte            x               (ODS-%d OpenVMS file system),
+>525    byte            x               (ODS-%d);
+>1017   string          A               RSX-11, VAX/VMS or OpenVMS VAX file system;
+>1017   string          B
+>>525   byte            2               VAX/VMS or OpenVMS file system;
+>>525   byte            5               OpenVMS Alpha or Itanium file system;
 >984    string          x               volume label is '%-12.12s'
 
 # From: Thomas Klausner <wiz@NetBSD.org>
@@ -1468,9 +1504,13 @@
 
 # From Eric Sandeen
 # GFS2
-0x10000         belong          0x01161970      GFS2 Filesystem
->0x10024        belong          x               (blocksize %d,
->0x10060        string          >\0             lockproto %s)
+0x10000         belong          0x01161970
+>0x10018        belong          0x0000051d      GFS1 Filesystem
+>>0x10024        belong          x               (blocksize %d,
+>>0x10060        string          >\0             lockproto %s)
+>0x10018        belong          0x00000709      GFS2 Filesystem
+>>0x10024        belong          x               (blocksize %d,
+>>0x10060        string          >\0             lockproto %s)
 
 # BTRFS
 0x10040         string          _BHRfS_M        BTRFS Filesystem
@@ -1490,3 +1530,42 @@
 0	string XFSM
 >0x200	string XFSB	XFS filesystem metadump image
 
+# Type:	CROM filesystem
+# From:	Werner Fink <werner@suse.de>
+0	string	CROMFS	CROMFS
+>6	string	>\0	\b version %2.2s,
+>8	ulequad	>0	\b block data at %lld,
+>16	ulequad	>0	\b fblock table at %lld,
+>24	ulequad	>0	\b inode table at %lld,
+>32	ulequad	>0	\b root at %lld,
+>40	ulelong	>0	\b fblock size = %ld,
+>44	ulelong	>0	\b block size = %ld,
+>48	ulequad	>0	\b bytes = %lld
+
+# Type:	xfs metadump image
+# From:	Daniel Novotny <dnovotny@redhat.com>
+# mb_magic XFSM at 0; superblock magic XFSB at 1 << mb_blocklog
+# but can we do the << ? For now it's always 512 (0x200) anyway.
+0	string	XFSM
+>0x200	string	XFSB	XFS filesystem metadump image
+
+# Type:	delta ISO
+# From:	Daniel Novotny <dnovotny@redhat.com>
+0	string	DISO	Delta ISO data,
+>4	belong	x	version %d
+
+# JFS2 (Journaling File System) image. (Old JFS1 has superblock at 0x1000.)
+# See linux/fs/jfs/jfs_superblock.h for layout; see jfs_filsys.h for flags.
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+0x8000	string	JFS1
+# Because it's text-only magic, check a binary value (version) to be sure.
+# Should always be 2, but mkfs.jfs writes it as 1. Needs to be 2 or 1 to be
+# mountable.
+>&0	lelong	<3	JFS2 filesystem image
+# Label is followed by a UUID; we have to limit string length to avoid
+# appending the UUID in the case of a 16-byte label.
+>>&144	regex	[\x20-\x7E]{1,16}	(label "%s")
+>>&0	lequad	x	\b, %lld blocks
+>>&8	lelong	x	\b, blocksize %d
+>>&32	lelong&0x00000006	>0	(dirty)
+>>&36	lelong	>0	(compressed)

+ 13 - 1
magic/Magdir/fonts

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.21 2009/12/06 23:17:52 rrt Exp $
+# $File: fonts,v 1.23 2010/09/20 18:55:20 rrt Exp $
 # fonts:  file(1) magic for font data
 #
 0	search/1	FONT		ASCII vfont text
@@ -61,7 +61,15 @@
 0	string		\007\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
 0	string		\012\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
 
+# TrueType/OpenType font collections (.ttc)
+# http://www.microsoft.com/typography/otspec/otff.htm
 0	string		ttcf		TrueType font collection data
+>4	belong		0x00010000	\b, 1.0
+>>8	belong		>0		\b, %d fonts
+>4	belong		0x00020000	\b, 2.0
+>>8	belong		>0		\b, %d fonts
+# 0x44454947 = 'DSIG'
+>>>16	belong		0x44534947	\b, digitally signed
 
 # Opentype font data from Avi Bercovich
 0	string		OTTO		OpenType font data
@@ -71,3 +79,7 @@
 0	string		SplineFontDB:	Spline Font Database 
 !:mime application/vnd.font-fontforge-sfd
 >14	string		x		version %s
+
+# EOT
+34	string		LP		Embedded OpenType (EOT)
+!:mime application/vnd.ms-fontobject

+ 19 - 9
magic/Magdir/games

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: games,v 1.8 2009/09/19 16:28:09 christos Exp $
+# $File: games,v 1.12 2010/11/25 15:00:12 christos Exp $
 # games:  file(1) for games
 
 # Fabio Bonelli <fabiobonelli@libero.it>
@@ -35,6 +35,7 @@
 # Quake
 
 0       string  PACK    Quake I or II world or extension
+>8	lelong	>0	\b, %d entries
 
 #0       string  -1\x0a  Quake I demo
 #>30     string  x        version %.4s
@@ -154,6 +155,11 @@
 0	string	=PWAD		doom patch PWAD data
 >4	lelong	x		containing %d lumps
 
+# Build engine group files (Duke Nukem, Shadow Warrior, ...)
+# Extension: .grp
+# Created by: "Ganael Laplanche" <ganael.laplanche@martymac.org>
+0	string	KenSilverman	Build engine group file
+>12	lelong	x		containing %d files
 
 # Summary: Warcraft 3 save
 # Extension: .w3g
@@ -174,7 +180,7 @@
 # Modified by (1): Abel Cheung (regex, more game format)
 # FIXME: Some games don't have GM (game type)
 0	regex		\\(;.*GM\\[[0-9]{1,2}\\]	Smart Game Format
->2	search/0x200	GM[
+>2	search/0x200/b	GM[
 >>&0	string		1]	(Go)
 >>&0	string		2]	(Othello)
 >>&0	string		3]	(chess)
@@ -216,13 +222,6 @@
 >>&0	string		39]	(Gipf)
 >>&0	string		40]	(Kropki)
 
-
-# Summary: Civilization 4 video
-# Extension: .bik
-# Created by: Abel Cheung <abelcheung@gmail.com>
-0	string	BIKi	Civilization 4 Video
-
-
 ##############################################
 # NetImmerse/Gamebryo game engine entries
 
@@ -245,3 +244,14 @@
 >&0		string		n\ 					NetImmerse game engine file
 >>&0		regex		[0-9a-z.]+				\b, version %s
 
+# Type:	SGF Smart Game Format
+# URL:	http://www.red-bean.com/sgf/
+# From:	Eduardo Sabbatella <eduardo_sabbatella@yahoo.com.ar>
+2	regex/c	\\(;.*GM\\[[0-9]{1,2}\\]	Smart Game Format
+>2	regex/c	GM\\[1\\]			- Go Game
+>2	regex/c	GM\\[6\\]			- BackGammon Game
+>2	regex/c	GM\\[11\\]			- Hex Game
+>2	regex/c	GM\\[18\\]			- Amazons Game
+>2	regex/c	GM\\[19\\]			- Octi Game
+>2	regex/c	GM\\[20\\]			- Gess Game
+>2	regex/c	GM\\[21\\]			- twix Game

+ 105 - 0
magic/Magdir/geo

@@ -0,0 +1,105 @@
+
+#------------------------------------------------------------------------------
+# $File: geo,v 1.1 2010/02/23 23:40:07 christos Exp $
+# Geo- files from Kurt Schwehr <schwehr@ccom.unh.edu>
+
+######################################################################
+#
+# Acoustic Doppler Current Profilers (ADCP)
+#
+######################################################################
+
+0	beshort	0x7f7f	RDI Acoustic Doppler Current Profiler (ADCP)
+
+######################################################################
+#
+# Metadata
+#
+######################################################################
+
+0	string	Identification_Information	FGDC ASCII metadata
+
+######################################################################
+#
+# Seimsic / Subbottom
+#
+######################################################################
+
+# Knudsen subbottom chirp profiler - Binary File Format: B9
+# KEB D409-03167 V1.75 Huffman
+0	string	KEB\ 	Knudsen seismic KEL binary (KEB) -
+>4	regex	[-A-Z0-9]*	Software: %s
+>>&1	regex	V[0-9]*\.[0-9]*	version %s
+
+######################################################################
+#
+# LIDAR - Laser altimetry or bathy
+#
+######################################################################
+
+
+# Caris LIDAR format for LADS comes as two parts... ascii location file and binary waveform data
+0	string	HCA	LADS Caris Ascii Format (CAF) bathymetric lidar
+>4	regex [0-9]*\.[0-9]*	version %s
+
+0	string	HCB	LADS Caris Binary Format (CBF) bathymetric lidar waveform data
+>3      byte    x	version %d .
+>4	byte	x	%d
+
+
+######################################################################
+#
+# MULTIBEAM SONARS http://www.ldeo.columbia.edu/res/pi/MB-System/formatdoc/
+#
+######################################################################
+
+# GeoAcoustics - GeoSwath Plus
+4	beshort	0x2002	GeoSwath RDF
+0	string	Start:-	GeoSwatch auf text file
+
+# Seabeam 2100 
+# mbsystem code mb41
+0	string SB2100	SeaBeam 2100 multibeam sonar
+0	string SB2100DR	SeaBeam 2100 DR multibeam sonar
+0	string SB2100PR SeaBeam 2100 PR multibeam sonar
+
+# This corresponds to MB-System format 94, L-3/ELAC/SeaBeam XSE vendor
+# format. It is the format of our upgraded SeaBeam 2112 on R/V KNORR.
+0    string $HSF    XSE multibeam
+
+# mb121 http://www.saic.com/maritime/gsf/
+8	string	GSF-v	SAIC generic sensor format (GSF) sonar data,
+>&0	regex [0-9]*\.[0-9]*	version %s
+
+# MGD77 - http://www.ngdc.noaa.gov/mgg/dat/geodas/docs/mgd77.htm
+# mb161
+9	string MGD77	MGD77 Header, Marine Geophysical Data Exchange Format
+
+# MBSystem processing caches the mbinfo output
+1	string	Swath\ Data\ File:	mbsystem info cache
+
+# Caris John Hughes Clark format
+0	string	HDCS	Caris multibeam sonar related data
+1	string	Start/Stop\ parameter\ header:	Caris ASCII project summary
+
+######################################################################
+#
+# Visualization and 3D modeling
+#
+######################################################################
+
+# IVS - IVS3d.com Tagged Data Represetation
+0	string	%%\ TDR\ 2.0	IVS Fledermaus TDR file
+
+# http://www.ecma-international.org/publications/standards/Ecma-363.htm
+# 3D in PDFs
+0	string	U3D	ECMA-363, Universal 3D
+
+######################################################################
+#
+# Support files
+#
+######################################################################
+
+# https://midas.psi.ch/elog/
+0	string	$@MID@$	elog journal entry

+ 2 - 1
magic/Magdir/gimp

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: gimp,v 1.6 2009/09/19 16:28:09 christos Exp $
+# $File: gimp,v 1.7 2010/09/20 18:55:20 rrt Exp $
 # GIMP Gradient: file(1) magic for the GIMP's gradient data files
 # by Federico Mena <federico@nuclecu.unam.mx>
 
@@ -12,6 +12,7 @@
 #       ('Bucky' LaDieu, nega@vt.edu)
 
 0	string		gimp\ xcf	GIMP XCF image data,
+!:mime	image/x-xcf
 >9	string		file		version 0,
 >9	string		v		version
 >>10	string		>\0		%s,

+ 111 - 13
magic/Magdir/images

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.64 2009/12/06 00:38:50 christos Exp $
+# $File: images,v 1.70 2010/11/25 15:00:12 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
@@ -34,7 +34,7 @@
 # The next byte following the magic is always whitespace.
 0	search/1	P1		Netpbm PBM image text
 !:mime	image/x-portable-bitmap
-0	search/1	P2		Netpbm PGM image text
+0	search/1b	P2		Netpbm PGM image text
 !:mime	image/x-portable-greymap
 0	search/1	P3		Netpbm PPM image text
 !:mime	image/x-portable-pixmap
@@ -63,6 +63,25 @@
 0	string		IIN1		NIFF image data
 !:mime	image/x-niff
 
+# Canon RAW version 1 (CRW) files are a type of Canon Image File Format
+# (CIFF) file. These are apparently all little-endian.
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# URL: http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
+0	string		II\x1a\0\0\0HEAPCCDR	Canon CIFF raw image data
+!:mime	image/x-canon-crw
+>16	leshort		x	\b, version %d.
+>14	leshort		x	\b%d
+
+# Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
+# number. Put this above the TIFF test to make sure we detect them.
+# These are apparently all little-endian.
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# URL: http://libopenraw.freedesktop.org/wiki/Canon_CR2
+0	string		II\x2a\0\x10\0\0\0CR	Canon CR2 raw image data
+!:mime	image/x-canon-cr2
+>10	byte		x	\b, version %d.
+>11	byte		x	\b%d
+
 # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
 # The second word of TIFF files is the TIFF version number, 42, which has
 # never changed.  The TIFF specification recommends testing for it.
@@ -310,11 +329,20 @@
 #   As described in /usr/X11R6/include/X11/XWDFile.h
 #   used by the xwd program.
 #   Bradford Castalia, idaeim, 1/01
-4	belong	7			XWD X Window Dump image data
->100	string	>\0			\b, "%s"
->16	belong	x			\b, %dx
->20	belong	x			\b%dx
->12	belong	x			\b%d
+#   updated by Adam Buchbinder, 2/09
+# The following assumes version 7 of the format; the first long is the length
+# of the header, which is at least 25 4-byte longs, and the one at offset 8
+# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
+# which is a maximum of 32.
+0	belong	>100
+>8	belong	<3
+>>12	belong	<33
+>>>4	belong	7			XWD X Window Dump image data
+!:mime	image/x-xwindowdump
+>>>>100	string	>\0			\b, "%s"
+>>>>16	belong	x			\b, %dx
+>>>>20	belong	x			\b%dx
+>>>>12	belong	x			\b%d
 
 # PDS - Planetary Data System
 #   These files use Parameter Value Language in the header section.
@@ -551,11 +579,16 @@
 # Bio-Rad .PIC is an image format used by microscope control systems
 # and related image processing software used by biologists.
 # From: Vebjorn Ljosa <vebjorn@ljosa.com>
-54	leshort 12345		Bio-Rad .PIC Image File
->0	leshort >0		%hd x
->2	leshort >0		%hd,
->4	leshort =1		1 image in file
->4	leshort >1		%hd images in file
+# BOOL values are two-byte integers; use them to rule out false positives.
+# http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
+# Samples: http://www.loci.wisc.edu/software/sample-data
+14	leshort <2
+>62	leshort <2
+>>54	leshort 12345		Bio-Rad .PIC Image File
+>>>0	leshort >0		%hd x
+>>>2	leshort >0		%hd,
+>>>4	leshort =1		1 image in file
+>>>4	leshort >1		%hd images in file
 
 # From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
 # The description of *.mrw format can be found at
@@ -590,7 +623,7 @@
 # specifications at http://hdf.ncsa.uiuc.edu/
 0	belong	0x0e031301	Hierarchical Data Format (version 4) data
 !:mime	application/x-hdf
-0	string	\211HDF\r\n\032	Hierarchical Data Format (version 5) data
+0	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
 !:mime	application/x-hdf
 
 # From: Tobias Burnus <burnus@net-b.de>
@@ -630,3 +663,68 @@
 # JPEG 2000 Code Stream Bitmap
 # From Petr Splichal <psplicha@redhat.com>
 0	string	\xFF\x4F\xFF\x51\x00	JPEG-2000 Code Stream Bitmap data
+
+# From: Rick Richardson <rick.richardson@comcast.net>
+0	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
+
+# Type:	Ulead Photo Explorer5 (.pe5)
+# URL:	http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
+# From:	Simon Horman <horms@debian.org>
+0	string	IIO2H			Ulead Photo Explorer5
+
+# Type:	X11 cursor
+# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
+# From:	Mathias Brodala <info@noctus.net>
+0	string	Xcur			X11 cursor
+
+# Type:	Olympus ORF raw images.
+# URL:	http://libopenraw.freedesktop.org/wiki/Olympus_ORF
+# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
+0	string		MMOR		Olympus ORF raw image data, big-endian
+!:mime	image/x-olympus-orf
+0	string		IIRO		Olympus ORF raw image data, little-endian
+!:mime	image/x-olympus-orf
+0	string		IIRS		Olympus ORF raw image data, little-endian
+!:mime	image/x-olympus-orf
+
+# Type: files used in modern AVCHD camcoders to store clip information
+# Extension: .cpi
+# From: Alexander Danilov <alexander.a.danilov@gmail.com>
+0	string	HDMV0100	AVCHD Clip Information
+
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
+# Radiance HDR; usually has .pic or .hdr extension.
+0	string	#?RADIANCE\n	Radiance HDR image data
+#!mime	image/vnd.radiance
+
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# URL: http://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
+# Used by the pfstools packages. The regex matches for the image size could
+# probably use some work. The MIME type is made up; if there's one in
+# actual common use, it should replace the one below.
+0	string	PFS1\x0a	PFS HDR image data
+#!mime	image/x-pfs
+>1	regex	[0-9]*\ 		\b, %s
+>>1	regex	\ [0-9]{4}		\bx%s
+
+# Type: Foveon X3F
+# URL:  http://www.photofo.com/downloads/x3f-raw-format.pdf
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# Note that the MIME type isn't defined anywhere that I can find; if
+# there's a canonical type for this format, it should replace this one.
+0	string	FOVb	Foveon X3F raw image data
+!:mime	image/x-x3f
+>6	leshort	x	\b, version %d.
+>4	leshort	x	\b%d
+>28	lelong	x	\b, %dx
+>32	lelong	x	\b%d
+
+# Paint.NET file
+# From Adam Buchbinder <adam.buchbinder@gmail.com>
+0	string	PDN3	Paint.NET image data
+!:mime	image/x-paintnet
+
+# Not really an image.
+# From: "Tano M. Fotang" <mfotang@quanteq.com>
+0	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)

+ 6 - 1
magic/Magdir/intel

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: intel,v 1.8 2009/09/19 16:28:10 christos Exp $
+# $File: intel,v 1.10 2011/03/30 19:51:00 christos Exp $
 # intel:  file(1) magic for x86 Unix
 #
 # Various flavors of x86 UNIX executable/object (other than Xenix, which
@@ -46,3 +46,8 @@
 >28      string          Adaptec      Adaptec
 >42      string          PROMISE      Promise
 >2       byte            x            (%d*512)
+
+# Flash descriptors for Intel SPI flash roms.
+# From Dr. Jesus <j@hug.gs>
+0	lelong		0x0ff0a55a	Intel serial flash for ICH/PCH ROM <= 5 or 3400 series A-step
+16	lelong		0x0ff0a55a	Intel serial flash for PCH ROM

+ 15 - 0
magic/Magdir/isz

@@ -0,0 +1,15 @@
+
+#------------------------------------------------------------------------------
+# $File: isz,v 1.1 2010/03/27 16:17:09 christos Exp $
+# ISO Zipped file format 
+# http://www.ezbsystems.com/isz/iszspec.txt
+0	string	IsZ!	ISO Zipped file
+>4	byte	x	\b, header size %u
+>5	byte	x	\b, version %u
+>8	lelong	x	\b, serial %u
+#12	leshort	x	\b, sector size %u
+#>16	lelong	x	\b, total sectors %u
+>17	byte	>0	\b, password protected
+#>24	lequad	x	\b, segment size %llu
+#>32	lelong	x	\b, blocks %u
+#>36	lelong	x	\b, block size %u

+ 3 - 8
magic/Magdir/jpeg

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: jpeg,v 1.15 2009/09/19 16:28:10 christos Exp $
+# $File: jpeg,v 1.16 2011/01/04 19:29:32 rrt Exp $
 # JPEG images
 # SunOS 5.5.1 had
 #
@@ -127,13 +127,8 @@
 # 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, comment: "%s"
-# FIXME: When we can do non-byte counted strings, we can use that to get
-# the string's count, and fix Debian bug #283760
-#>(4.S+5)	byte		0xFE		\b, comment
-#>>(4.S+6)	beshort		x		\b length=%d
-#>>(4.S+8)	string		>\0		\b, "%s"
+>(4.S+5)	byte		0xFE		\b, comment:
+>>(4.S+6)	pstring/HJ	x		"%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 - 4
magic/Magdir/kde

@@ -1,11 +1,11 @@
 
 #------------------------------------------------------------------------------
-# $File: kde,v 1.4 2009/09/19 16:28:10 christos Exp $
+# $File: kde,v 1.5 2010/11/25 15:00:12 christos Exp $
 # kde:  file(1) magic for KDE
 
-0		string	[KDE\ Desktop\ Entry]	KDE desktop entry
+0		string/t	[KDE\ Desktop\ Entry]	KDE desktop entry
 !:mime	application/x-kdelnk
-0		string	#\ KDE\ Config\ File	KDE config file
+0		string/t	#\ KDE\ Config\ File	KDE config file
 !:mime	application/x-kdelnk
-0		string	#\ xmcd	xmcd database file for kscd
+0		string/t	#\ xmcd	xmcd database file for kscd
 !:mime	text/x-xmcd

+ 3 - 3
magic/Magdir/kml

@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: kml,v 1.2 2009/09/19 16:28:10 christos Exp $
+# $File: kml,v 1.3 2010/11/25 15:00:12 christos Exp $
 # Type: Google KML, formerly Keyhole Markup Language
 # Future development of this format has been handed
 # over to the Open Geospatial Consortium.
 # http://www.opengeospatial.org/standards/kml/
 # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
-0 string    \<?xml
+0 string/t    \<?xml
 >20  search/400 \ xmlns= 
 >>&0 regex ['"]http://earth.google.com/kml Google KML document
 !:mime application/vnd.google-earth.kml+xml
@@ -22,7 +22,7 @@
 # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
 >>&0 regex ['"]http://www.opengis.net/kml OpenGIS KML document
 !:mime application/vnd.google-earth.kml+xml
->>>&1 string 2.2 \b, version 2.2
+>>>&1 string/t 2.2 \b, version 2.2
 
 #------------------------------------------------------------------------------
 # Type: Google KML Archive (ZIP based) 

+ 99 - 33
magic/Magdir/linux

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: linux,v 1.33 2009/10/23 16:44:59 christos Exp $
+# $File: linux,v 1.41 2011/04/20 18:57:10 christos Exp $
 # linux:  file(1) magic for Linux files
 #
 # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@@ -45,41 +45,49 @@
 # this can be overridden by the DOS executable (COM) entry
 2	string		LILO		Linux/i386 LILO boot/chain loader
 #
+# Linux make config build file, from Ole Aamot <oka@oka.no>
+28 	string		make\ config	Linux make config build file
+#
 # 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,
+# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
+# See: http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html
+0	leshort		0x0436		Linux/i386 PC Screen Font v1 data,
+>2	byte&0x01	0		256 characters,
+>2	byte&0x01	!0		512 characters,
+>2	byte&0x02	0		no directory,
+>2	byte&0x02	!0		Unicode directory,
 >3	byte		>0		8x%d
+0	string		\x72\xb5\x4a\x86\x00\x00 Linux/i386 PC Screen Font v2 data,
+>16	lelong		x		%d characters,
+>12	lelong&0x01	0		no directory,
+>12	lelong&0x01	!0		Unicode directory,
+>24	lelong		x		%d
+>28	lelong		x		\bx%d
+
 # Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
 4086	string		SWAP-SPACE	Linux/i386 swap file
 # From: Jeff Bailey <jbailey@ubuntu.com>
 # Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com>
 4076	string		SWAPSPACE2S1SUSPEND	Linux/i386 swap file (new style) with SWSUSP1 image
+# From: James Hunt <james.hunt@ubuntu.com>
+4076    string          SWAPSPACE2LINHIB0001    Linux/i386 swap file (new style) (compressed hibernate)
 # according to man page of mkswap (8) March 1999
-4086	string		SWAPSPACE2	Linux/i386 swap file (new style)
->0x400	long		x		%d (4K pages)
->0x404	long		x		size %d pages
->>4086	string		SWAPSPACE2	
->>>1052	string		>\0		Label %s
+# volume label and UUID Russell Coker
+# http://etbe.coker.com.au/2008/07/08/label-vs-uuid-vs-device/
+4086	string		SWAPSPACE2	Linux/i386 swap file (new style),
+>0x400	long		x		version %d (4K pages),
+>0x404	long		x		size %d pages,
+>1052	string		\0		no label,
+>1052	string		>\0		LABEL=%s,
+>0x40c	belong		x		UUID=%08x
+>0x410	beshort		x		\b-%04x
+>0x412	beshort		x		\b-%04x
+>0x414	beshort		x		\b-%04x
+>0x416	belong		x		\b-%08x
+>0x41a	beshort		x		\b%04x
 # From Daniel Novotny <dnovotny@redhat.com>
 # swap file for PowerPC
 65526	string		SWAPSPACE2	Linux/ppc 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>
@@ -159,6 +167,22 @@
 >0x1e6		belong		!0x454c4b53	style boot sector
 
 ############################################################################
+# Linux S390 kernel image
+# Created by: Jan Kaluza <jkaluza@redhat.com>
+8 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux S390
+>0x00010000 search/b/4096 \x00\x0a\x00\x00\x8b\xad\xcc\xcc
+# 64bit
+>>&0 string \xc1\x00\xef\xe3\xf0\x68\x00\x00 Z10 64bit kernel
+>>&0 string \xc1\x00\xef\xc3\x00\x00\x00\x00 Z9-109 64bit kernel
+>>&0 string \xc0\x00\x20\x00\x00\x00\x00\x00 Z990 64bit kernel
+>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00 Z900 64bit kernel
+# 32bit
+>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z10 32bit kernel
+>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z9-109 32bit kernel
+>>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel
+>>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel
+
+############################################################################
 # Linux 8086 executable
 0	lelong&0xFF0000FF 0xC30000E9	Linux-Dev86 executable, headerless
 >5	string		.		
@@ -222,19 +246,55 @@
 #
 # 0x200 seems to be the common case
 
-0x218		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
+0x218           string  LVM2\ 001      LVM2 PV (Linux Logical Volume Manager)
 # read the offset to add to the start of the header, and the header
 # start in 0x200
->(0x214.l+0x200) string	>\0		, UUID: %s
+>&(&-12.l-0x21) byte    x
+# display UUID in LVM format + display all 32 bytes (instead of max string length: 31)
+>>&0x0          string  >\x2f          \b, UUID: %.6s
+>>&0x6          string  >\x2f          \b-%.4s
+>>&0xa          string  >\x2f          \b-%.4s
+>>&0xe          string  >\x2f          \b-%.4s
+>>&0x12         string  >\x2f          \b-%.4s
+>>&0x16         string  >\x2f          \b-%.4s
+>>&0x1a         string  >\x2f          \b-%.6s
+>>&0x20         lequad  x              \b, size: %lld
 
-0x018		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
->(0x014.l)	 string	>\0		, UUID: %s
+0x018           string  LVM2\ 001      LVM2 PV (Linux Logical Volume Manager)
+>&(&-12.l-0x21) byte    x
+# display UUID in LVM format + display all 32 bytes (instead of max string length: 31)
+>>&0x0          string  >\x2f          \b, UUID: %.6s
+>>&0x6          string  >\x2f          \b-%.4s
+>>&0xa          string  >\x2f          \b-%.4s
+>>&0xe          string  >\x2f          \b-%.4s
+>>&0x12         string  >\x2f          \b-%.4s
+>>&0x16         string  >\x2f          \b-%.4s
+>>&0x1a         string  >\x2f          \b-%.6s
+>>&0x20         lequad  x              \b, size: %lld
 
-0x418		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
->(0x414.l+0x400) string	>\0		, UUID: %s
+0x418           string  LVM2\ 001      LVM2 PV (Linux Logical Volume Manager)
+>&(&-12.l-0x21) byte    x
+# display UUID in LVM format + display all 32 bytes (instead of max string length: 31)
+>>&0x0          string  >\x2f          \b, UUID: %.6s
+>>&0x6          string  >\x2f          \b-%.4s
+>>&0xa          string  >\x2f          \b-%.4s
+>>&0xe          string  >\x2f          \b-%.4s
+>>&0x12         string  >\x2f          \b-%.4s
+>>&0x16         string  >\x2f          \b-%.4s
+>>&0x1a         string  >\x2f          \b-%.6s
+>>&0x20         lequad  x              \b, size: %lld
 
-0x618		 string	LVM2\ 001	LVM2 (Linux Logical Volume Manager)
->(0x614.l+0x600) string	>\0		, UUID: %s
+0x618           string  LVM2\ 001      LVM2 PV (Linux Logical Volume Manager)
+>&(&-12.l-0x21) byte    x              
+# display UUID in LVM format + display all 32 bytes (instead of max string length: 31)
+>>&0x0          string  >\x2f          \b, UUID: %.6s
+>>&0x6          string  >\x2f          \b-%.4s
+>>&0xa          string  >\x2f          \b-%.4s
+>>&0xe          string  >\x2f          \b-%.4s
+>>&0x12         string  >\x2f          \b-%.4s
+>>&0x16         string  >\x2f          \b-%.4s
+>>&0x1a         string  >\x2f          \b-%.6s
+>>&0x20         lequad  x              \b, size: %lld
 
 # LVM snapshot
 # from Jason Farrel
@@ -267,3 +327,9 @@
 >20	search/256	(name			
 >>&1	string		x			(name %s)
 
+# Type: Xen, the virtual machine monitor
+# From: Radek Vokal <rvokal@redhat.com>
+0	string		LinuxGuestRecord	Xen saved domain
+#>2	regex		\(name\ [^)]*\)		%s
+>20	search/256	(name			(name
+>>&1	string		x			%s...)

+ 4 - 2
magic/Magdir/llvm

@@ -1,11 +1,13 @@
 
 #------------------------------------------------------------------------------
-# $File: llvm,v 1.4 2009/09/19 16:28:10 christos Exp $
+# $File: llvm,v 1.5 2010/09/20 18:55:20 rrt Exp $
 # llvm:  file(1) magic for LLVM byte-codes
-# URL:  http://llvm.cs.uiuc.edu/docs/BytecodeFormat.html#signature
+# URL:  http://llvm.org/docs/BitCodeFormat.html
 # From: Al Stone <ahs3@fc.hp.com>
 
 0	string	llvm	LLVM byte-codes, uncompressed
 0	string	llvc0	LLVM byte-codes, null compression
 0	string	llvc1	LLVM byte-codes, gzip compression
 0	string	llvc2	LLVM byte-codes, bzip2 compression
+0	string	\xde\xc0\x17\x0b	LLVM bitcode, wrapper
+0       string	BC\xc0\xde	LLVM bitcode

+ 14 - 2
magic/Magdir/macintosh

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: macintosh,v 1.20 2009/09/19 16:28:10 christos Exp $
+# $File: macintosh,v 1.22 2011/05/17 17:40:31 rrt Exp $
 # macintosh description
 #
 # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
@@ -285,7 +285,7 @@
 >0x412	beshort			x		number of blocks: %d,
 >0x424	pstring			x		volume name: %s
 
-# "BD" is has many false positives
+# "BD" gives many false positives
 #0x400	beshort			0x4244		Macintosh HFS data
 #>0	beshort			0x4C4B		(bootable)
 #>0x40a	beshort			&0x8000		(locked)
@@ -376,3 +376,15 @@
 
 # From: Remi Mommsen <mommsen@slac.stanford.edu>
 0		string		BOMStore	Mac OS X bill of materials (BOM) file
+
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# URL: http://en.wikipedia.org/wiki/Datafork_TrueType
+# Derived from the 'fondu' and 'ufond' source code (fondu.sf.net). 'sfnt' is
+# TrueType; 'POST' is PostScript. 'FONT' and 'NFNT' sometimes appear, but I
+# don't know what they mean.
+0	belong	0x100
+>(0x4.L+24)	beshort	x
+>>&4	belong	0x73666e74	Mac OSX datafork font, TrueType
+>>&4	belong	0x464f4e54	Mac OSX datafork font, 'FONT'
+>>&4	belong	0x4e464e54	Mac OSX datafork font, 'NFNT'
+>>&4	belong	0x504f5354	Mac OSX datafork font, PostScript

+ 2 - 2
magic/Magdir/magic

@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: magic,v 1.9 2009/09/19 16:28:10 christos Exp $
+# $File: magic,v 1.10 2010/11/25 15:00:12 christos Exp $
 # magic:  file(1) magic for magic files
 #
-0	string		#\ Magic	magic text file for file(1) cmd
+0	string/t		#\ Magic	magic text file for file(1) cmd
 0	lelong		0xF11E041C	magic binary file for file(1) cmd
 >4	lelong		x		(version %d) (little endian)
 0	belong		0xF11E041C	magic binary file for file(1) cmd

+ 26 - 15
magic/Magdir/mail.news

@@ -1,36 +1,36 @@
 
 #------------------------------------------------------------------------------
-# $File: mail.news,v 1.17 2009/09/19 16:28:10 christos Exp $
+# $File: mail.news,v 1.19 2011/01/25 13:55:57 christos Exp $
 # mail.news:  file(1) magic for mail and news
 #
 # Unfortunately, saved netnews also has From line added in some news software.
 #0	string		From 		mail text
 # There are tests to ascmagic.c to cope with mail and news.
-0	string		Relay-Version: 	old news text
+0	string/t		Relay-Version: 	old news text
 !:mime	message/rfc822
-0	string		#!\ rnews	batched news text
+0	string/t		#!\ rnews	batched news text
 !:mime	message/rfc822
-0	string		N#!\ rnews	mailed, batched news text
+0	string/t		N#!\ rnews	mailed, batched news text
 !:mime	message/rfc822
-0	string		Forward\ to 	mail forwarding text
+0	string/t		Forward\ to 	mail forwarding text
 !:mime	message/rfc822
-0	string		Pipe\ to 	mail piping text
+0	string/t		Pipe\ to 	mail piping text
 !:mime	message/rfc822
-0	string		Return-Path:	smtp mail text
+0	string/t		Return-Path:	smtp mail text
 !:mime	message/rfc822
-0	string		Path:		news text
+0	string/t		Path:		news text
 !:mime	message/news
-0	string		Xref:		news text
+0	string/t		Xref:		news text
 !:mime	message/news
-0	string		From:		news or mail text
+0	string/t		From:		news or mail text
 !:mime	message/rfc822
-0	string		Article 	saved news text
+0	string/t		Article 	saved news text
 !:mime	message/news
-0	string		BABYL		Emacs RMAIL text
-0	string		Received:	RFC 822 mail text
+0	string/t		BABYL		Emacs RMAIL text
+0	string/t		Received:	RFC 822 mail text
 !:mime	message/rfc822
-0	string		MIME-Version:	MIME entity text
-#0	string		Content-	MIME entity text
+0	string/t		MIME-Version:	MIME entity text
+#0	string/t		Content-	MIME entity text
 
 # TNEF files...
 0	lelong		0x223E9F78	Transport Neutral Encapsulation Format
@@ -53,3 +53,14 @@
 #>4	leshort	>0			(%d messages)
 
 #0	string		\<!--\ MHonArc		text/html; x-type=mhonarc
+
+# Cyrus: file(1) magic for compiled Cyrus sieve scripts
+# URL: http://www.cyrusimap.org/docs/cyrus-imapd/2.4.6/internal/bytecode.php
+# URL: http://git.cyrusimap.org/cyrus-imapd/tree/sieve/bytecode.h?h=master
+# From: Philipp Hahn <hahn@univention.de>
+
+# Compiled Cyrus sieve script
+0       string CyrSBytecode     Cyrus sieve bytecode data,
+>12     belong =1       version 1, big-endian
+>12     lelong =1       version 1, little-endian
+>12     belong x        version %d, network-endian

+ 9 - 1
magic/Magdir/matroska

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: matroska,v 1.5 2009/09/27 19:02:12 christos Exp $
+# $File: matroska,v 1.6 2010/09/20 21:11:35 rrt Exp $
 # matroska:  file(1) magic for Matroska files
 #
 # See http://www.matroska.org/
@@ -13,3 +13,11 @@
 # DocType contents:
 >>8		string		matroska	Matroska data
 !:mime  video/x-matroska
+
+# EBML id:
+0		belong		0x1a45dfa3
+# DocType id:
+>0		search/4096 	\x42\x82
+# DocType contents:
+>>&1		string		webm	WebM
+!:mime  video/webm

+ 8 - 0
magic/Magdir/metastore

@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: metastore,v 1.1 2011/04/06 12:37:44 christos Exp $
+# metastore:  file(1) magic for metastore files
+# From: Thomas Wissen
+# see http://david.hardeman.nu/software.php#metastore
+0	string		MeTaSt00r3	Metastore data file, 
+>10	bequad		x		version %0llx

+ 3 - 3
magic/Magdir/mime

@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: mime,v 1.5 2009/09/19 16:28:10 christos Exp $
+# $File: mime,v 1.6 2010/11/25 15:00:12 christos Exp $
 # mime:  file(1) magic for MIME encoded files
 #
-0	string		Content-Type:\ 
+0	string/t		Content-Type:\ 
 >14	string		>\0		%s
-0	string		Content-Type:
+0	string/t		Content-Type:
 >13	string		>\0		%s

+ 18 - 14
magic/Magdir/mips

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: mips,v 1.5 2009/09/19 16:28:10 christos Exp $
+# $File: mips,v 1.7 2011/05/03 01:44:17 christos Exp $
 # mips:  file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.)
 #                         Dec Ultrix (MIPS)
 # all of SGI's *current* machines and OSes run in big-endian mode on the
@@ -35,7 +35,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >22	byte	x		- version %ld
->23	byte	x		.%ld
+>23	byte	x		\b.%ld
 #
 0	beshort	0x0162		MIPSEL-BE ECOFF executable
 >20	beshort	0407		(impure)
@@ -44,7 +44,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %d
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 0	beshort	0x6001		MIPSEB-LE ECOFF executable
 >20	beshort	03401		(impure)
@@ -53,7 +53,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %d
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 0	beshort	0x6201		MIPSEL ECOFF executable
 >20	beshort	03401		(impure)
@@ -62,7 +62,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %ld
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 # MIPS 2 additions
 #
@@ -73,7 +73,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >22	byte	x		- version %ld
->23	byte	x		.%ld
+>23	byte	x		\b.%ld
 #
 0	beshort	0x0166		MIPSEL-BE MIPS-II ECOFF executable
 >20	beshort	0407		(impure)
@@ -82,7 +82,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >22	byte	x		- version %ld
->23	byte	x		.%ld
+>23	byte	x		\b.%ld
 #
 0	beshort	0x6301		MIPSEB-LE MIPS-II ECOFF executable
 >20	beshort	03401		(impure)
@@ -91,7 +91,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %ld
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 0	beshort	0x6601		MIPSEL MIPS-II ECOFF executable
 >20	beshort	03401		(impure)
@@ -100,7 +100,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %ld
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 # MIPS 3 additions
 #
@@ -111,7 +111,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >22	byte	x		- version %ld
->23	byte	x		.%ld
+>23	byte	x		\b.%ld
 #
 0	beshort	0x0142		MIPSEL-BE MIPS-III ECOFF executable
 >20	beshort	0407		(impure)
@@ -120,7 +120,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >22	byte	x		- version %ld
->23	byte	x		.%ld
+>23	byte	x		\b.%ld
 #
 0	beshort	0x4001		MIPSEB-LE MIPS-III ECOFF executable
 >20	beshort	03401		(impure)
@@ -129,7 +129,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %ld
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 0	beshort	0x4201		MIPSEL MIPS-III ECOFF executable
 >20	beshort	03401		(impure)
@@ -138,7 +138,7 @@
 >8	belong	>0		not stripped
 >8	belong	0		stripped
 >23	byte	x		- version %ld
->22	byte	x		.%ld
+>22	byte	x		\b.%ld
 #
 0	beshort	0x180		MIPSEB Ucode
 0	beshort	0x182		MIPSEL-BE Ucode
@@ -160,7 +160,7 @@
 # Trusted IRIX info
 0	string	SGIAUDIT	SGI Audit file
 >8	byte	x		- version %d
->9	byte	x		.%ld
+>9	byte	x		\b.%ld
 #
 0	string	WNGZWZSC	Wingz compiled script
 0	string	WNGZWZSS	Wingz spreadsheet
@@ -171,8 +171,12 @@
 # GLF is OpenGL stream encoding
 0	string	glfHeadMagic();		GLF_TEXT
 4	belong	0x7d000000		GLF_BINARY_LSB_FIRST
+!:strength -30
 4	belong	0x0000007d		GLF_BINARY_MSB_FIRST
+!:strength -30
 # GLS is OpenGL stream encoding; GLS is the successor of GLF
 0	string	glsBeginGLS(		GLS_TEXT
 4	belong	0x10000000		GLS_BINARY_LSB_FIRST
+!:strength -30
 4	belong	0x00000010		GLS_BINARY_MSB_FIRST
+!:strength -30

+ 11 - 1
magic/Magdir/misctools

@@ -1,10 +1,11 @@
 
 #-----------------------------------------------------------------------------
-# $File: misctools,v 1.10 2009/09/19 16:28:10 christos Exp $
+# $File: misctools,v 1.12 2010/09/29 18:36:49 rrt Exp $
 # misctools:  file(1) magic for miscellaneous UNIX tools.
 #
 0	search/1	%%!!			X-Post-It-Note text
 0	string/c	BEGIN:VCALENDAR		vCalendar calendar file
+!:mime	text/calendar
 0	string/c	BEGIN:VCARD		vCard visiting card
 !:mime	text/x-vcard
 
@@ -12,6 +13,12 @@
 4	string	gtktalog		GNOME Catalogue (gtktalog)
 >13	string	>\0			version %s
 
+# Summary: GStreamer binary registry
+# Extension: .bin
+# Submitted by: Josh Triplett <josh@joshtriplett.org>
+0	belong	0xc0def00d		GStreamer binary registry
+>4	string	x			\b, version %s
+
 # Summary: Libtool library file
 # Extension: .la
 # Submitted by: Tomasz Trojanowski <tomek@uninet.com.pl>
@@ -21,3 +28,6 @@
 # Extension: .lo
 # Submitted by: Abel Cheung <abelcheung@gmail.com>
 0	search/80	.lo\ -\ a\ libtool\ object\ file	libtool object file
+
+# From: Daniel Novotny <dnovotny@redhat.com>
+0	string		MDMP\x93\xA7				MDMP crash report data

+ 4 - 4
magic/Magdir/modem

@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: modem,v 1.4 2009/09/19 16:28:10 christos Exp $
+# $File: modem,v 1.5 2010/09/20 18:55:20 rrt Exp $
 # modem:  file(1) magic for modem programs
 #
 # From: Florian La Roche <florian@knorke.saar.de>
-4	string		Research,	Digifax-G3-File
->29	byte		1		, fine resolution
->29	byte		0		, normal resolution
+1	string		PC\ Research,\ Inc	Digifax-G3-File
+>29	byte		1			\b, fine resolution
+>29	byte		0			\b, normal resolution
 
 0	short		0x0100		raw G3 data, byte-padded
 0	short		0x1400		raw G3 data

+ 319 - 161
magic/Magdir/msdos

@@ -1,17 +1,17 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.65 2009/09/19 16:28:11 christos Exp $
+# $File: msdos,v 1.74 2011/06/06 13:01:41 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
 # .BAT files (Daniel Quinlan, quinlan@yggdrasil.com)
-# updated by Joerg Jenderek at Oct 2008
-0	string	@			
+# updated by Joerg Jenderek at Oct 2008,Apr 2011
+0	string/t	@			
 >1	string/cW	\ echo\ off	DOS batch file text
 !:mime	text/x-msdos-batch
 >1	string/cW	echo\ off	DOS batch file text
 !:mime	text/x-msdos-batch
->1	string/cW	rem\ 		DOS batch file text
+>1	string/cW	rem		DOS batch file text
 !:mime	text/x-msdos-batch
 >1	string/cW	set\ 		DOS batch file text
 !:mime	text/x-msdos-batch
@@ -19,8 +19,10 @@
 
 # OS/2 batch files are REXX. the second regex is a bit generic, oh well
 # the matched commands seem to be common in REXX and uncommon elsewhere
-100	regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
-100	regex/c =^[\ \t]{0,10}say\ ['"]	     OS/2 REXX batch file text
+100	search/0xffff   rxfuncadd
+>100	regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc	OS/2 REXX batch file text
+100	search/0xffff   say
+>100	regex/c =^[\ \t]{0,10}say\ ['"]			OS/2 REXX batch file text
 
 0	leshort		0x14c	MS Windows COFF Intel 80386 object file
 #>4	ledate		x	stamp %s
@@ -35,114 +37,111 @@
 0	leshort		0x290	MS Windows COFF PA-RISC object file
 #>4	ledate		x	stamp %s
 
-# XXX - according to Microsoft's spec, at an offset of 0x3c in a
-# PE-format executable is the offset in the file of the PE header;
-# unfortunately, that's a little-endian offset, and there's no way
-# to specify an indirect offset with a specified byte order.
-# So, for now, we assume the standard MS-DOS stub, which puts the
-# PE header at 0x80 = 128.
-#
-# Required OS version and subsystem version were 4.0 on some NT 3.51
-# executables built with Visual C++ 4.0, so it's not clear that
-# they're interesting.	The user version was 0.0, but there's
-# probably some linker directive to set it.  The linker version was
-# 3.0, except for one ".exe" which had it as 4.20 (same damn linker!).
+# Tests for various EXE types.
 #
-# many of the compressed formats were extraced from IDARC 1.23 source code
+# Many of the compressed formats were extraced from IDARC 1.23 source code.
 #
 0	string	MZ
 !:mime	application/x-dosexec
->0x18  leshort <0x40 MS-DOS executable
->0 string MZ\0\0\0\0\0\0\0\0\0\0PE\0\0 \b, PE for MS Windows
->>&18	leshort&0x2000	>0	(DLL)
->>&88	leshort		0	(unknown subsystem)
->>&88	leshort		1	(native)
->>&88	leshort		2	(GUI)
->>&88	leshort		3	(console)
->>&88	leshort		7	(POSIX)
->>&0	leshort		0x0	unknown processor
->>&0	leshort		0x14c	Intel 80386
->>&0	leshort		0x166	MIPS R4000
->>&0	leshort		0x184	Alpha
->>&0	leshort		0x268	Motorola 68000
->>&0	leshort		0x1f0	PowerPC
->>&0	leshort		0x290	PA-RISC
->>&18	leshort&0x0100	>0	32-bit
->>&18	leshort&0x1000	>0	system file
->>&0xf4 search/0x140 \x0\x40\x1\x0
->>>(&0.l+(4)) string MSCF \b, WinHKI CAB self-extracting archive
->30		string	Copyright\ 1989-1990\ PKWARE\ Inc.	Self-extracting PKZIP archive
-!:mime	application/zip
-# Is next line correct? One might expect "Corp." not "Copr." If it is right, add a note to that effect.
->30		string	PKLITE\ Copr.	Self-extracting PKZIP archive
-!:mime	application/zip
-
+# All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file.
+>0x18	leshort <0x40 MS-DOS executable
+# These traditional tests usually work but not always.  When test quality support is
+# implemented these can be turned on.
+#>>0x18	leshort	0x1c	(Borland compiler)
+#>>0x18	leshort	0x1e	(MS compiler)
+
+# If the relocation table is 0x40 or more bytes into the file, it's definitely
+# not a DOS EXE.
 >0x18  leshort >0x3f
+
+# Maybe it's a PE?
 >>(0x3c.l) string PE\0\0 PE
->>>(0x3c.l+25) byte		1 \b32 executable
->>>(0x3c.l+25) byte		2 \b32+ executable
-# hooray, there's a DOS extender using the PE format, with a valid PE
-# executable inside (which just prints a message and exits if run in win)
->>>(0x3c.l+92)	leshort		<10
->>>>(8.s*16) string 32STUB for MS-DOS, 32rtm DOS extender
->>>>(8.s*16) string !32STUB for MS Windows
->>>>>(0x3c.l+22)	leshort&0x2000	>0	(DLL)
->>>>>(0x3c.l+92)	leshort		0	(unknown subsystem)
->>>>>(0x3c.l+92)	leshort		1	(native)
->>>>>(0x3c.l+92)	leshort		2	(GUI)
->>>>>(0x3c.l+92)	leshort		3	(console)
->>>>>(0x3c.l+92)	leshort		7	(POSIX)
+>>>(0x3c.l+24)	leshort		0x010b	\b32 executable
+>>>(0x3c.l+24)	leshort		0x020b	\b32+ executable
+>>>(0x3c.l+24)	leshort		0x0107	ROM image
+>>>(0x3c.l+24)	default		x	Unknown PE signature
+>>>>&0 		leshort		x	0x%x
+>>>(0x3c.l+22)	leshort&0x2000	>0	(DLL)
+>>>(0x3c.l+92)	leshort		1	(native)
+>>>(0x3c.l+92)	leshort		2	(GUI)
+>>>(0x3c.l+92)	leshort		3	(console)
+>>>(0x3c.l+92)	leshort		7	(POSIX)
+>>>(0x3c.l+92)	leshort		9	(Windows CE)
 >>>(0x3c.l+92)	leshort		10	(EFI application)
 >>>(0x3c.l+92)	leshort		11	(EFI boot service driver)
 >>>(0x3c.l+92)	leshort		12	(EFI runtime driver)
->>>(0x3c.l+92)	leshort		13	(XBOX)
->>>(0x3c.l+4)	leshort		0x0	unknown processor
+>>>(0x3c.l+92)	leshort		13	(EFI ROM)
+>>>(0x3c.l+92)	leshort		14	(XBOX)
+>>>(0x3c.l+92)	leshort		15	(Windows boot application)
+>>>(0x3c.l+92)	default		x	(Unknown subsystem
+>>>>&0		leshort		x	0x%x)
 >>>(0x3c.l+4)	leshort		0x14c	Intel 80386
 >>>(0x3c.l+4)	leshort		0x166	MIPS R4000
+>>>(0x3c.l+4)	leshort		0x168	MIPS R10000
 >>>(0x3c.l+4)	leshort		0x184	Alpha
->>>(0x3c.l+4)	leshort		0x268	Motorola 68000
+>>>(0x3c.l+4)	leshort		0x1a2	Hitachi SH3
+>>>(0x3c.l+4)	leshort		0x1a6	Hitachi SH4
+>>>(0x3c.l+4)	leshort		0x1c0	ARM
+>>>(0x3c.l+4)	leshort		0x1c2	ARM Thumb
 >>>(0x3c.l+4)	leshort		0x1f0	PowerPC
->>>(0x3c.l+4)	leshort		0x290	PA-RISC
 >>>(0x3c.l+4)	leshort		0x200	Intel Itanium
->>>(0x3c.l+22)	leshort&0x0100	>0	32-bit
+>>>(0x3c.l+4)	leshort		0x266	MIPS16
+>>>(0x3c.l+4)	leshort		0x268	Motorola 68000
+>>>(0x3c.l+4)	leshort		0x290	PA-RISC
+>>>(0x3c.l+4)	leshort		0x366	MIPSIV
+>>>(0x3c.l+4)	leshort		0x466	MIPS16 with FPU
+>>>(0x3c.l+4)	leshort		0xebc	EFI byte code
+>>>(0x3c.l+4)	leshort		0x8664	x86-64
+>>>(0x3c.l+4)	leshort		0xc0ee	MSIL
+>>>(0x3c.l+4)	default		x	Unknown processor type
+>>>>&0		leshort		x	0x%x
+>>>(0x3c.l+22)	leshort&0x0200	>0	(stripped to external PDB)
 >>>(0x3c.l+22)	leshort&0x1000	>0	system file
->>>(0x3c.l+232) lelong	>0	Mono/.Net assembly
-
->>>>(0x3c.l+0xf8)	string		UPX0 \b, UPX compressed
->>>>(0x3c.l+0xf8)	search/0x140	PEC2 \b, PECompact2 compressed
->>>>(0x3c.l+0xf8)	search/0x140	UPX2
->>>>>(&0x10.l+(-4))	string		PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
->>>>(0x3c.l+0xf8)	search/0x140	.idata
->>>>>(&0xe.l+(-4))	string		PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
->>>>>(&0xe.l+(-4))	string		ZZ0 \b, ZZip self-extracting archive
->>>>>(&0xe.l+(-4))	string		ZZ1 \b, ZZip self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.rsrc
->>>>>(&0x0f.l+(-4))	string		a\\\4\5 \b, WinHKI self-extracting archive
->>>>>(&0x0f.l+(-4))	string		Rar! \b, RAR self-extracting archive
->>>>>(&0x0f.l+(-4))	search/0x3000	MSCF \b, InstallShield self-extracting archive
->>>>>(&0x0f.l+(-4))	search/32	Nullsoft \b, Nullsoft Installer self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.data
->>>>>(&0x0f.l)		string		WEXTRACT \b, MS CAB-Installer self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.petite\0 \b, Petite compressed
->>>>>(0x3c.l+0xf7)	byte		x
->>>>>>(&0x104.l+(-4))	string		=!sfx! \b, ACE self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.WISE \b, WISE installer self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.dz\0\0\0 \b, Dzip self-extracting archive
->>>>(0x3c.l+0xf8)	search/0x140	.reloc
->>>>>(&0xe.l+(-4))	search/0x180	PK\3\4 \b, ZIP self-extracting archive (WinZip)
-
->>>>&(0x3c.l+0xf8)	search/0x100	_winzip_ \b, ZIP self-extracting archive (WinZip)
->>>>&(0x3c.l+0xf8)	search/0x100	SharedD \b, Microsoft Installer self-extracting archive
->>>>0x30		string		Inno \b, InnoSetup self-extracting archive
+>>>(0x3c.l+24)	leshort		0x010b
+>>>>(0x3c.l+232) lelong	>0	Mono/.Net assembly
+>>>(0x3c.l+24)	leshort		0x020b
+>>>>(0x3c.l+248) lelong	>0	Mono/.Net assembly
 
+# hooray, there's a DOS extender using the PE format, with a valid PE
+# executable inside (which just prints a message and exits if run in win)
+>>>(8.s*16)		string		32STUB	\b, 32rtm DOS extender
+>>>(8.s*16)		string		!32STUB	\b, for MS Windows
+>>>(0x3c.l+0xf8)	string		UPX0 \b, UPX compressed
+>>>(0x3c.l+0xf8)	search/0x140	PEC2 \b, PECompact2 compressed
+>>>(0x3c.l+0xf8)	search/0x140	UPX2
+>>>>(&0x10.l+(-4))	string		PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
+>>>(0x3c.l+0xf8)	search/0x140	.idata
+>>>>(&0xe.l+(-4))	string		PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
+>>>>(&0xe.l+(-4))	string		ZZ0 \b, ZZip self-extracting archive
+>>>>(&0xe.l+(-4))	string		ZZ1 \b, ZZip self-extracting archive
+>>>(0x3c.l+0xf8)	search/0x140	.rsrc
+>>>>(&0x0f.l+(-4))	string		a\\\4\5 \b, WinHKI self-extracting archive
+>>>>(&0x0f.l+(-4))	string		Rar! \b, RAR self-extracting archive
+>>>>(&0x0f.l+(-4))	search/0x3000	MSCF \b, InstallShield self-extracting archive
+>>>>(&0x0f.l+(-4))	search/32	Nullsoft \b, Nullsoft Installer self-extracting archive
+>>>(0x3c.l+0xf8)	search/0x140	.data
+>>>>(&0x0f.l)		string		WEXTRACT \b, MS CAB-Installer self-extracting archive
+>>>(0x3c.l+0xf8)	search/0x140	.petite\0 \b, Petite compressed
+>>>>(0x3c.l+0xf7)	byte		x
+>>>>>(&0x104.l+(-4))	string		=!sfx! \b, ACE self-extracting archive
+>>>(0x3c.l+0xf8)	search/0x140	.WISE \b, WISE installer self-extracting archive
+>>>(0x3c.l+0xf8)	search/0x140	.dz\0\0\0 \b, Dzip self-extracting archive
+>>>&(0x3c.l+0xf8)	search/0x100	_winzip_ \b, ZIP self-extracting archive (WinZip)
+>>>&(0x3c.l+0xf8)	search/0x100	SharedD \b, Microsoft Installer self-extracting archive
+>>>0x30			string		Inno \b, InnoSetup self-extracting archive
+
+# Hmm, not a PE but the relocation table is too high for a traditional DOS exe,
+# must be one of the unusual subformats.
 >>(0x3c.l) string !PE\0\0 MS-DOS executable
 
 >>(0x3c.l)		string		NE \b, NE
->>>(0x3c.l+0x36)	byte		0 (unknown OS)
 >>>(0x3c.l+0x36)	byte		1 for OS/2 1.x
 >>>(0x3c.l+0x36)	byte		2 for MS Windows 3.x
 >>>(0x3c.l+0x36)	byte		3 for MS-DOS
->>>(0x3c.l+0x36)	byte		>3 (unknown OS)
+>>>(0x3c.l+0x36)	byte		4 for Windows 386
+>>>(0x3c.l+0x36)	byte		5 for Borland Operating System Services
+>>>(0x3c.l+0x36)	default		x
+>>>>(0x3c.l+0x36)	byte		x (unknown OS %x)
 >>>(0x3c.l+0x36)	byte		0x81 for MS-DOS, Phar Lap DOS extender
 >>>(0x3c.l+0x0c)	leshort&0x8003	0x8002 (DLL)
 >>>(0x3c.l+0x0c)	leshort&0x8003	0x8001 (driver)
@@ -226,16 +225,32 @@
 
 >(8.s*16) string $WdX \b, WDos/X DOS extender
 
-# .EXE formats (Greg Roelofs, newt@uchicago.edu)
+# By now an executable type should have been printed out.  The executable
+# may be a self-uncompressing archive, so look for evidence of that and 
+# print it out.  
+#
+# Some signatures below from Greg Roelofs, newt@uchicago.edu.
 #
 >0x35	string	\x8e\xc0\xb9\x08\x00\xf3\xa5\x4a\x75\xeb\x8e\xc3\x8e\xd8\x33\xff\xbe\x30\x00\x05 \b, aPack compressed
->0xe7	string	LH/2\ Self-Extract \b, %s
->0x1c	string	diet \b, diet compressed
->0x1c	string	LZ09 \b, LZEXE v0.90 compressed
->0x1c	string	LZ91 \b, LZEXE v0.91 compressed
->0x1c	string	tz \b, TinyProg compressed
->0x1e	string	PKLITE \b, %s compressed
->0x64	string	W\ Collis\0\0 \b, Compack compressed
+>0xe7	string	LH/2\ 	Self-Extract \b, %s
+>0x1c	string	UC2X	\b, UCEXE compressed
+>0x1c	string	WWP\ 	\b, WWPACK compressed
+>0x1c	string	RJSX 	\b, ARJ self-extracting archive
+>0x1c	string	diet 	\b, diet compressed
+>0x1c	string	LZ09 	\b, LZEXE v0.90 compressed
+>0x1c	string	LZ91 	\b, LZEXE v0.91 compressed
+>0x1c	string	tz 	\b, TinyProg compressed
+>0x1e	string	Copyright\ 1989-1990\ PKWARE\ Inc.	Self-extracting PKZIP archive
+!:mime	application/zip
+# Yes, this really is "Copr", not "Corp."
+>0x1e	string	PKLITE\ Copr.	Self-extracting PKZIP archive
+!:mime	application/zip
+# winarj stores a message in the stub instead of the sig in the MZ header
+>0x20	search/0xe0	aRJsfX \b, ARJ self-extracting archive
+>0x20	string AIN
+>>0x23	string 2	\b, AIN 2.x compressed
+>>0x23	string <2	\b, AIN 1.x compressed
+>>0x23	string >2	\b, AIN 1.x compressed
 >0x24	string	LHa's\ SFX \b, LHa self-extracting archive
 !:mime	application/x-lha
 >0x24	string	LHA's\ SFX \b, LHa self-extracting archive
@@ -243,18 +258,17 @@
 >0x24	string	\ $ARX \b, ARX self-extracting archive
 >0x24	string	\ $LHarc \b, LHarc self-extracting archive
 >0x20	string	SFX\ by\ LARC \b, LARC self-extracting archive
+>0x40	string aPKG \b, aPackage self-extracting archive
+>0x64	string	W\ Collis\0\0 \b, Compack compressed
+>0x7a	string		Windows\ self-extracting\ ZIP	\b, ZIP self-extracting archive
+>>&0xf4 search/0x140 \x0\x40\x1\x0
+>>>(&0.l+(4)) string MSCF \b, WinHKI CAB self-extracting archive
 >1638	string	-lh5- \b, LHa self-extracting archive v2.13S
 >0x17888 string Rar! \b, RAR self-extracting archive
->0x40	string aPKG \b, aPackage self-extracting archive
-
->32	 string AIN
->>35	 string 2		\b, AIN 2.x compressed
->>35	 string <2		\b, AIN 1.x compressed
->>35	 string >2		\b, AIN 1.x compressed
->28	 string UC2X		\b, UCEXE compressed
->28	 string WWP\  		\b, WWPACK compressed
 
-# skip to the end of the exe
+# Skip to the end of the EXE.  This will usually work fine in the PE case
+# because the MZ image is hardcoded into the toolchain and almost certainly
+# won't match any of these signatures.
 >(4.s*512)	long	x 
 >>&(2.s-517)	byte	x 
 >>>&0	string		PK\3\4 \b, ZIP self-extracting archive
@@ -266,13 +280,8 @@
 >>>&7	search/400	**ACE** \b, ACE self-extracting archive
 >>>&0	search/0x480	UC2SFX\ Header \b, UC2 self-extracting archive
 
->0x1c	string		RJSX \b, ARJ self-extracting archive
-# winarj stores a message in the stub instead of the sig in the MZ header
->0x20	search/0xe0	aRJsfX \b, ARJ self-extracting archive
-
 # a few unknown ZIP sfxes, no idea if they are needed or if they are
 # already captured by the generic patterns above
->122		string		Windows\ self-extracting\ ZIP	\b, ZIP self-extracting archive
 >(8.s*16)	search/0x20	PKSFX \b, ZIP self-extracting archive (PKZIP)
 # TODO: how to add this? >FileSize-34 string Windows\ Self-Installing\ Executable \b, ZIP self-extracting archive
 #
@@ -282,6 +291,29 @@
 >>49824 leshort		=1			\b, 1 file
 >>49824 leshort		>1			\b, %u files
 
+# added by Joerg Jenderek of http://www.freedos.org/software/?prog=kc
+# and http://www.freedos.org/software/?prog=kpdos
+# for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD
+0	string		KCF		FreeDOS KEYBoard Layout collection
+# only version=0x100 found
+>3	uleshort	x		\b, version 0x%x
+# length of string containing author,info and special characters
+>6	ubyte		>0		
+#>>6	pstring		x		\b, name=%s
+>>7	string		>\0		\b, author=%-.14s
+>>7	search/254	\xff		\b, info=
+#>>>&0	string		x		\b%-s
+>>>&0	string		x		\b%-.15s
+# for FreeDOS *.KL files 
+0	string		KLF		FreeDOS KEYBoard Layout file
+# only version=0x100 or 0x101 found
+>3	uleshort	x		\b, version 0x%x
+# stringlength
+>5	ubyte		>0		
+>>8	string		x		\b, name=%-.2s
+0	string	\xffKEYB\ \ \ \0\0\0\0	
+>12	string	\0\0\0\0`\360		MS-DOS KEYBoard Layout file
+
 # .COM formats (Daniel Quinlan, quinlan@yggdrasil.com)
 # Uncommenting only the first two lines will cover about 2/3 of COM files,
 # but it isn't feasible to match all COM files since there must be at least
@@ -290,27 +322,79 @@
 0	byte		0xe9		DOS executable (COM)
 >0x1FE leshort		0xAA55		\b, boot code
 >6	string		SFX\ of\ LHarc	(%s)
-0	belong	0xffffffff		DOS executable (device driver)
-#CMD640X2.SYS
->10	string	>\x23			
->>10	string	!\x2e			
->>>17	string	<\x5B			
->>>>10	string	x			\b, name: %.8s
-#UDMA.SYS KEYB.SYS CMD640X2.SYS
->10	string	<\x41			
->>12	string	>\x40			
->>>10	string	!$			
->>>>12	string	x			\b, name: %.8s
-#BTCDROM.SYS ASPICD.SYS
->22	string	>\x40			
->>22	string	<\x5B			
->>>23	string	<\x5B			
->>>>22	string	x			\b, name: %.8s
-#ATAPICD.SYS
->76	string	\0			
->>77	string	>\x40			
->>>77	string	<\x5B			
->>>>77	string	x			\b, name: %.8s
+
+# DOS device driver updated by Joerg Jenderek at May 2011
+# http://maben.homeip.net/static/S100/IBM/software/DOS/DOS%20techref/CHAPTER.009
+0	ulequad&0x07a0ffffffff		0xffffffff		DOS executable (
+>40	search/7			UPX!			\bUPX compressed 
+# DOS device driver attributes
+>4	uleshort&0x8000			0x0000			\bblock device driver
+# character device
+>4	uleshort&0x8000			0x8000			\b
+>>4	uleshort&0x0008			0x0008			\bclock 
+# fast video output by int 29h
+>>4	uleshort&0x0010			0x0010			\bfast 
+# standard input/output device
+>>4	uleshort&0x0003			>0			\bstandard 
+>>>4	uleshort&0x0001			0x0001			\binput
+>>>4	uleshort&0x0003			0x0003			\b/
+>>>4	uleshort&0x0002			0x0002			\boutput 
+>>4	uleshort&0x8000			0x8000			\bcharacter device driver
+>0	ubyte				x			
+# upx compressed device driver has garbage instead of real in name field of header
+>>40	search/7			UPX!			
+>>40	default				x			
+# leading/trailing nulls, zeros or non ASCII characters in 8-byte name field at offset 10 are skipped
+>>>12		ubyte			>0x27			\b 
+>>>>10		ubyte			>0x20			
+>>>>>10		ubyte			!0x2E			
+>>>>>>10	ubyte			!0x2A			\b%c
+>>>>11		ubyte			>0x20			
+>>>>>11		ubyte			!0x2E			\b%c
+>>>>12		ubyte			>0x20			
+>>>>>12		ubyte			!0x39			
+>>>>>>12	ubyte			!0x2E			\b%c
+>>>13		ubyte			>0x20			
+>>>>13		ubyte			!0x2E			\b%c
+>>>>14		ubyte			>0x20			
+>>>>>14		ubyte			!0x2E			\b%c
+>>>>15		ubyte			>0x20			
+>>>>>15		ubyte			!0x2E			\b%c
+>>>>16		ubyte			>0x20			
+>>>>>16		ubyte			!0x2E			
+>>>>>>16	ubyte			<0xCB			\b%c
+>>>>17		ubyte			>0x20			
+>>>>>17		ubyte			!0x2E			
+>>>>>>17	ubyte			<0x90			\b%c
+# some character device drivers like ASPICD.SYS, btcdrom.sys and Cr_atapi.sys contain only spaces or points in name field
+>>>4		uleshort&0x8000		0x8000			
+>>>>12		ubyte			<0x2F			
+# they have their real name at offset 22
+>>>>>22		string			>\0			\b%-.5s
+>4	uleshort&0x8000			0x0000			
+# 32 bit sector adressing ( > 32 MB) for block devices
+>>4	uleshort&0x0002			0x0002			\b,32-bit sector-
+# support by driver functions 13h, 17h, 18h
+>4	uleshort&0x0040			0x0040			\b,IOCTL-
+# open, close, removable media support by driver functions 0Dh, 0Eh, 0Fh
+>4	uleshort&0x0800			0x0800			\b,close media-
+# output until busy support by int 10h for character device driver
+>4	uleshort&0x8000			0x8000			
+>>4	uleshort&0x2000			0x2000			\b,until busy-
+# direct read/write support by driver functions 03h,0Ch
+>4	uleshort&0x4000			0x4000			\b,control strings-
+>4	uleshort&0x8000			0x8000			
+>>4	uleshort&0x6840			>0			\bsupport
+>4	uleshort&0x8000			0x0000			
+>>4	uleshort&0x4842			>0			\bsupport
+>0	ubyte				x			\b)
+# DOS driver cmd640x.sys has 0x12 instead of 0xffffffff for pointer field to next device header 
+# Too weak, matches files that only contain 0's
+#0	ulequad&0x000007a0ffffffed	0x0000000000000000	DOS-executable (
+#>4	uleshort&0x8000			0x8000			\bcharacter device driver
+#>>10	string				x			%-.8s
+#>4	uleshort&0x4000			0x4000			\b,control strings-support)
+
 # test too generic ?
 0	byte		0x8c		DOS executable (COM)
 # updated by Joerg Jenderek at Oct 2008
@@ -334,6 +418,13 @@
 # start with assembler instructions mov eax,21cd4cffh
 0	uleshort&0xc0ff	0xc0b8		
 >1	lelong		0x21cd4cff	COM executable (32-bit COMBOOT)
+# syslinux:doc/comboot.txt
+# A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov
+# eax,21cd4cfeh) as a magic number.
+0       string	\xb8\xfe\x4c\xcd\x21	COM executable (COM32R)
+# start with assembler instructions mov eax,21cd4cfeh
+0	uleshort&0xc0ff	0xc0b8		
+>1	lelong		0x21cd4cfe	COM executable (32-bit COMBOOT, relocatable)
 0	string	\x81\xfc		
 >4	string	\x77\x02\xcd\x20\xb9	
 >>36	string	UPX!			FREE-DOS executable (COM), UPX compressed
@@ -481,7 +572,7 @@
 
 # Windows icons (Ian Springer <ips@fpk.hp.com>)
 0	string	\000\000\001\000	MS Windows icon resource
-!:mime	image/x-ico
+!:mime	image/x-icon
 >4	byte	1			- 1 icon
 >4	byte	>1			- %d icons
 >>6	byte	>0			\b, %dx
@@ -519,6 +610,13 @@
 # Acroread or something	 files wrongly identified as G3	 .pfm
 # these have the form \000 \001 any? \002 \000 \000
 # or \000 \001 any? \022 \000 \000
+0	belong&0xffff00ff	0x00010012	PFM data
+>4	string			\000\000
+>6	string			>\060		- %s
+
+0	belong&0xffff00ff	0x00010002	PFM data
+>4	string			\000\000
+>6	string			>\060		- %s
 #0	string	\000\001 pfm?
 #>3	string	\022\000\000Copyright\	yes
 #>3	string	\002\000\000Copyright\	yes
@@ -554,6 +652,39 @@
 0	lelong		0x4C
 >4	lelong		0x00021401	Windows shortcut file
 
+# .PIF files added by Joerg Jenderek from http://smsoft.ru/en/pifdoc.htm
+# only for windows versions equal or greater 3.0
+0x171	string	MICROSOFT\ PIFEX\0	Windows Program Information File
+!:mime	application/x-dosexec
+#>2	string	 	>\0		\b, Title:%.30s
+>0x24	string		>\0		\b for %.63s
+>0x65	string		>\0		\b, directory=%.64s
+>0xA5	string		>\0		\b, parameters=%.64s
+#>0x181	leshort	x	\b, offset %x
+#>0x183	leshort	x	\b, offsetdata %x
+#>0x185	leshort	x	\b, section length %x
+>0x187	search/0xB55	WINDOWS\ VMM\ 4.0\0	
+>>&0x5e		ubyte	>0			
+>>>&-1		string	<PIFMGR.DLL		\b, icon=%s
+#>>>&-1		string	PIFMGR.DLL		\b, icon=%s
+>>>&-1		string	>PIFMGR.DLL		\b, icon=%s
+>>&0xF0		ubyte	>0			
+>>>&-1		string	<Terminal		\b, font=%.32s
+#>>>&-1		string	=Terminal		\b, font=%.32s
+>>>&-1		string	>Terminal		\b, font=%.32s
+>>&0x110	ubyte	>0			
+>>>&-1		string	<Lucida\ Console	\b, TrueTypeFont=%.32s
+#>>>&-1		string	=Lucida\ Console	\b, TrueTypeFont=%.32s
+>>>&-1		string	>Lucida\ Console	\b, TrueTypeFont=%.32s
+#>0x187	search/0xB55	WINDOWS\ 286\ 3.0\0	\b, Windows 3.X standard mode-style
+#>0x187	search/0xB55	WINDOWS\ 386\ 3.0\0	\b, Windows 3.X enhanced mode-style
+>0x187	search/0xB55	WINDOWS\ NT\ \ 3.1\0	\b, Windows NT-style
+#>0x187	search/0xB55	WINDOWS\ NT\ \ 4.0\0	\b, Windows NT-style
+>0x187	search/0xB55	CONFIG\ \ SYS\ 4.0\0	\b +CONFIG.SYS
+#>>&06		string	x			\b:%s
+>0x187	search/0xB55	AUTOEXECBAT\ 4.0\0	\b +AUTOEXEC.BAT
+#>>&06		string	x			\b:%s
+
 # DOS EPS Binary File Header
 # From: Ed Sznyter <ews@Black.Market.NET>
 0	belong		0xC5D0D3C6	DOS EPS Binary File
@@ -629,43 +760,58 @@
 #--------------------------------------------------------------------
 # Qemu Emulator Images
 # Lines written by Friedrich Schwittay (f.schwittay@yousable.de)
-# Made by reading sources and doing trial and error on existing
-# qcow files
-0	string	QFI	Qemu Image, Format: Qcow
+# Updated by Adam Buchbinder (adam.buchbinder@gmail.com)
+# Made by reading sources, reading documentation, and doing trial and error
+# on existing QCOW files
+0	string	QFI\xFB	QEMU QCOW Image
 
 # Uncomment the following line to display Magic (only used for debugging
 # this magic number)
 #>0	string	x	, Magic: %s
 
-# There are currently 2 Versions: "1" and "2"
-# I do not use Version 2 and therefor branch here
-# but can assure: it works (tested on both versions)
-# Also my Qemu 0.9.0 which uses this Version 2 refuses
-# to start in its bios
->0x04	belong	2	, Version: 2
->0x04	belong	1	, Version: 1
+# There are currently 2 Versions: "1" and "2".
+# http://www.gnome.org/~markmc/qcow-image-format-version-1.html
+>4	belong	1	(v1)
 
-# Using the existence of the Backing File Offset to Branch or not
+# Using the existence of the Backing File Offset to determine whether
 # to read Backing File Information
->>0xc	 belong	 >0	 , Backing File( Offset: %lu
->>>(0xc.L)	 string >\0	, Path: %s
-
-# Didn't get the trick here how qemu stores the "Size" at this Position
-# There is actually something stored but nothing makes sense
-# The header in the sources talks about it
-#>>>16	 lelong	 x	 , Size: %lu
+>>12	belong	 >0	 \b, has backing file (
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases.
+>>>(12.L)	 string >\0	\bpath %s
 
 # Modification time of the Backing File
 # Really useful if you want to know if your backing
 # file is still usable together with this image
->>>20	 bedate x	, Mtime: %s )
+>>>>20	bedate >0	\b, mtime %s)
+>>>>20	default x	\b)
+
+# Size is stored in bytes in a big-endian u64.
+>>24	bequad	x	 \b, %lld bytes
 
-# Don't know how to calculate in Magicfiles
-# Also: this Information is not reliably
-#	stored in image-files
->>24	 lelong	 x	 , Disk Size could be: %d * 256 bytes
+# 1 for AES encryption, 0 for none.
+>>36	belong	1	\b, AES-encrypted
 
-0	string	QEVM		QEMU's suspend to disk image
+# http://www.gnome.org/~markmc/qcow-image-format.html
+>4	belong	2	(v2)
+# Using the existence of the Backing File Offset to determine whether
+# to read Backing File Information
+>>8	bequad  >0	 \b, has backing file
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases. Also, since there's no
+# .Q modifier, we just use the bottom four bytes as an offset. Note that if
+# the file is over 4G, and the backing file path is stored after the first 4G,
+# the wrong filename will be printed. (This should be (8.Q), when that syntax
+# is introduced.)
+>>>(12.L)	 string >\0	(path %s)
+>>24	bequad	x	\b, %lld bytes
+>>32	belong	1	\b, AES-encrypted
+
+>4	default x	(unknown version)
+
+0	string	QEVM		QEMU suspend to disk image
 
 0	string	Bochs\ Virtual\ HD\ Image	Bochs disk image,
 >32	string	x				type %s,
@@ -695,7 +841,12 @@
 # Dell's .hdr
 0	string $RBU
 >23	string Dell			%s system BIOS
->48	string x			version %.3s
+>5	byte   2
+>>48	byte   x			version %d.
+>>49	byte   x			\b%d.
+>>50	byte   x			\b%d
+>5	byte   <2
+>>48	string x			version %.3s
 
 # Type: Microsoft DirectDraw Surface
 # URL:	http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
@@ -714,3 +865,10 @@
 0	string	ITOLITLS		Microsoft Reader eBook Data
 >8	lelong	x			\b, version %u
 !:mime					application/x-ms-reader
+
+# Windows CE Binary Image Data Format
+# From: Dr. Jesus <j@hug.gs>
+0	string	B000FF\n	Windows Embedded CE binary image
+
+# Windows Imaging (WIM) Image
+0	string	MSWIM\000\000\000	Windows imaging (WIM) image

+ 33 - 0
magic/Magdir/msooxml

@@ -0,0 +1,33 @@
+
+#------------------------------------------------------------------------------
+# $File: msooxml,v 1.1 2011/01/25 18:36:19 christos Exp $
+# msooxml:  file(1) magic for Microsoft Office XML
+# From: Ralf Brown <ralf.brown@gmail.com>
+
+# .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
+#   archive.  The first member file is normally "[Content_Types].xml".
+# Since MSOOXML doesn't have anything like the uncompressed "mimetype"
+#   file of ePub or OpenDocument, we'll have to scan for a filename
+#   which can distinguish between the three types
+
+# start by checking for ZIP local file header signature
+0               string          PK\003\004
+# make sure the first file is correct
+>0x1E           string          [Content_Types].xml
+# skip to the second local file header
+#   since some documents include a 520-byte extra field following the file
+#   header,  we need to scan for the next header
+>>(18.l+49)     search/2000     PK\003\004
+# now skip to the *third* local file header; again, we need to scan due to a
+#   520-byte extra field following the file header
+>>>&26          search/1000     PK\003\004
+# and check the subdirectory name to determine which type of OOXML
+#   file we have
+>>>>&26         string          word/           Microsoft Word 2007+
+!:mime application/msword
+>>>>&26         string          ppt/            Microsoft PowerPoint 2007+
+!:mime application/vnd.ms-powerpoint
+>>>>&26         string          xl/             Microsoft Excel 2007+
+!:mime application/vnd.ms-excel
+>>>>&26         default         x               Microsoft OOXML
+!:strength +10

+ 12 - 0
magic/Magdir/oasis

@@ -0,0 +1,12 @@
+
+#------------------------------------------------------------------------------
+# $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $
+# OASIS
+# Summary: OASIS stream file
+# Long descripton: Open Artwork System Interchange Standard
+# File extension: .oas
+# Full name:	Ben Cowley (bcowley@broadcom.com)
+#		Philip Dixon (pdixon@broadcom.com)
+# Reference: http://www.wrcad.com/oasis/oasis-3626-042303-draft.pdf
+#		(see page 3)
+0	string	%SEMI-OASIS\r\n		OASIS Stream file

+ 3 - 3
magic/Magdir/ocaml

@@ -1,8 +1,8 @@
 
 #------------------------------------------------------------------------------
-# $File: ocaml,v 1.4 2009/09/19 16:28:11 christos Exp $
+# $File: ocaml,v 1.5 2010/09/20 18:55:20 rrt Exp $
 # ocaml: file(1) magic for Objective Caml files.
-0	string	Caml1999	Objective caml
+0	string	Caml1999	OCaml
 >8	string	X		exec file
 >8	string	I		interface file (.cmi)
 >8	string	O		object file (.cmo)
@@ -11,4 +11,4 @@
 >8	string	Z		native library file (.cmxa)
 >8	string	M		abstract syntax tree implementation file
 >8	string	N		abstract syntax tree interface file
->9	string	>\0		(Version %3.3s).
+>9	string	>\0		(Version %3.3s)

+ 1 - 8
magic/Magdir/os9

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: os9,v 1.6 2009/09/19 16:28:11 christos Exp $
+# $File: os9,v 1.7 2011/05/13 22:15:54 christos Exp $
 #
 # Copyright (c) 1996 Ignatios Souvatzis. All rights reserved.
 #
@@ -12,13 +12,6 @@
 # 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 Ignatios Souvatzis for
-#      the NetBSD project.
-# 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 ``AS IS'' AND ANY EXPRESS OR
 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

+ 22 - 0
magic/Magdir/parrot

@@ -0,0 +1,22 @@
+#------------------------------------------------------------------------------
+# $File: parrot,v 1.1 2010/07/08 20:18:40 christos Exp $
+# parrot: file(1) magic for Parrot Virtual Machine
+# URL:	http://www.lua.org/
+# From: Lubomir Rintel <lkundrak@v3.sk>
+
+# Compiled Parrot byte code
+0	string	\376PBC\r\n\032\n	Parrot bytecode
+>64	byte	x			%d.
+>72	byte	x			\b%d,
+>8	byte	>0			%d byte words,
+>16	byte	0			little-endian,
+>16	byte	1			big-endian,
+>32	byte	0			IEEE-754 8 byte double floats,
+>32	byte	1			x86 12 byte long double floats,
+>32	byte	2			IEEE-754 16 byte long double floats,
+>32	byte	3			MIPS 16 byte long double floats,
+>32	byte	4			AIX 16 byte long double floats,
+>32	byte	5			4-byte floats,
+>40	byte	x			Parrot %d.
+>48	byte	x			\b%d.
+>56	byte	x			\b%d

+ 5 - 1
magic/Magdir/printer

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: printer,v 1.22 2009/09/19 16:28:11 christos Exp $
+# $File: printer,v 1.25 2011/05/20 23:31:46 christos Exp $
 # printer:  file(1) magic for printer-formatted files
 #
 
@@ -64,6 +64,10 @@
 #>15	string		\ ENTER\ LANGUAGE\ =
 #>31	string		PostScript		PostScript
 
+# From: Stefan Thurner <thurners@nicsys.de>
+0	string		\033%-12345X@PJL
+>&0	search/10000	%!			PJL encapsulated PostScript document text
+
 # HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com)
 0	string		\033E\033	HP PCL printer data
 >3	string		\&l0A		- default page size

+ 34 - 4
magic/Magdir/python

@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: python,v 1.12 2009/10/27 14:49:57 christos Exp $
+# $File: python,v 1.18 2011/02/26 02:33:38 christos Exp $
 # python:  file(1) magic for python
 #
 # From: David Necas <yeti@physics.muni.cz>
 # often the module starts with a multiline string
-0	string		"""	a python script text executable
-# MAGIC as specified in Python/import.c (1.5 to 2.6a1 and 3.1a0, assuming
+0	string/t	"""	a python script text executable
+# MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming
 # that Py_UnicodeFlag is off for Python 2)
 # 20121  ( YEAR - 1995 ) + MONTH  + DAY (little endian followed by "\r\n"
 0	belong		0x994e0d0a	python 1.5/1.6 byte-compiled
@@ -17,8 +17,10 @@
 0	belong		0x6df20d0a	python 2.4 byte-compiled
 0	belong		0xb3f20d0a	python 2.5 byte-compiled
 0	belong		0xd1f20d0a	python 2.6 byte-compiled
+0	belong		0x03f30d0a	python 2.7 byte-compiled
 0	belong		0x3b0c0d0a	python 3.0 byte-compiled
 0	belong		0x4f0c0d0a	python 3.1 byte-compiled
+0	belong		0x6c0c0d0a	python 3.2 byte-compiled
 
 0	search/1/w	#!\ /usr/bin/python	Python script text executable
 !:mime text/x-python
@@ -26,5 +28,33 @@
 !:mime text/x-python
 0	search/1	#!/usr/bin/env\ python	Python script text executable
 !:mime text/x-python
-0	search/1	#!\ /usr/bin/env\ ruby	Python script text executable
+0	search/1	#!\ /usr/bin/env\ python	Python script text executable
+!:mime text/x-python
+
+
+# from module.submodule import func1, func2
+0	regex	\^from\\s+(\\w|\\.)+\\s+import.*$	Python script text executable
+!:mime text/x-python
+
+# def __init__ (self, ...):
+0	search/4096	def\ __init__
+>&0	search/64 self	Python script text executable
+!:mime text/x-python
+
+# comments
+0	search/4096	'''
+>&0	regex	.*'''$	Python script text executable
+!:mime text/x-python
+
+0	search/4096	"""
+>&0	regex	.*"""$	Python script text executable
+!:mime text/x-python
+
+# try:
+# except: or finally:
+# block
+0	search/4096	try:
+>&0	regex	\^\\s*except.*:	Python script text executable
+!:mime text/x-python
+>&0	search/4096	finally:	Python script text executable
 !:mime text/x-python

+ 34 - 2
magic/Magdir/revision

@@ -1,9 +1,9 @@
 
 #------------------------------------------------------------------------------
-# $File: revision,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: revision,v 1.8 2010/11/25 15:00:12 christos Exp $
 # file(1) magic for revision control files
 # From Hendrik Scholz <hendrik@scholz.net>
-0	string	/1\ :pserver:	cvs password text file
+0	string/t	/1\ :pserver:	cvs password text file
 
 # Conary changesets
 # From: Jonathan Smith <smithj@rpath.com>
@@ -13,8 +13,40 @@
 # From: Josh Triplett <josh@freedesktop.org>
 0	string	#\ v2\ git\ bundle\n	Git bundle
 
+# Type: Git pack
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+# The actual magic is 'PACK', but that clashes with Doom/Quake packs. However,
+# those have a little-endian offset immediately following the magic 'PACK',
+# the first byte of which is never 0, while the first byte of the Git pack
+# version, since it's a tiny number stored in big-endian format, is always 0.
+0	string	PACK\0		Git pack
+>4	belong	>0		\b, version %d
+>>8	belong	>0		\b, %d objects
+
+# Type: Git pack index
+# From: Adam Buchbinder <adam.buchbinder@gmail.com>
+0	string	\377tOc		Git pack index
+>4	belong	=2		\b, version 2
+
+# Type: Git index file
+# From: Frédéric Brière <fbriere@fbriere.net>
+0	string	DIRC		Git index
+>4	belong	>0		\b, version %d
+>>8	belong	>0		\b, %d entries
+
 # Type:	Mercurial bundles
 # From:	Seo Sanghyeon <tinuviel@sparcs.kaist.ac.kr>
 0	string	HG10		Mercurial bundle,
 >4	string	UN		uncompressed
 >4	string	BZ		bzip2 compressed
+
+# Type:	Subversion (SVN) dumps
+# From:	Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
+0	string	SVN-fs-dump-format-version:	Subversion dumpfile
+>28	string	>\0				(version: %s)
+
+# Type:	Bazaar revision bundles and merge requests
+# URL:	http://www.bazaar-vcs.org/
+# From:	Jelmer Vernooij <jelmer@samba.org>
+0	string	#\ Bazaar\ revision\ bundle\ v Bazaar Bundle
+0	string	#\ Bazaar\ merge\ directive\ format Bazaar merge directive

+ 31 - 1
magic/Magdir/riff

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: riff,v 1.18 2009/09/19 16:28:12 christos Exp $
+# $File: riff,v 1.21 2011/02/10 01:52:51 christos Exp $
 # riff:  file(1) magic for RIFF format
 # See
 #
@@ -40,12 +40,14 @@
 >>20	leshort		2		\b, Microsoft ADPCM
 >>20	leshort		6		\b, ITU G.711 A-law
 >>20	leshort		7		\b, ITU G.711 mu-law
+>>20	leshort		8		\b, Microsoft DTS
 >>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
+>>20	leshort		0x2001		\b, DTS
 >>22	leshort		=1		\b, mono
 >>22	leshort		=2		\b, stereo
 >>22	leshort		>2		\b, %d channels
@@ -224,3 +226,31 @@
 >8	string		NIFF		\b, Notation Interchange File Format
 # SoundFont 2 <mpruett@sgi.com>
 >8	string		sfbk		SoundFont/Bank
+
+#------------------------------------------------------------------------------
+# Sony Wave64
+# see http://www.vcs.de/fileadmin/user_upload/MBS/PDF/Whitepaper/Informations_about_Sony_Wave64.pdf
+# 128 bit RIFF-GUID { 66666972-912E-11CF-A5D6-28DB04C10000 } in little-endian 
+0	string	riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00		Sony Wave64 RIFF data
+# 128 bit + total file size (64 bits) so 24 bytes
+# then WAVE-GUID { 65766177-ACF3-11D3-8CD1-00C04F8EDB8A }
+>24	string		wave\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b, WAVE 64 audio
+!:mime	audio/x-w64
+# FMT-GUID { 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A }
+>>40	search/256	fmt\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b
+>>>&10	leshort		=1		\b, mono
+>>>&10	leshort		=2		\b, stereo
+>>>&10	leshort		>2		\b, %d channels
+>>>&12	lelong		>0		%d Hz
+
+#------------------------------------------------------------------------------
+# MBWF/RF64
+# see EBU – TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
+0	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
+!:mime	audio/x-wav
+>40	search/256	fmt\x20		\b
+>>&6	leshort		=1		\b, mono
+>>&6	leshort		=2		\b, stereo
+>>&6	leshort		>2		\b, %d channels
+>>&8	lelong		>0		%d Hz
+

+ 44 - 0
magic/Magdir/rinex

@@ -0,0 +1,44 @@
+
+#------------------------------------------------------------------------------
+# $File: rinex,v 1.4 2011/05/03 01:44:17 christos Exp $
+# rinex:  file(1) magic for RINEX files
+# http://igscb.jpl.nasa.gov/igscb/data/format/rinex210.txt
+# ftp://cddis.gsfc.nasa.gov/pub/reports/formats/rinex300.pdf
+# data for testing: ftp://cddis.gsfc.nasa.gov/pub/gps/data
+60	string		RINEX
+>80	search/256	XXRINEXB	RINEX Data, GEO SBAS Broadcast
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/broadcast
+>80	search/256	XXRINEXD	RINEX Data, Observation (Hatanaka comp)
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/observation
+>80	search/256	XXRINEXC	RINEX Data, Clock
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/clock
+>80	search/256	XXRINEXH	RINEX Data, GEO SBAS Navigation
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/navigation
+>80	search/256	XXRINEXG	RINEX Data, GLONASS Navigation
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/navigation
+>80	search/256	XXRINEXL	RINEX Data, Galileo Navigation
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/navigation
+>80	search/256	XXRINEXM	RINEX Data, Meteorological
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/meteorological
+>80	search/256	XXRINEXN	RINEX Data, Navigation	
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/navigation
+>80	search/256	XXRINEXO	RINEX Data, Observation
+>>&32	string		x		\b, date %15.15s
+>>5	string		x		\b, version %6.6s
+!:mime	rinex/observation

+ 31 - 17
magic/Magdir/rpm

@@ -1,26 +1,34 @@
 
 #------------------------------------------------------------------------------
-# $File: rpm,v 1.9 2009/11/06 13:53:52 christos Exp $
+# $File: rpm,v 1.11 2011/06/14 12:47:41 christos Exp $
 #
 # RPM: file(1) magic for Red Hat Packages   Erik Troan (ewt@redhat.com)
 #
-0	beshort		0xedab
->2	beshort		0xeedb		RPM
+0	belong		0xedabeedb	RPM
 !:mime	application/x-rpm
->>4	byte		x		v%d
->>5	byte		x		\b.%d
->>6	beshort		1		src
->>6	beshort		0		bin
->>>8	beshort		1		i386/x86_64
->>>8	beshort		2		Alpha/Sparc64
->>>8	beshort		3		Sparc
->>>8	beshort		4		MIPS
->>>8	beshort		5		PowerPC
->>>8	beshort		6		68000
->>>8	beshort		7		SGI
->>>8	beshort		8		RS6000
->>>8	beshort		9		IA64
->>>8	beshort		10		Sparc64
+>4	byte		x		v%d
+>5	byte		x		\b.%d
+>6	beshort		1		src
+>6	beshort		0		bin
+>>8	beshort		1		i386/x86_64
+>>8	beshort		2		Alpha/Sparc64
+>>8	beshort		3		Sparc
+>>8	beshort		4		MIPS
+>>8	beshort		5		PowerPC
+>>8	beshort		6		68000
+>>8	beshort		7		SGI
+>>8	beshort		8		RS6000
+>>8	beshort		9		IA64
+>>8	beshort		10		Sparc64
+>>8	beshort		11		MIPSel
+>>8	beshort		12		ARM
+>>8	beshort		13		MiNT
+>>8	beshort		14		S/390
+>>8	beshort		15		S/390x
+>>8	beshort		16		PowerPC64
+>>8	beshort		17		SuperH
+>>8	beshort		18		Xtensa
+>>8	beshort		255		noarch
 
 #delta RPM    Daniel Novotny (dnovotny@redhat.com)
 0	string	drpm	Delta RPM
@@ -36,3 +44,9 @@
 >>>8	beshort		17		SuperH
 >>>8	beshort		18		Xtensa
 >>10	string		x		%s
+
+# Type:	Delta RPM
+# From:	Daniel Novotny (dnovotny@redhat.com)
+0	string		drpm		Delta RPM
+!:mime application/x-rpm
+>12	string		x		%s

+ 13 - 1
magic/Magdir/ruby

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ruby,v 1.3 2009/09/19 16:28:12 christos Exp $
+# $File: ruby,v 1.5 2010/07/21 16:47:17 christos Exp $
 # ruby:  file(1) magic for Ruby scripting language
 # URL:  http://www.ruby-lang.org/
 # From: Reuben Thomas <rrt@sc3d.org>
@@ -14,3 +14,15 @@
 !:mime text/x-ruby
 0	search/1	#!\ /usr/bin/env\ ruby	Ruby script text executable
 !:mime text/x-ruby
+
+# What looks like ruby, but does not have a shebang
+# (modules and such)
+# From: Lubomir Rintel <lkundrak@v3.sk>
+0	regex		\^[\ \t]*require[\ \t]'[A-Za-z_/]+'
+>0	regex		include\ [A-Z]|def\ [a-z]|\ do$
+>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby script text
+!:mime	text/x-ruby
+0	regex		\^[\ \t]*(class|module)[\ \t][A-Z]
+>0	regex		(modul|includ)e\ [A-Z]|def\ [a-z]
+>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby module source text
+!:mime	text/x-ruby

+ 34 - 1
magic/Magdir/scientific

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: scientific,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: scientific,v 1.7 2010/09/20 19:19:17 rrt Exp $
 # scientific:  file(1) magic for scientific formats 
 #
 # From: Joe Krahn <krahn@niehs.nih.gov>
@@ -71,3 +71,36 @@
 0	string	\060\000\040\000\110\000\105\000\101\000\104\000		GEDCOM data
 0	string	\376\377\000\060\000\040\000\110\000\105\000\101\000\104	GEDCOM data
 0	string	\377\376\060\000\040\000\110\000\105\000\101\000\104\000	GEDCOM data
+
+# PDB: Protein Data Bank files
+# Adam Buchbinder <adam.buchbinder@gmail.com>
+#
+# http://www.wwpdb.org/documentation/format32/sect2.html
+# http://www.ch.ic.ac.uk/chemime/
+#
+# The PDB file format is fixed-field, 80 columns. From the spec:
+#
+# COLS        DATA
+#  1 -  6      "HEADER"
+#  11 - 50     String(40)
+#  51 - 59     Date
+#  63 - 66     IDcode
+#
+# Thus, positions 7-10, 60-62 and 67-80 are spaces. The Date must be in the
+# format DD-MMM-YY, e.g., 01-JAN-70, and the IDcode consists of numbers and
+# uppercase letters. However, examples have been seen without the date string,
+# e.g., the example on the chemime site.
+0	string	HEADER\ \ \ \ 
+>&0	regex/1	\^.{40}
+>>&0	regex/1	[0-9]{2}-[A-Z]{3}-[0-9]{2}\ {3}
+>>>&0	regex/1s	[A-Z0-9]{4}.{14}$
+>>>>&0	regex/1	[A-Z0-9]{4}	Protein Data Bank data, ID Code %s
+!:mime	chemical/x-pdb
+>>>>0	regex/1	[0-9]{2}-[A-Z]{3}-[0-9]{2}	\b, %s
+
+# Type:	GDSII Stream file
+0	belong	0x00060002	GDSII Stream file
+>4	byte	0x00
+>>5	byte	x		version %d.0
+>4	byte	>0x00		version %d
+>>5	byte	x		\b.%d

+ 24 - 0
magic/Magdir/selinux

@@ -0,0 +1,24 @@
+# Type:	SE Linux policy modules *.pp reference policy
+#	for Fedora 5 to 9, RHEL5, and Debian Etch and Lenny.
+# URL:	http://doc.coker.com.au/computers/selinux-magic
+# From:	Russell Coker <russell@coker.com.au>
+
+0		lelong	0xf97cff8f	SE Linux modular policy
+>4		lelong	x		version %d,
+>8		lelong	x		%d sections,
+>>(12.l)	lelong	0xf97cff8d
+>>>(12.l+27)	lelong	x		mod version %d,
+>>>(12.l+31)	lelong	0		Not MLS,
+>>>(12.l+31)	lelong	1		MLS,
+>>>(12.l+23)	lelong	2
+>>>>(12.l+47)	string	>\0		module name %s
+>>>(12.l+23)	lelong	1		base
+
+1	string	policy_module(	SE Linux policy module source
+2	string	policy_module(	SE Linux policy module source
+
+0	string	##\ <summary>	SE Linux policy interface source
+
+#0	search	gen_context(	SE Linux policy file contexts
+
+#0	search	gen_sens(	SE Linux policy MLS constraints source

+ 2 - 2
magic/Magdir/sgi

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: sgi,v 1.17 2009/09/19 16:28:12 christos Exp $
+# $File: sgi,v 1.18 2010/11/25 15:00:12 christos Exp $
 # sgi:  file(1) magic for Silicon Graphics applications
 
 #
@@ -61,7 +61,7 @@
 >11	byte	x				dataformat %d
 
 # Alias Maya files
-0	string	//Maya ASCII	Alias Maya Ascii File,
+0	string/t	//Maya ASCII	Alias Maya Ascii File,
 >13	string	>\0	version %s
 8	string	MAYAFOR4	Alias Maya Binary File,
 >32	string	>\0	version %s scene

+ 20 - 20
magic/Magdir/sgml

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: sgml,v 1.24 2009/09/19 17:31:35 christos Exp $
+# $File: sgml,v 1.26 2011/04/16 15:20:04 christos Exp $
 # Type:	SVG Vectorial Graphics
 # From:	Noel Torres <tecnico@ejerciciosresueltos.com>
 0	string		\<?xml\ version="
@@ -10,21 +10,21 @@
 !:mime	application/x-gnucash
 
 # Sitemap file
-0	string		\<?xml\ version="
+0	string/t		\<?xml\ version="
 >15	string		>\0
 >>19	search/4096	\<urlset		XML Sitemap document text
 !:mime	application/xml-sitemap
 
 # xhtml
-0	string		\<?xml\ version="
+0	string/t		\<?xml\ version="
 >15	string		>\0
 >>19	search/4096/cWbt	\<!doctype\ html	xHTML document text
 !:mime	text/html
-0	string		\<?xml\ version='
+0	string/t		\<?xml\ version='
 >15	string		>\0
 >>19	search/4096/cWbt	\<!doctype\ html	xHTML document text
 !:mime	text/html
-0	string		\<?xml\ version="
+0	string/t		\<?xml\ version="
 >15	string		>\0
 >>19	search/4096/cWbt	\<html	broken xHTML document text
 !:mime	text/html
@@ -34,30 +34,30 @@
 # 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	search/4096/cWbt	\<!doctype\ html	HTML document text
+0	search/4096/cWt	\<!doctype\ html	HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<head			HTML document text
+0	search/4096/cwt	\<head			HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<title			HTML document text
+0	search/4096/cwt	\<title			HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<html			HTML document text
+0	search/4096/cwt	\<html			HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<script 		HTML document text
+0	search/4096/cwt	\<script 		HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<style 		HTML document text
+0	search/4096/cwt	\<style 		HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<table			HTML document text
+0	search/4096/cwt	\<table			HTML document text
 !:mime	text/html
-0	search/4096/cwbt	\<a\ href=		HTML document text
+0	search/4096/cwt	\<a\ href=		HTML document text
 !:mime	text/html
 
 # Extensible markup language (XML), a subset of SGML
 # from Marc Prud'hommeaux (marc@apocalypse.org)
-0	search/1/cwbt	\<?xml			XML document text
+0	search/1/cwt	\<?xml			XML document text
 !:mime	application/xml
-0	string		\<?xml\ version\ "	XML
+0	string/t		\<?xml\ version\ "	XML
 !:mime	application/xml
-0	string		\<?xml\ version="	XML
+0	string/t		\<?xml\ version="	XML
 !:mime	application/xml
 >15	search/1	>\0			%.3s document text
 >>23	search/1	\<xsl:stylesheet	(XSL stylesheet)
@@ -70,15 +70,15 @@
 0	search/1/wbt	\<?xml			XML document text
 !:mime	application/xml
 !:strength - 10
-0	search/1/wbt	\<?XML			broken XML document text
+0	search/1/wt	\<?XML			broken XML document text
 !:mime	application/xml
 !:strength - 10
 
 
 # SGML, mostly from rph@sq
-0	search/4096/cwbt	\<!doctype		exported SGML document text
-0	search/4096/cwbt	\<!subdoc		exported SGML subdocument text
-0	search/4096/cwbt	\<!--			exported SGML document text
+0	search/4096/cwt	\<!doctype		exported SGML document text
+0	search/4096/cwt	\<!subdoc		exported SGML subdocument text
+0	search/4096/cwt	\<!--			exported SGML document text
 !:strength - 10
 
 # Web browser cookie files

+ 18 - 0
magic/Magdir/sisu

@@ -0,0 +1,18 @@
+# Type: SiSU Markup Language
+# URL:  http://www.sisudoc.org/
+# From: Ralph Amissah <ralph.amissah@gmail.com>
+
+0	regex	\^%?[\ \t]*SiSU[\ \t]+insert	SiSU text insert
+>5	regex	[0-9.]+				%s
+
+0	regex	\^%[\ \t]+SiSU[\ \t]+master	SiSU text master
+>5	regex	[0-9.]+				%s
+
+0	regex	\^%?[\ \t]*SiSU[\ \t]+text	SiSU text
+>5	regex	[0-9.]+				%s
+
+0	regex	\^%?[\ \t]*SiSU[\ \t][0-9.]+	SiSU text
+>5	regex	[0-9.]+				%s
+
+0	regex	\^%*[\ \t]*sisu-[0-9.]+		SiSU text
+>5	regex	[0-9.]+				%s

+ 30 - 1
magic/Magdir/sniffer

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: sniffer,v 1.14 2009/09/19 16:28:12 christos Exp $
+# $File: sniffer,v 1.17 2011/07/11 19:42:02 christos Exp $
 # sniffer:  file(1) magic for packet capture files
 #
 # From: guy@alum.mit.edu (Guy Harris)
@@ -74,6 +74,7 @@
 # that use "libpcap", or that use the same capture file format.)
 #
 0	ubelong		0xa1b2c3d4	tcpdump capture file (big-endian)
+!:mime	application/vnd.tcpdump.pcap
 >4	beshort		x		- version %d
 >6	beshort		x		\b.%d
 >20	belong		0		(No link-layer encapsulation
@@ -138,6 +139,7 @@
 >20	belong		163		(802.11 with AVS header
 >16	belong		x		\b, capture length %d)
 0	ulelong		0xa1b2c3d4	tcpdump capture file (little-endian)
+!:mime	application/vnd.tcpdump.pcap
 >4	leshort		x		- version %d
 >6	leshort		x		\b.%d
 >20	lelong		0		(No link-layer encapsulation
@@ -248,6 +250,33 @@
 >16	lelong		x		\b, capture length %d)
 
 #
+# "pcapng" capture files.
+# http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html
+#
+0	ubelong		0x0a0d0d0a
+>8	ubelong		0x1a2b3c4d	pcapng capture file (big-endian)
+>>12	beshort		x		- version %d
+>>14	beshort		x		\b.%d
+>8	ulelong		0x1a2b3c4d	pcapng capture file (little-endian)
+>>12	leshort		x		- version %d
+>>14	leshort		x		\b.%d
+
+#
+# "pcap-ng" capture files.
+# http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html
+# Pcap-ng files can contain multiple sections. Printing the endianness,
+# snaplen, or other information from the first SHB may be misleading.
+#
+0	ubelong		0x0a0d0d0a
+>8	ubelong		0x1a2b3c4d	pcap-ng capture file
+>>12	beshort		x		- version %d
+>>14	beshort		x		\b.%d
+0	ulelong		0x0a0d0d0a
+>8	ulelong		0x1a2b3c4d	pcap-ng capture file
+>>12	leshort		x		- version %d
+>>14	leshort		x		\b.%d
+
+#
 # AIX "iptrace" capture files.
 #
 0	string		iptrace\ 1.0	"iptrace" capture file

+ 12 - 8
magic/Magdir/spectrum

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: spectrum,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: spectrum,v 1.7 2010/09/20 18:55:20 rrt Exp $
 # spectrum:  file(1) magic for Spectrum emulator files.
 #
 # John Elliott <jce@seasip.demon.co.uk>
@@ -20,13 +20,17 @@
 # Tape file. This assumes the .TAP starts with a Spectrum-format header,
 # which nearly all will.
 #
-0       string          \023\000\000    Spectrum .TAP data
->4      string          x               "%-10.10s"
->3      byte            0               - BASIC program
->3      byte            1               - number array
->3      byte            2               - character array
->3      byte            3               - memory block
->>14    belong          0x001B0040      (screen)
+# Update: Sanity-check string contents to be printable.
+#  -Adam Buchbinder <adam.buchbinder@gmail.com>
+#
+0       string          \023\000\000
+>4      string          >\0
+>>4     string          <\177           Spectrum .TAP data "%-10.10s"
+>>>3    byte            0               - BASIC program
+>>>3    byte            1               - number array
+>>>3    byte            2               - character array
+>>>3    byte            3               - memory block
+>>>>14  belong          0x001B0040      (screen)
 
 # The following three blocks are from pak21-spectrum@srcf.ucam.org
 # TZX tape images

+ 8 - 0
magic/Magdir/ssh

@@ -0,0 +1,8 @@
+# Type:	OpenSSH key files
+# From:	Nicolas Collignon <tsointsoin@gmail.com>
+
+0	string	SSH\ PRIVATE\ KEY	OpenSSH RSA1 private key,
+>28	string	>\0			version %s
+
+0	string	ssh-dss\ 		OpenSSH DSA public key
+0	string	ssh-rsa\ 		OpenSSH RSA public key

+ 7 - 0
magic/Magdir/ssl

@@ -0,0 +1,7 @@
+# Type: OpenSSL certificates/key files
+# From: Nicolas Collignon <tsointsoin@gmail.com>
+
+0	string	-----BEGIN\ CERTIFICATE-----	PEM certificate
+0	string	-----BEGIN\ CERTIFICATE\ REQ	PEM certificate request
+0	string	-----BEGIN\ RSA\ PRIVATE	PEM RSA private key
+0	string	-----BEGIN\ DSA\ PRIVATE	PEM DSA private key

+ 3 - 1
magic/Magdir/sun

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: sun,v 1.20 2009/09/19 16:28:12 christos Exp $
+# $File: sun,v 1.22 2011/02/10 01:52:51 christos Exp $
 # sun:  file(1) magic for Sun machines
 #
 # Values for big-endian Sun (MC680x0, SPARC) binaries on pre-5.x
@@ -113,8 +113,10 @@
 
 # Microsoft ICM color profile
 36	string		acspMSFT	Microsoft ICM Color Profile
+!:mime	application/vnd.iccprofile
 # Sun KCMS
 36	string		acsp		Kodak Color Management System, ICC Profile
+!:mime	application/vnd.iccprofile
 
 #---------------------------------------------------------------------------
 # The following entries have been tested by Duncan Laurie <duncan@sun.com> (a

+ 29 - 0
magic/Magdir/tcl

@@ -0,0 +1,29 @@
+#------------------------------------------------------------------------------
+# file:  file(1) magic for Tcl scripting language
+# URL:  http://www.tcl.tk/
+# From: gustaf neumann
+
+# Tcl scripts
+0	search/1/w	#!\ /usr/bin/tcl	Tcl script text executable
+!:mime	text/x-lua
+0	search/1/w	#!\ /usr/local/bin/tcl	Tcl script text executable
+!:mime	text/x-tcl
+0	search/1	#!/usr/bin/env\ tcl	Tcl script text executable
+!:mime	text/x-tcl
+0	search/1	#!\ /usr/bin/env\ tcl	Tcl script text executable
+!:mime	text/x-tcl
+0	search/1/w	#!\ /usr/bin/wish	Tcl/Tk script text executable
+!:mime	text/x-tcl
+0	search/1/w	#!\ /usr/local/bin/wish	Tcl/Tk script text executable
+!:mime	text/x-tcl
+0	search/1	#!/usr/bin/env\ wish	Tcl/Tk script text executable
+!:mime	text/x-tcl
+0	search/1	#!\ /usr/bin/env\ wish	Tcl/Tk script text executable
+!:mime	text/x-tcl
+
+# check the first line
+0	search/1	package\ req
+>0	regex		\^package[\ \t]+req	Tcl script
+# not 'p', check other lines
+0	search/1	!p
+>0	regex		\^package[\ \t]+req	Tcl script

+ 25 - 15
magic/Magdir/tex

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: tex,v 1.16 2009/09/19 16:28:12 christos Exp $
+# $File: tex,v 1.18 2011/02/08 13:45:15 christos Exp $
 # tex:  file(1) magic for TeX files
 #
 # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
@@ -37,34 +37,42 @@
 !:mime	text/x-info
 
 # TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
-0	search/400	\\input		TeX document text
+0	search/4096	\\input		TeX document text
 !:mime	text/x-tex
-0	search/400	\\section	LaTeX document text
+!:strength + 15
+0	search/4096	\\section	LaTeX document text
 !:mime	text/x-tex
-0	search/400	\\setlength	LaTeX document text
+!:strength + 18
+0	search/4096	\\setlength	LaTeX document text
 !:mime	text/x-tex
-0	search/400	\\documentstyle	LaTeX document text
+!:strength + 15
+0	search/4096	\\documentstyle	LaTeX document text
 !:mime	text/x-tex
-0	search/400	\\chapter	LaTeX document text
+!:strength + 18
+0	search/4096	\\chapter	LaTeX document text
 !:mime	text/x-tex
-0	search/400	\\documentclass	LaTeX 2e document text
+!:strength + 18
+0	search/4096	\\documentclass	LaTeX 2e document text
 !:mime	text/x-tex
-0	search/400	\\relax		LaTeX auxiliary file
+!:strength + 15
+0	search/4096	\\relax		LaTeX auxiliary file
 !:mime	text/x-tex
-0	search/400	\\contentsline	LaTeX table of contents
+!:strength + 15
+0	search/4096	\\contentsline	LaTeX table of contents
 !:mime	text/x-tex
-0	search/400	%\ -*-latex-*-	LaTeX document text
+!:strength + 15
+0	search/4096	%\ -*-latex-*-	LaTeX document text
 !:mime	text/x-tex
 
 # Tex document, from Hendrik Scholz <hendrik@scholz.net>
 0   	search/1	\\ifx		TeX document text
 
 # Index and glossary files
-0	search/400	\\indexentry	LaTeX raw index file
-0	search/400	\\begin{theindex}	LaTeX sorted index
-0	search/400	\\glossaryentry	LaTeX raw glossary
-0	search/400	\\begin{theglossary}	LaTeX sorted glossary
-0	search/400	This\ is\ makeindex	Makeindex log file
+0	search/4096	\\indexentry	LaTeX raw index file
+0	search/4096	\\begin{theindex}	LaTeX sorted index
+0	search/4096	\\glossaryentry	LaTeX raw glossary
+0	search/4096	\\begin{theglossary}	LaTeX sorted glossary
+0	search/4096	This\ is\ makeindex	Makeindex log file
 
 # End of TeX
 
@@ -93,3 +101,5 @@
 0	search/1	%\ BibTeX\ `	BibTeX custom bibliography style text file
 
 0	search/1	@c\ @mapfile{	TeX font aliases text file
+
+0	string		#LyX		LyX document text

+ 3 - 4
magic/Magdir/tgif

@@ -1,8 +1,7 @@
 
 #------------------------------------------------------------------------------
-# $File: tgif,v 1.5 2009/09/19 16:28:12 christos Exp $
+# $File: tgif,v 1.7 2010/09/20 19:03:46 rrt Exp $
 # file(1) magic for tgif(1) files
 # From Hendrik Scholz <hendrik@scholz.net>
-
-0	string	%TGIF\ x 		Tgif file version %s
-
+0	string	%TGIF\ 			Tgif file version
+>6	string	x			%s

+ 2 - 2
magic/Magdir/unicode

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: unicode,v 1.5 2009/09/19 16:28:13 christos Exp $
+# $File: unicode,v 1.6 2010/09/20 18:55:20 rrt Exp $
 # Unicode:  BOM prefixed text files - Adrian Havill <havill@turbolinux.co.jp>
 # GRR: These types should be recognised in file_ascmagic so these
 # encodings can be treated by text patterns.
@@ -11,6 +11,6 @@
 0	string	+/v+			Unicode text, UTF-7
 0	string	+/v/			Unicode text, UTF-7
 0	string	\335\163\146\163	Unicode text, UTF-8-EBCDIC
-0	string	\376\377\000\000	Unicode text, UTF-32, big-endian
+0	string	\000\000\376\377	Unicode text, UTF-32, big-endian
 0	string	\377\376\000\000	Unicode text, UTF-32, little-endian
 0	string	\016\376\377		Unicode text, SCSU (Standard Compression Scheme for Unicode)

+ 6 - 3
magic/Magdir/varied.out

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: varied.out,v 1.21 2009/09/19 16:28:13 christos Exp $
+# $File: varied.out,v 1.22 2010/07/02 00:06:27 christos Exp $
 # varied.out:  file(1) magic for various USG systems
 #
 #	Herewith many of the object file formats used by USG systems.
@@ -28,9 +28,12 @@
 0	string		gmon		GNU prof performance data
 >4	long		x		- version %ld
 # From: Dave Pearson <davep@davep.org>
-# Harbour <URL:http://www.harbour-project.org/> HRB files.
+# Harbour <URL:http://harbour-project.org/> HRB files.
 0	string		\xc0HRB		Harbour HRB file
->4	short		x		version %d
+>4	leshort		x		version %d
+# Harbour HBV files
+0	string		\xc0HBV		Harbour variable dump file
+>4	leshort		x		version %d
 
 # From: Alex Beregszaszi <alex@fsn.hu>
 # 0	string		exec 		BugOS executable

+ 5 - 5
magic/Magdir/varied.script

@@ -1,15 +1,15 @@
 
 #------------------------------------------------------------------------------
-# $File: varied.script,v 1.6 2009/09/19 16:28:13 christos Exp $
+# $File: varied.script,v 1.7 2010/11/25 15:00:12 christos Exp $
 # varied.script:  file(1) magic for various interpreter scripts
 
-0	string		#!\ /			a
+0	string/t		#!\ /			a
 >3	string		>\0			%s script text executable
-0	string		#!\t/			a
+0	string/t		#!\t/			a
 >3	string		>\0			%s script text executable
-0	string		#!/			a
+0	string/t		#!/			a
 >2	string		>\0			%s script text executable
-0	string		#!\ 			script text executable
+0	string/t		#!\ 			script text executable
 >3	string		>\0			for %s
 
 # From: arno <arenevier@fdn.fr>

+ 10 - 1
magic/Magdir/warc

@@ -1,7 +1,16 @@
 
 #------------------------------------------------------------------------------
-# $File: warc,v 1.2 2009/09/19 16:28:13 christos Exp $
+# $File: warc,v 1.3 2010/11/25 15:05:43 christos Exp $
 # warc:  file(1) magic for WARC files
 
 0	string	WARC/	WARC Archive
 >5	string	x	version %.4s
+!:mime application/warc
+
+#------------------------------------------------------------------------------
+# Arc File Format from Internet Archive
+# see http://www.archive.org/web/researcher/ArcFileFormat.php
+0      string          filedesc://     Internet Archive File
+!:mime application/x-ia-arc
+>11    search/256      \x0A    \b
+>>&0   ubyte   >0      \b version %c

+ 12 - 1
magic/Magdir/wordprocessors

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: wordprocessors,v 1.14 2009/09/19 16:28:13 christos Exp $
+# $File: wordprocessors,v 1.15 2010/09/20 19:19:17 rrt Exp $
 # wordprocessors:  file(1) magic fo word processors.
 #
 ####### PWP file format used on Smith Corona Personal Word Processors:
@@ -150,3 +150,14 @@
 0	string		DOC
 >43	byte		0x16	Just System Word Processor Ichitaro v6
 !:mime	application/x-ichitaro6
+
+# Type: Freemind mindmap documents
+# From: Jamie Thompson <debian-bugs@jamie-thompson.co.uk>
+0	string/w	\<map\ version	Freemind document
+!:mime	application/x-freemind
+
+# Type:        Scribus
+# From:        Werner Fink <werner@suse.de>
+0	string	\<SCRIBUSUTF8\ Version		Scribus Document
+0	string	\<SCRIBUSUTF8NEW\ Version	Scribus Document
+!:mime	application/x-scribus

+ 0 - 0
magic/Magdir/wsdl


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