Browse Source

Import upstream version 5.17

Christos Zoulas 10 years ago
parent
commit
1438924c48
99 changed files with 9893 additions and 5047 deletions
  1. 78 0
      ChangeLog
  2. 132 106
      Makefile.in
  3. 5 4
      README
  4. 6 5
      TODO
  5. 261 145
      aclocal.m4
  6. 7 2
      compile
  7. 143 115
      config.guess
  8. 6 3
      config.h.in
  9. 141 70
      config.sub
  10. 1881 993
      configure
  11. 3 3
      configure.ac
  12. 215 204
      depcomp
  13. 63 47
      doc/Makefile.in
  14. 12 5
      doc/file.man
  15. 25 5
      doc/magic.man
  16. 2637 1383
      ltmain.sh
  17. 1437 812
      m4/libtool.m4
  18. 24 8
      m4/ltoptions.m4
  19. 6 6
      m4/ltversion.m4
  20. 9 3
      m4/lt~obsolete.m4
  21. 1 1
      magic/Localstuff
  22. 100 0
      magic/Magdir/android
  23. 2 2
      magic/Magdir/animation
  24. 4 4
      magic/Magdir/archive
  25. 8 8
      magic/Magdir/assembler
  26. 64 1
      magic/Magdir/audio
  27. 8 0
      magic/Magdir/blackberry
  28. 10 10
      magic/Magdir/c-lang
  29. 50 17
      magic/Magdir/cad
  30. 2 2
      magic/Magdir/commands
  31. 23 8
      magic/Magdir/compress
  32. 23 0
      magic/Magdir/ctf
  33. 31 4
      magic/Magdir/database
  34. 55 47
      magic/Magdir/dolby
  35. 16 10
      magic/Magdir/elf
  36. 3 3
      magic/Magdir/epoc
  37. 431 95
      magic/Magdir/filesystems
  38. 4 1
      magic/Magdir/fsav
  39. 10 6
      magic/Magdir/gimp
  40. 12 1
      magic/Magdir/gnu
  41. 10 7
      magic/Magdir/ibm6000
  42. 74 20
      magic/Magdir/images
  43. 1 20
      magic/Magdir/java
  44. 55 4
      magic/Magdir/linux
  45. 4 1
      magic/Magdir/macintosh
  46. 16 1
      magic/Magdir/msdos
  47. 17 16
      magic/Magdir/msooxml
  48. 255 0
      magic/Magdir/msx
  49. 63 11
      magic/Magdir/palm
  50. 11 0
      magic/Magdir/pbf
  51. 2 1
      magic/Magdir/pdf
  52. 8 2
      magic/Magdir/pdp
  53. 4 7
      magic/Magdir/perl
  54. 3 3
      magic/Magdir/python
  55. 4 1
      magic/Magdir/riff
  56. 2 2
      magic/Magdir/scientific
  57. 8 1
      magic/Magdir/sgml
  58. 24 6
      magic/Magdir/sql
  59. 3 0
      magic/Magdir/ssh
  60. 1 0
      magic/Magdir/ssl
  61. 42 0
      magic/Magdir/symbos
  62. 6 4
      magic/Magdir/sysex
  63. 1 1
      magic/Magdir/tcl
  64. 4 1
      magic/Magdir/tex
  65. 175 4
      magic/Magdir/windows
  66. 6 1
      magic/Magdir/wordprocessors
  67. 27 25
      magic/Magdir/xilinx
  68. 9 3
      magic/Makefile.am
  69. 70 35
      magic/Makefile.in
  70. 145 260
      missing
  71. 61 31
      python/Makefile.in
  72. 103 62
      src/Makefile.in
  73. 48 27
      src/apprentice.c
  74. 4 3
      src/ascmagic.c
  75. 7 8
      src/compress.c
  76. 9 5
      src/encoding.c
  77. 12 6
      src/file.c
  78. 16 12
      src/file.h
  79. 1 1
      src/file_opts.h
  80. 3 4
      src/fsmagic.c
  81. 26 19
      src/funcs.c
  82. 11 4
      src/magic.c
  83. 2 1
      src/magic.h
  84. 1 0
      src/magic.h.in
  85. 2 2
      src/pread.c
  86. 90 46
      src/readcdf.c
  87. 168 107
      src/readelf.c
  88. 40 0
      src/readelf.h
  89. 102 63
      src/softmagic.c
  90. 82 0
      src/strcasestr.c
  91. 7 2
      tests/Makefile.am
  92. 93 54
      tests/Makefile.in
  93. 4 7
      tests/README
  94. 1 0
      tests/escapevel.result
  95. BIN
      tests/escapevel.testfile
  96. 0 6
      tests/gedcom.magic
  97. 1 1
      tests/gedcom.result
  98. 1 0
      tests/issue311docx.result
  99. BIN
      tests/issue311docx.testfile

+ 78 - 0
ChangeLog

@@ -1,3 +1,81 @@
+2014-02-12  18:21  Christos Zoulas <christos@zoulas.com>
+
+	* Count recursion levels through indirect magic
+
+2014-02-11  10:40  Christos Zoulas <christos@zoulas.com>
+
+	* Prevent infinite recursion on files with indirect offsets of 0
+
+2014-01-30  21:00  Christos Zoulas <christos@zoulas.com>
+
+	* Add -E flag that makes file print filesystem errors to stderr
+	  and exit.
+
+2014-01-08  17:20  Christos Zoulas <christos@zoulas.com>
+
+	* mime printing could print results from multiple magic entries
+	  if there were multiple matches.
+	* in some cases overflow was not detected when computing offsets
+	  in softmagic.
+
+2013-12-05  12:00  Christos Zoulas <christos@zoulas.com>
+
+	* use strcasestr() to for cdf strings
+	* reset to the "C" locale while doing regex operations, or case
+	  insensitive comparisons; this is provisional
+
+2013-11-19  20:10  Christos Zoulas <christos@zoulas.com>
+
+	* always leave magic file loaded, don't unload for magic_check, etc.
+	* fix default encoding to binary instead of unknown which broke recently
+	* handle empty and one byte files, less specially so that
+	  --mime-encoding does not break completely.
+		`
+2013-11-06  14:40  Christos Zoulas <christos@zoulas.com>
+
+	* fix erroneous non-zero exit code from non-existant file and message
+
+2013-10-29  14:25  Christos Zoulas <christos@zoulas.com>
+
+	* add CDF MSI file detection (Guy Helmer)
+
+2013-09-03  11:56  Christos Zoulas <christos@zoulas.com>
+
+	* Don't mix errors and regular output if there was an error
+	* in magic_descriptor() don't close the file and try to restore
+	  its position
+
+2013-05-30  17:25  Christos Zoulas <christos@zoulas.com>
+
+	* Don't treat magic as an error if offset was past EOF (Christoph Biedl)
+
+2013-05-28  17:25  Christos Zoulas <christos@zoulas.com>
+	
+	* Fix spacing issues in softmagic and elf (Jan Kaluza)
+
+2013-05-02  18:00  Christos Zoulas <christos@zoulas.com>
+
+	* Fix segmentation fault with multiple magic_load commands.
+
+2013-04-22  11:20  Christos Zoulas <christos@zoulas.com>
+
+	* The way "default" was implemented was not very useful
+	  because the "if something was printed at that level"
+	  was not easily controlled by the user, and the format
+	  was bound to a string which is too restrictive. Add
+	  a "clear" for that level keyword and make "default"
+	  void. This way one can do:
+
+		>>13	clear	x
+		>>13	lelong	1	foo
+		>>13	lelong	2	bar
+		>>13	default	x
+		>>>13	lelong	x	unknown %x
+
+2013-03-25  13:20  Christos Zoulas <christos@zoulas.com>
+
+	* disallow strength setting in "name" entries
+
 2013-03-06  21:24  Christos Zoulas <christos@zoulas.com>
 2013-03-06  21:24  Christos Zoulas <christos@zoulas.com>
 
 
 	* fix recursive magic separator printing
 	* fix recursive magic separator printing

+ 132 - 106
Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -14,23 +14,51 @@
 
 
 @SET_MAKE@
 @SET_MAKE@
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -49,11 +77,11 @@ POST_UNINSTALL = :
 build_triplet = @build@
 build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 subdir = .
 subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
-	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-	TODO compile config.guess config.sub depcomp install-sh \
-	ltmain.sh missing
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/configure $(am__configure_deps) \
+	$(srcdir)/config.h.in AUTHORS COPYING ChangeLog INSTALL NEWS \
+	README TODO compile config.guess config.sub depcomp install-sh \
+	missing ltmain.sh
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -81,13 +109,14 @@ am__v_at_0 = @
 am__v_at_1 = 
 am__v_at_1 = 
 SOURCES =
 SOURCES =
 DIST_SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-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_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-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 \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     n|no|NO) false;; \
@@ -95,9 +124,30 @@ am__can_run_installinfo = \
   esac
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
 	cscope distdir dist dist-all distcheck
 	cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+	$(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 ETAGS = etags
 CTAGS = ctags
 CTAGS = ctags
 CSCOPE = cscope
 CSCOPE = cscope
@@ -162,6 +212,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -186,6 +237,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -213,6 +265,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -246,7 +299,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -305,8 +357,8 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 $(am__aclocal_m4_deps):
 
 
 config.h: stamp-h1
 config.h: stamp-h1
-	@if test ! -f $@; then rm -f stamp-h1; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+	@test -f $@ || rm -f stamp-h1
+	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
 
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	@rm -f stamp-h1
@@ -334,14 +386,13 @@ distclean-libtool:
 # (1) if the variable is set in 'config.status', edit 'config.status'
 # (1) if the variable is set in 'config.status', edit 'config.status'
 #     (which will cause the Makefiles to be regenerated when you run 'make');
 #     (which will cause the Makefiles to be regenerated when you run 'make');
 # (2) otherwise, pass the desired values on the 'make' command line.
 # (2) otherwise, pass the desired values on the 'make' command line.
-$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	target=`echo $@ | sed s/-recursive//`; \
 	case "$@" in \
 	case "$@" in \
@@ -362,31 +413,13 @@ $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
 	if test "$$dot_seen" = "no"; then \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 	fi; test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
-cscopelist-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
-	done
 
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	set x; \
 	here=`pwd`; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -402,12 +435,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	  fi; \
 	done; \
 	done; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -419,15 +447,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	      $$unique; \
 	  fi; \
 	  fi; \
 	fi
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
 	     $$unique
@@ -436,18 +460,16 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
 	  && gtags -i $(GTAGS_ARGS) "$$here"
-
 cscope: cscope.files
 cscope: cscope.files
 	test ! -s cscope.files \
 	test ! -s cscope.files \
 	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
 	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
-
 clean-cscope:
 clean-cscope:
 	-rm -f cscope.files
 	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
 
 
-cscope.files: clean-cscope cscopelist-recursive cscopelist
-
-cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
-	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
 	case "$(srcdir)" in \
 	case "$(srcdir)" in \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
@@ -545,10 +567,16 @@ dist-xz: distdir
 	$(am__post_remove_distdir)
 	$(am__post_remove_distdir)
 
 
 dist-tarZ: distdir
 dist-tarZ: distdir
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__post_remove_distdir)
 	$(am__post_remove_distdir)
 
 
 dist-shar: distdir
 dist-shar: distdir
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 	$(am__post_remove_distdir)
 
 
@@ -750,26 +778,24 @@ ps-am:
 
 
 uninstall-am:
 uninstall-am:
 
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
-	cscopelist-recursive ctags-recursive install-am install-strip \
-	tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am am--refresh check check-am clean clean-cscope \
-	clean-generic clean-libtool cscope cscopelist \
-	cscopelist-recursive ctags ctags-recursive dist dist-all \
-	dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
-	dist-zip distcheck distclean distclean-generic distclean-hdr \
-	distclean-libtool distclean-tags distcleancheck distdir \
-	distuninstallcheck dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am
+.MAKE: $(am__recursive_targets) all install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	clean-libtool cscope cscopelist-am ctags ctags-am dist \
+	dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags distcleancheck \
+	distdir distuninstallcheck dvi dvi-am html html-am info \
+	info-am install install-am install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-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.

+ 5 - 4
README

@@ -1,7 +1,8 @@
 ** README for file(1) Command **
 ** README for file(1) Command **
-@(#) $File: README,v 1.45 2013/01/11 16:51:01 christos Exp $
+@(#) $File: README,v 1.47 2013/06/04 23:15:02 ian Exp $
 
 
 Mailing List: file@mx.gw.com
 Mailing List: file@mx.gw.com
+Mailing List archives: http://mx.gw.com/pipermail/file/
 Bug tracker: http://bugs.gw.com/
 Bug tracker: http://bugs.gw.com/
 E-mail: christos@astron.com
 E-mail: christos@astron.com
 
 
@@ -13,11 +14,11 @@ It knows the 'magic number' of several thousands of file types.
 This version is the standard "file" command for Linux,
 This version is the standard "file" command for Linux,
 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
 *BSD, and other systems. (See "patchlevel.h" for the exact release number).
 
 
-You can download the latest version of file from:
+You can download the latest version of the original sources for file from:
 
 
 	ftp://ftp.astron.com/pub/file/
 	ftp://ftp.astron.com/pub/file/
 
 
-A public read-only git repository is available at:
+A public read-only git repository of the same sources is available at:
 
 
 	https://github.com/glensc/file
 	https://github.com/glensc/file
 
 
@@ -28,7 +29,7 @@ The major feature of 4.x is the refactoring of the code into a library,
 and the re-write of the file command in terms of that library. The library
 and the re-write of the file command in terms of that library. The library
 itself, libmagic can be used by 3rd party programs that wish to identify
 itself, libmagic can be used by 3rd party programs that wish to identify
 file types without having to fork() and exec() file. The prime contributor
 file types without having to fork() and exec() file. The prime contributor
-for 4.0 was M\xe5ns Rullg\xe5rd.
+for 4.0 was Mans Rullgard.
 
 
 UNIX is a trademark of UNIX System Laboratories.
 UNIX is a trademark of UNIX System Laboratories.
 
 

+ 6 - 5
TODO

@@ -9,8 +9,9 @@ listed in the BUGS section of the man page had been fixed!)
 
 
 It would be nice to simplify file considerably. For example,
 It would be nice to simplify file considerably. For example,
 reimplement the apprentice and non-pattern magic methods in Python,
 reimplement the apprentice and non-pattern magic methods in Python,
-and compile the magic patterns to a giant regex (or something similar)
-so that only a small amount of C is needed (because fast execution is
-typically only required for soft magic, not the more detailed
-information given by hard-wired routines). In this regard, note that
-hplip, which is BSD-licensed, has a magic reimplementation in Python.
+and compile the magic patterns to a giant regex (or something similar;
+maybe using Ragel (http://www.complang.org/ragel/)) so that only a
+small amount of C is needed (because fast execution is typically only
+required for soft magic, not the more detailed information given by
+hard-wired routines). In this regard, note that hplip, which is
+BSD-licensed, has a magic reimplementation in Python.

+ 261 - 145
aclocal.m4

@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.12.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.14 -*- Autoconf -*-
 
 
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 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,
@@ -11,6 +11,7 @@
 # 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_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
@@ -19,8 +20,8 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
 
-# visibility.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc.
+# visibility.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 dnl with or without modifications, as long as this notice is preserved.
@@ -33,7 +34,7 @@ dnl __attribute__((__visibility__("hidden"))) and
 dnl __attribute__((__visibility__("default"))).
 dnl __attribute__((__visibility__("default"))).
 dnl Does *not* test for __visibility__("protected") - which has tricky
 dnl Does *not* test for __visibility__("protected") - which has tricky
 dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
 dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
-dnl MacOS X.
+dnl Mac OS X.
 dnl Does *not* test for __visibility__("internal") - which has processor
 dnl Does *not* test for __visibility__("internal") - which has processor
 dnl dependent semantics.
 dnl dependent semantics.
 dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
 dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
@@ -54,7 +55,8 @@ AC_DEFUN([gl_VISIBILITY],
     AC_CACHE_VAL([gl_cv_cc_vis_werror], [
     AC_CACHE_VAL([gl_cv_cc_vis_werror], [
       gl_save_CFLAGS="$CFLAGS"
       gl_save_CFLAGS="$CFLAGS"
       CFLAGS="$CFLAGS -Werror"
       CFLAGS="$CFLAGS -Werror"
-      AC_TRY_COMPILE([], [],
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
         [gl_cv_cc_vis_werror=yes],
         [gl_cv_cc_vis_werror=yes],
         [gl_cv_cc_vis_werror=no])
         [gl_cv_cc_vis_werror=no])
       CFLAGS="$gl_save_CFLAGS"])
       CFLAGS="$gl_save_CFLAGS"])
@@ -72,13 +74,15 @@ AC_DEFUN([gl_VISIBILITY],
       if test $gl_cv_cc_vis_werror = yes; then
       if test $gl_cv_cc_vis_werror = yes; then
         CFLAGS="$CFLAGS -Werror"
         CFLAGS="$CFLAGS -Werror"
       fi
       fi
-      AC_TRY_COMPILE(
-        [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
-         extern __attribute__((__visibility__("default"))) int exportedvar;
-         extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
-         extern __attribute__((__visibility__("default"))) int exportedfunc (void);
-         void dummyfunc (void) {}],
-        [],
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+             extern __attribute__((__visibility__("default"))) int exportedvar;
+             extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+             extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+             void dummyfunc (void) {}
+           ]],
+           [[]])],
         [gl_cv_cc_visibility=yes],
         [gl_cv_cc_visibility=yes],
         [gl_cv_cc_visibility=no])
         [gl_cv_cc_visibility=no])
       CFLAGS="$gl_save_CFLAGS"])
       CFLAGS="$gl_save_CFLAGS"])
@@ -94,7 +98,7 @@ AC_DEFUN([gl_VISIBILITY],
     [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
     [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
 ])
 ])
 
 
-# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+# Copyright (C) 2002-2013 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,
@@ -106,10 +110,10 @@ AC_DEFUN([gl_VISIBILITY],
 # generated from the m4 files accompanying Automake X.Y.
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.12'
+[am__api_version='1.14'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 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.
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.12.4], [],
+m4_if([$1], [1.14], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 ])
 
 
@@ -125,14 +129,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.12.4])dnl
+[AM_AUTOMAKE_VERSION([1.14])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
 
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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,
@@ -185,7 +189,7 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
 
-# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 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,
@@ -216,7 +220,7 @@ 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-2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 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,
@@ -407,7 +411,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
 
-# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 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,
@@ -418,7 +422,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 # ------------------------------
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   # if we detect the quoting.
   case $CONFIG_FILES in
   case $CONFIG_FILES in
@@ -447,7 +451,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
@@ -483,7 +487,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 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,
@@ -492,6 +496,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro actually does too much.  Some checks are only needed if
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 # your package does certain things.  But this isn't really a big deal.
 
 
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
 # -----------------------------------------------
@@ -504,7 +514,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # 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.62])dnl
+[AC_PREREQ([2.65])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
@@ -534,8 +544,7 @@ AC_SUBST([CYGPATH_W])
 dnl Distinguish between old-style and new-style calls.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
 m4_ifval([$2],
 [AC_DIAGNOSE([obsolete],
 [AC_DIAGNOSE([obsolete],
-[$0: two- and three-arguments forms are deprecated.  For more info, see:
-http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
+             [$0: two- and three-arguments forms are deprecated.])
 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
  AC_SUBST([VERSION], [$2])],
@@ -589,22 +598,60 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
 		  [_AM_DEPENDENCIES([OBJC])],
 		  [_AM_DEPENDENCIES([OBJC])],
 		  [m4_define([AC_PROG_OBJC],
 		  [m4_define([AC_PROG_OBJC],
 			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
 			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
-dnl Support for Objective C++ was only introduced in Autoconf 2.65,
-dnl but we still cater to Autoconf 2.62.
-m4_ifdef([AC_PROG_OBJCXX],
-[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
 		  [_AM_DEPENDENCIES([OBJCXX])],
 		  [_AM_DEPENDENCIES([OBJCXX])],
 		  [m4_define([AC_PROG_OBJCXX],
 		  [m4_define([AC_PROG_OBJCXX],
-			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
-dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+  fi
+fi])
 
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
@@ -612,7 +659,6 @@ dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
 m4_define([_AC_COMPILER_EXEEXT],
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 
 
-
 # When config.status generates a header, we must update the stamp-h file.
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
 # This file resides in the same directory as the config header
 # that is generated.  The stamp files are numbered to have different names.
 # that is generated.  The stamp files are numbered to have different names.
@@ -634,7 +680,7 @@ for _am_header in $config_headers :; do
 done
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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,
@@ -655,7 +701,7 @@ if test x"${install_sh}" != xset; then
 fi
 fi
 AC_SUBST([install_sh])])
 AC_SUBST([install_sh])])
 
 
-# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 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,
@@ -676,7 +722,7 @@ AC_SUBST([am__leading_dot])])
 
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
 
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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,
@@ -724,41 +770,9 @@ AC_MSG_RESULT([$_am_result])
 rm -f confinc confmf
 rm -f confinc confmf
 ])
 ])
 
 
-# Copyright (C) 1999-2012 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_PROG_CC_C_O
-# --------------
-# Like AC_PROG_CC_C_O, but changed for automake.
-AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
-dnl Make sure AC_PROG_CC is never called again, or it will override our
-dnl setting of CC.
-m4_define([AC_PROG_CC],
-          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
-])
-
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
 
-# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 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,
@@ -773,8 +787,8 @@ AC_SUBST($1)])
 
 
 # AM_MISSING_HAS_RUN
 # AM_MISSING_HAS_RUN
 # ------------------
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, 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
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -787,8 +801,8 @@ if test x"${MISSING+set}" != xset; then
   esac
   esac
 fi
 fi
 # Use eval to expand $SHELL
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
 else
   am_missing_run=
   am_missing_run=
   AC_MSG_WARN(['missing' script is too old or missing])
   AC_MSG_WARN(['missing' script is too old or missing])
@@ -797,7 +811,7 @@ fi
 
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
 
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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,
@@ -826,9 +840,73 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
 
+# Copyright (C) 1999-2013 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_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 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_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
 
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 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,
@@ -909,7 +987,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 rm -f conftest.file
 ])
 ])
 
 
-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 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,
@@ -969,7 +1047,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 ])
 
 
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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,
@@ -997,7 +1075,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
 
-# Copyright (C) 2006-2012 Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 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,
@@ -1016,7 +1094,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 # Check how to create a tarball.                            -*- Autoconf -*-
 
 
-# Copyright (C) 2004-2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 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,
@@ -1035,76 +1113,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
 AC_DEFUN([_AM_PROG_TAR],
 [# Always define AMTAR for backward compatibility.  Yes, it's still used
 [# Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 # in the wild :-(  We should find a proper way to deprecate it ...
 AC_SUBST([AMTAR], ['$${TAR-tar}'])
 AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of '-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
 
 
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
   rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 ]) # _AM_PROG_TAR

+ 7 - 2
compile

@@ -1,9 +1,9 @@
 #! /bin/sh
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 # Wrapper for compilers which do not understand '-c -o'.
 
 
-scriptversion=2012-03-05.13; # UTC
+scriptversion=2012-10-14.11; # UTC
 
 
-# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 #
 # This program is free software; you can redistribute it and/or modify
 # This program is free software; you can redistribute it and/or modify
@@ -112,6 +112,11 @@ func_cl_dashl ()
       lib=$dir/$lib.lib
       lib=$dir/$lib.lib
       break
       break
     fi
     fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
   done
   done
   IFS=$save_IFS
   IFS=$save_IFS
 
 

+ 143 - 115
config.guess

@@ -1,10 +1,10 @@
 #! /bin/sh
 #! /bin/sh
 # Attempt to guess a canonical system name.
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
 
-timestamp='2009-12-30'
+timestamp='2012-02-10'
 
 
 # This file is free software; you can redistribute it and/or modify it
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
 # under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2009-12-30'
 # General Public License for more details.
 # General Public License for more details.
 #
 #
 # 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
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 #
 # As a special exception to the GNU General Public License, if you
 # 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
@@ -57,8 +55,8 @@ GNU config.guess ($timestamp)
 
 
 Originally written by Per Bothner.
 Originally written by Per Bothner.
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+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
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
 	# object file format.  This provides both forward
@@ -181,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		fi
 		fi
 		;;
 		;;
 	    *)
 	    *)
-	        os=netbsd
+		os=netbsd
 		;;
 		;;
 	esac
 	esac
 	# The OS release
 	# The OS release
@@ -224,7 +222,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 		;;
 	*5.*)
 	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 		;;
 	esac
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -270,7 +268,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Xn.n version is an unreleased experimental baselevel.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -296,7 +297,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo s390-ibm-zvmoe
 	echo s390-ibm-zvmoe
 	exit ;;
 	exit ;;
     *:OS400:*:*)
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+	echo powerpc-ibm-os400
 	exit ;;
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	echo arm-acorn-riscix${UNAME_RELEASE}
@@ -395,23 +396,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
     m68k:machten:*:*)
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
 	exit ;;
@@ -481,8 +482,8 @@ EOF
 	echo m88k-motorola-sysv3
 	echo m88k-motorola-sysv3
 	exit ;;
 	exit ;;
     AViiON:dgux:*:*)
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -495,7 +496,7 @@ EOF
 	else
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	echo m88k-dolphin-sysv3
 	exit ;;
 	exit ;;
@@ -552,7 +553,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 		echo rs6000-ibm-aix3.2
 	fi
 	fi
 	exit ;;
 	exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 		IBM_ARCH=rs6000
@@ -595,52 +596,52 @@ EOF
 	    9000/[678][0-9][0-9])
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
 
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
 
 
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -731,22 +732,22 @@ EOF
 	exit ;;
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
 	echo c1-convex-bsd
-        exit ;;
+	exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	else echo c2-convex-bsd
 	fi
 	fi
-        exit ;;
+	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
 	echo c34-convex-bsd
-        exit ;;
+	exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
 	echo c38-convex-bsd
-        exit ;;
+	exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
 	echo c4-convex-bsd
-        exit ;;
+	exit ;;
     CRAY*Y-MP:*:*:*)
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
 	exit ;;
@@ -770,14 +771,14 @@ EOF
 	exit ;;
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
     5000:UNIX_System_V:4.*:*)
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -789,13 +790,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
 	exit ;;
     *:FreeBSD:*:*)
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	esac
 	exit ;;
 	exit ;;
     i*:CYGWIN*:*)
     i*:CYGWIN*:*)
@@ -804,15 +804,18 @@ EOF
     *:MINGW*:*)
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
     i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
 	exit ;;
     i*:PW*:*)
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
 	exit ;;
     *:Interix*:*)
     *:Interix*:*)
-    	case ${UNAME_MACHINE} in
+	case ${UNAME_MACHINE} in
 	    x86)
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
 		exit ;;
@@ -858,6 +861,13 @@ EOF
     i*86:Minix:*:*)
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     alpha:Linux:*:*)
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -867,7 +877,7 @@ EOF
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
+	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@@ -879,20 +889,29 @@ EOF
 	then
 	then
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
 	fi
 	fi
 	exit ;;
 	exit ;;
     avr32*:Linux:*:*)
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     cris:Linux:*:*)
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
 	exit ;;
     crisv32:Linux:*:*)
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
 	exit ;;
     frv:Linux:*:*)
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     i*86:Linux:*:*)
     i*86:Linux:*:*)
 	LIBC=gnu
 	LIBC=gnu
@@ -934,7 +953,7 @@ EOF
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
 	;;
     or32:Linux:*:*)
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     padre:Linux:*:*)
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
 	echo sparc-unknown-linux-gnu
@@ -960,7 +979,7 @@ EOF
 	echo ${UNAME_MACHINE}-ibm-linux
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
 	exit ;;
     sh64*:Linux:*:*)
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     sh*:Linux:*:*)
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -968,14 +987,17 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     vax:Linux:*:*)
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
 	exit ;;
     x86_64:Linux:*:*)
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     xtensa*:Linux:*:*)
     xtensa*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -984,11 +1006,11 @@ EOF
 	echo i386-sequent-sysv4
 	echo i386-sequent-sysv4
 	exit ;;
 	exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
 	exit ;;
     i*86:OS/2:*:*)
     i*86:OS/2:*:*)
@@ -1020,7 +1042,7 @@ EOF
 	fi
 	fi
 	exit ;;
 	exit ;;
     i*86:*:5:[678]*)
     i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1048,13 +1070,13 @@ EOF
 	exit ;;
 	exit ;;
     pc:*:*:*)
     pc:*:*:*)
 	# Left here for compatibility:
 	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# this is a cross-build.
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	echo i586-pc-msdosdjgpp
-        exit ;;
+	exit ;;
     Intel:Mach:3*:*)
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	echo i386-pc-mach3
 	exit ;;
 	exit ;;
@@ -1089,8 +1111,8 @@ EOF
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	OS_REL='.3'
 	test -r /etc/.relid \
 	test -r /etc/.relid \
@@ -1133,10 +1155,10 @@ EOF
 		echo ns32k-sni-sysv
 		echo ns32k-sni-sysv
 	fi
 	fi
 	exit ;;
 	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
     *:UNIX_System_V:4*:FTX*)
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
 	# How about differentiating between stratus architectures? -djm
@@ -1162,11 +1184,11 @@ EOF
 	exit ;;
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
 	fi
-        exit ;;
+	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	echo powerpc-be-beos
 	exit ;;
 	exit ;;
@@ -1231,6 +1253,9 @@ EOF
     *:QNX:*:4*)
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	echo i386-pc-qnx
 	exit ;;
 	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
     NSE-?:NONSTOP_KERNEL:*:*)
     NSE-?:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
 	exit ;;
@@ -1276,13 +1301,13 @@ EOF
 	echo pdp10-unknown-its
 	echo pdp10-unknown-its
 	exit ;;
 	exit ;;
     SEI:*:*:SEIUX)
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
 	exit ;;
     *:DragonFly:*:*)
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
 	exit ;;
     *:*VMS:*:*)
     *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1300,6 +1325,9 @@ EOF
     i*86:AROS:*:*)
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 esac
 
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1322,11 +1350,11 @@ main ()
 #include <sys/param.h>
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
 #ifdef NEWSOS4
-          "4"
+	"4"
 #else
 #else
-	  ""
+	""
 #endif
 #endif
-         ); exit (0);
+	); exit (0);
 #endif
 #endif
 #endif
 #endif
 
 

+ 6 - 3
config.h.in

@@ -38,6 +38,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 #undef HAVE_FCNTL_H
 
 
+/* Define to 1 if you have the `fmtcheck' function. */
+#undef HAVE_FMTCHECK
+
 /* Define to 1 if you have the `fork' function. */
 /* Define to 1 if you have the `fork' function. */
 #undef HAVE_FORK
 #undef HAVE_FORK
 
 
@@ -101,6 +104,9 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 #undef HAVE_STDLIB_H
 
 
+/* Define to 1 if you have the `strcasestr' function. */
+#undef HAVE_STRCASESTR
+
 /* Define to 1 if you have the `strerror' function. */
 /* Define to 1 if you have the `strerror' function. */
 #undef HAVE_STRERROR
 #undef HAVE_STRERROR
 
 
@@ -222,9 +228,6 @@
    <sysmacros.h>. */
    <sysmacros.h>. */
 #undef MAJOR_IN_SYSMACROS
 #undef MAJOR_IN_SYSMACROS
 
 
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
 /* Name of package */
 /* Name of package */
 #undef PACKAGE
 #undef PACKAGE
 
 

+ 141 - 70
config.sub

@@ -1,10 +1,10 @@
 #! /bin/sh
 #! /bin/sh
 # 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, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
 
-timestamp='2009-12-31'
+timestamp='2012-04-18'
 
 
 # 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
@@ -21,9 +21,7 @@ timestamp='2009-12-31'
 # GNU General Public License for more details.
 # GNU General Public License for more details.
 #
 #
 # 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
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 #
 # As a special exception to the GNU General Public License, if you
 # 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
@@ -76,8 +74,8 @@ version="\
 GNU config.sub ($timestamp)
 GNU config.sub ($timestamp)
 
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+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
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,13 +122,18 @@ 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-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
   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/'`
     ;;
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
     if [ $basic_machine != $1 ]
@@ -157,8 +160,8 @@ case $os in
 		os=
 		os=
 		basic_machine=$1
 		basic_machine=$1
 		;;
 		;;
-        -bluegene*)
-	        os=-cnk
+	-bluegene*)
+		os=-cnk
 		;;
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		os=
@@ -174,10 +177,10 @@ case $os in
 		os=-chorusos
 		os=-chorusos
 		basic_machine=$1
 		basic_machine=$1
 		;;
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 	-hiux*)
 		os=-hiuxwe2
 		os=-hiuxwe2
 		;;
 		;;
@@ -222,6 +225,12 @@ case $os in
 	-isc*)
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 	-lynx*)
 		os=-lynxos
 		os=-lynxos
 		;;
 		;;
@@ -246,17 +255,22 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	1750a | 580 \
 	| a29k \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| 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 | avr32 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| bfin \
 	| c4x | clipper \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -282,29 +296,39 @@ case $basic_machine in
 	| moxie \
 	| moxie \
 	| mt \
 	| mt \
 	| msp430 \
 	| msp430 \
+	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| nios | nios2 \
 	| ns16k | ns32k \
 	| ns16k | ns32k \
+	| open8 \
 	| or32 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		basic_machine=$basic_machine-unknown
 		;;
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		basic_machine=$basic_machine-unknown
 		os=-none
 		os=-none
 		;;
 		;;
@@ -314,6 +338,21 @@ case $basic_machine in
 		basic_machine=mt-unknown
 		basic_machine=mt-unknown
 		;;
 		;;
 
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-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
 	# (2) the word "unknown" tends to confuse beginning users.
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -328,21 +367,25 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	# Recognize the basic CPU types with company name.
 	580-* \
 	580-* \
 	| a29k-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| 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-* | avr32-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -368,25 +411,29 @@ case $basic_machine in
 	| mmix-* \
 	| mmix-* \
 	| mt-* \
 	| mt-* \
 	| msp430-* \
 	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
 	| tron-* \
 	| tron-* \
 	| ubicom32-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| ymp-* \
 	| z8k-* | z80-*)
 	| z8k-* | z80-*)
@@ -411,7 +458,7 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		basic_machine=a29k-amd
 		os=-udi
 		os=-udi
 		;;
 		;;
-    	abacus)
+	abacus)
 		basic_machine=abacus-unknown
 		basic_machine=abacus-unknown
 		;;
 		;;
 	adobe68k)
 	adobe68k)
@@ -481,11 +528,20 @@ case $basic_machine in
 		basic_machine=powerpc-ibm
 		basic_machine=powerpc-ibm
 		os=-cnk
 		os=-cnk
 		;;
 		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	c90)
 	c90)
 		basic_machine=c90-cray
 		basic_machine=c90-cray
 		os=-unicos
 		os=-unicos
 		;;
 		;;
-        cegcc)
+	cegcc)
 		basic_machine=arm-unknown
 		basic_machine=arm-unknown
 		os=-cegcc
 		os=-cegcc
 		;;
 		;;
@@ -517,7 +573,7 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		basic_machine=craynv-cray
 		os=-unicosmp
 		os=-unicosmp
 		;;
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		basic_machine=cr16-unknown
 		os=-elf
 		os=-elf
 		;;
 		;;
@@ -675,7 +731,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		basic_machine=i370-ibm
 		;;
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		os=-sysv32
@@ -733,7 +788,7 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		basic_machine=ns32k-utek
 		os=-sysv
 		os=-sysv
 		;;
 		;;
-        microblaze)
+	microblaze)
 		basic_machine=microblaze-xilinx
 		basic_machine=microblaze-xilinx
 		;;
 		;;
 	mingw32)
 	mingw32)
@@ -772,10 +827,18 @@ case $basic_machine in
 	ms1-*)
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 	mvs)
 		basic_machine=i370-ibm
 		basic_machine=i370-ibm
 		os=-mvs
 		os=-mvs
 		;;
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 	ncr3000)
 		basic_machine=i486-ncr
 		basic_machine=i486-ncr
 		os=-sysv4
 		os=-sysv4
@@ -840,6 +903,12 @@ case $basic_machine in
 	np1)
 	np1)
 		basic_machine=np1-gould
 		basic_machine=np1-gould
 		;;
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		basic_machine=nsr-tandem
 		;;
 		;;
@@ -922,9 +991,10 @@ case $basic_machine in
 		;;
 		;;
 	power)	basic_machine=power-ibm
 	power)	basic_machine=power-ibm
 		;;
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
 		basic_machine=powerpcle-unknown
@@ -1018,6 +1088,9 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		basic_machine=i860-stratus
 		os=-sysv4
 		os=-sysv4
 		;;
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 	sun2)
 		basic_machine=m68000-sun
 		basic_machine=m68000-sun
 		;;
 		;;
@@ -1074,20 +1147,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		basic_machine=t90-cray
 		os=-unicos
 		os=-unicos
 		;;
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
 	tile*)
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		os=-linux-gnu
 		;;
 		;;
 	tx39)
 	tx39)
@@ -1157,6 +1218,9 @@ case $basic_machine in
 	xps | xps100)
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		basic_machine=xps100-honeywell
 		;;
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 	ymp)
 		basic_machine=ymp-cray
 		basic_machine=ymp-cray
 		os=-unicos
 		os=-unicos
@@ -1254,11 +1318,11 @@ esac
 if [ x"$os" != x"" ]
 if [ x"$os" != x"" ]
 then
 then
 case $os in
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
 	# -solaris* is a basic system type, with this one exception.
-        -auroraux)
-	        os=-auroraux
+	-auroraux)
+		os=-auroraux
 		;;
 		;;
 	-solaris1 | -solaris1.*)
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1294,8 +1358,9 @@ case $os in
 	      | -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* | -cegcc* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -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* \
@@ -1342,7 +1407,7 @@ case $os in
 	-opened*)
 	-opened*)
 		os=-openedition
 		os=-openedition
 		;;
 		;;
-        -os400*)
+	-os400*)
 		os=-os400
 		os=-os400
 		;;
 		;;
 	-wince*)
 	-wince*)
@@ -1391,7 +1456,7 @@ case $os in
 	-sinix*)
 	-sinix*)
 		os=-sysv4
 		os=-sysv4
 		;;
 		;;
-        -tpf*)
+	-tpf*)
 		os=-tpf
 		os=-tpf
 		;;
 		;;
 	-triton*)
 	-triton*)
@@ -1436,8 +1501,8 @@ case $os in
 	-dicos*)
 	-dicos*)
 		os=-dicos
 		os=-dicos
 		;;
 		;;
-        -nacl*)
-	        ;;
+	-nacl*)
+		;;
 	-none)
 	-none)
 		;;
 		;;
 	*)
 	*)
@@ -1460,10 +1525,10 @@ 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-*)
+	score-*)
 		os=-elf
 		os=-elf
 		;;
 		;;
-        spu-*)
+	spu-*)
 		os=-elf
 		os=-elf
 		;;
 		;;
 	*-acorn)
 	*-acorn)
@@ -1475,8 +1540,17 @@ case $basic_machine in
 	arm*-semi)
 	arm*-semi)
 		os=-aout
 		os=-aout
 		;;
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
 		;;
 		;;
 	# This must come before the *-dec entry.
 	# This must come before the *-dec entry.
 	pdp10-*)
 	pdp10-*)
@@ -1496,14 +1570,11 @@ case $basic_machine in
 		;;
 		;;
 	m68000-sun)
 	m68000-sun)
 		os=-sunos3
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 		;;
 	m68*-cisco)
 	m68*-cisco)
 		os=-aout
 		os=-aout
 		;;
 		;;
-        mep-*)
+	mep-*)
 		os=-elf
 		os=-elf
 		;;
 		;;
 	mips*-cisco)
 	mips*-cisco)
@@ -1530,7 +1601,7 @@ case $basic_machine in
 	*-ibm)
 	*-ibm)
 		os=-aix
 		os=-aix
 		;;
 		;;
-    	*-knuth)
+	*-knuth)
 		os=-mmixware
 		os=-mmixware
 		;;
 		;;
 	*-wec)
 	*-wec)

File diff suppressed because it is too large
+ 1881 - 993
configure


+ 3 - 3
configure.ac

@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.14],[christos@astron.com])
+AC_INIT([file],[5.17],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 
@@ -136,10 +136,10 @@ else
 fi])
 fi])
 
 
 dnl Checks for functions
 dnl Checks for functions
-AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof)
+AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof fmtcheck)
 
 
 dnl Provide implementation of some required functions if necessary
 dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr)
 
 
 dnl Checks for libraries
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)
 AC_CHECK_LIB(z,gzopen)

+ 215 - 204
depcomp

@@ -1,9 +1,9 @@
 #! /bin/sh
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 # depcomp - compile a program generating dependencies as side-effects
 
 
-scriptversion=2012-07-12.20; # UTC
+scriptversion=2013-05-30.07; # UTC
 
 
-# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 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
@@ -27,9 +27,9 @@ scriptversion=2012-07-12.20; # UTC
 
 
 case $1 in
 case $1 in
   '')
   '')
-     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
   -h | --h*)
   -h | --h*)
     cat <<\EOF
     cat <<\EOF
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -56,11 +56,65 @@ EOF
     ;;
     ;;
 esac
 esac
 
 
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
 # A tabulation character.
 # A tabulation character.
 tab='	'
 tab='	'
 # A newline character.
 # A newline character.
 nl='
 nl='
 '
 '
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
 
 
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -74,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 
 rm -f "$tmpdepfile"
 rm -f "$tmpdepfile"
 
 
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
 # Some modes work just like other modes, but use different flags.  We
 # Some modes work just like other modes, but use different flags.  We
 # parameterize here, but still list the modes in the big case below,
 # parameterize here, but still list the modes in the big case below,
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
@@ -85,32 +142,32 @@ if test "$depmode" = hp; then
 fi
 fi
 
 
 if test "$depmode" = dashXmstdout; then
 if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
 fi
 fi
 
 
 cygpath_u="cygpath -u -f -"
 cygpath_u="cygpath -u -f -"
 if test "$depmode" = msvcmsys; then
 if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvisualcpp
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
 fi
 fi
 
 
 if test "$depmode" = msvc7msys; then
 if test "$depmode" = msvc7msys; then
-   # This is just like msvc7 but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvc7
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
 fi
 fi
 
 
 if test "$depmode" = xlc; then
 if test "$depmode" = xlc; then
-   # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
-   gccflag=-qmakedep=gcc,-MF
-   depmode=gcc
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
 fi
 fi
 
 
 case "$depmode" in
 case "$depmode" in
@@ -133,8 +190,7 @@ gcc3)
   done
   done
   "$@"
   "$@"
   stat=$?
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     rm -f "$tmpdepfile"
     exit $stat
     exit $stat
   fi
   fi
@@ -142,13 +198,17 @@ gcc3)
   ;;
   ;;
 
 
 gcc)
 gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
 ## There are various ways to get dependency output from gcc.  Here's
 ## There are various ways to get dependency output from gcc.  Here's
 ## why we pick this rather obscure method:
 ## why we pick this rather obscure method:
 ## - Don't want to use -MD because we'd like the dependencies to end
 ## - Don't want to use -MD because we'd like the dependencies to end
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   (We might end up doing this anyway to support other compilers.)
 ##   (We might end up doing this anyway to support other compilers.)
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
 ## - Using -M directly means running the compiler twice (even worse
 ## - Using -M directly means running the compiler twice (even worse
 ##   than renaming).
 ##   than renaming).
   if test -z "$gccflag"; then
   if test -z "$gccflag"; then
@@ -156,15 +216,14 @@ gcc)
   fi
   fi
   "$@" -Wp,"$gccflag$tmpdepfile"
   "$@" -Wp,"$gccflag$tmpdepfile"
   stat=$?
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     rm -f "$tmpdepfile"
     exit $stat
     exit $stat
   fi
   fi
   rm -f "$depfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
   sed -e 's/^[^:]*: / /' \
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
 ## This next piece of magic avoids the "deleted header file" problem.
 ## This next piece of magic avoids the "deleted header file" problem.
@@ -173,15 +232,15 @@ gcc)
 ## typically no way to rebuild the header).  We avoid this by adding
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
 ## this for us directly.
-  tr ' ' "$nl" < "$tmpdepfile" |
 ## Some versions of gcc put a space before the ':'.  On the theory
 ## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
 ## that the space means something, we add a space to the output as
 ## well.  hp depmode also adds that space, but also prefixes the VPATH
 ## well.  hp depmode also adds that space, but also prefixes the VPATH
 ## to the object.  Take care to not repeat it in the output.
 ## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
-      | sed -e 's/$/ :/' >> "$depfile"
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
@@ -199,8 +258,7 @@ sgi)
     "$@" -MDupdate "$tmpdepfile"
     "$@" -MDupdate "$tmpdepfile"
   fi
   fi
   stat=$?
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     rm -f "$tmpdepfile"
     exit $stat
     exit $stat
   fi
   fi
@@ -208,7 +266,6 @@ sgi)
 
 
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
     echo "$object : \\" > "$depfile"
     echo "$object : \\" > "$depfile"
-
     # Clip off the initial element (the dependent).  Don't try to be
     # Clip off the initial element (the dependent).  Don't try to be
     # clever and replace this with sed code, as IRIX sed won't handle
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # lines with more than a fixed number of characters (4096 in
@@ -216,19 +273,15 @@ sgi)
     # the IRIX cc adds comments like '#:fec' to the end of the
     # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
     # dependency line.
     tr ' ' "$nl" < "$tmpdepfile" \
     tr ' ' "$nl" < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr "$nl" ' ' >> "$depfile"
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
     echo >> "$depfile"
-
     # The second pass generates a dummy entry for each header file.
     # The second pass generates a dummy entry for each header file.
     tr ' ' "$nl" < "$tmpdepfile" \
     tr ' ' "$nl" < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
   else
   else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   fi
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
@@ -246,9 +299,8 @@ aix)
   # current directory.  Also, the AIX compiler puts '$object:' at the
   # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.u
     tmpdepfile1=$dir$base.u
     tmpdepfile2=$base.u
     tmpdepfile2=$base.u
@@ -261,9 +313,7 @@ aix)
     "$@" -M
     "$@" -M
   fi
   fi
   stat=$?
   stat=$?
-
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
     exit $stat
   fi
   fi
@@ -272,65 +322,37 @@ aix)
   do
   do
     test -f "$tmpdepfile" && break
     test -f "$tmpdepfile" && break
   done
   done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form 'foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # '$object: dependent.h' and one to simply 'dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
+  aix_post_process_depfile
   ;;
   ;;
 
 
-icc)
-  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
-  # However on
-  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using '\':
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-  # tcc 0.9.26 (FIXME still under development at the moment of writing)
-  # will emit a similar output, but also prepend the continuation lines
-  # with horizontal tabulation characters.
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
   "$@" -MD -MF "$tmpdepfile"
   "$@" -MD -MF "$tmpdepfile"
   stat=$?
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     rm -f "$tmpdepfile"
     exit $stat
     exit $stat
   fi
   fi
   rm -f "$depfile"
   rm -f "$depfile"
-  # Each line is of the form 'foo.o: dependent.h',
-  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # '$object: dependent.h' and one to simply 'dependent.h:'.
-  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
-    < "$tmpdepfile" > "$depfile"
-  sed '
-    s/[ '"$tab"'][ '"$tab"']*/ /g
-    s/^ *//
-    s/ *\\*$//
-    s/^[^:]*: *//
-    /^$/d
-    /:$/d
-    s/$/ :/
-  ' < "$tmpdepfile" >> "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
@@ -349,34 +371,37 @@ pgcc)
   #    foo.o: sub/foo.c ... \
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     sub/foo.h ... \
   #     ...
   #     ...
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
+  set_dir_from "$object"
   # Use the source, not the object, to determine the base name, since
   # Use the source, not the object, to determine the base name, since
   # that's sadly what pgcc will do too.
   # that's sadly what pgcc will do too.
-  base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
-  tmpdepfile="$base.d"
+  set_base_from "$source"
+  tmpdepfile=$base.d
 
 
   # For projects that build the same source file twice into different object
   # For projects that build the same source file twice into different object
   # files, the pgcc approach of using the *source* file root name can cause
   # files, the pgcc approach of using the *source* file root name can cause
   # problems in parallel builds.  Use a locking strategy to avoid stomping on
   # problems in parallel builds.  Use a locking strategy to avoid stomping on
   # the same $tmpdepfile.
   # the same $tmpdepfile.
-  lockdir="$base.d-lock"
-  trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
   numtries=100
   numtries=100
   i=$numtries
   i=$numtries
-  while test $i -gt 0 ; do
+  while test $i -gt 0; do
     # mkdir is a portable test-and-set.
     # mkdir is a portable test-and-set.
-    if mkdir $lockdir 2>/dev/null; then
+    if mkdir "$lockdir" 2>/dev/null; then
       # This process acquired the lock.
       # This process acquired the lock.
       "$@" -MD
       "$@" -MD
       stat=$?
       stat=$?
       # Release the lock.
       # Release the lock.
-      rm -rf $lockdir
+      rmdir "$lockdir"
       break
       break
     else
     else
-      ## the lock is being held by a different process,
-      ## wait until the winning process is done or we timeout
-      while test -d $lockdir && test $i -gt 0; do
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
         sleep 1
         sleep 1
         i=`expr $i - 1`
         i=`expr $i - 1`
       done
       done
@@ -402,8 +427,8 @@ pgcc)
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # correctly.  Breaking it into two sed invocations is a workaround.
   # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
@@ -414,9 +439,8 @@ hp2)
   # 'foo.d', which lands next to the object file, wherever that
   # 'foo.d', which lands next to the object file, wherever that
   # happens to be.
   # happens to be.
   # Much of this is similar to the tru64 case; see comments there.
   # 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$//'`
+  set_dir_from  "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.d
     tmpdepfile1=$dir$base.d
     tmpdepfile2=$dir.libs/$base.d
     tmpdepfile2=$dir.libs/$base.d
@@ -427,8 +451,7 @@ hp2)
     "$@" +Maked
     "$@" +Maked
   fi
   fi
   stat=$?
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
      exit $stat
   fi
   fi
@@ -438,76 +461,61 @@ hp2)
     test -f "$tmpdepfile" && break
     test -f "$tmpdepfile" && break
   done
   done
   if test -f "$tmpdepfile"; then
   if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add 'dependent.h:' lines.
     # Add 'dependent.h:' lines.
     sed -ne '2,${
     sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
   else
   else
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   fi
   rm -f "$tmpdepfile" "$tmpdepfile2"
   rm -f "$tmpdepfile" "$tmpdepfile2"
   ;;
   ;;
 
 
 tru64)
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in 'foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # 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.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # 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
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # 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
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
 
 
 msvc7)
 msvc7)
   if test "$libtool" = yes; then
   if test "$libtool" = yes; then
@@ -518,8 +526,7 @@ msvc7)
   "$@" $showIncludes > "$tmpdepfile"
   "$@" $showIncludes > "$tmpdepfile"
   stat=$?
   stat=$?
   grep -v '^Note: including file: ' "$tmpdepfile"
   grep -v '^Note: including file: ' "$tmpdepfile"
-  if test "$stat" = 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     rm -f "$tmpdepfile"
     exit $stat
     exit $stat
   fi
   fi
@@ -545,6 +552,7 @@ $ {
   G
   G
   p
   p
 }' >> "$depfile"
 }' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
@@ -596,13 +604,14 @@ dashmstdout)
   # in the target name.  This is to cope with DOS-style filenames:
   # in the target name.  This is to cope with DOS-style filenames:
   # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
   "$@" $dashmflag |
-    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
   rm -f "$depfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' "$nl" < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   rm -f "$tmpdepfile"
   ;;
   ;;
 
 
@@ -655,10 +664,12 @@ makedepend)
   # makedepend may prepend the VPATH from the source file name to the object.
   # makedepend may prepend the VPATH from the source file name to the object.
   # No need to regex-escape $object, excess matching of '.' is harmless.
   # No need to regex-escape $object, excess matching of '.' is harmless.
   sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
   sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   ;;
   ;;
 
 
@@ -694,10 +705,10 @@ cpp)
     esac
     esac
   done
   done
 
 
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -729,15 +740,15 @@ msvisualcpp)
       shift
       shift
       ;;
       ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
+        set fnord "$@"
+        shift
+        shift
+        ;;
     *)
     *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
     esac
     esac
   done
   done
   "$@" -E 2>/dev/null |
   "$@" -E 2>/dev/null |

+ 63 - 47
doc/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -14,23 +14,51 @@
 
 
 @SET_MAKE@
 @SET_MAKE@
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -49,7 +77,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 subdir = doc
 subdir = doc
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -115,6 +143,7 @@ man4dir = $(mandir)/man4
 man5dir = $(mandir)/man5
 man5dir = $(mandir)/man5
 NROFF = nroff
 NROFF = nroff
 MANS = $(man_MANS)
 MANS = $(man_MANS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 pkgdatadir = @pkgdatadir@
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
@@ -134,6 +163,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -158,6 +188,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -185,6 +216,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -218,7 +250,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -451,29 +482,14 @@ uninstall-man5:
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
 	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
 	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
 
 
-ctags: CTAGS
-CTAGS:
+ctags CTAGS:
 
 
 cscope cscopelist:
 cscope cscopelist:
 
 
 
 
 distdir: $(DISTFILES)
 distdir: $(DISTFILES)
-	@list='$(MANS)'; if test -n "$$list"; then \
-	  list=`for p in $$list; do \
-	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
-	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
-	  if test -n "$$list" && \
-	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
-	    echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
-	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
-	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
-	    echo "       typically 'make maintainer-clean' will remove them" >&2; \
-	    exit 1; \
-	  else :; fi; \
-	else :; fi
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
 	list='$(DISTFILES)'; \
@@ -613,18 +629,18 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
 .MAKE: install-am install-strip
 .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 \
-	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-man1 \
-	install-man3 install-man4 install-man5 install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-man uninstall-man1 uninstall-man3 uninstall-man4 \
-	uninstall-man5
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir 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-man1 install-man3 install-man4 install-man5 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags-am uninstall uninstall-am uninstall-man uninstall-man1 \
+	uninstall-man3 uninstall-man4 uninstall-man5
 
 
 
 
 file.1:	Makefile file.man
 file.1:	Makefile file.man

+ 12 - 5
doc/file.man

@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.102 2013/01/04 15:39:22 christos Exp $
-.Dd October 25, 2012
+.\" $File: file.man,v 1.105 2014/01/31 01:57:00 christos Exp $
+.Dd January 30, 2014
 .Dt FILE __CSECTION__
 .Dt FILE __CSECTION__
 .Os
 .Os
 .Sh NAME
 .Sh NAME
@@ -8,7 +8,7 @@
 .Sh SYNOPSIS
 .Sh SYNOPSIS
 .Nm
 .Nm
 .Bk -words
 .Bk -words
-.Op Fl bchiklLNnprsvz0
+.Op Fl bcEhiklLNnprsvz0
 .Op Fl Fl apple
 .Op Fl Fl apple
 .Op Fl Fl mime-encoding
 .Op Fl Fl mime-encoding
 .Op Fl Fl mime-type
 .Op Fl Fl mime-type
@@ -175,6 +175,10 @@ Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with the
 This is usually used in conjunction with the
 .Fl m
 .Fl m
 flag to debug a new magic file before installing it.
 flag to debug a new magic file before installing it.
+.It Fl E
+On filesystem errors (file not found etc), instead of handling the error
+as regular output as POSIX mandates and keep going, issue an error message
+and exit.
 .It Fl e , Fl Fl exclude Ar testname
 .It Fl e , Fl Fl exclude Ar testname
 Exclude the test named in
 Exclude the test named in
 .Ar testname
 .Ar testname
@@ -331,7 +335,7 @@ after the end of the filename.
 Nice to
 Nice to
 .Xr cut 1
 .Xr cut 1
 the output.
 the output.
-This does not affect the separator which is still printed.
+This does not affect the separator, which is still printed.
 .It Fl -help
 .It Fl -help
 Print a help message and exit.
 Print a help message and exit.
 .El
 .El
@@ -553,7 +557,10 @@ returns 0 on success, and non-zero on error.
 Please report bugs and send patches to the bug tracker at
 Please report bugs and send patches to the bug tracker at
 .Pa http://bugs.gw.com/
 .Pa http://bugs.gw.com/
 or the mailing list at
 or the mailing list at
-.Aq file@mx.gw.com .
+.Aq file@mx.gw.com
+(visit
+.Pa http://mx.gw.com/mailman/listinfo/file
+first to subscribe).
 .Sh TODO
 .Sh TODO
 .Pp
 .Pp
 Fix output so that tests for MIME and APPLE flags are not needed all
 Fix output so that tests for MIME and APPLE flags are not needed all

+ 25 - 5
doc/magic.man

@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.78 2013/01/09 13:04:30 christos Exp $
-.Dd January 7, 2013
+.\" $File: magic.man,v 1.79 2013/04/22 15:30:10 christos Exp $
+.Dd April 22, 2013
 .Dt MAGIC __FSECTION__
 .Dt MAGIC __FSECTION__
 .Os
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -261,8 +261,16 @@ The offset works as for regex.
 .It Dv default
 .It Dv default
 This is intended to be used with the test
 This is intended to be used with the test
 .Em x
 .Em x
-(which is always true) and a message that is to be used if there are
-no other matches.
+(which is always true) and it has no type.
+It matches when no other test at that continuation level has matched before.
+Clearing that matched tests for a continuation level, can be done using the
+.Dv clear
+test.
+.It Dv clear
+This test is always true and clears the match flag for that continuation level.
+It is intended to be used with the
+.Dv default
+test.
 .El
 .El
 .Pp
 .Pp
 For compatibility with the Single
 For compatibility with the Single
@@ -605,7 +613,7 @@ Or even both!
 \*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
 \*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
 .Ed
 .Ed
 .Pp
 .Pp
-Finally, if you have to deal with offset/length pairs in your file, even the
+If you have to deal with offset/length pairs in your file, even the
 second value in a parenthesized expression can be taken from the file itself,
 second value in a parenthesized expression can be taken from the file itself,
 using another set of parentheses.
 using another set of parentheses.
 Note that this additional indirect offset is always relative to the
 Note that this additional indirect offset is always relative to the
@@ -620,6 +628,18 @@ start of the main indirect offset.
 # these are located 14 and 10 bytes after the section name
 # these are located 14 and 10 bytes after the section name
 \*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
 \*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
 .Ed
 .Ed
+.Pp
+If you have a list of known avalues at a particular continuation level,
+and you want to provide a switch-like default case:
+.Bd -literal -offset indent
+# clear that continuation level match
+\*[Gt]18	clear
+\*[Gt]18	lelong	1	one
+\*[Gt]18	lelong	2	two
+\*[Gt]18	default	x
+# print default match
+\*[Gt]\*[Gt]18	lelong	x	unmatched 0x%x
+.Ed
 .Sh SEE ALSO
 .Sh SEE ALSO
 .Xr file __CSECTION__
 .Xr file __CSECTION__
 \- the command that reads this file.
 \- the command that reads this file.

File diff suppressed because it is too large
+ 2637 - 1383
ltmain.sh


File diff suppressed because it is too large
+ 1437 - 812
m4/libtool.m4


+ 24 - 8
m4/ltoptions.m4

@@ -1,13 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
 #
-#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
 #   Written by Gary V. Vaughan, 2004
 #   Written by Gary V. Vaughan, 2004
 #
 #
 # This file is free software; the Free Software Foundation gives
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 # modifications, as long as this notice is preserved.
 
 
-# serial 6 ltoptions.m4
+# serial 7 ltoptions.m4
 
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 [enable_win32_dll=yes
 
 
 case $host in
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
@@ -133,13 +134,13 @@ case $host in
 esac
 esac
 
 
 test -z "$AS" && AS=as
 test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [0], [Assembler program])dnl
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
 
 
 test -z "$DLLTOOL" && DLLTOOL=dlltool
 test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
 
 
 test -z "$OBJDUMP" && OBJDUMP=objdump
 test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
 ])# win32-dll
 ])# win32-dll
 
 
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
@@ -325,9 +326,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 m4_define([_LT_WITH_PIC],
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
 [AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
 	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
 	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
     [pic_mode=default])
     [pic_mode=default])
 
 
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])

+ 6 - 6
m4/ltversion.m4

@@ -7,17 +7,17 @@
 # unlimited permission to copy and/or distribute it, with or without
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 # modifications, as long as this notice is preserved.
 
 
-# Generated from ltversion.in.
+# @configure_input@
 
 
-# serial 3017 ltversion.m4
+# serial 3337 ltversion.m4
 # This file is part of GNU Libtool
 # This file is part of GNU Libtool
 
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6b])
-m4_define([LT_PACKAGE_REVISION], [1.3017])
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
 
 
 AC_DEFUN([LTVERSION_VERSION],
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6b'
-macro_revision='1.3017'
+[macro_version='2.4.2'
+macro_revision='1.3337'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 _LT_DECL(, macro_revision, 0)
 ])
 ])

+ 9 - 3
m4/lt~obsolete.m4

@@ -1,13 +1,13 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #   Written by Scott James Remnant, 2004.
 #
 #
 # This file is free software; the Free Software Foundation gives
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 # modifications, as long as this notice is preserved.
 
 
-# serial 4 lt~obsolete.m4
+# serial 5 lt~obsolete.m4
 
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
 #
@@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
 m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
 m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
 m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
 m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
 m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
 m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
 m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
 m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
@@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
 m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])

+ 1 - 1
magic/Localstuff

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

+ 100 - 0
magic/Magdir/android

@@ -0,0 +1,100 @@
+
+#------------------------------------------------------------
+# $File: android,v 1.3 2013/11/08 01:24:22 christos Exp $
+# Various android related magic entries
+#------------------------------------------------------------
+
+# Dalvik .dex format. http://retrodev.com/android/dexformat.html
+# From <mkf@google.com> "Mike Fleming"
+# Fixed to avoid regexec 17 errors on some dex files
+# From <diff@lookout.com> "Tim Strazzere"
+0	string	dex\n
+>0	regex	dex\n[0-9]{2}\0	Dalvik dex file
+>4	string	>000			version %s
+0	string	dey\n
+>0	regex	dey\n[0-9]{2}\0	Dalvik dex file (optimized for host)
+>4	string	>000			version %s
+
+# http://android.stackexchange.com/questions/23357/\
+# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\
+# 23608#23608
+0	string	ANDROID\040BACKUP\n	Android Backup
+>15	string	1\n			\b, version 1
+>17	string	0\n			\b, uncompressed
+>17	string	1\n			\b, compressed
+>19	string	none\n			\b, unencrypted
+>19	string	AES-256\n		\b, encrypted AES-256
+
+# Android bootimg format
+# From https://android.googlesource.com/\
+# platform/system/core/+/master/mkbootimg/bootimg.h
+0		string	ANDROID!	Android bootimg
+>8		lelong	>0			\b, kernel
+>>12	lelong	>0			\b (0x%x)
+>16		lelong	>0			\b, ramdisk
+>>20	lelong	>0			\b (0x%x)
+>24		lelong	>0			\b, second stage
+>>28	lelong	>0			\b (0x%x)
+>36		lelong	>0			\b, page size: %d
+>38		string	>0			\b, name: %s
+>64		string	>0		 	\b, cmdline (%s)
+# Dalvik .dex format. http://retrodev.com/android/dexformat.html
+# From <mkf@google.com> "Mike Fleming"
+# Fixed to avoid regexec 17 errors on some dex files
+# From <diff@lookout.com> "Tim Strazzere"
+0	string	dex\n
+>0	regex	dex\n[0-9]{2}\0	Dalvik dex file
+>4	string	>000			version %s
+0	string	dey\n
+>0	regex	dey\n[0-9]{2}\0	Dalvik dex file (optimized for host)
+>4	string	>000			version %s
+
+# http://android.stackexchange.com/questions/23357/\
+# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\
+# 23608#23608
+0	string	ANDROID\040BACKUP\n	Android Backup
+>15	string	1\n			\b, version 1
+>17	string	0\n			\b, uncompressed
+>17	string	1\n			\b, compressed
+>19	string	none\n			\b, unencrypted
+>19	string	AES-256\n		\b, encrypted AES-256
+
+# Android bootimg format
+# From https://android.googlesource.com/\
+# platform/system/core/+/master/mkbootimg/bootimg.h
+0		string	ANDROID!	Android bootimg
+>8		lelong	>0			\b, kernel
+>>12	lelong	>0			\b (0x%x)
+>16		lelong	>0			\b, ramdisk
+>>20	lelong	>0			\b (0x%x)
+>24		lelong	>0			\b, second stage
+>>28	lelong	>0			\b (0x%x)
+>36		lelong	>0			\b, page size: %d
+>38		string	>0			\b, name: %s
+>64		string	>0		 	\b, cmdline (%s)
+
+# Android Backup archive
+# From: Ariel Shkedi
+# File extension: .ab
+# No mime-type defined
+# URL: https://github.com/android/platform_frameworks_base/blob/\
+# 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\
+# android/server/BackupManagerService.java#L2367
+# After the header comes a tar file
+# If compressed, the entire tar file is compressed with JAVA deflate
+#
+# Include the version number hardcoded with the magic string to avoid
+# false positives
+0	string/b	ANDROID\ BACKUP\n1\n	Android Backup
+>17	string		0\n			\b, Not-Compressed
+>17	string		1\n			\b, Compressed
+# any string as long as it's not the word none (which is matched below)
+>>19    regex/1		\^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).*	\b, Encrypted (%s)
+>>19	string		none\n			\b, Not-Encrypted
+# Commented out because they don't seem useful to print
+# (but they are part of the header - the tar file comes after them):
+#>>>&1		regex/1 .*	\b, Password salt: %s
+#>>>>&1		regex/1 .*	\b, Master salt: %s
+#>>>>>&1	regex/1 .*	\b, PBKDF2 rounds: %s
+#>>>>>>&1	regex/1 .*	\b, IV: %s
+#>>>>>>>&1	regex/1 .*	\b, Key: %s

+ 2 - 2
magic/Magdir/animation

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: animation,v 1.48 2013/03/09 22:36:00 christos Exp $
+# $File: animation,v 1.49 2013/08/15 13:15:11 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 # animation:  file(1) magic for animation/movie formats
 #
 #
 # animation formats
 # animation formats
@@ -802,7 +802,7 @@
 !:mime	video/mp4v-es
 !:mime	video/mp4v-es
 0       belong             0x000001B3
 0       belong             0x000001B3
 !:mime	video/mpv
 !:mime	video/mpv
-0       belong&0xFF5FFF1F  0x47400010
+0       belong&0xFF5FFF10  0x47400010
 !:mime	video/mp2t
 !:mime	video/mp2t
 0       belong             0x00000001
 0       belong             0x00000001
 >4      byte&0x1F	   0x07
 >4      byte&0x1F	   0x07

+ 4 - 4
magic/Magdir/archive

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: archive,v 1.79 2013/02/08 17:24:06 christos Exp $
+# $File: archive,v 1.81 2014/01/08 22:27:31 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #           extracting compressed archives)
 #
 #
@@ -679,7 +679,7 @@
 #  EPUB (OEBPS) books using OCF (OEBPS Container Format)
 #  EPUB (OEBPS) books using OCF (OEBPS Container Format)
 #    http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
 #    http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
 #    From: Ralf Brown <ralf.brown@gmail.com>
 #    From: Ralf Brown <ralf.brown@gmail.com>
->0x1E	string	mimetypeapplication/epub+zip	EPUB document
+>>50	string	epub+zip	EPUB document
 !:mime application/epub+zip
 !:mime application/epub+zip
 
 
 #  Catch other ZIP-with-mimetype formats
 #  Catch other ZIP-with-mimetype formats
@@ -701,8 +701,8 @@
 !:mime	application/zip
 !:mime	application/zip
 
 
 # Java Jar files
 # Java Jar files
->(26.s+30)	leshort	0xcafe		Java Jar file data (zip)
-!:mime	application/jar
+>(26.s+30)	leshort	0xcafe		Java archive data (JAR)
+!:mime	application/java-archive
 
 
 # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 #   Next line excludes specialized formats:
 #   Next line excludes specialized formats:

+ 8 - 8
magic/Magdir/assembler

@@ -1,18 +1,18 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: assembler,v 1.4 2013/01/04 23:31:11 christos Exp $
+# $File: assembler,v 1.6 2013/12/11 14:14:20 christos Exp $
 # make:  file(1) magic for assembler source
 # make:  file(1) magic for assembler source
 #
 #
-0	regex	\^[\020\t]*\\.asciiz		assembler source text
+0	regex	\^[\040\t]{0,50}\\.asciiz		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.byte		assembler source text
+0	regex	\^[\040\t]{0,50}\\.byte		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.even		assembler source text
+0	regex	\^[\040\t]{0,50}\\.even		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.globl		assembler source text
+0	regex	\^[\040\t]{0,50}\\.globl		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.text		assembler source text
+0	regex	\^[\040\t]{0,50}\\.text		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.file		assembler source text
+0	regex	\^[\040\t]{0,50}\\.file		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm
-0	regex	\^[\020\t]*\\.type		assembler source text
+0	regex	\^[\040\t]{0,50}\\.type		assembler source text
 !:mime	text/x-asm
 !:mime	text/x-asm

+ 64 - 1
magic/Magdir/audio

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: audio,v 1.66 2013/02/06 14:18:52 christos Exp $
+# $File: audio,v 1.68 2013/12/02 13:32:26 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -637,3 +637,66 @@
 # URL:  http://wiki.multimedia.cx/index.php?title=WavPack
 # URL:  http://wiki.multimedia.cx/index.php?title=WavPack
 # From: Mike Melanson <mike@multimedia.cx>
 # From: Mike Melanson <mike@multimedia.cx>
 0	string	wvpk	WavPack Lossless Audio
 0	string	wvpk	WavPack Lossless Audio
+
+# From Fábio R. Schmidlin <frs@pop.com.br>
+# VGM music file
+0	string		Vgm\ 
+>9	ubyte		>0	VGM Video Game Music dump v
+>>9	ubyte/16	>0	\b%d
+>>9	ubyte&0x0F	x	\b%d
+>>8	ubyte/16	x	\b.%d
+>>8	ubyte&0x0F	>0	\b%d
+#Get soundchips
+>>8	ubyte		x	\b, soundchip(s)=
+>>0x0C	ulelong		>0	SN76489,
+>>0x10	ulelong		>0	YM2413,
+>>0x2C	ulelong		>0	YM2612,
+>>0x30	ulelong		>0	YM2151,
+>>0x38	ulelong		>0	Sega PCM,
+>>0x34	ulelong		>0xC
+>>>0x40	ulelong		>0	RF5C68,
+>>0x34	ulelong		>0x10
+>>>0x44	ulelong		>0	YM2203,
+>>0x34	ulelong		>0x14
+>>>0x48	ulelong		>0	YM2608,
+>>0x34	ulelong		>0x18
+>>>0x4C	lelong		>0	YM2610,
+>>>0x4C	lelong		<0	YM2610B,
+>>0x34	ulelong		>0x1C
+>>>0x50	ulelong		>0	YM3812,
+>>0x34	ulelong		>0x20
+>>>0x54	ulelong		>0	YM3526,
+>>0x34	ulelong		>0x24
+>>>0x58	ulelong		>0	Y8950,
+>>0x34	ulelong		>0x28
+>>>0x5C	ulelong		>0	YMF262,
+>>0x34	ulelong		>0x2C
+>>>0x60	ulelong		>0	YMF278B,
+>>0x34	ulelong		>0x30
+>>>0x64	ulelong		>0	YMF271,
+>>0x34	ulelong		>0x34
+>>>0x68	ulelong		>0	YMZ280B,
+>>0x34	ulelong		>0x38
+>>>0x6C	ulelong		>0	RF5C164,
+>>0x34	ulelong		>0x3C
+>>>0x70	ulelong		>0	PWM,
+>>0x34	ulelong		>0x40
+>>>0x74	ulelong		>0
+>>>>0x78 ubyte		0x00	AY-3-8910,
+>>>>0x78 ubyte		0x01	AY-3-8912,
+>>>>0x78 ubyte		0x02	AY-3-8913,
+>>>>0x78 ubyte		0x03	AY-3-8930,
+>>>>0x78 ubyte		0x10	YM2149,
+>>>>0x78 ubyte		0x11	YM3439,
+
+# GVOX Encore file format
+# Since this is a proprietary file format and there is no publicly available
+# format specification, this is just based on induction
+#
+0	string	SCOW
+>4	byte	0xc4	GVOX Encore music, version 5.0 or above
+>4	byte	0xc2	GVOX Encore music, version < 5.0
+
+0	string	ZBOT
+>4	byte	0xc5	GVOX Encore music, version < 5.0
+

+ 8 - 0
magic/Magdir/blackberry

@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: blackberry,v 1.1 2014/01/31 01:51:32 christos Exp $
+# blackberry:  file(1) magic for BlackBerry file formats
+#
+5	belong	0		
+>8	belong  010010010	BlackBerry RIM ETP file
+>>22	string	x		\b for %s

+ 10 - 10
magic/Magdir/c-lang

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.17 2012/04/28 21:20:26 christos Exp $
+# $File: c-lang,v 1.18 2013/08/14 13:06:43 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 # c-lang:  file(1) magic for C and related languages programs
 #
 #
 
 
@@ -12,30 +12,30 @@
 # C
 # C
 0	regex	\^#include	C source text
 0	regex	\^#include	C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^char		C source text
+0	regex	\^char[\ \t\n]+	C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^double		C source text
+0	regex	\^double[\ \t\n]+		C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^extern		C source text
+0	regex	\^extern[\ \t\n]+		C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^float		C source text
+0	regex	\^float[\ \t\n]+		C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^struct		C source text
+0	regex	\^struct[\ \t\n]+		C source text
 !:mime	text/x-c
 !:mime	text/x-c
-0	regex	\^union		C source text
+0	regex	\^union[\ \t\n]+		C source text
 !:mime	text/x-c
 !:mime	text/x-c
 0	search/8192	main(		C source text
 0	search/8192	main(		C source text
 !:mime	text/x-c
 !:mime	text/x-c
 
 
 # C++
 # C++
 # The strength of these rules is increased so they beat the C rules above
 # The strength of these rules is increased so they beat the C rules above
-0	regex	\^template	C++ source text
+0	regex	\^template[\ \t\n]+	C++ source text
 !:strength + 5
 !:strength + 5
 !:mime	text/x-c++
 !:mime	text/x-c++
-0	regex	\^virtual		C++ source text
+0	regex	\^virtual[\ \t\n]+		C++ source text
 !:strength + 5
 !:strength + 5
 !:mime	text/x-c++
 !:mime	text/x-c++
-0	regex	\^class		C++ source text
+0	regex	\^class[\ \t\n]+		C++ source text
 !:strength + 5
 !:strength + 5
 !:mime	text/x-c++
 !:mime	text/x-c++
 0	regex	\^public:		C++ source text
 0	regex	\^public:		C++ source text

+ 50 - 17
magic/Magdir/cad

@@ -1,16 +1,9 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: cad,v 1.11 2011/12/08 12:12:46 rrt Exp $
+# $File: cad,v 1.12 2013/07/04 15:24:37 christos Exp $
 # autocad:  file(1) magic for cad files
 # autocad:  file(1) magic for cad files
 #
 #
 
 
-# AutoCAD DWG versions R13/R14 (www.autodesk.com)
-# Written December 01, 2003 by Lester Hightower
-# Based on the DWG File Format Specifications at http://www.opendwg.org/
-0	string	       \101\103\061\060\061		   AutoCAD
->5	string	       \062\000\000\000\000		   DWG ver. R13
->5	string	       \064\000\000\000\000		   DWG ver. R14
-
 # Microstation DGN/CIT Files (www.bentley.com)
 # Microstation DGN/CIT Files (www.bentley.com)
 # Last updated July 29, 2005 by Lester Hightower
 # Last updated July 29, 2005 by Lester Hightower
 # DGN is the default file extension of Microstation/Intergraph CAD files.
 # DGN is the default file extension of Microstation/Intergraph CAD files.
@@ -49,19 +42,62 @@
 >4	string	\030\000\000			CITFile
 >4	string	\030\000\000			CITFile
 >4	string	\030\000\003			CITFile
 >4	string	\030\000\003			CITFile
 
 
+# AutoCAD 
+# Merge of the different contributions and updates from http://en.wikipedia.org/wiki/Dwg
+# and http://www.iana.org/assignments/media-types/image/vnd.dwg
+0	string	MC0.0	DWG AutoDesk AutoCAD Release 1.0
+!:mime image/vnd.dwg
+0	string	AC1.2	DWG AutoDesk AutoCAD Release 1.2
+!:mime image/vnd.dwg
+0	string	AC1.3	DWG AutoDesk AutoCAD Release 1.3
+!:mime image/vnd.dwg
+0	string	AC1.40	DWG AutoDesk AutoCAD Release 1.40
+!:mime image/vnd.dwg
+0	string	AC1.50	DWG AutoDesk AutoCAD Release 2.05
+!:mime image/vnd.dwg
+0	string	AC2.10	DWG AutoDesk AutoCAD Release 2.10
+!:mime image/vnd.dwg
+0	string	AC2.21	DWG AutoDesk AutoCAD Release 2.21
+!:mime image/vnd.dwg
+0	string	AC2.22	DWG AutoDesk AutoCAD Release 2.22
+!:mime image/vnd.dwg
+0	string	AC1001	DWG AutoDesk AutoCAD Release 2.22
+!:mime image/vnd.dwg
+0	string	AC1002	DWG AutoDesk AutoCAD Release 2.50
+!:mime image/vnd.dwg
+0	string	AC1003	DWG AutoDesk AutoCAD Release 2.60
+!:mime image/vnd.dwg
+0	string	AC1004	DWG AutoDesk AutoCAD Release 9
+!:mime image/vnd.dwg
+0	string	AC1006	DWG AutoDesk AutoCAD Release 10
+!:mime image/vnd.dwg
+0	string	AC1009	DWG AutoDesk AutoCAD Release 11/12
+!:mime image/vnd.dwg
+# AutoCAD DWG versions R13/R14 (www.autodesk.com)
+# Written December 01, 2003 by Lester Hightower
+# Based on the DWG File Format Specifications at http://www.opendwg.org/
 # AutoCad, from Nahuel Greco
 # AutoCad, from Nahuel Greco
 # AutoCAD DWG versions R12/R13/R14 (www.autodesk.com)
 # AutoCAD DWG versions R12/R13/R14 (www.autodesk.com)
-0	string	AC1012		DWG AutoDesk AutoCad (release 12)
-0	string	AC1013		DWG AutoDesk AutoCad (release 13)
-0	string	AC1014		DWG AutoDesk AutoCad (release 14)
+0	string	AC1012	DWG AutoDesk AutoCAD Release 13
+!:mime image/vnd.dwg
+0	string	AC1014	DWG AutoDesk AutoCAD Release 14
+!:mime image/vnd.dwg
+0	string	AC1015	DWG AutoDesk AutoCAD 2000/2002
+!:mime image/vnd.dwg
+
 # A new version of AutoCAD DWG
 # A new version of AutoCAD DWG
 # Sergey Zaykov (mail_of_sergey@mail.ru, sergey_zaikov@rambler.ru,
 # Sergey Zaykov (mail_of_sergey@mail.ru, sergey_zaikov@rambler.ru,
 # ICQ 358572321)
 # ICQ 358572321)
 # From various sources like:
 # From various sources like:
 # http://autodesk.blogs.com/between_the_lines/autocad-release-history.html
 # http://autodesk.blogs.com/between_the_lines/autocad-release-history.html
-0	string	AC1018 		DWG AutoDesk AutoCAD 2004/2005/2006
-0	string	AC1021 		DWG AutoDesk AutoCAD 2007/2008/2009
-0	string	AC1024 		DWG AutoDesk AutoCAD 2010/2011
+0	string	AC1018	DWG AutoDesk AutoCAD 2004/2005/2006
+!:mime image/vnd.dwg
+0	string	AC1021	DWG AutoDesk AutoCAD 2007/2008/2009
+!:mime image/vnd.dwg
+0	string	AC1024	DWG AutoDesk AutoCAD 2010/2011/2012
+!:mime image/vnd.dwg
+0	string	AC1027	DWG AutoDesk AutoCAD 2013/2014
+!:mime image/vnd.dwg
 
 
 # KOMPAS 2D drawing from ASCON 
 # KOMPAS 2D drawing from ASCON 
 # This is KOMPAS 2D drawing or fragment of drawing but is not detailed nor
 # This is KOMPAS 2D drawing or fragment of drawing but is not detailed nor
@@ -110,9 +146,6 @@
 0	beshort	0x0809		Bentley/Intergraph MicroStation
 0	beshort	0x0809		Bentley/Intergraph MicroStation
 >0x02	byte	0xfe
 >0x02	byte	0xfe
 >>0x04	beshort	0x1800		CIT raster CAD
 >>0x04	beshort	0x1800		CIT raster CAD
-0	string	AC1012		AutoDesk AutoCAD R13
-0	string	AC1014		AutoDesk AutoCAD R14 
-0	string	AC1015		AutoDesk AutoCAD R2000
 
 
 # 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

+ 2 - 2
magic/Magdir/commands

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
+# $File: commands,v 1.46 2013/03/25 14:06:55 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 # commands:  file(1) magic for various shells and interpreters
 #
 #
 #0	string/w	:			shell archive or script for antique kernel text
 #0	string/w	:			shell archive or script for antique kernel text
@@ -49,7 +49,7 @@
 !:mime	text/x-awk
 !:mime	text/x-awk
 0	string/wt	#!\ /usr/bin/awk	awk script text executable
 0	string/wt	#!\ /usr/bin/awk	awk script text executable
 !:mime	text/x-awk
 !:mime	text/x-awk
-0	regex		=^\\s*BEGIN\\s*[{]	awk script text
+0	regex		=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
 
 
 # AT&T Bell Labs' Plan 9 shell
 # AT&T Bell Labs' Plan 9 shell
 0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable
 0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable

+ 23 - 8
magic/Magdir/compress

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: compress,v 1.49 2011/12/07 22:04:27 christos Exp $
+# $File: compress,v 1.53 2014/01/05 15:55:21 christos Exp $
 # compress:  file(1) magic for pure-compression formats (no archives)
 # compress:  file(1) magic for pure-compression formats (no archives)
 #
 #
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -22,6 +22,7 @@
 #         other than 8 ("deflate", the only method defined in RFC 1952).
 #         other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
 0       string          \037\213        gzip compressed data
 !:mime	application/x-gzip
 !:mime	application/x-gzip
+!:strength * 2
 >2	byte		<8		\b, reserved method
 >2	byte		<8		\b, reserved method
 >2	byte		>8		\b, unknown method
 >2	byte		>8		\b, unknown method
 >3	byte		&0x01		\b, ASCII
 >3	byte		&0x01		\b, ASCII
@@ -30,6 +31,10 @@
 >3	byte&0xC	=0x08
 >3	byte&0xC	=0x08
 >>10	string		x		\b, was "%s"
 >>10	string		x		\b, was "%s"
 >3	byte		&0x10		\b, has comment
 >3	byte		&0x10		\b, has comment
+>3	byte		&0x20		\b, encrypted
+>4	ledate		>0		\b, last modified: %s
+>8	byte		2		\b, max compression
+>8	byte		4		\b, max speed
 >9	byte		=0x00		\b, from FAT filesystem (MS-DOS, OS/2, NT)
 >9	byte		=0x00		\b, from FAT filesystem (MS-DOS, OS/2, NT)
 >9	byte		=0x01		\b, from Amiga
 >9	byte		=0x01		\b, from Amiga
 >9	byte		=0x02		\b, from VMS
 >9	byte		=0x02		\b, from VMS
@@ -44,11 +49,6 @@
 >9	byte		=0x0B		\b, from NTFS filesystem (NT)
 >9	byte		=0x0B		\b, from NTFS filesystem (NT)
 >9	byte		=0x0C		\b, from QDOS
 >9	byte		=0x0C		\b, from QDOS
 >9	byte		=0x0D		\b, from Acorn RISCOS
 >9	byte		=0x0D		\b, from Acorn RISCOS
->3	byte		&0x10		\b, comment
->3	byte		&0x20		\b, encrypted
->4	ledate		>0		\b, last modified: %s
->8	byte		2		\b, max compression
->8	byte		4		\b, max speed
 
 
 # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
 # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
 0	string		\037\036	packed data
 0	string		\037\036	packed data
@@ -191,10 +191,13 @@
 
 
 # Type: LZMA
 # Type: LZMA
 0	lelong&0xffffff	=0x5d
 0	lelong&0xffffff	=0x5d
->12	leshort		=0xff			LZMA compressed data,
+!:mime	application/x-lzma
+>12	leshort		0xff			LZMA compressed data,
+>>5	lequad		=0xffffffffffffffff	streamed
+>>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
+>12	leshort		0			LZMA compressed data,
 >>5	lequad		=0xffffffffffffffff	streamed
 >>5	lequad		=0xffffffffffffffff	streamed
 >>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
 >>5	lequad		!0xffffffffffffffff	non-streamed, size %lld
-!:mime	application/x-lzma
 
 
 # http://tukaani.org/xz/xz-file-format.txt
 # http://tukaani.org/xz/xz-file-format.txt
 0	ustring		\xFD7zXZ\x00		XZ compressed data
 0	ustring		\xFD7zXZ\x00		XZ compressed data
@@ -206,6 +209,12 @@
 >5	byte		x			\b.%d
 >5	byte		x			\b.%d
 !:mime	application/x-lrzip
 !:mime	application/x-lrzip
 
 
+# http://fastcompression.blogspot.fi/2013/04/lz4-streaming-format-final.html
+0	lelong		0x184d2204	LZ4 compressed data
+!:mime	application/x-lz4
+0	lelong		0x184c2102	LZ4 compressed data, legacy format
+!:mime	application/x-lz4
+
 # AFX compressed files (Wolfram Kleff)
 # AFX compressed files (Wolfram Kleff)
 2	string		-afx-		AFX compressed file data
 2	string		-afx-		AFX compressed file data
 
 
@@ -229,3 +238,9 @@
 >6	byte	>-1		%i)
 >6	byte	>-1		%i)
 >7	long	>0		, original size: %i bytes
 >7	long	>0		, original size: %i bytes
 >15	long	>30		, block size: %i bytes
 >15	long	>30		, block size: %i bytes
+
+# Valve Pack (VPK) files
+0	lelong	0x55aa1234	Valve Pak file
+>0x4	lelong	x		\b, version %u
+>0x8	lelong	x		\b, %u entries
+

+ 23 - 0
magic/Magdir/ctf

@@ -0,0 +1,23 @@
+
+#--------------------------------------------------------------
+# ctf:  file(1) magic for CTF (Common Trace Format) trace files
+#
+# Specs. available here: <http://www.efficios.com/ctf>
+#--------------------------------------------------------------
+
+# CTF trace data
+0	lelong	0xc1fc1fc1	Common Trace Format (CTF) trace data (LE)
+0	belong	0xc1fc1fc1	Common Trace Format (CTF) trace data (BE)
+
+# CTF metadata (packetized)
+0	lelong	0x75d11d57	Common Trace Format (CTF) packetized metadata (LE)
+>35	byte	x		\b, v%d
+>36	byte	x		\b.%d
+0	belong	0x75d11d57	Common Trace Format (CTF) packetized metadata (BE)
+>35	byte	x		\b, v%d
+>36	byte	x		\b.%d
+
+# CTF metadata (plain text)
+0	string	/*\x20CTF\x20   Common Trace Format (CTF) plain text metadata
+!:strength + 5			# this is to make sure we beat C
+>&0	regex	[0-9]+\.[0-9]+	\b, v%s

+ 31 - 4
magic/Magdir/database

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: database,v 1.33 2013/03/09 22:36:00 christos Exp $
+# $File: database,v 1.36 2013/12/09 20:31:53 christos Exp $
 # database:  file(1) magic for various databases
 # database:  file(1) magic for various databases
 #
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@@ -84,8 +84,32 @@
 #
 #
 #
 #
 # Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
 # Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
-0	string	RRD		RRDTool DB
->4	string	x		version %s
+0	string/b	RRD\0		RRDTool DB
+>4	string/b	x		version %s
+
+>>10	short		!0		16bit aligned
+>>>10	bedouble	8.642135e+130	big-endian
+>>>>18	short		x		32bit long (m68k)
+
+>>10	short		0
+>>>12	long		!0		32bit aligned
+>>>>12	bedouble	8.642135e+130	big-endian
+>>>>>20 long		0		64bit long
+>>>>>20 long		!0		32bit long  
+>>>>12	ledouble	8.642135e+130	little-endian
+>>>>>24 long		0		64bit long
+>>>>>24 long		!0		32bit long (i386)
+>>>>12	string		\x43\x2b\x1f\x5b\x2f\x25\xc0\xc7	middle-endian
+>>>>>24 short		!0		32bit long (arm)
+
+>>8	quad		0		64bit aligned
+>>>16	bedouble	8.642135e+130	big-endian
+>>>>24	long		0		64bit long (s390x)
+>>>>24	long		!0		32bit long (hppa/mips/ppc/s390/sparc)
+>>>16	ledouble	8.642135e+130	little-endian
+>>>>28	long		0		64bit long (alpha/amd64/ia64)
+>>>>28	long		!0		32bit long (armel/mipsel)
+
 #----------------------------------------------------------------------
 #----------------------------------------------------------------------
 # ROOT: file(1) magic for ROOT databases
 # ROOT: file(1) magic for ROOT databases
 #
 #
@@ -303,7 +327,10 @@
 >>>>>>>8	ubelong		0		
 >>>>>>>8	ubelong		0		
 # skip MM*DD*.bin by test for for reserved NULL byte
 # skip MM*DD*.bin by test for for reserved NULL byte
 >>>>>>>>508	ubelong		0		
 >>>>>>>>508	ubelong		0		
->>>>>>>>>0	use		xbase-memo-print
+# real memo files should contain text here
+>>>>>>>>>520	ubelong		>0x20202019	
+>>>>>>>>>>520	ubelong		<0xFEFEFEFF	
+>>>>>>>>>>>0	use		xbase-memo-print
 # garbage PCX , ZIP , JAR , XPI 
 # garbage PCX , ZIP , JAR , XPI 
 >>>>>>>8	default		x		
 >>>>>>>8	default		x		
 
 

+ 55 - 47
magic/Magdir/dolby

@@ -1,61 +1,69 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: dolby,v 1.6 2012/10/31 13:39:42 christos Exp $
+# $File: dolby,v 1.7 2014/01/08 22:37:23 christos Exp $
 # ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
 # ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
 # from http://www.atsc.org/standards/a_52a.pdf
 # from http://www.atsc.org/standards/a_52a.pdf
 # corrections, additions, etc. are always welcome!
 # corrections, additions, etc. are always welcome!
 #
 #
 # syncword
 # syncword
-0       beshort         0x0b77  ATSC A/52 aka AC-3 aka Dolby Digital stream,
+0	beshort		0x0b77	ATSC A/52 aka AC-3 aka Dolby Digital stream,
+# Proposed audio/ac3 RFC/4184
 !:mime	audio/vnd.dolby.dd-raw
 !:mime	audio/vnd.dolby.dd-raw
 # fscod
 # fscod
->4      byte&0xc0       0x00    48 kHz,
->4      byte&0xc0       0x40    44.1 kHz,
->4      byte&0xc0       0x80    32 kHz,
+>4	byte&0xc0 = 0x00	48 kHz,
+>4	byte&0xc0 = 0x40	44.1 kHz,
+>4	byte&0xc0 = 0x80	32 kHz,
 # is this one used for 96 kHz?
 # is this one used for 96 kHz?
->4      byte&0xc0       0xc0    reserved frequency,
+>4	byte&0xc0 = 0xc0	reserved frequency,
 #
 #
->5	byte&7 = 0		\b, complete main (CM)
->5	byte&7 = 1		\b, music and effects (ME)
->5	byte&7 = 2		\b, visually impaired (VI)
->5	byte&7 = 3		\b, hearing impaired (HI)
->5	byte&7 = 4		\b, dialogue (D)
->5	byte&7 = 5		\b, commentary (C)
->5	byte&7 = 6		\b, emergency (E)
+>5	byte&0x07 = 0x00	\b, complete main (CM)
+>5	byte&0x07 = 0x01	\b, music and effects (ME)
+>5	byte&0x07 = 0x02	\b, visually impaired (VI)
+>5	byte&0x07 = 0x03	\b, hearing impaired (HI)
+>5	byte&0x07 = 0x04	\b, dialogue (D)
+>5	byte&0x07 = 0x05	\b, commentary (C)
+>5	byte&0x07 = 0x06	\b, emergency (E)
+>5	beshort&0x07e0  0x0720	\b, voiceover (VO) 
+>5	beshort&0x07e0 >0x0720	\b, karaoke
 # acmod
 # acmod
->6      byte&0xe0       0x00    1+1 front,
->6      byte&0xe0       0x20    1 front/0 rear,
->6      byte&0xe0       0x40    2 front/0 rear,
->6      byte&0xe0       0x60    3 front/0 rear,
->6      byte&0xe0       0x80    2 front/1 rear,
->6      byte&0xe0       0xa0    3 front/1 rear,
->6      byte&0xe0       0xc0    2 front/2 rear,
->6      byte&0xe0       0xe0    3 front/2 rear,
-# lfeon (these may be incorrect)
->7      byte&0x40       0x00    LFE off,
->7      byte&0x40       0x40    LFE on,
+>6	byte&0xe0 = 0x00	1+1 front,
+>>6	byte&0x10 = 0x10	LFE on,
+>6	byte&0xe0 = 0x20	1 front/0 rear,
+>>6	byte&0x10 = 0x10	LFE on,
+>6	byte&0xe0 = 0x40	2 front/0 rear,
+# dsurmod (for stereo only)
+>>6	byte&0x18 = 0x00	Dolby Surround not indicated
+>>6	byte&0x18 = 0x08	not Dolby Surround encoded
+>>6	byte&0x18 = 0x10	Dolby Surround encoded
+>>6	byte&0x18 = 0x18	reserved Dolby Surround mode
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0x60	3 front/0 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0x80	2 front/1 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0xa0	3 front/1 rear,
+>>6	byte&0x01 = 0x01	LFE on,
+>6	byte&0xe0 = 0xc0	2 front/2 rear,
+>>6	byte&0x04 = 0x04	LFE on,
+>6	byte&0xe0 = 0xe0	3 front/2 rear,
+>>6	byte&0x01 = 0x01	LFE on,
 #
 #
 >4	byte&0x3e = 0x00	\b, 32 kbit/s
 >4	byte&0x3e = 0x00	\b, 32 kbit/s
->4	byte&0x3e = 0x02        \b, 40 kbit/s
->4	byte&0x3e = 0x04        \b, 48 kbit/s
->4	byte&0x3e = 0x06        \b, 56 kbit/s
->4	byte&0x3e = 0x08        \b, 64 kbit/s
->4	byte&0x3e = 0x0a        \b, 80 kbit/s
->4	byte&0x3e = 0x0c        \b, 96 kbit/s
->4	byte&0x3e = 0x0e        \b, 112 kbit/s
->4	byte&0x3e = 0x10        \b, 128 kbit/s
->4	byte&0x3e = 0x12        \b, 160 kbit/s
->4	byte&0x3e = 0x14        \b, 192 kbit/s
->4	byte&0x3e = 0x16        \b, 224 kbit/s
->4	byte&0x3e = 0x18        \b, 256 kbit/s
->4	byte&0x3e = 0x1a        \b, 320 kbit/s
->4	byte&0x3e = 0x1c        \b, 384 kbit/s
->4	byte&0x3e = 0x1e        \b, 448 kbit/s
->4	byte&0x3e = 0x20        \b, 512 kbit/s
->4	byte&0x3e = 0x22        \b, 576 kbit/s
->4	byte&0x3e = 0x24        \b, 640 kbit/s
-# dsurmod (these may be incorrect)
->6      beshort&0x0180  0x0000  Dolby Surround not indicated
->6      beshort&0x0180  0x0080  not Dolby Surround encoded
->6      beshort&0x0180  0x0100  Dolby Surround encoded
->6      beshort&0x0180  0x0180  reserved Dolby Surround mode
+>4	byte&0x3e = 0x02	\b, 40 kbit/s
+>4	byte&0x3e = 0x04	\b, 48 kbit/s
+>4	byte&0x3e = 0x06	\b, 56 kbit/s
+>4	byte&0x3e = 0x08	\b, 64 kbit/s
+>4	byte&0x3e = 0x0a	\b, 80 kbit/s
+>4	byte&0x3e = 0x0c	\b, 96 kbit/s
+>4	byte&0x3e = 0x0e	\b, 112 kbit/s
+>4	byte&0x3e = 0x10	\b, 128 kbit/s
+>4	byte&0x3e = 0x12	\b, 160 kbit/s
+>4	byte&0x3e = 0x14	\b, 192 kbit/s
+>4	byte&0x3e = 0x16	\b, 224 kbit/s
+>4	byte&0x3e = 0x18	\b, 256 kbit/s
+>4	byte&0x3e = 0x1a	\b, 320 kbit/s
+>4	byte&0x3e = 0x1c	\b, 384 kbit/s
+>4	byte&0x3e = 0x1e	\b, 448 kbit/s
+>4	byte&0x3e = 0x20	\b, 512 kbit/s
+>4	byte&0x3e = 0x22	\b, 576 kbit/s
+>4	byte&0x3e = 0x24	\b, 640 kbit/s

+ 16 - 10
magic/Magdir/elf

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: elf,v 1.59 2013/03/21 17:50:02 christos Exp $
+# $File: elf,v 1.64 2013/08/04 09:31:47 christos Exp $
 # elf:  file(1) magic for ELF executables
 # elf:  file(1) magic for ELF executables
 #
 #
 # We have to check the byte order flag to see what byte order all the
 # We have to check the byte order flag to see what byte order all the
@@ -30,16 +30,17 @@
 #>>>(0x38+0xcc) string	>\0		of '%s'
 #>>>(0x38+0xcc) string	>\0		of '%s'
 #>>>(0x38+0x10) lelong	>0		(signal %d),
 #>>>(0x38+0x10) lelong	>0		(signal %d),
 >16	leshort		&0xff00		processor-specific,
 >16	leshort		&0xff00		processor-specific,
+>18	clear		x
 >18	leshort		0		no machine,
 >18	leshort		0		no machine,
 >18	leshort		1		AT&T WE32100
 >18	leshort		1		AT&T WE32100
 >18	leshort		2		SPARC
 >18	leshort		2		SPARC
 >18	leshort		3		Intel 80386,
 >18	leshort		3		Intel 80386,
 >18	leshort		4		Motorola
 >18	leshort		4		Motorola
 >>4	byte		1
 >>4	byte		1
->>>36	lelong		&0x01000000	68000 - invalid byte order,
->>>36	lelong		&0x00810000	CPU32 - invalid byte order,
->>>36	lelong		0		68020 - invalid byte order,
->18	leshort		5		Motorola 88000 - invalid byte order,
+>>>36	lelong		&0x01000000	68000,
+>>>36	lelong		&0x00810000	CPU32,
+>>>36	lelong		0		68020,
+>18	leshort		5		Motorola 88000,
 >18	leshort		6		Intel 80486,
 >18	leshort		6		Intel 80486,
 >18	leshort		7		Intel 80860,
 >18	leshort		7		Intel 80860,
 # The official e_machine number for MIPS is now #8, regardless of endianness.
 # The official e_machine number for MIPS is now #8, regardless of endianness.
@@ -74,10 +75,10 @@
 >>>48  lelong&0xf0000000	0x60000000	MIPS64
 >>>48  lelong&0xf0000000	0x60000000	MIPS64
 >>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
 >>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
 >>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
 >>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
->18	leshort		9		Amdahl - invalid byte order,
+>18	leshort		9		Amdahl,
 >18	leshort		10		MIPS (deprecated),
 >18	leshort		10		MIPS (deprecated),
->18	leshort		11		RS6000 - invalid byte order,
->18	leshort		15		PA-RISC - invalid byte order,
+>18	leshort		11		RS6000,
+>18	leshort		15		PA-RISC,
 # only for 32-bit
 # only for 32-bit
 >>4	byte		1
 >>4	byte		1
 >>>38	leshort		0x0214		2.0
 >>>38	leshort		0x0214		2.0
@@ -109,6 +110,8 @@
 >>4	byte		1
 >>4	byte		1
 >>>36	lelong&0xff000000	0x04000000	EABI4
 >>>36	lelong&0xff000000	0x04000000	EABI4
 >>>36	lelong&0xff000000	0x05000000	EABI5
 >>>36	lelong&0xff000000	0x05000000	EABI5
+>>>36	lelong		&0x00800000	BE8
+>>>36	lelong		&0x00400000	LE8
 >18	leshort		41		Alpha,
 >18	leshort		41		Alpha,
 >18	leshort		0xa390		IBM S/390 (obsolete),
 >18	leshort		0xa390		IBM S/390 (obsolete),
 >18	leshort		42		Renesas SH,
 >18	leshort		42		Renesas SH,
@@ -172,6 +175,7 @@
 >18	leshort		97		NatSemi 32k,
 >18	leshort		97		NatSemi 32k,
 >18	leshort		106		Analog Devices Blackfin,
 >18	leshort		106		Analog Devices Blackfin,
 >18	leshort		113		Altera Nios II,
 >18	leshort		113		Altera Nios II,
+>18	beshort		138		LatticeMico32,
 >18	leshort		174		META,
 >18	leshort		174		META,
 >18	leshort		183		ARM aarch64,
 >18	leshort		183		ARM aarch64,
 >18	leshort		187		Tilera TILE64,
 >18	leshort		187		Tilera TILE64,
@@ -180,6 +184,8 @@
 >18	leshort		0x3426		OpenRISC (obsolete),
 >18	leshort		0x3426		OpenRISC (obsolete),
 >18	leshort		0x8472		OpenRISC (obsolete),
 >18	leshort		0x8472		OpenRISC (obsolete),
 >18	leshort		0x9026		Alpha (unofficial),
 >18	leshort		0x9026		Alpha (unofficial),
+>18	default		x
+>>18	leshort		x		*unknown arch 0x%x*
 >20	lelong		0		invalid version
 >20	lelong		0		invalid version
 >20	lelong		1		version 1
 >20	lelong		1		version 1
 
 
@@ -189,9 +195,9 @@
 >4	byte		1		32-bit
 >4	byte		1		32-bit
 >4	byte		2		64-bit
 >4	byte		2		64-bit
 >5	byte		0		invalid byte order
 >5	byte		0		invalid byte order
->5	byte		1		LSB 
+>5	byte		1		LSB
 >>0	use		elf-le
 >>0	use		elf-le
->5	byte		2		MSB 
+>5	byte		2		MSB
 >>0	use		\^elf-le
 >>0	use		\^elf-le
 # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
 # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
 # like proper ELF, but extracting the string had bad results.
 # like proper ELF, but extracting the string had bad results.

+ 3 - 3
magic/Magdir/epoc

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: epoc,v 1.8 2012/06/16 14:43:36 christos Exp $
+# $File: epoc,v 1.9 2013/12/21 14:28:15 christos Exp $
 # EPOC : file(1) magic for EPOC documents [Psion Series 5/Osaris/Geofox 1]
 # EPOC : file(1) magic for EPOC documents [Psion Series 5/Osaris/Geofox 1]
 # Stefan Praszalowicz <hpicollo@worldnet.fr> and Peter Breitenlohner <peb@mppmu.mpg.de>
 # Stefan Praszalowicz <hpicollo@worldnet.fr> and Peter Breitenlohner <peb@mppmu.mpg.de>
 # Useful information for improving this file can be found at:
 # Useful information for improving this file can be found at:
@@ -30,8 +30,8 @@
 >4	lelong		0x10000074	OPL application
 >4	lelong		0x10000074	OPL application
 !:mime application/x-epoc-app
 !:mime application/x-epoc-app
 >4	lelong		0x1000008A	exported multi-bitmap image
 >4	lelong		0x1000008A	exported multi-bitmap image
->4	lelong		0x1000016D	
->>8	lelong		0x10000088	Comms names
+>4	lelong		0x1000016D
+>>8	lelong		0x10000087	Comms names
 
 
 0	lelong		0x10000041	Psion Series 5 ROM multi-bitmap image
 0	lelong		0x10000041	Psion Series 5 ROM multi-bitmap image
 
 

+ 431 - 95
magic/Magdir/filesystems

@@ -1,8 +1,189 @@
-
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.77 2013/03/14 01:38:30 christos Exp $
+# $File: filesystems,v 1.85 2013/11/19 23:54:05 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 # filesystems:  file(1) magic for different filesystems
 #
 #
+0	name	partid  
+>0	ubyte	0x00	Unused
+>0	ubyte	0x01	12-bit FAT
+>0	ubyte	0x02	XENIX /
+>0	ubyte	0x03	XENIX /usr
+>0	ubyte	0x04	16-bit FAT, less than 32M
+>0	ubyte	0x05	extended partition
+>0	ubyte	0x06	16-bit FAT, more than 32M
+>0	ubyte	0x07	OS/2 HPFS, NTFS, QNX2, Adv. UNIX
+>0	ubyte	0x08	AIX or os, or etc.
+>0	ubyte	0x09	AIX boot partition or Coherent
+>0	ubyte	0x0a	O/2 boot manager or Coherent swap
+>0	ubyte	0x0b	32-bit FAT
+>0	ubyte	0x0c	32-bit FAT, LBA-mapped
+>0	ubyte	0x0d	7XXX, LBA-mapped
+>0	ubyte	0x0e	16-bit FAT, LBA-mapped
+>0	ubyte	0x0f	extended partition, LBA-mapped
+>0	ubyte	0x10	OPUS
+>0	ubyte	0x11 	OS/2 DOS 12-bit FAT
+>0	ubyte	0x12 	Compaq diagnostics
+>0	ubyte	0x14 	OS/2 DOS 16-bit FAT <32M
+>0	ubyte	0x16 	OS/2 DOS 16-bit FAT >=32M
+>0	ubyte	0x17 	OS/2 hidden IFS
+>0	ubyte	0x18 	AST Windows swapfile
+>0	ubyte	0x19 	Willowtech Photon coS
+>0	ubyte	0x1b 	hidden win95 fat 32
+>0	ubyte	0x1c 	hidden win95 fat 32 lba
+>0	ubyte	0x1d	hidden win95 fat 16 lba
+>0	ubyte	0x20 	Willowsoft OFS1
+>0	ubyte	0x21 	reserved
+>0	ubyte	0x23 	reserved
+>0	ubyte	0x24	NEC DOS
+>0	ubyte	0x26 	reserved
+>0	ubyte	0x31 	reserved
+>0	ubyte	0x32	Alien Internet Services NOS
+>0	ubyte	0x33 	reserved
+>0	ubyte	0x34 	reserved
+>0	ubyte	0x35 	JFS on OS2
+>0	ubyte	0x36 	reserved
+>0	ubyte	0x38 	Theos
+>0	ubyte	0x39 	Plan 9, or Theos spanned
+>0	ubyte	0x3a 	Theos ver 4 4gb partition
+>0	ubyte	0x3b 	Theos ve 4 extended partition
+>0	ubyte	0x3c 	PartitionMagic recovery
+>0	ubyte	0x3d 	Hidden Netware
+>0	ubyte	0x40 	VENIX 286 or LynxOS
+>0	ubyte	0x41	PReP
+>0	ubyte	0x42	linux swap sharing DRDOS disk
+>0	ubyte	0x43	linux sharing DRDOS disk
+>0	ubyte	0x44	GoBack change utility
+>0	ubyte	0x45	Boot US Boot manager
+>0	ubyte	0x46	EUMEL/Elan or Ergos 3
+>0	ubyte	0x47	EUMEL/Elan or Ergos 3
+>0	ubyte	0x48	EUMEL/Elan or Ergos 3
+>0	ubyte	0x4a	ALFX/THIN filesystem for DOS
+>0	ubyte	0x4c	Oberon partition
+>0	ubyte	0x4d 	QNX4.x
+>0	ubyte	0x4e 	QNX4.x 2nd part
+>0	ubyte	0x4f 	QNX4.x 3rd part
+>0	ubyte	0x50 	DM (disk manager)
+>0	ubyte	0x51 	DM6 Aux1 (or Novell)
+>0	ubyte	0x52 	CP/M or Microport SysV/AT
+>0	ubyte	0x53 	DM6 Aux3
+>0	ubyte	0x54	DM6 DDO
+>0	ubyte	0x55	EZ-Drive (disk manager)
+>0	ubyte	0x56	Golden Bow (disk manager)
+>0	ubyte	0x57	Drive PRO
+>0	ubyte	0x5c	Priam Edisk (disk manager)
+>0	ubyte	0x61	SpeedStor
+>0	ubyte	0x63	GNU HURD or Mach or Sys V/386
+>0	ubyte	0x64	Novell Netware 2.xx or Speedstore
+>0	ubyte	0x65	Novell Netware 3.xx
+>0	ubyte	0x66	Novell 386 Netware
+>0	ubyte	0x67	Novell
+>0	ubyte	0x68	Novell
+>0	ubyte	0x69	Novell
+>0	ubyte	0x70	DiskSecure Multi-Boot
+>0	ubyte	0x71	reserved
+>0	ubyte	0x73	reserved
+>0	ubyte	0x74	reserved
+>0	ubyte	0x75	PC/IX
+>0	ubyte	0x76	reserved
+>0	ubyte	0x77	M2FS/M2CS partition
+>0	ubyte	0x78	XOSL boot loader filesystem
+>0	ubyte	0x80	MINIX until 1.4a
+>0	ubyte	0x81	MINIX since 1.4b
+>0	ubyte	0x82	Linux swap or Solaris
+>0	ubyte	0x83	Linux native
+>0	ubyte	0x84	OS/2 hidden C: drive
+>0	ubyte	0x85	Linux extended partition
+>0	ubyte	0x86	NT FAT volume set
+>0	ubyte	0x87	NTFS volume set or HPFS mirrored
+>0	ubyte	0x8a	Linux Kernel AiR-BOOT partition
+>0	ubyte	0x8b	Legacy Fault tolerant FAT32
+>0	ubyte	0x8c	Legacy Fault tolerant FAT32 ext
+>0	ubyte	0x8d	Hidden free FDISK FAT12
+>0	ubyte	0x8e	Linux Logical Volume Manager
+>0	ubyte	0x90	Hidden free FDISK FAT16
+>0	ubyte	0x91	Hidden free FDISK DOS EXT
+>0	ubyte	0x92	Hidden free FDISK FAT16 Big
+>0	ubyte	0x93	Amoeba filesystem
+>0	ubyte	0x94	Amoeba bad block table
+>0	ubyte	0x95	MIT EXOPC native partitions
+>0	ubyte	0x97	Hidden free FDISK FAT32
+>0	ubyte	0x98	Datalight ROM-DOS Super-Boot
+>0	ubyte	0x99	Mylex EISA SCSI
+>0	ubyte	0x9a	Hidden free FDISK FAT16 LBA
+>0	ubyte	0x9b	Hidden free FDISK EXT LBA
+>0	ubyte	0x9f	BSDI?
+>0	ubyte	0xa0	IBM Thinkpad hibernation
+>0	ubyte	0xa1	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa3	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa4	HP Volume expansion (SpeedStor)
+>0	ubyte	0xa5	386BSD partition type
+>0	ubyte	0xa6	OpenBSD partition type
+>0	ubyte	0xa7	NeXTSTEP 486
+>0	ubyte	0xa8	Apple UFS
+>0	ubyte	0xa9	NetBSD partition type
+>0	ubyte	0xaa	Olivetty Fat12 1.44MB Service part
+>0	ubyte	0xab	Apple Boot
+>0	ubyte	0xae	SHAG OS filesystem
+>0	ubyte	0xaf	Apple HFS
+>0	ubyte	0xb0	BootStar Dummy
+>0	ubyte	0xb1	reserved
+>0	ubyte	0xb3	reserved
+>0	ubyte	0xb4	reserved
+>0	ubyte	0xb6	reserved
+>0	ubyte	0xb7	BSDI BSD/386 filesystem
+>0	ubyte	0xb8	BSDI BSD/386 swap
+>0	ubyte	0xbb	Boot Wizard Hidden
+>0	ubyte	0xbe	Solaris 8 partition type
+>0	ubyte	0xbf	Solaris partition type
+>0	ubyte	0xc0 	CTOS
+>0	ubyte	0xc1 	DRDOS/sec (FAT-12)
+>0	ubyte	0xc2 	Hidden Linux
+>0	ubyte	0xc3 	Hidden Linux swap
+>0	ubyte	0xc4 	DRDOS/sec (FAT-16, < 32M)
+>0	ubyte	0xc5 	DRDOS/sec (EXT)
+>0	ubyte	0xc6 	DRDOS/sec (FAT-16, >= 32M)
+>0	ubyte	0xc7 	Syrinx (Cyrnix?) or HPFS disabled
+>0	ubyte	0xc8 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xc9 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xca 	Reserved for DR-DOS 8.0+
+>0	ubyte	0xcb 	DR-DOS 7.04+ Secured FAT32 CHS
+>0	ubyte	0xcc 	DR-DOS 7.04+ Secured FAT32 LBA
+>0	ubyte	0xcd	CTOS Memdump
+>0	ubyte	0xce 	DR-DOS 7.04+ FAT16X LBA
+>0	ubyte	0xcf 	DR-DOS 7.04+ EXT LBA
+>0	ubyte	0xd0 	REAL/32 secure big partition
+>0	ubyte	0xd1 	Old Multiuser DOS FAT12
+>0	ubyte	0xd4 	Old Multiuser DOS FAT16 Small
+>0	ubyte	0xd5 	Old Multiuser DOS Extended
+>0	ubyte	0xd6 	Old Multiuser DOS FAT16 Big
+>0	ubyte	0xd8 	CP/M 86
+>0	ubyte	0xdb 	CP/M or Concurrent CP/M
+>0	ubyte	0xdd 	Hidden CTOS Memdump
+>0	ubyte	0xde 	Dell PowerEdge Server utilities
+>0	ubyte	0xdf 	DG/UX virtual disk manager
+>0	ubyte	0xe0 	STMicroelectronics ST AVFS
+>0	ubyte	0xe1 	DOS access or SpeedStor 12-bit
+>0	ubyte	0xe3 	DOS R/O or Storage Dimensions
+>0	ubyte	0xe4 	SpeedStor 16-bit FAT < 1024 cyl.
+>0	ubyte	0xe5	reserved
+>0	ubyte	0xe6	reserved
+>0	ubyte	0xeb 	BeOS
+>0	ubyte	0xee	GPT Protective MBR
+>0	ubyte	0xef	EFI system partition
+>0	ubyte	0xf0 	Linux PA-RISC boot loader
+>0	ubyte	0xf1 	SpeedStor or Storage Dimensions
+>0	ubyte	0xf2 	DOS 3.3+ Secondary
+>0	ubyte	0xf3	reserved
+>0	ubyte	0xf4	SpeedStor large partition
+>0	ubyte	0xf5	Prologue multi-volumen partition
+>0	ubyte	0xf6 	reserved
+>0	ubyte	0xf9 	pCache: ext2/ext3 persistent cache
+>0	ubyte	0xfa 	Bochs x86 emulator
+>0	ubyte	0xfb 	VMware File System
+>0	ubyte	0xfc 	VMware Swap
+>0	ubyte	0xfd 	Linux RAID partition persistent sb
+>0	ubyte	0xfe	LANstep or IBM PS/2 IML
+>0	ubyte	0xff 	Xenix Bad Block Table
+
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
 # Sun disk labels
 # Sun disk labels
 # From /usr/include/sun/dklabel.h:
 # From /usr/include/sun/dklabel.h:
@@ -57,22 +238,34 @@
 >>>>15	ulelong	>0		\b, %d cylinders
 >>>>15	ulelong	>0		\b, %d cylinders
 >>>>128	indirect	x	\b; contains 
 >>>>128	indirect	x	\b; contains 
 
 
-# x86 boot sector updated by Joerg Jenderek at Sep 2007,May 2011
+# added by Joerg Jenderek at Nov 2012
+# http://www.thenakedpc.com/articles/v04/08/0408-05.html
+# Symantec (Peter Norton) Image.dat file consists of variable header, bootrecord, part of FAT and root directory data
+0	string	PNCIHISK\0		Norton Utilities disc image data
+# real x86 boot sector with jump instruction
+>509	search/1026	\x55\xAA\xeb	
+>>&-1	indirect	x		\b; contains 
+# http://file-extension.net/seeker/file_extension_dat
+0	string	PNCIUNDO		Norton Disk Doctor UnDo file
+#
+
+# DOS/MBR boot sector updated by Joerg Jenderek at Sep 2007,May 2011
 # for any allowed sector sizes
 # for any allowed sector sizes
 30		search/481	\x55\xAA	
 30		search/481	\x55\xAA	
-# to display x86 boot sector (40) before old one (strength=50+21),Syslinux bootloader (71),SYSLINUX MBR (37+36),NetBSD mbr (110),AdvanceMAME mbr (111)
+# to display DOS/MBR boot sector (40) before old one (strength=50+21),Syslinux bootloader (71),SYSLINUX MBR (37+36),NetBSD mbr (110),AdvanceMAME mbr (111)
 # DOS BPB information (70) and after DOS floppy (120) like in previous file version
 # DOS BPB information (70) and after DOS floppy (120) like in previous file version
 !:strength +72
 !:strength +72
 # for sector sizes < 512 Bytes
 # for sector sizes < 512 Bytes
 >11		uleshort	<512		
 >11		uleshort	<512		
->>(11.s-2)	uleshort	0xAA55		x86 boot sector
+>>(11.s-2)	uleshort	0xAA55		DOS/MBR boot sector
 # for sector sizes with 512 or more Bytes
 # for sector sizes with 512 or more Bytes
->0x1FE		leshort		0xAA55		x86 boot sector
-# keep old x86 boot sector as dummy for mbr and bootloader displaying
+>0x1FE		leshort		0xAA55		DOS/MBR boot sector
+# keep old DOS/MBR boot sector as dummy for mbr and bootloader displaying
 # only for sector sizes with 512 or more Bytes
 # only for sector sizes with 512 or more Bytes
-0x1FE	leshort	0xAA55			
+0x1FE		leshort		0xAA55		DOS/MBR boot sector
+!:strength +72
 # to display information (50) before DOS BPB (strength=70) and after DOS floppy (120) like in old file version
 # to display information (50) before DOS BPB (strength=70) and after DOS floppy (120) like in old file version
-!:strength +21
+#!:strength +21
 >2	string	OSBS			\b, OS/BS MBR
 >2	string	OSBS			\b, OS/BS MBR
 # added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/
 # added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/
 # and http://en.wikipedia.org/wiki/Master_Boot_Record
 # and http://en.wikipedia.org/wiki/Master_Boot_Record
@@ -336,60 +529,37 @@
 # http://www.bcdwb.de/bcdw/index_e.htm
 # http://www.bcdwb.de/bcdw/index_e.htm
 >3	string	BCDL				
 >3	string	BCDL				
 >>498	string	BCDL\ \ \ \ BIN			\b, Bootable CD Loader (1.50Z)
 >>498	string	BCDL\ \ \ \ BIN			\b, Bootable CD Loader (1.50Z)
-# mbr partition table entries
-# OEM-ID does not contain MicroSoft,NEWLDR,DOS,SYSLINUX,or MTOOLs
->3			string		!MS
->>3			string		!SYSLINUX
->>>3			string		!MTOOL
->>>>3			string		!NEWLDR
->>>>>5			string		!DOS
-# not FAT (32 bit)
->>>>>>82		string		!FAT32
-#not Linux kernel
->>>>>>>514		string		!HdrS
-#not BeOS
->>>>>>>>422		string		!Be\ Boot\ Loader
-# active flag 0 or 0x80 and type > 0
->>>>>>>>>446		ubyte		<0x81	
->>>>>>>>>>446		ubyte&0x7F	0	
->>>>>>>>>>>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
-#
->>>>>>>>>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
-#
->>>>>>>>>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 partition table entries updated by Joerg Jenderek at Sep 2013
+# skip Norton Utilities disc image data
+>3		string		!IHISK		
+# skip Linux style boot sector starting with assember instructions mov 0x7c0,ax;
+>>0		belong		!0xb8c0078e		
+# not Linux kernel 
+>>>514		string		!HdrS			
+# not BeOS
+>>>>422		string		!Be\ Boot\ Loader	
+# jump over BPB instruction implies DOS bootsector or AdvanceMAME mbr 
+>>>>>0		ubelong&0xFD000000	=0xE9000000	
+# AdvanceMAME mbr
+>>>>>>(1.b+2)	ubequad		0xfa31c08ed88ec08e	
+>>>>>>>446	use		partition-table
+# mbr, Norton Utilities disc image data, or 2nd,etc. sector of x86 bootloader
+>>>>>0		ubelong&0xFD000000	!0xE9000000	
+# skip FSInfosector
+>>>>>>0		string		!RRaA		
+# skip 3rd sector of MS x86 bootloader with assember instructions cli;MOVZX EAX,BYTE PTR [BP+10];MOV ECX,
+# http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm
+>>>>>>>0	ubequad		!0xfa660fb64610668b	
+# skip 13rd sector of MS x86 bootloader
+>>>>>>>>0	ubequad		!0x660fb64610668b4e	
+# skip sector starting with DOS new line
+>>>>>>>>>0	string		!\r\n			
+# allowed active flag 0,80h-FFh
+>>>>>>>>>>446	ubyte		0			
+>>>>>>>>>>>446	use		partition-table
+>>>>>>>>>>446	ubyte		>0x7F			
+>>>>>>>>>>>446	use		partition-table
+# TODO: test for extended bootrecord (ebr) moved and merged with mbr partition table entries
 # mbr partition table entries end
 # mbr partition table entries end
 # http://www.acronis.de/
 # http://www.acronis.de/
 #FAT label=ACRONIS\ SZ
 #FAT label=ACRONIS\ SZ
@@ -914,6 +1084,43 @@
 >>>>>495		string		RENF		\b, FAT (16 bit)
 >>>>>495		string		RENF		\b, FAT (16 bit)
 # x86 bootloader end
 # x86 bootloader end
 
 
+# by Joerg Jenderek at Apr 2013
+#	Print the DOS filenames from directory entry form with 8 right space padded bytes + 3 bytes for extension
+#	like IO.SYS. MSDOS.SYS , KERNEL.SYS , DRBIO.SYS
+0	name			DOS-filename
+# space=0x20 (00100000b) means empty 
+>0			ubyte&0xDF	>0		
+>>0			ubyte		x 		\b%c
+>>>1			ubyte&0xDF	>0		
+>>>>1			ubyte		x 		\b%c
+>>>>>2			ubyte&0xDF	>0		
+>>>>>>2			ubyte		x 		\b%c
+>>>>>>>3		ubyte&0xDF	>0		
+>>>>>>>>3		ubyte		x 		\b%c
+>>>>>>>>>4		ubyte&0xDF	>0		
+>>>>>>>>>>4		ubyte		x 		\b%c
+>>>>>>>>>>>5		ubyte&0xDF	>0		
+>>>>>>>>>>>>5		ubyte		x 		\b%c
+>>>>>>>>>>>>>6		ubyte&0xDF	>0		
+>>>>>>>>>>>>>>6		ubyte		x 		\b%c
+>>>>>>>>>>>>>>>7	ubyte&0xDF	>0		
+>>>>>>>>>>>>>>>>7	ubyte		x 		\b%c
+# DOS filename extension
+>>8			ubyte&0xDF	>0		\b.
+>>>8			ubyte		x 		\b%c
+>>>>9			ubyte&0xDF	>0		
+>>>>>9			ubyte		x 		\b%c
+>>>>>>10		ubyte&0xDF	>0		
+>>>>>>>10		ubyte		x 		\b%c
+#	Print 2 following DOS filenames from directory entry form
+#	like IO.SYS+MSDOS.SYS or ibmbio.com+ibmdos.com
+0	name			2xDOS-filename
+# display 1 space
+>0			ubyte		x		\b 
+>0			use		DOS-filename
+>11			ubyte		x		\b+
+>11			use		DOS-filename
+
 # added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO
 # added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO
 # and http://en.wikipedia.org/wiki/File_Allocation_Table#FS_Information_Sector
 # and http://en.wikipedia.org/wiki/File_Allocation_Table#FS_Information_Sector
 >0		string		RRaA		
 >0		string		RRaA		
@@ -922,17 +1129,6 @@
 >>>0x1E8	ulelong		<0xffffffff	\b, %u free clusters
 >>>0x1E8	ulelong		<0xffffffff	\b, %u free clusters
 >>>0x1EC	ulelong		<0xffffffff	\b, last allocated cluster %u
 >>>0x1EC	ulelong		<0xffffffff	\b, last allocated cluster %u
 
 
-# added by Joerg Jenderek at Nov 2012
-# http://www.thenakedpc.com/articles/v04/08/0408-05.html
-# Symantec (Peter Norton) Image.dat file consists of variable header, bootrecord, part of FAT and root directory data
-0	string	PNCIHISK\0		Norton Utilities disc image data
-# real x86 boot sector with jump instruction
->509	search/1026	\x55\xAA\xeb	
->>&-1	indirect	x		\b; contains 
-# http://file-extension.net/seeker/file_extension_dat
-0	string	PNCIUNDO		Norton Disk Doctor UnDo file
-#
-
 # updated by Joerg Jenderek at Sep 2007
 # updated by Joerg Jenderek at Sep 2007
 >3	ubyte	0			
 >3	ubyte	0			
 #no active flag
 #no active flag
@@ -948,9 +1144,59 @@
 >>>>>>>466	ubyte	0x0F			\b, extended partition table (LBA)
 >>>>>>>466	ubyte	0x0F			\b, extended partition table (LBA)
 >>>>>>>466	ubyte	0x0			\b, extended partition table (last)	
 >>>>>>>466	ubyte	0x0			\b, extended partition table (last)	
 
 
-# DOS x86 sector separated and moved from "x86 boot sector" by Joerg Jenderek at May 2011
+# DOS x86 sector separated and moved from "DOS/MBR boot sector" by Joerg Jenderek at May 2011
 
 
 >0x200	lelong	0x82564557		\b, BSD disklabel
 >0x200	lelong	0x82564557		\b, BSD disklabel
+
+# http://en.wikipedia.org/wiki/Master_boot_record#PTE
+# display standard partition table
+0	name				partition-table
+#>0		ubyte		x	PARTITION-TABLE
+# test and display 1st til 4th partition table entry
+>0		use			partition-entry-test
+>16		use			partition-entry-test
+>32		use			partition-entry-test
+>48		use			partition-entry-test
+#		test for entry of partition table
+0	name				partition-entry-test
+# partition type ID > 0
+>4		ubyte		>0
+# active flag 0
+>>0		ubyte		0	
+>>>0		use		partition-entry
+# active flag 0x80, 0x81, ... 
+>>0		ubyte		>0x7F	
+>>>0		use		partition-entry
+#		Print entry of partition table
+0	name				partition-entry
+# partition type ID > 0
+>4		ubyte		>0	\b; partition
+>>64		leshort		0xAA55	1
+>>48		leshort		0xAA55	2
+>>32		leshort		0xAA55	3
+>>16		leshort		0xAA55	4
+>>4		ubyte		x	: ID=0x%x
+>>0		ubyte&0x80	0x80	\b, active
+>>0		ubyte		>0x80	0x%x
+>>1		ubyte		x	\b, start-CHS (
+>>1		use		partition-chs
+>>5		ubyte		x	\b), end-CHS (
+>>5		use		partition-chs
+>>8		ulelong		x	\b), startsector %u
+>>12		ulelong		x	\b, %u sectors
+#		Print cylinder,head,sector (CHS) of partition entry
+0	name				partition-chs
+# cylinder
+>1		ubyte		x	\b0x
+>1		ubyte&0xC0	0x40	\b1
+>1		ubyte&0xC0	0x80	\b2
+>1		ubyte&0xC0	0xC0	\b3
+>2		ubyte		x	\b%x
+# head
+>0		ubyte		x	\b,%u
+# sector
+>1		ubyte&0x3F	x	\b,%u
+
 # FATX 
 # FATX 
 0		string		FATX		FATX filesystem data
 0		string		FATX		FATX filesystem data
 
 
@@ -987,7 +1233,7 @@
 >12	string	x			(older version %-4.4s)
 >12	string	x			(older version %-4.4s)
 0	string	\r\nSYSLINUX\ 		SYSLINUX loader
 0	string	\r\nSYSLINUX\ 		SYSLINUX loader
 >11	string	x			(version %-4.4s)
 >11	string	x			(version %-4.4s)
-# syslinux updated and separated from "x86 boot sector" by Joerg Jenderek at Sep 2012
+# syslinux updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at Sep 2012
 # assembler instructions: jmp yy (yy=0x3c,0x58);nop;"SYSLINUX"
 # assembler instructions: jmp yy (yy=0x3c,0x58);nop;"SYSLINUX"
 0	ulelong&0x80909bEB	0x009018EB	
 0	ulelong&0x80909bEB	0x009018EB	
 # OEM-ID not always "SYSLINUX"
 # OEM-ID not always "SYSLINUX"
@@ -997,10 +1243,10 @@
 >>1	ubyte		0x58			Syslinux bootloader (version 3.0-3.9)
 >>1	ubyte		0x58			Syslinux bootloader (version 3.0-3.9)
 >459	search/30	Boot\ error\r\n\0	
 >459	search/30	Boot\ error\r\n\0	
 >>1	ubyte		0x58			Syslinux bootloader (version 3.10 or newer)
 >>1	ubyte		0x58			Syslinux bootloader (version 3.10 or newer)
-# SYSLINUX MBR updated and separated from "x86 boot sector" by Joerg Jenderek at Sep 2012
+# SYSLINUX MBR updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at Sep 2012
 # assembler instructions: mov di,0600h;mov cx,0100h
 # assembler instructions: mov di,0600h;mov cx,0100h
 16	search/4	\xbf\x00\x06\xb9\x00\x01		
 16	search/4	\xbf\x00\x06\xb9\x00\x01		
-# to display SYSLINUX MBR (36) before old x86 boot sector one with partition table (strength=50+21)
+# to display SYSLINUX MBR (36) before old DOS/MBR boot sector one with partition table (strength=50+21)
 !:strength +36
 !:strength +36
 >94	search/249	Missing\ operating\ system		
 >94	search/249	Missing\ operating\ system		
 # followed by \r for versions older 3.35 , .\r for versions newer 3.52 and point for other
 # followed by \r for versions older 3.35 , .\r for versions newer 3.52 and point for other
@@ -1161,7 +1407,7 @@
 >>>>>0x217 	ulong		!0xffffffff	
 >>>>>0x217 	ulong		!0xffffffff	
 >>>>>>0x217 	string		>\0		\b, configuration file %-s
 >>>>>>0x217 	string		>\0		\b, configuration file %-s
 
 
-# DOS x86 sector updated and separated from "x86 boot sector" by Joerg Jenderek at May 2011
+# DOS x86 sector updated and separated from "DOS/MBR boot sector" by Joerg Jenderek at May 2011
 # JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
 # JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
 # over BIOS parameter block (BPB)
 # over BIOS parameter block (BPB)
 # http://thestarman.pcministry.com/asm/2bytejumps.htm#FWD
 # http://thestarman.pcministry.com/asm/2bytejumps.htm#FWD
@@ -1553,25 +1799,33 @@
 ############################################################################
 ############################################################################
 # Minix-ST kernel floppy
 # Minix-ST kernel floppy
 0x800	belong		0x46fc2700	Atari-ST Minix kernel image
 0x800	belong		0x46fc2700	Atari-ST Minix kernel image
->19	string		\240\5\371\5\0\011\0\2\0	\b, 720k floppy
->19	string		\320\2\370\5\0\011\0\1\0	\b, 360k floppy
+# http://en.wikipedia.org/wiki/BIOS_parameter_block
+# floppies with valid BPB and any instruction at beginning
+>19	string		\240\005\371\005\0\011\0\2\0	\b, 720k floppy
+>19	string		\320\002\370\005\0\011\0\1\0	\b, 360k floppy
 
 
 ############################################################################
 ############################################################################
 # Hmmm, is this a better way of detecting _standard_ floppy images ?
 # Hmmm, is this a better way of detecting _standard_ floppy images ?
-19	string		\320\2\360\3\0\011\0\1\0	DOS floppy 360k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-19	string		\240\5\371\3\0\011\0\2\0	DOS floppy 720k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
+19	string		\320\002\360\003\0\011\0\1\0	DOS floppy 360k
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+19	string		\240\005\371\003\0\011\0\2\0	DOS floppy 720k
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
 19	string		\100\013\360\011\0\022\0\2\0	DOS floppy 1440k
 19	string		\100\013\360\011\0\022\0\2\0	DOS floppy 1440k
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-
-19	string		\240\5\371\5\0\011\0\2\0	DOS floppy 720k, IBM
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-19	string		\100\013\371\5\0\011\0\2\0	DOS floppy 1440k, mkdosfs
->0x1FE	leshort		0xAA55		\b, x86 hard disk boot sector
-
-19	string		\320\2\370\5\0\011\0\1\0	Atari-ST floppy 360k
-19	string		\240\5\371\5\0\011\0\2\0	Atari-ST floppy 720k
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+
+19	string		\240\005\371\005\0\011\0\2\0	DOS floppy 720k, IBM
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+19	string		\100\013\371\005\0\011\0\2\0	DOS floppy 1440k, mkdosfs
+>0x1FE	leshort		0xAA55		\b, DOS/MBR hard disk boot sector
+
+19	string		\320\002\370\005\0\011\0\1\0	Atari-ST floppy 360k
+19	string		\240\005\371\005\0\011\0\2\0	Atari-ST floppy 720k
+#			|       |   |     |     |
+#			|       |   |     |     heads
+#			|       |   |     sectors/track
+#			|       |   sectors/FAT
+#			|       media descriptor
+#		BPB:	sectors
 
 
 #  Valid media descriptor bytes for MS-DOS:
 #  Valid media descriptor bytes for MS-DOS:
 #
 #
@@ -1614,6 +1868,79 @@
 #  11111000	Hard disk any format
 #  11111000	Hard disk any format
 #
 #
 
 
+# all FAT12 (strength=70) floppies with sectorsize 512 added by Joerg Jenderek at Jun 2013
+# http://en.wikipedia.org/wiki/File_Allocation_Table#Exceptions
+512		ubelong&0xE0ffff00	0xE0ffff00		
+# without valid Media descriptor in place of BPB, cases with are done at other places
+>21		ubyte			<0xE5			floppy with old FAT filesystem
+# but valid Media descriptor at begin of FAT
+#>>512		ubyte			=0xed			720k
+#>>512		ubyte			=0xf0			1440k
+#>>512		ubyte			=0xf8			720k
+#>>512		ubyte			=0xf9			1220k
+#>>512		ubyte			=0xfa			320k
+#>>512		ubyte			=0xfb			640k
+>>512		ubyte			=0xfc			180k
+# look like an an old DOS directory entry
+>>>0xA0E	ubequad			0			
+>>>>0xA00	ubequad			!0			
+!:mime application/x-ima
+>>512		ubyte			=0xfd			
+# look for 2nd FAT at different location to distinguish between 360k and 500k
+>>>0x600	ubelong&0xE0ffff00	0xE0ffff00		360k
+#>>>0x500	ubelong&0xE0ffff00	0xE0ffff00		500k
+>>>0xA0E	ubequad			0			
+!:mime application/x-ima
+>>512		ubyte			=0xfe			
+>>>0x400	ubelong&0xE0ffff00	0xE0ffff00		160k
+>>>>0x60E	ubequad			0			
+>>>>>0x600	ubequad			!0			
+!:mime application/x-ima
+#>>>0xC00	ubelong&0xE0ffff00	0xE0ffff00		1200k
+>>512		ubyte			=0xff			320k
+>>>0x60E	ubequad			0			
+>>>>0x600	ubequad			!0			
+!:mime application/x-ima
+>>512		ubyte			x			\b, Media descriptor 0x%x
+# without x86 jump instruction
+>>0		ulelong&0x804000E9	!0x000000E9		
+# assembler instructions: CLI;MOV SP,1E7;MOV AX;07c0;MOV 	
+>>>0	ubequad				0xfabce701b8c0078e	\b, MS-DOS 1.12 bootloader
+# IOSYS.COM+MSDOS.COM
+>>>>0xc4	use			2xDOS-filename
+>>0		ulelong&0x804000E9	=0x000000E9	
+# only x86 short jump instruction found
+>>>0		ubyte			=0xEB
+>>>>1		ubyte			x			\b, code offset 0x%x+2
+# http://thestarman.pcministry.com/DOS/ibm100/Boot.htm
+# assembler instructions: CLI;MOV AX,CS;MOV DS,AX;MOV DX,0		
+>>>>(1.b+2)	ubequad			0xfa8cc88ed8ba0000	\b, PC-DOS 1.0 bootloader 
+# ibmbio.com+ibmdos.com
+>>>>>0x176	use			DOS-filename
+>>>>>0x181	ubyte			x			\b+
+>>>>>0x182	use			DOS-filename
+# http://thestarman.pcministry.com/DOS/ibm110/Boot.htm
+# assembler instructions: CLI;MOV AX,CS;MOV DS,AX;XOR DX,DX;MOV		
+>>>>(1.b+2)	ubequad			0xfa8cc88ed833d28e	\b, PC-DOS 1.1 bootloader 
+# ibmbio.com+ibmdos.com
+>>>>>0x18b	use			DOS-filename
+>>>>>0x196	ubyte			x			\b+
+>>>>>0x197	use			DOS-filename
+# http://en.wikipedia.org/wiki/Zenith_Data_Systems
+# assembler instructions: MOV BX,07c0;MOV SS,BX;MOV SP,01c6		
+>>>>(1.b+2)	ubequad			0xbbc0078ed3bcc601	\b, Zenith Data Systems MS-DOS 1.25 bootloader
+# IO.SYS+MSDOS.SYS
+>>>>>0x20	use			2xDOS-filename
+# http://en.wikipedia.org/wiki/Corona_Data_Systems
+# assembler instructions: MOV AX,CS;MOV DS,AX;CLI;MOV SS,AX;		
+>>>>(1.b+2)	ubequad			0x8cc88ed8fa8ed0bc	\b, MS-DOS 1.25 bootloader
+# IO.SYS+MSDOS.SYS
+>>>>>0x69	use			2xDOS-filename
+# assembler instructions: CLI;PUSH CS;POP SS;MOV SP,7c00;		
+>>>>(1.b+2)	ubequad			0xfa0e17bc007cb860	\b, MS-DOS 2.11 bootloader
+# defect IO.SYS+MSDOS.SYS ?
+#>>>>>0x162	use			2xDOS-filename
+
 # CDROM Filesystems
 # CDROM Filesystems
 # Modified for UDF by gerardo.cacciari@gmail.com
 # Modified for UDF by gerardo.cacciari@gmail.com
 32769	string    CD001     #
 32769	string    CD001     #
@@ -1630,7 +1957,7 @@
 >34816	string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
 >34816	string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
 37633	string    CD001     ISO 9660 CD-ROM filesystem data (raw 2352 byte sectors)
 37633	string    CD001     ISO 9660 CD-ROM filesystem data (raw 2352 byte sectors)
 !:mime	application/x-iso9660-image
 !:mime	application/x-iso9660-image
-32776	string    CDROM     High Sierra CD-ROM filesystem data
+32777	string    CDROM     High Sierra CD-ROM filesystem data
 
 
 # .cso files
 # .cso files
 0    string    CISO	Compressed ISO CD image
 0    string    CISO	Compressed ISO CD image
@@ -1988,3 +2315,12 @@
 0	beshort	0xAA5A		floppy image data (IBM SaveDskF, compressed)
 0	beshort	0xAA5A		floppy image data (IBM SaveDskF, compressed)
 
 
 0	string	\074CPM_Disk\076	disk image data (YAZE)
 0	string	\074CPM_Disk\076	disk image data (YAZE)
+
+# ReFS
+# Richard W.M. Jones <rjones@redhat.com>
+0	string	\0\0\0ReFS\0	ReFS filesystem image
+
+# EFW encase image file format:
+# Gregoire Passault
+# http://www.forensicswiki.org/wiki/Encase_image_file_format
+0	string	EVF\x09\x0d\x0a\xff\x00	EWF/Expert Witness/EnCase image file format

+ 4 - 1
magic/Magdir/fsav

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: fsav,v 1.11 2009/09/19 16:28:09 christos Exp $
+# $File: fsav,v 1.13 2013/03/25 17:18:47 christos Exp $
 # fsav:  file(1) magic for datafellows fsav virus definition files
 # fsav:  file(1) magic for datafellows fsav virus definition files
 # Anthon van der Neut (anthon@mnt.org)
 # Anthon van der Neut (anthon@mnt.org)
 
 
@@ -61,3 +61,6 @@
 # Type: Grisoft AVG AntiVirus
 # Type: Grisoft AVG AntiVirus
 # From: David Newgas <david@newgas.net>
 # From: David Newgas <david@newgas.net>
 0	string	AVG7_ANTIVIRUS_VAULT_FILE	AVG 7 Antivirus vault file data
 0	string	AVG7_ANTIVIRUS_VAULT_FILE	AVG 7 Antivirus vault file data
+
+0	string	X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR
+>33	string	-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*	EICAR virus test files

+ 10 - 6
magic/Magdir/gimp

@@ -1,13 +1,17 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: gimp,v 1.7 2010/09/20 18:55:20 rrt Exp $
-# GIMP Gradient: file(1) magic for the GIMP's gradient data files
+# $File: gimp,v 1.8 2013/12/21 14:29:45 christos Exp $
+# GIMP Gradient: file(1) magic for the GIMP's gradient data files (.ggr)
 # by Federico Mena <federico@nuclecu.unam.mx>
 # by Federico Mena <federico@nuclecu.unam.mx>
 
 
-0       string          GIMP\ Gradient  GIMP gradient data
+0       string/t        GIMP\ Gradient  GIMP gradient data
+
+# GIMP palette (.gpl)
+# From: Markus Heidelberg <markus.heidelberg@web.de>
+0       string/t        GIMP\ Palette   GIMP palette data
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the XCF image format used in the GIMP developed
+# XCF:  file(1) magic for the XCF image format used in the GIMP (.xcf) developed
 #       by Spencer Kimball and Peter Mattis
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 #       ('Bucky' LaDieu, nega@vt.edu)
 
 
@@ -24,7 +28,7 @@
 >22	belong		>2		Unknown Image Type.
 >22	belong		>2		Unknown Image Type.
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the patterns used in the GIMP, developed
+# XCF:  file(1) magic for the patterns used in the GIMP (.pat), developed
 #       by Spencer Kimball and Peter Mattis
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 #       ('Bucky' LaDieu, nega@vt.edu)
 
 
@@ -32,7 +36,7 @@
 >24     string          x               %s
 >24     string          x               %s
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# XCF:  file(1) magic for the brushes used in the GIMP, developed
+# XCF:  file(1) magic for the brushes used in the GIMP (.gbr), developed
 #       by Spencer Kimball and Peter Mattis
 #       by Spencer Kimball and Peter Mattis
 #       ('Bucky' LaDieu, nega@vt.edu)
 #       ('Bucky' LaDieu, nega@vt.edu)
 
 

+ 12 - 1
magic/Magdir/gnu

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: gnu,v 1.14 2012/10/03 23:38:12 christos Exp $
+# $File: gnu,v 1.15 2014/02/06 14:21:02 christos Exp $
 # gnu:  file(1) magic for various GNU tools
 # gnu:  file(1) magic for various GNU tools
 #
 #
 # GNU nlsutils message catalog file format
 # GNU nlsutils message catalog file format
@@ -52,6 +52,17 @@
 >>2	leshort		0x0d04		GPG symmetrically encrypted data (CAMELLIA256 cipher)
 >>2	leshort		0x0d04		GPG symmetrically encrypted data (CAMELLIA256 cipher)
 
 
 
 
+# GnuPG Keybox file
+# <http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=kbx/keybox-blob.c;hb=HEAD>
+# From: Philipp Hahn <hahn@univention.de>
+0	belong	32
+>4	byte	1
+>>8	string	KBXf	GPG keybox database
+>>>5	byte	1	version %d
+>>>16	bedate	x	\b, created-at %s
+>>>20	bedate	x	\b, last-maintained %s
+
+
 # Gnumeric spreadsheet
 # Gnumeric spreadsheet
 # This entry is only semi-helpful, as Gnumeric compresses its files, so
 # This entry is only semi-helpful, as Gnumeric compresses its files, so
 # they will ordinarily reported as "compressed", but at least -z helps
 # they will ordinarily reported as "compressed", but at least -z helps

+ 10 - 7
magic/Magdir/ibm6000

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: ibm6000,v 1.11 2013/01/08 20:13:01 christos Exp $
+# $File: ibm6000,v 1.12 2013/09/16 15:12:42 christos Exp $
 # ibm6000:  file(1) magic for RS/6000 and the RT PC.
 # ibm6000:  file(1) magic for RS/6000 and the RT PC.
 #
 #
 0	beshort		0x01df		executable (RISC System/6000 V3.1) or obj module
 0	beshort		0x01df		executable (RISC System/6000 V3.1) or obj module
@@ -20,9 +20,12 @@
 
 
 0	beshort		0x01f7		64-bit XCOFF executable or object module
 0	beshort		0x01f7		64-bit XCOFF executable or object module
 >20	belong		0		not stripped
 >20	belong		0		not stripped
-4	belong		&0x0feeddb0	AIX core file
->1	byte		&0x01		fulldump
->7	byte		&0x01		32-bit
->>0x6e0 string		>\0		\b, %s
->7	byte		&0x02		64-bit
->>0x524 string		>\0		\b, %s
+# GRR: this test is still too general as it catches also many FATs of DOS filesystems
+4	belong		&0x0feeddb0	
+# real core dump could not be 32-bit and 64-bit together
+>7	byte&0x03	!3		AIX core file
+>>1	byte		&0x01		fulldump
+>>7	byte		&0x01		32-bit
+>>>0x6e0	string	>\0		\b, %s
+>>7	byte		&0x02		64-bit
+>>>0x524	string	>\0		\b, %s

+ 74 - 20
magic/Magdir/images

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: images,v 1.81 2013/03/09 22:36:00 christos Exp $
+# $File: images,v 1.87 2013/12/11 14:14:20 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 # XPM bitmaps)
 #
 #
@@ -34,39 +34,39 @@
 # The next byte following the magic is always whitespace.
 # The next byte following the magic is always whitespace.
 # strength is changed to try these patterns before "x86 boot sector"
 # strength is changed to try these patterns before "x86 boot sector"
 0	search/1	P1		
 0	search/1	P1		
->3	regex		=[0-9]*\ [0-9]*		Netpbm PBM image text
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-bitmap
 !:mime	image/x-portable-bitmap
 0	search/1	P2		
 0	search/1	P2		
->3	regex		=[0-9]*\ [0-9]*		Netpbm PGM image text
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-greymap
 !:mime	image/x-portable-greymap
-0	search/1	P3		Netpbm PPM image text
->3	regex		=[0-9]*\ [0-9]*		Netpbm PPM image text
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+0	search/1	P3
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM image text
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-pixmap
 !:mime	image/x-portable-pixmap
 0	string		P4		
 0	string		P4		
->3	regex		=[0-9]*\ [0-9]*		Netpbm PBM "rawbits" image data
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-bitmap
 !:mime	image/x-portable-bitmap
 0	string		P5		
 0	string		P5		
->3	regex		=[0-9]*\ [0-9]*		Netpbm PGM "rawbits" image data
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-greymap
 !:mime	image/x-portable-greymap
 0	string		P6		
 0	string		P6		
->3	regex		=[0-9]*\ [0-9]*		Netpbm PPM "rawbits" image data
->3	regex		=[0-9]+\ 		\b, size = %sx
->>3	regex		=\ [0-9]+	\b%s
+>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM "rawbits" image data
+>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
+>>3	regex		=\ [0-9]{1,50}	\b%s
 !:strength + 45
 !:strength + 45
 !:mime	image/x-portable-pixmap
 !:mime	image/x-portable-pixmap
 0	string		P7		Netpbm PAM image file
 0	string		P7		Netpbm PAM image file
@@ -256,6 +256,8 @@
 # at offset 8 starts imagedata followed by "RGB " marker
 # at offset 8 starts imagedata followed by "RGB " marker
 
 
 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
+# http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
+# 28bitmap_information_header.29
 0	string		BM
 0	string		BM
 >14	leshort		12		PC bitmap, OS/2 1.x format
 >14	leshort		12		PC bitmap, OS/2 1.x format
 !:mime	image/x-ms-bmp
 !:mime	image/x-ms-bmp
@@ -270,6 +272,16 @@
 >>18	lelong		x		\b, %d x
 >>18	lelong		x		\b, %d x
 >>22	lelong		x		%d x
 >>22	lelong		x		%d x
 >>28	leshort		x		%d
 >>28	leshort		x		%d
+>14	leshort		124		PC bitmap, Windows 98/2000 and newer format
+!:mime	image/x-ms-bmp
+>>18	lelong		x		\b, %d x
+>>22	lelong		x		%d x
+>>28	leshort		x		%d
+>14	leshort		108		PC bitmap, Windows 95/NT4 and newer format
+!:mime	image/x-ms-bmp
+>>18	lelong		x		\b, %d x
+>>22	lelong		x		%d x
+>>28	leshort		x		%d
 >14	leshort		128		PC bitmap, Windows NT/2000 format
 >14	leshort		128		PC bitmap, Windows NT/2000 format
 !:mime	image/x-ms-bmp
 !:mime	image/x-ms-bmp
 >>18	lelong		x		\b, %d x
 >>18	lelong		x		\b, %d x
@@ -734,6 +746,15 @@
 !:mime	application/x-hdf
 !:mime	application/x-hdf
 0	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
 0	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
 !:mime	application/x-hdf
 !:mime	application/x-hdf
+512	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 512 bytes user block
+!:mime	application/x-hdf
+1024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
+!:mime	application/x-hdf
+2048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
+!:mime	application/x-hdf
+4096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
+!:mime	application/x-hdf
+
 
 
 # From: Tobias Burnus <burnus@net-b.de>
 # From: Tobias Burnus <burnus@net-b.de>
 # Xara (for a while: Corel Xara) is a graphic package, see
 # Xara (for a while: Corel Xara) is a graphic package, see
@@ -769,6 +790,34 @@
 # From Tano M Fotang <mfotang@quanteq.com>
 # From Tano M Fotang <mfotang@quanteq.com>
 0	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
 0	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
 
 
+# Type:		PCO B16 image files
+# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
+# From:		Florian Philipp <florian.philipp@binarywings.net>
+# Extension:	.b16
+# Description:	Pixel image format produced by PCO Camware, typically used
+#		together with PCO cameras.
+# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
+#		Documentation is incomplete.
+0	string/b	PCO-	PCO B16 image data
+>12	lelong		x	\b, %dx
+>16	lelong		x	\b%d
+>20	lelong		0	\b, short header
+>20	lelong		-1	\b, extended header
+>>24	lelong		0	\b, grayscale
+>>>36	lelong		0	linear LUT
+>>>36	lelong		1	logarithmic LUT
+>>>28	lelong		x	[%d
+>>>32	lelong		x	\b,%d]
+>>24	lelong		1	\b, color
+>>>64	lelong		0	linear LUT
+>>>64	lelong		1	logarithmic LUT
+>>>40	lelong		x	r[%d
+>>>44	lelong		x	\b,%d]
+>>>48	lelong		x	g[%d
+>>>52	lelong		x	\b,%d]
+>>>56	lelong		x	b[%d
+>>>60	lelong		x	\b,%d]
+
 # Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
 # Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
 # From: Markus Heidelberg <markus.heidelberg at web.de>
 # From: Markus Heidelberg <markus.heidelberg at web.de>
 0	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
 0	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
@@ -838,3 +887,8 @@
 # Not really an image.
 # Not really an image.
 # From: "Tano M. Fotang" <mfotang@quanteq.com>
 # From: "Tano M. Fotang" <mfotang@quanteq.com>
 0	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
 0	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
+
+# WEBP https://developers.google.com/speed/webp/docs/riff_container
+0	string	RIFF
+>8	string	WEBP	Web/P image data
+>>4	lelong	x	\b, %d bytes

+ 1 - 20
magic/Magdir/java

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------
 #------------------------------------------------------------
-# $File: java,v 1.14 2013/02/08 16:54:45 christos Exp $
+# $File: java,v 1.16 2013/09/24 20:22:03 christos Exp $
 # Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
 # Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
 # same magic number, 0xcafebabe, so they are both handled
 # same magic number, 0xcafebabe, so they are both handled
 # in the entry called "cafebabe".
 # in the entry called "cafebabe".
@@ -15,25 +15,6 @@
 0	belong		0xcececece	Java JCE KeyStore
 0	belong		0xcececece	Java JCE KeyStore
 !:mime	application/x-java-jce-keystore
 !:mime	application/x-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
-
 # Java source
 # Java source
 0	regex	^import.*;$	Java source
 0	regex	^import.*;$	Java source
 !:mime	text/x-java
 !:mime	text/x-java
-
-# http://android.stackexchange.com/questions/23357/\
-# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\
-# 23608#23608
-0	string	ANDROID\040BACKUP\n	Android Backup
->15	string	1\n			\b, version 1
->17	string	0\n			\b, uncompressed
->17	string	1\n			\b, compressed
->19	string	none\n			\b, unencrypted
->19	string	AES-256\n		\b, encrypted AES-256

+ 55 - 4
magic/Magdir/linux

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: linux,v 1.47 2013/02/06 14:18:52 christos Exp $
+# $File: linux,v 1.53 2014/01/08 22:26:12 christos Exp $
 # linux:  file(1) magic for Linux files
 # linux:  file(1) magic for Linux files
 #
 #
 # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
 # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@@ -48,7 +48,10 @@
 2	string		LILO		Linux/i386 LILO boot/chain loader
 2	string		LILO		Linux/i386 LILO boot/chain loader
 #
 #
 # Linux make config build file, from Ole Aamot <oka@oka.no>
 # Linux make config build file, from Ole Aamot <oka@oka.no>
-28 	string		make\ config	Linux make config build file
+# Updated by Ken Sharp
+28	string		make\ config		Linux make config build file (old)
+49	search/70	Kernel\ Configuration	Linux make config build file
+
 #
 #
 # PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
 # PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
 # Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
 # Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
@@ -98,12 +101,13 @@
 # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
 # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
 # Linux kernel boot images (i386 arch) (Wolfram Kleff)
 # Linux kernel boot images (i386 arch) (Wolfram Kleff)
 514	string		HdrS		Linux kernel
 514	string		HdrS		Linux kernel
-!:strength + 5
+!:strength + 55
 >510	leshort		0xAA55		x86 boot executable
 >510	leshort		0xAA55		x86 boot executable
 >>518	leshort		>0x1ff
 >>518	leshort		>0x1ff
 >>>529	byte		0		zImage,
 >>>529	byte		0		zImage,
 >>>529	byte		1		bzImage,
 >>>529	byte		1		bzImage,
->>>(526.s+0x200) string	>\0		version %s,
+>>>526	lelong		>0
+>>>>(526.s+0x200) string	>\0	version %s,
 >>498	leshort		1		RO-rootFS,
 >>498	leshort		1		RO-rootFS,
 >>498	leshort		0		RW-rootFS,
 >>498	leshort		0		RW-rootFS,
 >>508	leshort		>0		root_dev 0x%X,
 >>508	leshort		>0		root_dev 0x%X,
@@ -344,3 +348,50 @@
 #>2	regex		\(name\ [^)]*\)		%s
 #>2	regex		\(name\ [^)]*\)		%s
 >20	search/256	(name			(name
 >20	search/256	(name			(name
 >>&1	string		x			%s...)
 >>&1	string		x			%s...)
+
+# Systemd journald files
+# See http://www.freedesktop.org/wiki/Software/systemd/journal-files/.
+# From: Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl>
+
+# check magic
+0	string	LPKSHHRH
+# check that state is one of known values
+>16		ubyte&252	0
+# check that each half of three unique id128s is non-zero
+>>24		ubequad		>0
+>>>32		ubequad		>0
+>>>>40		ubequad		>0
+>>>>>48		ubequad		>0
+>>>>>>56	ubequad		>0
+>>>>>>>64	ubequad		>0	Journal file
+!:mime application/octet-stream
+# provide more info
+>>>>>>>>184	leqdate		0	empty
+>>>>>>>>16	ubyte		0	\b, offline
+>>>>>>>>16	ubyte		1	\b, online
+>>>>>>>>16	ubyte		2	\b, archived
+>>>>>>>>8	ulelong&1	1	\b, sealed
+>>>>>>>>12	ulelong&1	1	\b, compressed
+
+# BCache backing and cache devices
+# From: Gabriel de Perthuis <g2p.code@gmail.com>
+0x1008		lequad		8
+>0x1018		string		\xc6\x85\x73\xf6\x4e\x1a\x45\xca\x82\x65\xf5\x7f\x48\xba\x6d\x81	BCache
+>>0x1010	ulequad		0	cache device
+>>0x1010	ulequad		1	backing device
+>>0x1010	ulequad		3	cache device
+>>0x1010	ulequad		4	backing device
+>>0x1048	string		>0	\b, label "%.32s"
+>>0x1028	ubelong		x	\b, uuid %08x
+>>0x102c	ubeshort	x	\b-%04x
+>>0x102e	ubeshort	x	\b-%04x
+>>0x1030	ubeshort	x	\b-%04x
+>>0x1032	ubelong		x	\b-%08x
+>>0x1036	ubeshort	x	\b%04x
+>>0x1038	ubelong		x	\b, set uuid %08x
+>>0x103c	ubeshort	x	\b-%04x
+>>0x103e	ubeshort	x	\b-%04x
+>>0x1040	ubeshort	x	\b-%04x
+>>0x1042	ubelong		x	\b-%08x
+>>0x1046	ubeshort	x	\b%04x
+

+ 4 - 1
magic/Magdir/macintosh

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: macintosh,v 1.22 2011/05/17 17:40:31 rrt Exp $
+# $File: macintosh,v 1.23 2013/11/19 18:47:58 christos Exp $
 # macintosh description
 # macintosh description
 #
 #
 # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
 # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
@@ -263,6 +263,9 @@
 0	string		$FL2		SPSS System File
 0	string		$FL2		SPSS System File
 >24	string		x		%s
 >24	string		x		%s
 
 
+0	string		$FL3		SPSS System File
+>24	string		x		%s
+
 # Macintosh filesystem data
 # Macintosh filesystem data
 # From "Tom N Harris" <telliamed@mac.com>
 # From "Tom N Harris" <telliamed@mac.com>
 # Fixed HFS+ and Partition map magic: Ethan Benson <erbenson@alaska.net>
 # Fixed HFS+ and Partition map magic: Ethan Benson <erbenson@alaska.net>

+ 16 - 1
magic/Magdir/msdos

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.85 2013/03/09 22:36:00 christos Exp $
+# $File: msdos,v 1.86 2014/01/08 22:10:18 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 # msdos:  file(1) magic for MS-DOS files
 #
 #
 
 
@@ -820,6 +820,21 @@
 >>24	bequad	x	\b, %lld bytes
 >>24	bequad	x	\b, %lld bytes
 >>32	belong	1	\b, AES-encrypted
 >>32	belong	1	\b, AES-encrypted
 
 
+>4	belong	3	(v3)
+# Using the existence of the Backing File Offset to determine whether
+# to read Backing File Information
+>>8	bequad  >0	 \b, has backing file
+# Note that this isn't a null-terminated string; the length is actually
+# (16.L). Assuming a null-terminated string happens to work usually, but it
+# may spew junk until it reaches a \0 in some cases. Also, since there's no
+# .Q modifier, we just use the bottom four bytes as an offset. Note that if
+# the file is over 4G, and the backing file path is stored after the first 4G,
+# the wrong filename will be printed. (This should be (8.Q), when that syntax
+# is introduced.)
+>>>(12.L)	 string >\0	(path %s)
+>>24	bequad	x	\b, %lld bytes
+>>32	belong	1	\b, AES-encrypted
+
 >4	default x	(unknown version)
 >4	default x	(unknown version)
 
 
 0	string/b	QEVM		QEMU suspend to disk image
 0	string/b	QEVM		QEMU suspend to disk image

+ 17 - 16
magic/Magdir/msooxml

@@ -1,35 +1,36 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: msooxml,v 1.2 2013/01/25 23:04:37 christos Exp $
+# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
 # msooxml:  file(1) magic for Microsoft Office XML
 # msooxml:  file(1) magic for Microsoft Office XML
 # From: Ralf Brown <ralf.brown@gmail.com>
 # From: Ralf Brown <ralf.brown@gmail.com>
 
 
 # .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
 # .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
 #   archive.  The first member file is normally "[Content_Types].xml".
 #   archive.  The first member file is normally "[Content_Types].xml".
+#   but some libreoffice generated files put this later. Perhaps skip
+#   the "[Content_Types].xml" test?
 # Since MSOOXML doesn't have anything like the uncompressed "mimetype"
 # Since MSOOXML doesn't have anything like the uncompressed "mimetype"
 #   file of ePub or OpenDocument, we'll have to scan for a filename
 #   file of ePub or OpenDocument, we'll have to scan for a filename
 #   which can distinguish between the three types
 #   which can distinguish between the three types
 
 
 # start by checking for ZIP local file header signature
 # start by checking for ZIP local file header signature
-0               string          PK\003\004
+0		string		PK\003\004
+!:strength +10
 # make sure the first file is correct
 # make sure the first file is correct
->0x1E           string          [Content_Types].xml
+>0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
 # skip to the second local file header
 # skip to the second local file header
-#   since some documents include a 520-byte extra field following the file
-#   header,  we need to scan for the next header
->>(18.l+49)     search/2000     PK\003\004
+# since some documents include a 520-byte extra field following the file
+# header, we need to scan for the next header
+>>(18.l+49)	search/2000	PK\003\004
 # now skip to the *third* local file header; again, we need to scan due to a
 # now skip to the *third* local file header; again, we need to scan due to a
-#   520-byte extra field following the file header
->>>&26          search/1000     PK\003\004
+# 520-byte extra field following the file header
+>>>&26		search/1000	PK\003\004
 # and check the subdirectory name to determine which type of OOXML
 # and check the subdirectory name to determine which type of OOXML
-#   file we have
-#   Correct the mimetype with the registered ones:
-#     http://technet.microsoft.com/en-us/library/cc179224.aspx
->>>>&26         string          word/           Microsoft Word 2007+
+# file we have.  Correct the mimetype with the registered ones:
+# http://technet.microsoft.com/en-us/library/cc179224.aspx
+>>>>&26		string		word/		Microsoft Word 2007+
 !:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
 !:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
->>>>&26         string          ppt/            Microsoft PowerPoint 2007+
+>>>>&26		string		ppt/		Microsoft PowerPoint 2007+
 !:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
 !:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
->>>>&26         string          xl/             Microsoft Excel 2007+
+>>>>&26		string		xl/		Microsoft Excel 2007+
 !:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
 !:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
->>>>&26         default         x               Microsoft OOXML
-!:strength +10
+>>>>&26		default		x		Microsoft OOXML

+ 255 - 0
magic/Magdir/msx

@@ -0,0 +1,255 @@
+
+#------------------------------------------------------------------------------
+# msx:  file(1) magic for the MSX Home Computer
+# v1.1
+# Fábio R. Schmidlin <sd-snatcher@users.sourceforge.net>
+
+############## MSX Music file formats ##############
+
+# Gigamix MGSDRV music file
+0	string		MGS	MSX Gigamix MGSDRV3 music file, 
+>6	ubeshort	0x0D0A
+>>3	byte		x	\bv%c
+>>4	byte		x	\b.%c
+>>5	byte		x	\b%c
+>>8	string		>\0	\b, title: %s
+
+1	string		mgs2\ 	MSX Gigamix MGSDRV2 music file
+>6	uleshort	0x80
+>>0x2E	uleshort	0
+>>>0x30	string		>\0	\b, title: %s
+
+# KSS music file
+0	string		KSCC	KSS music file v1.03
+>0xE	byte		0
+>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
+>>0xF	byte&0x02	2	\b, soundchip(s): SN76489
+>>>0xF	byte&0x04	4	stereo
+>>0xF	byte&0x01	1	\b, YM2413
+>>0xF	byte&0x08	8	\b, Y8950
+
+0	string		KSSX	KSS music file v1.20
+>0xE	byte&0xEF	0
+>>0xF	byte&0x40	0x00	\b, 60Hz
+>>0xF	byte&0x40	0x40	\b, 50Hz
+>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
+>>0xF	byte&0x02	0x02	\b, soundchips: SN76489
+>>>0xF	byte&0x04	0x04	stereo
+>>0xF	byte&0x01	0x01	\b, 
+>>>0xF	byte&0x18	0x00	\bYM2413
+>>>0xF	byte&0x18	0x08	\bYM2413, Y8950
+>>>0xF	byte&0x18	0x18	\bYM2413+Y8950 pseudostereo
+>>0xF	byte&0x18	0x10	\b, Majyutsushi DAC
+
+# Moonblaster for Moonsound
+0	string		MBMS
+>4	byte		0x10	MSX Moonblaster for MoonSound music
+
+# Music Player K-kaz
+0	string		MPK	MSX Music Player K-kaz song
+>6	ubeshort	0x0D0A
+>>3	byte		x	v%c
+>>4	byte		x	\b.%c
+>>5	byte		x	\b%c
+
+# I don't know why these don't work
+#0	search/0xFFFF	\r\n.FM9
+#>0	search/0xFFFF	\r\n#FORMAT	MSX Music Player K-kaz source MML file
+#0	search/0xFFFF	\r\nFM1\ \=
+#>0	search/0xFFFF	\r\nPSG1\=
+#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file
+
+# OPX Music file
+0x35	beshort		0x0d0a
+>0x7B	beshort		0x0d0a
+>>0x7D	byte		0x1a
+>>>0x87	uleshort	0		MSX OPX Music file
+>>>>0x86	byte		0		v1.5
+>>>>>0	string		>\32		\b, title: %s
+>>>>0x86	byte		1		v2.4
+>>>>>0	string		>\32		\b, title: %s
+
+# SCMD music file
+0x8B	string		SCMD
+>0xCE	uleshort	0	MSX SCMD Music file
+#>>-2	uleshort	0x6a71	; The file must end with this value. How to code this here?
+>>0x8F	string		>\0		\b, title: %s
+
+0	search/0xFFFF	\r\n@title
+>&0	search/0xFFFF	\r\n@m=[	MSX SCMD source MML file
+
+
+############## MSX image file formats ##############
+
+# MSX raw VRAM dump
+0	ubyte		0xFE
+>1	uleshort	0
+>>5	uleshort	0
+>>>3	uleshort	0x37FF		MSX SC2/GRP raw image
+>>>3	uleshort	0x6A00		MSX Graph Saurus SR5 raw image
+>>>3	uleshort	>0x769E
+>>>>3	uleshort	<0x8000		MSX GE5/GE6 raw image
+>>>>>3	uleshort	0x7FFF		\b, with sprite patterns
+>>>3	uleshort	0xD3FF		MSX screen 7-12 raw image
+>>>3	uleshort	0xD400		MSX Graph Saurus SR7/SR8/SRS raw image
+
+# Graph Saurus compressed images
+0	ubyte		0xFD
+>1	uleshort	0
+>>5	uleshort	0
+>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image
+
+# Maki-chan Graphic format
+0	string		MAKI02\ \ 	Maki-chan image,
+>8	byte		x		system ID: %c
+>9	byte		x		\b%c
+>10	byte		x		\b%c
+>11	byte		x		\b%c,
+>13	search/0x200	\x1A
+# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
+# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
+# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
+# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
+# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
+# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
+# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
+# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
+>>&8	uleshort+1	x		%dx
+>>&10	uleshort+1	x		\b%d,
+>>&3	ubyte&0x82	0x80		256 colors
+>>&3	ubyte&0x82	0x00		16 colors
+>>&3	ubyte&0x82	0x01		8 colors
+>>&3	ubyte&0x04	4		digital
+>>&3	ubyte&0x04	0		analog
+>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio
+
+# Japanese PIC file
+0	string		PIC\x1A
+>4	lelong		0		Japanese PIC image file
+
+# MSX G9B image file
+0	string		G9B
+>1	uleshort	11
+>>3	uleshort	>10
+>>>5	ubyte		>0		MSX G9B image, depth=%d
+>>>>8	uleshort	x		\b, %dx
+>>>>10	uleshort	x		\b%d
+>>>>5	ubyte		<9
+>>>>>6	ubyte		0
+>>>>>>7	ubyte		x		\b, codec=%d RGB color palettes
+>>>>>6	ubyte		64		\b, codec=RGB fixed color
+>>>>>6	ubyte		128		\b, codec=YJK
+>>>>>6	ubyte		192		\b, codec=YUV
+>>>>5	ubyte		>8		codec=RGB fixed color
+>>>>12	ubyte		0		\b, raw
+>>>>12	ubyte		1		\b, bitbuster compression
+
+############## Other MSX file formats ##############
+
+# MSX ROMs
+0	string		AB
+>2	uleshort	0x0010			MSX ROM
+>>2	uleshort	x			\b, init=0x%4x
+>>4	uleshort	>0			\b, stat=0x%4x
+>>6	uleshort	>0			\b, dev=0x%4x
+>>8	uleshort	>0			\b, bas=0x%4x
+>2	uleshort	0x4010			MSX ROM
+>>2	uleshort	x			\b, init=0x%04x
+>>4	uleshort	>0			\b, stat=0x%04x
+>>6	uleshort	>0			\b, dev=0x%04x
+>>8	uleshort	>0			\b, bas=0x%04x
+>2	uleshort	0x8010			MSX ROM
+>>2	uleshort	x			\b, init=0x%04x
+>>4	uleshort	>0			\b, stat=0x%04x
+>>6	uleshort	>0			\b, dev=0x%04x
+>>8	uleshort	>0			\b, bas=0x%04x
+
+0	string		AB
+#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
+#>3	string		@HYDLIDE3MSX		MSX Hydlide-3 ROM
+#>3	string		@3\x80IA862		Golvellius MSX1 ROM
+>2	uleshort	>10
+>>10	string		\0\0\0\0\0\0		MSX ROM
+>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
+>>>0x10	string		CD			\b, Konami RC-
+>>>>0x12	ubyte		x			\b%d
+>>>>0x13	ubyte/16	x			\b%d
+>>>>0x13	ubyte&0xF	x			\b%d
+>>>0x10	string		EF			\b, Konami RC-
+>>>>0x12	ubyte		x			\b%d
+>>>>0x13	ubyte/16	x			\b%d
+>>>>0x13	ubyte&0xF	x			\b%d
+>>>2	uleshort	x			\b, init=0x%04x
+>>>4	uleshort	>0			\b, stat=0x%04x
+>>>6	uleshort	>0			\b, dev=0x%04x
+>>>8	uleshort	>0			\b, bas=0x%04x
+>2	uleshort	0
+>>4	uleshort	0
+>>>6	uleshort	0
+>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x
+
+0x4000	string		AB
+>0x4002	uleshort	>0x4010
+>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x4002	uleshort	x			\b, init=0x%04x
+>>0x4004	uleshort	>0			\b, stat=0x%04x
+>>0x4006	uleshort	>0			\b, dev=0x%04x
+>>0x4008	uleshort	>0			\b, bas=0x%04x
+
+0x8000	string		AB
+>0x8002	uleshort	>0x4010
+>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x8002	uleshort	x			\b, init=0x%04x
+>>0x8004	uleshort	>0			\b, stat=0x%04x
+>>0x8006	uleshort	>0			\b, dev=0x%04x
+>>0x8008	uleshort	>0			\b, bas=0x%04x
+
+
+0x3C000	string		AB
+>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
+>>0x3C002	uleshort	x			\b, init=0x%04x
+>>0x3C004	uleshort	>0			\b, stat=0x%04x
+>>0x3C006	uleshort	>0			\b, dev=0x%04x
+>>0x3C008	uleshort	>0			\b, bas=0x%04x
+
+# MSX BIN file
+#0	byte		0xFE
+#>1	uleshort	>0x8000
+#>>3	uleshort	>0x8004
+#>>>5	uleshort	>0x8000			MSX BIN file
+
+# MSX-BASIC file
+0	byte		0xFF
+>3	uleshort	0x000A
+>>1	uleshort	>0x8000			MSX-BASIC program
+
+# MSX .CAS file
+0	string	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
+
+# Mega-Assembler file
+0	byte		0xFE
+>1	uleshort	0x0001
+>>5	uleshort	0xffff
+>>>6	byte		0x0A		MSX Mega-Assembler source
+
+# Execrom Patchfile
+0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
+>0x12	ubyte/16	x		v%d
+>0x12	ubyte&0xF	x		\b.%d
+>0x13	ubyte		x		\b, contains %d patches
+
+# Konami's King's Valley-2 custom stage (ELG file)
+4	uleshort	0x0900
+>0xF	byte		1
+>>0x14	byte		0
+>>>0x1E	string		\ \ \ 
+>>>>0x23	byte	1
+>>>>>0x25	byte	0
+>>>>>>0x15	string	>\x30
+>>>>>>>0x15	string	<\x5A		Konami King's Valley-2 custom stage, title: "%-8.8s"
+>>>>>>>>0x1D	byte	<32	\b, theme: %d
+
+# Metal Gear 1 savegame
+#0x4F	string	\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>0x60	string	\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>>0x7B	string	\0x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00	Metal Gear 1 savegame

+ 63 - 11
magic/Magdir/palm

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: palm,v 1.9 2012/01/16 15:16:43 christos Exp $
+# $File: palm,v 1.11 2013/12/31 19:18:02 christos Exp $
 # palm:	 file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
 # palm:	 file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
 #
 #
 # Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
 # Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
@@ -9,18 +9,70 @@
 # 8 character identifiers at byte 60, one I found for appl is BIGb.
 # 8 character identifiers at byte 60, one I found for appl is BIGb.
 # What are the possibilities and where is this documented?
 # What are the possibilities and where is this documented?
 
 
+# The common header format for PalmOS .pdb/.prc files is
+# {
+#         char            name[ 32 ];
+#         Word            attributes;
+#         Word            version;
+#         DWord           creationDate;
+#         DWord           modificationDate;
+#         DWord           lastBackupDate;
+#         DWord           modificationNumber;
+#         DWord           appInfoID;
+#         DWord           sortInfoID;
+#         char            type[4];
+#         char            creator[4];
+#         DWord           uniqueIDSeed;
+#         RecordListType  recordList;
+# };
+#
+# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904),
+# or Unix/POSIX time + 2082844800.
+
+0		name		aportisdoc
+# date is supposed to be big-endian seconds since 1 Jan 1904, but many
+# files contain the timestamp in little-endian or a completely
+# nonsensical value...
+#>36		bedate-2082844800	>0	\b, created %s
+# compression: 1=uncomp, 2=orig, 0x4448=HuffDic
+>(78.L)		beshort		=1		\b, uncompressed
+# compressed
+>(78.L)		beshort		>1
+>>(78.L+4)	belong		x		\b, %d bytes uncompressed
+
 # appl
 # appl
-#59	byte			\0
-#>60	string			appl		PalmOS application
-#>0	string			>\0		"%s"
-# TEXt
-#59	byte			\0
-#>60	belong			TEXt		AportisDoc file
-#>0	string			>\0		"%s"
+#60		string		appl		PalmOS application
+#>0		string		>\0		"%s"
+
 # HACK
 # HACK
-#59	byte			\0
-#>60	string			HACK		HackMaster hack
-#>0	string			>\0		"%s"
+#60		string		HACK		HackMaster hack
+#>0		string		>\0		"%s"
+
+# iSiloX e-book
+60		string		SDocSilX	iSiloX E-book
+>0		string		>\0		"%s"
+
+# Mobipocket (www.mobipocket.com), donated by Carl Witty
+# expanded by Ralf Brown
+60		string	 	BOOKMOBI	Mobipocket E-book
+# MobiPocket stores a full title, pointed at by the belong at offset
+# 0x54 in its header at (78.L), with length given by the belong at
+# offset 0x58.
+# there's no guarantee that the title string is null-terminated, but
+# we currently can't specify a variable-length string where the length
+# field is not at the start of the string; in practice, the data
+# following the string always seems to start with a zero byte
+>(78.L)		belong		x
+>>&(&0x50.L-4)	string		>\0		"%s"
+>0		use		aportisdoc
+>>(78.L+0x68)	belong		>0		\b, version %d
+>>(78.L+0x1C)	belong		!0		\b, codepage %d
+>>(78.L+0x0C)	beshort	 	>0		\b, encrypted (type %d)
+
+# AportisDoc/PalmDOC
+60		string		TEXtREAd	AportisDoc/PalmDOC E-book
+>0		string		>\0		"%s"
+>0		use		aportisdoc
 
 
 # Variety of PalmOS document types
 # Variety of PalmOS document types
 # Michael-John Turner <mj@debian.org>
 # Michael-John Turner <mj@debian.org>

+ 11 - 0
magic/Magdir/pbf

@@ -0,0 +1,11 @@
+
+#------------------------------------------------------------------------------
+# $File: pbf,v 1.1 2013/12/21 14:27:24 christos Exp $
+# file(1) magic(5) data for OpenStreetMap
+
+# OpenStreetMap Protocolbuffer Binary Format (.osm.pbf)
+# http://wiki.openstreetmap.org/wiki/PBF_Format
+# From: Markus Heidelberg <markus.heidelberg@web.de>
+0	belong		0x0000000D
+>4	beshort		0x0A09
+>>6	string		OSMHeader	OpenStreetMap Protocolbuffer Binary Format

+ 2 - 1
magic/Magdir/pdf

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: pdf,v 1.6 2009/09/19 16:28:11 christos Exp $
+# $File: pdf,v 1.7 2013/08/22 07:47:26 christos Exp $
 # pdf:  file(1) magic for Portable Document Format
 # pdf:  file(1) magic for Portable Document Format
 #
 #
 
 
@@ -12,5 +12,6 @@
 # From: Nick Schmalenberger <nick@schmalenberger.us>
 # From: Nick Schmalenberger <nick@schmalenberger.us>
 # Forms Data Format
 # Forms Data Format
 0       string          %FDF-           FDF document
 0       string          %FDF-           FDF document
+!:mime application/vnd.fdf
 >5      byte            x               \b, version %c
 >5      byte            x               \b, version %c
 >7      byte            x               \b.%c
 >7      byte            x               \b.%c

+ 8 - 2
magic/Magdir/pdp

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: pdp,v 1.8 2009/09/19 16:28:11 christos Exp $
+# $File: pdp,v 1.9 2013/04/19 20:11:43 christos Exp $
 # pdp:  file(1) magic for PDP-11 executable/object and APL workspace
 # pdp:  file(1) magic for PDP-11 executable/object and APL workspace
 #
 #
 0	lelong		0101555		PDP-11 single precision APL workspace
 0	lelong		0101555		PDP-11 single precision APL workspace
@@ -12,7 +12,13 @@
 >8	leshort		>0		not stripped
 >8	leshort		>0		not stripped
 >15	byte		>0		- version %ld
 >15	byte		>0		- version %ld
 
 
-0	leshort		0401		PDP-11 UNIX/RT ldp
+# updated by Joerg Jenderek at Mar 2013
+# GRR: line below too general as it catches also Windows precompiled setup information *.PNF
+0	leshort		0401		
+# skip *.PNF with WinDirPathOffset 58h 
+>68	ulelong		!0x00000058	PDP-11 UNIX/RT ldp
+# skip *.PNF with high byte of InfVersionDatumCount zero
+#>>15	byte		!0		PDP-11 UNIX/RT ldp
 0	leshort		0405		PDP-11 old overlay
 0	leshort		0405		PDP-11 old overlay
 
 
 0	leshort		0410		PDP-11 pure executable
 0	leshort		0410		PDP-11 pure executable

+ 4 - 7
magic/Magdir/perl

@@ -1,20 +1,14 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: perl,v 1.20 2012/06/21 01:16:49 christos Exp $
+# $File: perl,v 1.21 2013/12/08 23:33:18 christos Exp $
 # perl:  file(1) magic for Larry Wall's perl language.
 # perl:  file(1) magic for Larry Wall's perl language.
 #
 #
 # The `eval' lines recognizes an outrageously clever hack.
 # The `eval' lines recognizes an outrageously clever hack.
 # Keith Waclena <keith@cerberus.uchicago.edu>
 # Keith Waclena <keith@cerberus.uchicago.edu>
 # Send additions to <perl5-porters@perl.org>
 # Send additions to <perl5-porters@perl.org>
-0	search/1/w	#!\ /bin/perl			Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /bin/perl		Perl script text
 0	search/1	eval\ "exec\ /bin/perl		Perl script text
 !:mime	text/x-perl
 !:mime	text/x-perl
-0	search/1/w	#!\ /usr/bin/perl		Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /usr/bin/perl	Perl script text
 0	search/1	eval\ "exec\ /usr/bin/perl	Perl script text
 !:mime	text/x-perl
 !:mime	text/x-perl
-0	search/1/w	#!\ /usr/local/bin/perl		Perl script text executable
-!:mime	text/x-perl
 0	search/1	eval\ "exec\ /usr/local/bin/perl	Perl script text
 0	search/1	eval\ "exec\ /usr/local/bin/perl	Perl script text
 !:mime	text/x-perl
 !:mime	text/x-perl
 0	search/1	eval\ '(exit\ $?0)'\ &&\ eval\ 'exec	Perl script text
 0	search/1	eval\ '(exit\ $?0)'\ &&\ eval\ 'exec	Perl script text
@@ -23,6 +17,9 @@
 !:mime	text/x-perl
 !:mime	text/x-perl
 0	search/1	#!\ /usr/bin/env\ perl	Perl script text executable
 0	search/1	#!\ /usr/bin/env\ perl	Perl script text executable
 !:mime	text/x-perl
 !:mime	text/x-perl
+0	search/1	#!
+>0	regex	\^#!.*/bin/perl$	Perl script text executable
+!:mime	text/x-perl
 
 
 # by Dmitry V. Levin and Alexey Tourbin
 # by Dmitry V. Levin and Alexey Tourbin
 # check the first line
 # check the first line

+ 3 - 3
magic/Magdir/python

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: python,v 1.22 2013/03/18 12:49:55 christos Exp $
+# $File: python,v 1.23 2013/12/11 14:14:20 christos Exp $
 # python:  file(1) magic for python
 # python:  file(1) magic for python
 #
 #
 # Outlook puts """ too for urgent messages
 # Outlook puts """ too for urgent messages
@@ -62,6 +62,6 @@
 !:mime text/x-python
 !:mime text/x-python
 
 
 # def name(args, args):
 # def name(args, args):
-0	regex	 \^(\ |\\t)*def\ +[a-zA-Z]+
->&0	regex	\ *\\(([a-zA-Z]|,|\ )*\\):$ Python script text executable
+0	regex	 \^(\ |\\t){0,50}def\ {1,50}[a-zA-Z]{1,100}
+>&0	regex	\ {0,50}\\(([a-zA-Z]|,|\ ){1,500}\\):$ Python script text executable
 !:mime text/x-python
 !:mime text/x-python

+ 4 - 1
magic/Magdir/riff

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: riff,v 1.23 2013/02/06 14:18:52 christos Exp $
+# $File: riff,v 1.24 2013/11/19 23:58:17 christos Exp $
 # riff:  file(1) magic for RIFF format
 # riff:  file(1) magic for RIFF format
 # See
 # See
 #
 #
@@ -55,6 +55,8 @@
 # Corel Draw Picture
 # Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
 !:mime	image/x-coreldraw
 !:mime	image/x-coreldraw
+>8	string		CDR6		\b, Corel Draw Picture, version 6
+!:mime	image/x-coreldraw
 # AVI == Audio Video Interleave
 # AVI == Audio Video Interleave
 >8	string		AVI\040		\b, AVI
 >8	string		AVI\040		\b, AVI
 !:mime	video/x-msvideo
 !:mime	video/x-msvideo
@@ -220,6 +222,7 @@
 >>24	belong		>0		%d Hz
 >>24	belong		>0		%d Hz
 # Corel Draw Picture
 # Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
 >8	string		CDRA		\b, Corel Draw Picture
+>8	string		CDR6		\b, Corel Draw Picture, version 6
 # AVI == Audio Video Interleave
 # AVI == Audio Video Interleave
 >8	string		AVI\040		\b, AVI
 >8	string		AVI\040		\b, AVI
 # Animated Cursor format
 # Animated Cursor format

+ 2 - 2
magic/Magdir/scientific

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: scientific,v 1.7 2010/09/20 19:19:17 rrt Exp $
+# $File: scientific,v 1.8 2014/01/06 17:46:23 rrt Exp $
 # scientific:  file(1) magic for scientific formats 
 # scientific:  file(1) magic for scientific formats 
 #
 #
 # From: Joe Krahn <krahn@niehs.nih.gov>
 # From: Joe Krahn <krahn@niehs.nih.gov>
@@ -65,7 +65,7 @@
 0       search/1/c	0\ HEAD         GEDCOM genealogy text
 0       search/1/c	0\ HEAD         GEDCOM genealogy text
 >&0     search		1\ GEDC
 >&0     search		1\ GEDC
 >>&0    search		2\ VERS         version
 >>&0    search		2\ VERS         version
->>>&1   search/1	>\0		%s
+>>>&1   string		>\0		%s
 # From: Phil Endecott <phil05@chezphil.org>
 # From: Phil Endecott <phil05@chezphil.org>
 0	string	\000\060\000\040\000\110\000\105\000\101\000\104		GEDCOM data
 0	string	\000\060\000\040\000\110\000\105\000\101\000\104		GEDCOM data
 0	string	\060\000\040\000\110\000\105\000\101\000\104\000		GEDCOM data
 0	string	\060\000\040\000\110\000\105\000\101\000\104\000		GEDCOM data

+ 8 - 1
magic/Magdir/sgml

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: sgml,v 1.29 2012/08/26 10:25:41 christos Exp $
+# $File: sgml,v 1.30 2013/12/21 14:27:24 christos Exp $
 # Type:	SVG Vectorial Graphics
 # Type:	SVG Vectorial Graphics
 # From:	Noel Torres <tecnico@ejerciciosresueltos.com>
 # From:	Noel Torres <tecnico@ejerciciosresueltos.com>
 0	string		\<?xml\ version="
 0	string		\<?xml\ version="
@@ -15,6 +15,13 @@
 >>19	search/4096	\<urlset		XML Sitemap document text
 >>19	search/4096	\<urlset		XML Sitemap document text
 !:mime	application/xml-sitemap
 !:mime	application/xml-sitemap
 
 
+# OpenStreetMap XML (.osm)
+# http://wiki.openstreetmap.org/wiki/OSM_XML
+# From: Markus Heidelberg <markus.heidelberg@web.de>
+0	string		\<?xml\ version="
+>15	string		>\0
+>>19	search/4096	\<osm			OpenStreetMap XML data
+
 # xhtml
 # xhtml
 0	string/t		\<?xml\ version="
 0	string/t		\<?xml\ version="
 >15	string		>\0
 >15	string		>\0

+ 24 - 6
magic/Magdir/sql

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: sql,v 1.11 2013/02/21 15:27:01 christos Exp $
+# $File: sql,v 1.13 2013/08/27 04:02:33 christos Exp $
 # sql:  file(1) magic for SQL files
 # sql:  file(1) magic for SQL files
 #
 #
 # From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
 # From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
@@ -50,12 +50,30 @@
 0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
 0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
 
 
 # Version 3 of SQLite allows applications to embed their own "user version"
 # Version 3 of SQLite allows applications to embed their own "user version"
-# number in the database.  Detect this and distinguish those files.
-
+# number in the database at offset 60.  Later, SQLite added an "application id"
+# at offset 68 that is preferred over "user version" for indicating the
+# associated application.
+#
 0   string  SQLite\ format\ 3
 0   string  SQLite\ format\ 3
->60 string  _MTN               Monotone source repository
->60 belong  !0                 SQLite 3.x database, user version %u
->60 belong  0                  SQLite 3.x database
+>60 belong  =0x5f4d544e  Monotone source repository - SQLite3 database
+>68 belong  =0x0f055112  Fossil checkout - SQLite3 database
+>68 belong  =0x0f055113  Fossil global configuration - SQLite3 database
+>68 belong  =0x0f055111  Fossil repository - SQLite3 database
+>68 belong  =0x42654462  Bentley Systems BeSQLite Database - SQLite3 database
+>68 belong  =0x42654c6e  Bentley Systems Localization File - SQLite3 database
+>68 belong  =0x47504b47  OGC GeoPackage file - SQLite3 database
+>68 default x            SQLite 3.x database
+>>68 belong  !0          \b, application id %u
+>>60 belong  !0          \b, user version %d
+
+# SQLite Write-Ahead Log from SQLite version >= 3.7.0
+# http://www.sqlite.org/fileformat.html#walformat
+0	belong&0xfffffffe	0x377f0682	SQLite Write-Ahead Log,
+>4	belong	x	version %ld
+
+# SQLite Rollback Journal
+# http://www.sqlite.org/fileformat.html#rollbackjournal
+0	string	\xd9\xd5\x05\xf9\x20\xa1\x63\xd7	SQLite Rollback Journal
 
 
 # Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
 # Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
 # http://www.ullrich.es/job/service-menue/panasonic/panasonic-sendersortierung-sat-am-pc/
 # http://www.ullrich.es/job/service-menue/panasonic/panasonic-sendersortierung-sat-am-pc/

+ 3 - 0
magic/Magdir/ssh

@@ -6,3 +6,6 @@
 
 
 0	string	ssh-dss\ 		OpenSSH DSA public key
 0	string	ssh-dss\ 		OpenSSH DSA public key
 0	string	ssh-rsa\ 		OpenSSH RSA public key
 0	string	ssh-rsa\ 		OpenSSH RSA public key
+0	string	ecdsa-sha2-nistp256	OpenSSH ECDSA public key
+0	string	ecdsa-sha2-nistp384	OpenSSH ECDSA public key
+0	string	ecdsa-sha2-nistp521	OpenSSH ECDSA public key

+ 1 - 0
magic/Magdir/ssl

@@ -5,3 +5,4 @@
 0	string	-----BEGIN\ CERTIFICATE\ REQ	PEM certificate request
 0	string	-----BEGIN\ CERTIFICATE\ REQ	PEM certificate request
 0	string	-----BEGIN\ RSA\ PRIVATE	PEM RSA private key
 0	string	-----BEGIN\ RSA\ PRIVATE	PEM RSA private key
 0	string	-----BEGIN\ DSA\ PRIVATE	PEM DSA private key
 0	string	-----BEGIN\ DSA\ PRIVATE	PEM DSA private key
+0	string	-----BEGIN\ EC\ PRIVATE	PEM EC private key

+ 42 - 0
magic/Magdir/symbos

@@ -0,0 +1,42 @@
+
+#------------------------------------------------------------------------------
+# msx:  file(1) magic for the SymbOS operating system
+# http://www.symbos.de
+# Fábio R. Schmidlin <frs@pop.com.br>
+
+# SymbOS EXE file
+0x30	string		SymExe		SymbOS executable
+>0x36	ubyte		x		v%c
+>0x37	ubyte		x		\b.%c
+>0xF	string		x		\b, name: %s
+
+# SymbOS DOX document
+0	string		INFOq\0		SymbOS DOX document
+
+# Symbos driver
+0	string		SMD1		SymbOS driver
+>19	byte		x		\b, name: %c
+>20	byte		x		\b%c
+>21	byte		x		\b%c
+>22	byte		x		\b%c
+>23	byte		x		\b%c
+>24	byte		x		\b%c
+>25	byte		x		\b%c
+>26	byte		x		\b%c
+>27	byte		x		\b%c
+>28	byte		x		\b%c
+>29	byte		x		\b%c
+>30	byte		x		\b%c
+>31	byte		x		\b%c
+
+# Symbos video
+0	string		SymVid		SymbOS video
+>6	ubyte		x		v%c
+>7	ubyte		x		\b.%c
+
+# Soundtrakker 128 ST2 music
+0	byte		0
+>0xC	string		\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x40\x00	Soundtrakker 128 ST2 music,
+>>1	string		x		name: %s
+
+

+ 6 - 4
magic/Magdir/sysex

@@ -1,10 +1,12 @@
 
 
 #------------------------------------------------------------------------
 #------------------------------------------------------------------------
-# $File: sysex,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: sysex,v 1.7 2013/09/16 15:12:42 christos Exp $
 # sysex: file(1) magic for MIDI sysex files
 # sysex: file(1) magic for MIDI sysex files
 #
 #
-# 
-0	byte			0xF0		SysEx File -
+# GRR: orginal 1 byte test at offset was too general as it catches also many FATs of DOS filesystems
+# where real SYStem EXclusive messages at offset 1 are limited to seven bits
+# http://en.wikipedia.org/wiki/MIDI
+0	ubeshort&0xFF80		0xF000		SysEx File -
 
 
 # North American Group
 # North American Group
 >1	byte			0x01		Sequential
 >1	byte			0x01		Sequential
@@ -210,7 +212,7 @@
 >1	byte			0x52		Zoom
 >1	byte			0x52		Zoom
 >1	byte			0x54		Matsushita
 >1	byte			0x54		Matsushita
 >1	byte			0x57		Acoustic tech. lab.
 >1	byte			0x57		Acoustic tech. lab.
-
+# http://www.midi.org/techspecs/manid.php
 >1	belong&0xffffff00	0x00007400	Ta Horng
 >1	belong&0xffffff00	0x00007400	Ta Horng
 >1	belong&0xffffff00	0x00007500	e-Tek
 >1	belong&0xffffff00	0x00007500	e-Tek
 >1	belong&0xffffff00	0x00007600	E-Voice
 >1	belong&0xffffff00	0x00007600	E-Voice

+ 1 - 1
magic/Magdir/tcl

@@ -5,7 +5,7 @@
 
 
 # Tcl scripts
 # Tcl scripts
 0	search/1/w	#!\ /usr/bin/tcl	Tcl script text executable
 0	search/1/w	#!\ /usr/bin/tcl	Tcl script text executable
-!:mime	text/x-lua
+!:mime	text/x-tcl
 0	search/1/w	#!\ /usr/local/bin/tcl	Tcl script text executable
 0	search/1/w	#!\ /usr/local/bin/tcl	Tcl script text executable
 !:mime	text/x-tcl
 !:mime	text/x-tcl
 0	search/1	#!/usr/bin/env\ tcl	Tcl script text executable
 0	search/1	#!/usr/bin/env\ tcl	Tcl script text executable

+ 4 - 1
magic/Magdir/tex

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: tex,v 1.18 2011/02/08 13:45:15 christos Exp $
+# $File: tex,v 1.19 2013/09/17 17:39:16 christos Exp $
 # tex:  file(1) magic for TeX files
 # tex:  file(1) magic for TeX files
 #
 #
 # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
 # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
@@ -40,6 +40,9 @@
 0	search/4096	\\input		TeX document text
 0	search/4096	\\input		TeX document text
 !:mime	text/x-tex
 !:mime	text/x-tex
 !:strength + 15
 !:strength + 15
+0	search/4096	\\begin		LaTeX document text
+!:mime	text/x-tex
+!:strength + 15
 0	search/4096	\\section	LaTeX document text
 0	search/4096	\\section	LaTeX document text
 !:mime	text/x-tex
 !:mime	text/x-tex
 !:strength + 18
 !:strength + 18

+ 175 - 4
magic/Magdir/windows

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: windows,v 1.5 2012/04/03 22:25:07 christos Exp $
+# $File: windows,v 1.6 2013/04/19 20:12:29 christos Exp $
 # windows:  file(1) magic for Microsoft Windows
 # windows:  file(1) magic for Microsoft Windows
 #
 #
 # This file is mainly reserved for files where programs
 # This file is mainly reserved for files where programs
@@ -158,8 +158,179 @@
 0	string		Windows\ Registry\ Editor\ 
 0	string		Windows\ Registry\ Editor\ 
 >&0	string		Version\ 5.00\r\n\r\n	Windows Registry text (Win2K or above)
 >&0	string		Version\ 5.00\r\n\r\n	Windows Registry text (Win2K or above)
 
 
-
+# Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013
+# emtpy ,comment , section , unicode line
+0	regex/s		\\`(\r\n|;|[[]|\xFF\xFE)			
+# left bracket in section line
+>&0	search/8192	[						
+# http://en.wikipedia.org/wiki/Autorun.inf
+# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
+>>&0	regex/c		\^(autorun)]\r\n				
+>>>&0	ubyte		=0x5b						INItialization configuration
+!:mime application/x-wine-extension-ini
 # From: Pal Tamas <folti@balabit.hu>
 # From: Pal Tamas <folti@balabit.hu>
 # Autorun File
 # Autorun File
-0       string/c          [autorun]\r\n   Microsoft Windows Autorun file.
-!:mime	application/x-setupscript. 
+>>>&0	ubyte		!0x5b						Microsoft Windows Autorun file
+!:mime application/x-setupscript
+# http://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
+# version strings ASCII coded case-independent for Windows setup information script file
+>>&0	regex/c		\^(version|strings)]				Windows setup INFormation
+!:mime	application/x-setupscript
+#!:mime application/inf
+#!:mime application/x-wine-extension-inf
+>>&0	regex/c		\^(WinsockCRCList|OEMCPL)]			Windows setup INFormation
+!:mime	text/inf
+# http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
+# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
+# .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
+>>&0	regex/c	\^(\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)]	Windows desktop.ini
+!:mime application/x-wine-extension-ini
+#!:mime text/plain
+# http://support.microsoft.com/kb/84709/
+>>&0	regex/c		\^(don't\ load)]				Windows CONTROL.INI
+!:mime application/x-wine-extension-ini
+>>&0	regex/c		\^(ndishlp\\$|protman\\$|NETBEUI\\$)]		Windows PROTOCOL.INI
+!:mime application/x-wine-extension-ini
+# http://technet.microsoft.com/en-us/library/cc722567.aspx
+# http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
+>>&0	regex/c		\^(windows|Compatibility|embedding)]		Windows WIN.INI
+!:mime application/x-wine-extension-ini
+# http://en.wikipedia.org/wiki/SYSTEM.INI
+>>&0	regex/c		\^(boot|386enh|drivers)]			Windows SYSTEM.INI
+!:mime application/x-wine-extension-ini
+# http://www.mdgx.com/newtip6.htm
+>>&0	regex/c		\^(SafeList)]					Windows IOS.INI
+!:mime application/x-wine-extension-ini
+# http://en.wikipedia.org/wiki/NTLDR	Windows Boot Loader information
+>>&0	regex/c		\^(boot\x20loader)]				Windows boot.ini
+!:mime application/x-wine-extension-ini
+>>>&0	ubyte		x						
+# http://en.wikipedia.org/wiki/CONFIG.SYS
+>>&0	regex/c		\^(menu)]\r\n					MS-DOS CONFIG.SYS
+# http://support.microsoft.com/kb/118579/
+>>&0	regex/c		\^(Paths)]\r\n					MS-DOS MSDOS.SYS
+# VERS string unicoded case-independent
+>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
+# ION] string unicoded case-independent
+>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
+!:mime application/x-setupscript
+# STRI string unicoded case-independent
+>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0053005400520049		
+# NGS] string unicoded case-independent
+>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x004e00470053005D		Windows setup INFormation 
+!:mime application/x-setupscript
+# unknown keyword after opening bracket
+>>&0	default				x				
+>>>&0	search/8192			[				
+# version Strings FileIdentification
+>>>>&0	string/c			version				Windows setup INFormation 
+!:mime application/x-setupscript
+# VERS string unicoded case-independent
+>>>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
+# ION] string unicoded case-independent
+>>>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
+!:mime application/x-setupscript
+# http://en.wikipedia.org/wiki/Initialization_file	Windows Initialization File or other
+#>>>>&0	default				x				Generic INItialization configuration
+#!:mime application/x-wine-extension-ini
+
+# Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
+# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
+# GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
+0		leshort&0xFeFe	0x0000		
+# test for unused null bits in PNF_FLAGs
+>4	ulelong&0xFCffFe00	0x00000000	
+# only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
+>>68		ulelong		>0x57		
+# test for zero high byte of InfValueBlockSize, followed by WinDirPath like
+# C:\WINDOWS (ASCII 0x433a5c.. , unicode 0x43003a005c..) or X:\MININT
+>>>(68.l-1)	ubelong&0xffE0C519	=0x00400018	Windows Precompiled iNF
+!:mime	application/x-pnf
+# currently only found Major Version=1 and Minor Version=1
+#>>>>0		uleshort	=0x0101		
+#>>>>>1		ubyte		x		\b, version %u
+#>>>>>0		ubyte		x		\b.%u
+>>>>0		uleshort	!0x0101		
+>>>>>1		ubyte		x		\b, version %u
+>>>>>0		ubyte		x		\b.%u
+# 1 ,2 (windows 98 SE)
+#>>>>2		uleshort	=2		\b, InfStyle %u
+>>>>2		uleshort	!2		\b, InfStyle %u
+#	PNF_FLAG_IS_UNICODE		0x00000001
+#	PNF_FLAG_HAS_STRINGS		0x00000002
+#	PNF_FLAG_SRCPATH_IS_URL		0x00000004
+#	PNF_FLAG_HAS_VOLATILE_DIRIDS	0x00000008
+#	PNF_FLAG_INF_VERIFIED		0x00000010
+#	PNF_FLAG_INF_DIGITALLY_SIGNED	0x00000020
+#	??				0x00000100
+#	??				0x01000000
+#	??				0x02000000
+>>>>4	ulelong&0x00000001	0x00000001	\b, unicoded
+>>>>4	ulelong&0x00000020	0x00000020	\b, digitally signed
+#>>>>8		ulelong		x		\b, InfSubstValueListOffset 0x%x
+# many 0, 1 lmouusb.PNF, 2 linkfx10.PNF , f webfdr16.PNF
+#>>>>12		uleshort	x		\b, InfSubstValueCount 0x%x
+# only < 9 found
+#>>>>14		uleshort	x		\b, InfVersionDatumCount 0x%x
+# only found values lower 0x0000ffff
+#>>>>16		ulelong		x		\b, InfVersionDataSize 0x%x
+# only found positive values lower 0x00ffFFff for InfVersionDataOffset
+>>>>20		ulelong		x		\b, at 0x%x
+>>>>4	ulelong&0x00000001	=0x00000001	
+# case independent: CatalogFile Class DriverVer layoutfile LayoutFile SetupClass signature Signature    
+>>>>>(20.l)	lestring16	x		"%s"
+>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>(20.l)	string		x		"%s"
+# FILETIME is number of 100-nanosecond intervals since 1 January 1601
+#>>>>24		ulequad		x		\b, InfVersionLastWriteTime %16.16llx
+# only found values lower 0x00ffFFff
+#>>>>32		ulelong		x		\b, StringTableBlockOffset 0x%x
+#>>>>36		ulelong		x		\b, StringTableBlockSize 0x%x
+#>>>>40		ulelong		x		\b, InfSectionCount 0x%x
+#>>>>44		ulelong		x		\b, InfSectionBlockOffset 0x%x
+#>>>>48		ulelong		x		\b, InfSectionBlockSize 0x%x
+#>>>>52		ulelong		x		\b, InfLineBlockOffset 0x%x
+#>>>>56		ulelong		x		\b, InfLineBlockSize 0x%x
+#>>>>60		ulelong		x		\b, InfValueBlockOffset 0x%x
+#>>>>64		ulelong		x		\b, InfValueBlockSize 0x%x
+# WinDirPathOffset
+#>>>>68		ulelong		x		\b, at 0x%x
+>>>>68		ulelong		>0x57		
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(68.l)	ubequad		=0x43003a005c005700			
+# normally unicoded C:\Windows
+#>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
+>>>>>>(68.l)	ubequad		!0x43003a005c005700			
+>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+# normally ASCII C:\WINDOWS
+#>>>>>>(68.l)	string		=C:\\WINDOWS	\b, WinDirPath "%s"
+>>>>>>(68.l)	string		!C:\\WINDOWS	\b, WinDirPath "%s"
+# found OsLoaderPathOffset values often 0 , once 70h corelist.PNF, once 68h ASCII machine.PNF 
+#>>>>72		ulelong		>0		\b, at 0x%x
+>>>>72		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(72.l)	lestring16	x		OsLoaderPath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+# seldom C:\ instead empty
+>>>>>>(72.l)	string		x		OsLoaderPath "%s"
+# 1fdh
+#>>>>76		uleshort	x		\b, StringTableHashBucketCount 0x%x
+>>>>78		uleshort	!0x407		\b, LanguageId %x
+# only 407h found
+#>>>>78		uleshort	=0x407		\b, LanguageId %x
+# InfSourcePathOffset often 0
+#>>>>80		ulelong		>0		\b, at 0x%x
+>>>>80		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(80.l)	lestring16	x		SourcePath "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>>(80.l)	string		>\0		SourcePath "%s"
+# OriginalInfNameOffset often 0
+#>>>>84		ulelong		>0		\b, at 0x%x
+>>>>84		ulelong		>0		\b,
+>>>>>4	ulelong&0x00000001	=0x00000001	
+>>>>>>(84.l)	lestring16	x		InfName "%s"
+>>>>>4	ulelong&0x00000001	!0x00000001	
+>>>>>>(84.l)	string		>\0		InfName "%s"
+

+ 6 - 1
magic/Magdir/wordprocessors

@@ -1,6 +1,6 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: wordprocessors,v 1.17 2013/02/06 14:18:52 christos Exp $
+# $File: wordprocessors,v 1.18 2013/06/03 19:07:29 christos Exp $
 # wordprocessors:  file(1) magic fo word processors.
 # wordprocessors:  file(1) magic fo word processors.
 #
 #
 ####### PWP file format used on Smith Corona Personal Word Processors:
 ####### PWP file format used on Smith Corona Personal Word Processors:
@@ -156,6 +156,11 @@
 0	string/w	\<map\ version	Freemind document
 0	string/w	\<map\ version	Freemind document
 !:mime	application/x-freemind
 !:mime	application/x-freemind
 
 
+# Type: Freeplane mindmap documents
+# From: Felix Natter <fnatter@gmx.net>
+0       string/w        \<map\ version="freeplane  Freeplane document
+!:mime  application/x-freeplane
+
 # Type:        Scribus
 # Type:        Scribus
 # From:        Werner Fink <werner@suse.de>
 # From:        Werner Fink <werner@suse.de>
 0	string	\<SCRIBUSUTF8\ Version		Scribus Document
 0	string	\<SCRIBUSUTF8\ Version		Scribus Document

+ 27 - 25
magic/Magdir/xilinx

@@ -1,38 +1,40 @@
 
 
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
-# $File: xilinx,v 1.5 2013/01/08 03:06:50 christos Exp $
+# $File: xilinx,v 1.6 2013/11/19 23:15:13 christos Exp $
 # This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
 # This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
 # Xilinx-Magic@RevRagnarok.com
 # Xilinx-Magic@RevRagnarok.com
 # Got the info from FPGA-FAQ 0026
 # Got the info from FPGA-FAQ 0026
 #
 #
+# Rewritten to use pstring/H instead of hardcoded lengths by O. Freyermuth, 
+# fixes at least reading of bitfiles from Spartan 2, 3, 6. 
+# http://www.fpga-faq.com/FAQ_Pages/0026_Tell_me_about_bit_files.htm
+#
 # First there is the sync header and its length
 # First there is the sync header and its length
 0	beshort 0x0009
 0	beshort 0x0009
 >2 	belong	=0x0ff00ff0
 >2 	belong	=0x0ff00ff0
 >>&0	belong  =0x0ff00ff0
 >>&0	belong  =0x0ff00ff0
->>>&0	beshort =0x0000	
->>>>&0	pstring	a	Xilinx BIT data
+>>>&0	byte    =0x00
+>>>&1   beshort =0x0001
+>>>&3	string	a	Xilinx BIT data
 # Next is a Pascal-style string with the NCD name. We want to capture that.
 # Next is a Pascal-style string with the NCD name. We want to capture that.
->>>>0x0F	pstring	x	- from %s
-# It is followed by a NUL
->>>>>&1	byte	0x00
+>>>>&0	   pstring/H	x	- from %s
 # And then 'b'
 # And then 'b'
->>>>>&2	string b
-# With the part number:
-#>>>>>&5 string	4v	(Virtex4)
-#>>>>>&5 string  2v	(Virtex II
-#>>>>>>&0	string	!p	\b)
-#>>>>>>&0	string	p	Pro)
->>>>>&4	pstring x	- for %s
-# And then NUL / 'c' / Build Data / NUL / 'd' / Date / NUL / 'e' / Data Length
->>>>>>&1	byte	0x00
->>>>>>&2	string	c
->>>>>>&4	pstring	x	- built %s
->>>>>>>&1	byte	0x00
->>>>>>>&2	string	d
->>>>>>>&4	pstring	x	\b(%s)
->>>>>>>>&1	byte	0x00
->>>>>>>>&2	string	e
->>>>>>>>&4	belong	x	- data length 0x%lx
+>>>>>&1    string b
+# Then the model / part number: 
+>>>>>>&0   pstring/H    x       - for %s
+# Then 'c'
+>>>>>>>&1 string c
+# Then the build-date
+>>>>>>>>&0 pstring/H    x       - built %s
+# Then 'd'
+>>>>>>>>>&1   string d
+# Then the build-time
+>>>>>>>>>>&0  pstring/H x        \b(%s)
+# Then 'e'
+>>>>>>>>>>>&1  string e
+# And length of data
+>>>>>>>>>>>>&0 belong x          - data length 0x%lx
+
 # Raw bitstream files
 # Raw bitstream files
-0	long	0xffffffff	
->&0	belong	0xaa995566	Xilinx RAW bitstream (.BIN)
+0      long    0xffffffff      
+>&0    belong  0xaa995566      Xilinx RAW bitstream (.BIN)

+ 9 - 3
magic/Makefile.am

@@ -1,5 +1,5 @@
 #
 #
-# $File: Makefile.am,v 1.89 2013/02/18 18:31:09 christos Exp $
+# $File: Makefile.am,v 1.95 2014/01/31 01:51:32 christos Exp $
 #
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
 MAGIC_DIR = $(top_srcdir)/magic
@@ -17,6 +17,7 @@ $(MAGIC_FRAGMENT_DIR)/allegro \
 $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
+$(MAGIC_FRAGMENT_DIR)/android \
 $(MAGIC_FRAGMENT_DIR)/animation \
 $(MAGIC_FRAGMENT_DIR)/animation \
 $(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apl \
@@ -29,6 +30,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
 $(MAGIC_FRAGMENT_DIR)/audio \
 $(MAGIC_FRAGMENT_DIR)/audio \
 $(MAGIC_FRAGMENT_DIR)/basis \
 $(MAGIC_FRAGMENT_DIR)/basis \
 $(MAGIC_FRAGMENT_DIR)/bflt \
 $(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/blackberry \
 $(MAGIC_FRAGMENT_DIR)/blcr \
 $(MAGIC_FRAGMENT_DIR)/blcr \
 $(MAGIC_FRAGMENT_DIR)/blender \
 $(MAGIC_FRAGMENT_DIR)/blender \
 $(MAGIC_FRAGMENT_DIR)/blit \
 $(MAGIC_FRAGMENT_DIR)/blit \
@@ -54,6 +56,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/ctf \
 $(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/dact \
@@ -150,6 +153,7 @@ $(MAGIC_FRAGMENT_DIR)/motorola \
 $(MAGIC_FRAGMENT_DIR)/mozilla \
 $(MAGIC_FRAGMENT_DIR)/mozilla \
 $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
+$(MAGIC_FRAGMENT_DIR)/msx \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/mup \
 $(MAGIC_FRAGMENT_DIR)/mup \
 $(MAGIC_FRAGMENT_DIR)/music \
 $(MAGIC_FRAGMENT_DIR)/music \
@@ -173,6 +177,7 @@ $(MAGIC_FRAGMENT_DIR)/palm \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parrot \
 $(MAGIC_FRAGMENT_DIR)/parrot \
 $(MAGIC_FRAGMENT_DIR)/pascal \
 $(MAGIC_FRAGMENT_DIR)/pascal \
+$(MAGIC_FRAGMENT_DIR)/pbf \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
 $(MAGIC_FRAGMENT_DIR)/pdp \
@@ -217,6 +222,7 @@ $(MAGIC_FRAGMENT_DIR)/sql \
 $(MAGIC_FRAGMENT_DIR)/ssh \
 $(MAGIC_FRAGMENT_DIR)/ssh \
 $(MAGIC_FRAGMENT_DIR)/ssl \
 $(MAGIC_FRAGMENT_DIR)/ssl \
 $(MAGIC_FRAGMENT_DIR)/sun \
 $(MAGIC_FRAGMENT_DIR)/sun \
+$(MAGIC_FRAGMENT_DIR)/symbos \
 $(MAGIC_FRAGMENT_DIR)/sysex \
 $(MAGIC_FRAGMENT_DIR)/sysex \
 $(MAGIC_FRAGMENT_DIR)/tcl \
 $(MAGIC_FRAGMENT_DIR)/tcl \
 $(MAGIC_FRAGMENT_DIR)/teapot \
 $(MAGIC_FRAGMENT_DIR)/teapot \
@@ -264,10 +270,10 @@ CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
 # FIXME: Build file natively as well so that it can be used to compile
 # FIXME: Build file natively as well so that it can be used to compile
 # the target's magic file; for now we bail if the local version does not match
 # the target's magic file; for now we bail if the local version does not match
 if IS_CROSS_COMPILE
 if IS_CROSS_COMPILE
-FILE_COMPILE = file
+FILE_COMPILE = file${EXEEXT}
 FILE_COMPILE_DEP =
 FILE_COMPILE_DEP =
 else
 else
-FILE_COMPILE = $(top_builddir)/src/file
+FILE_COMPILE = $(top_builddir)/src/file${EXEEXT}
 FILE_COMPILE_DEP = $(FILE_COMPILE)
 FILE_COMPILE_DEP = $(FILE_COMPILE)
 endif
 endif
 
 

+ 70 - 35
magic/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -15,23 +15,51 @@
 @SET_MAKE@
 @SET_MAKE@
 
 
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -50,7 +78,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 subdir = magic
 subdir = magic
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -110,6 +138,7 @@ am__uninstall_files_from_dir = { \
   }
   }
 am__installdirs = "$(DESTDIR)$(pkgdatadir)"
 am__installdirs = "$(DESTDIR)$(pkgdatadir)"
 DATA = $(pkgdata_DATA)
 DATA = $(pkgdata_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 pkgdatadir = @pkgdatadir@
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
@@ -129,6 +158,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -153,6 +183,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -180,6 +211,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -213,7 +245,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -231,7 +262,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 top_srcdir = @top_srcdir@
 
 
 #
 #
-# $File: Makefile.am,v 1.89 2013/02/18 18:31:09 christos Exp $
+# $File: Makefile.am,v 1.95 2014/01/31 01:51:32 christos Exp $
 #
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
 MAGIC_DIR = $(top_srcdir)/magic
@@ -247,6 +278,7 @@ $(MAGIC_FRAGMENT_DIR)/allegro \
 $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
+$(MAGIC_FRAGMENT_DIR)/android \
 $(MAGIC_FRAGMENT_DIR)/animation \
 $(MAGIC_FRAGMENT_DIR)/animation \
 $(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apl \
@@ -259,6 +291,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
 $(MAGIC_FRAGMENT_DIR)/audio \
 $(MAGIC_FRAGMENT_DIR)/audio \
 $(MAGIC_FRAGMENT_DIR)/basis \
 $(MAGIC_FRAGMENT_DIR)/basis \
 $(MAGIC_FRAGMENT_DIR)/bflt \
 $(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/blackberry \
 $(MAGIC_FRAGMENT_DIR)/blcr \
 $(MAGIC_FRAGMENT_DIR)/blcr \
 $(MAGIC_FRAGMENT_DIR)/blender \
 $(MAGIC_FRAGMENT_DIR)/blender \
 $(MAGIC_FRAGMENT_DIR)/blit \
 $(MAGIC_FRAGMENT_DIR)/blit \
@@ -284,6 +317,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/ctf \
 $(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/dact \
@@ -380,6 +414,7 @@ $(MAGIC_FRAGMENT_DIR)/motorola \
 $(MAGIC_FRAGMENT_DIR)/mozilla \
 $(MAGIC_FRAGMENT_DIR)/mozilla \
 $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
+$(MAGIC_FRAGMENT_DIR)/msx \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/mup \
 $(MAGIC_FRAGMENT_DIR)/mup \
 $(MAGIC_FRAGMENT_DIR)/music \
 $(MAGIC_FRAGMENT_DIR)/music \
@@ -403,6 +438,7 @@ $(MAGIC_FRAGMENT_DIR)/palm \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parrot \
 $(MAGIC_FRAGMENT_DIR)/parrot \
 $(MAGIC_FRAGMENT_DIR)/pascal \
 $(MAGIC_FRAGMENT_DIR)/pascal \
+$(MAGIC_FRAGMENT_DIR)/pbf \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
 $(MAGIC_FRAGMENT_DIR)/pdp \
@@ -447,6 +483,7 @@ $(MAGIC_FRAGMENT_DIR)/sql \
 $(MAGIC_FRAGMENT_DIR)/ssh \
 $(MAGIC_FRAGMENT_DIR)/ssh \
 $(MAGIC_FRAGMENT_DIR)/ssl \
 $(MAGIC_FRAGMENT_DIR)/ssl \
 $(MAGIC_FRAGMENT_DIR)/sun \
 $(MAGIC_FRAGMENT_DIR)/sun \
+$(MAGIC_FRAGMENT_DIR)/symbos \
 $(MAGIC_FRAGMENT_DIR)/sysex \
 $(MAGIC_FRAGMENT_DIR)/sysex \
 $(MAGIC_FRAGMENT_DIR)/tcl \
 $(MAGIC_FRAGMENT_DIR)/tcl \
 $(MAGIC_FRAGMENT_DIR)/teapot \
 $(MAGIC_FRAGMENT_DIR)/teapot \
@@ -490,11 +527,11 @@ $(MAGIC_FRAGMENT_DIR)/zyxel
 
 
 MAGIC = magic.mgc
 MAGIC = magic.mgc
 CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
 CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
-@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file
+@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file${EXEEXT}
 
 
 # FIXME: Build file natively as well so that it can be used to compile
 # FIXME: Build file natively as well so that it can be used to compile
 # the target's magic file; for now we bail if the local version does not match
 # the target's magic file; for now we bail if the local version does not match
-@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file
+@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file${EXEEXT}
 @IS_CROSS_COMPILE_FALSE@FILE_COMPILE_DEP = $(FILE_COMPILE)
 @IS_CROSS_COMPILE_FALSE@FILE_COMPILE_DEP = $(FILE_COMPILE)
 @IS_CROSS_COMPILE_TRUE@FILE_COMPILE_DEP = 
 @IS_CROSS_COMPILE_TRUE@FILE_COMPILE_DEP = 
 all: all-am
 all: all-am
@@ -557,11 +594,9 @@ uninstall-pkgdataDATA:
 	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
 	@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
 	dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
 
 
-ctags: CTAGS
-CTAGS:
+ctags CTAGS:
 
 
 cscope cscopelist:
 cscope cscopelist:
 
 
@@ -703,16 +738,16 @@ uninstall-am: uninstall-pkgdataDATA
 .MAKE: install-am install-strip
 .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 \
-	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-pkgdataDATA install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am uninstall-pkgdataDATA
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir 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-pkgdataDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags-am uninstall uninstall-am uninstall-pkgdataDATA
 
 
 
 
 ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
 ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)

+ 145 - 260
missing

@@ -1,10 +1,10 @@
 #! /bin/sh
 #! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
 
 
-scriptversion=2012-01-06.18; # UTC
+scriptversion=2012-06-26.16; # UTC
 
 
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 
 # 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
@@ -29,61 +29,33 @@ if test $# -eq 0; then
   exit 1
   exit 1
 fi
 fi
 
 
-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
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
+case $1 in
 
 
-msg="missing on your system"
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
 
 
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
 
 
   -h|--h|--he|--hel|--help)
   -h|--h|--he|--hel|--help)
     echo "\
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
 
-Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
 
 
 Options:
 Options:
   -h, --help      display this help and exit
   -h, --help      display this help and exit
   -v, --version   output version information and exit
   -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
 
 
 Supported PROGRAM values:
 Supported PROGRAM values:
-  aclocal      touch file 'aclocal.m4'
-  autoconf     touch file 'configure'
-  autoheader   touch file 'config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all 'Makefile.in' files
-  bison        create 'y.tab.[ch]', if possible, from existing .[ch]
-  flex         create 'lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create 'lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  yacc         create 'y.tab.[ch]', if possible, from existing .[ch]
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
 
 
 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
 'g' are ignored when checking the name.
 'g' are ignored when checking the name.
@@ -98,228 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
     ;;
     ;;
 
 
   -*)
   -*)
-    echo 1>&2 "$0: Unknown '$1' option"
+    echo 1>&2 "$0: unknown '$1' option"
     echo 1>&2 "Try '$0 --help' for more information"
     echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     exit 1
     ;;
     ;;
 
 
 esac
 esac
 
 
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# 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
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running '$TOOL --version' or '$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'acinclude.m4' or '${configure_ac}'.  You might want
-         to install the Automake and Perl packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified '${configure_ac}'.  You might want to install the
-         Autoconf and GNU m4 packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'acconfig.h' or '${configure_ac}'.  You might want
-         to install the Autoconf and GNU m4 packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
-         You might want to install the Automake and Perl packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: '$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get '$1' as part of Autoconf from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: '$1' $msg.  You should only need it if
-         you modified a '.y' file.  You may need the Bison package
-         in order for those modifications to take effect.  You can get
-         Bison from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified a '.l' file.  You may need the Flex package
-         in order for those modifications to take effect.  You can get
-         Flex from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG=\${$#}
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 Help2man package in order for those modifications to take
-	 effect.  You can get Help2man from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: '$1' is $msg.  You should only need it if
-         you modified a '.texi' or '.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy 'make' (AIX,
-         DU, IRIX).  You might want to install the Texinfo package or
-         the GNU make package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
 
 
-  *)
-    echo 1>&2 "\
-WARNING: '$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the 'README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing '$1' program."
-    exit 1
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'automa4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
     ;;
     ;;
-esac
-
-exit 0
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
 
 
 # Local variables:
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # eval: (add-hook 'write-file-hooks 'time-stamp)

+ 61 - 31
python/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -14,23 +14,51 @@
 
 
 @SET_MAKE@
 @SET_MAKE@
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -49,7 +77,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 subdir = python
 subdir = python
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -80,6 +108,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
   esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 pkgdatadir = @pkgdatadir@
 pkgdatadir = @pkgdatadir@
 ACLOCAL = @ACLOCAL@
 ACLOCAL = @ACLOCAL@
@@ -99,6 +128,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -123,6 +153,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -150,6 +181,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -183,7 +215,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -239,11 +270,9 @@ mostlyclean-libtool:
 
 
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
-tags: TAGS
-TAGS:
+tags TAGS:
 
 
-ctags: CTAGS
-CTAGS:
+ctags CTAGS:
 
 
 cscope cscopelist:
 cscope cscopelist:
 
 
@@ -381,15 +410,16 @@ uninstall-am:
 .MAKE: install-am install-strip
 .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 \
-	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 maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir 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 \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags-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.

+ 103 - 62
src/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -17,23 +17,51 @@
 
 
 
 
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -53,10 +81,10 @@ build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 bin_PROGRAMS = file$(EXEEXT)
 bin_PROGRAMS = file$(EXEEXT)
 subdir = src
 subdir = src
-DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(top_srcdir)/depcomp asctime_r.c \
-	asprintf.c ctime_r.c getline.c getopt_long.c pread.c strlcat.c \
-	strlcpy.c vasprintf.c
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am strlcpy.c \
+	getline.c strcasestr.c strlcat.c vasprintf.c asctime_r.c \
+	asprintf.c pread.c getopt_long.c ctime_r.c \
+	$(top_srcdir)/depcomp $(include_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -158,6 +186,23 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
   esac
 HEADERS = $(include_HEADERS)
 HEADERS = $(include_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 ETAGS = etags
 CTAGS = ctags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -179,6 +224,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -203,6 +249,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -230,6 +277,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -263,7 +311,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -334,6 +381,7 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 $(am__aclocal_m4_deps):
+
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	@$(NORMAL_INSTALL)
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
@@ -368,6 +416,7 @@ clean-libLTLIBRARIES:
 	  echo rm -f $${locs}; \
 	  echo rm -f $${locs}; \
 	  rm -f $${locs}; \
 	  rm -f $${locs}; \
 	}
 	}
+
 libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES) 
 libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES) 
 	$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
 	$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
 install-binPROGRAMS: $(bin_PROGRAMS)
 install-binPROGRAMS: $(bin_PROGRAMS)
@@ -379,10 +428,12 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	fi; \
 	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p \
+	 || test -f $$p1 \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -403,7 +454,8 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
 	test -n "$$list" || exit 0; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
@@ -416,6 +468,7 @@ clean-binPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	echo " rm -f" $$list; \
 	rm -f $$list
 	rm -f $$list
+
 file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES) 
 file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES) 
 	@rm -f file$(EXEEXT)
 	@rm -f file$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
 	$(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
@@ -432,6 +485,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasestr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcat.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcat.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcpy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcpy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@
@@ -503,26 +557,15 @@ uninstall-includeHEADERS:
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	set x; \
 	here=`pwd`; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -534,15 +577,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	      $$unique; \
 	  fi; \
 	  fi; \
 	fi
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
 	     $$unique
@@ -551,9 +590,10 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
 
 
-cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
-	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
 	case "$(srcdir)" in \
 	case "$(srcdir)" in \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
@@ -716,20 +756,21 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
 
 
 .MAKE: all check install install-am install-strip
 .MAKE: all check install install-am install-strip
 
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-libLTLIBRARIES clean-libtool cscopelist \
-	ctags distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+	clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS 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-pdf install-pdf-am \
 	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
 	install-ps install-ps-am install-strip installcheck \
 	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 tags-am uninstall uninstall-am uninstall-binPROGRAMS \
 	uninstall-includeHEADERS uninstall-libLTLIBRARIES
 	uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
 
 
 

+ 48 - 27
src/apprentice.c

@@ -32,7 +32,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.191 2013/02/26 21:02:48 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.196 2013/11/19 21:01:12 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -80,6 +80,12 @@ struct magic_entry {
 	uint32_t max_count;
 	uint32_t max_count;
 };
 };
 
 
+struct magic_entry_set {
+	struct magic_entry *me;
+	uint32_t count;
+	uint32_t max;
+};
+
 struct magic_map {
 struct magic_map {
 	void *p;
 	void *p;
 	size_t len;
 	size_t len;
@@ -125,7 +131,6 @@ private int parse_strength(struct magic_set *, struct magic_entry *, const char
 private int parse_apple(struct magic_set *, struct magic_entry *, const char *);
 private int parse_apple(struct magic_set *, struct magic_entry *, const char *);
 
 
 
 
-private size_t maxmagic[MAGIC_SETS] = { 0 };
 private size_t magicsize = sizeof(struct magic);
 private size_t magicsize = sizeof(struct magic);
 
 
 private const char usg_hdr[] = "cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
 private const char usg_hdr[] = "cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
@@ -196,7 +201,7 @@ static const struct type_tbl_s type_tbl[] = {
 	{ XX("invalid"),	FILE_INVALID,		FILE_FMT_NONE },
 	{ XX("invalid"),	FILE_INVALID,		FILE_FMT_NONE },
 	{ XX("byte"),		FILE_BYTE,		FILE_FMT_NUM },
 	{ XX("byte"),		FILE_BYTE,		FILE_FMT_NUM },
 	{ XX("short"),		FILE_SHORT,		FILE_FMT_NUM },
 	{ XX("short"),		FILE_SHORT,		FILE_FMT_NUM },
-	{ XX("default"),	FILE_DEFAULT,		FILE_FMT_STR },
+	{ XX("default"),	FILE_DEFAULT,		FILE_FMT_NONE },
 	{ XX("long"),		FILE_LONG,		FILE_FMT_NUM },
 	{ XX("long"),		FILE_LONG,		FILE_FMT_NUM },
 	{ XX("string"),		FILE_STRING,		FILE_FMT_STR },
 	{ XX("string"),		FILE_STRING,		FILE_FMT_STR },
 	{ XX("date"),		FILE_DATE,		FILE_FMT_STR },
 	{ XX("date"),		FILE_DATE,		FILE_FMT_STR },
@@ -240,6 +245,7 @@ static const struct type_tbl_s type_tbl[] = {
 	{ XX("beqwdate"),	FILE_BEQWDATE,		FILE_FMT_STR },
 	{ XX("beqwdate"),	FILE_BEQWDATE,		FILE_FMT_STR },
 	{ XX("name"),		FILE_NAME,		FILE_FMT_NONE },
 	{ XX("name"),		FILE_NAME,		FILE_FMT_NONE },
 	{ XX("use"),		FILE_USE,		FILE_FMT_NONE },
 	{ XX("use"),		FILE_USE,		FILE_FMT_NONE },
+	{ XX("clear"),		FILE_CLEAR,		FILE_FMT_NONE },
 	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
 	{ XX_NULL,		FILE_INVALID,		FILE_FMT_NONE },
 };
 };
 
 
@@ -547,6 +553,8 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
 	int file_err, errs = -1;
 	int file_err, errs = -1;
 	size_t i;
 	size_t i;
 
 
+	file_reset(ms);
+
 	if ((fn = magic_getpath(fn, action)) == NULL)
 	if ((fn = magic_getpath(fn, action)) == NULL)
 		return -1;
 		return -1;
 
 
@@ -595,6 +603,10 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
 		return -1;
 		return -1;
 	}
 	}
 
 
+#if 0
+	/*
+	 * Always leave the database loaded
+	 */
 	if (action == FILE_LOAD)
 	if (action == FILE_LOAD)
 		return 0;
 		return 0;
 
 
@@ -602,8 +614,10 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
 		mlist_free(ms->mlist[i]);
 		mlist_free(ms->mlist[i]);
 		ms->mlist[i] = NULL;
 		ms->mlist[i] = NULL;
 	}
 	}
+#endif
 
 
 	switch (action) {
 	switch (action) {
+	case FILE_LOAD:
 	case FILE_COMPILE:
 	case FILE_COMPILE:
 	case FILE_CHECK:
 	case FILE_CHECK:
 	case FILE_LIST:
 	case FILE_LIST:
@@ -896,24 +910,24 @@ set_test_type(struct magic *mstart, struct magic *m)
 
 
 private int
 private int
 addentry(struct magic_set *ms, struct magic_entry *me,
 addentry(struct magic_set *ms, struct magic_entry *me,
-   struct magic_entry **mentry, uint32_t *mentrycount)
+   struct magic_entry_set *mset)
 {
 {
 	size_t i = me->mp->type == FILE_NAME ? 1 : 0;
 	size_t i = me->mp->type == FILE_NAME ? 1 : 0;
-	if (mentrycount[i] == maxmagic[i]) {
+	if (mset[i].count == mset[i].max) {
 		struct magic_entry *mp;
 		struct magic_entry *mp;
 
 
-		maxmagic[i] += ALLOC_INCR;
+		mset[i].max += ALLOC_INCR;
 		if ((mp = CAST(struct magic_entry *,
 		if ((mp = CAST(struct magic_entry *,
-		    realloc(mentry[i], sizeof(*mp) * maxmagic[i]))) ==
+		    realloc(mset[i].me, sizeof(*mp) * mset[i].max))) ==
 		    NULL) {
 		    NULL) {
-			file_oomem(ms, sizeof(*mp) * maxmagic[i]);
+			file_oomem(ms, sizeof(*mp) * mset[i].max);
 			return -1;
 			return -1;
 		}
 		}
-		(void)memset(&mp[mentrycount[i]], 0, sizeof(*mp) *
+		(void)memset(&mp[mset[i].count], 0, sizeof(*mp) *
 		    ALLOC_INCR);
 		    ALLOC_INCR);
-		mentry[i] = mp;
+		mset[i].me = mp;
 	}
 	}
-	mentry[i][mentrycount[i]++] = *me;
+	mset[i].me[mset[i].count++] = *me;
 	memset(me, 0, sizeof(*me));
 	memset(me, 0, sizeof(*me));
 	return 0;
 	return 0;
 }
 }
@@ -923,7 +937,7 @@ addentry(struct magic_set *ms, struct magic_entry *me,
  */
  */
 private void
 private void
 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 load_1(struct magic_set *ms, int action, const char *fn, int *errs,
-   struct magic_entry **mentry, uint32_t *mentrycount)
+   struct magic_entry_set *mset)
 {
 {
 	size_t lineno = 0, llen = 0;
 	size_t lineno = 0, llen = 0;
 	char *line = NULL;
 	char *line = NULL;
@@ -990,7 +1004,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 			case 0:
 			case 0:
 				continue;
 				continue;
 			case 1:
 			case 1:
-				(void)addentry(ms, &me, mentry, mentrycount);
+				(void)addentry(ms, &me, mset);
 				goto again;
 				goto again;
 			default:
 			default:
 				(*errs)++;
 				(*errs)++;
@@ -999,7 +1013,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
 		}
 		}
 	}
 	}
 	if (me.mp)
 	if (me.mp)
-		(void)addentry(ms, &me, mentry, mentrycount);
+		(void)addentry(ms, &me, mset);
 	free(line);
 	free(line);
 	(void)fclose(f);
 	(void)fclose(f);
 }
 }
@@ -1110,19 +1124,21 @@ private struct magic_map *
 apprentice_load(struct magic_set *ms, const char *fn, int action)
 apprentice_load(struct magic_set *ms, const char *fn, int action)
 {
 {
 	int errs = 0;
 	int errs = 0;
-	struct magic_entry *mentry[MAGIC_SETS] = { NULL };
-	uint32_t mentrycount[MAGIC_SETS] = { 0 };
 	uint32_t i, j;
 	uint32_t i, j;
 	size_t files = 0, maxfiles = 0;
 	size_t files = 0, maxfiles = 0;
 	char **filearr = NULL, *mfn;
 	char **filearr = NULL, *mfn;
 	struct stat st;
 	struct stat st;
 	struct magic_map *map;
 	struct magic_map *map;
+	struct magic_entry_set mset[MAGIC_SETS];
 	DIR *dir;
 	DIR *dir;
 	struct dirent *d;
 	struct dirent *d;
 
 
+	memset(mset, 0, sizeof(mset));
 	ms->flags |= MAGIC_CHECK;	/* Enable checks for parsed files */
 	ms->flags |= MAGIC_CHECK;	/* Enable checks for parsed files */
 
 
-	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
+
+	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL)
+	{
 		file_oomem(ms, sizeof(*map));
 		file_oomem(ms, sizeof(*map));
 		return NULL;
 		return NULL;
 	}
 	}
@@ -1168,36 +1184,35 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
 		closedir(dir);
 		closedir(dir);
 		qsort(filearr, files, sizeof(*filearr), cmpstrp);
 		qsort(filearr, files, sizeof(*filearr), cmpstrp);
 		for (i = 0; i < files; i++) {
 		for (i = 0; i < files; i++) {
-			load_1(ms, action, filearr[i], &errs, mentry,
-			    mentrycount);
+			load_1(ms, action, filearr[i], &errs, mset);
 			free(filearr[i]);
 			free(filearr[i]);
 		}
 		}
 		free(filearr);
 		free(filearr);
 	} else
 	} else
-		load_1(ms, action, fn, &errs, mentry, mentrycount);
+		load_1(ms, action, fn, &errs, mset);
 	if (errs)
 	if (errs)
 		goto out;
 		goto out;
 
 
 	for (j = 0; j < MAGIC_SETS; j++) {
 	for (j = 0; j < MAGIC_SETS; j++) {
 		/* Set types of tests */
 		/* Set types of tests */
-		for (i = 0; i < mentrycount[j]; ) {
-			if (mentry[j][i].mp->cont_level != 0) {
+		for (i = 0; i < mset[j].count; ) {
+			if (mset[j].me[i].mp->cont_level != 0) {
 				i++;
 				i++;
 				continue;
 				continue;
 			}
 			}
-			i = set_text_binary(ms, mentry[j], mentrycount[j], i);
+			i = set_text_binary(ms, mset[j].me, mset[j].count, i);
 		}
 		}
-		qsort(mentry[j], mentrycount[j], sizeof(*mentry[j]),
+		qsort(mset[j].me, mset[j].count, sizeof(*mset[j].me),
 		    apprentice_sort);
 		    apprentice_sort);
 
 
 		/*
 		/*
 		 * Make sure that any level 0 "default" line is last
 		 * Make sure that any level 0 "default" line is last
 		 * (if one exists).
 		 * (if one exists).
 		 */
 		 */
-		set_last_default(ms, mentry[j], mentrycount[j]);
+		set_last_default(ms, mset[j].me, mset[j].count);
 
 
 		/* coalesce per file arrays into a single one */
 		/* coalesce per file arrays into a single one */
-		if (coalesce_entries(ms, mentry[j], mentrycount[j],
+		if (coalesce_entries(ms, mset[j].me, mset[j].count,
 		    &map->magic[j], &map->nmagic[j]) == -1) {
 		    &map->magic[j], &map->nmagic[j]) == -1) {
 			errs++;
 			errs++;
 			goto out;
 			goto out;
@@ -1206,7 +1221,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
 
 
 out:
 out:
 	for (j = 0; j < MAGIC_SETS; j++)
 	for (j = 0; j < MAGIC_SETS; j++)
-		magic_entry_free(mentry[j], mentrycount[j]);
+		magic_entry_free(mset[j].me, mset[j].count);
 
 
 	if (errs) {
 	if (errs) {
 		for (j = 0; j < MAGIC_SETS; j++) {
 		for (j = 0; j < MAGIC_SETS; j++) {
@@ -1284,6 +1299,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
 		case FILE_INDIRECT:
 		case FILE_INDIRECT:
 		case FILE_NAME:
 		case FILE_NAME:
 		case FILE_USE:
 		case FILE_USE:
+		case FILE_CLEAR:
 			break;
 			break;
 		default:
 		default:
 			if (ms->flags & MAGIC_CHECK)
 			if (ms->flags & MAGIC_CHECK)
@@ -1936,6 +1952,11 @@ parse_strength(struct magic_set *ms, struct magic_entry *me, const char *line)
 		    m->factor_op, m->factor);
 		    m->factor_op, m->factor);
 		return -1;
 		return -1;
 	}
 	}
+	if (m->type == FILE_NAME) {
+		file_magwarn(ms, "%s: Strength setting is not supported in "
+		    "\"name\" magic entries", m->value.s);
+		return -1;
+	}
 	EATAB;
 	EATAB;
 	switch (*l) {
 	switch (*l) {
 	case FILE_FACTOR_OP_NONE:
 	case FILE_FACTOR_OP_NONE:

+ 4 - 3
src/ascmagic.c

@@ -35,7 +35,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.85 2012/08/09 16:33:15 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.88 2014/02/12 23:20:53 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -72,7 +72,7 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
 	int text)
 	int text)
 {
 {
 	unichar *ubuf = NULL;
 	unichar *ubuf = NULL;
-	size_t ulen;
+	size_t ulen = 0;
 	int rv = 1;
 	int rv = 1;
 
 
 	const char *code = NULL;
 	const char *code = NULL;
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 		    == NULL)
 		    == NULL)
 			goto done;
 			goto done;
 		if ((rv = file_softmagic(ms, utf8_buf,
 		if ((rv = file_softmagic(ms, utf8_buf,
-		    (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
+		    (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
 			rv = -1;
 			rv = -1;
 	}
 	}
 
 
@@ -211,6 +211,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 				case 0:
 				case 0:
 					if (file_printf(ms, ", ") == -1)
 					if (file_printf(ms, ", ") == -1)
 						goto done;
 						goto done;
+					break;
 				case -1:
 				case -1:
 					goto done;
 					goto done;
 				default:
 				default:

+ 7 - 8
src/compress.c

@@ -35,7 +35,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.70 2012/11/07 17:54:48 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.73 2014/01/05 15:55:21 christos Exp $")
 #endif
 #endif
 
 
 #include "magic.h"
 #include "magic.h"
@@ -80,6 +80,7 @@ private const struct {
 	{ "LZIP",     4, { "lzip", "-cdq", NULL }, 1 },
 	{ "LZIP",     4, { "lzip", "-cdq", NULL }, 1 },
  	{ "\3757zXZ\0",6,{ "xz", "-cd", NULL }, 1 },		/* XZ Utils */
  	{ "\3757zXZ\0",6,{ "xz", "-cd", NULL }, 1 },		/* XZ Utils */
  	{ "LRZI",     4, { "lrzip", "-dqo-", NULL }, 1 },	/* LRZIP */
  	{ "LRZI",     4, { "lrzip", "-dqo-", NULL }, 1 },	/* LRZIP */
+ 	{ "\004\"M\030", 4, { "lz4", "-cd", NULL }, 1 },	/* LZ4 */
 };
 };
 
 
 #define NODATA ((size_t)~0)
 #define NODATA ((size_t)~0)
@@ -121,14 +122,12 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
 				if (file_printf(ms, mime ?
 				if (file_printf(ms, mime ?
 				    " compressed-encoding=" : " (") == -1)
 				    " compressed-encoding=" : " (") == -1)
 					goto error;
 					goto error;
+				if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
+					goto error;
+				if (!mime && file_printf(ms, ")") == -1)
+					goto error;
 			}
 			}
 
 
-			if ((mime == 0 || mime & MAGIC_MIME_ENCODING) &&
-			    file_buffer(ms, -1, NULL, buf, nbytes) == -1)
-				goto error;
-
-			if (!mime && file_printf(ms, ")") == -1)
-				goto error;
 			rv = 1;
 			rv = 1;
 			break;
 			break;
 		}
 		}
@@ -481,7 +480,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
 #endif
 #endif
 			free(*newch);
 			free(*newch);
 			n = 0;
 			n = 0;
-			newch[0] = '\0';
+			*newch = NULL;
 			goto err;
 			goto err;
 		} else {
 		} else {
 			n = r;
 			n = r;

+ 9 - 5
src/encoding.c

@@ -35,7 +35,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: encoding.c,v 1.7 2012/01/24 19:02:02 christos Exp $")
+FILE_RCSID("@(#)$File: encoding.c,v 1.9 2013/11/19 20:45:50 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -72,13 +72,17 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
 	unsigned char *nbuf = NULL;
 	unsigned char *nbuf = NULL;
 
 
 	*type = "text";
 	*type = "text";
-	mlen = (nbytes + 1) * sizeof(nbuf[0]);
-	if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) {
+	*ulen = 0;
+	*code = "unknown";
+	*code_mime = "binary";
+
+	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
+	if ((*ubuf = CAST(unichar *, calloc((size_t)1, mlen))) == NULL) {
 		file_oomem(ms, mlen);
 		file_oomem(ms, mlen);
 		goto done;
 		goto done;
 	}
 	}
-	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
-	if ((*ubuf = CAST(unichar *, calloc((size_t)1, mlen))) == NULL) {
+	mlen = (nbytes + 1) * sizeof(nbuf[0]);
+	if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) {
 		file_oomem(ms, mlen);
 		file_oomem(ms, mlen);
 		goto done;
 		goto done;
 	}
 	}

+ 12 - 6
src/file.c

@@ -32,7 +32,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: file.c,v 1.149 2013/01/07 18:20:19 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.153 2014/02/11 15:41:04 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -71,9 +71,9 @@ int getopt_long(int argc, char * const *argv, const char *optstring, const struc
 #endif
 #endif
 
 
 #ifdef S_IFLNK
 #ifdef S_IFLNK
-#define FILE_FLAGS "-bchikLlNnprsvz0"
+#define FILE_FLAGS "-bcEhikLlNnprsvz0"
 #else
 #else
-#define FILE_FLAGS "-bciklNnprsvz0"
+#define FILE_FLAGS "-bcEiklNnprsvz0"
 #endif
 #endif
 
 
 # define USAGE  \
 # define USAGE  \
@@ -101,7 +101,7 @@ private const struct option long_options[] = {
 #undef OPT_LONGONLY
 #undef OPT_LONGONLY
     {0, 0, NULL, 0}
     {0, 0, NULL, 0}
 };
 };
-#define OPTSTRING	"bcCde:f:F:hiklLm:nNprsvz0"
+#define OPTSTRING	"bcCde:Ef:F:hiklLm:nNprsvz0"
 
 
 private const struct {
 private const struct {
 	const char *name;
 	const char *name;
@@ -194,6 +194,9 @@ main(int argc, char *argv[])
 		case 'd':
 		case 'd':
 			flags |= MAGIC_DEBUG|MAGIC_CHECK;
 			flags |= MAGIC_DEBUG|MAGIC_CHECK;
 			break;
 			break;
+		case 'E':
+			flags |= MAGIC_ERROR;
+			break;
 		case 'e':
 		case 'e':
 			for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++)
 			for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++)
 				if (strcmp(nv[i].name, optarg) == 0)
 				if (strcmp(nv[i].name, optarg) == 0)
@@ -465,8 +468,11 @@ file_mbswidth(const char *s)
 			 * is always right
 			 * is always right
 			 */
 			 */
 			width++;
 			width++;
-		} else
-			width += wcwidth(nextchar);
+		} else {
+			int w = wcwidth(nextchar);
+			if (w > 0)
+				width += w;
+		}
 
 
 		s += bytesconsumed, n -= bytesconsumed;
 		s += bytesconsumed, n -= bytesconsumed;
 	}
 	}

+ 16 - 12
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.144 2013/02/18 15:40:59 christos Exp $
+ * @(#)$File: file.h,v 1.148 2014/02/12 23:20:53 christos Exp $
  */
  */
 
 
 #ifndef __file_h__
 #ifndef __file_h__
@@ -133,7 +133,7 @@
 #define MAXstring 64		/* max len of "string" types */
 #define MAXstring 64		/* max len of "string" types */
 
 
 #define MAGICNO		0xF11E041C
 #define MAGICNO		0xF11E041C
-#define VERSIONNO	10
+#define VERSIONNO	11
 #define FILE_MAGICSIZE	248
 #define FILE_MAGICSIZE	248
 
 
 #define	FILE_LOAD	0
 #define	FILE_LOAD	0
@@ -222,7 +222,8 @@ struct magic {
 #define				FILE_BEQWDATE	44
 #define				FILE_BEQWDATE	44
 #define				FILE_NAME	45
 #define				FILE_NAME	45
 #define				FILE_USE	46
 #define				FILE_USE	46
-#define				FILE_NAMES_SIZE	47 /* size of array to contain all names */
+#define				FILE_CLEAR	47
+#define				FILE_NAMES_SIZE	48 /* size of array to contain all names */
 
 
 #define IS_STRING(t) \
 #define IS_STRING(t) \
 	((t) == FILE_STRING || \
 	((t) == FILE_STRING || \
@@ -232,8 +233,7 @@ struct magic {
 	 (t) == FILE_REGEX || \
 	 (t) == FILE_REGEX || \
 	 (t) == FILE_SEARCH || \
 	 (t) == FILE_SEARCH || \
 	 (t) == FILE_NAME || \
 	 (t) == FILE_NAME || \
-	 (t) == FILE_USE || \
-	 (t) == FILE_DEFAULT)
+	 (t) == FILE_USE)
 
 
 #define FILE_FMT_NONE 0
 #define FILE_FMT_NONE 0
 #define FILE_FMT_NUM  1 /* "cduxXi" */
 #define FILE_FMT_NUM  1 /* "cduxXi" */
@@ -415,7 +415,8 @@ protected int file_buffer(struct magic_set *, int, const char *, const void *,
     size_t);
     size_t);
 protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
 protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
 protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
 protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
-protected int file_vprintf(struct magic_set *, const char *, va_list);
+protected int file_vprintf(struct magic_set *, const char *, va_list)
+    __attribute__((__format__(__printf__, 2, 0)));
 protected size_t file_printedlen(const struct magic_set *);
 protected size_t file_printedlen(const struct magic_set *);
 protected int file_replace(struct magic_set *, const char *, const char *);
 protected int file_replace(struct magic_set *, const char *, const char *);
 protected int file_printf(struct magic_set *, const char *, ...)
 protected int file_printf(struct magic_set *, const char *, ...)
@@ -438,7 +439,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
     unichar **, size_t *, const char **, const char **, const char **);
     unichar **, size_t *, const char **, const char **, const char **);
 protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
 protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
 protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
 protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
-    int, int);
+    size_t, int, int);
 protected int file_apprentice(struct magic_set *, const char *, int);
 protected int file_apprentice(struct magic_set *, const char *, int);
 protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
 protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
 protected uint64_t file_signextend(struct magic_set *, struct magic *,
 protected uint64_t file_signextend(struct magic_set *, struct magic *,
@@ -491,18 +492,21 @@ ssize_t pread(int, void *, size_t, off_t);
 int vasprintf(char **, const char *, va_list);
 int vasprintf(char **, const char *, va_list);
 #endif
 #endif
 #ifndef HAVE_ASPRINTF
 #ifndef HAVE_ASPRINTF
-int asprintf(char **ptr, const char *format_string, ...);
+int asprintf(char **, const char *, ...);
 #endif
 #endif
 
 
 #ifndef HAVE_STRLCPY
 #ifndef HAVE_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t siz);
+size_t strlcpy(char *, const char *, size_t);
 #endif
 #endif
 #ifndef HAVE_STRLCAT
 #ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t siz);
+size_t strlcat(char *, const char *, size_t);
+#endif
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *, const char *);
 #endif
 #endif
 #ifndef HAVE_GETLINE
 #ifndef HAVE_GETLINE
-ssize_t getline(char **dst, size_t *len, FILE *fp);
-ssize_t getdelim(char **dst, size_t *len, int delimiter, FILE *fp);
+ssize_t getline(char **, size_t *, FILE *);
+ssize_t getdelim(char **, size_t *, int, FILE *);
 #endif
 #endif
 #ifndef HAVE_CTIME_R
 #ifndef HAVE_CTIME_R
 char   *ctime_r(const time_t *, char *);
 char   *ctime_r(const time_t *, char *);

+ 1 - 1
src/file_opts.h

@@ -32,8 +32,8 @@ OPT_LONGONLY("apple", 0, "                output the Apple CREATOR/TYPE\n")
 OPT_LONGONLY("mime-type", 0, "            output the MIME type\n")
 OPT_LONGONLY("mime-type", 0, "            output the MIME type\n")
 OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n")
 OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n")
 OPT('k', "keep-going", 0, "           don't stop at the first match\n")
 OPT('k', "keep-going", 0, "           don't stop at the first match\n")
-#ifdef S_IFLNK
 OPT('l', "list", 0, "                 list magic strength\n")
 OPT('l', "list", 0, "                 list magic strength\n")
+#ifdef S_IFLNK
 OPT('L', "dereference", 0, "          follow symlinks (default)\n")
 OPT('L', "dereference", 0, "          follow symlinks (default)\n")
 OPT('h', "no-dereference", 0, "       don't follow symlinks\n")
 OPT('h', "no-dereference", 0, "       don't follow symlinks\n")
 #endif
 #endif

+ 3 - 4
src/fsmagic.c

@@ -32,7 +32,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: fsmagic.c,v 1.67 2013/03/17 15:43:20 christos Exp $")
+FILE_RCSID("@(#)$File: fsmagic.c,v 1.71 2013/12/01 18:01:07 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -131,8 +131,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		if (file_printf(ms, "cannot open `%s' (%s)",
 		if (file_printf(ms, "cannot open `%s' (%s)",
 		    fn, strerror(errno)) == -1)
 		    fn, strerror(errno)) == -1)
 			return -1;
 			return -1;
-		ms->event_flags |= EVENT_HAD_ERR;
-		return -1;
+		return 0;
 	}
 	}
 
 
 	ret = 1;
 	ret = 1;
@@ -367,7 +366,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
 		/*NOTREACHED*/
 		/*NOTREACHED*/
 	}
 	}
 
 
-	if (!mime && did) {
+	if (!mime && did && ret == 0) {
 	    if (file_printf(ms, " ") == -1)
 	    if (file_printf(ms, " ") == -1)
 		    return -1;
 		    return -1;
 	}
 	}

+ 26 - 19
src/funcs.c

@@ -27,7 +27,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.61 2012/10/30 23:11:51 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -44,6 +44,9 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.61 2012/10/30 23:11:51 christos Exp $")
 #if defined(HAVE_LIMITS_H)
 #if defined(HAVE_LIMITS_H)
 #include <limits.h>
 #include <limits.h>
 #endif
 #endif
+#if defined(HAVE_LOCALE_H)
+#include <locale.h>
+#endif
 
 
 #ifndef SIZE_MAX
 #ifndef SIZE_MAX
 #define SIZE_MAX	((size_t)~0)
 #define SIZE_MAX	((size_t)~0)
@@ -58,6 +61,8 @@ file_vprintf(struct magic_set *ms, const char *fmt, va_list ap)
 	int len;
 	int len;
 	char *buf, *newstr;
 	char *buf, *newstr;
 
 
+	if (ms->event_flags & EVENT_HAD_ERR)
+		return 0;
 	len = vasprintf(&buf, fmt, ap);
 	len = vasprintf(&buf, fmt, ap);
 	if (len < 0)
 	if (len < 0)
 		goto out;
 		goto out;
@@ -93,6 +98,7 @@ file_printf(struct magic_set *ms, const char *fmt, ...)
  * error - print best error message possible
  * error - print best error message possible
  */
  */
 /*VARARGS*/
 /*VARARGS*/
+__attribute__((__format__(__printf__, 3, 0)))
 private void
 private void
 file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
 file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
     size_t lineno)
     size_t lineno)
@@ -166,22 +172,18 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 	size_t ulen;
 	size_t ulen;
 	const char *code = NULL;
 	const char *code = NULL;
 	const char *code_mime = "binary";
 	const char *code_mime = "binary";
-	const char *type = NULL;
+	const char *type = "application/octet-stream";
+	const char *def = "data";
 
 
 
 
 
 
 	if (nb == 0) {
 	if (nb == 0) {
-		if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
-		    file_printf(ms, mime ? "application/x-empty" :
-		    "empty") == -1)
-			return -1;
-		return 1;
+		def = "empty";
+		type = "application/x-empty";
+		goto simple;
 	} else if (nb == 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;
+		def = "very short file (no magic)";
+		goto simple;
 	}
 	}
 
 
 	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
 	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
@@ -207,7 +209,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 		if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) {
 		if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) {
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 				(void)fprintf(stderr, "zmagic %d\n", m);
 				(void)fprintf(stderr, "zmagic %d\n", m);
-			goto done;
+			goto done_encoding;
 		}
 		}
 #endif
 #endif
 	/* Check if we have a tar file */
 	/* Check if we have a tar file */
@@ -228,7 +230,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 
 
 	/* try soft magic tests */
 	/* try soft magic tests */
 	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
 	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
-		if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
+		if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
 		    looks_text)) != 0) {
 		    looks_text)) != 0) {
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 				(void)fprintf(stderr, "softmagic %d\n", m);
 				(void)fprintf(stderr, "softmagic %d\n", m);
@@ -276,10 +278,11 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 		}
 		}
 	}
 	}
 
 
+simple:
 	/* give up */
 	/* give up */
 	m = 1;
 	m = 1;
 	if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
 	if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
-	    file_printf(ms, mime ? "application/octet-stream" : "data") == -1) {
+	    file_printf(ms, "%s", mime ? type : def) == -1) {
 	    rv = -1;
 	    rv = -1;
 	}
 	}
  done:
  done:
@@ -290,6 +293,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
 		if (file_printf(ms, "%s", code_mime) == -1)
 		if (file_printf(ms, "%s", code_mime) == -1)
 			rv = -1;
 			rv = -1;
 	}
 	}
+ done_encoding:
 	free(u8buf);
 	free(u8buf);
 	if (rv)
 	if (rv)
 		return rv;
 		return rv;
@@ -437,14 +441,14 @@ protected int
 file_replace(struct magic_set *ms, const char *pat, const char *rep)
 file_replace(struct magic_set *ms, const char *pat, const char *rep)
 {
 {
 	regex_t rx;
 	regex_t rx;
-	int rc;
+	int rc, rv = -1;
 
 
+	(void)setlocale(LC_CTYPE, "C");
 	rc = regcomp(&rx, pat, REG_EXTENDED);
 	rc = regcomp(&rx, pat, REG_EXTENDED);
 	if (rc) {
 	if (rc) {
 		char errmsg[512];
 		char errmsg[512];
 		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
 		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
 		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
 		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
-		return -1;
 	} else {
 	} else {
 		regmatch_t rm;
 		regmatch_t rm;
 		int nm = 0;
 		int nm = 0;
@@ -452,10 +456,13 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
 			ms->o.buf[rm.rm_so] = '\0';
 			ms->o.buf[rm.rm_so] = '\0';
 			if (file_printf(ms, "%s%s", rep,
 			if (file_printf(ms, "%s%s", rep,
 			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
 			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
-				return -1;
+				goto out;
 			nm++;
 			nm++;
 		}
 		}
 		regfree(&rx);
 		regfree(&rx);
-		return nm;
+		rv = nm;
 	}
 	}
+out:
+	(void)setlocale(LC_CTYPE, "");
+	return rv;
 }
 }

+ 11 - 4
src/magic.c

@@ -33,7 +33,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: magic.c,v 1.78 2013/01/07 18:20:19 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.81 2013/11/29 15:42:51 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
@@ -282,7 +282,7 @@ private void
 close_and_restore(const struct magic_set *ms, const char *name, int fd,
 close_and_restore(const struct magic_set *ms, const char *name, int fd,
     const struct stat *sb)
     const struct stat *sb)
 {
 {
-	if (fd == STDIN_FILENO)
+	if (fd == STDIN_FILENO || name == NULL)
 		return;
 		return;
 	(void) close(fd);
 	(void) close(fd);
 
 
@@ -343,6 +343,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	struct stat	sb;
 	struct stat	sb;
 	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
 	ssize_t nbytes = 0;	/* number of bytes read from a datafile */
 	int	ispipe = 0;
 	int	ispipe = 0;
+	off_t	pos = (off_t)-1;
 
 
 	/*
 	/*
 	 * one extra for terminating '\0', and
 	 * one extra for terminating '\0', and
@@ -368,10 +369,13 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	if (inname == NULL) {
 	if (inname == NULL) {
 		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
+			pos = lseek(fd, (off_t)0, SEEK_CUR);
 	} else {
 	} else {
 		int flags = O_RDONLY|O_BINARY;
 		int flags = O_RDONLY|O_BINARY;
+		int okstat = stat(inname, &sb) == 0;
 
 
-		if (stat(inname, &sb) == 0 && S_ISFIFO(sb.st_mode)) {
+		if (okstat && S_ISFIFO(sb.st_mode)) {
 #ifdef O_NONBLOCK
 #ifdef O_NONBLOCK
 			flags |= O_NONBLOCK;
 			flags |= O_NONBLOCK;
 #endif
 #endif
@@ -380,7 +384,8 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 
 
 		errno = 0;
 		errno = 0;
 		if ((fd = open(inname, flags)) < 0) {
 		if ((fd = open(inname, flags)) < 0) {
-			if (unreadable_info(ms, sb.st_mode, inname) == -1)
+			if (okstat &&
+			    unreadable_info(ms, sb.st_mode, inname) == -1)
 				goto done;
 				goto done;
 			rv = 0;
 			rv = 0;
 			goto done;
 			goto done;
@@ -426,6 +431,8 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
 	rv = 0;
 	rv = 0;
 done:
 done:
 	free(buf);
 	free(buf);
+	if (pos != (off_t)-1)
+		(void)lseek(fd, pos, SEEK_SET);
 	close_and_restore(ms, inname, fd, &sb);
 	close_and_restore(ms, inname, fd, &sb);
 	return rv == 0 ? file_getbuffer(ms) : NULL;
 	return rv == 0 ? file_getbuffer(ms) : NULL;
 }
 }

+ 2 - 1
src/magic.h

@@ -65,6 +65,7 @@
 	MAGIC_NO_CHECK_CDF	| \
 	MAGIC_NO_CHECK_CDF	| \
 	MAGIC_NO_CHECK_TOKENS	| \
 	MAGIC_NO_CHECK_TOKENS	| \
 	MAGIC_NO_CHECK_ENCODING	| \
 	MAGIC_NO_CHECK_ENCODING	| \
+	0			  \
 )
 )
 
 
 /* Defined for backwards compatibility (renamed) */
 /* Defined for backwards compatibility (renamed) */
@@ -74,7 +75,7 @@
 #define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
 #define	MAGIC_NO_CHECK_FORTRAN	0x000000 /* Don't check ascii/fortran */
 #define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
 #define	MAGIC_NO_CHECK_TROFF	0x000000 /* Don't check ascii/troff */
 
 
-#define MAGIC_VERSION		514	/* This implementation */
+#define MAGIC_VERSION		516	/* This implementation */
 
 
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus

+ 1 - 0
src/magic.h.in

@@ -65,6 +65,7 @@
 	MAGIC_NO_CHECK_CDF	| \
 	MAGIC_NO_CHECK_CDF	| \
 	MAGIC_NO_CHECK_TOKENS	| \
 	MAGIC_NO_CHECK_TOKENS	| \
 	MAGIC_NO_CHECK_ENCODING	| \
 	MAGIC_NO_CHECK_ENCODING	| \
+	0			  \
 )
 )
 
 
 /* Defined for backwards compatibility (renamed) */
 /* Defined for backwards compatibility (renamed) */

+ 2 - 2
src/pread.c

@@ -1,12 +1,12 @@
 #include "file.h"
 #include "file.h"
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: pread.c,v 1.1 2013/02/18 15:40:59 christos Exp $")
+FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
 #endif  /* lint */
 #endif  /* lint */
 #include <fcntl.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
 ssize_t
 ssize_t
-pread(int fd, void *buf, ssize_t len, off_t off) {
+pread(int fd, void *buf, size_t len, off_t off) {
 	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
 	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
 		return -1;
 		return -1;
 
 

+ 90 - 46
src/readcdf.c

@@ -26,7 +26,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.33 2012/06/20 21:52:36 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.37 2014/01/06 13:41:18 rrt Exp $")
 #endif
 #endif
 
 
 #include <stdlib.h>
 #include <stdlib.h>
@@ -34,12 +34,57 @@ FILE_RCSID("@(#)$File: readcdf.c,v 1.33 2012/06/20 21:52:36 christos Exp $")
 #include <string.h>
 #include <string.h>
 #include <time.h>
 #include <time.h>
 #include <ctype.h>
 #include <ctype.h>
+#if defined(HAVE_LOCALE_H)
+#include <locale.h>
+#endif
 
 
 #include "cdf.h"
 #include "cdf.h"
 #include "magic.h"
 #include "magic.h"
 
 
 #define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
 #define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
 
 
+static const struct nv {
+	const char *pattern;
+	const char *mime;
+} app2mime[] =  {
+	{ "Word",			"msword",		},
+	{ "Excel",			"vnd.ms-excel",		},
+	{ "Powerpoint",			"vnd.ms-powerpoint",	},
+	{ "Crystal Reports",		"x-rpt",		},
+	{ "Advanced Installer",		"vnd.ms-msi",		},
+	{ "InstallShield",		"vnd.ms-msi",		},
+	{ "Microsoft Patch Compiler",	"vnd.ms-msi",		},
+	{ "NAnt",			"vnd.ms-msi",		},
+	{ "Windows Installer",		"vnd.ms-msi",		},
+	{ NULL,				NULL,			},
+}, name2mime[] = {
+	{ "WordDocument",		"msword",		},
+	{ "PowerPoint",			"vnd.ms-powerpoint",	},
+	{ "DigitalSignature",		"vnd.ms-msi",		},
+	{ NULL,				NULL,			},
+}, name2desc[] = {
+	{ "WordDocument",		"Microsoft Office Word",},
+	{ "PowerPoint",			"Microsoft PowerPoint",	},
+	{ "DigitalSignature",		"Microsoft Installer",	},
+	{ NULL,				NULL,			},
+};
+
+private const char *
+cdf_app_to_mime(const char *vbuf, const struct nv *nv)
+{
+	size_t i;
+	const char *rv = NULL;
+
+	(void)setlocale(LC_CTYPE, "C");
+	for (i = 0; nv[i].pattern != NULL; i++)
+		if (strcasestr(vbuf, nv[i].pattern) != NULL) {
+			rv = nv[i].mime;
+			break;
+		}
+	(void)setlocale(LC_CTYPE, "");
+	return rv;
+}
+
 private int
 private int
 cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
 cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
     size_t count)
     size_t count)
@@ -109,18 +154,10 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                                                         return -1;
                                                         return -1;
                                         }
                                         }
                                 } else if (info[i].pi_id ==
                                 } else if (info[i].pi_id ==
-                                        CDF_PROPERTY_NAME_OF_APPLICATION) {
-                                        if (strstr(vbuf, "Word"))
-                                                str = "msword";
-                                        else if (strstr(vbuf, "Excel"))
-                                                str = "vnd.ms-excel";
-                                        else if (strstr(vbuf, "Powerpoint"))
-                                                str = "vnd.ms-powerpoint";
-                                        else if (strstr(vbuf,
-                                            "Crystal Reports"))
-                                                str = "x-rpt";
-                                }
-                        }
+				    CDF_PROPERTY_NAME_OF_APPLICATION) {
+					str = cdf_app_to_mime(vbuf, app2mime);
+				}
+			}
                         break;
                         break;
                 case CDF_FILETIME:
                 case CDF_FILETIME:
                         tp = info[i].pi_tp;
                         tp = info[i].pi_tp;
@@ -136,8 +173,9 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                                         char *c, *ec;
                                         char *c, *ec;
                                         cdf_timestamp_to_timespec(&ts, tp);
                                         cdf_timestamp_to_timespec(&ts, tp);
                                         c = cdf_ctime(&ts.tv_sec, tbuf);
                                         c = cdf_ctime(&ts.tv_sec, tbuf);
-                                        if ((ec = strchr(c, '\n')) != NULL)
-                                                *ec = '\0';
+                                        if (c != NULL &&
+					    (ec = strchr(c, '\n')) != NULL)
+						*ec = '\0';
 
 
                                         if (NOTMIME(ms) && file_printf(ms,
                                         if (NOTMIME(ms) && file_printf(ms,
                                             ", %s: %s", buf, c) == -1)
                                             ", %s: %s", buf, c) == -1)
@@ -277,26 +315,34 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
         if ((i = cdf_file_summary_info(ms, &h, &scn)) < 0)
         if ((i = cdf_file_summary_info(ms, &h, &scn)) < 0)
                 expn = "Can't expand summary_info";
                 expn = "Can't expand summary_info";
 	if (i == 0) {
 	if (i == 0) {
-		const char *str = "vnd.ms-office";
+		const char *str = NULL;
 		cdf_directory_t *d;
 		cdf_directory_t *d;
 		char name[__arraycount(d->d_name)];
 		char name[__arraycount(d->d_name)];
 		size_t j, k;
 		size_t j, k;
 		for (j = 0; j < dir.dir_len; j++) {
 		for (j = 0; j < dir.dir_len; j++) {
-		    d = &dir.dir_tab[j];
-		    for (k = 0; k < sizeof(name); k++)
-			name[k] = (char)cdf_tole2(d->d_name[k]);
-		    if (strstr(name, "WordDocument") != 0) {
-			str = "msword";
-			break;
-		    }
-		    if (strstr(name, "PowerPoint") != 0) {
-			str = "vnd.ms-powerpoint";
-			break;
-		    }
+			d = &dir.dir_tab[j];
+			for (k = 0; k < sizeof(name); k++)
+				name[k] = (char)cdf_tole2(d->d_name[k]);
+			if (NOTMIME(ms))
+				str = cdf_app_to_mime(name, name2desc);
+			else
+				str = cdf_app_to_mime(name, name2mime);
+			if (str != NULL)
+				break;
+		}
+		if (NOTMIME(ms)) {
+			if (str != NULL) {
+				if (file_printf(ms, "%s", str) == -1)
+					return -1;
+				i = 1;
+			}
+		} else {
+			if (str == NULL)
+				str = "vnd.ms-office";
+			if (file_printf(ms, "application/%s", str) == -1)
+				return -1;
+			i = 1;
 		}
 		}
-                if (file_printf(ms, "application/%s", str) == -1)
-                        return -1;
-		i = 1;
 	}
 	}
         free(scn.sst_tab);
         free(scn.sst_tab);
 out4:
 out4:
@@ -308,21 +354,19 @@ out2:
 out1:
 out1:
         free(sat.sat_tab);
         free(sat.sat_tab);
 out0:
 out0:
-        if (i != 1) {
-		if (i == -1) {
-		    if (NOTMIME(ms)) {
-			if (file_printf(ms,
-			    "Composite Document File V2 Document") == -1)
-			    return -1;
-			if (*expn)
-			    if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
-				return -1;
-		    } else {
-			if (file_printf(ms, "application/CDFV2-corrupt") == -1)
-			    return -1;
-		    }
-		}
-                i = 1;
-        }
+	if (i == -1) {
+	    if (NOTMIME(ms)) {
+		if (file_printf(ms,
+		    "Composite Document File V2 Document") == -1)
+		    return -1;
+		if (*expn)
+		    if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
+			return -1;
+	    } else {
+		if (file_printf(ms, "application/CDFV2-corrupt") == -1)
+		    return -1;
+	    }
+	    i = 1;
+	}
         return i;
         return i;
 }
 }

+ 168 - 107
src/readelf.c

@@ -27,7 +27,7 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef lint
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.97 2013/03/06 03:35:30 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.99 2013/11/05 15:44:01 christos Exp $")
 #endif
 #endif
 
 
 #ifdef BUILTIN_ELF
 #ifdef BUILTIN_ELF
@@ -344,6 +344,126 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
 }
 }
 #endif
 #endif
 
 
+static void
+do_note_netbsd_version(struct magic_set *ms, int swap, void *v)
+{
+	uint32_t desc;
+	(void)memcpy(&desc, v, sizeof(desc));
+	desc = elf_getu32(swap, desc);
+
+	if (file_printf(ms, ", for NetBSD") == -1)
+		return;
+	/*
+	 * The version number used to be stuck as 199905, and was thus
+	 * basically content-free.  Newer versions of NetBSD have fixed
+	 * this and now use the encoding of __NetBSD_Version__:
+	 *
+	 *	MMmmrrpp00
+	 *
+	 * M = major version
+	 * m = minor version
+	 * r = release ["",A-Z,Z[A-Z] but numeric]
+	 * p = patchlevel
+	 */
+	if (desc > 100000000U) {
+		uint32_t ver_patch = (desc / 100) % 100;
+		uint32_t ver_rel = (desc / 10000) % 100;
+		uint32_t ver_min = (desc / 1000000) % 100;
+		uint32_t ver_maj = desc / 100000000;
+
+		if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
+			return;
+		if (ver_rel == 0 && ver_patch != 0) {
+			if (file_printf(ms, ".%u", ver_patch) == -1)
+				return;
+		} else if (ver_rel != 0) {
+			while (ver_rel > 26) {
+				if (file_printf(ms, "Z") == -1)
+					return;
+				ver_rel -= 26;
+			}
+			if (file_printf(ms, "%c", 'A' + ver_rel - 1)
+			    == -1)
+				return;
+		}
+	}
+}
+
+static void
+do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
+{
+	uint32_t desc;
+
+	(void)memcpy(&desc, v, sizeof(desc));
+	desc = elf_getu32(swap, desc);
+	if (file_printf(ms, ", for FreeBSD") == -1)
+		return;
+
+	/*
+	 * Contents is __FreeBSD_version, whose relation to OS
+	 * versions is defined by a huge table in the Porter's
+	 * Handbook.  This is the general scheme:
+	 * 
+	 * Releases:
+	 * 	Mmp000 (before 4.10)
+	 * 	Mmi0p0 (before 5.0)
+	 * 	Mmm0p0
+	 * 
+	 * Development branches:
+	 * 	Mmpxxx (before 4.6)
+	 * 	Mmp1xx (before 4.10)
+	 * 	Mmi1xx (before 5.0)
+	 * 	M000xx (pre-M.0)
+	 * 	Mmm1xx
+	 * 
+	 * M = major version
+	 * m = minor version
+	 * i = minor version increment (491000 -> 4.10)
+	 * p = patchlevel
+	 * x = revision
+	 * 
+	 * The first release of FreeBSD to use ELF by default
+	 * was version 3.0.
+	 */
+	if (desc == 460002) {
+		if (file_printf(ms, " 4.6.2") == -1)
+			return;
+	} else if (desc < 460100) {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 10000 % 10) == -1)
+			return;
+		if (desc / 1000 % 10 > 0)
+			if (file_printf(ms, ".%d", desc / 1000 % 10) == -1)
+				return;
+		if ((desc % 1000 > 0) || (desc % 100000 == 0))
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+	} else if (desc < 500000) {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 10000 % 10 + desc / 1000 % 10) == -1)
+			return;
+		if (desc / 100 % 10 > 0) {
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+		} else if (desc / 10 % 10 > 0) {
+			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
+				return;
+		}
+	} else {
+		if (file_printf(ms, " %d.%d", desc / 100000,
+		    desc / 1000 % 100) == -1)
+			return;
+		if ((desc / 100 % 10 > 0) ||
+		    (desc % 100000 / 100 == 0)) {
+			if (file_printf(ms, " (%d)", desc) == -1)
+				return;
+		} else if (desc / 10 % 10 > 0) {
+			if (file_printf(ms, ".%d", desc / 10 % 10) == -1)
+				return;
+		}
+	}
+}
+
 private size_t
 private size_t
 donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
 donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
     int clazz, int swap, size_t align, int *flags)
     int clazz, int swap, size_t align, int *flags)
@@ -461,130 +581,70 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
 	    *flags |= FLAGS_DID_BUILD_ID;
 	    *flags |= FLAGS_DID_BUILD_ID;
 	}
 	}
 
 
-	if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0 &&
-	    xnh_type == NT_NETBSD_VERSION && descsz == 4) {
+	if (namesz == 4 && strcmp((char *)&nbuf[noff], "PaX") == 0 &&
+	    xnh_type == NT_NETBSD_PAX && descsz == 4) {
+		static const char *pax[] = {
+		    "+mprotect",
+		    "-mprotect",
+		    "+segvguard",
+		    "-segvguard",
+		    "+ASLR",
+		    "-ASLR",
+		};
 		uint32_t desc;
 		uint32_t desc;
+		size_t i;
+		int did = 0;
+
 		(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
 		(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
 		desc = elf_getu32(swap, desc);
 		desc = elf_getu32(swap, desc);
 
 
-		if (file_printf(ms, ", for NetBSD") == -1)
+		if (desc && file_printf(ms, ", PaX: ") == -1)
 			return size;
 			return size;
-		/*
-		 * The version number used to be stuck as 199905, and was thus
-		 * basically content-free.  Newer versions of NetBSD have fixed
-		 * this and now use the encoding of __NetBSD_Version__:
-		 *
-		 *	MMmmrrpp00
-		 *
-		 * M = major version
-		 * m = minor version
-		 * r = release ["",A-Z,Z[A-Z] but numeric]
-		 * p = patchlevel
-		 */
-		if (desc > 100000000U) {
-			uint32_t ver_patch = (desc / 100) % 100;
-			uint32_t ver_rel = (desc / 10000) % 100;
-			uint32_t ver_min = (desc / 1000000) % 100;
-			uint32_t ver_maj = desc / 100000000;
 
 
-			if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
+		for (i = 0; i < __arraycount(pax); i++) {
+			if (((1 << i) & desc) == 0)
+				continue;
+			if (file_printf(ms, "%s%s", did++ ? "," : "",
+			    pax[i]) == -1)
 				return size;
 				return size;
-			if (ver_rel == 0 && ver_patch != 0) {
-				if (file_printf(ms, ".%u", ver_patch) == -1)
-					return size;
-			} else if (ver_rel != 0) {
-				while (ver_rel > 26) {
-					if (file_printf(ms, "Z") == -1)
-						return size;
-					ver_rel -= 26;
-				}
-				if (file_printf(ms, "%c", 'A' + ver_rel - 1)
-				    == -1)
-					return size;
-			}
 		}
 		}
-		*flags |= FLAGS_DID_NOTE;
-		return size;
 	}
 	}
 
 
-	if (namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0 &&
-	    xnh_type == NT_FREEBSD_VERSION && descsz == 4) {
-		uint32_t desc;
-		(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
-		desc = elf_getu32(swap, desc);
-		if (file_printf(ms, ", for FreeBSD") == -1)
-			return size;
-
-		/*
-		 * Contents is __FreeBSD_version, whose relation to OS
-		 * versions is defined by a huge table in the Porter's
-		 * Handbook.  This is the general scheme:
-		 * 
-		 * Releases:
-		 * 	Mmp000 (before 4.10)
-		 * 	Mmi0p0 (before 5.0)
-		 * 	Mmm0p0
-		 * 
-		 * Development branches:
-		 * 	Mmpxxx (before 4.6)
-		 * 	Mmp1xx (before 4.10)
-		 * 	Mmi1xx (before 5.0)
-		 * 	M000xx (pre-M.0)
-		 * 	Mmm1xx
-		 * 
-		 * M = major version
-		 * m = minor version
-		 * i = minor version increment (491000 -> 4.10)
-		 * p = patchlevel
-		 * x = revision
-		 * 
-		 * The first release of FreeBSD to use ELF by default
-		 * was version 3.0.
-		 */
-		if (desc == 460002) {
-			if (file_printf(ms, " 4.6.2") == -1)
+	if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0) {
+		switch (xnh_type) {
+		case NT_NETBSD_VERSION:
+			if (descsz == 4) {
+				do_note_netbsd_version(ms, swap, &nbuf[doff]);
+				*flags |= FLAGS_DID_NOTE;
 				return size;
 				return size;
-		} else if (desc < 460100) {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 10000 % 10) == -1)
+			}
+			break;
+		case NT_NETBSD_MARCH:
+			if (file_printf(ms, ", compiled for: %.*s", (int)descsz,
+			    (const char *)&nbuf[doff]) == -1)
 				return size;
 				return size;
-			if (desc / 1000 % 10 > 0)
-				if (file_printf(ms, ".%d", desc / 1000 % 10)
-				    == -1)
-					return size;
-			if ((desc % 1000 > 0) || (desc % 100000 == 0))
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-		} else if (desc < 500000) {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 10000 % 10 + desc / 1000 % 10) == -1)
+			break;
+		case NT_NETBSD_CMODEL:
+			if (file_printf(ms, ", compiler model: %.*s",
+			    (int)descsz, (const char *)&nbuf[doff]) == -1)
 				return size;
 				return size;
-			if (desc / 100 % 10 > 0) {
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-			} else if (desc / 10 % 10 > 0) {
-				if (file_printf(ms, ".%d", desc / 10 % 10)
-				    == -1)
-					return size;
-			}
-		} else {
-			if (file_printf(ms, " %d.%d", desc / 100000,
-			    desc / 1000 % 100) == -1)
+			break;
+		default:
+			if (file_printf(ms, ", note=%u", xnh_type) == -1)
 				return size;
 				return size;
-			if ((desc / 100 % 10 > 0) ||
-			    (desc % 100000 / 100 == 0)) {
-				if (file_printf(ms, " (%d)", desc) == -1)
-					return size;
-			} else if (desc / 10 % 10 > 0) {
-				if (file_printf(ms, ".%d", desc / 10 % 10)
-				    == -1)
-					return size;
-			}
+			break;
 		}
 		}
-		*flags |= FLAGS_DID_NOTE;
 		return size;
 		return size;
 	}
 	}
 
 
+	if (namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0) {
+	    	if (xnh_type == NT_FREEBSD_VERSION && descsz == 4) {
+			do_note_freebsd_version(ms, swap, &nbuf[doff]);
+			*flags |= FLAGS_DID_NOTE;
+			return size;
+		}
+	}
+
 	if (namesz == 8 && strcmp((char *)&nbuf[noff], "OpenBSD") == 0 &&
 	if (namesz == 8 && strcmp((char *)&nbuf[noff], "OpenBSD") == 0 &&
 	    xnh_type == NT_OPENBSD_VERSION && descsz == 4) {
 	    xnh_type == NT_OPENBSD_VERSION && descsz == 4) {
 		if (file_printf(ms, ", for OpenBSD") == -1)
 		if (file_printf(ms, ", for OpenBSD") == -1)
@@ -677,6 +737,7 @@ core:
 
 
 	default:
 	default:
 		if (xnh_type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
 		if (xnh_type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
+/*###709 [cc] warning: declaration of 'i' shadows previous non-variable%%%*/
 			size_t i, j;
 			size_t i, j;
 			unsigned char c;
 			unsigned char c;
 			/*
 			/*

+ 40 - 0
src/readelf.h

@@ -255,6 +255,46 @@ typedef struct {
  */
  */
 #define	NT_GNU_BUILD_ID		3
 #define	NT_GNU_BUILD_ID		3
 
 
+/*
+ * NetBSD-specific note type: PaX.
+ * There should be 1 NOTE per executable.
+ * name: PaX\0
+ * namesz: 4
+ * desc:
+ *	word[0]: capability bitmask
+ * descsz: 4
+ */
+#define NT_NETBSD_PAX		3
+#define NT_NETBSD_PAX_MPROTECT		0x01	/* Force enable Mprotect */
+#define NT_NETBSD_PAX_NOMPROTECT	0x02	/* Force disable Mprotect */
+#define NT_NETBSD_PAX_GUARD		0x04	/* Force enable Segvguard */
+#define NT_NETBSD_PAX_NOGUARD		0x08	/* Force disable Servguard */
+#define NT_NETBSD_PAX_ASLR		0x10	/* Force enable ASLR */
+#define NT_NETBSD_PAX_NOASLR		0x20	/* Force disable ASLR */
+
+/*
+ * NetBSD-specific note type: MACHINE_ARCH.
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * desc:	string
+ * descsz:	variable
+ */
+#define NT_NETBSD_MARCH		5
+
+/*
+ * NetBSD-specific note type: COMPILER MODEL.
+ * There should be 1 NOTE per executable.
+ * name:	NetBSD\0
+ * namesz:	7
+ * desc:	string
+ * descsz:	variable
+ */
+#define NT_NETBSD_CMODEL	6
+
+#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
+#define ELFSIZE ARCH_ELFSIZE
+#endif
 /* SunOS 5.x hardware/software capabilities */
 /* SunOS 5.x hardware/software capabilities */
 typedef struct {
 typedef struct {
 	Elf32_Word	c_tag;
 	Elf32_Word	c_tag;

+ 102 - 63
src/softmagic.c

@@ -32,14 +32,23 @@
 #include "file.h"
 #include "file.h"
 
 
 #ifndef	lint
 #ifndef	lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.165 2013/03/07 02:22:24 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.174 2014/02/12 23:20:53 christos Exp $")
 #endif	/* lint */
 #endif	/* lint */
 
 
 #include "magic.h"
 #include "magic.h"
+#ifdef HAVE_FMTCHECK
+#include <stdio.h>
+#define F(a, b) fmtcheck((a), (b))
+#else
+#define F(a, b) (a)
+#endif
 #include <string.h>
 #include <string.h>
 #include <ctype.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <time.h>
 #include <time.h>
+#if defined(HAVE_LOCALE_H)
+#include <locale.h>
+#endif
 
 
 
 
 private int match(struct magic_set *, struct magic *, uint32_t,
 private int match(struct magic_set *, struct magic *, uint32_t,
@@ -62,6 +71,7 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
 private void cvt_32(union VALUETYPE *, const struct magic *);
 private void cvt_32(union VALUETYPE *, const struct magic *);
 private void cvt_64(union VALUETYPE *, const struct magic *);
 private void cvt_64(union VALUETYPE *, const struct magic *);
 
 
+#define OFFSET_OOB(n, o, i)	((n) < (o) || (i) >= ((n) - (o)))
 /*
 /*
  * softmagic - lookup one file in parsed, in-memory copy of database
  * softmagic - lookup one file in parsed, in-memory copy of database
  * Passed the name and FILE * of one file to be typed.
  * Passed the name and FILE * of one file to be typed.
@@ -69,13 +79,13 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
 /*ARGSUSED1*/		/* nbytes passed for regularity, maybe need later */
 /*ARGSUSED1*/		/* nbytes passed for regularity, maybe need later */
 protected int
 protected int
 file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
 file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
-    int mode, int text)
+    size_t level, int mode, int text)
 {
 {
 	struct mlist *ml;
 	struct mlist *ml;
 	int rv, printed_something = 0, need_separator = 0;
 	int rv, printed_something = 0, need_separator = 0;
 	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
 	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
 		if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
 		if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
-		    text, 0, 0, &printed_something, &need_separator,
+		    text, 0, level, &printed_something, &need_separator,
 		    NULL)) != 0)
 		    NULL)) != 0)
 			return rv;
 			return rv;
 
 
@@ -185,6 +195,8 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 		}
 		}
 
 
 		if ((e = handle_annotation(ms, m)) != 0) {
 		if ((e = handle_annotation(ms, m)) != 0) {
+			*need_separator = 1;
+			*printed_something = 1;
 			*returnval = 1;
 			*returnval = 1;
 			return e;
 			return e;
 		}
 		}
@@ -265,13 +277,16 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
 #ifdef ENABLE_CONDITIONALS
 #ifdef ENABLE_CONDITIONALS
 				ms->c.li[cont_level].last_match = 1;
 				ms->c.li[cont_level].last_match = 1;
 #endif
 #endif
-				if (m->type != FILE_DEFAULT)
-					ms->c.li[cont_level].got_match = 1;
-				else if (ms->c.li[cont_level].got_match) {
+				if (m->type == FILE_CLEAR)
 					ms->c.li[cont_level].got_match = 0;
 					ms->c.li[cont_level].got_match = 0;
-					break;
-				}
+				else if (ms->c.li[cont_level].got_match) {
+					if (m->type == FILE_DEFAULT)
+						break;
+				} else
+					ms->c.li[cont_level].got_match = 1;
 				if ((e = handle_annotation(ms, m)) != 0) {
 				if ((e = handle_annotation(ms, m)) != 0) {
+					*need_separator = 1;
+					*printed_something = 1;
 					*returnval = 1;
 					*returnval = 1;
 					return e;
 					return e;
 				}
 				}
@@ -336,22 +351,24 @@ private int
 check_fmt(struct magic_set *ms, struct magic *m)
 check_fmt(struct magic_set *ms, struct magic *m)
 {
 {
 	regex_t rx;
 	regex_t rx;
-	int rc;
+	int rc, rv = -1;
 
 
 	if (strchr(m->desc, '%') == NULL)
 	if (strchr(m->desc, '%') == NULL)
 		return 0;
 		return 0;
 
 
+	(void)setlocale(LC_CTYPE, "C");
 	rc = regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
 	rc = regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
 	if (rc) {
 	if (rc) {
 		char errmsg[512];
 		char errmsg[512];
 		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
 		(void)regerror(rc, &rx, errmsg, sizeof(errmsg));
 		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
 		file_magerror(ms, "regex error %d, (%s)", rc, errmsg);
-		return -1;
 	} else {
 	} else {
 		rc = regexec(&rx, m->desc, 0, 0, 0);
 		rc = regexec(&rx, m->desc, 0, 0, 0);
 		regfree(&rx);
 		regfree(&rx);
-		return !rc;
+		rv = !rc;
 	}
 	}
+	(void)setlocale(LC_CTYPE, "");
+	return rv;
 }
 }
 
 
 #ifndef HAVE_STRNDUP
 #ifndef HAVE_STRNDUP
@@ -392,11 +409,12 @@ mprint(struct magic_set *ms, struct magic *m)
 		case 1:
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%c",
 			(void)snprintf(buf, sizeof(buf), "%c",
 			    (unsigned char)v);
 			    (unsigned char)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		default:
 		default:
-			if (file_printf(ms, m->desc, (unsigned char) v) == -1)
+			if (file_printf(ms, F(m->desc, "%c"),
+			    (unsigned char) v) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		}
 		}
@@ -413,12 +431,12 @@ mprint(struct magic_set *ms, struct magic *m)
 		case 1:
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%hu",
 			(void)snprintf(buf, sizeof(buf), "%hu",
 			    (unsigned short)v);
 			    (unsigned short)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		default:
 		default:
-			if (
-			    file_printf(ms, m->desc, (unsigned short) v) == -1)
+			if (file_printf(ms, F(m->desc, "%hu"),
+			    (unsigned short) v) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		}
 		}
@@ -435,11 +453,12 @@ mprint(struct magic_set *ms, struct magic *m)
 			return -1;
 			return -1;
 		case 1:
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%u", (uint32_t)v);
 			(void)snprintf(buf, sizeof(buf), "%u", (uint32_t)v);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		default:
 		default:
-			if (file_printf(ms, m->desc, (uint32_t) v) == -1)
+			if (file_printf(ms, F(m->desc, "%u"),
+			    (uint32_t) v) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		}
 		}
@@ -450,8 +469,21 @@ mprint(struct magic_set *ms, struct magic *m)
   	case FILE_BEQUAD:
   	case FILE_BEQUAD:
   	case FILE_LEQUAD:
   	case FILE_LEQUAD:
 		v = file_signextend(ms, m, p->q);
 		v = file_signextend(ms, m, p->q);
-		if (file_printf(ms, m->desc, (uint64_t) v) == -1)
+		switch (check_fmt(ms, m)) {
+		case -1:
 			return -1;
 			return -1;
+		case 1:
+			(void)snprintf(buf, sizeof(buf), "%llu",
+			    (unsigned long long)v);
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
+				return -1;
+			break;
+		default:
+			if (file_printf(ms, F(m->desc, "%llu"),
+			    (unsigned long long) v) == -1)
+				return -1;
+			break;
+		}
 		t = ms->offset + sizeof(int64_t);
 		t = ms->offset + sizeof(int64_t);
   		break;
   		break;
 
 
@@ -460,7 +492,7 @@ mprint(struct magic_set *ms, struct magic *m)
   	case FILE_BESTRING16:
   	case FILE_BESTRING16:
   	case FILE_LESTRING16:
   	case FILE_LESTRING16:
 		if (m->reln == '=' || m->reln == '!') {
 		if (m->reln == '=' || m->reln == '!') {
-			if (file_printf(ms, m->desc, m->value.s) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), m->value.s) == -1)
 				return -1;
 				return -1;
 			t = ms->offset + m->vallen;
 			t = ms->offset + m->vallen;
 		}
 		}
@@ -486,7 +518,7 @@ mprint(struct magic_set *ms, struct magic *m)
 				*++last = '\0';
 				*++last = '\0';
 			}
 			}
 
 
-			if (file_printf(ms, m->desc, str) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), str) == -1)
 				return -1;
 				return -1;
 
 
 			if (m->type == FILE_PSTRING)
 			if (m->type == FILE_PSTRING)
@@ -498,7 +530,8 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_BEDATE:
 	case FILE_BEDATE:
 	case FILE_LEDATE:
 	case FILE_LEDATE:
 	case FILE_MEDATE:
 	case FILE_MEDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->l, FILE_T_LOCAL,
+		if (file_printf(ms, F(m->desc, "%s"),
+		    file_fmttime(p->l, FILE_T_LOCAL,
 		    tbuf)) == -1)
 		    tbuf)) == -1)
 			return -1;
 			return -1;
 		t = ms->offset + sizeof(uint32_t);
 		t = ms->offset + sizeof(uint32_t);
@@ -508,7 +541,8 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_BELDATE:
 	case FILE_BELDATE:
 	case FILE_LELDATE:
 	case FILE_LELDATE:
 	case FILE_MELDATE:
 	case FILE_MELDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->l, 0, tbuf)) == -1)
+		if (file_printf(ms, F(m->desc, "%s"),
+		    file_fmttime(p->l, 0, tbuf)) == -1)
 			return -1;
 			return -1;
 		t = ms->offset + sizeof(uint32_t);
 		t = ms->offset + sizeof(uint32_t);
 		break;
 		break;
@@ -516,8 +550,8 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_QDATE:
 	case FILE_QDATE:
 	case FILE_BEQDATE:
 	case FILE_BEQDATE:
 	case FILE_LEQDATE:
 	case FILE_LEQDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->q, FILE_T_LOCAL,
-		    tbuf)) == -1)
+		if (file_printf(ms, F(m->desc, "%s"),
+		    file_fmttime(p->q, FILE_T_LOCAL, tbuf)) == -1)
 			return -1;
 			return -1;
 		t = ms->offset + sizeof(uint64_t);
 		t = ms->offset + sizeof(uint64_t);
 		break;
 		break;
@@ -525,7 +559,8 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_QLDATE:
 	case FILE_QLDATE:
 	case FILE_BEQLDATE:
 	case FILE_BEQLDATE:
 	case FILE_LEQLDATE:
 	case FILE_LEQLDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->q, 0, tbuf)) == -1)
+		if (file_printf(ms, F(m->desc, "%s"),
+		    file_fmttime(p->q, 0, tbuf)) == -1)
 			return -1;
 			return -1;
 		t = ms->offset + sizeof(uint64_t);
 		t = ms->offset + sizeof(uint64_t);
 		break;
 		break;
@@ -533,8 +568,8 @@ mprint(struct magic_set *ms, struct magic *m)
 	case FILE_QWDATE:
 	case FILE_QWDATE:
 	case FILE_BEQWDATE:
 	case FILE_BEQWDATE:
 	case FILE_LEQWDATE:
 	case FILE_LEQWDATE:
-		if (file_printf(ms, m->desc, file_fmttime(p->q, FILE_T_WINDOWS,
-		    tbuf)) == -1)
+		if (file_printf(ms, F(m->desc, "%s"),
+		    file_fmttime(p->q, FILE_T_WINDOWS, tbuf)) == -1)
 			return -1;
 			return -1;
 		t = ms->offset + sizeof(uint64_t);
 		t = ms->offset + sizeof(uint64_t);
 		break;
 		break;
@@ -548,11 +583,11 @@ mprint(struct magic_set *ms, struct magic *m)
 			return -1;
 			return -1;
 		case 1:
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%g", vf);
 			(void)snprintf(buf, sizeof(buf), "%g", vf);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		default:
 		default:
-			if (file_printf(ms, m->desc, vf) == -1)
+			if (file_printf(ms, F(m->desc, "%g"), vf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		}
 		}
@@ -568,11 +603,11 @@ mprint(struct magic_set *ms, struct magic *m)
 			return -1;
 			return -1;
 		case 1:
 		case 1:
 			(void)snprintf(buf, sizeof(buf), "%g", vd);
 			(void)snprintf(buf, sizeof(buf), "%g", vd);
-			if (file_printf(ms, m->desc, buf) == -1)
+			if (file_printf(ms, F(m->desc, "%s"), buf) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		default:
 		default:
-			if (file_printf(ms, m->desc, vd) == -1)
+			if (file_printf(ms, F(m->desc, "%g"), vd) == -1)
 				return -1;
 				return -1;
 			break;
 			break;
 		}
 		}
@@ -588,7 +623,7 @@ mprint(struct magic_set *ms, struct magic *m)
 			file_oomem(ms, ms->search.rm_len);
 			file_oomem(ms, ms->search.rm_len);
 			return -1;
 			return -1;
 		}
 		}
-		rval = file_printf(ms, m->desc, cp);
+		rval = file_printf(ms, F(m->desc, "%s"), cp);
 		free(cp);
 		free(cp);
 
 
 		if (rval == -1)
 		if (rval == -1)
@@ -602,7 +637,7 @@ mprint(struct magic_set *ms, struct magic *m)
 	}
 	}
 
 
 	case FILE_SEARCH:
 	case FILE_SEARCH:
-	  	if (file_printf(ms, m->desc, m->value.s) == -1)
+	  	if (file_printf(ms, F(m->desc, "%s"), m->value.s) == -1)
 			return -1;
 			return -1;
 		if ((m->str_flags & REGEX_OFFSET_START))
 		if ((m->str_flags & REGEX_OFFSET_START))
 			t = ms->search.offset;
 			t = ms->search.offset;
@@ -611,7 +646,8 @@ mprint(struct magic_set *ms, struct magic *m)
 		break;
 		break;
 
 
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
-	  	if (file_printf(ms, m->desc, m->value.s) == -1)
+	case FILE_CLEAR:
+	  	if (file_printf(ms, "%s", m->desc) == -1)
 			return -1;
 			return -1;
 		t = ms->offset;
 		t = ms->offset;
 		break;
 		break;
@@ -715,9 +751,8 @@ moffset(struct magic_set *ms, struct magic *m)
 		else
 		else
 			return CAST(int32_t, (ms->search.offset + m->vallen));
 			return CAST(int32_t, (ms->search.offset + m->vallen));
 
 
+	case FILE_CLEAR:
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
-		return ms->offset;
-
 	case FILE_INDIRECT:
 	case FILE_INDIRECT:
 		return ms->offset;
 		return ms->offset;
 
 
@@ -989,6 +1024,7 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
 	case FILE_REGEX:
 	case FILE_REGEX:
 	case FILE_SEARCH:
 	case FILE_SEARCH:
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
+	case FILE_CLEAR:
 	case FILE_NAME:
 	case FILE_NAME:
 	case FILE_USE:
 	case FILE_USE:
 		return 1;
 		return 1;
@@ -1070,11 +1106,8 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 				src++;
 				src++;
 
 
 			/* check that offset is within range */
 			/* check that offset is within range */
-			if (offset >= nbytes) {
-				file_magerror(ms, "invalid offset %u in mcopy()",
-				    offset);
-				return -1;
-			}
+			if (offset >= nbytes)
+				break;
 			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
 			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
 				if (dst < edst)
 				if (dst < edst)
 					*dst = *src;
 					*dst = *src;
@@ -1126,7 +1159,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 {
 {
 	uint32_t soffset, offset = ms->offset;
 	uint32_t soffset, offset = ms->offset;
 	uint32_t count = m->str_range;
 	uint32_t count = m->str_range;
-	int rv, oneed_separator;
+	int rv, oneed_separator, in_type;
 	char *sbuf, *rbuf;
 	char *sbuf, *rbuf;
 	union VALUETYPE *p = &ms->ms_value;
 	union VALUETYPE *p = &ms->ms_value;
 	struct mlist ml;
 	struct mlist ml;
@@ -1189,9 +1222,9 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 			if ((ms->flags & MAGIC_DEBUG) != 0)
 				fprintf(stderr, "indirect offs=%u\n", off);
 				fprintf(stderr, "indirect offs=%u\n", off);
 		}
 		}
-		switch (cvt_flip(m->in_type, flip)) {
+		switch (in_type = cvt_flip(m->in_type, flip)) {
 		case FILE_BYTE:
 		case FILE_BYTE:
-			if (nbytes < (offset + 1))
+			if (OFFSET_OOB(nbytes, offset, 1))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1226,7 +1259,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
 		case FILE_BESHORT:
 		case FILE_BESHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1278,7 +1311,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
 		case FILE_LESHORT:
 		case FILE_LESHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1330,7 +1363,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
 		case FILE_SHORT:
 		case FILE_SHORT:
-			if (nbytes < (offset + 2))
+			if (OFFSET_OOB(nbytes, offset, 2))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1367,7 +1400,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 			break;
 			break;
 		case FILE_BELONG:
 		case FILE_BELONG:
 		case FILE_BEID3:
 		case FILE_BEID3:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1438,7 +1471,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 			break;
 			break;
 		case FILE_LELONG:
 		case FILE_LELONG:
 		case FILE_LEID3:
 		case FILE_LEID3:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1508,7 +1541,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
 		case FILE_MELONG:
 		case FILE_MELONG:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1578,7 +1611,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
 		case FILE_LONG:
 		case FILE_LONG:
-			if (nbytes < (offset + 4))
+			if (OFFSET_OOB(nbytes, offset, 4))
 				return 0;
 				return 0;
 			if (off) {
 			if (off) {
 				switch (m->in_op & FILE_OPS_MASK) {
 				switch (m->in_op & FILE_OPS_MASK) {
@@ -1612,9 +1645,11 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 			if (m->in_op & FILE_OPINVERSE)
 			if (m->in_op & FILE_OPINVERSE)
 				offset = ~offset;
 				offset = ~offset;
 			break;
 			break;
+		default:
+			break;
 		}
 		}
 
 
-		switch (cvt_flip(m->in_type, flip)) {
+		switch (in_type) {
 		case FILE_LEID3:
 		case FILE_LEID3:
 		case FILE_BEID3:
 		case FILE_BEID3:
 			offset = ((((offset >>  0) & 0x7f) <<  0) |
 			offset = ((((offset >>  0) & 0x7f) <<  0) |
@@ -1653,14 +1688,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 	/* Verify we have enough data to match magic type */
 	/* Verify we have enough data to match magic type */
 	switch (m->type) {
 	switch (m->type) {
 	case FILE_BYTE:
 	case FILE_BYTE:
-		if (nbytes < (offset + 1)) /* should alway be true */
+		if (OFFSET_OOB(nbytes, offset, 1))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
 	case FILE_SHORT:
 	case FILE_SHORT:
 	case FILE_BESHORT:
 	case FILE_BESHORT:
 	case FILE_LESHORT:
 	case FILE_LESHORT:
-		if (nbytes < (offset + 2))
+		if (OFFSET_OOB(nbytes, offset, 2))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
@@ -1679,38 +1714,40 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 	case FILE_FLOAT:
 	case FILE_FLOAT:
 	case FILE_BEFLOAT:
 	case FILE_BEFLOAT:
 	case FILE_LEFLOAT:
 	case FILE_LEFLOAT:
-		if (nbytes < (offset + 4))
+		if (OFFSET_OOB(nbytes, offset, 4))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
 	case FILE_DOUBLE:
 	case FILE_DOUBLE:
 	case FILE_BEDOUBLE:
 	case FILE_BEDOUBLE:
 	case FILE_LEDOUBLE:
 	case FILE_LEDOUBLE:
-		if (nbytes < (offset + 8))
+		if (OFFSET_OOB(nbytes, offset, 8))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
 	case FILE_STRING:
 	case FILE_STRING:
 	case FILE_PSTRING:
 	case FILE_PSTRING:
 	case FILE_SEARCH:
 	case FILE_SEARCH:
-		if (nbytes < (offset + m->vallen))
+		if (OFFSET_OOB(nbytes, offset, m->vallen))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
 	case FILE_REGEX:
 	case FILE_REGEX:
-		if (nbytes < offset)
+		if (OFFSET_OOB(nbytes, offset, 0))
 			return 0;
 			return 0;
 		break;
 		break;
 
 
 	case FILE_INDIRECT:
 	case FILE_INDIRECT:
-		if (nbytes < offset)
+		if (offset == 0)
+			return 0;
+		if (OFFSET_OOB(nbytes, offset, 0))
 			return 0;
 			return 0;
 		sbuf = ms->o.buf;
 		sbuf = ms->o.buf;
 		soffset = ms->offset;
 		soffset = ms->offset;
 		ms->o.buf = NULL;
 		ms->o.buf = NULL;
 		ms->offset = 0;
 		ms->offset = 0;
 		rv = file_softmagic(ms, s + offset, nbytes - offset,
 		rv = file_softmagic(ms, s + offset, nbytes - offset,
-		    BINTEST, text);
+		    recursion_level, BINTEST, text);
 		if ((ms->flags & MAGIC_DEBUG) != 0)
 		if ((ms->flags & MAGIC_DEBUG) != 0)
 			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 		rbuf = ms->o.buf;
 		rbuf = ms->o.buf;
@@ -1718,7 +1755,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 		ms->offset = soffset;
 		ms->offset = soffset;
 		if (rv == 1) {
 		if (rv == 1) {
 			if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
 			if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
-			    file_printf(ms, m->desc, offset) == -1)
+			    file_printf(ms, F(m->desc, "%u"), offset) == -1)
 				return -1;
 				return -1;
 			if (file_printf(ms, "%s", rbuf) == -1)
 			if (file_printf(ms, "%s", rbuf) == -1)
 				return -1;
 				return -1;
@@ -1727,7 +1764,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 		return rv;
 		return rv;
 
 
 	case FILE_USE:
 	case FILE_USE:
-		if (nbytes < offset)
+		if (OFFSET_OOB(nbytes, offset, 0))
 			return 0;
 			return 0;
 		sbuf = m->value.s;
 		sbuf = m->value.s;
 		if (*sbuf == '^') {
 		if (*sbuf == '^') {
@@ -1754,6 +1791,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
 			return -1;
 			return -1;
 		return 1;
 		return 1;
 	case FILE_DEFAULT:	/* nothing to check */
 	case FILE_DEFAULT:	/* nothing to check */
+	case FILE_CLEAR:
 	default:
 	default:
 		break;
 		break;
 	}
 	}
@@ -1956,6 +1994,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
 		return matched;
 		return matched;
 
 
 	case FILE_DEFAULT:
 	case FILE_DEFAULT:
+	case FILE_CLEAR:
 		l = 0;
 		l = 0;
 		v = 0;
 		v = 0;
 		break;
 		break;

+ 82 - 0
src/strcasestr.c

@@ -0,0 +1,82 @@
+/*	$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
+__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <ctype.h>
+#include <string.h>
+
+static int
+_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+	if (n != 0) {
+		const unsigned char *us1 = (const unsigned char *)s1,
+				*us2 = (const unsigned char *)s2;
+
+		do {
+			if (tolower(*us1) != tolower(*us2++))
+				return tolower(*us1) - tolower(*--us2);
+			if (*us1++ == '\0')
+				break;
+		} while (--n != 0);
+	}
+	return 0;
+}
+
+/*
+ * Find the first occurrence of find in s, ignore case.
+ */
+char *
+strcasestr(const char *s, const char *find)
+{
+	char c, sc;
+	size_t len;
+
+	if ((c = *find++) != 0) {
+		c = tolower((unsigned char)c);
+		len = strlen(find);
+		do {
+			do {
+				if ((sc = *s++) == 0)
+					return (NULL);
+			} while ((char)tolower((unsigned char)sc) != c);
+		} while (_strncasecmp(s, find, len) != 0);
+		s--;
+	}
+	return (char *)(intptr_t)(s);
+}

+ 7 - 2
tests/Makefile.am

@@ -3,9 +3,14 @@ test_LDADD = $(top_builddir)/src/libmagic.la
 test_CPPFLAGS = -I$(top_srcdir)/src
 test_CPPFLAGS = -I$(top_srcdir)/src
 
 
 EXTRA_DIST = \
 EXTRA_DIST = \
-	gedcom.magic gedcom.testfile gedcom.result
+escapevel.result \
+escapevel.testfile \
+gedcom.result \
+gedcom.testfile \
+issue311docx.result \
+issue311docx.testfile
 
 
 T = $(top_srcdir)/tests
 T = $(top_srcdir)/tests
 check-local:
 check-local:
 	MAGIC=$(top_builddir)/magic/magic ./test
 	MAGIC=$(top_builddir)/magic/magic ./test
-	for i in $T/*.testfile; do MAGIC=$T/$${i%%.testfile}.magic $(top_builddir)/tests/test $T/$$i $T/$${i%%.testfile}.result; done
+	for i in $T/*.testfile; do MAGIC=$(top_builddir)/magic/magic ./test $T/$$i $T/$${i%%.testfile}.result; done

+ 93 - 54
tests/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.12.4 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
 # @configure_input@
 # @configure_input@
 
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 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,
@@ -14,23 +14,51 @@
 
 
 @SET_MAKE@
 @SET_MAKE@
 VPATH = @srcdir@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
     esac; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgincludedir = $(includedir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
 pkglibexecdir = $(libexecdir)/@PACKAGE@
@@ -50,8 +78,8 @@ build_triplet = @build@
 host_triplet = @host@
 host_triplet = @host@
 check_PROGRAMS = test$(EXEEXT)
 check_PROGRAMS = test$(EXEEXT)
 subdir = tests
 subdir = tests
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(top_srcdir)/depcomp
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/depcomp README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -111,6 +139,23 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
   esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 ETAGS = etags
 CTAGS = ctags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -132,6 +177,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_C = @ECHO_C@
@@ -156,6 +202,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
 MINGW = @MINGW@
 MKDIR_P = @MKDIR_P@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NM = @NM@
@@ -183,6 +230,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__include = @am__include@
@@ -216,7 +264,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 oldincludedir = @oldincludedir@
@@ -235,7 +282,12 @@ top_srcdir = @top_srcdir@
 test_LDADD = $(top_builddir)/src/libmagic.la
 test_LDADD = $(top_builddir)/src/libmagic.la
 test_CPPFLAGS = -I$(top_srcdir)/src
 test_CPPFLAGS = -I$(top_srcdir)/src
 EXTRA_DIST = \
 EXTRA_DIST = \
-	gedcom.magic gedcom.testfile gedcom.result
+escapevel.result \
+escapevel.testfile \
+gedcom.result \
+gedcom.testfile \
+issue311docx.result \
+issue311docx.testfile
 
 
 T = $(top_srcdir)/tests
 T = $(top_srcdir)/tests
 all: all-am
 all: all-am
@@ -281,6 +333,7 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	echo " rm -f" $$list; \
 	rm -f $$list
 	rm -f $$list
+
 test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) 
 test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) 
 	@rm -f test$(EXEEXT)
 	@rm -f test$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
 	$(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
@@ -337,26 +390,15 @@ mostlyclean-libtool:
 clean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 	-rm -rf .libs _libs
 
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	set x; \
 	here=`pwd`; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -368,15 +410,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	      $$unique; \
 	  fi; \
 	  fi; \
 	fi
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
 	     $$unique
@@ -385,9 +423,10 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
 
 
-cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
-	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
 	case "$(srcdir)" in \
 	case "$(srcdir)" in \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
 	  *) sdir=$(subdir)/$(srcdir) ;; \
@@ -542,9 +581,9 @@ uninstall-am:
 
 
 .MAKE: check-am install-am install-strip
 .MAKE: check-am install-am install-strip
 
 
-.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
-	clean-checkPROGRAMS clean-generic clean-libtool cscopelist \
-	ctags distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+	ctags ctags-am 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-data \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
 	install-data-am install-dvi install-dvi-am install-exec \
@@ -554,11 +593,11 @@ uninstall-am:
 	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
+	tags tags-am uninstall uninstall-am
 
 
 check-local:
 check-local:
 	MAGIC=$(top_builddir)/magic/magic ./test
 	MAGIC=$(top_builddir)/magic/magic ./test
-	for i in $T/*.testfile; do MAGIC=$T/$${i%%.testfile}.magic $(top_builddir)/tests/test $T/$$i $T/$${i%%.testfile}.result; done
+	for i in $T/*.testfile; do MAGIC=$(top_builddir)/magic/magic ./test $T/$$i $T/$${i%%.testfile}.result; done
 
 
 # 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.

+ 4 - 7
tests/README

@@ -3,15 +3,12 @@ file tests
 
 
 This directory contains tests for file. It is highly encouraged to add
 This directory contains tests for file. It is highly encouraged to add
 one each time a bug is found, and each time new magic is added. Each
 one each time a bug is found, and each time new magic is added. Each
-test consists of three files:
+test consists of two files:
 
 
-  TEST.magic
   TEST.testfile
   TEST.testfile
   TEST.result
   TEST.result
 
 
-where TEST is the base name of the test, TEST.magic contains the magic
-used, TEST.testfile is the input, and TEST.result is the desired
-output from file.
+where TEST is the base name of the test, TEST.testfile is the input,
+and TEST.result is the desired output from file.
 
 
-It suffices to add a triplet of test files to the directory to have
-them included in "make check".
+To add a new test just add the test files to the directory.

+ 1 - 0
tests/escapevel.result

@@ -0,0 +1 @@
+Zip data (MIME type "application/vnd.nz.gen.geek_central.ti5x"?)

BIN
tests/escapevel.testfile


+ 0 - 6
tests/gedcom.magic

@@ -1,6 +0,0 @@
-# GEDCOM Genealogy file
-
-0       string/c        0\ HEAD         GEDCOM genealogy data
->&0     search          1\ GEDC
->>&0    search          2\ VERS         version
->>>&1   string          >\0             %s

+ 1 - 1
tests/gedcom.result

@@ -1 +1 @@
-GEDCOM genealogy data version 5.5
+GEDCOM genealogy text version 5.5, ASCII text

+ 1 - 0
tests/issue311docx.result

@@ -0,0 +1 @@
+Microsoft Word 2007+

BIN
tests/issue311docx.testfile