Browse Source

Import upstream version 4.23

Christos Zoulas 16 years ago
parent
commit
de8dcb9b0b
58 changed files with 7794 additions and 5789 deletions
  1. 81 0
      ChangeLog
  2. 75 64
      Makefile.in
  3. 0 4
      acinclude.m4
  4. 93 81
      aclocal.m4
  5. 337 296
      config.guess
  6. 19 2
      config.h.in
  7. 125 58
      config.sub
  8. 5209 4471
      configure
  9. 13 5
      configure.in
  10. 59 5
      depcomp
  11. 56 50
      doc/Makefile.in
  12. 13 8
      doc/file.man
  13. 6 3
      doc/libmagic.man
  14. 20 2
      doc/magic.man
  15. 266 82
      install-sh
  16. 35 0
      magic/Magdir/acorn
  17. 11 0
      magic/Magdir/animation
  18. 41 0
      magic/Magdir/apple
  19. 17 0
      magic/Magdir/archive
  20. 7 0
      magic/Magdir/audio
  21. 34 14
      magic/Magdir/blender
  22. 2 1
      magic/Magdir/commands
  23. 61 0
      magic/Magdir/console
  24. 10 0
      magic/Magdir/database
  25. 14 0
      magic/Magdir/efi
  26. 17 16
      magic/Magdir/elf
  27. 140 91
      magic/Magdir/filesystems
  28. 2 0
      magic/Magdir/fortran
  29. 14 0
      magic/Magdir/java
  30. 1 1
      magic/Magdir/macintosh
  31. 48 11
      magic/Magdir/msdos
  32. 6 0
      magic/Magdir/pdf
  33. 5 2
      magic/Magdir/sgi
  34. 2 0
      magic/Makefile.am
  35. 54 47
      magic/Makefile.in
  36. 92 58
      magic/magic.mime
  37. 34 27
      missing
  38. 4 1
      mkinstalldirs
  39. 50 45
      python/Makefile.in
  40. 2 1
      src/Makefile.am
  41. 75 65
      src/Makefile.in
  42. 85 6
      src/apprentice.c
  43. 17 17
      src/ascmagic.c
  44. 18 9
      src/compress.c
  45. 49 77
      src/file.c
  46. 12 2
      src/file.h
  47. 48 0
      src/file_opts.h
  48. 9 6
      src/fsmagic.c
  49. 70 47
      src/funcs.c
  50. 19 20
      src/is_tar.c
  51. 31 23
      src/magic.c
  52. 16 11
      src/magic.h
  53. 13 15
      src/names.h
  54. 8 2
      src/patchlevel.h
  55. 13 4
      src/print.c
  56. 38 21
      src/readelf.c
  57. 3 6
      src/readelf.h
  58. 195 12
      src/softmagic.c

+ 81 - 0
ChangeLog

@@ -1,3 +1,84 @@
+2007-12-28 15:06 Christos Zoulas <christos@zoulas.com>
+
+	* strtof detection
+
+	* remove bogus regex magic that could cause a DoS
+
+	* better mismatch version message
+
+2007-12-27 11:35 Christos Zoulas <christos@zoulas.com>
+
+	* bring back some fixes from OpenBSD
+
+	* treat ELF dynamic objects as executables
+
+	* fix gcc warnings
+
+2007-12-01 19:55 Christos Zoulas <christos@zoulas.com>
+
+	* make sure we have zlib.h and libz to compile the builtin
+	  decompress code
+
+2007-10-28 20:48 Christos Zoulas <christos@zoulas.com>
+
+ 	* float and double magic support (Behan Webster) 
+
+2007-10-28 20:48 Christos Zoulas <christos@zoulas.com>
+
+	* Convert fortran to a soft test (Reuben Thomas)
+
+2007-10-23  5:25 Christos Zoulas <christos@zoulas.com>
+
+	* Add --with-filename, and --no-filename (Reuben Thomas)
+
+2007-10-23  3:59 Christos Zoulas <christos@zoulas.com>
+
+	* Rest of the mime split (Reuben Thomas)
+
+	* Make usage message generated from the flags so that
+	  they stay consistent (Reuben Thomas)
+
+2007-10-20  3:06 Christos Zoulas <christos@zoulas.com>
+
+	* typo in comment, missing ifdef QUICK, remove unneeded code
+		(Charles Longeau)
+
+2007-10-17  3:33 Christos Zoulas <christos@zoulas.com>
+
+	* Fix problem printing -\012 in some entries
+
+	* Separate magic type and encoding flags (Reuben Thomas)
+
+2007-10-09  3:55 Christos Zoulas <christos@zoulas.com>
+
+	* configure fix for int64 and strndup (Reuben Thomas)
+
+2007-09-26  4:45 Christos Zoulas <christos@zoulas.com>
+
+	* Add magic_descriptor() function.
+
+	* Fix regression in elf reading code where the core name was
+	  not being printed.
+
+	* Don't convert NUL's to spaces in {l,b}estring16 (Daniel Dawson)
+
+2007-08-19  6:30 Christos Zoulas <christos@zoulas.com>
+
+	* Make mime format consistent so that it can
+	  be easily parsed:
+	      mimetype [charset=character-set] [encoding=encoding-mime-type]
+
+	  Remove spurious extra text from some MIME type printouts 
+	  (mostly in is_tar).
+
+	  Fix one case where -i produced nothing at all (for a 1-byte file,
+	  which is now classed as application/octet-stream).
+
+	  Remove 7/8bit classifications, since they were arbitrary
+	  and not based on the file data.
+
+	  This work was done by Reuben Thomas
+
 2007-05-24 10:00 Christos Zoulas <christos@zoulas.com>
 2007-05-24 10:00 Christos Zoulas <christos@zoulas.com>
 
 
 	* Fix another integer overflow (Colin Percival)
 	* Fix another integer overflow (Colin Percival)

+ 75 - 64
Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -13,15 +13,11 @@
 # PARTICULAR PURPOSE.
 # PARTICULAR PURPOSE.
 
 
 @SET_MAKE@
 @SET_MAKE@
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = .
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -35,18 +31,18 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
+subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(top_srcdir)/configure ChangeLog config.guess config.sub \
 	$(top_srcdir)/configure ChangeLog config.guess config.sub \
 	depcomp install-sh ltmain.sh missing mkinstalldirs
 	depcomp install-sh ltmain.sh missing mkinstalldirs
-subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 	$(top_srcdir)/configure.in
 	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno configure.status.lineno
+ configure.lineno config.status.lineno
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = config.h
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_FILES =
@@ -56,10 +52,13 @@ SOURCES =
 DIST_SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 ETAGS = etags
 CTAGS = ctags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DIST_SUBDIRS = $(SUBDIRS)
@@ -75,8 +74,6 @@ GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
 distuninstallcheck_listfiles = find . -type f -print
 distcleancheck_listfiles = find . -type f -print
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AMTAR = @AMTAR@
 AR = @AR@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOCONF = @AUTOCONF@
@@ -103,14 +100,12 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 F77 = @F77@
 FFLAGS = @FFLAGS@
 FFLAGS = @FFLAGS@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
-IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
 LDFLAGS = @LDFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBS = @LIBS@
@@ -118,9 +113,8 @@ LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -134,16 +128,13 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SHELL = @SHELL@
 STRIP = @STRIP@
 STRIP = @STRIP@
 VERSION = @VERSION@
 VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_F77 = @ac_ct_F77@
 ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__quote = @am__quote@
@@ -155,7 +146,11 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_os = @build_os@
 build_vendor = @build_vendor@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 fsect = @fsect@
 fsect = @fsect@
 host = @host@
 host = @host@
@@ -163,21 +158,28 @@ host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_os = @host_os@
 host_vendor = @host_vendor@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 includedir = @includedir@
 infodir = @infodir@
 infodir = @infodir@
 install_sh = @install_sh@
 install_sh = @install_sh@
 libdir = @libdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 
 
 # don't enforce GNU packaging standards
 # don't enforce GNU packaging standards
 AUTOMAKE_OPTIONS = foreign no-dependencies
 AUTOMAKE_OPTIONS = foreign no-dependencies
@@ -224,7 +226,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 config.h: stamp-h1
 config.h: stamp-h1
 	@if test ! -f $@; then \
 	@if test ! -f $@; then \
 	  rm -f stamp-h1; \
 	  rm -f stamp-h1; \
-	  $(MAKE) stamp-h1; \
+	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
 	else :; fi
 	else :; fi
 
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@@ -246,7 +248,6 @@ clean-libtool:
 
 
 distclean-libtool:
 distclean-libtool:
 	-rm -f libtool
 	-rm -f libtool
-uninstall-info-am:
 
 
 # This directory's subdirectories are mostly independent; you can cd
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
 # into them and run `make' without going through this Makefile.
@@ -279,8 +280,7 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 	fi; test -z "$$fail"
 
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	  case $$f in \
@@ -382,23 +382,22 @@ distclean-tags:
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
 	$(am__remove_distdir)
-	mkdir $(distdir)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	test -d $(distdir) || mkdir $(distdir)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
 	    fi; \
@@ -412,7 +411,7 @@ distdir: $(DISTFILES)
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -420,6 +419,8 @@ distdir: $(DISTFILES)
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	        distdir) \
 	      || exit 1; \
 	      || exit 1; \
 	  fi; \
 	  fi; \
@@ -427,7 +428,7 @@ distdir: $(DISTFILES)
 	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
 	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r $(distdir)
 	|| chmod -R a+r $(distdir)
 dist-gzip: distdir
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
@@ -502,7 +503,7 @@ distcheck: dist
 	$(am__remove_distdir)
 	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
-	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
 distuninstallcheck:
 	@cd $(distuninstallcheck_dir) \
 	@cd $(distuninstallcheck_dir) \
 	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
 	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@@ -572,12 +573,20 @@ info-am:
 
 
 install-data-am:
 install-data-am:
 
 
+install-dvi: install-dvi-recursive
+
 install-exec-am:
 install-exec-am:
 
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 install-info: install-info-recursive
 
 
 install-man:
 install-man:
 
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 installcheck-am:
 
 
 maintainer-clean: maintainer-clean-recursive
 maintainer-clean: maintainer-clean-recursive
@@ -598,24 +607,26 @@ ps: ps-recursive
 
 
 ps-am:
 ps-am:
 
 
-uninstall-am: uninstall-info-am
+uninstall-am:
 
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
-	check-am clean clean-generic clean-libtool clean-recursive \
-	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
-	dist-shar dist-tarZ dist-zip distcheck distclean \
+.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-generic distclean-hdr distclean-libtool \
-	distclean-recursive distclean-tags distcleancheck distdir \
-	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	maintainer-clean-recursive mostlyclean mostlyclean-generic \
-	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am uninstall-info-am
+	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.
 # 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.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 0 - 4
acinclude.m4

@@ -157,8 +157,6 @@ fi
 dnl AC_HEADER_STDINT
 dnl AC_HEADER_STDINT
 AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
 AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
 
 
-#serial 19
-
 dnl By default, many hosts won't let programs access large files;
 dnl By default, many hosts won't let programs access large files;
 dnl one must use special compiler options to get large-file access to work.
 dnl one must use special compiler options to get large-file access to work.
 dnl For more details about this brain damage please see:
 dnl For more details about this brain damage please see:
@@ -252,8 +250,6 @@ AC_DEFUN([AC_FUNC_FSEEKO],
        [Define if fseeko (and presumably ftello) exists and is declared.])
        [Define if fseeko (and presumably ftello) exists and is declared.])
    fi])
    fi])
 
 
-# serial 9
-
 # From Paul Eggert.
 # From Paul Eggert.
 
 
 # BeOS 5 has <wchar.h> but does not define mbstate_t,
 # BeOS 5 has <wchar.h> but does not define mbstate_t,

+ 93 - 81
aclocal.m4

@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
 
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005  Free Software Foundation, Inc.
+# 2005, 2006  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,11 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 # PARTICULAR PURPOSE.
 
 
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
+
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 
 
 # serial 47 AC_PROG_LIBTOOL
 # serial 47 AC_PROG_LIBTOOL
@@ -6159,7 +6164,7 @@ SED=$lt_cv_path_SED
 AC_MSG_RESULT([$SED])
 AC_MSG_RESULT([$SED])
 ])
 ])
 
 
-# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
@@ -6169,14 +6174,29 @@ AC_MSG_RESULT([$SED])
 # ----------------------------
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
 
 
 # AM_SET_CURRENT_AUTOMAKE_VERSION
 # AM_SET_CURRENT_AUTOMAKE_VERSION
 # -------------------------------
 # -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.9.6])])
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
 
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
 
@@ -6233,14 +6253,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 # Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
 
 
-# serial 7
+# serial 8
 
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # -------------------------------------
@@ -6249,8 +6269,10 @@ AC_DEFUN([AM_CONDITIONAL],
 [AC_PREREQ(2.52)dnl
 [AC_PREREQ(2.52)dnl
  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
 	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])
-AC_SUBST([$1_FALSE])
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
 if $2; then
 if $2; then
   $1_TRUE=
   $1_TRUE=
   $1_FALSE='#'
   $1_FALSE='#'
@@ -6264,15 +6286,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 fi])])
 
 
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 # Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
 
 
-# serial 8
+# serial 9
 
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -6300,6 +6321,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl
 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
                    [depcc="$$1"   am_compiler_list=])
                    [depcc="$$1"   am_compiler_list=])
 
 
@@ -6365,6 +6387,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
          >/dev/null 2>conftest.err &&
          >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
@@ -6417,7 +6440,8 @@ if test "x$enable_dependency_tracking" != xno; then
   AMDEPBACKSLASH='\'
   AMDEPBACKSLASH='\'
 fi
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
 ])
 ])
 
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -6442,8 +6466,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # some people rename them; so instead we look at the file content.
   # some people rename them; so instead we look at the file content.
   # Grep'ing the first line is not enough: some people post-process
   # Grep'ing the first line is not enough: some people post-process
   # each Makefile.in and add a new line on top of each file to say so.
   # each Makefile.in and add a new line on top of each file to say so.
-  # So let's grep whole file.
-  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
     dirpart=`AS_DIRNAME("$mf")`
   else
   else
     continue
     continue
@@ -6502,8 +6527,8 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
@@ -6526,16 +6551,20 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # arguments mandatory, and then we can depend on a new Autoconf
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.58])dnl
+[AC_PREREQ([2.60])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
 AC_REQUIRE([AC_PROG_INSTALL])dnl
 AC_REQUIRE([AC_PROG_INSTALL])dnl
-# test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" &&
-   test -f $srcdir/config.status; then
-  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
 fi
 fi
 
 
 # test whether we have cygpath
 # test whether we have cygpath
@@ -6555,6 +6584,9 @@ m4_ifval([$2],
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 [_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 
@@ -6590,6 +6622,10 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX],
                   [_AM_DEPENDENCIES(CXX)],
                   [_AM_DEPENDENCIES(CXX)],
                   [define([AC_PROG_CXX],
                   [define([AC_PROG_CXX],
                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
 ])
 ])
 ])
 
 
@@ -6625,7 +6661,7 @@ echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
 # Define $install_sh.
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"$am_aux_dir/install-sh"}
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
 AC_SUBST(install_sh)])
 AC_SUBST(install_sh)])
 
 
 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
@@ -6732,14 +6768,14 @@ rm -f confinc confmf
 
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
 # Free Software Foundation, Inc.
 # Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
 
 
-# serial 4
+# serial 5
 
 
 # AM_MISSING_PROG(NAME, PROGRAM)
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 # ------------------------------
@@ -6755,6 +6791,7 @@ AC_SUBST($1)])
 # If it does, set am_missing_run to use it, otherwise, to nothing.
 # If it does, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
 # Use eval to expand $SHELL
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
 if eval "$MISSING --run true"; then
@@ -6765,7 +6802,7 @@ else
 fi
 fi
 ])
 ])
 
 
-# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 #
 #
 # This file is free software; the Free Software Foundation
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
@@ -6773,60 +6810,23 @@ fi
 
 
 # AM_PROG_MKDIR_P
 # AM_PROG_MKDIR_P
 # ---------------
 # ---------------
-# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-#
-# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
-# created by `make install' are always world readable, even if the
-# installer happens to have an overly restrictive umask (e.g. 077).
-# This was a mistake.  There are at least two reasons why we must not
-# use `-m 0755':
-#   - it causes special bits like SGID to be ignored,
-#   - it may be too restrictive (some setups expect 775 directories).
-#
-# Do not use -m 0755 and let people choose whatever they expect by
-# setting umask.
-#
-# We cannot accept any implementation of `mkdir' that recognizes `-p'.
-# Some implementations (such as Solaris 8's) are not thread-safe: if a
-# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
-# concurrently, both version can detect that a/ is missing, but only
-# one can create it and the other will error out.  Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
-# this.)
+# Check for `mkdir -p'.
 AC_DEFUN([AM_PROG_MKDIR_P],
 AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # We used to keeping the `.' as first argument, in order to
-  # allow $(mkdir_p) to be used without argument.  As in
-  #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.  However this is wrong
-  # for two reasons:
-  #  1. if the package is installed by a user who cannot write `.'
-  #     make install will fail,
-  #  2. the above comment should most certainly read
-  #     $(mkdir_p) $(DESTDIR)$(somedir)
-  #     so it does not work when $(somedir) is undefined and
-  #     $(DESTDIR) is not.
-  #  To support the latter case, we have to write
-  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
-  #  so the `.' trick is pointless.
-  mkdir_p='mkdir -p --'
-else
-  # On NextStep and OpenStep, the `mkdir' command does not
-  # recognize any option.  It will interpret all options as
-  # directories to create, and then abort because `.' already
-  # exists.
-  for d in ./-p ./--version;
-  do
-    test -d $d && rmdir $d
-  done
-  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
-  if test -f "$ac_aux_dir/mkinstalldirs"; then
-    mkdir_p='$(mkinstalldirs)'
-  else
-    mkdir_p='$(install_sh) -d'
-  fi
-fi
-AC_SUBST([mkdir_p])])
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
 
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
 
@@ -6938,9 +6938,21 @@ dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
 if test "$cross_compiling" != no; then
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 fi
-INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
 
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# 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.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
 # Check how to create a tarball.                            -*- Autoconf -*-
 # Check how to create a tarball.                            -*- Autoconf -*-
 
 
 # Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 # Copyright (C) 2004, 2005  Free Software Foundation, Inc.

File diff suppressed because it is too large
+ 337 - 296
config.guess


+ 19 - 2
config.h.in

@@ -72,6 +72,9 @@
 /* Define to 1 if you have the `strndup' function. */
 /* Define to 1 if you have the `strndup' function. */
 #undef HAVE_STRNDUP
 #undef HAVE_STRNDUP
 
 
+/* Define to 1 if you have the `strtof' function. */
+#undef HAVE_STRTOF
+
 /* Define to 1 if you have the `strtoul' function. */
 /* Define to 1 if you have the `strtoul' function. */
 #undef HAVE_STRTOUL
 #undef HAVE_STRTOUL
 
 
@@ -133,6 +136,9 @@
 /* Define to 1 if you have the `wcwidth' function. */
 /* Define to 1 if you have the `wcwidth' function. */
 #undef HAVE_WCWIDTH
 #undef HAVE_WCWIDTH
 
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
    */
    */
 #undef MAJOR_IN_MKDEV
 #undef MAJOR_IN_MKDEV
@@ -160,6 +166,9 @@
 #undef PACKAGE_VERSION
 #undef PACKAGE_VERSION
 
 
 /* */
 /* */
+#undef SIZEOF_INT64_T
+
+/* */
 #undef SIZEOF_UINT16_T
 #undef SIZEOF_UINT16_T
 
 
 /* */
 /* */
@@ -183,6 +192,11 @@
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 #undef _FILE_OFFSET_BITS
 
 
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+
 /* Define for large files, on AIX-style hosts. */
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 #undef _LARGE_FILES
 
 
@@ -192,13 +206,16 @@
 /* */
 /* */
 #undef int32_t
 #undef int32_t
 
 
+/* */
+#undef int64_t
+
 /* Define to a type if <wchar.h> does not define. */
 /* Define to a type if <wchar.h> does not define. */
 #undef mbstate_t
 #undef mbstate_t
 
 
-/* Define to `long' if <sys/types.h> does not define. */
+/* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
 #undef off_t
 
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 #undef size_t
 
 
 /* */
 /* */

+ 125 - 58
config.sub

@@ -1,12 +1,13 @@
 #! /bin/sh
 #! /bin/sh
 #
 #
-# $NetBSD: config.sub,v 1.7 2004/08/14 19:14:42 schmonz Exp $
+# $NetBSD: config.sub,v 1.8 2006/10/29 23:52:55 wiz Exp $
 #
 #
 # Configuration validation subroutine script.
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
 
-timestamp='2004-03-12'
+timestamp='2006-09-20'
 
 
 # This file is (in principle) common to ALL GNU software.
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # The presence of a machine in this file suggests that SOME GNU software
@@ -24,14 +25,15 @@ timestamp='2004-03-12'
 #
 #
 # You should have received a copy of the GNU General Public License
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
 # As a special exception to the GNU General Public License, if you
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 # the same distribution terms that you use for the rest of that program.
 
 
+
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
 # diff and a properly formatted ChangeLog entry.
 #
 #
@@ -73,7 +75,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 version="\
 GNU config.sub ($timestamp)
 GNU config.sub ($timestamp)
 
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 Free Software Foundation, Inc.
 Free Software Foundation, Inc.
 
 
 This is free software; see the source for copying conditions.  There is NO
 This is free software; see the source for copying conditions.  There is NO
@@ -86,11 +88,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
 while test $# -gt 0 ; do
   case $1 in
   case $1 in
     --time-stamp | --time* | -t )
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
     --version | -v )
-       echo "$version" ; exit 0 ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
     --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
     -- )     # Stop option processing
        shift; break ;;
        shift; break ;;
     - )	# Use stdin as input.
     - )	# Use stdin as input.
@@ -102,7 +104,7 @@ while test $# -gt 0 ; do
     *local*)
     *local*)
        # First pass through any local machine types.
        # First pass through any local machine types.
        echo $1
        echo $1
-       exit 0;;
+       exit ;;
 
 
     * )
     * )
        break ;;
        break ;;
@@ -121,8 +123,9 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
     ;;
@@ -148,7 +151,7 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis)
+	-apple | -axis | -knuth | -cray)
 		os=
 		os=
 		basic_machine=$1
 		basic_machine=$1
 		;;
 		;;
@@ -173,6 +176,10 @@ case $os in
 	-hiux*)
 	-hiux*)
 		os=-hiuxwe2
 		os=-hiuxwe2
 		;;
 		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco5)
 	-sco5)
 		os=-sco3.2v5
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -189,6 +196,10 @@ case $os in
 		# Don't forget version if it is 3.2v4 or newer.
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco*)
 	-sco*)
 		os=-sco3.2v2
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -233,14 +244,16 @@ case $basic_machine in
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
 	| c4x | clipper \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | mcore \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips16 \
 	| mips64 | mips64el \
 	| mips64 | mips64el \
@@ -249,6 +262,7 @@ case $basic_machine in
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
 	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
 	| mipsisa64 | mipsisa64el \
@@ -257,20 +271,24 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| mn10200 | mn10300 \
+	| mt \
 	| msp430 \
 	| msp430 \
+	| nios | nios2 \
 	| ns16k | ns32k \
 	| ns16k | ns32k \
-	| openrisc | or32 \
+	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
 	| pyramid \
-	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
-	| strongarm \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| v850 | v850e \
 	| we32k \
 	| we32k \
-	| x86 | xscale | xstormy16 | xtensa \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k)
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		basic_machine=$basic_machine-unknown
 		;;
 		;;
@@ -281,6 +299,9 @@ case $basic_machine in
 		;;
 		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
 		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
 
 
 	# We use `pc' rather than `unknown'
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# because (1) that's what they normally are, and
@@ -300,10 +321,10 @@ case $basic_machine in
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* \
-	| bs2000-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | cydra-* \
+	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
@@ -311,9 +332,9 @@ case $basic_machine in
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
 	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
+	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
 	| mips64-* | mips64el-* \
@@ -322,6 +343,7 @@ case $basic_machine in
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
 	| mipsisa64-* | mipsisa64el-* \
@@ -329,24 +351,28 @@ case $basic_machine in
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
 	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
 	| msp430-* \
 	| msp430-* \
-	| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
-	| xtensa-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
 	| ymp-* \
 	| ymp-* \
 	| z8k-*)
 	| z8k-*)
 		;;
 		;;
@@ -448,6 +474,10 @@ case $basic_machine in
 		basic_machine=j90-cray
 		basic_machine=j90-cray
 		os=-unicos
 		os=-unicos
 		;;
 		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
 	cr16c)
 	cr16c)
 		basic_machine=cr16c-unknown
 		basic_machine=cr16c-unknown
 		os=-elf
 		os=-elf
@@ -455,6 +485,9 @@ case $basic_machine in
 	crds | unos)
 	crds | unos)
 		basic_machine=m68k-crds
 		basic_machine=m68k-crds
 		;;
 		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
 	cris | cris-* | etrax*)
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		basic_machine=cris-axis
 		;;
 		;;
@@ -484,6 +517,10 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		basic_machine=m88k-motorola
 		os=-sysv3
 		os=-sysv3
 		;;
 		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
 	dpx20 | dpx20-*)
 	dpx20 | dpx20-*)
 		basic_machine=rs6000-bull
 		basic_machine=rs6000-bull
 		os=-bosx
 		os=-bosx
@@ -662,10 +699,6 @@ case $basic_machine in
 	mips3*)
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
 		;;
-	mmix*)
-		basic_machine=mmix-knuth
-		os=-mmixware
-		;;
 	monitor)
 	monitor)
 		basic_machine=m68k-rom68k
 		basic_machine=m68k-rom68k
 		os=-coff
 		os=-coff
@@ -678,6 +711,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		basic_machine=i386-pc
 		os=-msdos
 		os=-msdos
 		;;
 		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
 	mvs)
 	mvs)
 		basic_machine=i370-ibm
 		basic_machine=i370-ibm
 		os=-mvs
 		os=-mvs
@@ -746,10 +782,6 @@ case $basic_machine in
 	np1)
 	np1)
 		basic_machine=np1-gould
 		basic_machine=np1-gould
 		;;
 		;;
-	nv1)
-		basic_machine=nv1-cray
-		os=-unicosmp
-		;;
 	nsr-tandem)
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		basic_machine=nsr-tandem
 		;;
 		;;
@@ -757,9 +789,8 @@ case $basic_machine in
 		basic_machine=hppa1.1-oki
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		os=-proelf
 		;;
 		;;
-	or32 | or32-*)
+	openrisc | openrisc-*)
 		basic_machine=or32-unknown
 		basic_machine=or32-unknown
-		os=-coff
 		;;
 		;;
 	os400)
 	os400)
 		basic_machine=powerpc-ibm
 		basic_machine=powerpc-ibm
@@ -790,6 +821,12 @@ case $basic_machine in
 	pc532 | pc532-*)
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		basic_machine=ns32k-pc532
 		;;
 		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		basic_machine=i586-pc
 		;;
 		;;
@@ -846,6 +883,10 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		basic_machine=i586-unknown
 		os=-pw32
 		os=-pw32
 		;;
 		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
 	rom68k)
 	rom68k)
 		basic_machine=m68k-rom68k
 		basic_machine=m68k-rom68k
 		os=-coff
 		os=-coff
@@ -872,6 +913,10 @@ case $basic_machine in
 	sb1el)
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		basic_machine=mipsisa64sb1el-unknown
 		;;
 		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
 	sei)
 	sei)
 		basic_machine=mips-sei
 		basic_machine=mips-sei
 		os=-seiux
 		os=-seiux
@@ -883,6 +928,9 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		basic_machine=sh-hitachi
 		os=-hms
 		os=-hms
 		;;
 		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
 	sh64)
 	sh64)
 		basic_machine=sh64-unknown
 		basic_machine=sh64-unknown
 		;;
 		;;
@@ -1032,6 +1080,10 @@ case $basic_machine in
 		basic_machine=hppa1.1-winbond
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		os=-proelf
 		;;
 		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
 	xps | xps100)
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		basic_machine=xps100-honeywell
 		;;
 		;;
@@ -1062,6 +1114,9 @@ case $basic_machine in
 	romp)
 	romp)
 		basic_machine=romp-ibm
 		basic_machine=romp-ibm
 		;;
 		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
 	rs6000)
 	rs6000)
 		basic_machine=rs6000-ibm
 		basic_machine=rs6000-ibm
 		;;
 		;;
@@ -1078,16 +1133,10 @@ case $basic_machine in
 	we32k)
 	we32k)
 		basic_machine=we32k-att
 		basic_machine=we32k-att
 		;;
 		;;
-	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		basic_machine=sh-unknown
 		;;
 		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		basic_machine=sparc-sun
 		;;
 		;;
 	cydra)
 	cydra)
@@ -1160,20 +1209,23 @@ case $os in
 	      | -aos* \
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 		;;
 	-qnx*)
 	-qnx*)
@@ -1191,7 +1243,7 @@ case $os in
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
 		;;
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 		;;
 	-mac*)
 	-mac*)
@@ -1300,6 +1352,9 @@ case $os in
 	-kaos*)
 	-kaos*)
 		os=-kaos
 		os=-kaos
 		;;
 		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
 	-none)
 	-none)
 		;;
 		;;
 	*)
 	*)
@@ -1322,6 +1377,12 @@ else
 # system, and we'll never get to this point.
 # system, and we'll never get to this point.
 
 
 case $basic_machine in
 case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
 	*-acorn)
 	*-acorn)
 		os=-riscix1.2
 		os=-riscix1.2
 		;;
 		;;
@@ -1331,9 +1392,9 @@ case $basic_machine in
 	arm*-semi)
 	arm*-semi)
 		os=-aout
 		os=-aout
 		;;
 		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
 	# This must come before the *-dec entry.
 	# This must come before the *-dec entry.
 	pdp10-*)
 	pdp10-*)
 		os=-tops20
 		os=-tops20
@@ -1377,9 +1438,15 @@ case $basic_machine in
 	*-be)
 	*-be)
 		os=-beos
 		os=-beos
 		;;
 		;;
+	*-haiku)
+		os=-haiku
+		;;
 	*-ibm)
 	*-ibm)
 		os=-aix
 		os=-aix
 		;;
 		;;
+    	*-knuth)
+		os=-mmixware
+		;;
 	*-wec)
 	*-wec)
 		os=-proelf
 		os=-proelf
 		;;
 		;;
@@ -1545,7 +1612,7 @@ case $basic_machine in
 esac
 esac
 
 
 echo $basic_machine$os
 echo $basic_machine$os
-exit 0
+exit
 
 
 # Local variables:
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # eval: (add-hook 'write-file-hooks 'time-stamp)

File diff suppressed because it is too large
+ 5209 - 4471
configure


+ 13 - 5
configure.in

@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT
 AC_INIT
 AC_CONFIG_SRCDIR([src/file.c])
 AC_CONFIG_SRCDIR([src/file.c])
-AM_INIT_AUTOMAKE(file, 4.21)
+AM_INIT_AUTOMAKE(file, 4.23)
 AM_CONFIG_HEADER([config.h])
 AM_CONFIG_HEADER([config.h])
 AM_MAINTAINER_MODE
 AM_MAINTAINER_MODE
 
 
@@ -49,6 +49,7 @@ fi], [
 ])
 ])
 AC_SUBST(fsect)
 AC_SUBST(fsect)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
+AC_GNU_SOURCE
 
 
 dnl Checks for programs.
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_CC
@@ -66,11 +67,13 @@ AH_TEMPLATE([HAVE_LONG_LONG], [])
 AH_TEMPLATE([HAVE_TM_ISDST], [])
 AH_TEMPLATE([HAVE_TM_ISDST], [])
 AH_TEMPLATE([SIZEOF_UINT16_T], [])
 AH_TEMPLATE([SIZEOF_UINT16_T], [])
 AH_TEMPLATE([SIZEOF_UINT32_T], [])
 AH_TEMPLATE([SIZEOF_UINT32_T], [])
+AH_TEMPLATE([SIZEOF_INT64_T], [])
 AH_TEMPLATE([SIZEOF_UINT64_T], [])
 AH_TEMPLATE([SIZEOF_UINT64_T], [])
 AH_TEMPLATE([SIZEOF_UINT8_T], [])
 AH_TEMPLATE([SIZEOF_UINT8_T], [])
 AH_TEMPLATE([int32_t], [])
 AH_TEMPLATE([int32_t], [])
 AH_TEMPLATE([uint16_t], [])
 AH_TEMPLATE([uint16_t], [])
 AH_TEMPLATE([uint32_t], [])
 AH_TEMPLATE([uint32_t], [])
+AH_TEMPLATE([int64_t], [])
 AH_TEMPLATE([uint64_t], [])
 AH_TEMPLATE([uint64_t], [])
 AH_TEMPLATE([uint8_t], [])
 AH_TEMPLATE([uint8_t], [])
 
 
@@ -82,6 +85,7 @@ AC_HEADER_STDINT
 AC_CHECK_HEADERS(fcntl.h locale.h stdint.h inttypes.h unistd.h getopt.h)
 AC_CHECK_HEADERS(fcntl.h locale.h stdint.h inttypes.h unistd.h getopt.h)
 AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
 AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
+AC_CHECK_HEADERS(zlib.h)
 
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_C_CONST
@@ -106,20 +110,24 @@ AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
 AC_CHECK_TYPE_STDC(int32_t, int)
 AC_CHECK_TYPE_STDC(int32_t, int)
 AC_C_LONG_LONG
 AC_C_LONG_LONG
 if test $ac_cv_c_long_long = yes; then
 if test $ac_cv_c_long_long = yes; then
-  long64='unsigned long long';
+  ulong64='unsigned long long';
+  long64='long long';
 else
 else
-  long64='unsigned long';
+  ulong64='unsigned long';
+  long64='long';
 fi
 fi
 dnl This needs a patch to autoconf 2.13 acgeneral.m4
 dnl This needs a patch to autoconf 2.13 acgeneral.m4
-AC_CHECK_TYPE2_STDC(uint64_t, $long64)
+AC_CHECK_TYPE2_STDC(uint64_t, $ulong64)
+AC_CHECK_TYPE2_STDC(int64_t, $long64)
 
 
 AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
+AC_CHECK_SIZEOF_STDC_HEADERS(int64_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
 
 
 dnl Checks for functions
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf)
+AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf strtof)
 
 
 dnl Checks for libraries
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)
 AC_CHECK_LIB(z,gzopen)

+ 59 - 5
depcomp

@@ -1,9 +1,10 @@
 #! /bin/sh
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 # depcomp - compile a program generating dependencies as side-effects
 
 
-scriptversion=2005-07-09.11
+scriptversion=2006-10-15.18
 
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
 
 
 # This program is free software; you can redistribute it and/or modify
 # 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
 # it under the terms of the GNU General Public License as published by
@@ -91,7 +92,20 @@ gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
 ## gcc 3 implements dependency tracking that does exactly what
 ## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 ## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 ## it if -MD -MP comes after the -MF stuff.  Hmm.
 ## it if -MD -MP comes after the -MF stuff.  Hmm.
-  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
   stat=$?
   stat=$?
   if test $stat -eq 0; then :
   if test $stat -eq 0; then :
   else
   else
@@ -276,6 +290,46 @@ icc)
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  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.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  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"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
 tru64)
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # The Tru64 compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@@ -288,13 +342,13 @@ tru64)
 
 
    if test "$libtool" = yes; then
    if test "$libtool" = yes; then
       # With Tru64 cc, shared objects can also be used to make a
       # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mecanism is used in libtool 1.4 series to
+      # static library.  This mechanism is used in libtool 1.4 series to
       # handle both shared and static libraries in a single compilation.
       # handle both shared and static libraries in a single compilation.
       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
       # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
       #
       #
       # With libtool 1.5 this exception was removed, and libtool now
       # With libtool 1.5 this exception was removed, and libtool now
       # generates 2 separate objects for the 2 libraries.  These two
       # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # compilations output dependencies in $dir.libs/$base.o.d and
       # in $dir$base.o.d.  We have to check for both files, because
       # in $dir$base.o.d.  We have to check for both files, because
       # one of the two compilations can be disabled.  We should prefer
       # one of the two compilations can be disabled.  We should prefer
       # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
       # $dir$base.o.d over $dir.libs/$base.o.d because the latter is

+ 56 - 50
doc/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -13,15 +13,11 @@
 # PARTICULAR PURPOSE.
 # PARTICULAR PURPOSE.
 
 
 @SET_MAKE@
 @SET_MAKE@
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -57,8 +53,6 @@ NROFF = nroff
 MANS = $(man_MANS)
 MANS = $(man_MANS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AMTAR = @AMTAR@
 AR = @AR@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOCONF = @AUTOCONF@
@@ -85,14 +79,12 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 F77 = @F77@
 FFLAGS = @FFLAGS@
 FFLAGS = @FFLAGS@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
-IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
 LDFLAGS = @LDFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBS = @LIBS@
@@ -100,9 +92,8 @@ LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -116,16 +107,13 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SHELL = @SHELL@
 STRIP = @STRIP@
 STRIP = @STRIP@
 VERSION = @VERSION@
 VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_F77 = @ac_ct_F77@
 ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__quote = @am__quote@
@@ -137,7 +125,11 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_os = @build_os@
 build_vendor = @build_vendor@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 fsect = @fsect@
 fsect = @fsect@
 host = @host@
 host = @host@
@@ -145,21 +137,28 @@ host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_os = @host_os@
 host_vendor = @host_vendor@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 includedir = @includedir@
 infodir = @infodir@
 infodir = @infodir@
 install_sh = @install_sh@
 install_sh = @install_sh@
 libdir = @libdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 MAGIC = $(pkgdatadir)/magic
 MAGIC = $(pkgdatadir)/magic
 @FSECT5_FALSE@man_MAGIC = magic.4
 @FSECT5_FALSE@man_MAGIC = magic.4
 @FSECT5_TRUE@man_MAGIC = magic.5
 @FSECT5_TRUE@man_MAGIC = magic.5
@@ -204,13 +203,9 @@ mostlyclean-libtool:
 
 
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
-
-distclean-libtool:
-	-rm -f libtool
-uninstall-info-am:
 install-man1: $(man1_MANS) $(man_MANS)
 install-man1: $(man1_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
 	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
 	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
 	for i in $$l2; do \
@@ -255,7 +250,7 @@ uninstall-man1:
 	done
 	done
 install-man3: $(man3_MANS) $(man_MANS)
 install-man3: $(man3_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
+	test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
 	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
 	@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
 	for i in $$l2; do \
@@ -300,7 +295,7 @@ uninstall-man3:
 	done
 	done
 install-man4: $(man4_MANS) $(man_MANS)
 install-man4: $(man4_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(man4dir)" || $(mkdir_p) "$(DESTDIR)$(man4dir)"
+	test -z "$(man4dir)" || $(MKDIR_P) "$(DESTDIR)$(man4dir)"
 	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
 	@list='$(man4_MANS) $(dist_man4_MANS) $(nodist_man4_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
 	for i in $$l2; do \
@@ -345,7 +340,7 @@ uninstall-man4:
 	done
 	done
 install-man5: $(man5_MANS) $(man_MANS)
 install-man5: $(man5_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
+	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
 	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
 	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
 	for i in $$l2; do \
@@ -396,22 +391,21 @@ CTAGS:
 
 
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
 	    fi; \
@@ -427,7 +421,7 @@ check: check-am
 all-am: Makefile $(MANS)
 all-am: Makefile $(MANS)
 installdirs:
 installdirs:
 	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"; do \
 	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 	done
 install: install-am
 install: install-am
 install-exec: install-exec-am
 install-exec: install-exec-am
@@ -460,7 +454,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
 
 
 distclean: distclean-am
 distclean: distclean-am
 	-rm -f Makefile
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-libtool
+distclean-am: clean-am distclean-generic
 
 
 dvi: dvi-am
 dvi: dvi-am
 
 
@@ -474,12 +468,20 @@ info-am:
 
 
 install-data-am: install-man
 install-data-am: install-man
 
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 install-exec-am:
 
 
+install-html: install-html-am
+
 install-info: install-info-am
 install-info: install-info-am
 
 
 install-man: install-man1 install-man3 install-man4 install-man5
 install-man: install-man1 install-man3 install-man4 install-man5
 
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 installcheck-am:
 
 
 maintainer-clean: maintainer-clean-am
 maintainer-clean: maintainer-clean-am
@@ -498,22 +500,26 @@ ps: ps-am
 
 
 ps-am:
 ps-am:
 
 
-uninstall-am: uninstall-info-am uninstall-man
+uninstall-am: uninstall-man
 
 
 uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
 uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
 	uninstall-man5
 	uninstall-man5
 
 
+.MAKE: install-am install-strip
+
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	dvi-am html html-am info info-am install install-am \
 	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-exec install-exec-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-man1 \
 	install-info install-info-am install-man install-man1 \
-	install-man3 install-man4 install-man5 install-strip \
+	install-man3 install-man4 install-man5 install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
 	installcheck installcheck-am installdirs maintainer-clean \
 	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
 	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-info-am uninstall-man uninstall-man1 uninstall-man3 \
-	uninstall-man4 uninstall-man5
+	uninstall-man uninstall-man1 uninstall-man3 uninstall-man4 \
+	uninstall-man5
 
 
 
 
 file.1:	Makefile file.man
 file.1:	Makefile file.man

+ 13 - 8
doc/file.man

@@ -1,4 +1,4 @@
-.\" $File: file.man,v 1.65 2007/01/25 21:05:46 christos Exp $
+.\" $File: file.man,v 1.66 2007/10/23 19:58:59 christos Exp $
 .Dd January 8, 2007
 .Dd January 8, 2007
 .Dt FILE __CSECTION__
 .Dt FILE __CSECTION__
 .Os
 .Os
@@ -8,6 +8,8 @@
 .Sh SYNOPSIS
 .Sh SYNOPSIS
 .Nm
 .Nm
 .Op Fl bchikLnNprsvz
 .Op Fl bchikLnNprsvz
+.Op Fl mime-type
+.Op Fl mime-encoding
 .Op Fl f Ar namefile
 .Op Fl f Ar namefile
 .Op Fl F Ar separator
 .Op Fl F Ar separator
 .Op Fl m Ar magicfiles
 .Op Fl m Ar magicfiles
@@ -226,9 +228,8 @@ is not defined.
 .It Fl i , -mime
 .It Fl i , -mime
 Causes the file command to output mime type strings rather than the more
 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
-.Dq text/plain; charset=us-ascii
-rather
-than
+.Dq text/plain charset=us-ascii
+rather than
 .Dq ASCII text .
 .Dq ASCII text .
 In order for this option to work, file changes the way
 In order for this option to work, file changes the way
 it handles files recognized by the command itself (such as many of the
 it handles files recognized by the command itself (such as many of the
@@ -238,6 +239,10 @@ file.
 (See
 (See
 .Dq FILES
 .Dq FILES
 section, below).
 section, below).
+.It Fl -mime-type ,  -mime-encoding
+Like
+.Fl i ,
+but print only the specified element(s).
 .It Fl k , -keep-going
 .It Fl k , -keep-going
 Don't stop at the first match, keep going.
 Don't stop at the first match, keep going.
 .It Fl L , -dereference
 .It Fl L , -dereference
@@ -251,8 +256,9 @@ is defined.
 Specify an alternate list of files containing magic numbers.
 Specify an alternate list of files containing magic numbers.
 This can be a single file, or a colon-separated list of files.
 This can be a single file, or a colon-separated list of files.
 If a compiled magic file is found alongside, it will be used instead.
 If a compiled magic file is found alongside, it will be used instead.
-With the 
-.Fl i or 
+With the
+.Fl i
+or 
 .Fl "mime"
 .Fl "mime"
 option, the program adds
 option, the program adds
 .Dq .mime
 .Dq .mime
@@ -447,8 +453,7 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 
 
 $ file -i file.c file /dev/{wd0a,hda}
 $ file -i file.c file /dev/{wd0a,hda}
 file.c:      text/x-c
 file.c:      text/x-c
-file:        application/x-executable, dynamically linked (uses shared libs),
-	     not stripped
+file:        application/x-executable
 /dev/hda:    application/x-not-regular-file
 /dev/hda:    application/x-not-regular-file
 /dev/wd0a:   application/x-not-regular-file
 /dev/wd0a:   application/x-not-regular-file
 
 

+ 6 - 3
doc/libmagic.man

@@ -87,8 +87,10 @@ If the file is compressed, unpack it and look at the contents.
 .It Dv MAGIC_DEVICES
 .It Dv MAGIC_DEVICES
 If the file is a block or character special device, then open the device
 If the file is a block or character special device, then open the device
 and try to look in its contents.
 and try to look in its contents.
-.It Dv MAGIC_MIME
-Return a mime string, instead of a textual description.
+.It Dv MAGIC_MIME_TYPE
+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_CONTINUE
 .It Dv MAGIC_CONTINUE
 Return all matches, not just the first.
 Return all matches, not just the first.
 .It Dv MAGIC_CHECK
 .It Dv MAGIC_CHECK
@@ -164,7 +166,8 @@ The
 .Fn magic_setflags
 .Fn magic_setflags
 function, sets the 
 function, sets the 
 .Ar flags
 .Ar flags
-described above.
+described above. Note that using both MIME flags together can also
+return extra information on the charset.
 .Pp
 .Pp
 The
 The
 .Fn magic_check
 .Fn magic_check

+ 20 - 2
doc/magic.man

@@ -1,4 +1,4 @@
-.\" $File: magic.man,v 1.38 2007/01/27 00:52:08 ljt Exp $
+.\" $File: magic.man,v 1.39 2007/11/08 00:31:37 christos Exp $
 .Dd January 10, 2007
 .Dd January 10, 2007
 .Dt MAGIC __FSECTION__
 .Dt MAGIC __FSECTION__
 .Os
 .Os
@@ -45,6 +45,10 @@ A two-byte value (on most systems) in this machine's native byte order.
 A four-byte value (on most systems) in this machine's native byte order.
 A four-byte value (on most systems) in this machine's native byte order.
 .It Dv quad
 .It Dv quad
 An eight-byte value (on most systems) in this machine's native byte order.
 An eight-byte value (on most systems) in this machine's native byte order.
+.It Dv float
+A 32-bit (on most systems) single precision IEEE floating point number in this machine's native byte order.
+.It Dv double
+A 64-bit (on most systems) double precision IEEE floating point number in this machine's native byte order.
 .It Dv string
 .It Dv string
 A string of bytes.
 A string of bytes.
 The string type specification can be optionally followed
 The string type specification can be optionally followed
@@ -87,6 +91,10 @@ A two-byte value (on most systems) in big-endian byte order.
 A four-byte value (on most systems) in big-endian byte order.
 A four-byte value (on most systems) in big-endian byte order.
 .It Dv bequad
 .It Dv bequad
 An eight-byte value (on most systems) in big-endian byte order.
 An eight-byte value (on most systems) in big-endian byte order.
+.It Dv befloat
+A 32-bit (on most systems) single precision IEEE floating point number in big-endian byte order.
+.It Dv bedouble
+A 64-bit (on most systems) double precision IEEE floating point number in big-endian byte order.
 .It Dv bedate
 .It Dv bedate
 A four-byte value (on most systems) in big-endian byte order,
 A four-byte value (on most systems) in big-endian byte order,
 interpreted as a Unix date.
 interpreted as a Unix date.
@@ -109,6 +117,10 @@ A two-byte value (on most systems) in little-endian byte order.
 A four-byte value (on most systems) in little-endian byte order.
 A four-byte value (on most systems) in little-endian byte order.
 .It Dv lequad
 .It Dv lequad
 An eight-byte value (on most systems) in little-endian byte order.
 An eight-byte value (on most systems) in little-endian byte order.
+.It Dv lefloat
+A 32-bit (on most systems) single precision IEEE floating point number in little-endian byte order.
+.It Dv ledouble
+A 64-bit (on most systems) double precision IEEE floating point number in little-endian byte order.
 .It Dv ledate
 .It Dv ledate
 A four-byte value (on most systems) in little-endian byte order,
 A four-byte value (on most systems) in little-endian byte order,
 interpreted as a UNIX date.
 interpreted as a UNIX date.
@@ -214,6 +226,12 @@ the value specified after is negated before tested.
 to specify that any value will match.
 to specify that any value will match.
 If the character is omitted, it is assumed to be
 If the character is omitted, it is assumed to be
 .Dv = .
 .Dv = .
+Operators
+.Dv \*[Am] ,
+.Dv ^ ,
+and
+.Dv ~
+don't work with floats and doubles.
 For all tests except
 For all tests except
 .Em string
 .Em string
 and
 and
@@ -450,4 +468,4 @@ a system on which the lengths are invariant.
 .\" the changes I posted to the S5R2 version.
 .\" the changes I posted to the S5R2 version.
 .\"
 .\"
 .\" Modified for Ian Darwin's version of the file command.
 .\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.38 2007/01/27 00:52:08 ljt Exp $
+.\" @(#)$Id: magic.man,v 1.39 2007/11/08 00:31:37 christos Exp $

+ 266 - 82
install-sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 # install - install a program, script, or datafile
 # install - install a program, script, or datafile
 
 
-scriptversion=2005-05-14.22
+scriptversion=2006-10-14.15
 
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,15 +39,24 @@ scriptversion=2005-05-14.22
 # when there is no Makefile.
 # when there is no Makefile.
 #
 #
 # This script is compatible with the BSD install script, but was written
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
 
 
 # set DOITPROG to echo to test this script
 # set DOITPROG to echo to test this script
 
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
 doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
 
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
 
 mvprog="${MVPROG-mv}"
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
 cpprog="${CPPROG-cp}"
@@ -58,7 +67,13 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
 
-chmodcmd="$chmodprog 0755"
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
 chowncmd=
 chowncmd=
 chgrpcmd=
 chgrpcmd=
 stripcmd=
 stripcmd=
@@ -95,7 +110,7 @@ Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 "
 
 
-while test -n "$1"; do
+while test $# -ne 0; do
   case $1 in
   case $1 in
     -c) shift
     -c) shift
         continue;;
         continue;;
@@ -111,9 +126,15 @@ while test -n "$1"; do
 
 
     --help) echo "$usage"; exit $?;;
     --help) echo "$usage"; exit $?;;
 
 
-    -m) chmodcmd="$chmodprog $2"
+    -m) mode=$2
         shift
         shift
         shift
         shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
         continue;;
         continue;;
 
 
     -o) chowncmd="$chownprog $2"
     -o) chowncmd="$chownprog $2"
@@ -136,25 +157,33 @@ while test -n "$1"; do
 
 
     --version) echo "$0 $scriptversion"; exit $?;;
     --version) echo "$0 $scriptversion"; exit $?;;
 
 
-    *)  # When -d is used, all remaining arguments are directories to create.
-	# When -t is used, the destination is already specified.
-	test -n "$dir_arg$dstarg" && break
-        # 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
+    --)	shift
 	break;;
 	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
   esac
   esac
 done
 done
 
 
-if test -z "$1"; then
+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
+fi
+
+if test $# -eq 0; then
   if test -z "$dir_arg"; then
   if test -z "$dir_arg"; then
     echo "$0: no input file specified." >&2
     echo "$0: no input file specified." >&2
     exit 1
     exit 1
@@ -164,6 +193,33 @@ if test -z "$1"; then
   exit 0
   exit 0
 fi
 fi
 
 
+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
+
 for src
 for src
 do
 do
   # Protect names starting with `-'.
   # Protect names starting with `-'.
@@ -173,15 +229,11 @@ do
 
 
   if test -n "$dir_arg"; then
   if test -n "$dir_arg"; then
     dst=$src
     dst=$src
-    src=
-
-    if test -d "$dst"; then
-      mkdircmd=:
-      chmodcmd=
-    else
-      mkdircmd=$mkdirprog
-    fi
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
   else
   else
+
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
     # if $src (and thus $dsttmp) contains '*'.
@@ -208,53 +260,188 @@ do
 	echo "$0: $dstarg: Is a directory" >&2
 	echo "$0: $dstarg: Is a directory" >&2
 	exit 1
 	exit 1
       fi
       fi
-      dst=$dst/`basename "$src"`
+      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
   fi
   fi
 
 
-  # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
-  # Make sure that the destination directory exists.
-
-  # Skip lots of stat calls in the usual case.
-  if test ! -d "$dstdir"; then
-    defaultIFS='
-	 '
-    IFS="${IFS-$defaultIFS}"
-
-    oIFS=$IFS
-    # Some sh's can't handle IFS=/ for some reason.
-    IFS='%'
-    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-    shift
-    IFS=$oIFS
+  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=
+	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=
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
 
 
-    while test $# -ne 0 ; do
-      pathcomp=$pathcomp$1
+      # 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
       shift
-      if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp"
-	# mkdir can fail with a `File exist' error in case several
-	# install-sh are creating the directory concurrently.  This
-	# is OK.
-	test -d "$pathcomp" || exit
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	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
+	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
-      pathcomp=$pathcomp/
-    done
+    fi
   fi
   fi
 
 
   if test -n "$dir_arg"; then
   if test -n "$dir_arg"; then
-    $doit $mkdircmd "$dst" \
-      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
+    { 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
   else
-    dstfile=`basename "$dst"`
 
 
     # Make a couple of temp file names in the proper directory.
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
     dsttmp=$dstdir/_inst.$$_
@@ -262,10 +449,9 @@ do
 
 
     # Trap to clean up those temp files at exit.
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-    trap '(exit $?); exit' 1 2 13 15
 
 
     # Copy the file name to the temp name.
     # Copy the file name to the temp name.
-    $doit $cpprog "$src" "$dsttmp" &&
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 
 
     # and set any options; do chmod last to preserve setuid bits.
     # and set any options; do chmod last to preserve setuid bits.
     #
     #
@@ -276,10 +462,10 @@ do
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
 
     # Now rename the file to the real destination.
     # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
       || {
       || {
 	   # The rename failed, perhaps because mv can't rename something else
 	   # The rename failed, perhaps because mv can't rename something else
 	   # to itself, or perhaps because mv is so ancient that it does not
 	   # to itself, or perhaps because mv is so ancient that it does not
@@ -291,11 +477,12 @@ do
 	   # reasons.  In this case, the final cleanup might fail but the new
 	   # reasons.  In this case, the final cleanup might fail but the new
 	   # file should still install successfully.
 	   # file should still install successfully.
 	   {
 	   {
-	     if test -f "$dstdir/$dstfile"; then
-	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	     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 $dstdir/$dstfile" >&2
+		 echo "$0: cannot unlink or rename $dst" >&2
 		 (exit 1); exit 1
 		 (exit 1); exit 1
 	       }
 	       }
 	     else
 	     else
@@ -304,16 +491,13 @@ do
 	   } &&
 	   } &&
 
 
 	   # Now rename the file to the real destination.
 	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	   $doit $mvcmd "$dsttmp" "$dst"
 	 }
 	 }
-    }
-  fi || { (exit 1); exit 1; }
-done
+    } || exit 1
 
 
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit 0
-}
+    trap '' 0
+  fi
+done
 
 
 # Local variables:
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # eval: (add-hook 'write-file-hooks 'time-stamp)

+ 35 - 0
magic/Magdir/acorn

@@ -30,3 +30,38 @@
 0	string		Maestro\r	RISC OS music file
 0	string		Maestro\r	RISC OS music file
 >8	byte		x		version %d
 >8	byte		x		version %d
 
 
+>8	byte		x		type %d
+
+# Digital Symphony data files
+# From: Bernard Jungen (bern8817@euphonynet.be)
+0		string	\x02\x01\x13\x13\x13\x01\x0d\x10	Digital Symphony sound sample (RISC OS),
+>8		byte	x	version %d,
+>9		pstring	x	named "%s",
+>(9.b+19)	byte	=0	8-bit logarithmic
+>(9.b+19)	byte	=1	LZW-compressed linear
+>(9.b+19)	byte	=2	8-bit linear signed
+>(9.b+19)	byte	=3	16-bit linear signed
+>(9.b+19)	byte	=4	SigmaDelta-compressed linear
+>(9.b+19)	byte	=5	SigmaDelta-compressed logarithmic
+>(9.b+19)	byte	>5	unknown format
+
+0	string	\x02\x01\x13\x13\x14\x12\x01\x0b	Digital Symphony song (RISC OS),
+>8	byte	x	version %d,
+>9	byte	=1	1 voice,
+>9	byte	!1	%d voices,
+>10	leshort	=1	1 track,
+>10	leshort	!1	%d tracks,
+>12	leshort	=1	1 pattern
+>12	leshort	!1	%d patterns
+
+0	string	\x02\x01\x13\x13\x10\x14\x12\x0e
+>9	byte	=0	Digital Symphony sequence (RISC OS),
+>>8	byte	x	version %d,
+>>10	byte	=1	1 line,
+>>10	byte	!1	%d lines,
+>>11	leshort	=1	1 position
+>>11	leshort	!1	%d positions
+>9	byte	=1	Digital Symphony pattern data (RISC OS),
+>>8	byte	x	version %d,
+>>10	leshort	=1	1 pattern
+>>10	leshort	!1	%d patterns

+ 11 - 0
magic/Magdir/animation

@@ -678,3 +678,14 @@
 >0x21	byte		x		v%x
 >0x21	byte		x		v%x
 0	string		DVDVIDEO-VMG	Video manager,
 0	string		DVDVIDEO-VMG	Video manager,
 >0x21	byte		x		v%x
 >0x21	byte		x		v%x
+
+# From: Behan Webster <behanw@websterwood.com>
+# NuppelVideo used by Mythtv (*.nuv)
+0	regex		NuppelVideo|MythTVVideo MythTV NuppelVideo
+>12	string		x		v%s
+>20	lelong		x		(%d
+>24	lelong		x		\bx%d),
+>36	string		P		\bprogressive,
+>36	string		I		\binterlaced,
+>40	ledouble	x		\baspect:%.2f,
+>48	ledouble	x		\bfps:%.2f

+ 41 - 0
magic/Magdir/apple

@@ -189,3 +189,44 @@
 >0		byte		<5		\b
 >0		byte		<5		\b
 >>13	byte		0x81	\b
 >>13	byte		0x81	\b
 >>>14	uleshort	x		\b, system %hd
 >>>14	uleshort	x		\b, system %hd
+
+#------------------------------------------------------------------------------
+# CAF: Apple CoreAudio File Format
+#
+# Container format for high-end audio purposes.
+# From: David Remahl <dremahl@apple.com>
+#
+0	string		caff		CoreAudio Format audio file
+>4	beshort		<10		version %d
+>6	beshort		x
+
+
+#------------------------------------------------------------------------------
+# Keychain database files
+0	string		kych		Mac OS X Keychain File
+
+#------------------------------------------------------------------------------
+# Code Signing related file types
+0	belong		0xfade0c00	Mac OS X Code Requirement
+>8	belong		1			(opExpr)
+>4	belong		x			- %d bytes
+
+0	belong		0xfade0c01	Mac OS X Code Requirement Set
+>8	belong		>1			containing %d items
+>4	belong		x			- %d bytes
+
+0	belong		0xfade0c02	Mac OS X Code Directory
+>8	belong		x			version %x
+>12	belong		>0			flags 0x%x
+>4	belong		x			- %d bytes
+
+0	belong		0xfade0cc0	Mac OS X Detached Code Signature (non-executable)
+>4	belong		x			- %d bytes
+
+0	belong		0xfade0cc1	Mac OS X Detached Code Signature
+>8	belong		>1			(%d elements)
+>4	belong		x			- %d bytes
+
+# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# .vdi
+4	string innotek\ VirtualBox\ Disk\ Image %s

+ 17 - 0
magic/Magdir/archive

@@ -531,6 +531,7 @@
 
 
 # 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
 0	string		PK\003\004
+>4	byte		0x00		Zip archive data
 >4	byte		0x09		Zip archive data, at least v0.9 to extract
 >4	byte		0x09		Zip archive data, at least v0.9 to extract
 >4	byte		0x0a		Zip archive data, at least v1.0 to extract
 >4	byte		0x0a		Zip archive data, at least v1.0 to extract
 >4	byte		0x0b		Zip archive data, at least v1.1 to extract
 >4	byte		0x0b		Zip archive data, at least v1.1 to extract
@@ -731,3 +732,19 @@
 >4	lelong	0x1000006D	(EPOC release 3/4/5)
 >4	lelong	0x1000006D	(EPOC release 3/4/5)
 >4	lelong	0x10003A12	(EPOC release 6)
 >4	lelong	0x10003A12	(EPOC release 6)
 0	lelong	0x10201A7A	Symbian installation file (Symbian OS 9.x)
 0	lelong	0x10201A7A	Symbian installation file (Symbian OS 9.x)
+
+# Pack200 Java archives, http://jcp.org/en/jsr/detail?id=200
+0	belong	0xcafed00d	Pack200 Java archive
+
+# From "Nelson A. de Oliveira" <naoliv@gmail.com>
+0	string	MPQ\032		MoPaQ (MPQ) archive
+
+# From: Dirk Jagdmann <doj@cubic.org>
+# xar archive format: http://code.google.com/p/xar/
+0	string	xar!		xar archive
+>6	beshort	x		- version %ld
+
+# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# .kgb
+0	string KGB_arch		KGB Archiver file
+>10	string x		with compression level %.1s

+ 7 - 0
magic/Magdir/audio

@@ -556,3 +556,10 @@
 # From: Matthew Flaschen <matthew.flaschen@gatech.edu>
 # From: Matthew Flaschen <matthew.flaschen@gatech.edu>
 0	string	#EXTM3U 	M3U playlist text
 0	string	#EXTM3U 	M3U playlist text
 
 
+# From: "Mateus Caruccio" <mateus@caruccio.com>
+# guitar pro v3,4,5 from http://filext.com/file-extension/gp3
+0	string	\030FICHIER\ GUITAR\ PRO\ v3.	Guitar Pro Ver. 3 Tablature
+
+# From: "Leslie P. Polzer" <leslie.polzer@gmx.net>
+60	string	SONG		SoundFX Module sound file
+

+ 34 - 14
magic/Magdir/blender

@@ -1,17 +1,37 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# blender: file(1) magic for Blender 3D data files
+# blender: file(1) magic for Blender 3D related files
 #
 #
-# Coded by Guillermo S. Romero <gsromero@alumnos.euitt.upm.es> using the
-# data from Ton Roosendaal <ton@blender.nl>. Ton or his company do not
-# support the rule, so mail GSR if problems with it. Rule version: 1.1.
-# You can get latest version with comments and details about the format
-# at http://acd.asoc.euitt.upm.es/~gsromero/3d/blender/magic.blender
+# Native format rule v1.2. For questions use the developers list 
+# http://lists.blender.org/mailman/listinfo/bf-committers
+# GLOB chunk was moved near start and provides subversion info since 2.42 
 
 
-0	string	=BLENDER	Blender3D,
->7	string	=_		saved as 32-bits
->7      string	=-		saved as 64-bits
->8	string	=v		little endian
->8	string	=V		big endian
->9	byte	x		with version %c.
->10	byte	x		\b%c
->11	byte	x		\b%c
+0		string	=BLENDER	Blender3D,
+>7		string	=_		saved as 32-bits
+>>8		string	=v		little endian
+>>>9		byte	x		with version %c.
+>>>10		byte	x		\b%c
+>>>11		byte	x		\b%c
+>>>0x40		string	=GLOB		\b.
+>>>>0x58	leshort	x		\b%.4d
+>>8		string	=V		big endian
+>>>9		byte	x		with version %c.
+>>>10		byte	x		\b%c
+>>>11		byte	x		\b%c
+>>>0x40		string	=GLOB		\b.
+>>>>0x58	beshort	x		\b%.4d
+>7		string	=-		saved as 64-bits
+>>8		string	=v		little endian
+>>9		byte	x		with version %c.
+>>10		byte	x		\b%c
+>>11		byte	x		\b%c
+>>0x44		string	=GLOB		\b.
+>>>0x60		leshort	x		\b%.4d
+>>8		string	=V		big endian
+>>>9		byte	x		with version %c.
+>>>10		byte	x		\b%c
+>>>11		byte	x		\b%c
+>>>0x44		string	=GLOB		\b.
+>>>>0x60	beshort	x		\b%.4d
+
+# Scripts that run in the embeded Python interpreter
+0		string	#!BPY		Blender3D BPython script

+ 2 - 1
magic/Magdir/commands

@@ -28,7 +28,8 @@
 0	string/b	#!\ /bin/awk		awk script text executable
 0	string/b	#!\ /bin/awk		awk script text executable
 0	string/b	#!\ /usr/bin/awk	awk script text executable
 0	string/b	#!\ /usr/bin/awk	awk script text executable
 # update to distinguish from *.vcf files
 # update to distinguish from *.vcf files
-0	regex		BEGIN[[:space:]]*[{]	awk script text
+# this is broken because postscript has /EBEGIN{ for example.
+#0	regex		BEGIN[[:space:]]*[{]	awk script text
 
 
 # AT&T Bell Labs' Plan 9 shell
 # AT&T Bell Labs' Plan 9 shell
 0	string/b	#!\ /bin/rc	Plan 9 rc shell script text executable
 0	string/b	#!\ /bin/rc	Plan 9 rc shell script text executable

+ 61 - 0
magic/Magdir/console

@@ -191,3 +191,64 @@
 0	string	PPF10			Playstation Patch File version 1.0
 0	string	PPF10			Playstation Patch File version 1.0
 >5	byte	0			\b, Simple Encoding
 >5	byte	0			\b, Simple Encoding
 >6	string	x			\b, description: %s
 >6	string	x			\b, description: %s
+
+# From: Daniel Dawson <ddawson@icehouse.net>
+# SNES9x .smv "movie" file format.
+0		string		SMV\x1A	SNES9x input recording
+>0x4		lelong		x	\b, version %d
+# version 4 is latest so far 
+>0x4		lelong		<5
+>>0x8		ledate		x	\b, recorded at %s
+>>0xc		lelong		>0	\b, rerecorded %d times
+>>0x10		lelong		x	\b, %d frames long
+>>0x14		byte		>0	\b, data for controller(s):
+>>>0x14		byte		&0x1	#1
+>>>0x14		byte		&0x2	#2
+>>>0x14		byte		&0x4	#3
+>>>0x14		byte		&0x8	#4
+>>>0x14		byte		&0x10	#5
+>>0x15		byte		^0x1	\b, begins from snapshot
+>>0x15		byte		&0x1	\b, begins from reset
+>>0x15		byte		^0x2	\b, NTSC standard
+>>0x15		byte		&0x2	\b, PAL standard
+>>0x17		byte		&0x1    \b, settings:
+# WIP1Timing not used as of version 4
+>>>0x4		lelong		<4
+>>>>0x17	byte		&0x2	WIP1Timing
+>>>0x17		byte		&0x4	Left+Right
+>>>0x17		byte		&0x8	VolumeEnvX
+>>>0x17		byte		&0x10	FakeMute
+>>>0x17		byte		&0x20	SyncSound
+# New flag as of version 4
+>>>0x4		lelong		>3
+>>>>0x17	byte		&0x80	NoCPUShutdown
+>>0x4		lelong		<4
+>>>0x18		lelong		>0x23
+>>>>0x20	leshort		!0
+>>>>>0x20	lestring16	x	\b, metadata: "%s"
+>>0x4		lelong		>3
+>>>0x24		byte		>0	\b, port 1:
+>>>>0x24	byte		1	joypad
+>>>>0x24	byte		2	mouse
+>>>>0x24	byte		3	SuperScope
+>>>>0x24	byte		4	Justifier
+>>>>0x24	byte		5	multitap
+>>>0x24		byte		>0	\b, port 2:
+>>>>0x25	byte		1	joypad
+>>>>0x25	byte		2	mouse
+>>>>0x25	byte		3	SuperScope
+>>>>0x25	byte		4	Justifier
+>>>>0x25	byte		5	multitap
+>>>0x18		lelong		>0x43
+>>>>0x40	leshort		!0
+>>>>>0x40	lestring16	x	\b, metadata: "%s"
+>>0x17		byte		&0x40   \b, ROM:
+>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
+>>>(0x18.l-23)	string		x	"%s"
+
+# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# .w3g
+0	string Warcraft\ III\ recorded\ game	%s
+# .w3m
+0	string HM3W				Warcraft III map file
+

+ 10 - 0
magic/Magdir/database

@@ -210,3 +210,13 @@
 16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
+
+# From: Maxime Henrion <mux@FreeBSD.org>
+# PostgreSQL's custom dump format, Maxime Henrion <mux@FreeBSD.org>
+0	string		PGDMP		PostgreSQL custom database dump
+>5	byte		x		- v%d
+>6	byte		x		\b.%d
+>5	beshort		<=0x100		\b-0
+>5	beshort		>0x100
+>>7	byte		x		\b-%d
+

+ 14 - 0
magic/Magdir/efi

@@ -0,0 +1,14 @@
+
+#------------------------------------------------------------------------------
+# efi:  file(1) magic for Universal EFI binaries
+
+0	lelong	0x0ef1fab9
+>4	lelong	1		Universal EFI binary with 1 architecture
+>>&0	lelong	7		\b, i386
+>>&0	lelong	0x01000007	\b, x86_64
+>4	lelong	2		Universal EFI binary with 2 architectures
+>>&0	lelong	7		\b, i386
+>>&0	lelong	0x01000007	\b, x86_64
+>>&20	lelong	7		\b, i386
+>>&20	lelong	0x01000007	\b, x86_64
+>4	lelong	>2		Universal EFI binary with %ld architectures

+ 17 - 16
magic/Magdir/elf

@@ -51,10 +51,10 @@
 >>>>36  lelong&0xf0000000	0x20000000	MIPS-III
 >>>>36  lelong&0xf0000000	0x20000000	MIPS-III
 >>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
 >>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
 >>>>36  lelong&0xf0000000	0x40000000	MIPS-V
 >>>>36  lelong&0xf0000000	0x40000000	MIPS-V
->>>>36  lelong&0xf0000000	0x60000000	MIPS32
->>>>36  lelong&0xf0000000	0x70000000	MIPS64
->>>>36  lelong&0xf0000000	0x80000000	MIPS32 rel2
->>>>36  lelong&0xf0000000	0x90000000	MIPS64 rel2
+>>>>36  lelong&0xf0000000	0x50000000	MIPS32
+>>>>36  lelong&0xf0000000	0x60000000	MIPS64
+>>>>36  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>>36  lelong&0xf0000000	0x80000000	MIPS64 rel2
 # only for 64-bit
 # only for 64-bit
 >>>4	byte		2
 >>>4	byte		2
 >>>>48  lelong&0xf0000000	0x00000000	MIPS-I
 >>>>48  lelong&0xf0000000	0x00000000	MIPS-I
@@ -62,10 +62,10 @@
 >>>>48  lelong&0xf0000000	0x20000000	MIPS-III
 >>>>48  lelong&0xf0000000	0x20000000	MIPS-III
 >>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
 >>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
 >>>>48  lelong&0xf0000000	0x40000000	MIPS-V
 >>>>48  lelong&0xf0000000	0x40000000	MIPS-V
->>>>48  lelong&0xf0000000	0x60000000	MIPS32
->>>>48  lelong&0xf0000000	0x70000000	MIPS64 
->>>>48  lelong&0xf0000000	0x80000000	MIPS32 rel2
->>>>48  lelong&0xf0000000	0x90000000	MIPS64 rel2
+>>>>48  lelong&0xf0000000	0x50000000	MIPS32
+>>>>48  lelong&0xf0000000	0x60000000	MIPS64
+>>>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
 >>18	leshort		9		Amdahl - invalid byte order,
 >>18	leshort		9		Amdahl - invalid byte order,
 >>18	leshort		10		MIPS (deprecated),
 >>18	leshort		10		MIPS (deprecated),
 >>18	leshort		11		RS6000 - invalid byte order,
 >>18	leshort		11		RS6000 - invalid byte order,
@@ -139,10 +139,10 @@
 >>>>36  belong&0xf0000000	0x20000000	MIPS-III
 >>>>36  belong&0xf0000000	0x20000000	MIPS-III
 >>>>36  belong&0xf0000000	0x30000000	MIPS-IV
 >>>>36  belong&0xf0000000	0x30000000	MIPS-IV
 >>>>36  belong&0xf0000000	0x40000000	MIPS-V
 >>>>36  belong&0xf0000000	0x40000000	MIPS-V
->>>>36  belong&0xf0000000	0x60000000	MIPS32
->>>>36  belong&0xf0000000	0x70000000	MIPS64
->>>>36  belong&0xf0000000	0x80000000	MIPS32 rel2
->>>>36  belong&0xf0000000	0x90000000	MIPS64 rel2
+>>>>36  belong&0xf0000000	0x50000000	MIPS32
+>>>>36  belong&0xf0000000	0x60000000	MIPS64
+>>>>36  belong&0xf0000000	0x70000000	MIPS32 rel2
+>>>>36  belong&0xf0000000	0x80000000	MIPS64 rel2
 # only for 64-bit
 # only for 64-bit
 >>>4	byte		2
 >>>4	byte		2
 >>>>48	belong&0xf0000000	0x00000000	MIPS-I
 >>>>48	belong&0xf0000000	0x00000000	MIPS-I
@@ -150,10 +150,10 @@
 >>>>48	belong&0xf0000000	0x20000000	MIPS-III
 >>>>48	belong&0xf0000000	0x20000000	MIPS-III
 >>>>48	belong&0xf0000000	0x30000000	MIPS-IV
 >>>>48	belong&0xf0000000	0x30000000	MIPS-IV
 >>>>48	belong&0xf0000000	0x40000000	MIPS-V
 >>>>48	belong&0xf0000000	0x40000000	MIPS-V
->>>>48	belong&0xf0000000	0x60000000	MIPS32
->>>>48	belong&0xf0000000	0x70000000	MIPS64 
->>>>48	belong&0xf0000000	0x80000000	MIPS32 rel2
->>>>48	belong&0xf0000000	0x90000000	MIPS64 rel2
+>>>>48	belong&0xf0000000	0x50000000	MIPS32
+>>>>48	belong&0xf0000000	0x60000000	MIPS64
+>>>>48	belong&0xf0000000	0x70000000	MIPS32 rel2
+>>>>48	belong&0xf0000000	0x80000000	MIPS64 rel2
 >>18	beshort		9		Amdahl,
 >>18	beshort		9		Amdahl,
 >>18	beshort		10		MIPS (deprecated),
 >>18	beshort		10		MIPS (deprecated),
 >>18	beshort		11		RS6000,
 >>18	beshort		11		RS6000,
@@ -196,6 +196,7 @@
 >>18	beshort		88		Renesas M32R,
 >>18	beshort		88		Renesas M32R,
 >>18	beshort		94		Tensilica Xtensa,
 >>18	beshort		94		Tensilica Xtensa,
 >>18	beshort		97		NatSemi 32k,
 >>18	beshort		97		NatSemi 32k,
+>>18	beshort		0x18ad		AVR32 (unofficial),
 >>18	beshort		0x9026		Alpha (unofficial),
 >>18	beshort		0x9026		Alpha (unofficial),
 >>18	beshort		0xa390		IBM S/390 (obsolete),
 >>18	beshort		0xa390		IBM S/390 (obsolete),
 >>20	belong		0		invalid version
 >>20	belong		0		invalid version

+ 140 - 91
magic/Magdir/filesystems

@@ -52,7 +52,13 @@
 >>>>11	ulelong	>0		\b, %d sectors/track
 >>>>11	ulelong	>0		\b, %d sectors/track
 >>>>15	ulelong	>0		\b, %d cylinders
 >>>>15	ulelong	>0		\b, %d cylinders
 
 
+# updated by Joerg Jenderek at Sep 2007
+# only for sector sizes with 512 or more Bytes
 0x1FE	leshort	0xAA55			x86 boot sector
 0x1FE	leshort	0xAA55			x86 boot sector
+# to do also for sectors < than 512 Bytes and some other files, GRR
+#30	search/481	\x55\xAA	x86 boot sector
+# not for BeOS floppy 1440k, MBRs
+#(11.s-2) uleshort	0xAA55		x86 boot sector
 >2	string	OSBS			\b, OS/BS MBR
 >2	string	OSBS			\b, OS/BS MBR
 # J\xf6rg Jenderek <joerg dot jenderek at web dot de>
 # J\xf6rg Jenderek <joerg dot jenderek at web dot de>
 >0x8C	string	Invalid\ partition\ table	\b, MS-DOS MBR
 >0x8C	string	Invalid\ partition\ table	\b, MS-DOS MBR
@@ -173,56 +179,59 @@
 >>498	string	BCDL\ \ \ \ BIN			\b, Bootable CD Loader (1.50Z)
 >>498	string	BCDL\ \ \ \ BIN			\b, Bootable CD Loader (1.50Z)
 # mbr partion table entries
 # mbr partion table entries
 # OEM-ID not Microsoft,SYSLINUX,or MTOOLs
 # OEM-ID not Microsoft,SYSLINUX,or MTOOLs
->3			string		!MS	
+>3			string		!MS
 >>3			string		!SYSLINUX
 >>3			string		!SYSLINUX
 >>>3			string		!MTOOL
 >>>3			string		!MTOOL
 # not FAT (32 bit)
 # not FAT (32 bit)
 >>>>82			string		!FAT32	
 >>>>82			string		!FAT32	
 #not IO.SYS
 #not IO.SYS
 >>>>>472		string		!IO\ \ \ \ \ \ SYS
 >>>>>472		string		!IO\ \ \ \ \ \ SYS
+>>>>>>480		string		!IO\ \ \ \ \ \ SYS
 #not Linux kernel
 #not Linux kernel
->>>>>>514		string		!HdrS		
+>>>>>>>514		string		!HdrS
+#not BeOS
+>>>>>>>>422		string		!Be\ Boot\ Loader
 # active flag 0 or 0x80 and type > 0
 # active flag 0 or 0x80 and type > 0
->>>>>>>446		ubyte		<0x81	
->>>>>>>>446		ubyte&0x7F	0	
+>>>>>>>>>446		ubyte		<0x81	
+>>>>>>>>>>446		ubyte&0x7F	0	
 >>>>>>>>>>>450		ubyte		>0	\b; partition 1: ID=0x%x
 >>>>>>>>>>>450		ubyte		>0	\b; partition 1: ID=0x%x
->>>>>>>>>>446		ubyte		0x80	\b, active
->>>>>>>>>>447		ubyte		x	\b, starthead %u
-#>>>>>>>>>>448		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>448		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>454		ulelong		x	\b, startsector %u
->>>>>>>>>>458		ulelong		x	\b, %u sectors
+>>>>>>>>>>>>446		ubyte		0x80	\b, active
+>>>>>>>>>>>>447		ubyte		x	\b, starthead %u
+#>>>>>>>>>>>>448		ubyte		x	\b, start C_S: 0x%x
+#>>>>>>>>>>>>448		ubeshort&1023	x	\b, startcylinder? %d
+>>>>>>>>>>>>454		ulelong		x	\b, startsector %u
+>>>>>>>>>>>>458		ulelong		x	\b, %u sectors
 #
 #
->>>>>>>462		ubyte		<0x81	
->>>>>>>>462		ubyte&0x7F	0		
->>>>>>>>>466		ubyte		>0	\b; partition 2: ID=0x%x
->>>>>>>>>>462		ubyte		0x80	\b, active
->>>>>>>>>>463		ubyte		x	\b, starthead %u
-#>>>>>>>>>>464		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>464		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>470		ulelong		x	\b, startsector %u
->>>>>>>>>>474		ulelong		x	\b, %u sectors
+>>>>>>>>>462		ubyte		<0x81	
+>>>>>>>>>>462		ubyte&0x7F	0		
+>>>>>>>>>>>466		ubyte		>0	\b; partition 2: ID=0x%x
+>>>>>>>>>>>>462		ubyte		0x80	\b, active
+>>>>>>>>>>>>463		ubyte		x	\b, starthead %u
+#>>>>>>>>>>>>464		ubyte		x	\b, start C_S: 0x%x
+#>>>>>>>>>>>>464		ubeshort&1023	x	\b, startcylinder? %d
+>>>>>>>>>>>>470		ulelong		x	\b, startsector %u
+>>>>>>>>>>>>474		ulelong		x	\b, %u sectors
 #
 #
->>>>>>>478		ubyte		<0x81		
->>>>>>>>478		ubyte&0x7F	0		
->>>>>>>>>482		ubyte		>0	\b; partition 3: ID=0x%x
->>>>>>>>>>478		ubyte		0x80	\b, active
->>>>>>>>>>479		ubyte		x	\b, starthead %u
-#>>>>>>>>>>480		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>481		ubyte		x	\b, start C2S: 0x%x
-#>>>>>>>>>>480		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>486		ulelong		x	\b, startsector %u
->>>>>>>>>>490		ulelong		x	\b, %u sectors
+>>>>>>>>>478		ubyte		<0x81		
+>>>>>>>>>>478		ubyte&0x7F	0		
+>>>>>>>>>>>482		ubyte		>0	\b; partition 3: ID=0x%x
+>>>>>>>>>>>>478		ubyte		0x80	\b, active
+>>>>>>>>>>>>479		ubyte		x	\b, starthead %u
+#>>>>>>>>>>>>480		ubyte		x	\b, start C_S: 0x%x
+#>>>>>>>>>>>>481		ubyte		x	\b, start C2S: 0x%x
+#>>>>>>>>>>>>480		ubeshort&1023	x	\b, startcylinder? %d
+>>>>>>>>>>>>486		ulelong		x	\b, startsector %u
+>>>>>>>>>>>>490		ulelong		x	\b, %u sectors
 #
 #
->>>>>>>494		ubyte		<0x81	
->>>>>>>>494		ubyte&0x7F	0		
->>>>>>>>>498		ubyte		>0	\b; partition 4: ID=0x%x
->>>>>>>>>>494		ubyte		0x80	\b, active
->>>>>>>>>>495		ubyte		x	\b, starthead %u
-#>>>>>>>>>>496		ubyte		x	\b, start C_S: 0x%x
-#>>>>>>>>>>496		ubeshort&1023	x	\b, startcylinder? %d
->>>>>>>>>>502		ulelong		x	\b, startsector %u
->>>>>>>>>>506		ulelong		x	\b, %u sectors
+>>>>>>>>>494		ubyte		<0x81	
+>>>>>>>>>>494		ubyte&0x7F	0		
+>>>>>>>>>>>498		ubyte		>0	\b; partition 4: ID=0x%x
+>>>>>>>>>>>>494		ubyte		0x80	\b, active
+>>>>>>>>>>>>495		ubyte		x	\b, starthead %u
+#>>>>>>>>>>>>496		ubyte		x	\b, start C_S: 0x%x
+#>>>>>>>>>>>>496		ubeshort&1023	x	\b, startcylinder? %d
+>>>>>>>>>>>>502		ulelong		x	\b, startsector %u
+>>>>>>>>>>>>506		ulelong		x	\b, %u sectors
 # mbr partion table entries end
 # mbr partion table entries end
 # http://www.acronis.de/
 # http://www.acronis.de/
 #FAT label=ACRONIS\ SZ
 #FAT label=ACRONIS\ SZ
@@ -507,34 +516,52 @@
 >>>>>>>498	ubyte&0xDF	>0			
 >>>>>>>498	ubyte&0xDF	>0			
 >>>>>>>>498	string		x 			\b.%-.3s
 >>>>>>>>498	string		x 			\b.%-.3s
 #
 #
->486	ubyte&0xDF	>0
->>416	string	Non-System\ disk\ or\ 			
->>>435	string	disk\ error\r				
->>>>447	string	Replace\ and\ press\ any\ key\ 		
->>>>>473 string	when\ ready\r				\b, Microsoft DOS Bootloader
->480	ubyte&0xDF	>0			
->>393	string	Non-System\ disk\ or\ 			
->>>412	string	disk\ error\r				
->>>>424	string	Replace\ and\ press\ any\ key\ 		
->>>>>450 string	when\ ready\r				\b, Microsoft DOS bootloader
-#IO.SYS
->>>>>480	string		x 			\b %-.2s
->>>>>>482	ubyte&0xDF	>0			
->>>>>>>48	string		x 			\b%-.6s
->>>>>488	ubyte&0xDF	>0			
->>>>>>488	string		x 			\b.%-.3s
-#MSDOS.SYS
->>>>>>491	ubyte&0xDF	>0			\b+
->>>>>>>491	string		x 			\b%-.5s
->>>>>>>>496	ubyte&0xDF	>0			
->>>>>>>>>496	string		x 			\b%-.3s
->>>>>>>499	ubyte&0xDF	>0			
->>>>>>>>499	string		x 			\b.%-.3s
+>376	search/41	Non-System\ disk\ or\ 		
+>>395	search/41	disk\ error\r			
+>>>407	search/41	Replace\ and\ 			
+>>>>419	search/41	press\ 				\b,
+>>>>419	search/41	strike\ 			\b, old
+>>>>426	search/41	any\ key\ when\ ready\r		MS or PC-DOS bootloader
+#449			Disk\ Boot\ failure\r		MS 3.21
+#466			Boot\ Failure\r			MS 3.30
+>>>>>468 search/18	\0				
+#IO.SYS,IBMBIO.COM
+>>>>>>&0	string		x 			\b %-.2s
+>>>>>>>&-20	ubyte&0xDF	>0			
+>>>>>>>>&-1	string		x 			\b%-.4s
+>>>>>>>>>&-16	ubyte&0xDF	>0			
+>>>>>>>>>>&-1	string		x 			\b%-.2s
+>>>>>>&8	ubyte&0xDF	>0			\b.
+>>>>>>>&-1	string		x 			\b%-.3s
+#MSDOS.SYS,IBMDOS.COM
+>>>>>>&11	ubyte&0xDF	>0			\b+
+>>>>>>>&-1	string		x 			\b%-.5s
+>>>>>>>>&-6	ubyte&0xDF	>0			
+>>>>>>>>>&-1	string		x 			\b%-.1s
+>>>>>>>>>>&-5	ubyte&0xDF	>0			
+>>>>>>>>>>>&-1	string		x 			\b%-.2s
+>>>>>>>&7	ubyte&0xDF	>0			\b.
+>>>>>>>>&-1	string		x 			\b%-.3s
+>441	string	Cannot\ load\ from\ harddisk.\n\r
+>>469	string	Insert\ Systemdisk\ 			
+>>>487	string	and\ press\ any\ key.\n\r		\b, MS (2.11) DOS bootloader
 #>43	string	\224R-LOADER\ \ SYS			=label					
 #>43	string	\224R-LOADER\ \ SYS			=label					
 >54	string	SYS
 >54	string	SYS
 >>324	string	VASKK
 >>324	string	VASKK
 >>>495	string	NEWLDR\0				\b, DR-DOS Bootloader (LOADER.SYS)
 >>>495	string	NEWLDR\0				\b, DR-DOS Bootloader (LOADER.SYS)
 #
 #
+>98	string	Press\ a\ key\ to\ retry\0\r		
+>>120	string	Cannot\ find\ file\ \0\r		
+>>>139	string	Disk\ read\ error\0\r			
+>>>>156	string	Loading\ ...\0				\b, DR-DOS (3.41) Bootloader
+#DRBIOS.SYS
+>>>>>44		ubyte&0xDF	>0			
+>>>>>>44	string		x			\b %-.6s
+>>>>>>>50	ubyte&0xDF	>0			
+>>>>>>>>50	string		x 			\b%-.2s
+>>>>>>52	ubyte&0xDF	>0			
+>>>>>>>52	string		x 			\b.%-.3s
+#
 >70	string	IBMBIO\ \ COM				
 >70	string	IBMBIO\ \ COM				
 >>472	string	Cannot\ load\ DOS!\ 			
 >>472	string	Cannot\ load\ DOS!\ 			
 >>>489	string	Any\ key\ to\ retry			\b, DR-DOS Bootloader
 >>>489	string	Any\ key\ to\ retry			\b, DR-DOS Bootloader
@@ -679,26 +706,43 @@
 #it also hangs with another message ("NF").
 #it also hangs with another message ("NF").
 >>>>>492		string		RENF		\b, FAT (12 bit)
 >>>>>492		string		RENF		\b, FAT (12 bit)
 >>>>>495		string		RENF		\b, FAT (16 bit)
 >>>>>495		string		RENF		\b, FAT (16 bit)
+# added by Joerg Jenderek
+# http://syslinux.zytor.com/iso.php
+0	ulelong	0x7c40eafa		isolinux Loader
+# http://syslinux.zytor.com/pxe.php
+0	ulelong	0x007c05ea		pxelinux Loader
+0	ulelong	0x60669c66		pxelinux Loader
 # loader end
 # loader end
-# Joerg Jenderek
->446	ubyte	0			
->>450	ubyte	>0			
->>>482	ubyte	0			
->>>>498	ubyte	0			
->>>>466	ubyte	0x05			\b, extended partition table
->>>>466	ubyte	0x0F			\b, extended partition table (LBA)
->>>>466	ubyte	0x0			\b, extended partition table (last)	
+# updated by Joerg Jenderek at Sep 2007
+>3	ubyte	0			
+#no active flag
+>>446	ubyte	0			
+# partition 1 not empty
+>>>450	ubyte	>0			
+# partitions 3,4 empty
+>>>>482		ubyte	0			
+>>>>>498	ubyte	0			
+# partition 2 ID=0,5,15
+>>>>>>466	ubyte	<0x10			
+>>>>>>>466	ubyte	0x05			\b, extended partition table
+>>>>>>>466	ubyte	0x0F			\b, extended partition table (LBA)
+>>>>>>>466	ubyte	0x0			\b, extended partition table (last)	
 # JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
 # JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
-# older drives may use E9 xx xx
+# http://mirror.href.com/thestarman/asm/2bytejumps.htmm#FWD
+# older drives may use Near JuMP instruction E9 xx xx
 >0		lelong&0x009000EB	0x009000EB 
 >0		lelong&0x009000EB	0x009000EB 
 >0		lelong&0x000000E9	0x000000E9 
 >0		lelong&0x000000E9	0x000000E9 
->>1		ubyte			>37	\b, code offset 0x%x
+# maximal short forward jump is 07fx
+>1		ubyte			<0xff	\b, code offset 0x%x
 # mtools-3.9.8/msdos.h
 # mtools-3.9.8/msdos.h
 # usual values are marked with comments to get only informations of strange FAT systems
 # usual values are marked with comments to get only informations of strange FAT systems
-# valid sectorsize are from 32 to 2048
->>>11		uleshort	<2049	
->>>>11		uleshort	>31	
+# valid sectorsize must be a power of 2 from 32 to 32768
+>>11		uleshort&0x000f	x		
+>>>11		uleshort	<32769		
+>>>>11		uleshort	>31		
 >>>>>3		string		>\0		\b, OEM-ID "%8.8s"
 >>>>>3		string		>\0		\b, OEM-ID "%8.8s"
+#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
+>>>>>>8		string		IHC		\b cached by Windows 9M
 >>>>>11		uleshort	>512		\b, Bytes/sector %u
 >>>>>11		uleshort	>512		\b, Bytes/sector %u
 #>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
 #>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
 >>>>>11		uleshort	<512		\b, Bytes/sector %u
 >>>>>11		uleshort	<512		\b, Bytes/sector %u
@@ -725,17 +769,18 @@
 >>>>>26		ubyte		>2		\b, heads %u
 >>>>>26		ubyte		>2		\b, heads %u
 #>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
 #>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
 >>>>>26		ubyte		=1		\b, heads %u
 >>>>>26		ubyte		=1		\b, heads %u
->>>>>28		ulelong		>0		\b, hidden sectors %u
-#>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
->>>>>32		ulelong		>0		\b, sectors %u (volumes > 32 MB) 
-#>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB) 
+#skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
+>>>>>38		ubyte		!0x70		
+>>>>>>28	ulelong		>0		\b, hidden sectors %u
+#>>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
+>>>>>>32	ulelong		>0		\b, sectors %u (volumes > 32 MB) 
+#>>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB)
 # FAT<32 specific 
 # FAT<32 specific 
-# NOT le FAT3=NOT 3TAF=0xCCABBEB9
->>>>>82		ulelong&0xCCABBEB9	>0
->>>>>>36	ubyte		>0x80		\b, physical drive 0x%x
-#>>>>>>36	ubyte		=0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
->>>>>>36	ubyte&0x7F	>0		\b, physical drive 0x%x
-#>>>>>>36	ubyte		=0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>82		string		!FAT32
+#>>>>>>36	ubyte		0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
+#>>>>>>36	ubyte		0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>>36	ubyte		!0x80		
+>>>>>>>36	ubyte		!0		\b, physical drive 0x%x
 >>>>>>37	ubyte		>0		\b, reserved 0x%x
 >>>>>>37	ubyte		>0		\b, reserved 0x%x
 #>>>>>>37	ubyte		=0		\b, reserved 0x%x
 #>>>>>>37	ubyte		=0		\b, reserved 0x%x
 >>>>>>38	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
 >>>>>>38	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
@@ -1072,13 +1117,12 @@
 # Modified for UDF by gerardo.cacciari@gmail.com
 # Modified for UDF by gerardo.cacciari@gmail.com
 32769    string    CD001
 32769    string    CD001
 >38913   string   !NSR0      ISO 9660 CD-ROM filesystem data
 >38913   string   !NSR0      ISO 9660 CD-ROM filesystem data
->38913   string    NSR01     UDF filesystem data (version 1.0)
->38913   string    NSR02     UDF filesystem data (version 1.5)
->38913   string    NSR03     UDF filesystem data (version 2.0)
->38913   string    >NSR03    UDF filesystem data (unknown version,
->>38917  byte      x         id 'NSR0%c')
->38913   string    <NSR01    UDF filesystem data (unknown version,
->>38917  byte      x         id 'NSR0%c')
+>38913   string    NSR0      UDF filesystem data
+>>38917  string    1         (version 1.0)
+>>38917  string    2         (version 1.5)
+>>38917  string    3         (version 2.0)
+>>38917  byte     >0x33      (unknown version, ID 0x%X)
+>>38917  byte     <0x31      (unknown version, ID 0x%X)
 # "application id" which appears to be used as a volume label
 # "application id" which appears to be used as a volume label
 >32808	 string    >\0       '%s'
 >32808	 string    >\0       '%s'
 >34816	 string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
 >34816	 string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
@@ -1210,3 +1254,8 @@
 >525    byte            x               Level %d
 >525    byte            x               Level %d
 >525    byte            x               (ODS-%d OpenVMS file system),
 >525    byte            x               (ODS-%d OpenVMS file system),
 >984    string          x               volume label is '%-12.12s'
 >984    string          x               volume label is '%-12.12s'
+
+# From: Thomas Klausner <wiz@NetBSD.org>
+# http://filext.com/file-extension/DAA
+# describes the daa file format. The magic would be:
+0	string		DAA\x0\x0\x0\x0\x0	PowerISO Direct-Access-Archive

+ 2 - 0
magic/Magdir/fortran

@@ -0,0 +1,2 @@
+# FORTRAN source
+0	string/c	c\ 		FORTRAN program

+ 14 - 0
magic/Magdir/java

@@ -7,3 +7,17 @@
 # From Martin Pool (m.pool@pharos.com.au)
 # From Martin Pool (m.pool@pharos.com.au)
 0	beshort		0xaced		Java serialization data
 0	beshort		0xaced		Java serialization data
 >2	beshort		>0x0004		\b, version %d
 >2	beshort		>0x0004		\b, version %d
+
+0	belong		0xfeedfeed	Java KeyStore
+
+0	belong		0xcececece	Java JCE KeyStore
+
+# Dalvik .dex format. http://retrodev.com/android/dexformat.html
+# From <mkf@google.com> "Mike Fleming"
+0	string	dex\n
+>0	regex	dex\n[0-9][0-9][0-9]\0	Dalvik dex file
+>4	string	>000			version %s
+0	string	dey\n
+>0	regex	dey\n[0-9][0-9][0-9]\0	Dalvik dex file (optimized for host)
+>4	string	>000			version %s
+

+ 1 - 1
magic/Magdir/macintosh

@@ -357,4 +357,4 @@
 >>>>0xa54	belong		x		number of blocks: %d
 >>>>0xa54	belong		x		number of blocks: %d
 
 
 # From: Remi Mommsen <mommsen@slac.stanford.edu>
 # From: Remi Mommsen <mommsen@slac.stanford.edu>
-0		string		BOMStore	Mac OS X bill of materials (BOM) fil
+0		string		BOMStore	Mac OS X bill of materials (BOM) file

+ 48 - 11
magic/Magdir/msdos

@@ -17,10 +17,6 @@
 100	regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
 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	regex/c =^[\ \t]{0,10}say\ ['"]	     OS/2 REXX batch file text
 
 
-
-100 regex/c =^\\s*call\\s+rxfuncadd.*sysloadfu OS/2 REXX batch file text
-100 regex/c =^\\s*say\ ['"] OS/2 REXX batch file text
-
 0	leshort		0x14c	MS Windows COFF Intel 80386 object file
 0	leshort		0x14c	MS Windows COFF Intel 80386 object file
 #>4	ledate		x	stamp %s
 #>4	ledate		x	stamp %s
 0	leshort		0x166	MS Windows COFF MIPS R4000 object file
 0	leshort		0x166	MS Windows COFF MIPS R4000 object file
@@ -363,8 +359,6 @@
 >30	byte	12		(4kB sectors)
 >30	byte	12		(4kB sectors)
 
 
 # Popular applications
 # Popular applications
-# False positive with PPT
-#0       string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
 2080	string	Microsoft\ Word\ 6.0\ Document	%s
 2080	string	Microsoft\ Word\ 6.0\ Document	%s
 2080	string	Documento\ Microsoft\ Word\ 6 Spanish Microsoft Word 6 document data
 2080	string	Documento\ Microsoft\ Word\ 6 Spanish Microsoft Word 6 document data
 # Pawel Wiecek <coven@i17linuxb.ists.pwr.wroc.pl> (for polish Word)
 # Pawel Wiecek <coven@i17linuxb.ists.pwr.wroc.pl> (for polish Word)
@@ -610,10 +604,44 @@
 0	string	VMDK		 VMware4 disk image
 0	string	VMDK		 VMware4 disk image
 0	string	KDMV		 VMware4 disk image
 0	string	KDMV		 VMware4 disk image
 
 
-0	belong	0x514649fb	QEMU Copy-On-Write disk image
->4	belong	x		version %d,
->24	belong	x		size %d +
->28	belong	x		%d
+#--------------------------------------------------------------------
+# 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
+
+# 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
+
+# Using the existence of the Backing File Offset to Branch or not
+# to read Backing File Information
+>>0xc    belong  >0      , Backing File( Offset: %d
+>>>(0xc.L)       string >\0     , Path: %s
+
+# Didnt got 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: %d
+
+# Modification time of the Backing File
+# Really usefull if you want to know if your backing
+# file is still usable together with this image
+>>>20    bedate x       , Mtime: %s )
+
+# Dont 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
 
 
 0	string	QEVM		QEMU's suspend to disk image
 0	string	QEVM		QEMU's suspend to disk image
 
 
@@ -624,5 +652,14 @@
 0	lelong	0x02468ace			Bochs Sparse disk image
 0	lelong	0x02468ace			Bochs Sparse disk image
 
 
 # from http://filext.com by Derek M Jones <derek@knosof.co.uk>
 # from http://filext.com by Derek M Jones <derek@knosof.co.uk>
-0	string	\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF	Microsoft Installer
+# False positive with PPT
+#0	string	\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF	Microsoft Installer
 0	string	\320\317\021\340\241\261\032\341	Microsoft Office Document
 0	string	\320\317\021\340\241\261\032\341	Microsoft Office Document
+
+# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# Magic type for Dell's BIOS .hdr files
+# Dell's .hdr
+0	string $RBU
+>23	string Dell			%s system BIOS
+>48	string x			version %.3s
+

+ 6 - 0
magic/Magdir/pdf

@@ -5,3 +5,9 @@
 0	string		%PDF-		PDF document
 0	string		%PDF-		PDF document
 >5	byte		x		\b, version %c
 >5	byte		x		\b, version %c
 >7	byte		x		\b.%c
 >7	byte		x		\b.%c
+
+# From: Nick Schmalenberger <nick@schmalenberger.us>
+# Forms Data Format
+0       string          %FDF-           FDF text
+>5      byte            x               \b, version %c
+>7      byte            x               \b.%c

+ 5 - 2
magic/Magdir/sgi

@@ -15,19 +15,22 @@
 >20	lelong	0				log volume #0
 >20	lelong	0				log volume #0
 >20	lelong	>0				log volume #%ld
 >20	lelong	>0				log volume #%ld
 >24	string	>\0				host: %s
 >24	string	>\0				host: %s
-0	string	PCPFolio			PCP 
+0	string	PCPFolio			PCP
 >9	string	Version:			Archive Folio
 >9	string	Version:			Archive Folio
 >18	string	>\0				(V.%s)
 >18	string	>\0				(V.%s)
 0	string	#pmchart			PCP pmchart view
 0	string	#pmchart			PCP pmchart view
 >9	string	Version
 >9	string	Version
 >17	string	>\0				(V%-3.3s)
 >17	string	>\0				(V%-3.3s)
+0	string	#kmchart			PCP kmchart view
+>9	string	Version
+>17	string	>\0				(V.%s)
 0	string	pmview				PCP pmview config
 0	string	pmview				PCP pmview config
 >7	string	Version
 >7	string	Version
 >15	string	>\0				(V%-3.3s)
 >15	string	>\0				(V%-3.3s)
 0	string	#pmlogger			PCP pmlogger config
 0	string	#pmlogger			PCP pmlogger config
 >10	string	Version
 >10	string	Version
 >18	string	>\0				(V%1.1s)
 >18	string	>\0				(V%1.1s)
-0	string	PcPh				PCP Help 
+0	string	PcPh				PCP Help
 >4	string	1				Index
 >4	string	1				Index
 >4	string	2				Text
 >4	string	2				Text
 >5	string	>\0				(V.%1.1s)
 >5	string	>\0				(V.%1.1s)

+ 2 - 0
magic/Makefile.am

@@ -77,6 +77,7 @@ Magdir/digital \
 Magdir/dolby \
 Magdir/dolby \
 Magdir/dump \
 Magdir/dump \
 Magdir/editors \
 Magdir/editors \
+Magdir/efi \
 Magdir/elf \
 Magdir/elf \
 Magdir/encore \
 Magdir/encore \
 Magdir/epoc \
 Magdir/epoc \
@@ -85,6 +86,7 @@ Magdir/fcs \
 Magdir/filesystems \
 Magdir/filesystems \
 Magdir/flash \
 Magdir/flash \
 Magdir/fonts \
 Magdir/fonts \
+Magdir/fortran \
 Magdir/frame \
 Magdir/frame \
 Magdir/freebsd \
 Magdir/freebsd \
 Magdir/fsav \
 Magdir/fsav \

+ 54 - 47
magic/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -14,15 +14,11 @@
 
 
 @SET_MAKE@
 @SET_MAKE@
 
 
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -59,8 +55,6 @@ pkgdataDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(pkgdata_DATA)
 DATA = $(pkgdata_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AMTAR = @AMTAR@
 AR = @AR@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOCONF = @AUTOCONF@
@@ -87,14 +81,12 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 F77 = @F77@
 FFLAGS = @FFLAGS@
 FFLAGS = @FFLAGS@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
-IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
 LDFLAGS = @LDFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBS = @LIBS@
@@ -102,9 +94,8 @@ LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -118,16 +109,13 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SHELL = @SHELL@
 STRIP = @STRIP@
 STRIP = @STRIP@
 VERSION = @VERSION@
 VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_F77 = @ac_ct_F77@
 ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__quote = @am__quote@
@@ -139,7 +127,11 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_os = @build_os@
 build_vendor = @build_vendor@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 fsect = @fsect@
 fsect = @fsect@
 host = @host@
 host = @host@
@@ -147,21 +139,28 @@ host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_os = @host_os@
 host_vendor = @host_vendor@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 includedir = @includedir@
 infodir = @infodir@
 infodir = @infodir@
 install_sh = @install_sh@
 install_sh = @install_sh@
 libdir = @libdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
 pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
 EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
 EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
 CLEANFILES = magic magic.mgc magic.mime.mgc
 CLEANFILES = magic magic.mgc magic.mime.mgc
@@ -217,6 +216,7 @@ Magdir/digital \
 Magdir/dolby \
 Magdir/dolby \
 Magdir/dump \
 Magdir/dump \
 Magdir/editors \
 Magdir/editors \
+Magdir/efi \
 Magdir/elf \
 Magdir/elf \
 Magdir/encore \
 Magdir/encore \
 Magdir/epoc \
 Magdir/epoc \
@@ -225,6 +225,7 @@ Magdir/fcs \
 Magdir/filesystems \
 Magdir/filesystems \
 Magdir/flash \
 Magdir/flash \
 Magdir/fonts \
 Magdir/fonts \
+Magdir/fortran \
 Magdir/frame \
 Magdir/frame \
 Magdir/freebsd \
 Magdir/freebsd \
 Magdir/fsav \
 Magdir/fsav \
@@ -394,13 +395,9 @@ mostlyclean-libtool:
 
 
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
-
-distclean-libtool:
-	-rm -f libtool
-uninstall-info-am:
 install-pkgdataDATA: $(pkgdata_DATA)
 install-pkgdataDATA: $(pkgdata_DATA)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
+	test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
 	@list='$(pkgdata_DATA)'; for p in $$list; do \
 	@list='$(pkgdata_DATA)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  f=$(am__strip_dir) \
 	  f=$(am__strip_dir) \
@@ -423,23 +420,21 @@ CTAGS:
 
 
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/Magdir
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
 	    fi; \
@@ -455,7 +450,7 @@ check: check-am
 all-am: Makefile $(DATA)
 all-am: Makefile $(DATA)
 installdirs:
 installdirs:
 	for dir in "$(DESTDIR)$(pkgdatadir)"; do \
 	for dir in "$(DESTDIR)$(pkgdatadir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 	done
 install: install-am
 install: install-am
 install-exec: install-exec-am
 install-exec: install-exec-am
@@ -488,7 +483,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
 
 
 distclean: distclean-am
 distclean: distclean-am
 	-rm -f Makefile
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-libtool
+distclean-am: clean-am distclean-generic
 
 
 dvi: dvi-am
 dvi: dvi-am
 
 
@@ -502,12 +497,20 @@ info-am:
 
 
 install-data-am: install-pkgdataDATA
 install-data-am: install-pkgdataDATA
 
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 install-exec-am:
 
 
+install-html: install-html-am
+
 install-info: install-info-am
 install-info: install-info-am
 
 
 install-man:
 install-man:
 
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 installcheck-am:
 
 
 maintainer-clean: maintainer-clean-am
 maintainer-clean: maintainer-clean-am
@@ -526,17 +529,21 @@ ps: ps-am
 
 
 ps-am:
 ps-am:
 
 
-uninstall-am: uninstall-info-am uninstall-pkgdataDATA
+uninstall-am: uninstall-pkgdataDATA
+
+.MAKE: install-am install-strip
 
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	dvi-am html html-am info info-am install install-am \
 	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-exec install-exec-am \
-	install-info install-info-am install-man install-pkgdataDATA \
+	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-pkgdataDATA install-ps install-ps-am \
 	install-strip installcheck installcheck-am installdirs \
 	install-strip installcheck installcheck-am installdirs \
 	maintainer-clean maintainer-clean-generic mostlyclean \
 	maintainer-clean maintainer-clean-generic mostlyclean \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am uninstall-info-am uninstall-pkgdataDATA
+	uninstall uninstall-am uninstall-pkgdataDATA
 
 
 
 
 magic: Header Localstuff $(magic_FRAGMENTS)
 magic: Header Localstuff $(magic_FRAGMENTS)

+ 92 - 58
magic/magic.mime

@@ -1,5 +1,25 @@
 # Magic data for KMimeMagic (originally for file(1) command)
 # Magic data for KMimeMagic (originally for file(1) command)
 #
 #
+# Note on adding additional MIME types:
+#
+# [RFC2045,RFC2046] specifies that Content Types, Content Subtypes, Character
+# Sets, Access Types, and conversion values for MIME mail will be assigned and
+# listed by the IANA.
+# http://www.iana.org/assignments/media-types/
+#
+# Any unregistered file type should be listed with a preceding x-, as in
+# application/x-foo (RFC2045 5.1), or a x., as in application/x.foo (RFC4288
+# 4.3).  Any non x-prefixed type should be registered with IANA and listed at
+# the above address.  Any other behavior is a MIME standards violation!
+#
+# It is preferred that when a registered MIME type exists, that
+# the registered Content-Type and Subtype be used to refer to a file of
+# that type, so don't use application/x-zip when application/zip is
+# registered.
+#
+# If an active RFC suggests that a MIME registration for a new type is in
+# progress, make a note of it pointing to that RFC.
+#
 # The format is 4-5 columns:
 # The format is 4-5 columns:
 #    Column #1: byte number to begin checking from, ">" indicates continuation
 #    Column #1: byte number to begin checking from, ">" indicates continuation
 #    Column #2: type of data to match
 #    Column #2: type of data to match
@@ -101,6 +121,10 @@
 
 
 38	string		\<\!DOCTYPE\040svg	image/svg+xml
 38	string		\<\!DOCTYPE\040svg	image/svg+xml
 
 
+0	belong		0xfeedfeed	application/x-java-keystore
+
+0	belong		0xcececece	application/x-java-jce-keystore
+
 
 
 # xml
 # xml
 0	string		\<?xml			text/xml
 0	string		\<?xml			text/xml
@@ -110,7 +134,8 @@
 # Java
 # Java
 
 
 0	beshort		0xcafe
 0	beshort		0xcafe
->2	beshort		0xbabe		application/java
+>2	beshort		0xbabe		application/x-java-applet
+>2	beshort		0xd00d		application/x-java-pack200
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # audio:  file(1) magic for sound formats
 # audio:  file(1) magic for sound formats
@@ -156,15 +181,15 @@
 
 
 # Creative Labs AUDIO stuff
 # Creative Labs AUDIO stuff
 #					Standard MIDI data
 #					Standard MIDI data
-0	string	MThd			audio/unknown
+0	string	MThd			audio/x-midi
 #>9 	byte	>0			(format %d)
 #>9 	byte	>0			(format %d)
 #>11	byte	>1			using %d channels
 #>11	byte	>1			using %d channels
 #					Creative Music (CMF) data
 #					Creative Music (CMF) data
-0	string	CTMF			audio/unknown
+0	string	CTMF			audio/x-unknown
 #					SoundBlaster instrument data
 #					SoundBlaster instrument data
-0	string	SBI			audio/unknown
+0	string	SBI			audio/x-unknown
 #					Creative Labs voice data
 #					Creative Labs voice data
-0	string	Creative\ Voice\ File	audio/unknown
+0	string	Creative\ Voice\ File	audio/x-unknown
 ## is this next line right?  it came this way...
 ## is this next line right?  it came this way...
 #>19	byte	0x1A
 #>19	byte	0x1A
 #>23	byte	>0			- version %d
 #>23	byte	>0			- version %d
@@ -210,7 +235,7 @@
 
 
 # XPM icons (Greg Roelofs, newt@uchicago.edu)
 # XPM icons (Greg Roelofs, newt@uchicago.edu)
 # ideally should go into "images", but entries below would tag XPM as C source
 # ideally should go into "images", but entries below would tag XPM as C source
-0	string		/*\ XPM		image/x-xpmi 7bit
+0	string		/*\ XPM		image/x-xpmi
 
 
 # 3DS (3d Studio files) Conflicts with diff output 0x3d '='
 # 3DS (3d Studio files) Conflicts with diff output 0x3d '='
 #16	beshort		0x3d3d		image/x-3ds
 #16	beshort		0x3d3d		image/x-3ds
@@ -273,7 +298,8 @@
 0       string          #!/usr/bin/awk          application/x-awk
 0       string          #!/usr/bin/awk          application/x-awk
 0       string          #!\ /usr/bin/awk        application/x-awk
 0       string          #!\ /usr/bin/awk        application/x-awk
 # update to distinguish from *.vcf files by Joerg Jenderek: joerg dot jenderek at web dot de
 # update to distinguish from *.vcf files by Joerg Jenderek: joerg dot jenderek at web dot de
-0	regex		BEGIN[[:space:]]*[{]	application/x-awk
+# Too general, \EBEGIN matches in postscript
+#0	regex		BEGIN[[:space:]]*[{]	application/x-awk
 
 
 # For Larry Wall's perl language.  The ``eval'' line recognizes an
 # For Larry Wall's perl language.  The ``eval'' line recognizes an
 # outrageously clever hack for USG systems.
 # outrageously clever hack for USG systems.
@@ -303,7 +329,7 @@
 # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
 # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
 0       string          \037\213        application/x-gzip
 0       string          \037\213        application/x-gzip
 
 
-0		string			PK\003\004		application/x-zip
+0		string			PK\003\004		application/zip
 
 
 # RAR archiver (Greg Roelofs, newt@uchicago.edu)
 # RAR archiver (Greg Roelofs, newt@uchicago.edu)
 0	string		Rar!		application/x-rar
 0	string		Rar!		application/x-rar
@@ -389,13 +415,16 @@
 # This stuff came on a FrameMaker demo tape, most of which is
 # This stuff came on a FrameMaker demo tape, most of which is
 # copyright, but this file is "published" as witness the following:
 # copyright, but this file is "published" as witness the following:
 #
 #
-0	string		\<MakerFile	application/x-frame
-0	string		\<MIFFile	application/x-frame
-0	string		\<MakerDictionary	application/x-frame
-0	string		\<MakerScreenFon	application/x-frame
-0	string		\<MML		application/x-frame
-0	string		\<Book		application/x-frame
-0	string		\<Maker		application/x-frame
+# Note that this is the Framemaker Maker Interchange Format, not the
+# Normal format which would be application/vnd.framemaker.
+#
+0	string		\<MakerFile	application/x-mif
+0	string		\<MIFFile	application/x-mif
+0	string		\<MakerDictionary	application/x-mif
+0	string		\<MakerScreenFon	application/x-mif
+0	string		\<MML		application/x-mif
+0	string		\<Book		application/x-mif
+0	string		\<Maker		application/x-mif
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # html:  file(1) magic for HTML (HyperText Markup Language) docs
 # html:  file(1) magic for HTML (HyperText Markup Language) docs
@@ -429,11 +458,11 @@
 
 
 # PBMPLUS
 # PBMPLUS
 #					PBM file
 #					PBM file
-0	string		P1		image/x-portable-bitmap	7bit
+0	string		P1		image/x-portable-bitmap
 #					PGM file
 #					PGM file
-0	string		P2		image/x-portable-greymap	7bit
+0	string		P2		image/x-portable-greymap
 #					PPM file
 #					PPM file
-0	string		P3		image/x-portable-pixmap	7bit
+0	string		P3		image/x-portable-pixmap
 #					PBM "rawbits" file
 #					PBM "rawbits" file
 0	string		P4		image/x-portable-bitmap
 0	string		P4		image/x-portable-bitmap
 #					PGM "rawbits" file
 #					PGM "rawbits" file
@@ -456,16 +485,16 @@
 #
 #
 # GRR 950115:  this was mine ("Zip GIF"):
 # GRR 950115:  this was mine ("Zip GIF"):
 #					ZIF image (GIF+deflate alpha)
 #					ZIF image (GIF+deflate alpha)
-0	string		GIF94z		image/unknown
+0	string		GIF94z		image/x-unknown
 #
 #
 # GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
 # GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
 #					FGF image (GIF+deflate beta)
 #					FGF image (GIF+deflate beta)
-0	string		FGF95a		image/unknown
+0	string		FGF95a		image/x-unknown
 #
 #
 # GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
 # GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
 # (best; not yet implemented):
 # (best; not yet implemented):
 #					PBF image (deflate compression)
 #					PBF image (deflate compression)
-0	string		PBF		image/unknown
+0	string		PBF		image/x-unknown
 
 
 # GIF
 # GIF
 0	string		GIF		image/gif
 0	string		GIF		image/gif
@@ -485,7 +514,7 @@
 #0	string		BA		bitmap array
 #0	string		BA		bitmap array
 
 
 # CDROM Filesystems
 # CDROM Filesystems
-32769    string    CD001     application/x-iso9660
+32769    string    CD001     application/x-iso9660-image
 
 
 # Newer StuffIt archives (grant@netbsd.org)
 # Newer StuffIt archives (grant@netbsd.org)
 0	string		StuffIt			application/x-stuffit
 0	string		StuffIt			application/x-stuffit
@@ -501,7 +530,7 @@
 # lisp:  file(1) magic for lisp programs
 # lisp:  file(1) magic for lisp programs
 #
 #
 # various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
 # various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
-0	string	;;			text/plain	8bit
+0	string	;;			text/plain
 # Emacs 18 - this is always correct, but not very magical.
 # Emacs 18 - this is always correct, but not very magical.
 0	string	\012(			application/x-elc
 0	string	\012(			application/x-elc
 # Emacs 19
 # Emacs 19
@@ -511,17 +540,17 @@
 # mail.news:  file(1) magic for mail and news
 # mail.news:  file(1) magic for mail and news
 #
 #
 # There are tests to ascmagic.c to cope with mail and news.
 # There are tests to ascmagic.c to cope with mail and news.
-0	string		Relay-Version: 	message/rfc822	7bit
-0	string		#!\ rnews	message/rfc822	7bit
-0	string		N#!\ rnews	message/rfc822	7bit
-0	string		Forward\ to 	message/rfc822	7bit
-0	string		Pipe\ to 	message/rfc822	7bit
-0	string		Return-Path:	message/rfc822	7bit
+0	string		Relay-Version: 	message/rfc822
+0	string		#!\ rnews	message/rfc822
+0	string		N#!\ rnews	message/rfc822
+0	string		Forward\ to 	message/rfc822
+0	string		Pipe\ to 	message/rfc822
+0	string		Return-Path:	message/rfc822
 0	string		Received:	message/rfc822
 0	string		Received:	message/rfc822
-0	string		Path:		message/news	8bit
-0	string		Xref:		message/news	8bit
-0	string		From:		message/rfc822	7bit
-0	string		Article 	message/news	8bit
+0	string		Path:		message/news
+0	string		Xref:		message/news
+0	string		From:		message/rfc822
+0	string		Article 	message/news
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # msword: file(1) magic for MS Word files
 # msword: file(1) magic for MS Word files
 #
 #
@@ -618,13 +647,13 @@
 >4      byte&0x1F	   0x07           video/h264
 >4      byte&0x1F	   0x07           video/h264
 
 
 # FLI animation format
 # FLI animation format
-0	leshort		0xAF11				video/fli
+0	leshort		0xAF11				video/x-fli
 # FLC animation format
 # FLC animation format
-0	leshort		0xAF12				video/flc
+0	leshort		0xAF12				video/x-flc
 #
 #
 # SGI and Apple formats
 # SGI and Apple formats
 # Added ISO mimes
 # Added ISO mimes
-0	string		MOVI	      video/sgi
+0	string		MOVI	      video/x-sgi-movie
 4	string		moov	      video/quicktime
 4	string		moov	      video/quicktime
 4	string		mdat	      video/quicktime
 4	string		mdat	      video/quicktime
 4	string		wide	      video/quicktime
 4	string		wide	      video/quicktime
@@ -632,7 +661,7 @@
 4	string		free	      video/quicktime
 4	string		free	      video/quicktime
 4	string		idsc	      image/x-quicktime
 4	string		idsc	      image/x-quicktime
 4	string		idat	      image/x-quicktime
 4	string		idat	      image/x-quicktime
-4	string		pckg	      application/x-quicktime
+4	string		pckg	      application/x-quicktime-player
 4	string/B	jP	      image/jp2
 4	string/B	jP	      image/jp2
 4	string		ftyp
 4	string		ftyp
 >8	string		isom	      video/mp4
 >8	string		isom	      video/mp4
@@ -654,8 +683,8 @@
 # 255 (hex FF)! DL format SUCKS BIG ROCKS.
 # 255 (hex FF)! DL format SUCKS BIG ROCKS.
 #
 #
 #						DL file version 1 , medium format (160x100, 4 images/screen)
 #						DL file version 1 , medium format (160x100, 4 images/screen)
-0	byte		1			video/unknown
-0	byte		2			video/unknown
+0	byte		1			video/x-unknown
+0	byte		2			video/x-unknown
 #
 #
 # Databases
 # Databases
 #
 #
@@ -689,7 +718,7 @@
 0		string	[KDE\ Desktop\ Entry]	application/x-kdelnk
 0		string	[KDE\ Desktop\ Entry]	application/x-kdelnk
 0		string	#\ KDE\ Config\ File	application/x-kdelnk
 0		string	#\ KDE\ Config\ File	application/x-kdelnk
 # xmcd database file for kscd
 # xmcd database file for kscd
-0		string	#\ xmcd                text/xmcd
+0		string	#\ xmcd                text/x-xmcd
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # pkgadd:  file(1) magic for SysV R4 PKG Datastreams
 # pkgadd:  file(1) magic for SysV R4 PKG Datastreams
@@ -710,7 +739,7 @@
 0	string		\211HDF\r\n\032	Hierarchical Data Format (version 5) data
 0	string		\211HDF\r\n\032	Hierarchical Data Format (version 5) data
 
 
 # Adobe Photoshop
 # Adobe Photoshop
-0	string		8BPS			image/x-photoshop
+0	string		8BPS			image/vnd.adobe.photoshop
 
 
 # Felix von Leitner <felix-file@fefe.de>
 # Felix von Leitner <felix-file@fefe.de>
 0	string		d8:announce		application/x-bittorrent
 0	string		d8:announce		application/x-bittorrent
@@ -721,7 +750,7 @@
 0	belong	0x00000200 	application/x-123
 0	belong	0x00000200 	application/x-123
 
 
 # MS Access database
 # MS Access database
-4	string	Standard\ Jet\ DB	application/msaccess
+4	string	Standard\ Jet\ DB	application/x-msaccess
 
 
 ## magic for XBase files
 ## magic for XBase files
 #0      byte       0x02
 #0      byte       0x02
@@ -777,10 +806,10 @@
 # Debian has entries for the old PGP formats:
 # Debian has entries for the old PGP formats:
 # pgp:  file(1) magic for Pretty Good Privacy
 # pgp:  file(1) magic for Pretty Good Privacy
 # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
 # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
-0       beshort         0x9900                  text/PGP key public ring
-0       beshort         0x9501                  text/PGP key security ring
-0       beshort         0x9500                  text/PGP key security ring
-0       beshort         0xa600                  text/PGP encrypted data
+0       beshort         0x9900                  application/x-pgp-keyring
+0       beshort         0x9501                  application/x-pgp-keyring
+0       beshort         0x9500                  application/x-pgp-keyring
+0       beshort         0xa600                  application/pgp-encrypted
 0       string          -----BEGIN\040PGP       text/PGP armored data
 0       string          -----BEGIN\040PGP       text/PGP armored data
 >15     string          PUBLIC\040KEY\040BLOCK- public key block
 >15     string          PUBLIC\040KEY\040BLOCK- public key block
 >15     string          MESSAGE-                message
 >15     string          MESSAGE-                message
@@ -790,7 +819,7 @@
 #
 #
 # GnuPG Magic:
 # GnuPG Magic:
 #
 #
-0       beshort         0x9901                  text/GnuPG key public ring
+0       beshort         0x9901                  application/x-gnupg-keyring
 0       beshort         0x8501                  text/OpenPGP data
 0       beshort         0x8501                  text/OpenPGP data
 
 
 # flash:        file(1) magic for Macromedia Flash file format
 # flash:        file(1) magic for Macromedia Flash file format
@@ -801,6 +830,9 @@
 #
 #
 0	string		FWS
 0	string		FWS
 >3	byte		x			application/x-shockwave-flash
 >3	byte		x			application/x-shockwave-flash
+# Flash Video
+0	string		FLV			video/x-flv
+
 
 
 # The following paramaters are created for Namazu.
 # The following paramaters are created for Namazu.
 # <http://www.namazu.org/>
 # <http://www.namazu.org/>
@@ -822,14 +854,14 @@
 #
 #
 
 
 0	string		DOC
 0	string		DOC
->43	byte		0x14		application/ichitaro4
->144	string	JDASH		application/ichitaro4
+>43	byte		0x14		application/x-ichitaro4
+>144	string	JDASH		application/x-ichitaro4
 
 
 0	string		DOC
 0	string		DOC
->43	byte		0x15		application/ichitaro5
+>43	byte		0x15		application/x-ichitaro5
 
 
 0	string		DOC
 0	string		DOC
->43	byte		0x16		application/ichitaro6
+>43	byte		0x16		application/x-ichitaro6
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 # office97: file(1) magic for MicroSoft Office files
 # office97: file(1) magic for MicroSoft Office files
@@ -841,8 +873,8 @@
 #0       string          \320\317\021\340\241\261\032\341
 #0       string          \320\317\021\340\241\261\032\341
 #>48     byte            0x1B            application/excel
 #>48     byte            0x1B            application/excel
 
 
-2080	string	Microsoft\ Excel\ 5.0\ Worksheet	application/excel
-2114	string	Biff5					application/excel
+2080	string	Microsoft\ Excel\ 5.0\ Worksheet	application/vnd.ms-excel
+2114	string	Biff5					application/vnd.ms-excel
 
 
 0       string	\224\246\056		application/msword
 0       string	\224\246\056		application/msword
 
 
@@ -883,10 +915,10 @@
 >24		string	@		application/octet-stream
 >24		string	@		application/octet-stream
 
 
 0		string	MZ
 0		string	MZ
->30		string	Copyright\ 1989-1990\ PKWARE\ Inc.	application/x-zip
+>30		string	Copyright\ 1989-1990\ PKWARE\ Inc.	application/zip
 
 
 0		string	MZ
 0		string	MZ
->30		string	PKLITE\ Copr.	application/x-zip
+>30		string	PKLITE\ Copr.	application/zip
 
 
 0		string	MZ
 0		string	MZ
 >36		string	LHa's\ SFX	application/x-lha
 >36		string	LHa's\ SFX	application/x-lha
@@ -910,11 +942,11 @@
 0		lelong&0x8080ffff	0x0000061a	application/x-arc
 0		lelong&0x8080ffff	0x0000061a	application/x-arc
 
 
 # Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
 # Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
-0		lelong	0x223e9f78	application/ms-tnef
+0		lelong	0x223e9f78	application/vnd.ms-tnef
 
 
 # From: stephane.loeuillet@tiscali.f
 # From: stephane.loeuillet@tiscali.f
 # http://www.djvuzone.org/
 # http://www.djvuzone.org/
-0	string		AT&TFORM	image/x.djvu
+0	string		AT&TFORM	image/vnd.djvu
 
 
 # Danny Milosavljevic <danny.milo@gmx.net>
 # Danny Milosavljevic <danny.milo@gmx.net>
 # this are adrift (adventure game standard) game files, extension .taf
 # this are adrift (adventure game standard) game files, extension .taf
@@ -947,7 +979,7 @@
 0	string/c	BEGIN:VCARD	text/x-vcard
 0	string/c	BEGIN:VCARD	text/x-vcard
 0	string		WordPro\0	application/vnd.lotus-wordpro
 0	string		WordPro\0	application/vnd.lotus-wordpro
 0	string		WordPro\r\373	application/vnd.lotus-wordpro
 0	string		WordPro\r\373	application/vnd.lotus-wordpro
-0	string		CPC\262		image/cpi
+0	string		CPC\262		image/x-cpi
 
 
 # 
 # 
 128	string		DICM		application/dicom
 128	string		DICM		application/dicom
@@ -955,3 +987,5 @@
 # Symbian installation files
 # Symbian installation files
 8	lelong	0x10000419	application/vnd.symbian.install
 8	lelong	0x10000419	application/vnd.symbian.install
 0	lelong	0x10201A7A	x-epoc/x-sisx-app
 0	lelong	0x10201A7A	x-epoc/x-sisx-app
+# FORTRAN source
+0	string/c	c\ 		text/x-fortran

+ 34 - 27
missing

@@ -1,9 +1,9 @@
 #! /bin/sh
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 # Common stub for a few missing GNU programs while installing.
 
 
-scriptversion=2005-06-08.21
+scriptversion=2006-05-10.23
 
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
 #   Free Software Foundation, Inc.
 #   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 
@@ -33,6 +33,8 @@ if test $# -eq 0; then
 fi
 fi
 
 
 run=:
 run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
 
 
 # In the cases where this matters, `missing' is being run in the
 # In the cases where this matters, `missing' is being run in the
 # srcdir already.
 # srcdir already.
@@ -44,7 +46,7 @@ fi
 
 
 msg="missing on your system"
 msg="missing on your system"
 
 
-case "$1" in
+case $1 in
 --run)
 --run)
   # Try to run requested program, and just exit if it succeeds.
   # Try to run requested program, and just exit if it succeeds.
   run=
   run=
@@ -77,6 +79,7 @@ Supported PROGRAM values:
   aclocal      touch file \`aclocal.m4'
   aclocal      touch file \`aclocal.m4'
   autoconf     touch file \`configure'
   autoconf     touch file \`configure'
   autoheader   touch file \`config.h.in'
   autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
   automake     touch all \`Makefile.in' files
   automake     touch all \`Makefile.in' files
   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
   flex         create \`lex.yy.c', if possible, from existing .c
   flex         create \`lex.yy.c', if possible, from existing .c
@@ -106,7 +109,7 @@ esac
 # Now exit if we have it, but it failed.  Also exit now if we
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
 # don't have it and --version was passed (most likely to detect
 # the program).
 # the program).
-case "$1" in
+case $1 in
   lex|yacc)
   lex|yacc)
     # Not GNU programs, they don't have --version.
     # Not GNU programs, they don't have --version.
     ;;
     ;;
@@ -135,7 +138,7 @@ esac
 
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
 # try to emulate it.
-case "$1" in
+case $1 in
   aclocal*)
   aclocal*)
     echo 1>&2 "\
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
 WARNING: \`$1' is $msg.  You should only need it if
@@ -164,7 +167,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     test -z "$files" && files="config.h"
     test -z "$files" && files="config.h"
     touch_files=
     touch_files=
     for f in $files; do
     for f in $files; do
-      case "$f" in
+      case $f in
       *:*) touch_files="$touch_files "`echo "$f" |
       *:*) touch_files="$touch_files "`echo "$f" |
 				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
 				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
       *) touch_files="$touch_files $f.in";;
       *) touch_files="$touch_files $f.in";;
@@ -192,8 +195,8 @@ WARNING: \`$1' is needed, but is $msg.
          You can get \`$1' as part of \`Autoconf' from any GNU
          You can get \`$1' as part of \`Autoconf' from any GNU
          archive site."
          archive site."
 
 
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -f "$file"; then
     if test -f "$file"; then
 	touch $file
 	touch $file
     else
     else
@@ -214,25 +217,25 @@ WARNING: \`$1' $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          in order for those modifications to take effect.  You can get
          \`Bison' from any GNU archive site."
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.y)
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.c
 	         cp "$SRCFILE" y.tab.c
 	    fi
 	    fi
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" y.tab.h
 	         cp "$SRCFILE" y.tab.h
 	    fi
 	    fi
 	  ;;
 	  ;;
 	esac
 	esac
     fi
     fi
-    if [ ! -f y.tab.h ]; then
+    if test ! -f y.tab.h; then
 	echo >y.tab.h
 	echo >y.tab.h
     fi
     fi
-    if [ ! -f y.tab.c ]; then
+    if test ! -f y.tab.c; then
 	echo 'main() { return 0; }' >y.tab.c
 	echo 'main() { return 0; }' >y.tab.c
     fi
     fi
     ;;
     ;;
@@ -244,18 +247,18 @@ WARNING: \`$1' is $msg.  You should only need it if
          in order for those modifications to take effect.  You can get
          in order for those modifications to take effect.  You can get
          \`Flex' from any GNU archive site."
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
+    if test $# -ne 1; then
         eval LASTARG="\${$#}"
         eval LASTARG="\${$#}"
-	case "$LASTARG" in
+	case $LASTARG in
 	*.l)
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if [ -f "$SRCFILE" ]; then
+	    if test -f "$SRCFILE"; then
 	         cp "$SRCFILE" lex.yy.c
 	         cp "$SRCFILE" lex.yy.c
 	    fi
 	    fi
 	  ;;
 	  ;;
 	esac
 	esac
     fi
     fi
-    if [ ! -f lex.yy.c ]; then
+    if test ! -f lex.yy.c; then
 	echo 'main() { return 0; }' >lex.yy.c
 	echo 'main() { return 0; }' >lex.yy.c
     fi
     fi
     ;;
     ;;
@@ -267,11 +270,9 @@ WARNING: \`$1' is $msg.  You should only need it if
 	 \`Help2man' package in order for those modifications to take
 	 \`Help2man' package in order for those modifications to take
 	 effect.  You can get \`Help2man' from any GNU archive site."
 	 effect.  You can get \`Help2man' from any GNU archive site."
 
 
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
 	touch $file
 	touch $file
     else
     else
 	test -z "$file" || exec >$file
 	test -z "$file" || exec >$file
@@ -289,11 +290,17 @@ WARNING: \`$1' is $msg.  You should only need it if
          DU, IRIX).  You might want to install the \`Texinfo' package or
          DU, IRIX).  You might want to install the \`Texinfo' package or
          the \`GNU make' package.  Grab either from any GNU archive site."
          the \`GNU make' package.  Grab either from any GNU archive site."
     # The file to touch is that specified with -o ...
     # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     if test -z "$file"; then
     if test -z "$file"; then
       # ... or it is the one specified with @setfilename ...
       # ... or it is the one specified with @setfilename ...
       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
       # ... or it is derived from the source name (dir/f.texi becomes f.info)
       # ... or it is derived from the source name (dir/f.texi becomes f.info)
       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
     fi
@@ -317,13 +324,13 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     fi
     firstarg="$1"
     firstarg="$1"
     if shift; then
     if shift; then
-	case "$firstarg" in
+	case $firstarg in
 	*o*)
 	*o*)
 	    firstarg=`echo "$firstarg" | sed s/o//`
 	    firstarg=`echo "$firstarg" | sed s/o//`
 	    tar "$firstarg" "$@" && exit 0
 	    tar "$firstarg" "$@" && exit 0
 	    ;;
 	    ;;
 	esac
 	esac
-	case "$firstarg" in
+	case $firstarg in
 	*h*)
 	*h*)
 	    firstarg=`echo "$firstarg" | sed s/h//`
 	    firstarg=`echo "$firstarg" | sed s/h//`
 	    tar "$firstarg" "$@" && exit 0
 	    tar "$firstarg" "$@" && exit 0

+ 4 - 1
mkinstalldirs

@@ -1,7 +1,7 @@
 #! /bin/sh
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
 # mkinstalldirs --- make directory hierarchy
 
 
-scriptversion=2005-06-29.22
+scriptversion=2006-05-11.19
 
 
 # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
 # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
 # Created: 1993-05-16
 # Created: 1993-05-16
@@ -11,6 +11,9 @@ scriptversion=2005-06-29.22
 # bugs to <bug-automake@gnu.org> or send patches to
 # bugs to <bug-automake@gnu.org> or send patches to
 # <automake-patches@gnu.org>.
 # <automake-patches@gnu.org>.
 
 
+nl='
+'
+IFS=" ""	$nl"
 errstatus=0
 errstatus=0
 dirmode=
 dirmode=
 
 

+ 50 - 45
python/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -13,15 +13,11 @@
 # PARTICULAR PURPOSE.
 # PARTICULAR PURPOSE.
 
 
 @SET_MAKE@
 @SET_MAKE@
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -49,8 +45,6 @@ SOURCES =
 DIST_SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AMTAR = @AMTAR@
 AR = @AR@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOCONF = @AUTOCONF@
@@ -77,14 +71,12 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 F77 = @F77@
 FFLAGS = @FFLAGS@
 FFLAGS = @FFLAGS@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
-IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
 LDFLAGS = @LDFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBS = @LIBS@
@@ -92,9 +84,8 @@ LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -108,16 +99,13 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SHELL = @SHELL@
 STRIP = @STRIP@
 STRIP = @STRIP@
 VERSION = @VERSION@
 VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_F77 = @ac_ct_F77@
 ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__quote = @am__quote@
@@ -129,7 +117,11 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_os = @build_os@
 build_vendor = @build_vendor@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 fsect = @fsect@
 fsect = @fsect@
 host = @host@
 host = @host@
@@ -137,21 +129,28 @@ host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_os = @host_os@
 host_vendor = @host_vendor@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 includedir = @includedir@
 infodir = @infodir@
 infodir = @infodir@
 install_sh = @install_sh@
 install_sh = @install_sh@
 libdir = @libdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 EXTRA_DIST = README example.py py_magic.c py_magic.h setup.py
 EXTRA_DIST = README example.py py_magic.c py_magic.h setup.py
 all: all-am
 all: all-am
 
 
@@ -191,10 +190,6 @@ mostlyclean-libtool:
 
 
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
-
-distclean-libtool:
-	-rm -f libtool
-uninstall-info-am:
 tags: TAGS
 tags: TAGS
 TAGS:
 TAGS:
 
 
@@ -203,22 +198,21 @@ CTAGS:
 
 
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
 	    fi; \
@@ -263,7 +257,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
 
 
 distclean: distclean-am
 distclean: distclean-am
 	-rm -f Makefile
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-libtool
+distclean-am: clean-am distclean-generic
 
 
 dvi: dvi-am
 dvi: dvi-am
 
 
@@ -277,12 +271,20 @@ info-am:
 
 
 install-data-am:
 install-data-am:
 
 
+install-dvi: install-dvi-am
+
 install-exec-am:
 install-exec-am:
 
 
+install-html: install-html-am
+
 install-info: install-info-am
 install-info: install-info-am
 
 
 install-man:
 install-man:
 
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 installcheck-am:
 
 
 maintainer-clean: maintainer-clean-am
 maintainer-clean: maintainer-clean-am
@@ -301,17 +303,20 @@ ps: ps-am
 
 
 ps-am:
 ps-am:
 
 
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
 
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	dvi-am html html-am info info-am install install-am \
 	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-exec install-exec-am \
-	install-info install-info-am install-man install-strip \
+	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 maintainer-clean \
 	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-info-am
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # 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.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 2 - 1
src/Makefile.am

@@ -9,7 +9,8 @@ AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
 
 
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	compress.c is_tar.c readelf.c print.c fsmagic.c \
 	compress.c is_tar.c readelf.c print.c fsmagic.c \
-	funcs.c file.h names.h patchlevel.h readelf.h tar.h apptype.c
+	funcs.c file.h names.h patchlevel.h readelf.h tar.h apptype.c \
+	file_opts.h
 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
 
 
 file_SOURCES = file.c
 file_SOURCES = file.c

+ 75 - 65
src/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # with or without modifications, as long as this notice is preserved.
@@ -16,15 +16,11 @@
 
 
 
 
 
 
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -65,22 +61,26 @@ am_libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo \
 	ascmagic.lo compress.lo is_tar.lo readelf.lo print.lo \
 	ascmagic.lo compress.lo is_tar.lo readelf.lo print.lo \
 	fsmagic.lo funcs.lo apptype.lo
 	fsmagic.lo funcs.lo apptype.lo
 libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
 libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
+libmagic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libmagic_la_LDFLAGS) $(LDFLAGS) -o $@
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 PROGRAMS = $(bin_PROGRAMS)
 am_file_OBJECTS = file.$(OBJEXT)
 am_file_OBJECTS = file.$(OBJEXT)
 file_OBJECTS = $(am_file_OBJECTS)
 file_OBJECTS = $(am_file_OBJECTS)
 file_DEPENDENCIES = libmagic.la
 file_DEPENDENCIES = libmagic.la
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
 SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
 DIST_SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
 DIST_SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
 includeHEADERS_INSTALL = $(INSTALL_HEADER)
 includeHEADERS_INSTALL = $(INSTALL_HEADER)
@@ -89,8 +89,6 @@ ETAGS = etags
 CTAGS = ctags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AMTAR = @AMTAR@
 AR = @AR@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOCONF = @AUTOCONF@
@@ -117,14 +115,12 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 F77 = @F77@
 FFLAGS = @FFLAGS@
 FFLAGS = @FFLAGS@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
+GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
-IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
 LDFLAGS = @LDFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBS = @LIBS@
@@ -132,9 +128,8 @@ LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 OBJEXT = @OBJEXT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -148,16 +143,13 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SHELL = @SHELL@
 STRIP = @STRIP@
 STRIP = @STRIP@
 VERSION = @VERSION@
 VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_F77 = @ac_ct_F77@
 ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
 am__include = @am__include@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__quote = @am__quote@
@@ -169,7 +161,11 @@ build_alias = @build_alias@
 build_cpu = @build_cpu@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_os = @build_os@
 build_vendor = @build_vendor@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 fsect = @fsect@
 fsect = @fsect@
 host = @host@
 host = @host@
@@ -177,21 +173,28 @@ host_alias = @host_alias@
 host_cpu = @host_cpu@
 host_cpu = @host_cpu@
 host_os = @host_os@
 host_os = @host_os@
 host_vendor = @host_vendor@
 host_vendor = @host_vendor@
+htmldir = @htmldir@
 includedir = @includedir@
 includedir = @includedir@
 infodir = @infodir@
 infodir = @infodir@
 install_sh = @install_sh@
 install_sh = @install_sh@
 libdir = @libdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
 prefix = @prefix@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 program_transform_name = @program_transform_name@
+psdir = @psdir@
 sbindir = @sbindir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 MAGIC = $(pkgdatadir)/magic
 MAGIC = $(pkgdatadir)/magic
 lib_LTLIBRARIES = libmagic.la
 lib_LTLIBRARIES = libmagic.la
 include_HEADERS = magic.h
 include_HEADERS = magic.h
@@ -199,7 +202,8 @@ EXTRA_DIST = test.c
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	compress.c is_tar.c readelf.c print.c fsmagic.c \
 	compress.c is_tar.c readelf.c print.c fsmagic.c \
-	funcs.c file.h names.h patchlevel.h readelf.h tar.h apptype.c
+	funcs.c file.h names.h patchlevel.h readelf.h tar.h apptype.c \
+	file_opts.h
 
 
 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
 file_SOURCES = file.c
 file_SOURCES = file.c
@@ -239,7 +243,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
 	  if test -f $$p; then \
 	    f=$(am__strip_dir) \
 	    f=$(am__strip_dir) \
@@ -250,7 +254,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 
 
 uninstall-libLTLIBRARIES:
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
 	@$(NORMAL_UNINSTALL)
-	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  p=$(am__strip_dir) \
 	  p=$(am__strip_dir) \
 	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
 	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
 	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
 	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
@@ -265,10 +269,10 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	  rm -f "$${dir}/so_locations"; \
 	done
 	done
 libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) 
 libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) 
-	$(LINK) -rpath $(libdir) $(libmagic_la_LDFLAGS) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
+	$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
 install-binPROGRAMS: $(bin_PROGRAMS)
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
 	  if test -f $$p \
 	  if test -f $$p \
@@ -296,7 +300,7 @@ clean-binPROGRAMS:
 	done
 	done
 file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) 
 file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) 
 	@rm -f file$(EXEEXT)
 	@rm -f file$(EXEEXT)
-	$(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD) $(LIBS)
+	$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
 
 
 mostlyclean-compile:
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
 	-rm -f *.$(OBJEXT)
@@ -318,22 +322,22 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
 
 
 .c.o:
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 
 .c.obj:
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 
 
 .c.lo:
 .c.lo:
-@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
@@ -343,13 +347,9 @@ mostlyclean-libtool:
 
 
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
-
-distclean-libtool:
-	-rm -f libtool
-uninstall-info-am:
 install-includeHEADERS: $(include_HEADERS)
 install-includeHEADERS: $(include_HEADERS)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
-	test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
 	@list='$(include_HEADERS)'; for p in $$list; do \
 	@list='$(include_HEADERS)'; for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  f=$(am__strip_dir) \
 	  f=$(am__strip_dir) \
@@ -414,22 +414,21 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
 	    fi; \
@@ -447,7 +446,7 @@ install-binPROGRAMS: install-libLTLIBRARIES
 
 
 installdirs:
 installdirs:
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 	done
 install: install-am
 install: install-am
 install-exec: install-exec-am
 install-exec: install-exec-am
@@ -482,7 +481,7 @@ distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
 	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-libtool distclean-tags
+	distclean-tags
 
 
 dvi: dvi-am
 dvi: dvi-am
 
 
@@ -496,12 +495,20 @@ info-am:
 
 
 install-data-am: install-includeHEADERS
 install-data-am: install-includeHEADERS
 
 
+install-dvi: install-dvi-am
+
 install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
 install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
 
 
+install-html: install-html-am
+
 install-info: install-info-am
 install-info: install-info-am
 
 
 install-man:
 install-man:
 
 
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
 installcheck-am:
 installcheck-am:
 
 
 maintainer-clean: maintainer-clean-am
 maintainer-clean: maintainer-clean-am
@@ -523,22 +530,25 @@ ps: ps-am
 ps-am:
 ps-am:
 
 
 uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
 uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
-	uninstall-info-am uninstall-libLTLIBRARIES
+	uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
 
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
 	clean-generic clean-libLTLIBRARIES clean-libtool ctags \
 	clean-generic clean-libLTLIBRARIES clean-libtool ctags \
 	distclean distclean-compile distclean-generic \
 	distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-binPROGRAMS \
 	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-exec install-exec-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
 	install-includeHEADERS install-info install-info-am \
 	install-includeHEADERS install-info install-info-am \
-	install-libLTLIBRARIES install-man install-strip installcheck \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs maintainer-clean \
 	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-binPROGRAMS \
 	tags uninstall uninstall-am uninstall-binPROGRAMS \
-	uninstall-includeHEADERS uninstall-info-am \
-	uninstall-libLTLIBRARIES
+	uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # 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.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 85 - 6
src/apprentice.c

@@ -31,6 +31,7 @@
 
 
 #include "file.h"
 #include "file.h"
 #include "magic.h"
 #include "magic.h"
+#include "patchlevel.h"
 #include <stdlib.h>
 #include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #include <unistd.h>
@@ -46,7 +47,7 @@
 #endif
 #endif
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.105 2007/05/16 20:51:40 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.109 2007/12/27 20:52:36 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #define	EATAB {while (isascii((unsigned char) *l) && \
 #define	EATAB {while (isascii((unsigned char) *l) && \
@@ -110,6 +111,7 @@ private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
     const char *);
     const char *);
 private int check_format_type(const char *, int);
 private int check_format_type(const char *, int);
 private int check_format(struct magic_set *, struct magic *);
 private int check_format(struct magic_set *, struct magic *);
+private int get_op(char);
 
 
 private size_t maxmagic = 0;
 private size_t maxmagic = 0;
 private size_t magicsize = sizeof(struct magic);
 private size_t magicsize = sizeof(struct magic);
@@ -188,6 +190,12 @@ static const struct type_tbl_s {
 	{ XX("qldate"),		FILE_QLDATE,		FILE_FMT_STR },
 	{ XX("qldate"),		FILE_QLDATE,		FILE_FMT_STR },
 	{ XX("leqldate"),	FILE_LEQLDATE,		FILE_FMT_STR },
 	{ XX("leqldate"),	FILE_LEQLDATE,		FILE_FMT_STR },
 	{ XX("beqldate"),	FILE_BEQLDATE,		FILE_FMT_STR },
 	{ XX("beqldate"),	FILE_BEQLDATE,		FILE_FMT_STR },
+	{ XX("float"),		FILE_FLOAT,		FILE_FMT_FLOAT },
+	{ XX("befloat"),	FILE_BEFLOAT,		FILE_FMT_FLOAT },
+	{ XX("lefloat"),	FILE_LEFLOAT,		FILE_FMT_FLOAT },
+	{ XX("double"),		FILE_DOUBLE,		FILE_FMT_DOUBLE },
+	{ XX("bedouble"),	FILE_BEDOUBLE,		FILE_FMT_DOUBLE },
+	{ XX("ledouble"),	FILE_LEDOUBLE,		FILE_FMT_DOUBLE },
 	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
 	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
 # undef XX
 # undef XX
 # undef XX_NULL
 # undef XX_NULL
@@ -261,7 +269,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
 		rv = apprentice_file(ms, &magic, &nmagic, fn, action);
 		rv = apprentice_file(ms, &magic, &nmagic, fn, action);
 		if (rv != 0)
 		if (rv != 0)
 			return -1;
 			return -1;
-		mapped = 0;
 	}
 	}
 
 
 	mapped = rv;
 	mapped = rv;
@@ -296,10 +303,12 @@ file_delmagic(struct magic *p, int type, size_t entries)
 	if (p == NULL)
 	if (p == NULL)
 		return;
 		return;
 	switch (type) {
 	switch (type) {
+#ifdef QUICK
 	case 2:
 	case 2:
 		p--;
 		p--;
 		(void)munmap((void *)p, sizeof(*p) * (entries + 1));
 		(void)munmap((void *)p, sizeof(*p) * (entries + 1));
 		break;
 		break;
+#endif
 	case 1:
 	case 1:
 		p--;
 		p--;
 		/*FALLTHROUGH*/
 		/*FALLTHROUGH*/
@@ -431,6 +440,9 @@ apprentice_magic_strength(const struct magic *m)
 	case FILE_LELDATE:
 	case FILE_LELDATE:
 	case FILE_BELDATE:
 	case FILE_BELDATE:
 	case FILE_MELDATE:
 	case FILE_MELDATE:
+	case FILE_FLOAT:
+	case FILE_BEFLOAT:
+	case FILE_LEFLOAT:
 		val += 4 * MULT;
 		val += 4 * MULT;
 		break;
 		break;
 
 
@@ -443,6 +455,9 @@ apprentice_magic_strength(const struct magic *m)
 	case FILE_QLDATE:
 	case FILE_QLDATE:
 	case FILE_LEQLDATE:
 	case FILE_LEQLDATE:
 	case FILE_BEQLDATE:
 	case FILE_BEQLDATE:
+	case FILE_DOUBLE:
+	case FILE_BEDOUBLE:
+	case FILE_LEDOUBLE:
 		val += 8 * MULT;
 		val += 8 * MULT;
 		break;
 		break;
 
 
@@ -512,7 +527,7 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 	private const char hdr[] =
 	private const char hdr[] =
 		"cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
 		"cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
 	FILE *f;
 	FILE *f;
-	char line[BUFSIZ+1];
+	char line[BUFSIZ];
 	int errs = 0;
 	int errs = 0;
 	struct magic_entry *marray;
 	struct magic_entry *marray;
 	uint32_t marraycount, i, mentrycount = 0;
 	uint32_t marraycount, i, mentrycount = 0;
@@ -541,7 +556,7 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 		(void)fprintf(stderr, "%s\n", hdr);
 		(void)fprintf(stderr, "%s\n", hdr);
 
 
 	/* read and parse this file */
 	/* read and parse this file */
-	for (ms->line = 1; fgets(line, BUFSIZ, f) != NULL; ms->line++) {
+	for (ms->line = 1; fgets(line, sizeof(line), f) != NULL; ms->line++) {
 		size_t len;
 		size_t len;
 		len = strlen(line);
 		len = strlen(line);
 		if (len == 0) /* null line, garbage, etc */
 		if (len == 0) /* null line, garbage, etc */
@@ -646,6 +661,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
 		case FILE_BELONG:
 		case FILE_BELONG:
 		case FILE_LELONG:
 		case FILE_LELONG:
 		case FILE_MELONG:
 		case FILE_MELONG:
+		case FILE_FLOAT:
+		case FILE_BEFLOAT:
+		case FILE_LEFLOAT:
 			v = (int32_t) v;
 			v = (int32_t) v;
 			break;
 			break;
 		case FILE_QUAD:
 		case FILE_QUAD:
@@ -657,6 +675,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
 		case FILE_BEQLDATE:
 		case FILE_BEQLDATE:
 		case FILE_LEQDATE:
 		case FILE_LEQDATE:
 		case FILE_LEQLDATE:
 		case FILE_LEQLDATE:
+		case FILE_DOUBLE:
+		case FILE_BEDOUBLE:
+		case FILE_LEDOUBLE:
 			v = (int64_t) v;
 			v = (int64_t) v;
 			break;
 			break;
 		case FILE_STRING:
 		case FILE_STRING:
@@ -959,6 +980,16 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
 			case 'B':
 			case 'B':
 				m->in_type = FILE_BYTE;
 				m->in_type = FILE_BYTE;
 				break;
 				break;
+			case 'e':
+			case 'f':
+			case 'g':
+				m->in_type = FILE_LEDOUBLE;
+				break;
+			case 'E':
+			case 'F':
+			case 'G':
+				m->in_type = FILE_BEDOUBLE;
+				break;
 			default:
 			default:
 				if (ms->flags & MAGIC_CHECK)
 				if (ms->flags & MAGIC_CHECK)
 					file_magwarn(ms,
 					file_magwarn(ms,
@@ -1252,6 +1283,31 @@ check_format_type(const char *ptr, int type)
 			return -1;
 			return -1;
 		}
 		}
 		
 		
+	case FILE_FMT_FLOAT:
+	case FILE_FMT_DOUBLE:
+		if (*ptr == '-')
+			ptr++;
+		if (*ptr == '.')
+			ptr++;
+		while (isdigit((unsigned char)*ptr)) ptr++;
+		if (*ptr == '.')
+			ptr++;
+		while (isdigit((unsigned char)*ptr)) ptr++;
+	
+		switch (*ptr++) {
+		case 'e':
+		case 'E':
+		case 'f':
+		case 'F':
+		case 'g':
+		case 'G':
+			return 0;
+			
+		default:
+			return -1;
+		}
+		
+
 	case FILE_FMT_STR:
 	case FILE_FMT_STR:
 		if (*ptr == '-')
 		if (*ptr == '-')
 			ptr++;
 			ptr++;
@@ -1358,6 +1414,28 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
 		}
 		}
 		m->vallen = slen;
 		m->vallen = slen;
 		return 0;
 		return 0;
+	case FILE_FLOAT:
+	case FILE_BEFLOAT:
+	case FILE_LEFLOAT:
+		if (m->reln != 'x') {
+			char *ep;
+#ifdef HAVE_STRTOF
+			m->value.f = strtof(*p, &ep);
+#else
+			m->value.f = (float)strtod(*p, &ep);
+#endif
+			*p = ep;
+		}
+		return 0;
+	case FILE_DOUBLE:
+	case FILE_BEDOUBLE:
+	case FILE_LEDOUBLE:
+		if (m->reln != 'x') {
+			char *ep;
+			m->value.d = strtod(*p, &ep);
+			*p = ep;
+		}
+		return 0;
 	default:
 	default:
 		if (m->reln != 'x') {
 		if (m->reln != 'x') {
 			char *ep;
 			char *ep;
@@ -1685,8 +1763,9 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
 	else
 	else
 		version = ptr[1];
 		version = ptr[1];
 	if (version != VERSIONNO) {
 	if (version != VERSIONNO) {
-		file_error(ms, 0, "version mismatch (%d != %d) in `%s'",
-		    version, VERSIONNO, dbname);
+		file_error(ms, 0, "File %d.%d supports only %d version magic "
+		    "files. `%s' is version %d", FILE_VERSION_MAJOR, patchlevel,
+		    VERSIONNO, dbname, version);
 		goto error;
 		goto error;
 	}
 	}
 	*nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1;
 	*nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1;

+ 17 - 17
src/ascmagic.c

@@ -49,7 +49,7 @@
 #include "names.h"
 #include "names.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.50 2007/03/15 14:51:00 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.53 2007/10/29 00:54:08 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 typedef unsigned long unichar;
 typedef unsigned long unichar;
@@ -76,6 +76,7 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
 	size_t ulen;
 	size_t ulen;
 	struct names *p;
 	struct names *p;
 	int rv = -1;
 	int rv = -1;
+	int mime = ms->flags & MAGIC_MIME;
 
 
 	const char *code = NULL;
 	const char *code = NULL;
 	const char *code_mime = NULL;
 	const char *code_mime = NULL;
@@ -184,13 +185,6 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
 		}
 		}
 	}
 	}
 
 
-	if ((ms->flags & MAGIC_NO_CHECK_FORTRAN) == 0 &&
-	    (*buf == 'c' || *buf == 'C') && ISSPC(buf[1])) {
-		subtype_mime = "text/fortran";
-		subtype = "fortran program";
-		goto subtype_identified;
-	}
-
 	/* look for tokens from names.h - this is expensive! */
 	/* look for tokens from names.h - this is expensive! */
 
 
 	if ((ms->flags & MAGIC_NO_CHECK_TOKENS) != 0)
 	if ((ms->flags & MAGIC_NO_CHECK_TOKENS) != 0)
@@ -271,21 +265,27 @@ subtype_identified:
 	if (seen_cr && nbytes < HOWMANY)
 	if (seen_cr && nbytes < HOWMANY)
 		n_cr++;
 		n_cr++;
 
 
-	if ((ms->flags & MAGIC_MIME)) {
-		if (subtype_mime) {
-			if (file_printf(ms, subtype_mime) == -1)
-				goto done;
-		} else {
-			if (file_printf(ms, "text/plain") == -1)
-				goto done;
+	if (mime) {
+		if (mime & MAGIC_MIME_TYPE) {
+			if (subtype_mime) {
+				if (file_printf(ms, subtype_mime) == -1)
+					goto done;
+			} else {
+				if (file_printf(ms, "text/plain") == -1)
+					goto done;
+			}
 		}
 		}
 
 
-		if (code_mime) {
-			if (file_printf(ms, "; charset=") == -1)
+		if ((mime == 0 || mime == MAGIC_MIME) && code_mime) {
+			if ((mime & MAGIC_MIME_TYPE) &&
+			    file_printf(ms, " charset=") == -1)
 				goto done;
 				goto done;
 			if (file_printf(ms, code_mime) == -1)
 			if (file_printf(ms, code_mime) == -1)
 				goto done;
 				goto done;
 		}
 		}
+
+		if (mime == MAGIC_MIME_ENCODING)
+			file_printf(ms, "binary");
 	} else {
 	} else {
 		if (file_printf(ms, code) == -1)
 		if (file_printf(ms, code) == -1)
 			goto done;
 			goto done;

+ 18 - 9
src/compress.c

@@ -49,13 +49,14 @@
 #if defined(HAVE_SYS_TIME_H)
 #if defined(HAVE_SYS_TIME_H)
 #include <sys/time.h>
 #include <sys/time.h>
 #endif
 #endif
-#ifdef HAVE_LIBZ
+#if defined(HAVE_ZLIB_H) && defined(HAVE_LIBZ)
+#define BUILTIN_DECOMPRESS
 #include <zlib.h>
 #include <zlib.h>
 #endif
 #endif
 
 
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.51 2007/03/05 02:41:29 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.54 2007/12/02 00:28:10 christos Exp $")
 #endif
 #endif
 
 
 private struct {
 private struct {
@@ -86,7 +87,7 @@ private size_t ncompr = sizeof(compr) / sizeof(compr[0]);
 private ssize_t swrite(int, const void *, size_t);
 private ssize_t swrite(int, const void *, size_t);
 private size_t uncompressbuf(struct magic_set *, int, size_t,
 private size_t uncompressbuf(struct magic_set *, int, size_t,
     const unsigned char *, unsigned char **, size_t);
     const unsigned char *, unsigned char **, size_t);
-#ifdef HAVE_LIBZ
+#ifdef BUILTIN_DECOMPRESS
 private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
 private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
     unsigned char **, size_t);
     unsigned char **, size_t);
 #endif
 #endif
@@ -98,6 +99,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
 	unsigned char *newbuf = NULL;
 	unsigned char *newbuf = NULL;
 	size_t i, nsz;
 	size_t i, nsz;
 	int rv = 0;
 	int rv = 0;
+	int mime = ms->flags & MAGIC_MIME;
 
 
 	if ((ms->flags & MAGIC_COMPRESS) == 0)
 	if ((ms->flags & MAGIC_COMPRESS) == 0)
 		return 0;
 		return 0;
@@ -112,11 +114,18 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
 			rv = -1;
 			rv = -1;
 			if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
 			if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
 				goto error;
 				goto error;
-			if (file_printf(ms, " (") == -1)
-				goto error;
-			if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
+
+			if (mime == MAGIC_MIME || mime == 0) {
+				if (file_printf(ms, mime ?
+				    " compressed-encoding=" : " (") == -1)
+					goto error;
+			}
+
+			if ((mime == 0 || mime & MAGIC_MIME_ENCODING) &&
+			    file_buffer(ms, -1, NULL, buf, nbytes) == -1)
 				goto error;
 				goto error;
-			if (file_printf(ms, ")") == -1)
+
+			if (!mime && file_printf(ms, ")") == -1)
 				goto error;
 				goto error;
 			rv = 1;
 			rv = 1;
 			break;
 			break;
@@ -285,7 +294,7 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 	return fd;
 	return fd;
 }
 }
 
 
-#ifdef HAVE_LIBZ
+#ifdef BUILTIN_DECOMPRESS
 
 
 #define FHCRC		(1 << 1)
 #define FHCRC		(1 << 1)
 #define FEXTRA		(1 << 2)
 #define FEXTRA		(1 << 2)
@@ -364,7 +373,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
 	int fdin[2], fdout[2];
 	int fdin[2], fdout[2];
 	int r;
 	int r;
 
 
-#ifdef HAVE_LIBZ
+#ifdef BUILTIN_DECOMPRESS
 	if (method == 2)
 	if (method == 2)
 		return uncompressgzipped(ms, old, newch, n);
 		return uncompressgzipped(ms, old, newch, n);
 #endif
 #endif

+ 49 - 77
src/file.c

@@ -71,7 +71,7 @@
 #include "patchlevel.h"
 #include "patchlevel.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: file.c,v 1.111 2007/05/08 14:44:18 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.117 2007/12/27 16:35:58 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 
 
@@ -122,7 +122,8 @@ private void load(const char *, int);
 int
 int
 main(int argc, char *argv[])
 main(int argc, char *argv[])
 {
 {
-	int c, i;
+	int c;
+	size_t i;
 	int action = 0, didsomefiles = 0, errflg = 0;
 	int action = 0, didsomefiles = 0, errflg = 0;
 	int flags = 0;
 	int flags = 0;
 	char *home, *usermagic;
 	char *home, *usermagic;
@@ -133,33 +134,15 @@ main(int argc, char *argv[])
 	int longindex;
 	int longindex;
 	static const struct option long_options[] =
 	static const struct option long_options[] =
 	{
 	{
-		{"version", 0, 0, 'v'},
-		{"help", 0, 0, 0},
-		{"brief", 0, 0, 'b'},
-		{"checking-printout", 0, 0, 'c'},
-		{"debug", 0, 0, 'd'},
-		{"exclude", 1, 0, 'e' },
-		{"files-from", 1, 0, 'f'},
-		{"separator", 1, 0, 'F'},
-		{"mime", 0, 0, 'i'},
-		{"keep-going", 0, 0, 'k'},
-#ifdef S_IFLNK
-		{"dereference", 0, 0, 'L'},
-		{"no-dereference", 0, 0, 'h'},
-#endif
-		{"magic-file", 1, 0, 'm'},
-#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
-		{"preserve-date", 0, 0, 'p'},
-#endif
-		{"uncompress", 0, 0, 'z'},
-		{"raw", 0, 0, 'r'},
-		{"no-buffer", 0, 0, 'n'},
-		{"no-pad", 0, 0, 'N'},
-		{"special-files", 0, 0, 's'},
-		{"compile", 0, 0, 'C'},
-		{"print0", 0, 0, '0'},
-		{0, 0, 0, 0},
-	};
+#define OPT(shortname, longname, opt, doc)      \
+    {longname, opt, NULL, shortname},
+#define OPT_LONGONLY(longname, opt, doc)        \
+    {longname, opt, NULL, 0},
+#include "file_opts.h"
+#undef OPT
+#undef OPT_LONGONLY
+    {0, 0, NULL, 0}
+};
 #endif
 #endif
 
 
 	static const struct {
 	static const struct {
@@ -170,7 +153,6 @@ main(int argc, char *argv[])
 		{ "ascii",	MAGIC_NO_CHECK_ASCII },
 		{ "ascii",	MAGIC_NO_CHECK_ASCII },
 		{ "compress",	MAGIC_NO_CHECK_COMPRESS },
 		{ "compress",	MAGIC_NO_CHECK_COMPRESS },
 		{ "elf",	MAGIC_NO_CHECK_ELF },
 		{ "elf",	MAGIC_NO_CHECK_ELF },
-		{ "fortran",	MAGIC_NO_CHECK_FORTRAN },
 		{ "soft",	MAGIC_NO_CHECK_SOFT },
 		{ "soft",	MAGIC_NO_CHECK_SOFT },
 		{ "tar",	MAGIC_NO_CHECK_TAR },
 		{ "tar",	MAGIC_NO_CHECK_TAR },
 		{ "tokens",	MAGIC_NO_CHECK_TOKENS },
 		{ "tokens",	MAGIC_NO_CHECK_TOKENS },
@@ -220,15 +202,24 @@ main(int argc, char *argv[])
 		switch (c) {
 		switch (c) {
 #ifdef HAVE_GETOPT_LONG
 #ifdef HAVE_GETOPT_LONG
 		case 0 :
 		case 0 :
-			if (longindex == 1)
+			switch (longindex) {
+			case 0:
 				help();
 				help();
+				break;
+			case 10:
+				flags |= MAGIC_MIME_TYPE;
+				break;
+			case 11:
+				flags |= MAGIC_MIME_ENCODING;
+				break;
+			}
 			break;
 			break;
 #endif
 #endif
 		case '0':
 		case '0':
 			nulsep = 1;
 			nulsep = 1;
 			break;
 			break;
 		case 'b':
 		case 'b':
-			++bflag;
+			bflag++;
 			break;
 			break;
 		case 'c':
 		case 'c':
 			action = FILE_CHECK;
 			action = FILE_CHECK;
@@ -287,9 +278,9 @@ main(int argc, char *argv[])
 			flags |= MAGIC_DEVICES;
 			flags |= MAGIC_DEVICES;
 			break;
 			break;
 		case 'v':
 		case 'v':
-			(void)fprintf(stdout, "%s-%d.%.2d\n", progname,
+			(void)fprintf(stderr, "%s-%d.%.2d\n", progname,
 				       FILE_VERSION_MAJOR, patchlevel);
 				       FILE_VERSION_MAJOR, patchlevel);
-			(void)fprintf(stdout, "magic file from %s\n",
+			(void)fprintf(stderr, "magic file from %s\n",
 				       magicfile);
 				       magicfile);
 			return 1;
 			return 1;
 		case 'z':
 		case 'z':
@@ -341,12 +332,19 @@ main(int argc, char *argv[])
 		}
 		}
 	}
 	}
 	else {
 	else {
-		int i, wid, nw;
-		for (wid = 0, i = optind; i < argc; i++) {
-			nw = file_mbswidth(argv[i]);
+		size_t j, wid, nw;
+		for (wid = 0, j = (size_t)optind; j < (size_t)argc; j++) {
+			nw = file_mbswidth(argv[j]);
 			if (nw > wid)
 			if (nw > wid)
 				wid = nw;
 				wid = nw;
 		}
 		}
+		/*
+		 * If bflag is only set twice, set it depending on
+		 * number of files [this is undocumented, and subject to change]
+		 */
+		if (bflag == 2) {
+			bflag = optind >= argc - 1;
+		}
 		for (; optind < argc; optind++)
 		for (; optind < argc; optind++)
 			process(argv[optind], wid);
 			process(argv[optind], wid);
 	}
 	}
@@ -383,7 +381,6 @@ unwrap(char *fn)
 	char buf[MAXPATHLEN];
 	char buf[MAXPATHLEN];
 	FILE *f;
 	FILE *f;
 	int wid = 0, cwid;
 	int wid = 0, cwid;
-	size_t len;
 
 
 	if (strcmp("-", fn) == 0) {
 	if (strcmp("-", fn) == 0) {
 		f = stdin;
 		f = stdin;
@@ -396,9 +393,7 @@ unwrap(char *fn)
 		}
 		}
 
 
 		while (fgets(buf, MAXPATHLEN, f) != NULL) {
 		while (fgets(buf, MAXPATHLEN, f) != NULL) {
-			len = strlen(buf);
-			if (len > 0 && buf[len - 1] == '\n')
-				buf[len - 1] = '\0';
+			buf[strcspn(buf, "\n")] = '\0';
 			cwid = file_mbswidth(buf);
 			cwid = file_mbswidth(buf);
 			if (cwid > wid)
 			if (cwid > wid)
 				wid = cwid;
 				wid = cwid;
@@ -407,10 +402,8 @@ unwrap(char *fn)
 		rewind(f);
 		rewind(f);
 	}
 	}
 
 
-	while (fgets(buf, MAXPATHLEN, f) != NULL) {
-		len = strlen(buf);
-		if (len > 0 && buf[len - 1] == '\n')
-			buf[len - 1] = '\0';
+	while (fgets(buf, sizeof(buf), f) != NULL) {
+		buf[strcspn(buf, "\n")] = '\0';
 		process(buf, wid);
 		process(buf, wid);
 		if(nobuffer)
 		if(nobuffer)
 			(void)fflush(stdout);
 			(void)fflush(stdout);
@@ -551,38 +544,17 @@ usage(void)
 private void
 private void
 help(void)
 help(void)
 {
 {
-	(void)puts(
-"Usage: file [OPTION]... [FILE]...\n"
-"Determine file type of FILEs.\n"
-"\n"
-"  -m, --magic-file LIST      use LIST as a colon-separated list of magic\n"
-"                               number files\n"
-"  -z, --uncompress           try to look inside compressed files\n"
-"  -b, --brief                do not prepend filenames to output lines\n"
-"  -c, --checking-printout    print the parsed form of the magic file, use in\n"
-"                               conjunction with -m to debug a new magic file\n"
-"                               before installing it\n"
-"  -e, --exclude              exclude test from the list of test to be\n"
-"                               performed for file. Valid tests are:\n"
-"                               ascii, apptype, elf, compress, soft, tar\n"
-"  -f, --files-from FILE      read the filenames to be examined from FILE\n"
-"  -F, --separator string     use string as separator instead of `:'\n"
-"  -i, --mime                 output mime type strings\n"
-"  -k, --keep-going           don't stop at the first match\n"
-"  -L, --dereference          causes symlinks to be followed\n"
-"  -n, --no-buffer            do not buffer output\n"
-"  -N, --no-pad               do not pad output\n"
-"  -p, --preserve-date        preserve access times on files\n"
-"  -r, --raw                  don't translate unprintable chars to \\ooo\n"
-"  -s, --special-files        treat special (block/char devices) files as\n"
-"                             ordinary ones\n"
-"or\n"
-"      --help                 display this help and exit\n"
-"or\n"
-"      --version              output version information and exit\n"
-"or\n"
-"  -C, --compile              compile file specified by -m\n"
-);
+	(void)fputs(
+"Usage: file [OPTION...] [FILE...]\n"
+"Determine type of FILEs.\n"
+"\n", stderr);
+#define OPT(shortname, longname, opt, doc)      \
+        fprintf(stderr, "  -%c, --" longname doc, shortname);
+#define OPT_LONGONLY(longname, opt, doc)        \
+        fprintf(stderr, "      --" longname doc);
+#include "file_opts.h"
+#undef OPT
+#undef OPT_LONGONLY
 	exit(0);
 	exit(0);
 }
 }
 #endif
 #endif

+ 12 - 2
src/file.h

@@ -27,7 +27,7 @@
  */
  */
 /*
 /*
  * file.h - definitions for file(1) program
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.91 2007/03/25 03:13:47 christos Exp $
+ * @(#)$File: file.h,v 1.92 2007/11/08 00:31:37 christos Exp $
  */
  */
 
 
 #ifndef __file_h__
 #ifndef __file_h__
@@ -146,7 +146,13 @@ struct magic {
 #define				FILE_QLDATE	30
 #define				FILE_QLDATE	30
 #define				FILE_LEQLDATE	31
 #define				FILE_LEQLDATE	31
 #define				FILE_BEQLDATE	32
 #define				FILE_BEQLDATE	32
-#define				FILE_NAMES_SIZE	33/* size of array to contain all names */
+#define				FILE_FLOAT	33
+#define				FILE_BEFLOAT	34
+#define				FILE_LEFLOAT	35
+#define				FILE_DOUBLE	36
+#define				FILE_BEDOUBLE	37
+#define				FILE_LEDOUBLE	38
+#define				FILE_NAMES_SIZE	39/* size of array to contain all names */
 
 
 #define IS_STRING(t) \
 #define IS_STRING(t) \
 	((t) == FILE_STRING || \
 	((t) == FILE_STRING || \
@@ -161,6 +167,8 @@ struct magic {
 #define FILE_FMT_NUM  1 /* "cduxXi" */
 #define FILE_FMT_NUM  1 /* "cduxXi" */
 #define FILE_FMT_STR  2 /* "s" */
 #define FILE_FMT_STR  2 /* "s" */
 #define FILE_FMT_QUAD 3 /* "ll" */
 #define FILE_FMT_QUAD 3 /* "ll" */
+#define FILE_FMT_FLOAT 4 /* "eEfFgG" */
+#define FILE_FMT_DOUBLE 5 /* "eEfFgG" */
 
 
 	/* Word 3 */
 	/* Word 3 */
 	uint8_t in_op;		/* operator for indirection */
 	uint8_t in_op;		/* operator for indirection */
@@ -224,6 +232,8 @@ struct magic {
 		uint8_t hl[4];	/* 4 bytes of a fixed-endian "long" */
 		uint8_t hl[4];	/* 4 bytes of a fixed-endian "long" */
 		uint8_t hq[8];	/* 8 bytes of a fixed-endian "quad" */
 		uint8_t hq[8];	/* 8 bytes of a fixed-endian "quad" */
 		char s[MAXstring];	/* the search string or regex pattern */
 		char s[MAXstring];	/* the search string or regex pattern */
+		float f;
+		double d;
 	} value;		/* either number or string */
 	} value;		/* either number or string */
 	/* Words 17..31 */
 	/* Words 17..31 */
 	char desc[MAXDESC];	/* description */
 	char desc[MAXDESC];	/* description */

+ 48 - 0
src/file_opts.h

@@ -0,0 +1,48 @@
+/*
+ * Table of command-line options
+ *
+ * The first column specifies the short name, if any, or 0 if none.
+ * The second column specifies the long name.
+ * The third column specifies whether it takes a parameter.
+ * The fourth column is the documentation.
+ *
+ * N.B. The long options' order must correspond to the code in file.c,
+ * and OPTSTRING must be kept up-to-date with the short options.
+ * Pay particular attention to the numbers of long-only options in the
+ * switch statement!
+ */
+
+OPT_LONGONLY("help", 0, "                 display this help and exit\n")
+OPT('v', "version", 0, "              output version information and exit\n")
+OPT('m', "magic-file", 1, " LIST      use LIST as a colon-separated list of magic\n"
+    "                               number files\n")
+OPT('z', "uncompress", 0, "           try to look inside compressed files\n")
+OPT('b', "brief", 0, "                do not prepend filenames to output lines\n")
+OPT('c', "checking-printout", 0, "    print the parsed form of the magic file, use in\n"
+    "                               conjunction with -m to debug a new magic file\n"
+    "                               before installing it\n")
+OPT('e', "exclude", 1, " TEST         exclude TEST from the list of test to be\n"
+    "                               performed for file. Valid tests are:\n"
+    "                               ascii, apptype, compress, elf, soft, tar, tokens, troff\n")
+OPT('f', "files-from", 1, " FILE      read the filenames to be examined from FILE\n")
+OPT('F', "separator", 1, " STRING     use string as separator instead of `:'\n")
+OPT('i', "mime", 0, "                 output MIME type strings (--mime-type and\n"
+    "                               --mime-encoding)\n")
+OPT_LONGONLY("mime-type", 0, "            output the MIME type\n")
+OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n")
+OPT('k', "keep-going", 0, "           don't stop at the first match\n")
+#ifdef S_IFLNK
+OPT('L', "dereference", 0, "          follow symlinks (default)\n")
+OPT('h', "no-dereference", 0, "       don't follow symlinks\n")
+#endif
+OPT('n', "no-buffer", 0, "            do not buffer output\n")
+OPT('N', "no-pad", 0, "               do not pad output\n")
+OPT('0', "print0", 0, "               terminate filenames with ASCII NUL\n")
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
+OPT('p', "preserve-date", 0, "        preserve access times on files\n")
+#endif
+OPT('r', "raw", 0, "                  don't translate unprintable chars to \\ooo\n")
+OPT('s', "special-files", 0, "        treat special (block/char devices) files as\n"
+    "                             ordinary ones\n")
+OPT('C', "compile", 0, "              compile file specified by -m\n")
+OPT('d', "debug", 0, "                print debugging messages\n")

+ 9 - 6
src/fsmagic.c

@@ -57,13 +57,14 @@
 #undef HAVE_MAJOR
 #undef HAVE_MAJOR
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: fsmagic.c,v 1.47 2007/01/12 17:38:28 christos Exp $")
+FILE_RCSID("@(#)$File: fsmagic.c,v 1.48 2007/10/17 19:33:31 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 protected int
 protected int
 file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 {
 {
 	int ret = 0;
 	int ret = 0;
+	int mime = ms->flags & MAGIC_MIME;
 #ifdef	S_IFLNK
 #ifdef	S_IFLNK
 	char buf[BUFSIZ+4];
 	char buf[BUFSIZ+4];
 	int nch;
 	int nch;
@@ -95,11 +96,12 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		return 1;
 		return 1;
 	}
 	}
 
 
-	if ((ms->flags & MAGIC_MIME) != 0) {
+	if (mime) {
 		if ((sb->st_mode & S_IFMT) != S_IFREG) {
 		if ((sb->st_mode & S_IFMT) != S_IFREG) {
-			if (file_printf(ms, "application/x-not-regular-file")
+			if ((mime & MAGIC_MIME_TYPE) &&
+			    file_printf(ms, "application/x-not-regular-file")
 			    == -1)
 			    == -1)
-				return -1;
+				    return -1;
 			return 1;
 			return 1;
 		}
 		}
 	}
 	}
@@ -303,8 +305,9 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 	 * when we read the file.)
 	 * when we read the file.)
 	 */
 	 */
 	if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
 	if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
-		if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
-		    "application/x-empty" : "empty") == -1)
+		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
+		    file_printf(ms, mime ? "application/x-empty" :
+		    "empty") == -1)
 			return -1;
 			return -1;
 		return 1;
 		return 1;
 	}
 	}

+ 70 - 47
src/funcs.c

@@ -41,14 +41,14 @@
 #endif
 #endif
 #ifndef SIZE_T_MAX
 #ifndef SIZE_T_MAX
 #ifdef __LP64__
 #ifdef __LP64__
-#define SIZE_T_MAX (size_t)0xfffffffffffffffffU
+#define SIZE_T_MAX (size_t)0xffffffffffffffffU
 #else
 #else
 #define SIZE_T_MAX (size_t)0xffffffffU
 #define SIZE_T_MAX (size_t)0xffffffffU
 #endif
 #endif
 #endif
 #endif
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.32 2007/05/24 17:22:27 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.35 2007/12/27 16:35:59 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #ifndef HAVE_VSNPRINTF
 #ifndef HAVE_VSNPRINTF
@@ -62,12 +62,16 @@ protected int
 file_printf(struct magic_set *ms, const char *fmt, ...)
 file_printf(struct magic_set *ms, const char *fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
-	size_t len, size;
+	size_t size;
+	ssize_t len;
 	char *buf;
 	char *buf;
 
 
 	va_start(ap, fmt);
 	va_start(ap, fmt);
 
 
-	if ((len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap)) >= ms->o.left) {
+	len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap);
+	if (len == -1)
+		goto out;
+	if (len >= (ssize_t)ms->o.left) {
 		long diff;	/* XXX: really ptrdiff_t */
 		long diff;	/* XXX: really ptrdiff_t */
 
 
 		va_end(ap);
 		va_end(ap);
@@ -84,11 +88,16 @@ file_printf(struct magic_set *ms, const char *fmt, ...)
 
 
 		va_start(ap, fmt);
 		va_start(ap, fmt);
 		len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap);
 		len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap);
+		if (len == -1)
+			goto out;
 	}
 	}
 	va_end(ap);
 	va_end(ap);
 	ms->o.ptr += len;
 	ms->o.ptr += len;
 	ms->o.left -= len;
 	ms->o.left -= len;
 	return 0;
 	return 0;
+out:
+	file_error(ms, errno, "vsnprintf failed");
+	return -1;
 }
 }
 
 
 /*
 /*
@@ -164,59 +173,73 @@ protected int
 file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
 file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
     size_t nb)
     size_t nb)
 {
 {
-    int m;
+	int m;
+	int mime = ms->flags & MAGIC_MIME;
+
+	if (nb == 0) {
+		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
+		    file_printf(ms, mime ? "application/x-empty" :
+		    "empty") == -1)
+			return -1;
+		return 1;
+	} else if (nb == 1) {
+		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
+		    file_printf(ms, mime ?  "application/octet-stream" :
+		    "very short file (no magic)") == -1)
+			return -1;
+		return 1;
+	}
 
 
 #ifdef __EMX__
 #ifdef __EMX__
-    if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
-	switch (file_os2_apptype(ms, inname, buf, nb)) {
-	case -1:
-	    return -1;
-	case 0:
-	    break;
-	default:
-	    return 1;
+	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
+		switch (file_os2_apptype(ms, inname, buf, nb)) {
+		case -1:
+			return -1;
+		case 0:
+			break;
+		default:
+			return 1;
+		}
 	}
 	}
-    }
 #endif
 #endif
 
 
-    /* try compression stuff */
-    if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) != 0 ||
-        (m = file_zmagic(ms, fd, inname, buf, nb)) == 0) {
-	/* Check if we have a tar file */
-	if ((ms->flags & MAGIC_NO_CHECK_TAR) != 0 ||
-	    (m = file_is_tar(ms, buf, nb)) == 0) {
-	    /* try tests in /etc/magic (or surrogate magic file) */
-	    if ((ms->flags & MAGIC_NO_CHECK_SOFT) != 0 ||
-		(m = file_softmagic(ms, buf, nb)) == 0) {
-		/* try known keywords, check whether it is ASCII */
-		if ((ms->flags & MAGIC_NO_CHECK_ASCII) != 0 ||
-		    (m = file_ascmagic(ms, buf, nb)) == 0) {
-		    /* abandon hope, all ye who remain here */
-		    if (file_printf(ms, ms->flags & MAGIC_MIME ?
-			(nb ? "application/octet-stream" :
-			    "application/empty") :
-			(nb ? "data" :
-			    "empty")) == -1)
-			    return -1;
-		    m = 1;
+	/* try compression stuff */
+	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) != 0 ||
+	    (m = file_zmagic(ms, fd, inname, buf, nb)) == 0) {
+	    /* Check if we have a tar file */
+	    if ((ms->flags & MAGIC_NO_CHECK_TAR) != 0 ||
+		(m = file_is_tar(ms, buf, nb)) == 0) {
+		/* try tests in /etc/magic (or surrogate magic file) */
+		if ((ms->flags & MAGIC_NO_CHECK_SOFT) != 0 ||
+		    (m = file_softmagic(ms, buf, nb)) == 0) {
+		    /* try known keywords, check whether it is ASCII */
+		    if ((ms->flags & MAGIC_NO_CHECK_ASCII) != 0 ||
+			(m = file_ascmagic(ms, buf, nb)) == 0) {
+			/* abandon hope, all ye who remain here */
+			if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
+			    file_printf(ms, mime ?  "application/octet-stream" :
+				"data") == -1)
+				return -1;
+			m = 1;
+		    }
 		}
 		}
 	    }
 	    }
 	}
 	}
-    }
 #ifdef BUILTIN_ELF
 #ifdef BUILTIN_ELF
-    if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 && nb > 5 && fd != -1) {
-	/*
-	 * We matched something in the file, so this *might*
-	 * be an ELF file, and the file is at least 5 bytes
-	 * long, so if it's an ELF file it has at least one
-	 * byte past the ELF magic number - try extracting
-	 * information from the ELF headers that cannot easily
-	 * be extracted with rules in the magic file.
-	 */
-	(void)file_tryelf(ms, fd, buf, nb);
-    }
+	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&
+	    nb > 5 && fd != -1) {
+		/*
+		 * We matched something in the file, so this *might*
+		 * be an ELF file, and the file is at least 5 bytes
+		 * long, so if it's an ELF file it has at least one
+		 * byte past the ELF magic number - try extracting
+		 * information from the ELF headers that cannot easily
+		 * be extracted with rules in the magic file.
+		 */
+		(void)file_tryelf(ms, fd, buf, nb);
+	}
 #endif
 #endif
-    return m;
+	return m;
 }
 }
 #endif
 #endif
 
 

+ 19 - 20
src/is_tar.c

@@ -45,7 +45,7 @@
 #include "tar.h"
 #include "tar.h"
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: is_tar.c,v 1.27 2007/01/12 17:38:28 christos Exp $")
+FILE_RCSID("@(#)$File: is_tar.c,v 1.29 2007/10/17 19:33:31 christos Exp $")
 #endif
 #endif
 
 
 #define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
 #define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
@@ -53,6 +53,12 @@ FILE_RCSID("@(#)$File: is_tar.c,v 1.27 2007/01/12 17:38:28 christos Exp $")
 private int is_tar(const unsigned char *, size_t);
 private int is_tar(const unsigned char *, size_t);
 private int from_oct(int, const char *);	/* Decode octal number */
 private int from_oct(int, const char *);	/* Decode octal number */
 
 
+static const char *tartype[] = {
+	"tar archive",
+	"POSIX tar archive",
+	"POSIX tar archive (GNU)",
+};
+
 protected int
 protected int
 file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
 file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
 {
 {
@@ -60,26 +66,19 @@ file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
 	 * Do the tar test first, because if the first file in the tar
 	 * Do the tar test first, because if the first file in the tar
 	 * archive starts with a dot, we can confuse it with an nroff file.
 	 * archive starts with a dot, we can confuse it with an nroff file.
 	 */
 	 */
-	switch (is_tar(buf, nbytes)) {
-	case 1:
-	        if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
-		    "application/x-tar" : "tar archive") == -1)
-			return -1;
-		return 1;
-	case 2:
-		if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
-		    "application/x-tar, POSIX" : "POSIX tar archive") == -1)
-			return -1;
-		return 1;
-	case 3:
-		if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
-		    "application/x-tar, POSIX (GNU)" :
-		    "POSIX tar archive (GNU)") == -1)
-			return -1;
-		return 1;
-	default:
+	int tar = is_tar(buf, nbytes);
+	int mime = ms->flags & MAGIC_MIME;
+
+	if (tar < 1 || tar > 3)
 		return 0;
 		return 0;
-	}
+
+	if (mime == MAGIC_MIME_ENCODING)
+		return 0;
+
+	if (file_printf(ms, mime ? "application/x-tar" :
+	    tartype[tar - 1]) == -1)
+		return -1;
+	return 1;
 }
 }
 
 
 /*
 /*

+ 31 - 23
src/magic.c

@@ -63,7 +63,7 @@
 #include "patchlevel.h"
 #include "patchlevel.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: magic.c,v 1.41 2007/03/26 17:59:50 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.45 2007/12/27 16:35:59 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #ifdef __EMX__
 #ifdef __EMX__
@@ -76,6 +76,9 @@ private void free_mlist(struct mlist *);
 private void close_and_restore(const struct magic_set *, const char *, int,
 private void close_and_restore(const struct magic_set *, const char *, int,
     const struct stat *);
     const struct stat *);
 private int info_from_stat(struct magic_set *, mode_t);
 private int info_from_stat(struct magic_set *, mode_t);
+#ifndef COMPILE_ONLY
+private const char *file_or_fd(struct magic_set *, const char *, int);
+#endif
 
 
 #ifndef	STDIN_FILENO
 #ifndef	STDIN_FILENO
 #define	STDIN_FILENO	0
 #define	STDIN_FILENO	0
@@ -230,13 +233,28 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
 }
 }
 
 
 #ifndef COMPILE_ONLY
 #ifndef COMPILE_ONLY
+
+/*
+ * find type of descriptor
+ */
+public const char *
+magic_descriptor(struct magic_set *ms, int fd)
+{
+	return file_or_fd(ms, NULL, fd);
+}
+
 /*
 /*
  * find type of named file
  * find type of named file
  */
  */
 public const char *
 public const char *
 magic_file(struct magic_set *ms, const char *inname)
 magic_file(struct magic_set *ms, const char *inname)
 {
 {
-	int	fd = 0;
+	return file_or_fd(ms, inname, STDIN_FILENO);
+}
+
+private const char *
+file_or_fd(struct magic_set *ms, const char *inname, int fd)
+{
 	int	rv = -1;
 	int	rv = -1;
 	unsigned char *buf;
 	unsigned char *buf;
 	struct stat	sb;
 	struct stat	sb;
@@ -265,7 +283,6 @@ magic_file(struct magic_set *ms, const char *inname)
 	}
 	}
 
 
 	if (inname == NULL) {
 	if (inname == NULL) {
-		fd = STDIN_FILENO;
 		if (fstat(fd, &sb) == 0 && S_ISFIFO(sb.st_mode))
 		if (fstat(fd, &sb) == 0 && S_ISFIFO(sb.st_mode))
 			ispipe = 1;
 			ispipe = 1;
 	} else {
 	} else {
@@ -279,16 +296,16 @@ magic_file(struct magic_set *ms, const char *inname)
 		errno = 0;
 		errno = 0;
 		if ((fd = open(inname, flags)) < 0) {
 		if ((fd = open(inname, flags)) < 0) {
 #ifdef __CYGWIN__
 #ifdef __CYGWIN__
-		    char *tmp = alloca(strlen(inname) + 5);
-		    (void)strcat(strcpy(tmp, inname), ".exe");
-		    if ((fd = open(tmp, flags)) < 0) {
+			char *tmp = alloca(strlen(inname) + 5);
+			(void)strcat(strcpy(tmp, inname), ".exe");
+			if ((fd = open(tmp, flags)) < 0) {
 #endif
 #endif
-			if (info_from_stat(ms, sb.st_mode) == -1)
-			    goto done;
-			rv = 0;
-			goto done;
+				if (info_from_stat(ms, sb.st_mode) == -1)
+					goto done;
+				rv = 0;
+				goto done;
 #ifdef __CYGWIN__
 #ifdef __CYGWIN__
-		    }
+			}
 #endif
 #endif
 		}
 		}
 #ifdef O_NONBLOCK
 #ifdef O_NONBLOCK
@@ -326,18 +343,9 @@ magic_file(struct magic_set *ms, const char *inname)
 		}
 		}
 	}
 	}
 
 
-	if (nbytes == 0) {
-		if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
-		    "application/x-empty" : "empty") == -1)
-			goto done;
-	} else if (nbytes == 1) {
-		if (file_printf(ms, "very short file (no magic)") == -1)
-			goto done;
-	} else {
-		(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
-		if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
-			goto done;
-	}
+	(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
+	if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
+		goto done;
 	rv = 0;
 	rv = 0;
 done:
 done:
 	free(buf);
 	free(buf);

+ 16 - 11
src/magic.h

@@ -34,21 +34,25 @@
 #define	MAGIC_SYMLINK		0x000002 /* Follow symlinks */
 #define	MAGIC_SYMLINK		0x000002 /* Follow symlinks */
 #define	MAGIC_COMPRESS		0x000004 /* Check inside compressed files */
 #define	MAGIC_COMPRESS		0x000004 /* Check inside compressed files */
 #define	MAGIC_DEVICES		0x000008 /* Look at the contents of devices */
 #define	MAGIC_DEVICES		0x000008 /* Look at the contents of devices */
-#define	MAGIC_MIME		0x000010 /* Return a mime string */
+#define	MAGIC_MIME_TYPE		0x000010 /* Return only the MIME type */
 #define	MAGIC_CONTINUE		0x000020 /* Return all matches */
 #define	MAGIC_CONTINUE		0x000020 /* Return all matches */
 #define	MAGIC_CHECK		0x000040 /* Print warnings to stderr */
 #define	MAGIC_CHECK		0x000040 /* Print warnings to stderr */
 #define	MAGIC_PRESERVE_ATIME	0x000080 /* Restore access time on exit */
 #define	MAGIC_PRESERVE_ATIME	0x000080 /* Restore access time on exit */
-#define	MAGIC_RAW		0x000100 /* Don't translate unprintable chars */
+#define	MAGIC_RAW		0x000100 /* Don't translate unprint chars */
 #define	MAGIC_ERROR		0x000200 /* Handle ENOENT etc as real errors */
 #define	MAGIC_ERROR		0x000200 /* Handle ENOENT etc as real errors */
-#define MAGIC_NO_CHECK_COMPRESS	0x001000 /* Don't check for compressed files */
-#define MAGIC_NO_CHECK_TAR	0x002000 /* Don't check for tar files */
-#define MAGIC_NO_CHECK_SOFT	0x004000 /* Don't check magic entries */
-#define MAGIC_NO_CHECK_APPTYPE	0x008000 /* Don't check application type */
-#define MAGIC_NO_CHECK_ELF	0x010000 /* Don't check for elf details */
-#define MAGIC_NO_CHECK_ASCII	0x020000 /* Don't check for ascii files */
-#define MAGIC_NO_CHECK_TROFF	0x040000 /* Don't check ascii/troff */
-#define MAGIC_NO_CHECK_FORTRAN	0x080000 /* Don't check ascii/fortran */
-#define MAGIC_NO_CHECK_TOKENS	0x100000 /* Don't check ascii/tokens */
+#define	MAGIC_MIME_ENCODING	0x000400 /* Return only the MIME encoding */
+#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
+#define	MAGIC_NO_CHECK_COMPRESS	0x001000 /* Don't check for compressed files */
+#define	MAGIC_NO_CHECK_TAR	0x002000 /* Don't check for tar files */
+#define	MAGIC_NO_CHECK_SOFT	0x004000 /* Don't check magic entries */
+#define	MAGIC_NO_CHECK_APPTYPE	0x008000 /* Don't check application type */
+#define	MAGIC_NO_CHECK_ELF	0x010000 /* Don't check for elf details */
+#define	MAGIC_NO_CHECK_ASCII	0x020000 /* Don't check for ascii files */
+#define	MAGIC_NO_CHECK_TROFF	0x040000 /* Don't check ascii/troff */
+#define	MAGIC_NO_CHECK_TOKENS	0x100000 /* Don't check ascii/tokens */
+
+/* Defined for backwards compatibility; does nothing */
+#define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {
@@ -59,6 +63,7 @@ magic_t magic_open(int);
 void magic_close(magic_t);
 void magic_close(magic_t);
 
 
 const char *magic_file(magic_t, const char *);
 const char *magic_file(magic_t, const char *);
+const char *magic_descriptor(magic_t, int);
 const char *magic_buffer(magic_t, const void *, size_t);
 const char *magic_buffer(magic_t, const void *, size_t);
 
 
 const char *magic_error(magic_t);
 const char *magic_error(magic_t);

+ 13 - 15
src/names.h

@@ -32,7 +32,7 @@
  * appear at fixed offsets into the file. Don't make HOWMANY
  * appear at fixed offsets into the file. Don't make HOWMANY
  * too high unless you have a very fast CPU.
  * too high unless you have a very fast CPU.
  *
  *
- * $File: names.h,v 1.27 2007/05/08 16:47:03 christos Exp $
+ * $File: names.h,v 1.29 2007/12/27 20:30:35 christos Exp $
  */
  */
 
 
 /*
 /*
@@ -43,19 +43,18 @@
 /* these types are used to index the table 'types': keep em in sync! */
 /* these types are used to index the table 'types': keep em in sync! */
 #define	L_C	0		/* first and foremost on UNIX */
 #define	L_C	0		/* first and foremost on UNIX */
 #define	L_CC	1		/* Bjarne's postincrement */
 #define	L_CC	1		/* Bjarne's postincrement */
-#define	L_FORT	2		/* the oldest one */
-#define	L_MAKE	3		/* Makefiles */
-#define	L_PLI	4		/* PL/1 */
-#define	L_MACH	5		/* some kinda assembler */
-#define	L_ENG	6		/* English */
-#define	L_PAS	7		/* Pascal */
-#define	L_MAIL	8		/* Electronic mail */
-#define	L_NEWS	9		/* Usenet Netnews */
-#define	L_JAVA	10		/* Java code */
-#define	L_HTML	11		/* HTML */
-#define	L_BCPL	12		/* BCPL */
-#define	L_M4	13		/* M4 */
-#define	L_PO	14		/* PO */
+#define	L_MAKE	2		/* Makefiles */
+#define	L_PLI	3		/* PL/1 */
+#define	L_MACH	4		/* some kinda assembler */
+#define	L_ENG	5		/* English */
+#define	L_PAS	6		/* Pascal */
+#define	L_MAIL	7		/* Electronic mail */
+#define	L_NEWS	8		/* Usenet Netnews */
+#define	L_JAVA	9		/* Java code */
+#define	L_HTML	10		/* HTML */
+#define	L_BCPL	11		/* BCPL */
+#define	L_M4	12		/* M4 */
+#define	L_PO	13		/* PO */
 
 
 static const struct {
 static const struct {
 	const char *human;
 	const char *human;
@@ -63,7 +62,6 @@ static const struct {
 } types[] = {
 } types[] = {
 	{ "C program",					"text/x-c", },
 	{ "C program",					"text/x-c", },
 	{ "C++ program",				"text/x-c++" },
 	{ "C++ program",				"text/x-c++" },
-	{ "FORTRAN program",				"text/x-fortran" },
 	{ "make commands",				"text/x-makefile" },
 	{ "make commands",				"text/x-makefile" },
 	{ "PL/1 program",				"text/x-pl1" },
 	{ "PL/1 program",				"text/x-pl1" },
 	{ "assembler program",				"text/x-asm" },
 	{ "assembler program",				"text/x-asm" },

+ 8 - 2
src/patchlevel.h

@@ -1,11 +1,17 @@
 #define	FILE_VERSION_MAJOR	4
 #define	FILE_VERSION_MAJOR	4
-#define	patchlevel		21
+#define	patchlevel		23
 
 
 /*
 /*
  * Patchlevel file for Ian Darwin's MAGIC command.
  * Patchlevel file for Ian Darwin's MAGIC command.
- * $File: patchlevel.h,v 1.65 2007/05/24 17:22:27 christos Exp $
+ * $File: patchlevel.h,v 1.67 2007/12/28 20:08:40 christos Exp $
  *
  *
  * $Log: patchlevel.h,v $
  * $Log: patchlevel.h,v $
+ * Revision 1.67  2007/12/28 20:08:40  christos
+ * welcome to 4.23.
+ *
+ * Revision 1.66  2007/12/27 16:38:24  christos
+ * welcome to 4.22
+ *
  * Revision 1.65  2007/05/24 17:22:27  christos
  * Revision 1.65  2007/05/24 17:22:27  christos
  * Welcome to 4.21
  * Welcome to 4.21
  *
  *

+ 13 - 4
src/print.c

@@ -41,7 +41,7 @@
 #include <time.h>
 #include <time.h>
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.59 2007/03/05 02:41:29 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.61 2007/12/27 16:35:59 christos Exp $")
 #endif  /* lint */
 #endif  /* lint */
 
 
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
 #define SZOF(a)	(sizeof(a) / sizeof(a[0]))
@@ -157,6 +157,16 @@ file_mdump(struct magic *m)
 			(void)fprintf(stderr, "%s,",
 			(void)fprintf(stderr, "%s,",
 			    file_fmttime((uint32_t)m->value.q, 0));
 			    file_fmttime((uint32_t)m->value.q, 0));
 			break;
 			break;
+		case FILE_FLOAT:
+		case FILE_BEFLOAT:
+		case FILE_LEFLOAT:
+			(void) fprintf(stderr, "%G", m->value.f);
+			break;
+		case FILE_DOUBLE:
+		case FILE_BEDOUBLE:
+		case FILE_LEDOUBLE:
+			(void) fprintf(stderr, "%G", m->value.d);
+			break;
 		case FILE_DEFAULT:
 		case FILE_DEFAULT:
 			/* XXX - do anything here? */
 			/* XXX - do anything here? */
 			break;
 			break;
@@ -189,7 +199,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
 protected const char *
 protected const char *
 file_fmttime(uint32_t v, int local)
 file_fmttime(uint32_t v, int local)
 {
 {
-	char *pp, *rt;
+	char *pp;
 	time_t t = (time_t)v;
 	time_t t = (time_t)v;
 	struct tm *tm;
 	struct tm *tm;
 
 
@@ -219,7 +229,6 @@ file_fmttime(uint32_t v, int local)
 		pp = asctime(tm);
 		pp = asctime(tm);
 	}
 	}
 
 
-	if ((rt = strchr(pp, '\n')) != NULL)
-		*rt = '\0';
+	pp[strcspn(pp, "\n")] = '\0';
 	return pp;
 	return pp;
 }
 }

+ 38 - 21
src/readelf.c

@@ -37,7 +37,7 @@
 #include "readelf.h"
 #include "readelf.h"
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.63 2007/01/16 14:56:45 ljt Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.68 2007/12/27 16:13:26 christos Exp $")
 #endif
 #endif
 
 
 #ifdef	ELFCORE
 #ifdef	ELFCORE
@@ -191,15 +191,15 @@ getu64(int swap, uint64_t value)
 #ifdef ELFCORE
 #ifdef ELFCORE
 size_t	prpsoffsets32[] = {
 size_t	prpsoffsets32[] = {
 	8,		/* FreeBSD */
 	8,		/* FreeBSD */
-	28,		/* Linux 2.0.36 (short name) */
 	44,		/* Linux (path name) */
 	44,		/* Linux (path name) */
+	28,		/* Linux 2.0.36 (short name) */
 	84,		/* SunOS 5.x */
 	84,		/* SunOS 5.x */
 };
 };
 
 
 size_t	prpsoffsets64[] = {
 size_t	prpsoffsets64[] = {
 	16,		/* FreeBSD, 64-bit */
 	16,		/* FreeBSD, 64-bit */
-	40,             /* Linux (tested on core from 2.4.x, short name) */
 	56,		/* Linux (path name) */
 	56,		/* Linux (path name) */
+	40,             /* Linux (tested on core from 2.4.x, short name) */
 	120,		/* SunOS 5.x, 64-bit */
 	120,		/* SunOS 5.x, 64-bit */
 };
 };
 
 
@@ -241,6 +241,7 @@ private const char *os_style_names[] = {
 
 
 #define FLAGS_DID_CORE		1
 #define FLAGS_DID_CORE		1
 #define FLAGS_DID_NOTE		2
 #define FLAGS_DID_NOTE		2
+#define FLAGS_DID_CORE_STYLE	4
 
 
 private int
 private int
 dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off,
 dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off,
@@ -587,10 +588,11 @@ core:
 	if ((*flags & FLAGS_DID_CORE) != 0)
 	if ((*flags & FLAGS_DID_CORE) != 0)
 		return size;
 		return size;
 
 
-	if (os_style != -1) {
+	if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
 		if (file_printf(ms, ", %s-style", os_style_names[os_style])
 		if (file_printf(ms, ", %s-style", os_style_names[os_style])
 		    == -1)
 		    == -1)
 			return size;
 			return size;
+		*flags |= FLAGS_DID_CORE_STYLE;
 	}
 	}
 
 
 	switch (os_style) {
 	switch (os_style) {
@@ -615,6 +617,7 @@ core:
 			if (file_printf(ms, " (signal %u)",
 			if (file_printf(ms, " (signal %u)",
 			    getu32(swap, signo)) == -1)
 			    getu32(swap, signo)) == -1)
 				return size;
 				return size;
+			*flags |= FLAGS_DID_CORE;
 			return size;
 			return size;
 		}
 		}
 		break;
 		break;
@@ -629,11 +632,12 @@ core:
 			 * is in SunOS 5.x and Linux).
 			 * is in SunOS 5.x and Linux).
 			 *
 			 *
 			 * Unfortunately, it's at a different offset
 			 * Unfortunately, it's at a different offset
-			 * in varous OSes, so try multiple offsets.
+			 * in various OSes, so try multiple offsets.
 			 * If the characters aren't all printable,
 			 * If the characters aren't all printable,
 			 * reject it.
 			 * reject it.
 			 */
 			 */
 			for (i = 0; i < NOFFSETS; i++) {
 			for (i = 0; i < NOFFSETS; i++) {
+				unsigned char *cname, *cp;
 				size_t reloffset = prpsoffsets(i);
 				size_t reloffset = prpsoffsets(i);
 				size_t noffset = doff + reloffset;
 				size_t noffset = doff + reloffset;
 				for (j = 0; j < 16; j++, noffset++,
 				for (j = 0; j < 16; j++, noffset++,
@@ -681,9 +685,16 @@ core:
 				/*
 				/*
 				 * Well, that worked.
 				 * Well, that worked.
 				 */
 				 */
-				if (file_printf(ms, ", from '%.16s'",
-				    &nbuf[doff + prpsoffsets(i)]) == -1)
+				cname = (unsigned char *)
+				    &nbuf[doff + prpsoffsets(i)];
+				for (cp = cname; *cp && isprint(*cp); cp++)
+					continue;
+				if (cp > cname)
+					cp--;
+				if (file_printf(ms, ", from '%.*s'",
+				    (int)(cp - cname), cname) == -1)
 					return size;
 					return size;
+				*flags |= FLAGS_DID_CORE;
 				return size;
 				return size;
 
 
 			tryanother:
 			tryanother:
@@ -693,7 +704,6 @@ core:
 		break;
 		break;
 	}
 	}
 #endif
 #endif
-	*flags |= FLAGS_DID_CORE;
 	return offset;
 	return offset;
 }
 }
 
 
@@ -884,6 +894,8 @@ dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off,
 				return -1;
 				return -1;
 			}
 			}
 			break;
 			break;
+		default:
+			break;
 		}
 		}
 	}
 	}
 	if (file_printf(ms, ", %s linked%s", linking_style, shared_libraries)
 	if (file_printf(ms, ", %s linked%s", linking_style, shared_libraries)
@@ -935,6 +947,8 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
 
 
 	if (class == ELFCLASS32) {
 	if (class == ELFCLASS32) {
 		Elf32_Ehdr elfhdr;
 		Elf32_Ehdr elfhdr;
+		uint16_t type;
+
 		if (nbytes <= sizeof (Elf32_Ehdr))
 		if (nbytes <= sizeof (Elf32_Ehdr))
 			return 0;
 			return 0;
 
 
@@ -943,33 +957,36 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
 		(void) memcpy(&elfhdr, buf, sizeof elfhdr);
 		(void) memcpy(&elfhdr, buf, sizeof elfhdr);
 		swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
 		swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
 
 
-		if (getu16(swap, elfhdr.e_type) == ET_CORE) {
+		type = getu16(swap, elfhdr.e_type);
+		switch (type) {
 #ifdef ELFCORE
 #ifdef ELFCORE
+		case ET_CORE:
 			if (dophn_core(ms, class, swap, fd,
 			if (dophn_core(ms, class, swap, fd,
 			    (off_t)getu32(swap, elfhdr.e_phoff),
 			    (off_t)getu32(swap, elfhdr.e_phoff),
 			    getu16(swap, elfhdr.e_phnum), 
 			    getu16(swap, elfhdr.e_phnum), 
 			    (size_t)getu16(swap, elfhdr.e_phentsize),
 			    (size_t)getu16(swap, elfhdr.e_phentsize),
 			    fsize, &flags) == -1)
 			    fsize, &flags) == -1)
 				return -1;
 				return -1;
-#else
-			;
+			break;
 #endif
 #endif
-		} else {
-			if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
-				if (dophn_exec(ms, class, swap,
-				    fd, (off_t)getu32(swap, elfhdr.e_phoff),
-				    getu16(swap, elfhdr.e_phnum), 
-				    (size_t)getu16(swap, elfhdr.e_phentsize),
-				    fsize, &flags)
-				    == -1)
-					return -1;
-			}
+		case ET_EXEC:
+		case ET_DYN:
+			if (dophn_exec(ms, class, swap,
+			    fd, (off_t)getu32(swap, elfhdr.e_phoff),
+			    getu16(swap, elfhdr.e_phnum), 
+			    (size_t)getu16(swap, elfhdr.e_phentsize),
+			    fsize, &flags) == -1)
+				return -1;
 			if (doshn(ms, class, swap, fd,
 			if (doshn(ms, class, swap, fd,
 			    (off_t)getu32(swap, elfhdr.e_shoff),
 			    (off_t)getu32(swap, elfhdr.e_shoff),
 			    getu16(swap, elfhdr.e_shnum),
 			    getu16(swap, elfhdr.e_shnum),
 			    (size_t)getu16(swap, elfhdr.e_shentsize),
 			    (size_t)getu16(swap, elfhdr.e_shentsize),
 			    &flags) == -1)
 			    &flags) == -1)
 				return -1;
 				return -1;
+			break;
+
+		default:
+			break;
 		}
 		}
 		return 1;
 		return 1;
 	}
 	}

+ 3 - 6
src/readelf.h

@@ -97,6 +97,7 @@ typedef struct {
 
 
 /* e_type */
 /* e_type */
 #define ET_EXEC		2
 #define ET_EXEC		2
+#define ET_DYN		3
 #define ET_CORE		4
 #define ET_CORE		4
 
 
 /* sh_type */
 /* sh_type */
@@ -190,12 +191,6 @@ typedef struct {
     Elf64_Off	sh_entsize;
     Elf64_Off	sh_entsize;
 } Elf64_Shdr;
 } Elf64_Shdr;
 
 
-/* Notes used in ET_CORE */
-#define NT_PRSTATUS	1
-#define NT_PRFPREG	2
-#define NT_PRPSINFO	3
-#define NT_TASKSTRUCT	4
-
 #define	NT_NETBSD_CORE_PROCINFO		1
 #define	NT_NETBSD_CORE_PROCINFO		1
 
 
 /* Note header in a PT_NOTE section */
 /* Note header in a PT_NOTE section */
@@ -211,10 +206,12 @@ typedef struct {
     Elf64_Word	n_type;
     Elf64_Word	n_type;
 } Elf64_Nhdr;
 } Elf64_Nhdr;
 
 
+/* Notes used in ET_CORE */
 #define	NT_PRSTATUS	1
 #define	NT_PRSTATUS	1
 #define	NT_PRFPREG	2
 #define	NT_PRFPREG	2
 #define	NT_PRPSINFO	3
 #define	NT_PRPSINFO	3
 #define	NT_PRXREG	4
 #define	NT_PRXREG	4
+#define NT_TASKSTRUCT	4
 #define	NT_PLATFORM	5
 #define	NT_PLATFORM	5
 #define	NT_AUXV		6
 #define	NT_AUXV		6
 
 

+ 195 - 12
src/softmagic.c

@@ -38,7 +38,7 @@
 
 
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.99 2007/05/08 14:44:18 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.103 2007/12/27 16:35:59 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 private int match(struct magic_set *, struct magic *, uint32_t,
 private int match(struct magic_set *, struct magic *, uint32_t,
@@ -254,9 +254,10 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 				break;
 				break;
 			}
 			}
 		}
 		}
-		firstline = 0;
-		if (printed_something)
+		if (printed_something) {
+			firstline = 0;
 			returnval = 1;
 			returnval = 1;
+		}
 		if ((ms->flags & MAGIC_CONTINUE) == 0 && printed_something) {
 		if ((ms->flags & MAGIC_CONTINUE) == 0 && printed_something) {
 			return 1; /* don't keep searching */
 			return 1; /* don't keep searching */
 		}			
 		}			
@@ -310,6 +311,8 @@ private int32_t
 mprint(struct magic_set *ms, struct magic *m)
 mprint(struct magic_set *ms, struct magic *m)
 {
 {
 	uint64_t v;
 	uint64_t v;
+	float vf;
+	double vd;
 	int64_t t = 0;
 	int64_t t = 0;
  	char buf[512];
  	char buf[512];
 	union VALUETYPE *p = &ms->ms_value;
 	union VALUETYPE *p = &ms->ms_value;
@@ -398,11 +401,8 @@ mprint(struct magic_set *ms, struct magic *m)
 			t = ms->offset + m->vallen;
 			t = ms->offset + m->vallen;
 		}
 		}
 		else {
 		else {
-			if (*m->value.s == '\0') {
-				char *cp = strchr(p->s,'\n');
-				if (cp)
-					*cp = '\0';
-			}
+			if (*m->value.s == '\0')
+				p->s[strcspn(p->s, "\n")] = '\0';
 			if (file_printf(ms, m->desc, p->s) == -1)
 			if (file_printf(ms, m->desc, p->s) == -1)
 				return -1;
 				return -1;
 			t = ms->offset + strlen(p->s);
 			t = ms->offset + strlen(p->s);
@@ -445,6 +445,48 @@ mprint(struct magic_set *ms, struct magic *m)
 		t = ms->offset + sizeof(uint64_t);
 		t = ms->offset + sizeof(uint64_t);
 		break;
 		break;
 
 
+  	case FILE_FLOAT:
+  	case FILE_BEFLOAT:
+  	case FILE_LEFLOAT:
+		vf = p->f;
+		switch (check_fmt(ms, m)) {
+		case -1:
+			return -1;
+		case 1:
+			if (snprintf(buf, sizeof(buf), "%g", vf) < 0)
+				return -1;
+			if (file_printf(ms, m->desc, buf) == -1)
+				return -1;
+			break;
+		default:
+			if (file_printf(ms, m->desc, vf) == -1)
+				return -1;
+			break;
+		}
+		t = ms->offset + sizeof(float);
+  		break;
+
+  	case FILE_DOUBLE:
+  	case FILE_BEDOUBLE:
+  	case FILE_LEDOUBLE:
+		vd = p->d;
+		switch (check_fmt(ms, m)) {
+		case -1:
+			return -1;
+		case 1:
+			if (snprintf(buf, sizeof(buf), "%g", vd) < 0)
+				return -1;
+			if (file_printf(ms, m->desc, buf) == -1)
+				return -1;
+			break;
+		default:
+			if (file_printf(ms, m->desc, vd) == -1)
+				return -1;
+			break;
+		}
+		t = ms->offset + sizeof(double);
+  		break;
+
 	case FILE_REGEX: {
 	case FILE_REGEX: {
 		char *cp;
 		char *cp;
 		int rval;
 		int rval;
@@ -545,6 +587,35 @@ cvt_64(union VALUETYPE *p, const struct magic *m)
 	DO_CVT(q, (uint64_t));
 	DO_CVT(q, (uint64_t));
 }
 }
 
 
+#define DO_CVT2(fld, cast) \
+	if (m->num_mask) \
+		switch (m->mask_op & FILE_OPS_MASK) { \
+		case FILE_OPADD: \
+			p->fld += cast m->num_mask; \
+			break; \
+		case FILE_OPMINUS: \
+			p->fld -= cast m->num_mask; \
+			break; \
+		case FILE_OPMULTIPLY: \
+			p->fld *= cast m->num_mask; \
+			break; \
+		case FILE_OPDIVIDE: \
+			p->fld /= cast m->num_mask; \
+			break; \
+		} \
+
+private void
+cvt_float(union VALUETYPE *p, const struct magic *m)
+{
+	DO_CVT2(f, (float));
+}
+
+private void
+cvt_double(union VALUETYPE *p, const struct magic *m)
+{
+	DO_CVT2(d, (double));
+}
+
 /*
 /*
  * Convert the byte order of the data we are looking at
  * Convert the byte order of the data we are looking at
  * While we're here, let's apply the mask operation
  * While we're here, let's apply the mask operation
@@ -644,6 +715,36 @@ mconvert(struct magic_set *ms, struct magic *m)
 		    ((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
 		    ((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
 		cvt_32(p, m);
 		cvt_32(p, m);
 		return 1;
 		return 1;
+	case FILE_FLOAT:
+		cvt_float(p, m);
+		return 1;
+	case FILE_BEFLOAT:
+		p->l =  ((uint32_t)p->hl[0]<<24)|((uint32_t)p->hl[1]<<16)|
+			((uint32_t)p->hl[2]<<8) |((uint32_t)p->hl[3]);
+		cvt_float(p, m);
+		return 1;
+	case FILE_LEFLOAT:
+		p->l =  ((uint32_t)p->hl[3]<<24)|((uint32_t)p->hl[2]<<16)|
+			((uint32_t)p->hl[1]<<8) |((uint32_t)p->hl[0]);
+		cvt_float(p, m);
+		return 1;
+	case FILE_DOUBLE:
+		cvt_double(p, m);
+		return 1;
+	case FILE_BEDOUBLE:
+		p->q =  ((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)|
+			((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
+			((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
+			((uint64_t)p->hq[6]<<8) |((uint64_t)p->hq[7]);
+		cvt_double(p, m);
+		return 1;
+	case FILE_LEDOUBLE:
+		p->q =  ((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)|
+			((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
+			((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
+			((uint64_t)p->hq[1]<<8) |((uint64_t)p->hq[0]);
+		cvt_double(p, m);
+		return 1;
 	case FILE_REGEX:
 	case FILE_REGEX:
 	case FILE_SEARCH:
 	case FILE_SEARCH:
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
@@ -730,13 +831,17 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 				    offset);
 				    offset);
 				return -1;
 				return -1;
 			}
 			}
-			for (/*EMPTY*/; src < esrc; src++, dst++) {
+			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
 				if (dst < edst)
 				if (dst < edst)
-					*dst = *src++;
+					*dst = *src;
 				else
 				else
 					break;
 					break;
-				if (*dst == '\0')
-					*dst = ' ';
+				if (*dst == '\0') {
+					if (type == FILE_BESTRING16 ?
+					    *(src - 1) != '\0' :
+					    *(src + 1) != '\0')
+						*dst = ' ';
+				}
 			}
 			}
 			*edst = '\0';
 			*edst = '\0';
 			return 0;
 			return 0;
@@ -1289,10 +1394,20 @@ mget(struct magic_set *ms, const unsigned char *s,
 	case FILE_BELDATE:
 	case FILE_BELDATE:
 	case FILE_LELDATE:
 	case FILE_LELDATE:
 	case FILE_MELDATE:
 	case FILE_MELDATE:
+	case FILE_FLOAT:
+	case FILE_BEFLOAT:
+	case FILE_LEFLOAT:
 		if (nbytes < (offset + 4))
 		if (nbytes < (offset + 4))
 			return 0;
 			return 0;
 		break;
 		break;
 		
 		
+	case FILE_DOUBLE:
+	case FILE_BEDOUBLE:
+	case FILE_LEDOUBLE:
+		if (nbytes < (offset + 8))
+			return 0;
+		break;
+
 	case FILE_STRING:
 	case FILE_STRING:
 	case FILE_PSTRING:
 	case FILE_PSTRING:
 	case FILE_SEARCH:
 	case FILE_SEARCH:
@@ -1395,6 +1510,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
 {
 {
 	uint64_t l = m->value.q;
 	uint64_t l = m->value.q;
 	uint64_t v;
 	uint64_t v;
+	float fl, fv;
+	double dl, dv;
 	int matched;
 	int matched;
 	union VALUETYPE *p = &ms->ms_value;
 	union VALUETYPE *p = &ms->ms_value;
 
 
@@ -1436,6 +1553,72 @@ magiccheck(struct magic_set *ms, struct magic *m)
 		v = p->q;
 		v = p->q;
 		break;
 		break;
 
 
+	case FILE_FLOAT:
+	case FILE_BEFLOAT:
+	case FILE_LEFLOAT:
+		fl = m->value.f;
+		fv = p->f;
+		switch (m->reln) {
+		case 'x':
+			matched = 1;
+			break;
+	
+		case '!':
+			matched = fv != fl;
+			break;
+	
+		case '=':
+			matched = fv == fl;
+			break;
+	
+		case '>':
+			matched = fv > fl;
+			break;
+	
+		case '<':
+			matched = fv < fl;
+			break;
+	
+		default:
+			matched = 0;
+			file_magerror(ms, "cannot happen with float: invalid relation `%c'", m->reln);
+			return -1;
+		}
+		return matched;
+
+	case FILE_DOUBLE:
+	case FILE_BEDOUBLE:
+	case FILE_LEDOUBLE:
+		dl = m->value.d;
+		dv = p->d;
+		switch (m->reln) {
+		case 'x':
+			matched = 1;
+			break;
+	
+		case '!':
+			matched = dv != dl;
+			break;
+	
+		case '=':
+			matched = dv == dl;
+			break;
+	
+		case '>':
+			matched = dv > dl;
+			break;
+	
+		case '<':
+			matched = dv < dl;
+			break;
+	
+		default:
+			matched = 0;
+			file_magerror(ms, "cannot happen with double: invalid relation `%c'", m->reln);
+			return -1;
+		}
+		return matched;
+
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
 		l = 0;
 		l = 0;
 		v = 0;
 		v = 0;