Browse Source

Merge upstream version 5.13

Luk Claes 11 years ago
parent
commit
ab6b954578
100 changed files with 5450 additions and 2790 deletions
  1. 67 0
      ChangeLog
  2. 8 5
      Makefile.in
  3. 11 8
      README
  4. 13 3
      TODO
  5. 1 12
      aclocal.m4
  6. 94 47
      config.h.in
  7. 1729 1098
      configure
  8. 23 42
      configure.ac
  9. 6 3
      doc/Makefile.in
  10. 46 12
      doc/file.man
  11. 20 3
      doc/libmagic.man
  12. 132 16
      doc/magic.man
  13. 77 0
      m4/visibility.m4
  14. 9 5
      magic/Magdir/adventure
  15. 4 1
      magic/Magdir/amigaos
  16. 5 9
      magic/Magdir/animation
  17. 46 0
      magic/Magdir/aout
  18. 47 1
      magic/Magdir/apple
  19. 95 80
      magic/Magdir/archive
  20. 10 6
      magic/Magdir/assembler
  21. 3 2
      magic/Magdir/audio
  22. 3 13
      magic/Magdir/bsdi
  23. 6 6
      magic/Magdir/c-lang
  24. 50 12
      magic/Magdir/cafebabe
  25. 5 5
      magic/Magdir/claris
  26. 5 2
      magic/Magdir/commands
  27. 3 3
      magic/Magdir/console
  28. 1 3
      magic/Magdir/convex
  29. 8 0
      magic/Magdir/cubemap
  30. 19 45
      magic/Magdir/cups
  31. 7 10
      magic/Magdir/database
  32. 13 2
      magic/Magdir/diff
  33. 15 15
      magic/Magdir/digital
  34. 2 1
      magic/Magdir/dolby
  35. 34 72
      magic/Magdir/dump
  36. 159 237
      magic/Magdir/elf
  37. 10 1
      magic/Magdir/epoc
  38. 615 207
      magic/Magdir/filesystems
  39. 10 2
      magic/Magdir/fonts
  40. 2 1
      magic/Magdir/fortran
  41. 13 1
      magic/Magdir/geo
  42. 59 0
      magic/Magdir/gnome
  43. 0 26
      magic/Magdir/gnome-keyring
  44. 16 1
      magic/Magdir/gnu
  45. 241 0
      magic/Magdir/gpt
  46. 4 1
      magic/Magdir/hitachi-sh
  47. 9 1
      magic/Magdir/ibm6000
  48. 51 0
      magic/Magdir/icc
  49. 117 23
      magic/Magdir/images
  50. 2 2
      magic/Magdir/intel
  51. 11 1
      magic/Magdir/java
  52. 17 0
      magic/Magdir/javascript
  53. 16 3
      magic/Magdir/jpeg
  54. 20 0
      magic/Magdir/keepass
  55. 12 6
      magic/Magdir/linux
  56. 11 3
      magic/Magdir/llvm
  57. 2 1
      magic/Magdir/lua
  58. 191 69
      magic/Magdir/mach
  59. 7 0
      magic/Magdir/macos
  60. 4 3
      magic/Magdir/mail.news
  61. 2 2
      magic/Magdir/maple
  62. 5 11
      magic/Magdir/matroska
  63. 3 65
      magic/Magdir/mips
  64. 1 11
      magic/Magdir/misctools
  65. 42 3
      magic/Magdir/msdos
  66. 6 4
      magic/Magdir/msooxml
  67. 2 2
      magic/Magdir/natinst
  68. 4 6
      magic/Magdir/netbsd
  69. 6 3
      magic/Magdir/perl
  70. 14 0
      magic/Magdir/pwsafe
  71. 6 1
      magic/Magdir/python
  72. 2 2
      magic/Magdir/revision
  73. 3 3
      magic/Magdir/riff
  74. 10 17
      magic/Magdir/rpm
  75. 69 2
      magic/Magdir/sgi
  76. 15 3
      magic/Magdir/sgml
  77. 60 104
      magic/Magdir/sniffer
  78. 23 4
      magic/Magdir/sql
  79. 37 30
      magic/Magdir/sun
  80. 23 24
      magic/Magdir/unknown
  81. 16 0
      magic/Magdir/uterus
  82. 5 13
      magic/Magdir/vax
  83. 46 3
      magic/Magdir/windows
  84. 6 2
      magic/Magdir/wordprocessors
  85. 2 2
      magic/Magdir/wsdl
  86. 4 1
      magic/Magdir/xilinx
  87. 2 2
      magic/Magdir/xwindows
  88. 11 2
      magic/Makefile.am
  89. 17 5
      magic/Makefile.in
  90. 6 3
      python/Makefile.in
  91. 8 1
      src/Makefile.am
  92. 40 18
      src/Makefile.in
  93. 686 276
      src/apprentice.c
  94. 2 2
      src/ascmagic.c
  95. 19 0
      src/asctime_r.c
  96. 5 6
      src/cdf.c
  97. 1 1
      src/cdf.h
  98. 8 9
      src/cdf_time.c
  99. 17 16
      src/compress.c
  100. 0 0
      src/ctime_r.c

+ 67 - 0
ChangeLog

@@ -1,3 +1,70 @@
+2013-02-18  10:39  Christos Zoulas <christos@zoulas.com>
+
+	* add elf reading of debug info to determine if file is stripped
+	  (Jan Kaluza)
+	* use pread()
+
+2013-01-25  18:05  Christos Zoulas <christos@zoulas.com>
+
+	* change mime description size from 64 to 80 to accommodate OOXML.
+
+2013-01-11  14:50  Christos Zoulas <christos@zoulas.com>
+
+	* Warn about inconsistent continuation levels.
+	* Change fsmagic to add a space after it prints.
+
+2013-01-10  21:00  Christos Zoulas <christos@zoulas.com>
+
+	* Make getline public so that file can link against it.
+	  Perhaps it is better to rename it, or hide it differently.
+	  Fixes builds on platforms that do not provide it.
+	  
+2013-01-07  16:30  Christos Zoulas <christos@zoulas.com>
+
+	* Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document
+	  what long, int, short, etc is (Guy Harris)
+
+2013-01-06  11:20  Christos Zoulas <christos@zoulas.com>
+
+	* add magic_version function and constant
+	* Redo memory allocation and de-allocation.
+	  (prevents double frees on non mmap platforms)
+	* Fix bug with name/use having to do with passing
+	  found state from the parent to the child and back.
+
+2012-12-19   8:47  Christos Zoulas <christos@zoulas.com>
+
+	* Only print elf capabilities for archs we know (Jan Kaluza)
+
+2012-10-30  19:14  Christos Zoulas <christos@zoulas.com>
+
+	* Add "name" and "use" file types in order to look
+	  inside mach-o files.
+
+2012-09-06  10:40  Christos Zoulas <christos@zoulas.com>
+
+	* make --version exit 0 (Matthew Schultz)
+	* add string/T (Jan Kaluza)
+
+2012-08-09  2:15  Christos Zoulas <christos@zoulas.com>
+
+	* add z and t modifiers for our own vasprintf
+	* search for $HOME/.magic.mgc if it is there first
+	* fix reads from a pipe, and preserve errno
+
+2012-05-15  13:12  Christos Zoulas <christos@zoulas.com>
+
+	* use ctime_r, asctime_r
+
+2012-04-06  17:18  Christos Zoulas <christos@zoulas.com>
+
+	* Fixes for indirect offsets to handle apple disk formats
+
+2012-04-03  18:26  Christos Zoulas <christos@zoulas.com>
+
+	* Add windows date field types
+	* More info for windows shortcuts (incomplete)
+
 2012-02-20  17:33  Christos Zoulas <christos@zoulas.com>
 
 	* Fix CDF parsing issues found by CERT's fuzzing tool (Will Dormann)

+ 8 - 5
Makefile.in

@@ -42,7 +42,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -122,6 +123,7 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -136,6 +138,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -239,15 +242,15 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
-	      $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
 		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu Makefile
+	  $(AUTOMAKE) --foreign Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

+ 11 - 8
README

@@ -1,5 +1,5 @@
 ** README for file(1) Command **
-@(#) $File: README,v 1.44 2011/03/24 13:03:39 rrt Exp $
+@(#) $File: README,v 1.45 2013/01/11 16:51:01 christos Exp $
 
 Mailing List: file@mx.gw.com
 Bug tracker: http://bugs.gw.com/
@@ -68,15 +68,19 @@ src/apprentice.c - parses /etc/magic to learn magic
 src/apptype.c - used for OS/2 specific application type magic
 src/asprintf.c - replacement for OS's that don't have it.
 src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
+src/asctime_r.c - for systems that don't have it.
+src/asprintf.c - for systems that don't have it.
 src/cdf.c - parser for Microsoft Compound Document Files
 src/cdf_time.c - time converter for CDF.
 src/compress.c - handles decompressing files to look inside.
+src/ctime_r.c - for systems that don't have it.
 src/encoding.c - handles unicode encodings
 src/file.c - the main program
 src/file.h - header file
 src/fsmagic.c - first set of tests the program runs, based on filesystem info
 src/funcs.c - utilility functions
-src/getopt_long.c - used for OS/2 specific application type magic
+src/getopt_long.c - for systems that don't have it.
+src/getline.c - for systems that don't have it.
 src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
 src/names.h - header file for ascmagic.c
 src/magic.c - the libmagic api
@@ -84,14 +88,13 @@ src/print.c - print results, errors, warnings.
 src/readcdf.c - CDF wrapper.
 src/readelf.[ch] - Stand-alone elf parsing code.
 src/softmagic.c - 2nd set of tests, based on /etc/magic
-src/strlcat.c - used for OS/2 specific application type magic
-src/strlcpy.c - used for OS/2 specific application type magic
-src/vasprintf.c - used for OS/2 specific application type magic
-doc/file.1 - man page for the command
-doc/magic.4 - man page for the magic file, courtesy Guy Harris.
+src/strlcat.c - for systems that don't have it.
+src/strlcpy.c - for systems that don't have it.
+src/vasprintf.c - for systems that don't have it.
+doc/file.man - man page for the command
+doc/magic.man - man page for the magic file, courtesy Guy Harris.
 	Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
 Magdir - directory of /etc/magic pieces
-
 ------------------------------------------------------------------------------
 
 If you submit a new magic entry please make sure you read the following

+ 13 - 3
TODO

@@ -1,6 +1,16 @@
-TODOs live in the TODO section of doc/file.man (i.e. file(1)). They
-are more visible there, so please add any further TODOs to that file,
-not here.
+Most TODOs live in the TODO section of doc/file.man (i.e. file(1)).
+They are more visible there, so please add any further TODOs to that
+file, not here. More speculative material can live here.
 
 (This change was made when Reuben Thomas noticed that all the bugs
 listed in the BUGS section of the man page had been fixed!)
+
+---
+
+It would be nice to simplify file considerably. For example,
+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.

+ 1 - 12
aclocal.m4

@@ -406,18 +406,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
 ])
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# 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.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -1028,4 +1016,5 @@ m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
+m4_include([m4/visibility.m4])
 m4_include([acinclude.m4])

+ 94 - 47
config.h.in

@@ -1,14 +1,23 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Define in built-in ELF support is used */
 #undef BUILTIN_ELF
 
 /* Define for ELF core file support */
 #undef ELFCORE
 
+/* Define to 1 if you have the `asctime_r' function. */
+#undef HAVE_ASCTIME_R
+
 /* Define to 1 if you have the `asprintf' function. */
 #undef HAVE_ASPRINTF
 
+/* Define to 1 if you have the `ctime_r' function. */
+#undef HAVE_CTIME_R
+
 /* HAVE_DAYLIGHT */
 #undef HAVE_DAYLIGHT
 
@@ -44,11 +53,8 @@
 /* Define to 1 if you have the `getopt_long' function. */
 #undef HAVE_GETOPT_LONG
 
-/* Define to 1 if the system has the type `int32_t'. */
-#undef HAVE_INT32_T
-
-/* Define to 1 if the system has the type `int64_t'. */
-#undef HAVE_INT64_T
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
@@ -65,7 +71,7 @@
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
-/* Define to 1 if you have the `mbrtowc' function. */
+/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #undef HAVE_MBRTOWC
 
 /* Define to 1 if <wchar.h> declares mbstate_t. */
@@ -74,14 +80,20 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `mkostemp' function. */
+#undef HAVE_MKOSTEMP
+
 /* Define to 1 if you have the `mkstemp' function. */
 #undef HAVE_MKSTEMP
 
-/* Define to 1 if you have the `mmap' function. */
+/* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
-/* Define to 1 if the system has the type `pid_t'. */
-#undef HAVE_PID_T
+/* Define to 1 if you have the `pread' function. */
+#undef HAVE_PREAD
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
 
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
@@ -128,6 +140,9 @@
 /* Define to 1 if you have the <sys/mman.h> header file. */
 #undef HAVE_SYS_MMAN_H
 
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
@@ -152,18 +167,6 @@
 /* HAVE_TZNAME */
 #undef HAVE_TZNAME
 
-/* Define to 1 if the system has the type `uint16_t'. */
-#undef HAVE_UINT16_T
-
-/* Define to 1 if the system has the type `uint32_t'. */
-#undef HAVE_UINT32_T
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#undef HAVE_UINT64_T
-
-/* Define to 1 if the system has the type `uint8_t'. */
-#undef HAVE_UINT8_T
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
@@ -179,6 +182,16 @@
 /* Define to 1 if you have the `vasprintf' function. */
 #undef HAVE_VASPRINTF
 
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+   declarations. */
+#undef HAVE_VISIBILITY
+
 /* Define to 1 if you have the <wchar.h> header file. */
 #undef HAVE_WCHAR_H
 
@@ -188,6 +201,12 @@
 /* Define to 1 if you have the `wcwidth' function. */
 #undef HAVE_WCWIDTH
 
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
@@ -261,6 +280,18 @@
 /* Version number of package */
 #undef VERSION
 
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
@@ -280,43 +311,59 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
 /* Define to a type if <wchar.h> does not define. */
 #undef mbstate_t
 
 /* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
 
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
 
-#ifndef HAVE_UINT8_T
-typedef unsigned char uint8_t;
-#endif
-#ifndef HAVE_UINT16_T
-typedef unsigned short uint16_t;
-#endif
-#ifndef HAVE_UINT32_T
-typedef unsigned int uint32_t;
-#endif
-#ifndef HAVE_INT32_T
-typedef int int32_t;
-#endif
-#ifndef HAVE_UINT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef unsigned long long uint64_t;
-#else
-typedef unsigned long uint64_t;
-#endif
-#endif
-#ifndef HAVE_INT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef long long int64_t;
-#else
-typedef long int64_t;
-#endif
-#endif
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
 
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork

File diff suppressed because it is too large
+ 1729 - 1098
configure


+ 23 - 42
configure.ac

@@ -1,9 +1,9 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file, 5.11, christos@astron.com)
-AM_INIT_AUTOMAKE()
+AC_INIT([file],[5.13],[christos@astron.com])
+AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_MSG_CHECKING(for builtin ELF support)
@@ -66,21 +66,22 @@ AC_SUBST(fsect)
 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
 
 AC_SUBST(WARNINGS)
-AC_GNU_SOURCE
 
 dnl Checks for programs.
-AC_PROG_CC
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
 AM_PROG_CC_C_O
+AC_C_BIGENDIAN
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AC_PROG_LIBTOOL
-
+LT_INIT([disable-static pic-only])
+gl_VISIBILITY
 dnl Checks for headers
 AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
-AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
+AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
 AC_CHECK_HEADERS(getopt.h err.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
 AC_CHECK_HEADERS(zlib.h)
@@ -91,45 +92,25 @@ AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_CHECK_MEMBERS([struct stat.st_rdev])
 
-AC_STRUCT_TM
-AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
+AC_STRUCT_TIMEZONE
 AC_STRUCT_TIMEZONE_DAYLIGHT
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 AC_TYPE_MBSTATE_T
 
 AC_STRUCT_OPTION_GETOPT_H
-
-AC_CHECK_TYPES([pid_t, uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
+AC_TYPE_PID_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_INT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_INT64_T
 AC_CHECK_SIZEOF(long long)
-AH_BOTTOM([
-#ifndef HAVE_UINT8_T
-typedef unsigned char uint8_t;
-#endif
-#ifndef HAVE_UINT16_T
-typedef unsigned short uint16_t;
-#endif
-#ifndef HAVE_UINT32_T
-typedef unsigned int uint32_t;
-#endif
-#ifndef HAVE_INT32_T
-typedef int int32_t;
-#endif
-#ifndef HAVE_UINT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef unsigned long long uint64_t;
-#else
-typedef unsigned long uint64_t;
-#endif
-#endif
-#ifndef HAVE_INT64_T
-#if SIZEOF_LONG_LONG == 8
-typedef long long int64_t;
-#else
-typedef long int64_t;
-#endif
-#endif
-])
+AC_FUNC_MMAP
+AC_FUNC_FORK
+AC_FUNC_MBRTOWC
 
 AC_MSG_CHECKING(for gcc compiler warnings)
 AC_ARG_ENABLE(warnings,
@@ -156,10 +137,10 @@ else
 fi])
 
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof fork)
+AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof)
 
 dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread)
 
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)

+ 6 - 3
doc/Makefile.in

@@ -38,7 +38,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -95,6 +96,7 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -109,6 +111,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -217,9 +220,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu doc/Makefile
+	  $(AUTOMAKE) --foreign doc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

+ 46 - 12
doc/file.man

@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.98 2011/12/08 12:12:46 rrt Exp $
-.Dd October 17, 2011
+.\" $File: file.man,v 1.102 2013/01/04 15:39:22 christos Exp $
+.Dd October 25, 2012
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -259,8 +259,16 @@ prepended.
 (If you want a newline, see the
 .Fl r
 option.)
+The magic pattern with the highest strength (see the
+.Fl l
+option) comes first.
 .It Fl l , Fl Fl list
-Print information about the strength of each magic pattern.
+Shows a list of patterns and their strength sorted descending by
+.Xr magic 4
+strength
+which is used for the matching (see also the
+.Fl k
+option).
 .It Fl L , Fl Fl dereference
 option causes symlinks to be followed, as the like-named option in
 .Xr ls 1
@@ -268,8 +276,6 @@ option causes symlinks to be followed, as the like-named option in
 This is the default if the environment variable
 .Ev POSIXLY_CORRECT
 is defined.
-.It Fl l
-Shows sorted patterns list in the order which is used for the matching.
 .It Fl m , Fl Fl magic-file Ar magicfiles
 Specify an alternate list of files and directories containing magic.
 This can be a single item, or a colon-separated list.
@@ -551,16 +557,20 @@ or the mailing list at
 .Sh TODO
 .Pp
 Fix output so that tests for MIME and APPLE flags are not needed all
-over the place, and actual output is only done in one place. This
-needs a design. Suggestion: push possible outputs on to a list, then
-pick the last-pushed (most specific, one hopes) value at the end, or
-use a default if the list is empty. This should not slow down evaluation.
+over the place, and actual output is only done in one place.
+This needs a design.
+Suggestion: push possible outputs on to a list, then pick the
+last-pushed (most specific, one hopes) value at the end, or
+use a default if the list is empty.
+This should not slow down evaluation.
 .Pp
-Continue to squash all magic bugs. See Debian BTS for a good source.
+Continue to squash all magic bugs.
+See Debian BTS for a good source.
 .Pp
 Store arbitrarily long strings, for example for %s patterns, so that
-they can be printed out. Fixes Debian bug #271672. Would require more
-complex store/load code in apprentice.
+they can be printed out.
+Fixes Debian bug #271672.
+Would require more complex store/load code in apprentice.
 .Pp
 Add syntax for relative offsets after current level (Debian bug #466037).
 .Pp
@@ -570,6 +580,30 @@ Add a zip library so we can peek inside Office2007 documents to
 figure out what they are.
 .Pp
 Add an option to print URLs for the sources of the file descriptions.
+.Pp
+Combine script searches and add a way to map executable names to MIME
+types (e.g. have a magic value for !:mime which causes the resulting
+string to be looked up in a table).
+This would avoid adding the same magic repeatedly for each new
+hash-bang interpreter.
+.Pp
+Fix
+.Dq name
+and
+.Dq use
+to check for consistency at compile time (duplicate 
+.Dq name ,
+.Dq use
+pointing to undefined
+.Dq name
+).
+Make 
+.Dq name
+/
+.Dq use 
+more efficient by keeping a sorted list of names.
+Special-case ^ to flip endianness in the parser so that it does not
+have to be escaped, and document it.
 .Sh AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP
 on

+ 20 - 3
doc/libmagic.man

@@ -1,4 +1,4 @@
-.\" $File: libmagic.man,v 1.26 2011/12/19 17:49:31 christos Exp $
+.\" $File: libmagic.man,v 1.27 2013/01/06 20:56:52 christos Exp $
 .\"
 .\" Copyright (c) Christos Zoulas 2003.
 .\" All Rights Reserved.
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 19, 2011
+.Dd January 6, 2012
 .Dt LIBMAGIC 3
 .Os
 .Sh NAME
@@ -37,7 +37,9 @@
 .Nm magic_setflags ,
 .Nm magic_check ,
 .Nm magic_compile ,
-.Nm magic_load
+.Nm magic_list ,
+.Nm magic_load ,
+.Nm magic_version
 .Nd Magic number recognition library
 .Sh LIBRARY
 .Lb libmagic
@@ -67,6 +69,8 @@
 .Fn magic_list "magic_t cookie" "const char *filename"
 .Ft int
 .Fn magic_load "magic_t cookie" "const char *filename"
+.Ft int
+.Fn magic_version "void"
 .Sh DESCRIPTION
 These functions
 operate on the magic database file
@@ -246,6 +250,16 @@ If that variable is not set, the default database file name is __MAGIC__.
 adds
 .Dq .mgc
 to the database filename as appropriate.
+.Pp
+The
+.Fn magic_version
+command returns the version number of this library which is compiled into
+the shared library using the constant
+.Dv MAGIC_VERSION
+from
+.In magic.h .
+This can be used by client programs to verify that the version they compile
+against is the same as the version that they run against.
 .Sh RETURN VALUES
 The function
 .Fn magic_open
@@ -276,6 +290,9 @@ function returns a textual description of the errors of the above
 functions, or
 .Dv NULL
 if there was no error.
+The
+.Fn magic_version
+always returns the version number of the library.
 Finally,
 .Fn magic_setflags
 returns \-1 on systems that don't support

+ 132 - 16
doc/magic.man

@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.71 2011/12/07 11:58:24 rrt Exp $
-.Dd April 20, 2011
+.\" $File: magic.man,v 1.78 2013/01/09 13:04:30 christos Exp $
+.Dd January 7, 2013
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -51,7 +51,7 @@ A 64-bit double precision IEEE floating point number in this machine's native by
 .It Dv string
 A string of bytes.
 The string type specification can be optionally followed
-by /[WwcCtb]*.
+by /[WwcCtbT]*.
 The
 .Dq W
 flag compacts whitespace in the target, which must
@@ -85,8 +85,12 @@ The
 flag forces the test to be done for text files, while the
 .Dq b
 flag forces the test to be done for binary files.
+The
+.Dq T
+flag causes the string to be trimmed, i.e. leading and trailing whitespace
+is deleted before the string is printed.
 .It Dv pstring
-A Pascal-style string where the first byte/short/int is interpreted as the an
+A Pascal-style string where the first byte/short/int is interpreted as the
 unsigned length.
 The length defaults to byte and can be specified as a modifier.
 The following modifiers are supported:
@@ -121,6 +125,8 @@ local time rather than UTC.
 .It Dv qldate
 An eight-byte value interpreted as a UNIX-style date, but interpreted as
 local time rather than UTC.
+.It Dv qwdate
+An eight-byte value interpreted as a Windows-style date.
 .It Dv beid3
 A 32-bit ID3 length in big-endian byte order.
 .It Dv beshort
@@ -147,6 +153,9 @@ than UTC.
 An eight-byte value in big-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
+.It Dv beqwdate
+An eight-byte value in big-endian byte order,
+interpreted as a Windows-style date.
 .It Dv bestring16
 A two-byte unicode (UCS16) string in big-endian byte order.
 .It Dv leid3
@@ -175,6 +184,9 @@ than UTC.
 An eight-byte value in little-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
+.It Dv leqwdate
+An eight-byte value in little-endian byte order,
+interpreted as a Windows-style date.
 .It Dv lestring16
 A two-byte unicode (UCS16) string in little-endian byte order.
 .It Dv melong
@@ -188,6 +200,27 @@ interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
 .It Dv indirect
 Starting at the given offset, consult the magic database again.
+.It Dv name
+Define a
+.Dq named
+magic instance that can be called from another
+.Dv use
+magic entry, like a subroutine call.
+Named instance direct magic offsets are relative to the offset of the
+previous matched entry, but indirect offsets are relative to the beginning
+of the file as usual.
+Named magic entries always match.
+.It Dv use
+Recursively call the named magic starting from the current offset.
+If the name of the referenced begins with a
+.Dv ^
+then the endianness of the magic is switched; if the magic mentioned
+.Dv leshort
+for example,
+it is treated as
+.Dv beshort
+and vice versa.
+This is useful to avoid duplicating the rules for different endianness.
 .It Dv regex
 A regular expression match in extended POSIX regular expression syntax
 (like egrep).
@@ -232,6 +265,67 @@ This is intended to be used with the test
 no other matches.
 .El
 .Pp
+For compatibility with the Single
+.Ux
+Standard, the type specifiers
+.Dv dC
+and
+.Dv d1
+are equivalent to
+.Dv byte ,
+the type specifiers
+.Dv uC
+and
+.Dv u1
+are equivalent to
+.Dv ubyte ,
+the type specifiers
+.Dv dS
+and
+.Dv d2
+are equivalent to
+.Dv short ,
+the type specifiers
+.Dv uS
+and
+.Dv u2
+are equivalent to
+.Dv ushort ,
+the type specifiers
+.Dv dI ,
+.Dv dL ,
+and
+.Dv d4
+are equivalent to
+.Dv long ,
+the type specifiers
+.Dv uI ,
+.Dv uL ,
+and
+.Dv u4
+are equivalent to
+.Dv ulong ,
+the type specifier
+.Dv d8
+is equivalent to
+.Dv quad ,
+the type specifier
+.Dv u8
+is equivalent to
+.Dv uquad ,
+and the type specifier
+.Dv s
+is equivalent to
+.Dv string .
+In addition, the type specifier
+.Dv dQ
+is equivalent to
+.Dv quad
+and the type specifier
+.Dv uQ
+is equivalent to
+.Dv uquad .
+.Pp
 Each top-level magic pattern (see below for an explanation of levels)
 is classified as text or binary according to the types used.
 Types
@@ -537,19 +631,41 @@ The formats
 .Dv melong ,
 .Dv short ,
 .Dv beshort ,
-.Dv leshort ,
-.Dv date ,
-.Dv bedate ,
-.Dv medate ,
-.Dv ledate ,
-.Dv beldate ,
-.Dv leldate ,
 and
-.Dv meldate
-are system-dependent; perhaps they should be specified as a number
-of bytes (2B, 4B, etc),
-since the files being recognized typically come from
-a system on which the lengths are invariant.
+.Dv leshort
+do not depend on the length of the C data types
+.Dv short
+and
+.Dv long
+on the platform, even though the Single
+.Ux
+Specification implies that they do.  However, as OS X Mountain Lion has
+passed the Single
+.Ux
+Specification validation suite, and supplies a version of
+.Xr file __CSECTION__
+in which they do not depend on the sizes of the C data types and that is
+built for a 64-bit environment in which
+.Dv long
+is 8 bytes rather than 4 bytes, presumably the validation suite does not
+test whether, for example
+.Dv long
+refers to an item with the same size as the C data type
+.Dv long .
+There should probably be
+.Dv type
+names
+.Dv int8 ,
+.Dv uint8 ,
+.Dv int16 ,
+.Dv uint16 ,
+.Dv int32 ,
+.Dv uint32 ,
+.Dv int64 ,
+and
+.Dv uint64 ,
+and specified-byte-order variants of them,
+to make it clearer that those types have specified widths.
 .\"
 .\" From: guy@sun.uucp (Guy Harris)
 .\" Newsgroups: net.bugs.usg

+ 77 - 0
m4/visibility.m4

@@ -0,0 +1,77 @@
+# visibility.m4 serial 4 (gettext-0.18.2)
+dnl Copyright (C) 2005, 2008, 2010-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+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 MacOS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+    dnl First, check whether -Werror can be added to the command line, or
+    dnl whether it leads to an error because of some other option that the
+    dnl user has put into $CC $CFLAGS $CPPFLAGS.
+    AC_MSG_CHECKING([whether the -Werror option is usable])
+    AC_CACHE_VAL([gl_cv_cc_vis_werror], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror"
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
+        [gl_cv_cc_vis_werror=yes],
+        [gl_cv_cc_vis_werror=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_vis_werror])
+    dnl Now check whether visibility declarations are supported.
+    AC_MSG_CHECKING([for simple visibility declarations])
+    AC_CACHE_VAL([gl_cv_cc_visibility], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+      dnl We use the option -Werror and a function dummyfunc, because on some
+      dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
+      dnl "visibility attribute not supported in this configuration; ignored"
+      dnl at the first function definition in every compilation unit, and we
+      dnl don't want to use the option in this case.
+      if test $gl_cv_cc_vis_werror = yes; then
+        CFLAGS="$CFLAGS -Werror"
+      fi
+      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=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_visibility])
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+  AC_SUBST([CFLAG_VISIBILITY])
+  AC_SUBST([HAVE_VISIBILITY])
+  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+])

+ 9 - 5
magic/Magdir/adventure

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: adventure,v 1.13 2010/12/31 16:32:54 christos Exp $
+# $File: adventure,v 1.14 2012/06/21 01:32:26 christos Exp $
 # adventure: file(1) magic for Adventure game files
 #
 # from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
@@ -33,10 +33,14 @@
 #
 0	ubyte			>0
 >0	ubyte			<9
->>16	belong&0xfe00f0f0	0x3030	Infocom game data
->>>0	ubyte			x	(Z-machine %d,
->>>>2	ubeshort		x	Release %d /
->>>>18	string			>\0	Serial %.6s)
+>>16	belong&0xfe00f0f0	0x3030
+>>>0	ubyte			< 10
+>>>>2	ubeshort		< 10
+>>>>>18	regex			[0-9][0-9][0-9][0-9][0-9][0-9]
+>>>>>>0	ubyte			< 10	Infocom (Z-machine %d,
+>>>>>>>2	ubeshort	< 10 	Release %d /
+>>>>>>>>18	string		>\0	Serial %.6s)
+!:strength + 40
 
 #------------------------------------------------------------------------------
 # Glulx:  file(1) magic for Glulx binaries.

+ 4 - 1
magic/Magdir/amigaos

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: amigaos,v 1.14 2009/09/19 16:28:07 christos Exp $
+# $File: amigaos,v 1.15 2012/06/21 01:13:59 christos Exp $
 # amigaos:  file(1) magic for AmigaOS binary formats:
 
 #
@@ -63,3 +63,6 @@
 # From: Alex Beregszaszi <alex@fsn.hu>
 0	string		LZX		LZX compressed archive (Amiga)
 
+# From: Przemek Kramarczyk <pkramarczyk@gmail.com>
+0	string 		.KEY		AmigaDOS script
+0	string 		.key		AmigaDOS script

+ 5 - 9
magic/Magdir/animation

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.45 2011/09/06 11:00:06 christos Exp $
+# $File: animation,v 1.47 2013/02/06 14:18:52 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -688,10 +688,6 @@
 # iso 13818 transport stream
 #
 # from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
-# (the following is a little bit restrictive and works fine for a stream
-#  that starts with PAT properly. it won't work for stream data, that is
-#  cut from an input device data right in the middle, but this shouldn't
-#  disturb)
 # syncbyte      8 bit	0x47
 # error_ind     1 bit	-
 # payload_start 1 bit	1
@@ -699,9 +695,9 @@
 # PID          13 bit	0x0000
 # scrambling    2 bit	-
 # adaptfld_ctrl 2 bit	1 or 3
-# conti_count   4 bit	0
-0	belong&0xFF5FFF1F	0x47400010	MPEG transport stream data
->188	byte			!0x47		CORRUPTED
+# conti_count   4 bit	-
+0	belong&0xFF5FFF10	0x47400010
+>188	byte			0x47		MPEG transport stream data
 
 # DIF digital video file format <mpruett@sgi.com>
 0	belong&0xffffff00	0x1f070000      DIF
@@ -755,7 +751,7 @@
 >0	byte		x		GameCube movie,
 >0x34	ubeshort	x		%d x
 >0x36	ubeshort	x		%d,
->0x26	ubeshort	x		%dµs,
+>0x26	ubeshort	x		%dus,
 >0x42	ubeshort	0		no audio
 >0x42	ubeshort	>0		%dHz audio
 

+ 46 - 0
magic/Magdir/aout

@@ -0,0 +1,46 @@
+
+#------------------------------------------------------------------------------
+# $File: aout,v 1.1 2013/01/09 22:37:23 christos Exp $
+# aout:  file(1) magic for a.out executable/object/etc entries that
+# handle executables on multiple platforms.
+#
+
+#
+# Little-endian 32-bit-int a.out, merged from bsdi (for BSD/OS, from
+# BSDI), netbsd, and vax (for UNIX/32V and BSD)
+#
+# XXX - is there anything we can look at to distinguish BSD/OS 386 from
+# NetBSD 386 from various VAX binaries?  The BSD/OS shared library flag
+# works only for binaries using shared libraries.  Grabbing the entry
+# point from the a.out header, using it to find the first code executed
+# in the program, and looking at that might help.
+#
+0	lelong		0407		a.out little-endian 32-bit executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+0	lelong		0410		a.out little-endian 32-bit pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+0	lelong		0413		a.out little-endian 32-bit demand paged pure executable
+>16	lelong		>0		not stripped
+>32	byte		0x6a		(uses BSD/OS shared libs)
+
+#
+# Big-endian 32-bit-int a.out, merged from sun (for old 68010 SunOS a.out),
+# mips (for old 68020(!) SGI a.out), and netbsd (for old big-endian a.out).
+#
+# XXX - is there anything we can look at to distinguish old SunOS 68010
+# from old 68020 IRIX from old NetBSD?  Again, I guess we could look at
+# the first instruction or instructions in the program.
+#
+0	belong		0407		a.out big-endian 32-bit executable
+>16	belong		>0		not stripped
+
+0	belong		0410		a.out big-endian 32-bit pure executable
+>16	belong		>0		not stripped
+
+0	belong		0413		a.out big-endian 32-bit demand paged executable
+>16	belong		>0		not stripped
+

+ 47 - 1
magic/Magdir/apple

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.24 2010/11/25 15:00:12 christos Exp $
+# $File: apple,v 1.26 2012/12/27 15:43:23 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
@@ -249,3 +249,49 @@
 # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
 # .vdi
 4	string innotek\ VirtualBox\ Disk\ Image %s
+
+# Apple disk partition stuff, strengthen the magic using byte 4
+0	beshort	0x4552
+>4	byte	0			Apple Driver Map
+>>2	beshort	x			\b, blocksize %d
+>>4	belong	x			\b, blockcount %d
+>>10	beshort	x			\b, devtype %d
+>>12	beshort	x			\b, devid %d
+>>20	beshort x			\b, descriptors %d
+# Assume 	8 partitions each at a multiple of the sector size.
+# We could glean this from the partition descriptors, but they are empty!?!?
+>>(2.S*1)	indirect		\b, contains[@0x%x]: 
+>>(2.S*2)	indirect		\b, contains[@0x%x]: 
+>>(2.S*3)	indirect		\b, contains[@0x%x]: 
+>>(2.S*4)	indirect		\b, contains[@0x%x]: 
+>>(2.S*5)	indirect		\b, contains[@0x%x]: 
+>>(2.S*6)	indirect		\b, contains[@0x%x]: 
+>>(2.S*7)	indirect		\b, contains[@0x%x]: 
+>>(2.S*8)	indirect		\b, contains[@0x%x]: 
+
+# Yes, the 3rd and 4th bytes are reserved, but we use them to make the
+# magic stronger.
+0	belong	0x504d0000		Apple Partition Map
+>4	belong	x			\b, map block count %d
+>8	belong	x			\b, start block %d
+>12	belong	x			\b, block count %d
+>16	string >0			\b, name %s
+>48	string >0			\b, type %s
+>124	string >0			\b, processor %s
+>140	string >0			\b, boot arguments %s
+>92	belong	& 1			\b, valid
+>92	belong	& 2			\b, allocated
+>92	belong	& 4			\b, in use
+>92	belong	& 8			\b, has boot info
+>92	belong	& 16			\b, readable
+>92	belong	& 32			\b, writable
+>92	belong	& 64			\b, pic boot code
+>92	belong	& 128			\b, chain compatible driver
+>92	belong	& 256			\b, real driver
+>92	belong	& 512			\b, chain driver
+>92	belong	& 1024			\b, mount at startup
+>92	belong	& 2048			\b, is the startup partition
+
+#http://wiki.mozilla.org/DS_Store_File_Format`
+#http://en.wikipedia.org/wiki/.DS_Store
+0	string	\0\0\0\1Bud1\0		Apple Desktop Services Store

+ 95 - 80
magic/Magdir/archive

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.70 2011/10/26 15:44:47 christos Exp $
+# $File: archive,v 1.79 2013/02/08 17:24:06 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -36,7 +36,60 @@
 0	string		070701		ASCII cpio archive (SVR4 with no CRC)
 0	string		070702		ASCII cpio archive (SVR4 with CRC)
 
-# Debian package (needs to go before regular portable archives)
+#
+# Various archive formats used by various versions of the "ar"
+# command.
+#
+
+#
+# Original UNIX archive formats.
+# They were written with binary values in host byte order, and
+# the magic number was a host "int", which might have been 16 bits
+# or 32 bits.  We don't say "PDP-11" or "VAX", as there might have
+# been ports to little-endian 16-bit-int or 32-bit-int platforms
+# (x86?) using some of those formats; if none existed, feel free
+# to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
+# 32-bit.  There might have been big-endian ports of that sort as
+# well.
+#
+0	leshort		0177555		very old 16-bit-int little-endian archive
+0	beshort		0177555		very old 16-bit-int big-endian archive
+0	lelong		0177555		very old 32-bit-int little-endian archive
+0	belong		0177555		very old 32-bit-int big-endian archive
+
+0	leshort		0177545		old 16-bit-int little-endian archive
+>2	string		__.SYMDEF	random library
+0	beshort		0177545		old 16-bit-int big-endian archive
+>2	string		__.SYMDEF	random library
+0	lelong		0177545		old 32-bit-int little-endian archive
+>4	string		__.SYMDEF	random library
+0	belong		0177545		old 32-bit-int big-endian archive
+>4	string		__.SYMDEF	random library
+
+#
+# From "pdp" (but why a 4-byte quantity?)
+#
+0	lelong		0x39bed		PDP-11 old archive
+0	lelong		0x39bee		PDP-11 4.0 archive
+
+#
+# XXX - what flavor of APL used this, and was it a variant of
+# some ar archive format?  It's similar to, but not the same
+# as, the APL workspace magic numbers in pdp.
+#
+0	long		0100554		apl workspace
+
+#
+# System V Release 1 portable(?) archive format.
+#
+0	string		=<ar>		System V Release 1 ar archive
+!:mime	application/x-archive
+
+#
+# Debian package; it's in the portable archive format, and needs to go
+# before the entry for regular portable archives, as it's recognized as
+# a portable archive whose first member has a name beginning with
+# "debian".
 #
 0	string		=!<arch>\ndebian
 !:mime	application/x-debian-package
@@ -53,18 +106,14 @@
 #>84	string		gz		\b, uses gzip compression
 #>136	ledate		x		created: %s
 
-# other archives
-0	long		0177555		very old archive
-0	short		0177555		very old PDP-11 archive
-0	long		0177545		old archive
-0	short		0177545		old PDP-11 archive
-0	long		0100554		apl workspace
-0	string		=<ar>		archive
-!:mime	application/x-archive
-
-# MIPS archive (needs to go before regular portable archives)
+#
+# MIPS archive; they're in the portable archive format, and need to go
+# before the entry for regular portable archives, as it's recognized as
+# a portable archive whose first member has a name beginning with
+# "__________E".
 #
 0	string	=!<arch>\n__________E	MIPS archive
+!:mime	application/x-archive
 >20	string	U			with MIPS Ucode members
 >21	string	L			with MIPSEL members
 >21	string	B			with MIPSEB members
@@ -75,56 +124,20 @@
 0	search/1	-h-		Software Tools format archive text
 
 #
-# XXX - why are there multiple <ar> thingies?  Note that 0x213c6172 is
-# "!<ar", so, for new-style (4.xBSD/SVR2andup) archives, we have:
-#
-# 0	string		=!<arch>		current ar archive
-# 0	long		0x213c6172	archive file
-#
-# and for SVR1 archives, we have:
-#
-# 0	string		\<ar>		System V Release 1 ar archive
-# 0	string		=<ar>		archive
-#
-# XXX - did Aegis really store shared libraries, breakpointed modules,
-# and absolute code program modules in the same format as new-style
-# "ar" archives?
+# BSD/SVR2-and-later portable archive formats.
 #
 0	string		=!<arch>		current ar archive
 !:mime	application/x-archive
 >8	string		__.SYMDEF	random library
->0	belong		=65538		- pre SR9.5
->0	belong		=65539		- post SR9.5
->0	beshort		2		- object archive
->0	beshort		3		- shared library module
->0	beshort		4		- debug break-pointed module
->0	beshort		5		- absolute code program module
-0	string		\<ar>		System V Release 1 ar archive
-0	string		=<ar>		archive
-#
-# XXX - from "vax", which appears to collect a bunch of byte-swapped
-# thingies, to help you recognize VAX files on big-endian machines;
-# with "leshort", "lelong", and "string", that's no longer necessary....
-#
-0	belong		0x65ff0000	VAX 3.0 archive
-0	belong		0x3c61723e	VAX 5.0 archive
-#
-0	long		0x213c6172	archive file
-0	lelong		0177555		very old VAX archive
-0	leshort		0177555		very old PDP-11 archive
-#
-# XXX - "pdp" claims that 0177545 can have an __.SYMDEF member and thus
-# be a random library (it said 0xff65 rather than 0177545).
-#
-0	lelong		0177545		old VAX archive
->8	string		__.SYMDEF	random library
-0	leshort		0177545		old PDP-11 archive
->8	string		__.SYMDEF	random library
+>68	string		__.SYMDEF\ SORTED	random library
+
 #
-# From "pdp" (but why a 4-byte quantity?)
+# "Thin" archive, as can be produced by GNU ar.
 #
-0	lelong		0x39bed		PDP-11 old archive
-0	lelong		0x39bee		PDP-11 4.0 archive
+0	string		=!<thin>\n	thin archive with
+>68	belong		0		no symbol entries
+>68	belong		1		%d symbol entry
+>68	belong		>1		%d symbol entries
 
 # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
 #
@@ -184,7 +197,10 @@
 # SAR
 3	string	LH5 SAR archive data
 # BSArc/BS2
-0	string	\212\3SB \0 BSArc/BS2 archive data
+0	string	\212\3SB\020\0	BSArc/BS2 archive data
+# Bethesda Softworks Archive (Oblivion)
+0	string	BSA\0 		BSArc archive data
+>4	lelong	x		version %d
 # MAR
 2	string	=-ah MAR archive data
 # ACB
@@ -209,7 +225,7 @@
 # AMGC
 0	string	\xad6" AMGC archive data
 # NuLIB
-0	string	NõFélå NuLIB archive data
+0	string	N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
 # PakLeo
 0	string	LEOLZW PAKLeo archive data
 # ChArc
@@ -221,7 +237,7 @@
 # Freeze
 0	string	\x1f\x9f\x4a\x10\x0a Freeze archive data
 # KBoom
-0	string	¨MP¨ KBoom archive data
+0	string	\xc2\xa8MP\xc2\xa8 KBoom archive data
 # NSQ, must go after CDC Codec
 0	string	\x76\xff NSQ archive data
 # DPA
@@ -259,7 +275,7 @@
 # MP3 (archiver, not lossy audio compression)
 0	string	MP3\x1a MP3-Archiver archive data
 # ZET
-0	string	OZÝ ZET archive data
+0	string	OZ\xc3\x9d ZET archive data
 # TSComp
 0	string	\x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
 # ARQ
@@ -290,7 +306,7 @@
 # Xtreme
 0	string	ULEB\0 Xtreme archive data
 # Pack Magic
-0	string	@â\1\0 Pack Magic archive data
+0	string	@\xc3\xa2\1\0 Pack Magic archive data
 # BTS
 0	belong&0xfeffffff	0x1a034465 BTS archive data
 # ELI 5750
@@ -426,7 +442,7 @@
 # XPack Data
 0	string	xpa XPack archive data
 # XPack Single Data
-0	string	Í\ jm XPack single archive data
+0	string	\xc3\x8d\ jm XPack single archive data
 
 # TODO: missing due to unknown magic/magic at end of file:
 #DWC
@@ -571,6 +587,7 @@
 !:mime	application/zip
 
 # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+0	string		PK\005\006	Zip archive data (empty)
 0	string		PK\003\004
 
 # Specialised zip formats which start with a member named 'mimetype'
@@ -660,11 +677,10 @@
 !:mime	application/vnd.oasis.opendocument.image-template
 
 #  EPUB (OEBPS) books using OCF (OEBPS Container Format)
-#    From: Adam Buchbinder <adam.buchbinder@gmail.com>
 #    http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
-#    (mimetype contains "application/epub+zip")
->>50	string	epub+zip		EPUB ebook data
-!:mime	application/epub+zip
+#    From: Ralf Brown <ralf.brown@gmail.com>
+>0x1E	string	mimetypeapplication/epub+zip	EPUB document
+!:mime application/epub+zip
 
 #  Catch other ZIP-with-mimetype formats
 #	In a ZIP file, the bytes immediately after a member's contents are
@@ -684,16 +700,21 @@
 >>>38		regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
 !:mime	application/zip
 
+# Java Jar files
+>(26.s+30)	leshort	0xcafe		Java Jar file data (zip)
+!:mime	application/jar
+
 # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 #   Next line excludes specialized formats:
->26    string          !\x8\0\0\0mimetype	Zip archive data
+>(26.s+30)	leshort	!0xcafe
+>>26    string          !\x8\0\0\0mimetype	Zip archive data
 !:mime	application/zip
->>4	byte		0x09		\b, at least v0.9 to extract
->>4	byte		0x0a		\b, at least v1.0 to extract
->>4	byte		0x0b		\b, at least v1.1 to extract
->>4	byte		0x14		\b, at least v2.0 to extract
->>4	byte		0x2d		\b, at least v3.0 to extract
->>0x161	string		WINZIP		\b, WinZIP self-extracting
+>>>4	byte		0x09		\b, at least v0.9 to extract
+>>>4	byte		0x0a		\b, at least v1.0 to extract
+>>>4	byte		0x0b		\b, at least v1.1 to extract
+>>>4	byte		0x14		\b, at least v2.0 to extract
+>>>4	byte		0x2d		\b, at least v3.0 to extract
+>>>0x161	string		WINZIP		\b, WinZIP self-extracting
 
 # StarView Metafile
 # From Pierre Ducroquet <pinaraf@pinaraf.info>
@@ -884,14 +905,8 @@
 #   archive must be an uncompressed file called 'mimetype' with contents
 #   'application/epub+zip'
 
-# start by checking that this is a ZIP archive, then check for the
-#   proper mimetype file
-# From: Ralf Brown <ralf.brown@gmail.com>
-0	string	PK\003\004
->0x1E	string	mimetypeapplication/epub+zip	EPUB document
-!:mime application/epub+zip
 
-# From: "Michał Górny" <mgorny@gentoo.org>
+# From: "Michael Gorny" <mgorny@gentoo.org>
 # ZPAQ: http://mattmahoney.net/dc/zpaq.html
 0	string	zPQ	ZPAQ stream
 >3	byte	x	\b, level %d

+ 10 - 6
magic/Magdir/assembler

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

+ 3 - 2
magic/Magdir/audio

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.64 2012/02/20 16:37:34 christos Exp $
+# $File: audio,v 1.66 2013/02/06 14:18:52 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -512,7 +512,7 @@
 >>12		ulelong		x		\b, sample rate %d
 
 # adlib sound files
-# From Gürkan Sengün <gurkan@linuks.mine.nu>, http://www.linuks.mine.nu
+# From Gurkan Sengun <gurkan@linuks.mine.nu>, http://www.linuks.mine.nu
 0    	string		RAWADATA	RdosPlay RAW
 
 1068	string		RoR		AMUSIC Adlib Tracker
@@ -571,6 +571,7 @@
 
 # musepak support From: "Jiri Pejchal" <jiri.pejchal@gmail.com>
 0       string          MP+     Musepack audio
+!:mime	audio/x-musepack
 >3      byte            255     \b, SV pre8
 >3      byte&0xF        0x6     \b, SV 6
 >3      byte&0xF        0x8     \b, SV 8

+ 3 - 13
magic/Magdir/bsdi

@@ -1,25 +1,15 @@
 
 #------------------------------------------------------------------------------
-# $File: bsdi,v 1.5 2009/09/19 16:28:08 christos Exp $
+# $File: bsdi,v 1.6 2013/01/09 22:37:24 christos Exp $
 # bsdi:  file(1) magic for BSD/OS (from BSDI) objects
+# Some object/executable formats use the same magic numbers as are used
+# in other OSes; those are handled by entries in aout.
 #
 
 0	lelong		0314		386 compact demand paged pure executable
 >16	lelong		>0		not stripped
 >32	byte		0x6a		(uses shared libs)
 
-0	lelong		0407		386 executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
-0	lelong		0410		386 pure executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
-0	lelong		0413		386 demand paged pure executable
->16	lelong		>0		not stripped
->32	byte		0x6a		(uses shared libs)
-
 # same as in SunOS 4.x, except for static shared libraries
 0	belong&077777777	0600413		sparc demand paged
 >0	byte		&0x80

+ 6 - 6
magic/Magdir/c-lang

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.16 2011/12/09 08:02:16 rrt Exp $
+# $File: c-lang,v 1.17 2012/04/28 21:20:26 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 
@@ -30,19 +30,19 @@
 # C++
 # The strength of these rules is increased so they beat the C rules above
 0	regex	\^template	C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^virtual		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^class		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^public:		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 0	regex	\^private:		C++ source text
-!:strength + 10
+!:strength + 5
 !:mime	text/x-c++
 
 # From: Mikhail Teterin <mi@aldan.algebra.com> 

+ 50 - 12
magic/Magdir/cafebabe

@@ -1,19 +1,20 @@
 
 #------------------------------------------------------------------------------
-# $File: cafebabe,v 1.8 2009/09/19 16:28:08 christos Exp $
+# $File: cafebabe,v 1.12 2013/01/11 16:45:23 christos Exp $
 # Cafe Babes unite!
 #
-# Since Java bytecode and Mach-O fat-files have the same magic number, the test
-# must be performed in the same "magic" sequence to get both right.  The long
-# at offset 4 in a mach-O fat file tells the number of architectures; the short at
-# offset 4 in a Java bytecode file is the JVM minor version and the
-# short at offset 6 is the JVM major version.  Since there are only 
+# Since Java bytecode and Mach-O universal binaries have the same magic number,
+# the test must be performed in the same "magic" sequence to get both right.
+# The long at offset 4 in a Mach-O universal binary tells the number of
+# architectures; the short at offset 4 in a Java bytecode file is the JVM minor
+# version and the short at offset 6 is the JVM major version.  Since there are only 
 # only 18 labeled Mach-O architectures at current, and the first released 
 # Java class format was version 43.0, we can safely choose any number
 # between 18 and 39 to test the number of architectures against
 # (and use as a hack). Let's not use 18, because the Mach-O people
 # might add another one or two as time goes by...
 #
+### JAVA START ###
 0	belong		0xcafebabe
 !:mime	application/x-java-applet
 >4	belong		>30		compiled Java class data,
@@ -28,13 +29,50 @@
 >>4	belong		0x0031		(Java 1.5)
 >>4	belong		0x0032		(Java 1.6)
 
+0	belong		0xcafed00d	JAR compressed with pack200,
+>5	byte		x		version %d.
+>4	byte		x		\b%d
+!:mime	application/x-java-pack200
 
-0	belong		0xcafebabe
->4	belong		1		Mach-O fat file with 1 architecture
->4	belong		>1
->>4	belong		<20		Mach-O fat file with %ld architectures
 
 0	belong		0xcafed00d	JAR compressed with pack200,
->>5	byte		x		version %d.
->>4	byte		x		\b%d
+>5	byte		x		version %d.
+>4	byte		x		\b%d
 !:mime	application/x-java-pack200
+
+### JAVA END ###
+### MACH-O START ###
+
+# 16777216 = 0x01000000
+0	name		mach-o		\b [ 
+>0	belong		0xffffffff	\bAny
+>0	belong		1		\bVax
+>0	belong		6		\bMC680x0
+>0	belong		7		\bI386
+>0	belong		8		\bMIPS
+>0	belong		10		\bMC98000
+>0	belong		11		\bHPPA
+>0	belong		12		\bARM
+>0	belong		13		\bMC88000
+>0	belong		14		\bSPARC
+>0	belong		15		\bI860
+>0	belong		16		\bALPHA
+>0	belong		17		\bPOWERPC
+>0	belong		16777223	\bX86_64
+>0	belong		16777233	\bPOWERPC64
+>&(8.L)	indirect			: 
+>0	belong		x		\b]
+
+0	belong		0xcafebabe
+>4	belong		1		Mach-O universal binary with 1 architecture:
+>>8	use		mach-o
+>4	belong		>1
+>>4	belong		<20		Mach-O universal binary with %ld architectures:
+>>>8	use		mach-o
+>>>28	use		mach-o
+>>>4	belong		>2
+>>>>48	use		mach-o
+>>>>>4	belong		>3
+>>>>>68	use		mach-o
+
+### MACH-O END ###

+ 5 - 5
magic/Magdir/claris

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: claris,v 1.5 2009/09/19 16:28:08 christos Exp $
+# $File: claris,v 1.6 2012/06/20 21:19:05 christos Exp $
 # claris:  file(1) magic for claris
 # "H. Nanosecond" <aldomel@ix.netcom.com>
 # Claris Works a word processor, etc.
@@ -11,10 +11,10 @@
 #*
 #0001000 #010 250 377 377 377 377 000 213 000 230 000 021 002 377 014 000
 #null to byte 1000 octal
-514	string	\377\377\377\377\000	Claris clip art?
->0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	yes.
-514	string	\377\377\377\377\001	Claris clip art?
->0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	yes.
+514	string	\377\377\377\377\000
+>0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	Claris clip art
+514	string	\377\377\377\377\001
+>0	string	\0\0\0\0\0\0\0\0\0\0\0\0\0	Claris clip art
 
 # Claris works files
 # .cwk

+ 5 - 2
magic/Magdir/commands

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.42 2011/12/05 23:14:02 rrt Exp $
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
 #0	string/w	:			shell archive or script for antique kernel text
@@ -67,17 +67,20 @@
 # PHP scripts
 # Ulf Harnhammar <ulfh@update.uu.se>
 0	search/1/c	=<?php			PHP script text
+!:strength + 10
 !:mime	text/x-php
 0	search/1	=<?\n			PHP script text
 !:mime	text/x-php
 0	search/1	=<?\r			PHP script text
 !:mime	text/x-php
 0	search/1/w	#!\ /usr/local/bin/php	PHP script text executable
+!:strength + 10
 !:mime	text/x-php
 0	search/1/w	#!\ /usr/bin/php	PHP script text executable
+!:strength + 10
 !:mime	text/x-php
 # Smarty compiled template, http://www.smarty.net/
-# Elan Ruusamäe <glen@delfi.ee>
+# Elan Ruusamae <glen@delfi.ee>
 0	string	=<?php\ /*\ Smarty\ version	Smarty compiled template
 >24	regex	[0-9.]+				\b, version %s
 !:mime	text/x-php

+ 3 - 3
magic/Magdir/console

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: console,v 1.18 2010/09/20 19:19:17 rrt Exp $
+# $File: console,v 1.19 2013/02/06 14:18:52 christos Exp $
 # Console game magic
 # Toby Deshane <hac@shoelace.digivill.net>
 #    ines:  file(1) magic for Marat's iNES Nintendo Entertainment System
@@ -137,7 +137,7 @@
 >113	string	x		(%s)
 
 #------------------------------------------------------------------------------
-# Microsoft Xbox executables .xbe (Esa Hyytiä <ehyytia@cc.hut.fi>)
+# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
 0       string          XBEH            XBE, Microsoft Xbox executable
 # probabilistic checks whether signed or not
 >0x0004 ulelong =0x0
@@ -177,7 +177,7 @@
 # From: Serge van den Boom <svdb@stack.nl>
 0	string		\x01ZZZZZ\x01	3DO "Opera" file system
 
-# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
 0	string		GBS		Nintendo Gameboy Music/Audio Data
 12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
 

+ 1 - 3
magic/Magdir/convex

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: convex,v 1.7 2009/09/19 16:28:08 christos Exp $
+# $File: convex,v 1.8 2012/10/03 23:44:43 christos Exp $
 # convex:  file(1) magic for Convex boxes
 #
 # Convexes are big-endian.
@@ -30,8 +30,6 @@
 # The restore program uses these number to determine how the data is
 # to be extracted.
 #
-24	belong	=60011	dump format, 4.1 BSD or earlier
-24	belong	=60012	dump format, 4.2 or 4.3 BSD without IDC
 24	belong	=60013	dump format, 4.2 or 4.3 BSD (IDC compatible)
 24	belong	=60014	dump format, Convex Storage Manager by-reference dump
 #

+ 8 - 0
magic/Magdir/cubemap

@@ -0,0 +1,8 @@
+
+#------------------------------------------------------------------------------
+# $File: cubemap,v 1.1 2012/06/06 13:03:20 christos Exp $
+# file(1) magic(5) data for cubemaps  Martin Erik Werner <martinerikwerner@gmail.com>
+#
+0	string	ACMP	Map file for the AssaultCube FPS game
+0	string	CUBE	Map file for cube and cube2 engine games
+0	string	MAPZ)	Map file for the Blood Frontier/Red Eclipse FPS games

+ 19 - 45
magic/Magdir/cups

@@ -1,55 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: cups,v 1.1 2011/11/10 18:59:54 christos Exp $
+# $File: cups,v 1.2 2012/11/02 21:50:29 christos Exp $
 # Cups: file(1) magic for the cups raster file format
 # From: Laurent Martelli <martellilaurent@gmail.com>
 # http://www.cups.org/documentation.php/spec-raster.html
 #
 
-# Cups Raster image format, Big Endian
-0	string		RaS		
-!:mime	application/vnd.cups-raster
->3	string		t		Cups Raster version 1, Big Endian
->3	string		2		Cups Raster version 2, Big Endian
->3	string		3		Cups Raster version 3, Big Endian
->280	belong		x		\b, %d
->284	belong		x		\bx%d dpi
->376	belong		x		\b, %dx
->380	belong		x		\b%d pixels
->388	belong		x		%d bits/color
->392	belong		x		%d bits/pixel
->400	belong		0		ColorOrder=Chunky
->400	belong		1		ColorOrder=Banded
->400	belong		2		ColorOrder=Planar
->404	belong		0		ColorSpace=gray
->404	belong		1		ColorSpace=RGB
->404	belong		2		ColorSpace=RGBA
->404	belong		3		ColorSpace=black
->404	belong		4		ColorSpace=CMY
->404	belong		5		ColorSpace=YMC
->404	belong		6		ColorSpace=CMYK
->404	belong		7		ColorSpace=YMCK
->404	belong		8		ColorSpace=KCMY
->404	belong		9		ColorSpace=KCMYcm
->404	belong		10		ColorSpace=GMCK
->404	belong		11		ColorSpace=GMCS
->404	belong		12		ColorSpace=WHITE
->404	belong		13		ColorSpace=GOLD
->404	belong		14		ColorSpace=SILVER
->404	belong		15		ColorSpace=CIE XYZ
->404	belong		16		ColorSpace=CIE Lab
->404	belong		17		ColorSpace=RGBW
->404	belong		18		ColorSpace=sGray
->404	belong		19		ColorSpace=sRGB
->404	belong		20		ColorSpace=AdobeRGB
-
-
-# Cups Raster image format, Little Endian
-1	string		SaR		
->0	string		t		Cups Raster version 1, Little Endian
->0	string		2		Cups Raster version 2, Little Endian
->0	string		3		Cups Raster version 3, Little Endian
-!:mime	application/vnd.cups-raster
+0	name		cups-be
 >280	lelong		x		\b, %d
 >284	lelong		x		\bx%d dpi
 >376	lelong		x		\b, %dx
@@ -80,3 +37,20 @@
 >404	lelong		18		ColorSpace=sGray
 >404	lelong		19		ColorSpace=sRGB
 >404	lelong		20		ColorSpace=AdobeRGB
+
+# Cups Raster image format, Big Endian
+0	string		RaS		
+>3	string		t		Cups Raster version 1, Big Endian
+>3	string		2		Cups Raster version 2, Big Endian
+>3	string		3		Cups Raster version 3, Big Endian
+!:mime	application/vnd.cups-raster
+>0	use		^cups-be
+
+
+# Cups Raster image format, Little Endian
+1	string		SaR		
+>0	string		t		Cups Raster version 1, Little Endian
+>0	string		2		Cups Raster version 2, Little Endian
+>0	string		3		Cups Raster version 3, Little Endian
+!:mime	application/vnd.cups-raster
+>0	use		\^cups-be

+ 7 - 10
magic/Magdir/database

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: database,v 1.28 2011/09/16 19:40:40 christos Exp $
+# $File: database,v 1.32 2013/02/06 14:18:52 christos Exp $
 # database:  file(1) magic for various databases
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@@ -203,6 +203,8 @@
 # MS Access database
 4	string	Standard\ Jet\ DB	Microsoft Access Database
 !:mime	application/x-msaccess
+4	string	Standard\ ACE\ DB	Microsoft Access Database
+!:mime	application/x-msaccess
 
 # TDB database from Samba et al - Martin Pool <mbp@samba.org>
 0	string	TDB\ file		TDB database
@@ -269,14 +271,6 @@
 >48	lequad		x			\b, rnum=%lld
 >56	lequad		x			\b, fsiz=%lld
 
-# G-IR database made by gobject-introspect toolset,
-# http://live.gnome.org/GObjectIntrospection
-0	string		GOBJ\nMETADATA\r\n\032	G-IR binary database
->16	byte		x			\b, v%d
->17	byte		x			\b.%d
->20	leshort		x			\b, %d entries
->22	leshort		x			\b/%d local
-
 # Type:	QDBM Quick Database Manager
 # From:	Benoit Sibaud <bsibaud@april.org>
 0	string		\\[depot\\]\n\f		Quick Database Manager, little endian
@@ -288,8 +282,11 @@
 0	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
 >14	string		x			(version %s)
 
-# From:  Stéphane Blondon http://www.yaal.fr
+# From:  Stephane Blondon http://www.yaal.fr
 # Database file for Zope (done by FileStorage)
 0	string		FS21	Zope Object Database File Storage (data)
 # Cache file for the database of Zope (done by ClientStorage)
 0	string		ZEC3	Zope Object Database Client Cache File (data)
+
+# IDA (Interactive Disassembler) database
+0	string		IDA1	IDA (Interactive Disassembler) database

+ 13 - 2
magic/Magdir/diff

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: diff,v 1.12 2010/12/07 16:52:52 christos Exp $
+# $File: diff,v 1.14 2012/09/16 23:08:54 christos Exp $
 # diff:  file(1) magic for diff(1) output
 #
 0	search/1	diff\ 		diff output text
@@ -16,7 +16,7 @@
 !:mime	text/x-diff
 
 # bsdiff:  file(1) magic for bsdiff(1) output
-0	string/t		BSDIFF40	bsdiff(1) patch file
+0	string/b		BSDIFF40	bsdiff(1) patch file
 
 
 # unified diff
@@ -27,3 +27,14 @@
 >>>>&0	search/1 @@	unified diff output text
 !:mime	text/x-diff
 !:strength + 90
+
+# librsync -- the library for network deltas
+#
+# Copyright (C) 2001 by Martin Pool.  You may do whatever you want with
+# this file.
+#
+0	belong		0x72730236	rdiff network-delta data
+
+0	belong		0x72730136	rdiff network-delta signature data
+>4	belong		x		(block length=%d,
+>8	belong		x		signature strength=%d)

+ 15 - 15
magic/Magdir/digital

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: digital,v 1.10 2011/05/03 01:44:17 christos Exp $
+# $File: digital,v 1.11 2013/01/11 16:45:23 christos Exp $
 #  Digital UNIX - Info
 #
 0	string	=!<arch>\n________64E	Alpha archive
@@ -8,20 +8,20 @@
 #
 
 0	leshort		0603
->>24	leshort		0410		COFF format alpha pure
->>24	leshort		0413		COFF format alpha demand paged
->>>22	leshort&030000	!020000		executable
->>>22	leshort&020000	!0		dynamically linked
->>>16	lelong		!0		not stripped
->>>16	lelong		0		stripped
->>>27	byte		x		- version %d
->>>26	byte		x		\b.%d
->>>28	byte		x		\b-%d
->>24	leshort		0407		COFF format alpha object
->>>22	leshort&030000	020000		shared library
->>>27	byte		x		- version %d
->>>26	byte		x		\b.%d
->>>28	byte		x		\b-%d
+>24	leshort		0410		COFF format alpha pure
+>24	leshort		0413		COFF format alpha demand paged
+>>22	leshort&030000	!020000		executable
+>>22	leshort&020000	!0		dynamically linked
+>>16	lelong		!0		not stripped
+>>16	lelong		0		stripped
+>>27	byte		x		- version %d
+>>26	byte		x		\b.%d
+>>28	byte		x		\b-%d
+>24	leshort		0407		COFF format alpha object
+>>22	leshort&030000	020000		shared library
+>>27	byte		x		- version %d
+>>26	byte		x		\b.%d
+>>28	byte		x		\b-%d
 
 # Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk>
 #

+ 2 - 1
magic/Magdir/dolby

@@ -1,12 +1,13 @@
 
 #------------------------------------------------------------------------------
-# $File: dolby,v 1.5 2009/09/19 16:28:08 christos Exp $
+# $File: dolby,v 1.6 2012/10/31 13:39:42 christos Exp $
 # ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
 # from http://www.atsc.org/standards/a_52a.pdf
 # corrections, additions, etc. are always welcome!
 #
 # syncword
 0       beshort         0x0b77  ATSC A/52 aka AC-3 aka Dolby Digital stream,
+!:mime	audio/vnd.dolby.dd-raw
 # fscod
 >4      byte&0xc0       0x00    48 kHz,
 >4      byte&0xc0       0x40    44.1 kHz,

+ 34 - 72
magic/Magdir/dump

@@ -1,11 +1,11 @@
 
 #------------------------------------------------------------------------------
-# $File: dump,v 1.11 2009/09/19 16:28:09 christos Exp $
+# $File: dump,v 1.12 2012/11/01 04:26:40 christos Exp $
 # dump:  file(1) magic for dump file format--for new and old dump filesystems
 #
 # We specify both byte orders in order to recognize byte-swapped dumps.
 #
-24	belong	60012		new-fs dump file (big endian),
+0	name	new-dump-be
 >4	bedate	x		Previous dump %s,
 >8	bedate	x		This dump %s,
 >12	belong	>0		Volume %ld,
@@ -24,7 +24,7 @@
 >824	string	>\0		Host %s,
 >888	belong	>0		Flags %x
 
-24	belong	60011		old-fs dump file (big endian),
+0	name	old-dump-be
 #>4	bedate	x		Previous dump %s,
 #>8	bedate	x		This dump %s,
 >12	belong	>0		Volume %ld,
@@ -43,57 +43,7 @@
 >824	string	>\0		Host %s,
 >888	belong	>0		Flags %x
 
-24	lelong	60012		new-fs dump file (little endian),
->4	ledate	x		This dump %s,
->8	ledate	x		Previous dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
-
-24	lelong	60011		old-fs dump file (little endian),
-#>4	ledate	x		Previous dump %s,
-#>8	ledate	x		This dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
-
-18	leshort	60011		old-fs dump file (16-bit, assuming PDP-11 endianness),
->2	medate	x		Previous dump %s,
->6	medate	x		This dump %s,
->10	leshort	>0		Volume %ld,
->0	leshort	1		tape header.
->0	leshort	2		beginning of file record.
->0	leshort	3		map of inodes on tape.
->0	leshort	4		continuation of file record.
->0	leshort	5		end of volume.
->0	leshort	6		map of inodes deleted.
->0	leshort	7		end of medium (for floppy).
-
-24	belong	0x19540119	new-fs dump file (ufs2, big endian),
+0	name	ufs2-dump-be
 >896	beqdate	x		Previous dump %s,
 >904	beqdate	x		This dump %s,
 >12	belong	>0		Volume %ld,
@@ -112,21 +62,33 @@
 >824	string	>\0		Host %s,
 >888	belong	>0		Flags %x
 
-24	lelong	0x19540119	new-fs dump file (ufs2, little endian),
->896	leqdate	x		This dump %s,
->904	leqdate	x		Previous dump %s,
->12	lelong	>0		Volume %ld,
->692	lelong	0		Level zero, type:
->692	lelong	>0		Level %d, type:
->0	lelong	1		tape header,
->0	lelong	2		beginning of file record,
->0	lelong	3		map of inodes on tape,
->0	lelong	4		continuation of file record,
->0	lelong	5		end of volume,
->0	lelong	6		map of inodes deleted,
->0	lelong	7		end of medium (for floppy),
->676	string	>\0		Label %s,
->696	string	>\0		Filesystem %s,
->760	string	>\0		Device %s,
->824	string	>\0		Host %s,
->888	lelong	>0		Flags %x
+24	belong	60012		new-fs dump file (big endian), 
+>0	use	new-dump-be
+
+24	belong	60011		old-fs dump file (big endian), 
+>0	use	old-dump-be
+
+24	lelong	60012		new-fs dump file (little endian), 
+>0	use	\^new-dump-be
+
+24	lelong	60011		old-fs dump file (little endian), 
+>0	use	\^old-dump-be
+
+
+24	belong	0x19540119	new-fs dump file (ufs2, big endian), 
+>0	use	ufs2-dump-be
+
+24	lelong	0x19540119	new-fs dump file (ufs2, little endian), 
+>0	use	\^ufs2-dump-be
+
+18	leshort	60011		old-fs dump file (16-bit, assuming PDP-11 endianness),
+>2	medate	x		Previous dump %s,
+>6	medate	x		This dump %s,
+>10	leshort	>0		Volume %ld,
+>0	leshort	1		tape header.
+>0	leshort	2		beginning of file record.
+>0	leshort	3		map of inodes on tape.
+>0	leshort	4		continuation of file record.
+>0	leshort	5		end of volume.
+>0	leshort	6		map of inodes deleted.
+>0	leshort	7		end of medium (for floppy).

+ 159 - 237
magic/Magdir/elf

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: elf,v 1.54 2011/12/17 17:16:29 christos Exp $
+# $File: elf,v 1.58 2012/11/06 20:43:52 christos Exp $
 # elf:  file(1) magic for ELF executables
 #
 # We have to check the byte order flag to see what byte order all the
@@ -14,263 +14,185 @@
 # Modified by (3): Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de> (fix of core support)
 # Modified by (4): <gerardo.cacciari@gmail.com> (VMS Itanium)
 # Modified by (5): Matthias Urlichs <smurf@debian.org> (Listing of many architectures)
-0	string		\177ELF		ELF
->4	byte		0		invalid class
->4	byte		1		32-bit
->4	byte		2		64-bit
->5	byte		0		invalid byte order
->5	byte		1		LSB
->>16	leshort		0		no file type,
+
+0	name		elf-le
+>16	leshort		0		no file type,
 !:strength *2
 !:mime	application/octet-stream
->>16	leshort		1		relocatable,
+>16	leshort		1		relocatable,
 !:mime	application/x-object
->>16	leshort		2		executable,
+>16	leshort		2		executable,
 !:mime	application/x-executable
->>16	leshort		3		shared object,
+>16	leshort		3		shared object,
 !:mime	application/x-sharedlib
->>16	leshort		4		core file
+>16	leshort		4		core file
 !:mime	application/x-coredump
 # Core file detection is not reliable.
 #>>>(0x38+0xcc) string	>\0		of '%s'
 #>>>(0x38+0x10) lelong	>0		(signal %d),
->>16	leshort		&0xff00		processor-specific,
->>18	leshort		0		no machine,
->>18	leshort		1		AT&T WE32100 - invalid byte order,
->>18	leshort		2		SPARC - invalid byte order,
->>18	leshort		3		Intel 80386,
->>18	leshort		4		Motorola
+>16	leshort		&0xff00		processor-specific,
+>18	leshort		0		no machine,
+>18	leshort		1		AT&T WE32100
+>18	leshort		2		SPARC
+>18	leshort		3		Intel 80386,
+>18	leshort		4		Motorola
+>>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,
->>18	leshort		6		Intel 80486,
->>18	leshort		7		Intel 80860,
+>18	leshort		5		Motorola 88000 - invalid byte order,
+>18	leshort		6		Intel 80486,
+>18	leshort		7		Intel 80860,
 # The official e_machine number for MIPS is now #8, regardless of endianness.
 # The second number (#10) will be deprecated later. For now, we still
 # say something if #10 is encountered, but only gory details for #8.
->>18	leshort		8		MIPS,
+>18	leshort		8		MIPS,
+>>4	byte		1
 >>>36	lelong		&0x20		N32
->>18	leshort		10		MIPS,
+>18	leshort		10		MIPS,
+>>4	byte		1
 >>>36	lelong		&0x20		N32
->>18	leshort		8
+>18	leshort		8
 # only for 32-bit
->>>4	byte		1
->>>>36  lelong&0xf0000000	0x00000000	MIPS-I
->>>>36  lelong&0xf0000000	0x10000000	MIPS-II
->>>>36  lelong&0xf0000000	0x20000000	MIPS-III
->>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
->>>>36  lelong&0xf0000000	0x40000000	MIPS-V
->>>>36  lelong&0xf0000000	0x50000000	MIPS32
->>>>36  lelong&0xf0000000	0x60000000	MIPS64
->>>>36  lelong&0xf0000000	0x70000000	MIPS32 rel2
->>>>36  lelong&0xf0000000	0x80000000	MIPS64 rel2
+>>4	byte		1
+>>>36  lelong&0xf0000000	0x00000000	MIPS-I
+>>>36  lelong&0xf0000000	0x10000000	MIPS-II
+>>>36  lelong&0xf0000000	0x20000000	MIPS-III
+>>>36  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>36  lelong&0xf0000000	0x40000000	MIPS-V
+>>>36  lelong&0xf0000000	0x50000000	MIPS32
+>>>36  lelong&0xf0000000	0x60000000	MIPS64
+>>>36  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>36  lelong&0xf0000000	0x80000000	MIPS64 rel2
 # only for 64-bit
->>>4	byte		2
->>>>48  lelong&0xf0000000	0x00000000	MIPS-I
->>>>48  lelong&0xf0000000	0x10000000	MIPS-II
->>>>48  lelong&0xf0000000	0x20000000	MIPS-III
->>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
->>>>48  lelong&0xf0000000	0x40000000	MIPS-V
->>>>48  lelong&0xf0000000	0x50000000	MIPS32
->>>>48  lelong&0xf0000000	0x60000000	MIPS64
->>>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
->>>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
->>18	leshort		9		Amdahl - invalid byte order,
->>18	leshort		10		MIPS (deprecated),
->>18	leshort		11		RS6000 - invalid byte order,
->>18	leshort		15		PA-RISC - invalid byte order,
->>>50	leshort		0x0214		2.0
->>>48	leshort		&0x0008		(LP64),
->>18	leshort		16		nCUBE,
->>18	leshort		17		Fujitsu VPP500,
->>18	leshort		18		SPARC32PLUS - invalid byte order,
->>18	leshort		20		PowerPC,
->>18	leshort		22		IBM S/390,
->>18	leshort		36		NEC V800,
->>18	leshort		37		Fujitsu FR20,
->>18	leshort		38		TRW RH-32,
->>18	leshort		39		Motorola RCE,
->>18	leshort		40		ARM,
->>18	leshort		41		Alpha,
->>18	leshort		0xa390		IBM S/390 (obsolete),
->>18	leshort		42		Renesas SH,
->>18	leshort		43		SPARC V9 - invalid byte order,
->>18	leshort		44		Siemens Tricore Embedded Processor,
->>18	leshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
->>18	leshort		46		Renesas H8/300,
->>18	leshort		47		Renesas H8/300H,
->>18	leshort		48		Renesas H8S,
->>18	leshort		49		Renesas H8/500,
->>18	leshort		50		IA-64,
->>18	leshort		51		Stanford MIPS-X,
->>18	leshort		52		Motorola Coldfire,
->>18	leshort		53		Motorola M68HC12,
->>18	leshort		54		Fujitsu MMA,
->>18	leshort		55		Siemens PCP,
->>18	leshort		56		Sony nCPU,
->>18	leshort		57		Denso NDR1,
->>18	leshort		58		Start*Core,
->>18	leshort		59		Toyota ME16,
->>18	leshort		60		ST100,
->>18	leshort		61		Tinyj emb.,
->>18	leshort		62		x86-64,
->>18	leshort		63		Sony DSP,
->>18	leshort		66		FX66,
->>18	leshort		67		ST9+ 8/16 bit,
->>18	leshort		68		ST7 8 bit,
->>18	leshort		69		MC68HC16,
->>18	leshort		70		MC68HC11,
->>18	leshort		71		MC68HC08,
->>18	leshort		72		MC68HC05,
->>18	leshort		73		SGI SVx,
->>18	leshort		74		ST19 8 bit,
->>18	leshort		75		Digital VAX,
->>18	leshort		76		Axis cris,
->>18	leshort		77		Infineon 32-bit embedded,
->>18	leshort		78		Element 14 64-bit DSP,
->>18	leshort		79		LSI Logic 16-bit DSP,
->>18	leshort		80		MMIX,
->>18	leshort		81		Harvard machine-independent,
->>18	leshort		82		SiTera Prism,
->>18	leshort		83		Atmel AVR 8-bit,
->>18	leshort		84		Fujitsu FR30,
->>18	leshort		85		Mitsubishi D10V,
->>18	leshort		86		Mitsubishi D30V,
->>18	leshort		87		NEC v850,
->>18	leshort		88		Renesas M32R,
->>18	leshort		89		Matsushita MN10300,
->>18	leshort		90		Matsushita MN10200,
->>18	leshort		91		picoJava,
->>18	leshort		92		OpenRISC,
->>18	leshort		93		ARC Cores Tangent-A5,
->>18	leshort		94		Tensilica Xtensa,
->>18	leshort		97		NatSemi 32k,
->>18	leshort		106		Analog Devices Blackfin,
->>18	leshort		113		Altera Nios II,
->>18	leshort		0xae		META,
->>18	leshort		187		Tilera TILE64,
->>18	leshort		188		Tilera TILEPro,
->>18	leshort		191		Tilera TILE-Gx,
->>18	leshort		0x3426		OpenRISC (obsolete),
->>18	leshort		0x8472		OpenRISC (obsolete),
->>18	leshort		0x9026		Alpha (unofficial),
->>20	lelong		0		invalid version
->>20	lelong		1		version 1
->>36	lelong		1		MathCoPro/FPU/MAU Required
->5	byte		2		MSB
->>16	beshort		0		no file type,
-!:mime	application/octet-stream
->>16	beshort		1		relocatable,
-!:mime	application/x-object
->>16	beshort		2		executable,
-!:mime	application/x-executable
->>16	beshort		3		shared object,
-!:mime	application/x-sharedlib
->>16	beshort		4		core file,
-!:mime	application/x-coredump
-#>>>(0x38+0xcc) string	>\0		of '%s'
-#>>>(0x38+0x10) belong	>0		(signal %d),
->>16	beshort		&0xff00		processor-specific,
->>18	beshort		0		no machine,
->>18	beshort		1		AT&T WE32100,
->>18	beshort		2		SPARC,
->>18	beshort		3		Intel 80386 - invalid byte order,
->>18	beshort		4		Motorola
->>>36	belong		&0x01000000	68000,
->>>36	belong		&0x00810000	CPU32,
->>>36	belong		0		68020,
->>18	beshort		5		Motorola 88000,
->>18	beshort		6		Intel 80486 - invalid byte order,
->>18	beshort		7		Intel 80860,
-# only for MIPS - see comment in little-endian section above.
->>18	beshort		8		MIPS,
->>>36	belong		&0x20		N32
->>18	beshort		10		MIPS,
->>>36	belong		&0x20		N32
->>18	beshort		8
+>>4	byte		2
+>>>48  lelong&0xf0000000	0x00000000	MIPS-I
+>>>48  lelong&0xf0000000	0x10000000	MIPS-II
+>>>48  lelong&0xf0000000	0x20000000	MIPS-III
+>>>48  lelong&0xf0000000	0x30000000	MIPS-IV
+>>>48  lelong&0xf0000000	0x40000000	MIPS-V
+>>>48  lelong&0xf0000000	0x50000000	MIPS32
+>>>48  lelong&0xf0000000	0x60000000	MIPS64
+>>>48  lelong&0xf0000000	0x70000000	MIPS32 rel2
+>>>48  lelong&0xf0000000	0x80000000	MIPS64 rel2
+>18	leshort		9		Amdahl - invalid byte order,
+>18	leshort		10		MIPS (deprecated),
+>18	leshort		11		RS6000 - invalid byte order,
+>18	leshort		15		PA-RISC - invalid byte order,
 # only for 32-bit
->>>4	byte		1
->>>>36  belong&0xf0000000	0x00000000	MIPS-I
->>>>36  belong&0xf0000000	0x10000000	MIPS-II
->>>>36  belong&0xf0000000	0x20000000	MIPS-III
->>>>36  belong&0xf0000000	0x30000000	MIPS-IV
->>>>36  belong&0xf0000000	0x40000000	MIPS-V
->>>>36  belong&0xf0000000	0x50000000	MIPS32
->>>>36  belong&0xf0000000	0x60000000	MIPS64
->>>>36  belong&0xf0000000	0x70000000	MIPS32 rel2
->>>>36  belong&0xf0000000	0x80000000	MIPS64 rel2
+>>4	byte		1
+>>>38	leshort		0x0214		2.0
+>>>36	leshort		&0x0008		(LP64)
 # only for 64-bit
->>>4	byte		2
->>>>48	belong&0xf0000000	0x00000000	MIPS-I
->>>>48	belong&0xf0000000	0x10000000	MIPS-II
->>>>48	belong&0xf0000000	0x20000000	MIPS-III
->>>>48	belong&0xf0000000	0x30000000	MIPS-IV
->>>>48	belong&0xf0000000	0x40000000	MIPS-V
->>>>48	belong&0xf0000000	0x50000000	MIPS32
->>>>48	belong&0xf0000000	0x60000000	MIPS64
->>>>48	belong&0xf0000000	0x70000000	MIPS32 rel2
->>>>48	belong&0xf0000000	0x80000000	MIPS64 rel2
->>18	beshort		9		Amdahl,
->>18	beshort		10		MIPS (deprecated),
->>18	beshort		11		RS6000,
->>18	beshort		15		PA-RISC
->>>50	beshort		0x0214		2.0
->>>48	beshort		&0x0008		(LP64)
->>18	beshort		16		nCUBE,
->>18	beshort		17		Fujitsu VPP500,
->>18	beshort		18		SPARC32PLUS,
->>>36	belong&0xffff00	0x000100	V8+ Required,
->>>36	belong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>36	belong&0xffff00	0x000400	HaL R1 Extensions Required,
->>>36	belong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
->>18	beshort		20		PowerPC or cisco 4500,
->>18	beshort		21		64-bit PowerPC or cisco 7500,
->>18	beshort		22		IBM S/390,
->>18	beshort		23		Cell SPU,
->>18	beshort		24		cisco SVIP,
->>18	beshort		25		cisco 7200,
->>18	beshort		36		NEC V800 or cisco 12000,
->>18	beshort		37		Fujitsu FR20,
->>18	beshort		38		TRW RH-32,
->>18	beshort		39		Motorola RCE,
->>18	beshort		40		ARM,
->>18	beshort		41		Alpha,
->>18	beshort		42		Renesas SH,
->>18	beshort		43		SPARC V9,
->>>48	belong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>48	belong&0xffff00	0x000400	HaL R1 Extensions Required,
->>>48	belong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
->>>48	belong&0x3	0		total store ordering,
->>>48	belong&0x3	1		partial store ordering,
->>>48	belong&0x3	2		relaxed memory ordering,
->>18	beshort		44		Siemens Tricore Embedded Processor,
->>18	beshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
->>18	beshort		46		Renesas H8/300,
->>18	beshort		47		Renesas H8/300H,
->>18	beshort		48		Renesas H8S,
->>18	beshort		49		Renesas H8/500,
->>18	beshort		50		IA-64,
->>18	beshort		51		Stanford MIPS-X,
->>18	beshort		52		Motorola Coldfire,
->>18	beshort		53		Motorola M68HC12,
->>18	beshort		73		Cray NV1,
->>18	beshort		75		Digital VAX,
->>18	beshort		88		Renesas M32R,
->>18	leshort		92		OpenRISC,
->>18	leshort		0x3426		OpenRISC (obsolete),
->>18	leshort		0x8472		OpenRISC (obsolete),
->>18	beshort		94		Tensilica Xtensa,
->>18	beshort		97		NatSemi 32k,
->>18	beshort		187		Tilera TILE64,
->>18	beshort		188		Tilera TILEPro,
->>18	beshort		191		Tilera TILE-Gx,
->>18	beshort		0x18ad		AVR32 (unofficial),
->>18	beshort		0x9026		Alpha (unofficial),
->>18	beshort		0xa390		IBM S/390 (obsolete),
->>20	belong		0		invalid version
->>20	belong		1		version 1
->>36	belong		1		MathCoPro/FPU/MAU Required
+>>4	byte		2
+>>>50	leshort		0x0214		2.0
+>>>48	leshort		&0x0008		(LP64)
+>18	leshort		16		nCUBE,
+>18	leshort		17		Fujitsu VPP500,
+>18	leshort		18		SPARC32PLUS,
+# only for 32-bit
+>>4	byte		1
+>>>36	lelong&0xffff00	0x000100	V8+ Required,
+>>>36	lelong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
+>>>36	lelong&0xffff00	0x000400	HaL R1 Extensions Required,
+>>>36	lelong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
+>18	leshort		20		PowerPC or cisco 4500,
+>18	leshort		21		64-bit PowerPC or cisco 7500,
+>18	leshort		22		IBM S/390,
+>18	leshort		23		Cell SPU,
+>18	leshort		24		cisco SVIP,
+>18	leshort		25		cisco 7200,
+>18	leshort		36		NEC V800 or cisco 12000,
+>18	leshort		37		Fujitsu FR20,
+>18	leshort		38		TRW RH-32,
+>18	leshort		39		Motorola RCE,
+>18	leshort		40		ARM,
+>>4	byte		1
+>>>36	lelong&0xff000000	0x04000000	EABI4
+>>>36	lelong&0xff000000	0x05000000	EABI5
+>18	leshort		41		Alpha,
+>18	leshort		0xa390		IBM S/390 (obsolete),
+>18	leshort		42		Renesas SH,
+>18	leshort		43		SPARC V9,
+>>4	byte		2
+>>>48	lelong&0xffff00	0x000200	Sun UltraSPARC1 Extensions Required,
+>>>48	lelong&0xffff00	0x000400	HaL R1 Extensions Required,
+>>>48	lelong&0xffff00	0x000800	Sun UltraSPARC3 Extensions Required,
+>>>48	lelong&0x3	0		total store ordering,
+>>>48	lelong&0x3	1		partial store ordering,
+>>>48	lelong&0x3	2		relaxed memory ordering,
+>18	leshort		44		Siemens Tricore Embedded Processor,
+>18	leshort		45		Argonaut RISC Core, Argonaut Technologies Inc.,
+>18	leshort		46		Renesas H8/300,
+>18	leshort		47		Renesas H8/300H,
+>18	leshort		48		Renesas H8S,
+>18	leshort		49		Renesas H8/500,
+>18	leshort		50		IA-64,
+>18	leshort		51		Stanford MIPS-X,
+>18	leshort		52		Motorola Coldfire,
+>18	leshort		53		Motorola M68HC12,
+>18	leshort		54		Fujitsu MMA,
+>18	leshort		55		Siemens PCP,
+>18	leshort		56		Sony nCPU,
+>18	leshort		57		Denso NDR1,
+>18	leshort		58		Start*Core,
+>18	leshort		59		Toyota ME16,
+>18	leshort		60		ST100,
+>18	leshort		61		Tinyj emb.,
+>18	leshort		62		x86-64,
+>18	leshort		63		Sony DSP,
+>18	leshort		66		FX66,
+>18	leshort		67		ST9+ 8/16 bit,
+>18	leshort		68		ST7 8 bit,
+>18	leshort		69		MC68HC16,
+>18	leshort		70		MC68HC11,
+>18	leshort		71		MC68HC08,
+>18	leshort		72		MC68HC05,
+>18	leshort		73		SGI SVx or Cray NV1,
+>18	leshort		74		ST19 8 bit,
+>18	leshort		75		Digital VAX,
+>18	leshort		76		Axis cris,
+>18	leshort		77		Infineon 32-bit embedded,
+>18	leshort		78		Element 14 64-bit DSP,
+>18	leshort		79		LSI Logic 16-bit DSP,
+>18	leshort		80		MMIX,
+>18	leshort		81		Harvard machine-independent,
+>18	leshort		82		SiTera Prism,
+>18	leshort		83		Atmel AVR 8-bit,
+>18	leshort		84		Fujitsu FR30,
+>18	leshort		85		Mitsubishi D10V,
+>18	leshort		86		Mitsubishi D30V,
+>18	leshort		87		NEC v850,
+>18	leshort		88		Renesas M32R,
+>18	leshort		89		Matsushita MN10300,
+>18	leshort		90		Matsushita MN10200,
+>18	leshort		91		picoJava,
+>18	leshort		92		OpenRISC,
+>18	leshort		93		ARC Cores Tangent-A5,
+>18	leshort		94		Tensilica Xtensa,
+>18	leshort		97		NatSemi 32k,
+>18	leshort		106		Analog Devices Blackfin,
+>18	leshort		113		Altera Nios II,
+>18	leshort		174		META,
+>18	leshort		183		ARM aarch64,
+>18	leshort		187		Tilera TILE64,
+>18	leshort		188		Tilera TILEPro,
+>18	leshort		191		Tilera TILE-Gx,
+>18	leshort		0x3426		OpenRISC (obsolete),
+>18	leshort		0x8472		OpenRISC (obsolete),
+>18	leshort		0x9026		Alpha (unofficial),
+>20	lelong		0		invalid version
+>20	lelong		1		version 1
+
+0	string		\177ELF		ELF
+>4	byte		0		invalid class
+>4	byte		1		32-bit
+>4	byte		2		64-bit
+>5	byte		0		invalid byte order
+>5	byte		1		LSB 
+>>0	use		elf-le
+>5	byte		2		MSB 
+>>0	use		\^elf-le
 # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
 # like proper ELF, but extracting the string had bad results.
 >4      byte            <0x80

+ 10 - 1
magic/Magdir/epoc

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: epoc,v 1.7 2009/09/19 16:28:09 christos Exp $
+# $File: epoc,v 1.8 2012/06/16 14:43:36 christos Exp $
 # 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>
 # Useful information for improving this file can be found at:
@@ -21,6 +21,7 @@
 !:mime application/x-epoc-word
 >>8	lelong		0x10000085	OPL program (TextEd)
 !:mime application/x-epoc-opl
+>>8	lelong		0x10000087	Comms settings
 >>8	lelong		0x10000088	Sheet file
 !:mime application/x-epoc-sheet
 >>8	lelong		0x100001C4	EasyFax initialisation file
@@ -29,11 +30,19 @@
 >4	lelong		0x10000074	OPL application
 !:mime application/x-epoc-app
 >4	lelong		0x1000008A	exported multi-bitmap image
+>4	lelong		0x1000016D	
+>>8	lelong		0x10000088	Comms names
 
 0	lelong		0x10000041	Psion Series 5 ROM multi-bitmap image
 
 0	lelong		0x10000050	Psion Series 5
 >4	lelong		0x1000006D	database
+>>8	lelong		0x10000084	Agenda file
+!:mime application/x-epoc-agenda
+>>8	lelong		0x10000086	Data file
+!:mime application/x-epoc-data
+>>8	lelong		0x10000CEA	Jotter file
+!:mime application/x-epoc-jotter
 >4	lelong		0x100000E4	ini file
 
 0	lelong		0x10000079	Psion Series 5 binary:

+ 615 - 207
magic/Magdir/filesystems

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.61 2011/01/10 14:01:10 christos Exp $
+# $File: filesystems,v 1.76 2013/02/18 18:45:41 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
@@ -27,7 +27,8 @@
 >>0770	long		x		%ld blocks
 # Is there a boot block written 1 sector in?
 >512    belong&077777777	0600407	\b, boot block present
-# Joerg Jenderek: Smart Boot Manager backup file is 41 byte header + first sectors of disc
+
+# Joerg Jenderek: Smart Boot Manager backup file is 25 (MSDOS) or 41 (LINUX) byte header + first sectors of disk
 # (http://btmgr.sourceforge.net/docs/user-guide-3.html)
 0		string	SBMBAKUP_	Smart Boot Manager backup file
 >9		string	x		\b, version %-5.5s
@@ -41,8 +42,10 @@
 >>>>21		ubyte	x		\b, from drive 0x%x
 >>>22		ubyte	>0		
 >>>>21		string	x		\b, from drive %s
+>>>535		search/17	\x55\xAA	
+>>>>&-512	indirect	x	\b; contains 
 
-# Joerg Jenderek
+# updated by Joerg Jenderek at Nov 2012
 # DOS Emulator image is 128 byte, null right padded header + harddisc image
 0	string	DOSEMU\0			
 >0x27E	leshort	0xAA55			
@@ -52,17 +55,173 @@
 >>>>7	ulelong	>0		\b, %u heads
 >>>>11	ulelong	>0		\b, %d sectors/track
 >>>>15	ulelong	>0		\b, %d cylinders
+>>>>128	indirect	x	\b; contains 
 
-# updated by Joerg Jenderek at Sep 2007
+# x86 boot sector updated by Joerg Jenderek at Sep 2007,May 2011
+# for any allowed sector sizes
+30		search/481	\x55\xAA	
+# to display x86 boot sector (40) before old one (strength=50), SYSLINUX MBR (?) and DOS BPB information (71) like in previous file version
+!:strength +30
+# for sector sizes < 512 Bytes
+>11		uleshort	<512		
+>>(11.s-2)	uleshort	0xAA55		x86 boot sector
+# 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
 # only for sector sizes with 512 or more Bytes
-0x1FE	leshort	0xAA55			x86 boot sector
-# to do also for sectors < than 512 Bytes and some other files, GRR
-#30	search/481	\x55\xAA	x86 boot sector
-# not for BeOS floppy 1440k, MBRs
-#(11.s-2) uleshort	0xAA55		x86 boot sector
+0x1FE	leshort	0xAA55			
+# to display information (51) before DOS BPB (strength=71) and after DOS floppy (120) like in old file version
+!:strength +21
 >2	string	OSBS			\b, OS/BS MBR
-# J\xf6rg Jenderek <joerg dot jenderek at web dot de>
->0x8C	string	Invalid\ partition\ table	\b, MS-DOS 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
+# test for nearly all MS-DOS Master Boot Record initial program loader (IPL) is now done by 
+# characteristic assembler instructions: xor ax,ax;mov ss,ax;mov sp,7c00
+>0	search/2	\x33\xc0\x8e\xd0\xbc\x00\x7c	MS-MBR
+# Microsoft Windows 95A and early ( http://thestarman.pcministry.com/asm/mbr/STDMBR.htm )
+# assembler instructions: mov si,sp;push ax;pop es;push ax;pop ds;sti;cld
+>>8	ubequad		0x8bf45007501ffbfc		
+# http://thestarman.pcministry.com/asm/mbr/200MBR.htm
+>>>0x16	ubyte		0xF3				\b,DOS 2
+>>>>219	regex		Author\ -\ 			Author:
+# found "David Litton" , "A Pehrsson  "
+>>>>>&0	string		x				"%s"
+>>>0x16	ubyte		0xF2				
+# NEC MS-DOS 3.30 Rev. 3 . See http://thestarman.pcministry.com/asm/mbr/DOS33MBR.htm
+# assembler instructions: mov di,077c;cmp word ptrl[di],a55a;jnz
+>>>>0x22	ubequad	0xbf7c07813d5aa575		\b,NEC 3.3
+# version MS-DOS 3.30 til MS-Windows 95A (WinVer=4.00.1111)
+>>>>0x22	default	x				\b,D0S version 3.3-7.0
+# error messages are printed by assembler instructions: mov si,06nn;...;int 10 (0xBEnn06;...)
+# where nn is string offset varying for different languages
+# "Invalid partition table"				nn=0x8b for english version
+>>>>>(0x49.b)	string		Invalid\ partition\ table		english
+>>>>>(0x49.b)	string		Ung\201ltige\ Partitionstabelle		german
+>>>>>(0x49.b)	string		Table\ de\ partition\ invalide		french
+>>>>>(0x49.b)	string		Tabela\ de\ parti\207ao\ inv\240lida	portuguese
+>>>>>(0x49.b)	string		Tabla\ de\ partici\242n\ no\ v\240lida	spanish
+>>>>>(0x49.b)	string		Tavola\ delle\ partizioni\ non\ valida	italian
+>>>>>0x49	ubyte		>0			at offset 0x%x
+>>>>>>(0x49.b)	string		>\0			"%s"
+# "Error loading operating system"			nn=0xa3 for english version
+# "Fehler beim Laden des Betriebssystems"		nn=0xa7 for german version
+# "Erreur en chargeant syst\212me d'exploitation"	nn=0xa7 for french version
+# "Erro na inicializa\207ao do sistema operacional"	nn=0xa7 for portuguese Brazilian version
+# "Error al cargar sistema operativo"			nn=0xa8 for spanish version
+# "Errore durante il caricamento del sistema operativo"	nn=0xae for italian version
+>>>>>0x74	ubyte		>0			at offset 0x%x
+>>>>>>(0x74.b)	string		>\0			"%s"
+# "Missing operating system"				nn=0xc2 for english version
+# "Betriebssystem fehlt"				nn=0xcd for german version
+# "Syst\212me d'exploitation absent"			nn=0xd2 for french version
+# "Sistema operacional nao encontrado"			nn=0xd4 for portuguese Brazilian version
+# "Falta sistema operativo"				nn=0xca for spanish version
+# "Sistema operativo mancante"				nn=0xe2 for italian version
+>>>>>0x79	ubyte		>0			at offset 0x%x
+>>>>>>(0x79.b)	string		>\0			"%s"
+# Microsoft Windows 95B to XP (http://thestarman.pcministry.com/asm/mbr/95BMEMBR.htm)
+# assembler instructions: push ax;pop es;push  ax;pop ds;cld;mov si,7c1b
+>>8	ubequad		0x5007501ffcbe1b7c		
+# assembler instructions: rep;movsb;retf;mov si,07be;mov cl,04
+>>>24		ubequad	0xf3a4cbbebe07b104		9M
+# "Invalid partition table"				nn=0x10F for english version
+# "Ungültige Partitionstabelle"				nn=0x10F for german version
+# "Table de partition erronée"				nn=0x10F for french version
+# "\216\257\245\340\240\346\250\256\255\255\240\357 \341\250\341\342\245\254\240 \255\245 \255\240\251\244\245\255\240"	nn=0x10F for russian version
+>>>>(0x3C.b+0x0FF)	string	Invalid\ partition\ table		english
+>>>>(0x3C.b+0x0FF)	string	Ung\201ltige\ Partitionstabelle		german
+>>>>(0x3C.b+0x0FF)	string	Table\ de\ partition\ erron\202e	french
+>>>>(0x3C.b+0x0FF)	string	\215\245\257\340\240\242\250\253\354\255\240\357\ \342\240\241\253\250\346\240	russian
+>>>>0x3C		ubyte	x			at offset 0x%x+0xFF
+>>>>(0x3C.b+0x0FF)	string	>\0			"%s"
+# "Error loading operating system"			nn=0x127 for english version
+# "Fehler beim Laden des Betriebssystems"		nn=0x12b for german version
+# "Erreur lors du chargement du système d'exploitation"	nn=0x12a for french version
+# "\216\350\250\241\252\240 \257\340\250 \247\240\243\340\343\247\252\245 \256\257\245\340\240\346\250\256\255\255\256\251 \341\250\341\342\245\254\353"	nn=0x12d for russian version
+>>>>0xBD		ubyte	x			at offset 0x1%x
+>>>>(0xBD.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				nn=0x146 for english version
+# "Betriebssystem fehlt"				nn=0x151 for german version
+# "Système d'exploitation manquant"			nn=0x15e for french version
+# "\216\257\245\340\240\346\250\256\255\255\240\357 \341\250\341\342\245\254\240 \255\245 \255\240\251\244\245\255\240"	nn=0x156 for russian version
+>>>>0xA9		ubyte	x			at offset 0x1%x
+>>>>(0xA9.b+0x100)	string	>\0			"%s"
+# http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm
+# assembler instructions: rep;movsb;retf;mov BP,07be;mov cl,04
+>>>24		ubequad	0xf3a4cbbdbe07b104		XP
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x002c4463	english
+>>>>0x1B4	ubelong&0x00FFFFFF	0x002c486e	german
+# "Invalid partition table"				xx=0x12C for english version
+# "Ungültige Partitionstabelle"				xx=0x12C for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x144 for english version
+# "Fehler beim Laden des Betriebssystems"		yy=0x148 for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x163 for english version
+# "Betriebssystem nicht vorhanden"			zz=0x16e for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# Microsoft Windows Vista or 7
+# assembler instructions: ..;mov ds,ax;mov si,7c00;mov di,..00
+>>8	ubequad		0xc08ed8be007cbf00		
+# Microsoft Windows Vista (http://thestarman.pcministry.com/asm/mbr/VistaMBR.htm)
+# assembler instructions: jnz 0729;cmp ebx,"TCPA"
+>>>0xEC		ubequad	0x753b6681fb544350		Vista
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x00627a99	english
+#>>>>0x1B4	ubelong&0x00FFFFFF	?		german
+# "Invalid partition table"				xx=0x162 for english version
+# "Ungültige Partitionstabelle"				xx=0x1?? for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x17a for english version
+# "Fehler beim Laden des Betriebssystems"		yy= 0x1?? for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x199 for english version
+# "Betriebssystem nicht vorhanden"			zz=0x1?? for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# Microsoft Windows 7 (http://thestarman.pcministry.com/asm/mbr/W7MBR.htm)
+# assembler instructions: cmp ebx,"TCPA";cmp
+>>>0xEC		ubequad	0x6681fb5443504175		Windows 7
+# where xxyyzz are lower bits from offsets of error messages varying for different languages
+>>>>0x1B4	ubelong&0x00FFFFFF	0x00637b9a	english
+#>>>>0x1B4	ubelong&0x00FFFFFF	?		german
+# "Invalid partition table"				xx=0x163 for english version
+# "Ungültige Partitionstabelle"				xx=0x1?? for german version
+>>>>0x1b5	ubyte		>0			at offset 0x1%x
+>>>>(0x1b5.b+0x100)	string	>\0			"%s"
+# "Error loading operating system"			yy=0x17b for english version
+# "Fehler beim Laden des Betriebssystems"		yy=0x1?? for german version
+>>>>0x1b6	ubyte		>0			at offset 0x1%x
+>>>>(0x1b6.b+0x100)	string	>\0			"%s"
+# "Missing operating system"				zz=0x19a for english version
+# "Betriebssystem nicht vorhanden"			zz=0x1?? for german version
+>>>>0x1b7	ubyte		>0			at offset 0x1%x
+>>>>(0x1b7.b+0x100)	string	>\0			"%s"
+# http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm#DiskSigs
+# http://en.wikipedia.org/wiki/MBR_disk_signature#ID
+>>0x1b8	ulelong		>0				\b, disk signature 0x%-.4x
+# driveID/timestamp for Win 95B,98,98SE and ME. See http://thestarman.pcministry.com/asm/mbr/mystery.htm
+>>0xDA	uleshort		0			
+>>>0xDC 	ulelong		>0			\b, created
+# physical drive number (0x80-0xFF) when the Windows wrote that byte to the drive
+>>>>0xDC	ubyte		x			with driveID 0x%x
+# hours, minutes and seconds 
+>>>>0xDf	ubyte		x			at %x
+>>>>0xDe	ubyte		x			\b:%x
+>>>>0xDd	ubyte		x			\b:%x
+# special case for Microsoft MS-DOS 3.21 spanish
+# assembler instructions: cli;mov $0x30,%ax;mov %ax,%ss;mov 
+>0	ubequad		0xfab830008ed0bc00		
+# assembler instructions: $0x1f00,%sp;mov $0x80cb,%di;add %cl,(%bx,%si);in (%dx),%ax;mov 
+>>8	ubequad		0x1fbfcb800008ed8		MS-MBR,D0S version 3.21 spanish
+# Microsoft MBR IPL end
+
 # dr-dos with some upper-, lowercase variants
 >0x9D	string	Invalid\ partition\ table$	
 >>181	string	No\ Operating\ System$		
@@ -81,30 +240,9 @@
 >>>>>>358	string	Press\ any\ key\ to\ continue.\n\r$	
 >>>>>>>387	string	Copyright\ (c)\ 1984,1998	
 >>>>>>>>411	string	Caldera\ Inc.\0		\b, DR-DOS MBR (IBMBIO.LDR)
->0x10F	string	Ung\201ltige\ Partitionstabelle	\b, MS-DOS MBR, german version 4.10.1998, 4.10.2222
->>0x1B8	ubelong	>0				\b, Serial 0x%-.4x
->0x8B	string	Ung\201ltige\ Partitionstabelle	\b, MS-DOS MBR, german version 5.00 to 4.00.950
->271	string	Invalid\ partition\ table\0		
->>295	string	Error\ loading\ operating\ system\0	
->>>326	string	Missing\ operating\ system\0		\b, mbr
 #
->139	string	Invalid\ partition\ table\0		
->>163	string	Error\ loading\ operating\ system\0	
->>>194	string	Missing\ operating\ system\0		\b, Microsoft Windows XP mbr
-# http://www.heise.de/ct/05/09/006/ page 184
-#HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\?:=Serial4Bytes+8Bytes
->>>>0x1B8	ulelong	>0				\b,Serial 0x%-.4x
->300	string	Invalid\ partition\ table\0	
->>324	string	Error\ loading\ operating\ system\0
->>>355	string	Missing\ operating\ system\0		\b, Microsoft Windows XP MBR
-#??>>>389	string	Invalid\ system\ disk		
->>>>0x1B8	ulelong	>0				\b, Serial 0x%-.4x
->300	string	Ung\201ltige\ Partitionstabelle
-#split string to avoid error: String too long
->>328	string	Fehler\ beim\ Laden\ 	
->>>346	string	des\ Betriebssystems	
->>>>366	string	Betriebssystem\ nicht\ vorhanden	\b, Microsoft Windows XP MBR (german)
->>>>>0x1B8	ulelong	>0				\b, Serial 0x%-.4x
+# tests for different MS-DOS Master Boot Records (MBR) moved and merged
+#
 #>0x145	string	Default:\ F				\b, FREE-DOS MBR
 #>0x14B	string	Default:\ F				\b, FREE-DOS 1.0 MBR
 >0x145	search/7	Default:\ F			\b, FREE-DOS MBR
@@ -131,8 +269,7 @@
 >>>>>>>420	ubyte&0x0F	0Xf			\b ask
 >>>>>420	ubyte		x			\b)
 #
->271	string	Operating\ system\ loading 		
->>296	string	error\r					\b, SYSLINUX MBR (2.10)
+# SYSLINUX MBR moved
 # http://www.acronis.de/
 >362	string	MBR\ Error\ \0\r			
 >>376	string	ress\ any\ key\ to\ 			
@@ -193,12 +330,7 @@
 >>>>321		string	Loading\ stage1.5	\b, GRUB version x.y
 >>>380		string	Geom\0Hard\ Disk\0Read\0\ Error\0
 >>>>374		string	GRUB\ \0		\b, GRUB version n.m
-# http://syslinux.zytor.com/
->478	string	Boot\ failed\r			
->>495	string	LDLINUX\ SYS			\b, SYSLINUX bootloader (1.62)
->480	string	Boot\ failed\r			
->>495	string	LDLINUX\ SYS			\b, SYSLINUX bootloader (2.06 or 2.11)
->484	string	Boot\ error\r			\b, SYSLINUX bootloader (3.11)
+# SYSLINUX bootloader moved
 >395	string	chksum\0\ ERROR!\0		\b, Gujin bootloader
 # http://www.bcdwb.de/bcdw/index_e.htm
 >3	string	BCDL				
@@ -263,11 +395,14 @@
 #OEM-ID=BOOTWIZ0
 >442	string	Non-system\ disk,\ 	
 >>459	string	press\ any\ key...\x7\0		\b, Acronis Startup Recovery Loader
-# DOS names like F11.SYS are 8 right space padded bytes+3 bytes
+# updated by Joerg Jenderek at Nov 2012
+# DOS names like F11.SYS or BOOTWIZ.SYS are 8 right space padded bytes+3 bytes
 >>>477		ubyte&0xDF	>0		
 >>>>477		string		x 		\b %-.3s
 >>>>>480	ubyte&0xDF	>0		
->>>>>>480	string		x 		\b%-.5s
+>>>>>>480	string		x 		\b%-.4s
+>>>>>>>484	ubyte&0xDF	>0		
+>>>>>>>>484	string		x 		\b%-.1s
 >>>>485		ubyte&0xDF	>0		
 >>>>>485	string		x 		\b.%-.3s
 #
@@ -279,24 +414,39 @@
 >>>>>291 string and\ press\ any\ key.\n\r		\b, FDBOOT harddisk Bootloader
 >>>>>>200 string	>\0                             \b, version %-3s
 >242	string	Bootsector\ from\ C.H.\ Hochst\204	
->>278	string	No\ Systemdisk.\ 			
->>>293	string	Booting\ from\ harddisk.\n\r		
->>>441	string	Cannot\ load\ from\ harddisk.\n\r	
->>>>469 string	Insert\ Systemdisk\ 			
->>>>>487 string and\ press\ any\ key.\n\r		\b, WinImage harddisk Bootloader
->>>>>>209 string	>\0                             \b, version %-4.4s
+# http://freecode.com/projects/dosfstools	dosfstools-n.m/src/mkdosfs.c
+# updated by Joerg Jenderek at Nov 2012. Use search directive with offset instead of string
+# skip name "C.H. Hochstaetter" partly because it is sometimes written without umlaut
+>242	search/127	Bootsector\ from\ C.H.\ Hochst			
+>>278	search/127	No\ Systemdisk.\ Booting\ from\ harddisk	
+# followed by variants with point,CR-NL or NL-CR
+>>>208	search/261	Cannot\ load\ from\ harddisk.			
+# followed by variants CR-NL or NL-CR
+>>>>236	search/235	Insert\ Systemdisk\ and\ press\ any\ key.	
+# followed by variants with point,CR-NL or NL-CR
+>>>>>180	search/96	Disk\ formatted\ with\ WinImage\ 	\b, WinImage harddisk Bootloader
+# followed by string like "6.50 (c) 1993-2004 Gilles Vollant"
+>>>>>>&0	string		x 					\b, version %-4.4s
 >(1.b+2)	ubyte		0xe			
 >>(1.b+3)	ubyte		0x1f			
 >>>(1.b+4)	ubyte		0xbe			
->>>>(1.b+5)	ubyte		0x77			
->>>>(1.b+6)	ubyte		0x7c			
->>>>>(1.b+7)	ubyte		0xac			
->>>>>>(1.b+8)	ubyte		0x22			
->>>>>>>(1.b+9)	ubyte		0xc0			
->>>>>>>>(1.b+10)	ubyte	0x74			
->>>>>>>>>(1.b+11)	ubyte	0xb			
->>>>>>>>>>(1.b+12)	ubyte	0x56			
->>>>>>>>>>(1.b+13)	ubyte	0xb4			\b, mkdosfs boot message display
+# message offset found at (1.b+5) is 0x77 for FAT32 or 0x5b for others
+>>>>(1.b+5)	ubyte&0xd3	0x53			
+>>>>>(1.b+6)	ubyte		0x7c			
+# assembler instructions: lodsb;and al,al;jz 0xb;push si;mov ah,
+>>>>>>(1.b+7)	ubyte		0xac			
+>>>>>>>(1.b+8)	ubyte		0x22			
+>>>>>>>>(1.b+9)	ubyte		0xc0			
+>>>>>>>>>(1.b+10)	ubyte	0x74			
+>>>>>>>>>>(1.b+11)	ubyte	0x0b			
+>>>>>>>>>>>(1.b+12)	ubyte	0x56			
+>>>>>>>>>>>>(1.b+13)	ubyte	0xb4			\b, mkdosfs boot message display
+# FAT1X version
+>>>>>>>>>>>>>(1.b+5)	ubyte	0x5b			
+>>>>>>>>>>>>>>0x5b	string	>\0			"%-s"
+# FAT32 version
+>>>>>>>>>>>>>(1.b+5)	ubyte	0x77			
+>>>>>>>>>>>>>>0x77	string	>\0			"%-s"
 >214	string	Please\ try\ to\ install\ FreeDOS\ 	\b, DOS Emulator boot message display
 #>>244	string	from\ dosemu-freedos-*-bin.tgz\r	
 #>>>170	string	Sorry,\ could\ not\ load\ an\ 		
@@ -762,6 +912,18 @@
 >>>>>492		string		RENF		\b, FAT (12 bit)
 >>>>>495		string		RENF		\b, FAT (16 bit)
 # x86 bootloader end
+
+# 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
 >3	ubyte	0			
 #no active flag
@@ -776,149 +938,13 @@
 >>>>>>>466	ubyte	0x05			\b, extended partition table
 >>>>>>>466	ubyte	0x0F			\b, extended partition table (LBA)
 >>>>>>>466	ubyte	0x0			\b, extended partition table (last)	
-# JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
-# http://mirror.href.com/thestarman/asm/2bytejumps.htmm#FWD
-# older drives may use Near JuMP instruction E9 xx xx
->0		lelong&0x009000EB	0x009000EB 
->0		lelong&0x000000E9	0x000000E9 
-# minimal short forward jump found 03cx??
-# maximal short forward jump is 07fx
->1		ubyte			<0xff	\b, code offset 0x%x
-# mtools-3.9.8/msdos.h
-# usual values are marked with comments to get only informations of strange FAT systems
-# valid sectorsize must be a power of 2 from 32 to 32768
->>11		uleshort&0x000f	x		
->>>11		uleshort	<32769		
->>>>11		uleshort	>31		
->>>>>21		ubyte&0xf0	0xF0		
->>>>>>3		string		>\0		\b, OEM-ID "%8.8s"
-#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
->>>>>>>8	string		IHC		\b cached by Windows 9M
->>>>>>11	uleshort	>512		\b, Bytes/sector %u
-#>>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
->>>>>>11	uleshort	<512		\b, Bytes/sector %u
->>>>>>13	ubyte		>1		\b, sectors/cluster %u
-#>>>>>>13	ubyte		=1		\b, sectors/cluster %u (usual on Floppies)
->>>>>>14	uleshort	>32		\b, reserved sectors %u
-#>>>>>>14	uleshort	=32		\b, reserved sectors %u (usual Fat32)
-#>>>>>>14	uleshort	>1		\b, reserved sectors %u
-#>>>>>>14	uleshort	=1		\b, reserved sectors %u (usual FAT12,FAT16)
->>>>>>14	uleshort	<1		\b, reserved sectors %u
->>>>>>16	ubyte		>2		\b, FATs %u
-#>>>>>>16	ubyte		=2		\b, FATs %u (usual)
->>>>>>16	ubyte		=1		\b, FAT  %u
->>>>>>16	ubyte		>0
->>>>>>17	uleshort	>0		\b, root entries %u
-#>>>>>>17	uleshort	=0		\b, root entries %u=0 (usual Fat32)
->>>>>>19	uleshort	>0		\b, sectors %u (volumes <=32 MB) 
-#>>>>>>19	uleshort	=0		\b, sectors %u=0 (usual Fat32)
->>>>>>21	ubyte		>0xF0		\b, Media descriptor 0x%x
-#>>>>>>21	ubyte		=0xF0		\b, Media descriptor 0x%x (usual floppy)
->>>>>>21	ubyte		<0xF0		\b, Media descriptor 0x%x
->>>>>>22	uleshort	>0		\b, sectors/FAT %u
-#>>>>>>22	uleshort	=0		\b, sectors/FAT %u=0 (usual Fat32)
->>>>>>26	ubyte		>2		\b, heads %u
-#>>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
->>>>>>26	ubyte		=1		\b, heads %u
-#skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
->>>>>>38	ubyte		!0x70		
->>>>>>>28	ulelong		>0		\b, hidden sectors %u
-#>>>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
->>>>>>>32	ulelong		>0		\b, sectors %u (volumes > 32 MB) 
-#>>>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB)
-# FAT<32 specific 
->>>>>>82	string		!FAT32
-#>>>>>>>36	ubyte		0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
-#>>>>>>>36	ubyte		0		\b, physical drive 0x%x=0 (usual floppy)
->>>>>>>36	ubyte		!0x80		
->>>>>>>>36	ubyte		!0		\b, physical drive 0x%x
->>>>>>>37	ubyte		>0		\b, reserved 0x%x
-#>>>>>>>37	ubyte		=0		\b, reserved 0x%x
->>>>>>>38	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>38	ubyte		<0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>38	ubyte		=0x29
->>>>>>>>39	ulelong		x		\b, serial number 0x%x
->>>>>>>>43	string		<NO\ NAME	\b, label: "%11.11s"
->>>>>>>>43	string		>NO\ NAME	\b, label: "%11.11s"
->>>>>>>>43	string		=NO\ NAME	\b, unlabeled
->>>>>>>54	string		FAT		\b, FAT
->>>>>>>>54	string		FAT12		\b (12 bit)
->>>>>>>>54	string		FAT16		\b (16 bit)
-# FAT32 specific
->>>>>>82	string		FAT32		\b, FAT (32 bit)
->>>>>>>36	ulelong		x		\b, sectors/FAT %u
->>>>>>>40	uleshort	>0		\b, extension flags %u
-#>>>>>>>40	uleshort	=0		\b, extension flags %u
->>>>>>>42	uleshort	>0		\b, fsVersion %u
-#>>>>>>>42	uleshort	=0		\b, fsVersion %u (usual)
->>>>>>>44	ulelong		>2		\b, rootdir cluster %u
-#>>>>>>>44	ulelong		=2		\b, rootdir cluster %u
-#>>>>>>>44	ulelong		=1		\b, rootdir cluster %u
->>>>>>>48	uleshort	>1		\b, infoSector %u
-#>>>>>>>48	uleshort	=1		\b, infoSector %u (usual)
->>>>>>>48	uleshort	<1		\b, infoSector %u
->>>>>>>50	uleshort	>6		\b, Backup boot sector %u
-#>>>>>>>50	uleshort	=6		\b, Backup boot sector %u (usual) 
->>>>>>>50	uleshort	<6		\b, Backup boot sector %u
->>>>>>>54	ulelong		>0		\b, reserved1 0x%x
->>>>>>>58	ulelong		>0		\b, reserved2 0x%x
->>>>>>>62	ulelong		>0		\b, reserved3 0x%x
-# same structure as FAT1X 
->>>>>>>64	ubyte		>0x80		\b, physical drive 0x%x
-#>>>>>>>64	ubyte		=0x80		\b, physical drive 0x%x=80 (usual harddisk)
->>>>>>>64	ubyte&0x7F	>0		\b, physical drive 0x%x
-#>>>>>>>64	ubyte		=0		\b, physical drive 0x%x=0 (usual floppy)
->>>>>>>65	ubyte		>0		\b, reserved 0x%x
->>>>>>>66	ubyte		>0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>66	ubyte		<0x29		\b, dos < 4.0 BootSector (0x%x)
->>>>>>>66	ubyte		=0x29
->>>>>>>>67	ulelong		x		\b, serial number 0x%x
->>>>>>>>71	string		<NO\ NAME	\b, label: "%11.11s"
->>>>>>>71	string		>NO\ NAME	\b, label: "%11.11s"
->>>>>>>71	string		=NO\ NAME	\b, unlabeled
-### FATs end
+
+# DOS x86 sector separated and moved from "x86 boot sector" by Joerg Jenderek at May 2011
+
 >0x200	lelong	0x82564557		\b, BSD disklabel
 # FATX 
 0		string		FATX		FATX filesystem data
 
-
-# Minix filesystems - Juan Cespedes <cespedes@debian.org>
-0x410	leshort		0x137f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x137f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1 (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x138f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x138f
-!:strength / 2
->0x402	beshort		< 100		Minix filesystem, V1, 30 char names (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x2468
->0x402	beshort		< 100		Minix filesystem, V2, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x2468
->0x402	beshort		< 100		Minix filesystem, V2 (big endian), %d zones
->0x1e	string		minix		\b, bootable
-
-0x410	leshort		0x2478
->0x402	beshort		< 100		Minix filesystem, V2, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x2478
->0x402	beshort		< 100		Minix filesystem, V2, 30 char names, %d zones
->0x1e	string		minix		\b, bootable
-0x410	beshort		0x2478
->0x402	beshort		!0		Minix filesystem, V2, 30 char names (big endian), %d zones
->0x1e	string		minix		\b, bootable
-0x410	leshort		0x4d5a
->0x402	beshort		!0		Minix filesystem, V3, %d zones
->0x1e	string		minix		\b, bootable
-
 # romfs filesystems - Juan Cespedes <cespedes@debian.org>
 0	string		-rom1fs-	romfs filesystem, version 1
 >8	belong	x			%d bytes,
@@ -933,12 +959,141 @@
 
 0x18b	string	OS/2	OS/2 Boot Manager
 
-# updated by Joerg Jenderek at Oct 2008!!
+# updated by Joerg Jenderek at Oct 2008 and Sep 2012
 # http://syslinux.zytor.com/iso.php
-0	ulelong	0x7c40eafa		isolinux Loader
+# tested with versions 1.47,1.48,1.49,1.50,1.62,1.76,2.00,2.10;3.00,3.11,3.31,;3.70,3.71,3.73,3.75,3.80,3.82,3.84,3.86,4.01,4.03 and 4.05
+# assembler instructions: cli;jmp 0:7Cyy (yy=0x40,0x5e,0x6c,0x6e,0x77);nop;nop
+0	ulequad&0x909000007cc0eafa	0x909000007c40eafa	
+>631	search/689	ISOLINUX\ 	isolinux Loader
+>>&0	string		x		(version %-4.4s)
 # http://syslinux.zytor.com/pxe.php
-0	ulelong	0x007c05ea		pxelinux Loader
-0	ulelong	0x60669c66		pxelinux Loader
+# assembler instructions: jmp 7C05
+0	ulelong	0x007c05ea		pxelinux loader (version 2.13 or older)
+# assembler instructions: pushfd;pushad
+0	ulelong	0x60669c66		pxelinux loader
+# assembler instructions: jmp 05
+0	ulelong	0xc00005ea		pxelinux loader (version 3.70 or newer)
+# http://syslinux.zytor.com/wiki/index.php/SYSLINUX
+0	string	LDLINUX\ SYS\ 		SYSLINUX loader
+>12	string	x			(older version %-4.4s)
+0	string	\r\nSYSLINUX\ 		SYSLINUX loader
+>11	string	x			(version %-4.4s)
+# syslinux updated and separated from "x86 boot sector" by Joerg Jenderek at Sep 2012
+# assembler instructions: jmp yy (yy=0x3c,0x58);nop;"SYSLINUX"
+0	ulelong&0x80909bEB	0x009018EB	
+# OEM-ID not always "SYSLINUX"
+>434	search/47	Boot\ failed		
+# followed by \r\n\0 or :\ 
+>>482	search/132	\0LDLINUX\ SYS		Syslinux bootloader (version 2.13 or older)
+>>1	ubyte		0x58			Syslinux bootloader (version 3.0-3.9)
+>459	search/30	Boot\ error\r\n\0	
+>>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
+# assembler instructions: mov di,0600h;mov cx,0100h
+16	search/4	\xbf\x00\x06\xb9\x00\x01		
+>94	search/249	Missing\ operating\ system		
+# followed by \r for versions older 3.35 , .\r for versions newer 3.52 and point for other
+# skip Ranish MBR
+>>408	search/4	HD1/\0	 				
+>>408	default		x					
+>>>250	search/118	\0Operating\ system\ load		SYSLINUX MBR
+# followed by "ing " or space
+>>>>292	search/98	error   				
+>>>>>&0	string		\r		    			(version 3.35 or older)
+>>>>>&0	string		.\r					(version 3.52 or newer)
+>>>>>&0	default		x					(version 3.36-3.51 )
+>368	search/106	\0Disk\ error\ on\ boot\r\n		SYSLINUX GPT-MBR
+>>156	search/10	\0Boot\ partition\ not\ found\r\n	
+>>>270	search/10	\0OS\ not\ bootable\r\n			(version 3.86 or older)
+>>174	search/10	\0Missing\ OS\r\n			
+>>>189	search/10	\0Multiple\ active\ partitions\r\n	(version 4.00 or newer)
+# SYSLINUX END
+
+# NetBSD mbr variants (master-boot-code version 1.22) added by Joerg Jenderek at Nov 2012
+# assembler instructions: xor ax,ax;mov	ax,ss;mov sp,0x7c00;mov	ax,
+0	ubequad		0x31c08ed0bc007c8e			
+# mbr_bootsel magic before partition table not reliable with small ipl fragments
+#>444	uleshort	0xb5e1					
+>0004	uleshort	x					
+# ERRorTeXT
+>>181	search/166		Error\ \0\r\n				NetBSD mbr
+# NT Drive Serial Number http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm#DS
+>>>0x1B8	ubelong		>0					\b,Serial 0x%-.8x
+# BOOTSEL definitions contains assembler instructions: int 0x13;pop dx;push dx;push dx
+>>>0xbb		search/71	\xcd\x13\x5a\x52\x52			\b,bootselector
+# BOOT_EXTENDED definitions contains assembler instructions: 
+# xchg ecx,edx;addl ecx,edx;movw lba_info,si;movb 0x42,ah;pop dx;push dx;int 0x13
+>>>0x96	search/1	\x66\x87\xca\x66\x01\xca\x66\x89\x16\x3a\x07\xbe\x32\x07\xb4\x42\x5a\x52\xcd\x13	\b,boot extended
+# COM_PORT_VAL definitions contains assembler instructions: outb al,dx;add 5,dl;inb %dx;test 0x40,al
+>>>0x130	search/55	\xee\x80\xc2\x05\xec\xa8\x40		\b,serial IO
+# not TERSE_ERROR
+>>>196		search/106	No\ active\ partition\0			
+>>>>&0		string		Disk\ read\ error\0			
+>>>>>&0		string		No\ operating\ system\0			\b,verbose
+# not NO_CHS definitions contains assembler instructions: pop dx;push dx;movb $8,ah;int0x13
+>>>0x7d		search/7	\x5a\x52\xb4\x08\xcd\x13		\b,CHS
+# not NO_LBA_CHECK definitions contains assembler instructions: movw 0x55aa,bx;movb 0x41,ah;pop	dx;push	dx;int 0x13
+>>>0xa4		search/84	\xbb\xaa\x55\xb4\x41\x5a\x52\xcd\x13	\b,LBA-check
+# assembler instructions: movw nametab,bx
+>>>0x26	    search/21	\xBB\x94\x07					
+# not NO_BANNER definitions contains assembler instructions: mov banner,si;call message_crlf
+>>>>&-9	ubequad&0xBE00f0E800febb94	0xBE0000E80000bb94		
+>>>>>181	search/166		Error\ \0			
+# "a: disk" , "Fn: diskn" or "NetBSD MBR boot"
+>>>>>>&3	string			x				\b,"%s"
+# Andrea Mazzoleni AdvanceCD mbr loader of http://advancemame.sourceforge.net/boot-readme.html
+# added by Joerg Jenderek at Nov 2012 for versions 1.3 - 1.4
+# assembler instructions: jmp short 0x58;nop;ASCII
+0	ubequad&0xeb58908000000000	0xeb58900000000000	
+# assembler instructions: cli;xor ax,ax;mov ds,ax;mov es,ax;mov ss,
+>(1.b+2)	ubequad			0xfa31c08ed88ec08e	
+# Error messages at end of code
+>>376		string	No\ operating\ system\r\n\0		
+>>>398		string	Disk\ error\r\n\0FDD\0HDD\0		
+>>>>419		string	\ EBIOS\r\n\0				AdvanceMAME mbr
+
+# Neil Turton mbr loader variant of http://www.chiark.greenend.org.uk/~neilt/mbr/ 
+# added by Joerg Jenderek at Mar 2011 for versions 1.0.0 - 1.1.11
+# for 1st version assembler instructions:	cld;xor ax,ax;mov DS,ax;MOV ES,AX;mov SI,
+# or  	  	  	    			cld;xor ax,ax;mov SS,ax;XOR SP,SP;mov DS,
+0	ulequad&0xcE1b40D48EC031FC	0x8E0000D08EC031FC	
+# pointer to the data starting with Neil Turton signature string
+>(0x1BC.s)		string		NDTmbr			
+>>&-14			string		1234F\0			Turton mbr (
+# parameters also viewed by install-mbr --list
+>>>(0x1BC.s+7)		ubyte		x			\b%u<=
+>>>(0x1BC.s+9)		ubyte		x			\bVersion<=%u
+#>>>(0x1BC.s+8)		ubyte		x			asm_flag_%x
+>>>(0x1BC.s+8)		ubyte&1		1			\b,Y2K-Fix
+# variant used by testdisk of http://www.cgsecurity.org/wiki/Menu_MBRCode
+>>>(0x1BC.s+8)		ubyte&2		2			\b,TestDisk
+#0x1~1,..,0x8~4,0x10~F,0x80~A enabled
+#>>>(0x1BC.s+10)		ubyte		x			\b,flags 0x%x
+#0x0~1,0x1~2,...,0x3~4,0x4~F,0x7~D default boot
+#>>>(0x1BC.s+11)		ubyte		x			\b,cfg_def 0x%x
+# for older versions
+>>>(0x1BC.s+9)		ubyte		<2			
+#>>>>(0x1BC.s+12)	ubyte		18			\b,%u/18 seconds
+>>>>(0x1BC.s+12)	ubyte		!18			\b,%u/18 seconds
+# floppy A: or B:
+>>>>(0x1BC.s+13)	ubyte		<2			\b,floppy 0x%x
+>>>>(0x1BC.s+13)	ubyte		>1			
+# 1st hard disc
+#>>>>>(0x1BC.s+13)	ubyte		0x80			\b,drive 0x%x
+# not 1st hard disc
+>>>>>(0x1BC.s+13)	ubyte		!0x80			\b,drive 0x%x
+# for version >= 2 maximal timeout can be 65534
+>>>(0x1BC.s+9)		ubyte		>1			
+#>>>>(0x1BC.s+12)	uleshort	18			\b,%u/18 seconds
+>>>>(0x1BC.s+12)	uleshort	!18			\b,%u/18 seconds
+# floppy A: or B:
+>>>>(0x1BC.s+14)	ubyte		<2			\b,floppy 0x%x
+>>>>(0x1BC.s+14)	ubyte		>1			
+# 1st hard disc
+#>>>>>(0x1BC.s+14)	ubyte		0x80			\b,drive 0x%x
+# not 1st hard disc
+>>>>>(0x1BC.s+14)	ubyte		!0x80			\b,drive 0x%x
+>>>0	ubyte		x					\b)
 
 # added by Joerg Jenderek
 # In the second sector (+0x200) are variables according to grub-0.97/stage2/asm.S or
@@ -995,6 +1150,178 @@
 >>>>>0x217 	ulong		!0xffffffff	
 >>>>>>0x217 	string		>\0		\b, configuration file %-s
 
+# DOS x86 sector updated and separated from "x86 boot sector" by Joerg Jenderek at May 2011
+# JuMP short     bootcodeoffset NOP assembler instructions will usually be EB xx 90
+# over BIOS parameter block (BPB)
+# http://thestarman.pcministry.com/asm/2bytejumps.htm#FWD
+# older drives may use Near JuMP instruction E9 xx xx
+# minimal short forward jump found 0x29 for bootloaders or 0x0
+# maximal short forward jump is 0x7f
+# OEM-ID is empty or contain readable bytes
+0		ulelong&0x804000E9	0x000000E9	
+# mtools-3.9.8/msdos.h
+# usual values are marked with comments to get only informations of strange FAT systems
+# valid sectorsize must be a power of 2 from 32 to 32768
+>11		uleshort&0xf001f	0	
+>>11		uleshort	<32769		
+>>>11		uleshort	>31		
+>>>>21		ubyte&0xf0	0xF0		
+>>>>>0		ubyte		0xEB		
+>>>>>>1		ubyte		x		\b, code offset 0x%x+2
+>>>>>0		ubyte		0xE9		
+>>>>>>1		uleshort	x		\b, code offset 0x%x+2
+>>>>>3		string		>\0		\b, OEM-ID "%-.8s"
+#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
+>>>>>>8		string		IHC		\b cached by Windows 9M
+>>>>>11		uleshort	>512		\b, Bytes/sector %u
+#>>>>>11	uleshort	=512		\b, Bytes/sector %u=512 (usual)
+>>>>>11		uleshort	<512		\b, Bytes/sector %u
+>>>>>13		ubyte		>1		\b, sectors/cluster %u
+#>>>>>13	ubyte		=1		\b, sectors/cluster %u (usual on Floppies)
+>>>>>82		string		FAT32		
+>>>>>>14	uleshort	!32		\b, reserved sectors %u
+#>>>>>>14	uleshort	=32		\b, reserved sectors %u (usual Fat32)
+>>>>>82		string		!FAT32		
+>>>>>>14	uleshort	>1		\b, reserved sectors %u
+#>>>>>>14	uleshort	=1		\b, reserved sectors %u (usual FAT12,FAT16)
+#>>>>>>14	uleshort	0		\b, reserved sectors %u (usual NTFS)
+>>>>>16		ubyte		>2		\b, FATs %u
+#>>>>>16	ubyte		=2		\b, FATs %u (usual)
+>>>>>16		ubyte		=1		\b, FAT  %u
+>>>>>16		ubyte		>0
+>>>>>17		uleshort	>0		\b, root entries %u
+#>>>>>17	uleshort	=0		\b, root entries %u=0 (usual Fat32)
+>>>>>19		uleshort	>0		\b, sectors %u (volumes <=32 MB) 
+#>>>>>19	uleshort	=0		\b, sectors %u=0 (usual Fat32)
+>>>>>21		ubyte		>0xF0		\b, Media descriptor 0x%x
+#>>>>>21	ubyte		=0xF0		\b, Media descriptor 0x%x (usual floppy)
+>>>>>21		ubyte		<0xF0		\b, Media descriptor 0x%x
+>>>>>22		uleshort	>0		\b, sectors/FAT %u
+#>>>>>22	uleshort	=0		\b, sectors/FAT %u=0 (usual Fat32)
+>>>>>24		uleshort	x		\b, sectors/track %u
+>>>>>26		ubyte		>2		\b, heads %u
+#>>>>>26	ubyte		=2		\b, heads %u (usual floppy)
+>>>>>26		ubyte		=1		\b, heads %u
+# valid only for sector sizes with more then 32 Bytes
+>>>>>11		uleshort	>32		
+# skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
+>>>>>>38	ubyte		!0x70		
+>>>>>>>28	ulelong		>0		\b, hidden sectors %u
+#>>>>>>>28	ulelong		=0		\b, hidden sectors %u (usual floppy)
+>>>>>>>32	ulelong		>0		\b, sectors %u (volumes > 32 MB) 
+#>>>>>>>32	ulelong		=0		\b, sectors %u (volumes > 32 MB)
+# FAT<32 bit specific 
+>>>>>>>82	string		!FAT32
+#>>>>>>>>36	ubyte		0x80		\b, physical drive 0x%x=0x80 (usual harddisk)
+#>>>>>>>>36	ubyte		0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>>>>36	ubyte		!0x80		
+>>>>>>>>>36	ubyte		!0		\b, physical drive 0x%x
+>>>>>>>>37	ubyte		>0		\b, reserved 0x%x
+#>>>>>>>>37	ubyte		=0		\b, reserved 0x%x
+# value is 0x80 for NTFS
+>>>>>>>>38	ubyte		!0x29		\b, dos < 4.0 BootSector (0x%x)
+>>>>>>>>38	ubyte		=0x29
+>>>>>>>>>39	ulelong		x		\b, serial number 0x%x
+>>>>>>>>>43	string		<NO\ NAME	\b, label: "%11.11s"
+>>>>>>>>>43	string		>NO\ NAME	\b, label: "%11.11s"
+>>>>>>>>>43	string		=NO\ NAME	\b, unlabeled
+# there exist some old floppies without word FAT at offset 54
+# a word like "FATnm   " is only a hint for a FAT size on nm-bits
+# Normally the number of clusters is calculated by the values of BPP.
+# if it is small enough FAT is 12 bit, if it is too big enough FAT is 32 bit,
+# otherwise FAT is 16 bit.
+# http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-fat-widths.html
+>>>>>>54	string		FAT		\b, FAT
+>>>>>>>54	string		FAT12		\b (12 bit)
+>>>>>>>54	string		FAT16		\b (16 bit)
+# FAT32 bit specific
+>>>>>82		string		FAT32		\b, FAT (32 bit)
+>>>>>>36	ulelong		x		\b, sectors/FAT %u
+# http://technet.microsoft.com/en-us/library/cc977221.aspx
+>>>>>>40	uleshort	>0		\b, extension flags 0x%x
+#>>>>>>40	uleshort	=0		\b, extension flags %u
+>>>>>>42	uleshort	>0		\b, fsVersion %u
+#>>>>>>42	uleshort	=0		\b, fsVersion %u (usual)
+>>>>>>44	ulelong		>2		\b, rootdir cluster %u
+#>>>>>>44	ulelong		=2		\b, rootdir cluster %u
+#>>>>>>44	ulelong		=1		\b, rootdir cluster %u
+>>>>>>48	uleshort	>1		\b, infoSector %u
+#>>>>>>48	uleshort	=1		\b, infoSector %u (usual)
+>>>>>>48	uleshort	<1		\b, infoSector %u
+>>>>>>50	uleshort	>6		\b, Backup boot sector %u
+#>>>>>>50	uleshort	=6		\b, Backup boot sector %u (usual) 
+>>>>>>50	uleshort	<6		\b, Backup boot sector %u
+# corrected by Joerg Jenderek at Feb 2011 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO
+>>>>>>52	ulelong		>0		\b, reserved1 0x%x
+>>>>>>56	ulelong		>0		\b, reserved2 0x%x
+>>>>>>60	ulelong		>0		\b, reserved3 0x%x
+# same structure as FAT1X 
+#>>>>>>64	ubyte		=0x80		\b, physical drive 0x%x=80 (usual harddisk)
+#>>>>>>64	ubyte		=0		\b, physical drive 0x%x=0 (usual floppy)
+>>>>>>64	ubyte		!0x80		
+>>>>>>>64	ubyte		>0		\b, physical drive 0x%x
+# in Windows NT bit 0 is a dirty flag to request chkdsk at boot time. bit 1 requests surface scan too
+>>>>>>65	ubyte		>0		\b, reserved 0x%x
+>>>>>>66	ubyte		!0x29		\b, dos < 4.0 BootSector (0x%x)
+>>>>>>66	ubyte		=0x29
+>>>>>>>67	ulelong		x		\b, serial number 0x%x
+>>>>>>>71	string		<NO\ NAME	\b, label: "%11.11s"
+>>>>>>>71	string		>NO\ NAME	\b, label: "%11.11s"
+>>>>>>>71	string		=NO\ NAME	\b, unlabeled
+# additional tests for floppy image added by Joerg Jenderek
+# no fixed disk 
+>>>>>21		ubyte		!0xF8		
+# floppy media with 12 bit FAT
+>>>>>>54	string		!FAT16		
+# test for FAT after bootsector
+>>>>>>>(11.s)	ulelong&0x00ffffF0	0x00ffffF0	\b, followed by FAT
+# floppy image
+!:mime application/x-ima
+# NTFS specific added by Joerg Jenderek at Mar 2011 according to http://thestarman.pcministry.com/asm/mbr/NTFSBR.htm
+# and http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/bios-parameter-block.html
+# 0 FATs
+>>>>>16	ubyte		=0		
+# 0 root entries
+>>>>>>17	uleshort	=0		
+# 0 DOS sectors
+>>>>>>>19	uleshort	=0		
+# 0 sectors/FAT
+# dos < 4.0 BootSector value found is 0x80
+#38	ubyte		=0x80			\b, dos < 4.0 BootSector (0x%x)
+>>>>>>>>22	uleshort	=0		\b; NTFS
+>>>>>>>>>24	uleshort	>0		\b, sectors/track %u
+>>>>>>>>>36	ulelong		!0x800080	\b, physical drive 0x%x
+>>>>>>>>>40	ulequad		>0		\b, sectors %lld
+>>>>>>>>>48	ulequad		>0		\b, $MFT start cluster %lld
+>>>>>>>>>56	ulequad		>0		\b, $MFTMirror start cluster %lld
+# Values 0 to 127 represent MFT record sizes of 0 to 127 clusters.
+# Values 128 to 255 represent MFT record sizes of 2^(256-N) bytes. 
+>>>>>>>>>64	lelong		<256		
+>>>>>>>>>>64	lelong		<128		\b, clusters/RecordSegment %d
+>>>>>>>>>>64	ubyte		>127		\b, bytes/RecordSegment 2^(-1*%hhi)
+# Values 0 to 127 represent index block sizes of 0 to 127 clusters.
+# Values 128 to 255 represent index block sizes of 2^(256-N) byte
+>>>>>>>>>68	ulelong		<256		
+>>>>>>>>>>68	ulelong		<128		\b, clusters/index block %d
+#>>>>>>>>>>68	ulelong		>127		\b, bytes/index block 2^(256-%d)
+>>>>>>>>>>68	ubyte		>127		\b, bytes/index block 2^(-1*%hhi)
+>>>>>>>>>72	ulequad		x		\b, serial number 0%llx
+>>>>>>>>>80	ulelong		>0		\b, checksum 0x%x
+#>>>>>>>>>80	ulelong		=0		\b, checksum 0x%x=0 (usual)
+>>>>>>>>>0x258	ulelong&0x00009090	=0x00009090	
+>>>>>>>>>>&-92		indirect	x	\b; contains 
+# For 2nd NTFS sector added by Joerg Jenderek at Jan 2013
+# http://thestarman.pcministry.com/asm/mbr/NTFSbrHexEd.htm
+# unused assembler instructions JMP y2;NOP;NOP
+0x056		ulelong&0xFFFF0FFF	0x909002EB	
+# unicode loadername terminated by CTRL-D
+>(0.s*2)	ulelong&0xFFFFFF00	0x00040000		
+# loadernames are NTLDR,CMLDR,PELDR,$LDR$ or BOOTMGR
+>>0x002		lestring16	x	Microsoft Windows XP/VISTA bootloader %-5.5s
+>>0x12		string		$	
+>>>0x0c		lestring16	x	\b%-2.2s
+### DOS,NTFS boot sectors end
+
 9564	lelong		0x00011954	Unix Fast File system [v1] (little-endian),
 >8404	string		x		last mounted on %s,
 #>9504	ledate		x		last checked at %s,
@@ -1157,6 +1484,51 @@
 #>0x464	lelong          &0x0000020      (many subdirs)
 #>0x463	lelong          &0x0000040      (extra isize)
 
+# Minix filesystems - Juan Cespedes <cespedes@debian.org>
+0x410	leshort		0x137f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x137f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1 (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x138f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x138f
+!:strength / 2
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V1, 30 char names (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x2468
+>0x402	beshort		< 100
+>>0x402	beshort		> -1		Minix filesystem, V2, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x2468
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2 (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+
+0x410	leshort		0x2478
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x2478
+>0x402	beshort		< 100
+>0x402	beshort		> -1		Minix filesystem, V2, 30 char names, %d zones
+>0x1e	string		minix		\b, bootable
+0x410	beshort		0x2478
+>0x402	beshort		!0		Minix filesystem, V2, 30 char names (big endian), %d zones
+>0x1e	string		minix		\b, bootable
+0x410	leshort		0x4d5a
+>0x402	beshort		!0		Minix filesystem, V3, %d zones
+>0x1e	string		minix		\b, bootable
+
 # SGI disk labels - Nathan Scott <nathans@debian.org>
 0	belong		0x0BE5A941	SGI disk label (volume header)
 
@@ -1226,8 +1598,8 @@
 #        10	SS, 8 SPT
 #        11	DS, 8 SPT
 #
-#  11111001	Double density 3½ floppy disk, high density 5¼
-#  11110000	High density 3½ floppy disk
+#  11111001	Double density 3 1/2 floppy disk, high density 5 1/4
+#  11110000	High density 3 1/2 floppy disk
 #  11111000	Hard disk any format
 #
 
@@ -1243,7 +1615,7 @@
 >>38917	byte     >0x33      (unknown version, ID 0x%X)
 >>38917	byte     <0x31      (unknown version, ID 0x%X)
 # "application id" which appears to be used as a volume label
->32808	string    >\0       '%s'
+>32808	string/T  >\0       '%s'
 >34816	string    \000CD001\001EL\ TORITO\ SPECIFICATION    (bootable)
 37633	string    CD001     ISO 9660 CD-ROM filesystem data (raw 2352 byte sectors)
 !:mime	application/x-iso9660-image
@@ -1414,8 +1786,6 @@
 >28 leshort >3
 >>8	ledate	x	created: %s
 
-0	string		td\000		floppy image data (TeleDisk)
-
 # AFS Dump Magic
 # From: Ty Sarna <tsarna@sarna.org> 
 0       string                  \x01\xb3\xa1\x13\x22    AFS Dump
@@ -1569,3 +1939,41 @@
 >>&8	lelong	x	\b, blocksize %d
 >>&32	lelong&0x00000006	>0	(dirty)
 >>&36	lelong	>0	(compressed)
+
+# LFS
+0	lelong	0x070162	LFS filesystem image
+>4	lelong	1		version 1,
+>>8	lelong	x		\b blocks %u,
+>>12	lelong	x		\b blocks per segment %u,
+>4	lelong	2		version 2,
+>>8	lelong	x		\b fragments %u,
+>>12	lelong	x		\b bytes per segment %u,
+>16	lelong	x		\b disk blocks %u,
+>20	lelong	x		\b block size %u,
+>24	lelong	x		\b fragment size %u,
+>28	lelong	x		\b fragments per block %u,
+>32	lelong	x		\b start for free list %u,
+>36	lelong	x		\b number of free blocks %d,
+>40	lelong	x		\b number of files %u,
+>44	lelong	x		\b blocks available for writing %d,
+>48	lelong	x		\b inodes in cache %d,
+>52	lelong	x		\b inode file disk address 0x%x,
+>56	lelong	x		\b inode file inode number %u,
+>60	lelong	x		\b address of last segment written 0x%x,
+>64	lelong	x		\b address of next segment to write 0x%x,
+>68	lelong	x		\b address of current segment written 0x%x
+
+0	string	td\000		floppy image data (TeleDisk, compressed)
+0	string	TD\000		floppy image data (TeleDisk)
+
+0	string	CQ\024		floppy image data (CopyQM, 
+>16	leshort	x		%d sectors, 
+>18	leshort	x		%d heads.)
+
+0	string	ACT\020Apricot\020disk\020image\032\004	floppy image data (ApriDisk)
+
+0	beshort	0xAA58		floppy image data (IBM SaveDskF, old)
+0	beshort	0xAA59		floppy image data (IBM SaveDskF)
+0	beshort	0xAA5A		floppy image data (IBM SaveDskF, compressed)
+
+0	string	\074CPM_Disk\076	disk image data (YAZE)

+ 10 - 2
magic/Magdir/fonts

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.23 2010/09/20 18:55:20 rrt Exp $
+# $File: fonts,v 1.25 2013/02/06 14:18:52 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0	search/1	FONT		ASCII vfont text
@@ -75,7 +75,7 @@
 0	string		OTTO		OpenType font data
 !:mime application/vnd.ms-opentype
 
-# Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu 
+# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu 
 0	string		SplineFontDB:	Spline Font Database 
 !:mime application/vnd.font-fontforge-sfd
 >14	string		x		version %s
@@ -83,3 +83,11 @@
 # EOT
 34	string		LP		Embedded OpenType (EOT)
 !:mime application/vnd.ms-fontobject
+
+# Web Open Font Format (.woff)
+# http://www.w3.org/TR/WOFF/
+0	string		wOFF	Web Open Font Format
+>4	belong		x	\b, flavor %d
+>8	belong		x	\b, length %d
+>20	beshort		x	\b, version %hd
+>22	beshort		x	\b.%hd

+ 2 - 1
magic/Magdir/fortran

@@ -1,6 +1,7 @@
 
 #------------------------------------------------------------------------------
-# $File: fortran,v 1.6 2009/09/19 16:28:09 christos Exp $
+# $File: fortran,v 1.7 2012/06/21 01:55:02 christos Exp $
 # FORTRAN source
 0	regex/100	\^[Cc][\ \t]	FORTRAN program
 !:mime	text/x-fortran
+!:strength - 5

+ 13 - 1
magic/Magdir/geo

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: geo,v 1.1 2010/02/23 23:40:07 christos Exp $
+# $File: geo,v 1.3 2013/01/04 00:47:02 christos Exp $
 # Geo- files from Kurt Schwehr <schwehr@ccom.unh.edu>
 
 ######################################################################
@@ -103,3 +103,15 @@
 
 # https://midas.psi.ch/elog/
 0	string	$@MID@$	elog journal entry
+
+# Geospatial Designs http://www.geospatialdesigns.com/surfer6_format.htm
+0	string		DSBB	Surfer 6 binary grid file
+>4	leshort		x	\b, %d
+>6	leshort		x	\bx%d
+>8	ledouble	x	\b, minx=%g
+>16	ledouble	x	\b, maxx=%g
+>24	ledouble	x	\b, miny=%g
+>32	ledouble	x	\b, maxy=%g
+>40	ledouble	x	\b, minz=%g
+>48	ledouble	x	\b, maxz=%g
+

+ 59 - 0
magic/Magdir/gnome

@@ -0,0 +1,59 @@
+
+#------------------------------------------------------------------------------
+# $File: gnome,v 1.3 2013/02/05 15:20:47 christos Exp $
+# GNOME related files
+
+# Contributed by Josh Triplett
+# FIXME: Could be simplified if pstring supported two-byte counts
+0         string   GnomeKeyring\n\r\0\n GNOME keyring
+>&0       ubyte    0                    \b, major version 0
+>>&0      ubyte    0                    \b, minor version 0
+>>>&0     ubyte    0                    \b, crypto type 0 (AES)
+>>>&0     ubyte    >0                   \b, crypto type %hhu (unknown)
+>>>&1     ubyte    0                    \b, hash type 0 (MD5)
+>>>&1     ubyte    >0                   \b, hash type %hhu (unknown)
+>>>&2     ubelong  0xFFFFFFFF           \b, name NULL
+>>>&2     ubelong  !0xFFFFFFFF
+>>>>&-4   ubelong  >255                 \b, name too long for file's pstring type
+>>>>&-4   ubelong  <256
+>>>>>&-1  pstring  x                    \b, name "%s"
+>>>>>>&0  ubeqdate x                    \b, last modified %s
+>>>>>>&8  ubeqdate x                    \b, created %s
+>>>>>>&16 ubelong  &1
+>>>>>>>&0 ubelong  x                    \b, locked if idle for %u seconds
+>>>>>>&16 ubelong  ^1                   \b, not locked if idle
+>>>>>>&24 ubelong  x                    \b, hash iterations %u
+>>>>>>&28 ubequad  x                    \b, salt %llu
+>>>>>>&52 ubelong  x                    \b, %u item(s)
+
+# From: Alex Beregszaszi <alex@fsn.hu>
+4	string	gtktalog		GNOME Catalogue (gtktalog)
+>13	string	>\0			version %s
+
+# Summary: GStreamer binary registry
+# Extension: .bin
+# Submitted by: Josh Triplett <josh@joshtriplett.org>
+0	belong	0xc0def00d		GStreamer binary registry
+>4	string	x			\b, version %s
+
+# GVariant Database file
+# By Elan Ruusamae <glen@delfi.ee>
+# https://github.com/GNOME/gvdb/blob/master/gvdb-format.h
+# It's always "GVariant", it's byte swapped on incompatible archs
+# See https://github.com/GNOME/gvdb/blob/master/gvdb-builder.c
+# file_builder_serialise()
+# http://developer.gnome.org/glib/2.34/glib-GVariant.html#GVariant
+0	string	GVariant	GVariant Database file,
+# version is never filled. probably future extension
+>8	lelong	x		version %d
+# not sure are these usable, so commented out
+#>>16	lelong	x		start %d,
+#>>>20	lelong	x		end %d
+
+# G-IR database made by gobject-introspect toolset,
+# http://live.gnome.org/GObjectIntrospection
+0	string		GOBJ\nMETADATA\r\n\032	G-IR binary database
+>16	byte		x			\b, v%d
+>17	byte		x			\b.%d
+>20	leshort		x			\b, %d entries
+>22	leshort		x			\b/%d local

+ 0 - 26
magic/Magdir/gnome-keyring

@@ -1,26 +0,0 @@
-
-#------------------------------------------------------------------------------
-# $File: gnome-keyring,v 1.2 2009/09/19 16:28:09 christos Exp $
-# GNOME keyring
-# Contributed by Josh Triplett
-# FIXME: Could be simplified if pstring supported two-byte counts
-0         string   GnomeKeyring\n\r\0\n GNOME keyring
->&0       ubyte    0                    \b, major version 0
->>&0      ubyte    0                    \b, minor version 0
->>>&0     ubyte    0                    \b, crypto type 0 (AEL)
->>>&0     ubyte    >0                   \b, crypto type %hhu (unknown)
->>>&1     ubyte    0                    \b, hash type 0 (MD5)
->>>&1     ubyte    >0                   \b, hash type %hhu (unknown)
->>>&2     ubelong  0xFFFFFFFF           \b, name NULL
->>>&2     ubelong  !0xFFFFFFFF
->>>>&-4   ubelong  >255                 \b, name too long for file's pstring type
->>>>&-4   ubelong  <256
->>>>>&-1  pstring  x                    \b, name "%s"
->>>>>>&0  ubeqdate x                    \b, last modified %s
->>>>>>&8  ubeqdate x                    \b, created %s
->>>>>>&16 ubelong  &1
->>>>>>>&0 ubelong  x                    \b, locked if idle for %u seconds
->>>>>>&16 ubelong  ^1                   \b, not locked if idle
->>>>>>&24 ubelong  x                    \b, hash iterations %u
->>>>>>&28 ubequad  x                    \b, salt %llu
->>>>>>&52 ubelong  x                    \b, %u item(s)

+ 16 - 1
magic/Magdir/gnu

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: gnu,v 1.13 2012/01/03 17:16:54 christos Exp $
+# $File: gnu,v 1.14 2012/10/03 23:38:12 christos Exp $
 # gnu:  file(1) magic for various GNU tools
 #
 # GNU nlsutils message catalog file format
@@ -37,6 +37,21 @@
 0       beshort         0x9901                  GPG key public ring
 !:mime	application/x-gnupg-keyring
 
+# Symmetric encryption
+0	leshort		0x0d8c
+>4	leshort		0x0203
+>>2	leshort		0x0204		GPG symmetrically encrypted data (3DES cipher)
+>>2	leshort		0x0304		GPG symmetrically encrypted data (CAST5 cipher)
+>>2	leshort		0x0404		GPG symmetrically encrypted data (BLOWFISH cipher)
+>>2	leshort		0x0704		GPG symmetrically encrypted data (AES cipher)
+>>2	leshort		0x0804		GPG symmetrically encrypted data (AES192 cipher)
+>>2	leshort		0x0904		GPG symmetrically encrypted data (AES256 cipher)
+>>2	leshort		0x0a04		GPG symmetrically encrypted data (TWOFISH cipher)
+>>2	leshort		0x0b04		GPG symmetrically encrypted data (CAMELLIA128 cipher)
+>>2	leshort		0x0c04		GPG symmetrically encrypted data (CAMELLIA192 cipher)
+>>2	leshort		0x0d04		GPG symmetrically encrypted data (CAMELLIA256 cipher)
+
+
 # Gnumeric spreadsheet
 # This entry is only semi-helpful, as Gnumeric compresses its files, so
 # they will ordinarily reported as "compressed", but at least -z helps

+ 241 - 0
magic/Magdir/gpt

@@ -0,0 +1,241 @@
+
+#------------------------------------------------------------------------------
+# $File: gpt,v 1.1 2013/02/18 18:31:09 christos Exp $
+#
+# GPT Partition table patterns.
+# Author: Rogier Goossens (goossens.rogier@gmail.com)
+# Note that a GPT-formatted disk must contain an MBR as well.
+#
+
+# The initial segment (up to >>>>>>>>422) was copied from the X86
+# partition table code (aka MBR).
+# This is kept separate, so that MBR partitions are not reported as well.
+# (use -k if you do want them as well)
+
+# First, detect the MBR partiton table
+# If more than one GPT protective MBR partition exists, don't print anything
+# (the other MBR detection code will then just print the MBR partition table)
+0x1FE			leshort		0xAA55
+>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
+# GPT with protective MBR entry in partition 1 (only)
+>>>>>>>>>450		ubyte		0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>446	use		gpt-mbr-partition
+>>>>>>>>>>>>>(454.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(454.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(454.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(454.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(454.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(454.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(454.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(454.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(454.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 2 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>462	use		gpt-mbr-partition
+>>>>>>>>>>>>>(470.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(470.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(470.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(470.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(470.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(470.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(470.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(470.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(470.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 3 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		0xee
+>>>>>>>>>>>>498		ubyte		!0xee
+#>>>>>>>>>>>>>478	use		gpt-mbr-partition
+>>>>>>>>>>>>>(486.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(486.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(486.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(486.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(486.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(486.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(486.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(486.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(486.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+# GPT with protective MBR entry in partition 4 (only)
+>>>>>>>>>450		ubyte		!0xee
+>>>>>>>>>>466		ubyte		!0xee
+>>>>>>>>>>>482		ubyte		!0xee
+>>>>>>>>>>>>498		ubyte		0xee
+#>>>>>>>>>>>>>494	use		gpt-mbr-partition
+>>>>>>>>>>>>>(502.l*8192)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>0			use		gpt-mbr-type
+>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>0			ubyte		x		of 8192 bytes		
+>>>>>>>>>>>>>(502.l*8192)	string		!EFI\ PART
+>>>>>>>>>>>>>>(502.l*4096)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>0		ubyte		x		of 4096 bytes
+>>>>>>>>>>>>>>(502.l*4096)	string		!EFI\ PART
+>>>>>>>>>>>>>>>(502.l*2048)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>0		ubyte		x		of 2048 bytes
+>>>>>>>>>>>>>>>(502.l*2048)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>(502.l*1024)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>0		ubyte		x		of 1024 bytes
+>>>>>>>>>>>>>>>>(502.l*1024)	string		!EFI\ PART
+>>>>>>>>>>>>>>>>>(502.l*512)	string		EFI\ PART	GPT partition table
+>>>>>>>>>>>>>>>>>>0		use		gpt-mbr-type
+>>>>>>>>>>>>>>>>>>&-8		use		gpt-table
+>>>>>>>>>>>>>>>>>>0		ubyte		x		of 512 bytes
+
+# The following code does GPT detection and processing, including
+# sector size detection.
+# It has to be duplicated above because the top-level pattern
+# (i.e. not called using 'use') must print *something* for file
+# to count it as a match. Text only printed in named patterns is
+# not counted, and causes file to continue, and try and match
+# other patterns.
+#
+# Unfortunately, when assuming sector sizes >=16k, if the sector size
+# happens to be 512 instead, we may find confusing data after the GPT
+# table...  If the GPT table has less than 128 entries, this may even
+# happen for assumed sector sizes as small as 4k
+# This could be solved by checking for the presence of the backup GPT
+# header as well, but that makes the logic extremely complex
+##0		name		gpt-mbr-partition
+##>(8.l*8192)	string		EFI\ PART
+##>>(8.l*8192)	use		gpt-mbr-type
+##>>&-8		use		gpt-table
+##>>0		ubyte		x		of 8192 bytes		
+##>(8.l*8192)	string		!EFI\ PART
+##>>(8.l*4096)	string		EFI\ PART	GPT partition table
+##>>>0		use		gpt-mbr-type
+##>>>&-8		use		gpt-table
+##>>>0		ubyte		x		of 4096 bytes
+##>>(8.l*4096)	string		!EFI\ PART
+##>>>(8.l*2048)	string		EFI\ PART	GPT partition table
+##>>>>0		use		gpt-mbr-type
+##>>>>&-8		use		gpt-table
+##>>>>0		ubyte		x		of 2048 bytes
+##>>>(8.l*2048)	string		!EFI\ PART
+##>>>>(8.l*1024)	string		EFI\ PART	GPT partition table
+##>>>>>0		use		gpt-mbr-type
+##>>>>>&-8	use		gpt-table
+##>>>>>0		ubyte		x		of 1024 bytes
+##>>>>(8.l*1024)	string		!EFI\ PART
+##>>>>>(8.l*512)	string		EFI\ PART	GPT partition table
+##>>>>>>0		use		gpt-mbr-type
+##>>>>>>&-8	use		gpt-table
+##>>>>>>0		ubyte		x		of 512 bytes
+
+# Print details of MBR type for a GPT-disk
+# Calling code ensures that there is only one 0xee partition.
+0		name		gpt-mbr-type
+# GPT with protective MBR entry in partition 1
+>450		ubyte		0xee
+>>454		ulelong		1
+>>>462		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0	\b (with hybrid MBR)
+>>454		ulelong		!1													\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 2
+>466		ubyte		0xee
+>>470		ulelong		1
+>>>478		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
+>>>>446		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0					\b (with hybrid MBR)
+>>>478		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0	\b (with hybrid MBR)
+>>470		ulelong		!1									\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 3
+>482		ubyte		0xee
+>>486		ulelong		1
+>>>494		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
+>>>>446		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0	\b (with hybrid MBR)
+>>>494		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0					\b (with hybrid MBR)
+>>486		ulelong		!1									\b (nonstandard: not at LBA 1)
+# GPT with protective MBR entry in partition 4
+>498		ubyte		0xee
+>>502		ulelong		1		
+>>>446		string		!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0	\b (with hybrid MBR)
+>>502		ulelong		!1													\b (nonstandard: not at LBA 1)
+
+# Print the information from a GPT partition table structure
+0		name		gpt-table
+>10		uleshort	x		\b, version %u
+>8		uleshort	x		\b.%u
+# a GUID is just like a UUID, except it's displayed mixed-endian.
+>56		ulelong		x		\b, GUID: %08x
+>60		uleshort	x		\b-%04x
+>62		uleshort	x		\b-%04x
+>64		ubeshort	x		\b-%04x
+>66		ubeshort	x		\b-%04x
+>68		ubelong		x		\b%08x
+#>80		uleshort	x		\b, %d partition entries
+>32		ulequad+1	x		\b, disk size: %lld sectors
+
+# In case a GPT data-structure is at LBA 0, report it as well
+# This covers systems which are not GPT-aware, and which show
+# and allow access to the protective partition. This code will
+# detect the contents of such a partition.
+0		string		EFI\ PART	GPT data structure (nonstandard: at LBA 0)
+>0		use		gpt-table
+>0		ubyte		x		(sector size unknown)
+
+

+ 4 - 1
magic/Magdir/hitachi-sh

@@ -1,11 +1,14 @@
 
 #------------------------------------------------------------------------------
-# $File: hitachi-sh,v 1.5 2009/09/19 16:28:09 christos Exp $
+# $File: hitachi-sh,v 1.6 2013/01/29 19:31:33 christos Exp $
 # hitach-sh: file(1) magic for Hitachi Super-H
 #
 # Super-H COFF
 #
+# below test line conflicts with 2nd NTFS filesystem sector 
 0	beshort		0x0500		Hitachi SH big-endian COFF
+# 2nd NTFS filesystem sector often starts with 0x05004e00 for unicode string 5 NTLDR
+#0	ubelong&0xFFFFNMPQ	0x0500NMPQ     Hitachi SH big-endian COFF
 >18	beshort&0x0002	=0x0000		object
 >18	beshort&0x0002	=0x0002		executable
 >18	beshort&0x0008	=0x0008		\b, stripped

+ 9 - 1
magic/Magdir/ibm6000

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: ibm6000,v 1.9 2009/09/19 16:28:09 christos Exp $
+# $File: ibm6000,v 1.11 2013/01/08 20:13:01 christos Exp $
 # ibm6000:  file(1) magic for RS/6000 and the RT PC.
 #
 0	beshort		0x01df		executable (RISC System/6000 V3.1) or obj module
@@ -18,3 +18,11 @@
 0	string		\<aiaff>	archive
 0	string		\<bigaf>	archive (big format)
 
+0	beshort		0x01f7		64-bit XCOFF executable or object module
+>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

+ 51 - 0
magic/Magdir/icc

@@ -0,0 +1,51 @@
+
+#------------------------------------------------------------------------------
+# $File: icc,v 1.1 2013/01/08 01:43:18 christos Exp $
+# icc:  file(1) magic for International Color Consortium file formats
+
+#
+# Color profiles as per the ICC's "Image technology colour management -
+# Architecture, profile format, and data structure" specification.
+# See
+#
+#	http://www.color.org/specification/ICC1v43_2010-12.pdf
+#
+# for Specification ICC.1:2010 (Profile version 4.3.0.0).
+#
+# Bytes 36 to 39 contain a generic profile file signature of "acsp";
+# bytes 40 to 43 "may be used to identify the primary platform/operating
+# system framework for which the profile was created".
+#
+# There are other fields that might be worth dumping as well.
+#
+
+# This appears to be what's used for Apple ColorSync profiles.
+# Instead of adding that, Apple just changed the generic "acsp" entry
+# to be for "ColorSync ICC Color Profile" rather than "Kodak Color
+# Management System, ICC Profile".
+# Yes, it's "APPL", not "AAPL"; see the spec.
+36	string		acspAPPL	ColorSync ICC Profile
+!:mime	application/vnd.iccprofile
+
+# Microsoft ICM color profile
+36	string		acspMSFT	Microsoft ICM Color Profile
+!:mime	application/vnd.iccprofile
+
+# Yes, that's a blank after "SGI".
+36	string		acspSGI\ 	SGI ICC Profile
+!:mime	application/vnd.iccprofile
+
+# XXX - is this what's used for the Sun KCMS or not?  The standard file
+# uses just "acsp" for that, but Apple's file uses it for "ColorSync",
+# and there *is* an identified "primary platform" value of SUNW.
+36	string		acspSUNW	Sun KCMS ICC Profile
+!:mime	application/vnd.iccprofile
+
+# Any other profile.
+# XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
+# and use "acsp" for everything else and dump the "primary platform"
+# string in those cases?
+36	string		acsp		ICC Profile
+!:mime	application/vnd.iccprofile
+
+

+ 117 - 23
magic/Magdir/images

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.72 2011/12/08 12:12:46 rrt Exp $
+# $File: images,v 1.80 2013/02/06 14:18:52 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
@@ -32,17 +32,42 @@
 
 # PBMPLUS images
 # The next byte following the magic is always whitespace.
-0	search/1	P1		Netpbm PBM image text
+# strength is changed to try these patterns before "x86 boot sector"
+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
+!:strength + 45
 !:mime	image/x-portable-bitmap
-0	search/1b	P2		Netpbm PGM image text
+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
+!:strength + 45
 !: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
+!:strength + 45
 !:mime	image/x-portable-pixmap
-0	string		P4		Netpbm PBM "rawbits" image data
+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
+!:strength + 45
 !:mime	image/x-portable-bitmap
-0	string		P5		Netpbm PGM "rawbits" image data
+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
+!:strength + 45
 !:mime	image/x-portable-greymap
-0	string		P6		Netpbm PPM "rawbits" image data
+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
+!:strength + 45
 !:mime	image/x-portable-pixmap
 0	string		P7		Netpbm PAM image file
 !:mime	image/x-portable-pixmap
@@ -203,6 +228,32 @@
 # From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
 0	string		Sfff		structured fax file
 
+# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
+# most files with the extension .EPA and some with .BMP
+0	string		\x11\x06	Award BIOS Logo, 136 x 84
+!:mime	image/x-award-bioslogo
+0	string		\x11\x09	Award BIOS Logo, 136 x 126
+!:mime	image/x-award-bioslogo
+#0	string		\x07\x1f	BIOS Logo corrupted?
+# http://www.blackfiveservices.co.uk/awbmtools.shtml
+# http://biosgfx.narod.ru/v3/
+# http://biosgfx.narod.ru/abr-2/
+0	string		AWBM		
+>4	leshort		<1981		Award BIOS bitmap
+!:mime	image/x-award-bmp
+# image width is a multiple of 4
+>>4	leshort&0x0003	0		
+>>>4		leshort	x		\b, %d
+>>>6		leshort	x		x %d
+>>4	leshort&0x0003	>0		\b,
+>>>4	leshort&0x0003	=1		
+>>>>4		leshort	x		%d+3
+>>>4	leshort&0x0003	=2		
+>>>>4		leshort	x		%d+2
+>>>4	leshort&0x0003	=3		
+>>>>4		leshort	x		%d+1
+>>>6		leshort	x		x %d
+# at offset 8 starts imagedata followed by "RGB " marker
 
 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
 0	string		BM
@@ -376,7 +427,7 @@
 >5	byte	0x00		(white background)
 >5	byte	0xFF		(black background)
 
-# Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
 # http://www.atarimax.com/jindroush.atari.org/afmtatr.html
 0	leshort	0x0296		Atari ATR image
 
@@ -401,16 +452,6 @@
 #>12	beshort	3		RP175
 #>12	beshort	4		YUV
 
-#------------------------------------------------------------------------------
-#
-# Marco Schmidt (marcoschmidt@users.sourceforge.net) -- an image  file format
-# for the EPOC operating system, which is used with PDAs like those from Psion
-#
-# see http://huizen.dds.nl/~frodol/psiconv/html/Index.html for a description
-# of various EPOC file formats
-
-0	string \x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47 EPOC MBM image file
-
 # PCX image files
 # From: Dan Fandrich <dan@coneharvesters.com>
 0	beshort		0x0a00	PCX ver. 2.5 image data
@@ -615,9 +656,61 @@
 >12	string	THUM		DjVu page thumbnails
 !:mime	image/vnd.djvu
 
-
-# From Marc Espie
-0	lelong	20000630		OpenEXR image data
+# Originally by Marc Espie
+# Modified by Robert Minsk <robertminsk at yahoo.com>
+# http://www.openexr.com/openexrfilelayout.pdf
+0	lelong		20000630	OpenEXR image data,
+!:mime image/x-exr
+>4	lelong&0x000000ff x		version %d,
+>4	lelong		^0x00000200	storage: scanline
+>4	lelong		&0x00000200	storage: tiled
+>8	search/0x1000	compression\0	\b, compression:
+>>&16	byte		0		none
+>>&16	byte		1		rle
+>>&16	byte		2		zips
+>>&16	byte		3		zip
+>>&16	byte		4		piz
+>>&16	byte		5		pxr24
+>>&16	byte		6		b44
+>>&16	byte		7		b44a
+>>&16	byte		>7		unknown
+>8	 search/0x1000	dataWindow\0	\b, dataWindow:
+>>&10	lelong		x		(%d
+>>&14	lelong		x		%d)-
+>>&18	lelong		x		\b(%d
+>>&22	lelong		x		%d)
+>8	search/0x1000	displayWindow\0	\b, displayWindow:
+>>&10	lelong		x		(%d
+>>&14	lelong		x		%d)-
+>>&18	lelong		x		\b(%d
+>>&22	lelong		x		%d)
+>8	search/0x1000	lineOrder\0	 \b, lineOrder:
+>>&14	byte		0		increasing y
+>>&14	byte		1		decreasing y
+>>&14	byte		2		random y
+>>&14	byte		>2		unknown
+
+# SMPTE Digital Picture Exchange Format, SMPTE DPX
+#
+# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
+# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
+# Robert Minsk <robertminsk at yahoo.com>
+0	string		SDPX	DPX image data, big-endian,
+!:mime image/x-dpx
+>768	beshort		<4
+>>772	belong		x	%dx
+>>776	belong		x	\b%d,
+>768	beshort		>3
+>>776	belong		x	%dx
+>>772	belong		x	\b%d,
+>768	beshort		0	left to right/top to bottom
+>768	beshort		1	right to left/top to bottom
+>768	beshort		2	left to right/bottom to top
+>768	beshort		3	right to left/bottom to top
+>768	beshort		4	top to bottom/left to right
+>768	beshort		5	top to bottom/right to left
+>768	leshort		6	bottom to top/left to right
+>768	leshort		7	bottom to top/right to left
 
 # From: Tom Hilinski <tom.hilinski@comcast.net>
 # http://www.unidata.ucar.edu/packages/netcdf/
@@ -665,9 +758,10 @@
 # From Tano M Fotang <mfotang@quanteq.com>
 0	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
 
-# JPEG 2000 Code Stream Bitmap
-# From Petr Splichal <psplicha@redhat.com>
-0	string	\xFF\x4F\xFF\x51\x00	JPEG-2000 Code Stream Bitmap data
+# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
+# From: Markus Heidelberg <markus.heidelberg at web.de>
+0	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
+!:mime	image/x-polar-monitor-bitmap
 
 # From: Rick Richardson <rick.richardson@comcast.net>
 0	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file

+ 2 - 2
magic/Magdir/intel

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: intel,v 1.10 2011/03/30 19:51:00 christos Exp $
+# $File: intel,v 1.11 2013/02/06 14:18:52 christos Exp $
 # intel:  file(1) magic for x86 Unix
 #
 # Various flavors of x86 UNIX executable/object (other than Xenix, which
@@ -37,7 +37,7 @@
 
 # rom: file(1) magic for BIOS ROM Extensions found in intel machines
 #      mapped into memory between 0xC0000 and 0xFFFFF
-# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
 0        beshort         0x55AA       BIOS (ia32) ROM Ext.
 >5       string          USB          USB
 >7       string          LDR          UNDI image

+ 11 - 1
magic/Magdir/java

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------
-# $File: java,v 1.13 2011/12/08 12:12:46 rrt Exp $
+# $File: java,v 1.14 2013/02/08 16:54:45 christos Exp $
 # Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
 # same magic number, 0xcafebabe, so they are both handled
 # in the entry called "cafebabe".
@@ -27,3 +27,13 @@
 # Java source
 0	regex	^import.*;$	Java source
 !: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

+ 17 - 0
magic/Magdir/javascript

@@ -0,0 +1,17 @@
+
+#------------------------------------------------------------------------------
+# $File: javascript,v 1.1 2012/06/16 13:30:36 christos Exp $
+# javascript:  magic for javascript and node.js scripts.
+#
+0	search/1/w	#!/bin/node		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/usr/bin/node		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/bin/nodejs		Node.js script text executable
+!:mime application/javascript
+0	search/1/w	#!/usr/bin/nodejs	Node.js script text executable
+!:mime application/javascript
+0	search/1	#!/usr/bin/env\ node	Node.js script text executable
+!:mime application/javascript
+0	search/1	#!/usr/bin/env\ nodejs	Node.js script text executable
+!:mime application/javascript

+ 16 - 3
magic/Magdir/jpeg

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: jpeg,v 1.16 2011/01/04 19:29:32 rrt Exp $
+# $File: jpeg,v 1.19 2013/02/04 15:50:03 christos Exp $
 # JPEG images
 # SunOS 5.5.1 had
 #
@@ -12,7 +12,7 @@
 0	beshort		0xffd8		JPEG image data
 !:mime	image/jpeg
 !:apple	8BIMJPEG
-!:strength +1
+!:strength +2
 >6	string		JFIF		\b, JFIF standard
 # The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
 # in a vain attempt to add image size reporting for JFIF.  Note that these
@@ -153,7 +153,20 @@
 0	string		hsi1		JPEG image data, HSI proprietary
 
 # From: David Santinoli <david@santinoli.com>
-0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000 image data
+0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
+# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
+# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
+# https://github.com/bitsgalore/jp2kMagic
+#
+# Now read value of 'Brand' field, which yields a few possibilities:
+>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
+!:mime	image/jp2
+>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
+!:mime	image/jpx
+>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
+!:mime	image/jpm
+>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
+!:mime	video/mj2
 
 # Type: JPEG 2000 codesream
 # From: Mathieu Malaterre <mathieu.malaterre@gmail.com>

+ 20 - 0
magic/Magdir/keepass

@@ -0,0 +1,20 @@
+
+#------------------------------------------------------------------------------
+# $File: keepass,v 1.1 2012/12/24 22:14:56 christos Exp $
+# keepass: file(1) magic for KeePass file
+#
+# Keepass Password Safe:
+#  * original one: http://keepass.info/
+#  * *nix port:    http://www.keepassx.org/
+#  * android port: http://code.google.com/p/keepassdroid/
+
+0	lelong		0x9AA2D903	Keepass password database
+>4	lelong		0xB54BFB65	1.x KDB
+>>48	lelong		>0		\b, %d groups
+>>52	lelong		>0		\b, %d entries
+>>8	lelong&0x0f	1		\b, SHA-256
+>>8	lelong&0x0f	2		\b, AES
+>>8	lelong&0x0f	4		\b, RC4
+>>8	lelong&0x0f	8		\b, Twofish
+>>120	lelong		>0		\b, %d key transformation rounds
+>4	lelong		0xB54BFB67	2.x KDBX

+ 12 - 6
magic/Magdir/linux

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: linux,v 1.42 2012/02/07 21:35:03 christos Exp $
+# $File: linux,v 1.47 2013/02/06 14:18:52 christos Exp $
 # linux:  file(1) magic for Linux files
 #
 # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@@ -36,6 +36,8 @@
 >28	long		!0		not stripped
 0	string		\01\03\040\20	Minix-386 executable
 >28	long		!0		not stripped
+0	string		\01\03\04\20	Minix-386 NSYM/GNU executable
+>28	long		!0		not stripped
 # core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
 216	lelong		0421		Linux/i386 core file
 >220	string		>\0		of '%s'
@@ -88,13 +90,15 @@
 # From Daniel Novotny <dnovotny@redhat.com>
 # swap file for PowerPC
 65526	string		SWAPSPACE2	Linux/ppc swap file
+16374	string		SWAPSPACE2	Linux/ia64 swap file
 #
 # Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
 # and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
-# and Nicolás Lichtmaier <nick@debian.org>
+# and Nicolas Lichtmaier <nick@debian.org>
 # 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)
 514	string		HdrS		Linux kernel
+!:strength + 5
 >510	leshort		0xAA55		x86 boot executable
 >>518	leshort		>0x1ff
 >>>529	byte		0		zImage,
@@ -114,10 +118,10 @@
 >0x1e3		string	Loading		version 1.3.79 or older
 >0x1e9		string	Loading		from prehistoric times
 
-# System.map files - Nicolás Lichtmaier <nick@debian.org>
+# System.map files - Nicolas Lichtmaier <nick@debian.org>
 8	search/1	\ A\ _text	Linux kernel symbol map text
 
-# LSM entries - Nicolás Lichtmaier <nick@debian.org>
+# LSM entries - Nicolas Lichtmaier <nick@debian.org>
 0	search/1	Begin3	Linux Software Map entry text
 0	search/1	Begin4	Linux Software Map entry text (new format)
 
@@ -213,9 +217,11 @@
 # 0	lelong&0xFF00FFFF 0x17000301	ld86 SPARC executable
 
 # SYSLINUX boot logo files (from 'ppmtolss16' sources)
-# http://syslinux.zytor.com/
-#
+# http://www.syslinux.org/wiki/index.php/SYSLINUX#Display_graphic_from_filename:
+# file extension .lss .16
 0	lelong	=0x1413f33d		SYSLINUX' LSS16 image data
+# syslinux-4.05/mime/image/x-lss16.xml
+!:mime image/x-lss16
 >4	leshort	x			\b, width %d
 >6	leshort	x			\b, height %d
 

+ 11 - 3
magic/Magdir/llvm

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: llvm,v 1.5 2010/09/20 18:55:20 rrt Exp $
+# $File: llvm,v 1.8 2013/01/12 03:09:51 christos Exp $
 # llvm:  file(1) magic for LLVM byte-codes
 # URL:  http://llvm.org/docs/BitCodeFormat.html
 # From: Al Stone <ahs3@fc.hp.com>
@@ -9,5 +9,13 @@
 0	string	llvc0	LLVM byte-codes, null compression
 0	string	llvc1	LLVM byte-codes, gzip compression
 0	string	llvc2	LLVM byte-codes, bzip2 compression
-0	string	\xde\xc0\x17\x0b	LLVM bitcode, wrapper
-0       string	BC\xc0\xde	LLVM bitcode
+
+0	lelong	0x0b17c0de	LLVM bitcode, wrapper
+# Are these Mach-O ABI values?  They appear to be.
+>16	lelong	0x01000007	x86_64
+>16	lelong	0x00000007	i386
+>16	lelong	0x00000012	ppc
+>16	lelong	0x01000012	ppc64
+>16	lelong 	0x0000000c	arm
+
+0	string	BC\xc0\xde	LLVM IR bitcode

+ 2 - 1
magic/Magdir/lua

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: lua,v 1.5 2009/09/19 16:28:10 christos Exp $
+# $File: lua,v 1.6 2013/01/09 16:23:17 christos Exp $
 # lua:  file(1) magic for Lua scripting language
 # URL:  http://www.lua.org/
 # From: Reuben Thomas <rrt@sc3d.org>, Seo Sanghyeon <tinuviel@sparcs.kaist.ac.kr>
@@ -19,3 +19,4 @@
 0	string		\033Lua			Lua bytecode,
 >4	byte		0x50			version 5.0
 >4	byte		0x51			version 5.1
+>4	byte		0x52			version 5.2

+ 191 - 69
magic/Magdir/mach

@@ -1,86 +1,208 @@
 
 #------------------------------------------------------------
-# $File: mach,v 1.9 2009/09/19 16:28:10 christos Exp $
+# $File: mach,v 1.14 2013/01/04 23:35:53 christos Exp $
 # Mach has two magic numbers, 0xcafebabe and 0xfeedface.
 # Unfortunately the first, cafebabe, is shared with
 # Java ByteCode, so they are both handled in the file "cafebabe".
 # The "feedface" ones are handled herein.
 #------------------------------------------------------------
-0	lelong&0xfffffffe	0xfeedface	Mach-O
+
+0	name		mach-o-be
 >0	byte		0xcf		64-bit
->12	lelong		1		object
->12	lelong		2		executable
->12	lelong		3		fixed virtual memory shared library
->12	lelong		4		core
->12	lelong		5		preload executable
->12	lelong		6		dynamically linked shared library
->12	lelong		7		dynamic linker
->12	lelong		8		bundle
->12	lelong		9		dynamically linked shared library stub
->12	lelong		>9
->>12	lelong		x		filetype=%ld
->4	lelong		<0
->>4	lelong		x		architecture=%ld
->4	lelong		1		vax
->4	lelong		2		romp
->4	lelong		3		architecture=3
->4	lelong		4		ns32032
->4	lelong		5		ns32332
->4	lelong		6		m68k
->4	lelong		7		i386
->4	lelong		8		mips
->4	lelong		9		ns32532
->4	lelong		10		architecture=10
->4	lelong		11		hppa
->4	lelong		12		acorn
->4	lelong		13		m88k
->4	lelong		14		sparc
->4	lelong		15		i860-big
->4	lelong		16		i860
->4	lelong		17		rs6000
->4	lelong		18		ppc
->4	lelong		16777234	ppc64
->4	lelong		>16777234
->>4	lelong		x		architecture=%ld
+# if set, it's for the 64-bit version of the architecture
+# yes, this is separate from the low-order magic number bit
+# it's also separate from the "64-bit libraries" bit in the
+# upper 8 bits of the CPU subtype
+>4	belong&0x01000000	0
+#
+# 32-bit ABIs.
+#
+#				1	vax
+>>4	belong&0x00ffffff	1
+>>>8		belong&0x00ffffff	0	vax
+>>>8		belong&0x00ffffff	1	vax11/780
+>>>8		belong&0x00ffffff	2	vax11/785
+>>>8		belong&0x00ffffff	3	vax11/750
+>>>8		belong&0x00ffffff	4	vax11/730
+>>>8		belong&0x00ffffff	5	uvaxI
+>>>8		belong&0x00ffffff	6	uvaxII
+>>>8		belong&0x00ffffff	7	vax8200
+>>>8		belong&0x00ffffff	8	vax8500
+>>>8		belong&0x00ffffff	9	vax8600
+>>>8		belong&0x00ffffff	10	vax8650
+>>>8		belong&0x00ffffff	11	vax8800
+>>>8		belong&0x00ffffff	12	uvaxIII
+>>>8		belong&0x00ffffff	>12	vax subarchitecture=%ld
+>>4	belong&0x00ffffff	2	romp
+>>4	belong&0x00ffffff	3	architecture=3
+>>4	belong&0x00ffffff	4	ns32032
+>>4	belong&0x00ffffff	5	ns32332
+>>4	belong&0x00ffffff	6	m68k
+#				7	x86
+>>4	belong&0x00ffffff	7
+>>>8	belong&0x0000000f	3		i386
+>>>8	belong&0x0000000f	4		i486
+>>>>8	belong&0x00fffff0	0
+>>>>8	belong&0x00fffff0	0x80		\bsx
+>>>8	belong&0x0000000f	5		i586
+>>>8	belong&0x0000000f	6
+>>>>8	belong&0x00fffff0	0		p6
+>>>>8	belong&0x00fffff0	0x10		pentium_pro
+>>>>8	belong&0x00fffff0	0x20		pentium_2_m0x20
+>>>>8	belong&0x00fffff0	0x30		pentium_2_m3
+>>>>8	belong&0x00fffff0	0x40		pentium_2_m0x40
+>>>>8	belong&0x00fffff0	0x50		pentium_2_m5
+>>>>8	belong&0x00fffff0	>0x50		pentium_2_m0x%lx
+>>>8	belong&0x0000000f	7		celeron
+>>>>8	belong&0x00fffff0	0x00		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x10		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x20		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x30		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x40		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x50		\b_m0x%lx
+>>>>8	belong&0x00fffff0	0x60
+>>>>8	belong&0x00fffff0	0x70		\b_mobile
+>>>>8	belong&0x00fffff0	>0x70		\b_m0x%lx
+>>>8	belong&0x0000000f	8		pentium_3
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	0x10		\b_m
+>>>>8	belong&0x00fffff0	0x20		\b_xeon
+>>>>8	belong&0x00fffff0	>0x20		\b_m0x%lx
+>>>8	belong&0x0000000f	9		pentiumM
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	>0x00		\b_m0x%lx
+>>>8	belong&0x0000000f	10		pentium_4
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	0x10		\b_m
+>>>>8	belong&0x00fffff0	>0x10		\b_m0x%lx
+>>>8	belong&0x0000000f	11		itanium
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	0x10		\b_2
+>>>>8	belong&0x00fffff0	>0x10		\b_m0x%lx
+>>>8	belong&0x0000000f	12		xeon
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	0x10		\b_mp
+>>>>8	belong&0x00fffff0	>0x10		\b_m0x%lx
+>>>8	belong&0x0000000f	>12		ia32 family=%ld
+>>>>8	belong&0x00fffff0	0x00
+>>>>8	belong&0x00fffff0	>0x00		model=%lx
+>>4	belong&0x00ffffff	8	mips
+>>>8		belong&0x00ffffff	1	R2300
+>>>8		belong&0x00ffffff	2	R2600
+>>>8		belong&0x00ffffff	3	R2800
+>>>8		belong&0x00ffffff	4	R2000a
+>>>8		belong&0x00ffffff	5	R2000
+>>>8		belong&0x00ffffff	6	R3000a
+>>>8		belong&0x00ffffff	7	R3000
+>>>8		belong&0x00ffffff	>7	subarchitecture=%ld
+>>4	belong&0x00ffffff	9	ns32532
+>>4	belong&0x00ffffff	10	mc98000
+>>4	belong&0x00ffffff	11	hppa
+>>>8		belong&0x00ffffff	0	7100
+>>>8		belong&0x00ffffff	1	7100LC
+>>>8		belong&0x00ffffff	>1	subarchitecture=%ld
+>>4	belong&0x00ffffff	12	arm
+>>>8		belong&0x00ffffff	0
+>>>8		belong&0x00ffffff	1	subarchitecture=%ld
+>>>8		belong&0x00ffffff	2	subarchitecture=%ld
+>>>8		belong&0x00ffffff	3	subarchitecture=%ld
+>>>8		belong&0x00ffffff	4	subarchitecture=%ld
+>>>8		belong&0x00ffffff	5	\b_v4t
+>>>8		belong&0x00ffffff	6	\b_v6
+>>>8		belong&0x00ffffff	7	\b_v5tej
+>>>8		belong&0x00ffffff	8	\b_xscale
+>>>8		belong&0x00ffffff	9	\b_v7
+>>>8		belong&0x00ffffff	10	\b_v7f
+>>>8		belong&0x00ffffff	11	subarchitecture=%ld
+>>>8		belong&0x00ffffff	12	\b_v7k
+>>>8		belong&0x00ffffff	>12	subarchitecture=%ld
+#				13	m88k
+>>4	belong&0x00ffffff	13
+>>>8		belong&0x00ffffff	0	mc88000
+>>>8		belong&0x00ffffff	1	mc88100
+>>>8		belong&0x00ffffff	2	mc88110
+>>>8		belong&0x00ffffff	>2	mc88000 subarchitecture=%ld
+>>4	belong&0x00ffffff	14	sparc
+>>4	belong&0x00ffffff	15	i860g
+>>4	belong&0x00ffffff	16	alpha
+>>4	belong&0x00ffffff	17	rs6000
+>>4	belong&0x00ffffff	18	ppc
+>>>8		belong&0x00ffffff	0
+>>>8		belong&0x00ffffff	1	\b_601
+>>>8		belong&0x00ffffff	2	\b_602
+>>>8		belong&0x00ffffff	3	\b_603
+>>>8		belong&0x00ffffff	4	\b_603e
+>>>8		belong&0x00ffffff	5	\b_603ev
+>>>8		belong&0x00ffffff	6	\b_604
+>>>8		belong&0x00ffffff	7	\b_604e
+>>>8		belong&0x00ffffff	8	\b_620
+>>>8		belong&0x00ffffff	9	\b_650
+>>>8		belong&0x00ffffff	10	\b_7400
+>>>8		belong&0x00ffffff	11	\b_7450
+>>>8		belong&0x00ffffff	100	\b_970
+>>>8		belong&0x00ffffff	>100	subarchitecture=%ld
+>>4	belong&0x00ffffff	>18	architecture=%ld
+>4	belong&0x01000000	0x01000000
+#
+# 64-bit ABIs.
 #
-0	belong&0xfffffffe	0xfeedface	Mach-O
->3	byte		0xcf		64-bit
+>>4	belong&0x00ffffff	0	64-bit architecture=%ld
+>>4	belong&0x00ffffff	1	64-bit architecture=%ld
+>>4	belong&0x00ffffff	2	64-bit architecture=%ld
+>>4	belong&0x00ffffff	3	64-bit architecture=%ld
+>>4	belong&0x00ffffff	4	64-bit architecture=%ld
+>>4	belong&0x00ffffff	5	64-bit architecture=%ld
+>>4	belong&0x00ffffff	6	64-bit architecture=%ld
+>>4	belong&0x00ffffff	7	x86_64
+>>>8		belong&0x00ffffff	0	subarchitecture=%ld
+>>>8		belong&0x00ffffff	1	subarchitecture=%ld
+>>>8		belong&0x00ffffff	2	subarchitecture=%ld
+>>>8		belong&0x00ffffff	3
+>>>8		belong&0x00ffffff	4	\b_arch1
+>>>8		belong&0x00ffffff	>4	subarchitecture=%ld
+>>4	belong&0x00ffffff	8	64-bit architecture=%ld
+>>4	belong&0x00ffffff	9	64-bit architecture=%ld
+>>4	belong&0x00ffffff	10	64-bit architecture=%ld
+>>4	belong&0x00ffffff	11	64-bit architecture=%ld
+>>4	belong&0x00ffffff	12	64-bit architecture=%ld
+>>4	belong&0x00ffffff	13	64-bit architecture=%ld
+>>4	belong&0x00ffffff	14	64-bit architecture=%ld
+>>4	belong&0x00ffffff	15	64-bit architecture=%ld
+>>4	belong&0x00ffffff	16	64-bit architecture=%ld
+>>4	belong&0x00ffffff	17	64-bit architecture=%ld
+>>4	belong&0x00ffffff	18	ppc64
+>>>8		belong&0x00ffffff	0
+>>>8		belong&0x00ffffff	1		\b_601
+>>>8		belong&0x00ffffff	2		\b_602
+>>>8		belong&0x00ffffff	3		\b_603
+>>>8		belong&0x00ffffff	4		\b_603e
+>>>8		belong&0x00ffffff	5		\b_603ev
+>>>8		belong&0x00ffffff	6		\b_604
+>>>8		belong&0x00ffffff	7		\b_604e
+>>>8		belong&0x00ffffff	8		\b_620
+>>>8		belong&0x00ffffff	9		\b_650
+>>>8		belong&0x00ffffff	10		\b_7400
+>>>8		belong&0x00ffffff	11		\b_7450
+>>>8		belong&0x00ffffff	100		\b_970
+>>>8		belong&0x00ffffff	>100		subarchitecture=%ld
+>>4	belong&0x00ffffff	>18	64-bit architecture=%ld
 >12	belong		1		object
 >12	belong		2		executable
 >12	belong		3		fixed virtual memory shared library
 >12	belong		4		core
 >12	belong		5		preload executable
->12	belong		6               dynamically linked shared library
->12	belong		7               dynamic linker
+>12	belong		6		dynamically linked shared library
+>12	belong		7		dynamic linker
 >12	belong		8		bundle
 >12	belong		9		dynamically linked shared library stub
->12	belong		>9
+>12	belong		10		dSYM companion file
+>12	belong		11		kext bundle
+>12	belong		>11
 >>12	belong		x		filetype=%ld
->4	belong		<0
->>4	belong		x		architecture=%ld
->4	belong		1		vax
->4	belong		2		romp
->4	belong		3		architecture=3
->4	belong		4		ns32032
->4	belong		5		ns32332
->4	belong		6		for m68k architecture
-# from NeXTstep 3.0 <mach/machine.h>
-# i.e. mc680x0_all, ignore
-# >>8	belong		1		(mc68030)
->>8	belong		2		(mc68040)
->>8	belong		3		(mc68030 only)
->4	belong		7		i386
->4	belong		8		mips
->4	belong		9		ns32532
->4	belong		10		architecture=10
->4	belong		11		hppa
->4	belong		12		acorn
->4	belong		13		m88k
->4	belong		14		sparc
->4	belong		15		i860-big
->4	belong		16		i860
->4	belong		17		rs6000
->4	belong		18		ppc
->4	belong		16777234	ppc64
->4	belong		>16777234
->>4	belong		x		architecture=%ld
+
+#
+0	lelong&0xfffffffe	0xfeedface	Mach-O 
+>0	use	\^mach-o-be
+
+0	belong&0xfffffffe	0xfeedface	Mach-O 
+>0	use	mach-o-be

+ 7 - 0
magic/Magdir/macos

@@ -0,0 +1,7 @@
+
+#------------------------------------------------------------------------------
+# $File: macos,v 1.1 2012/12/21 16:41:07 christos Exp $
+# MacOS files
+#
+
+0	string		book\0\0\0\0mark\0\0\0\0	MacOS Alias file

+ 4 - 3
magic/Magdir/mail.news

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: mail.news,v 1.20 2011/12/08 12:12:46 rrt Exp $
+# $File: mail.news,v 1.22 2013/01/04 14:22:07 christos Exp $
 # mail.news:  file(1) magic for mail and news
 #
 # Unfortunately, saved netnews also has From line added in some news software.
@@ -14,9 +14,9 @@
 !:mime	message/rfc822
 0	string/t		Pipe\ to 	mail piping text
 !:mime	message/rfc822
-0	string/t		Delivered-To:	SMTP mail text
+0	string/tc		delivered-to:	SMTP mail text
 !:mime	message/rfc822
-0	string/t		Return-Path:	SMTP mail text
+0	string/tc		return-path:	SMTP mail text
 !:mime	message/rfc822
 0	string/t		Path:		news text
 !:mime	message/news
@@ -34,6 +34,7 @@
 
 # TNEF files...
 0	lelong		0x223E9F78	Transport Neutral Encapsulation Format
+!:mime	application/vnd.ms-tnef
 
 # From: Kevin Sullivan <ksulliva@psc.edu>
 0	string		*mbx*		MBX mail folder

+ 2 - 2
magic/Magdir/maple

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: maple,v 1.6 2009/09/19 16:28:10 christos Exp $
+# $File: maple,v 1.7 2013/01/11 16:45:23 christos Exp $
 # maple:  file(1) magic for maple files
 # "H. Nanosecond" <aldomel@ix.netcom.com>
 # Maple V release 4, a multi-purpose math program
@@ -33,7 +33,7 @@
 # that is {VERSION major_version miunor_version computer_type version_string}
 0	string	{VERSION\ 	Maple worksheet
 >9	string	>\0	version %.1s.
->>>11	string	>\0	%.1s
+>>11	string	>\0	%.1s
 
 # .mps
 0	string	\0\0\001$	Maple something

+ 5 - 11
magic/Magdir/matroska

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: matroska,v 1.6 2010/09/20 21:11:35 rrt Exp $
+# $File: matroska,v 1.8 2013/02/08 17:25:16 christos Exp $
 # matroska:  file(1) magic for Matroska files
 #
 # See http://www.matroska.org/
@@ -9,15 +9,9 @@
 # EBML id:
 0		belong		0x1a45dfa3
 # DocType id:
->5		beshort		0x4282
+>4		search/4096 	\x42\x82
 # DocType contents:
->>8		string		matroska	Matroska data
-!:mime  video/x-matroska
-
-# EBML id:
-0		belong		0x1a45dfa3
-# DocType id:
->0		search/4096 	\x42\x82
-# DocType contents:
->>&1		string		webm	WebM
+>>&1		string		webm		WebM
 !:mime  video/webm
+>>&1		string		matroska	Matroska data
+!:mime  video/x-matroska

+ 3 - 65
magic/Magdir/mips

@@ -1,32 +1,8 @@
 
 #------------------------------------------------------------------------------
-# $File: mips,v 1.7 2011/05/03 01:44:17 christos Exp $
-# mips:  file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.)
-#                         Dec Ultrix (MIPS)
-# all of SGI's *current* machines and OSes run in big-endian mode on the
-# MIPS machines, as far as I know.
-#
-# XXX - what is the blank "-" line?
-#
-# kbd file definitions
-0	string	kbd!map		kbd map file
->8	byte	>0		Ver %d:
->10	short	>0		with %d table(s)
-0	belong	0407		old SGI 68020 executable
-0	belong	0410		old SGI 68020 pure executable
-0	beshort	0x8765		disk quotas file
-0	beshort	0x0506		IRIS Showcase file
->2	byte	0x49		-
->3	byte	x		- version %ld
-0	beshort	0x0226		IRIS Showcase template
->2	byte	0x63		-
->3	byte	x		- version %ld
-0	belong	0x5343464d	IRIS Showcase file
->4	byte	x		- version %ld
-0	belong	0x5443464d	IRIS Showcase template
->4	byte	x		- version %ld
-0	belong	0xdeadbabe	IRIX Parallel Arena
->8	belong	>0		- version %ld
+# $File: mips,v 1.9 2013/01/12 03:09:51 christos Exp $
+# mips:  file(1) magic for MIPS ECOFF and Ucode, as used in SGI IRIX
+# and DEC Ultrix
 #
 0	beshort	0x0160		MIPSEB ECOFF executable
 >20	beshort	0407		(impure)
@@ -142,41 +118,3 @@
 #
 0	beshort	0x180		MIPSEB Ucode
 0	beshort	0x182		MIPSEL-BE Ucode
-# 32bit core file
-0	belong	0xdeadadb0	IRIX core dump
->4	belong	1		of
->16	string	>\0		'%s'
-# 64bit core file
-0	belong	0xdeadad40	IRIX 64-bit core dump
->4	belong	1		of
->16	string	>\0		'%s'
-# N32bit core file
-0       belong	0xbabec0bb	IRIX N32 core dump
->4      belong	1               of
->16     string	>\0             '%s'
-# New style crash dump file
-0	string	\x43\x72\x73\x68\x44\x75\x6d\x70	IRIX vmcore dump of
->36	string	>\0					'%s'
-# Trusted IRIX info
-0	string	SGIAUDIT	SGI Audit file
->8	byte	x		- version %d
->9	byte	x		\b.%ld
-#
-0	string	WNGZWZSC	Wingz compiled script
-0	string	WNGZWZSS	Wingz spreadsheet
-0	string	WNGZWZHP	Wingz help file
-#
-0	string	#Inventor V	IRIS Inventor 1.0 file
-0	string	#Inventor V2	Open Inventor 2.0 file
-# GLF is OpenGL stream encoding
-0	string	glfHeadMagic();		GLF_TEXT
-4	belong	0x7d000000		GLF_BINARY_LSB_FIRST
-!:strength -30
-4	belong	0x0000007d		GLF_BINARY_MSB_FIRST
-!:strength -30
-# GLS is OpenGL stream encoding; GLS is the successor of GLF
-0	string	glsBeginGLS(		GLS_TEXT
-4	belong	0x10000000		GLS_BINARY_LSB_FIRST
-!:strength -30
-4	belong	0x00000010		GLS_BINARY_MSB_FIRST
-!:strength -30

+ 1 - 11
magic/Magdir/misctools

@@ -1,6 +1,6 @@
 
 #-----------------------------------------------------------------------------
-# $File: misctools,v 1.12 2010/09/29 18:36:49 rrt Exp $
+# $File: misctools,v 1.13 2013/01/16 13:53:10 christos Exp $
 # misctools:  file(1) magic for miscellaneous UNIX tools.
 #
 0	search/1	%%!!			X-Post-It-Note text
@@ -9,16 +9,6 @@
 0	string/c	BEGIN:VCARD		vCard visiting card
 !:mime	text/x-vcard
 
-# From: Alex Beregszaszi <alex@fsn.hu>
-4	string	gtktalog		GNOME Catalogue (gtktalog)
->13	string	>\0			version %s
-
-# Summary: GStreamer binary registry
-# Extension: .bin
-# Submitted by: Josh Triplett <josh@joshtriplett.org>
-0	belong	0xc0def00d		GStreamer binary registry
->4	string	x			\b, version %s
-
 # Summary: Libtool library file
 # Extension: .la
 # Submitted by: Tomasz Trojanowski <tomek@uninet.com.pl>

+ 42 - 3
magic/Magdir/msdos

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.77 2011/12/07 22:05:05 christos Exp $
+# $File: msdos,v 1.84 2013/02/05 13:55:22 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
@@ -83,6 +83,7 @@
 >>>(0x3c.l+4)	leshort		0x1a6	Hitachi SH4
 >>>(0x3c.l+4)	leshort		0x1c0	ARM
 >>>(0x3c.l+4)	leshort		0x1c2	ARM Thumb
+>>>(0x3c.l+4)	leshort		0x1c4	ARMv7 Thumb
 >>>(0x3c.l+4)	leshort		0x1f0	PowerPC
 >>>(0x3c.l+4)	leshort		0x200	Intel Itanium
 >>>(0x3c.l+4)	leshort		0x266	MIPS16
@@ -312,7 +313,7 @@
 >5	ubyte		>0		
 >>8	string		x		\b, name=%-.2s
 0	string	\xffKEYB\ \ \ \0\0\0\0	
->12	string	\0\0\0\0`\360		MS-DOS KEYBoard Layout file
+>12	string	\0\0\0\0`\004\360	MS-DOS KEYBoard Layout file
 
 # .COM formats (Daniel Quinlan, quinlan@yggdrasil.com)
 # Uncommenting only the first two lines will cover about 2/3 of COM files,
@@ -498,11 +499,18 @@
 !:mime	application/msword
 0	string/b	\333\245-\0\0\0			Microsoft Office Document
 !:mime	application/msword
-512	string/b		\354\245\301		Microsoft Word Document
+512	string/b	\354\245\301			Microsoft Word Document
 !:mime	application/msword
+
+#
+0	string/b	\xDB\xA5\x2D\x00		Microsoft WinWord 2.0 Document
+!:mime application/msword
 #
 2080	string	Microsoft\ Excel\ 5.0\ Worksheet	%s
 !:mime	application/vnd.ms-excel
+#
+0	string/b	\xDB\xA5\x2D\x00		Microsoft WinWord 2.0 Document
+!:mime application/msword
 
 2080	string	Foglio\ di\ lavoro\ Microsoft\ Exce	%s
 !:mime	application/vnd.ms-excel
@@ -702,6 +710,15 @@
 0	leshort		0x223e9f78	TNEF
 !:mime	application/vnd.ms-tnef
 
+# 4DOS help (.HLP) files added by Joerg Jenderek from source TPHELP.PAS 
+# of http://www.4dos.info/
+# pointer,HelpID[8]=4DHnnnmm
+0	ulelong	0x48443408		4DOS help file
+>4	string	x			\b, version %-4.4s
+
+# old binary Microsoft (.HLP) files added by Joerg Jenderek from http://file-extension.net/seeker/file_extension_hlp
+0	ulequad	0x3a000000024e4c	MS Advisor help file
+
 # HtmlHelp files (.chm)
 0	string/b	ITSF\003\000\000\000\x60\000\000\000\001\000\000\000	MS Windows HtmlHelp Data
 
@@ -815,6 +832,16 @@
 
 0	string/b	QEVM		QEMU suspend to disk image
 
+# QEMU QED Image
+# http://wiki.qemu.org/Features/QED/Specification
+0	string/b	QED\0		QEMU QED Image
+
+# VDI Image
+64	string/b	\x7f\x10\xda\xbe	VDI Image
+>68	string/b	\x01\x00\x01\x00	version 1.1
+>0	string		>\0			(%s)
+>368	lequad		x			 \b, %lld bytes
+
 0	string/b	Bochs\ Virtual\ HD\ Image	Bochs disk image,
 >32	string	x				type %s,
 >48	string	x				subtype %s
@@ -874,3 +901,15 @@
 
 # Windows Imaging (WIM) Image
 0	string/b	MSWIM\000\000\000	Windows imaging (WIM) image
+
+# The second byte of these signatures is a file version; I don't know what, 
+# if anything, produced files with version numbers 0-2.
+# From: John Elliott <johne@seasip.demon.co.uk>
+0	string	\xfc\x03\x00	Mallard BASIC program data (v1.11)
+0	string	\xfc\x04\x00	Mallard BASIC program data (v1.29+)
+0	string	\xfc\x03\x01	Mallard BASIC protected program data (v1.11)
+0	string	\xfc\x04\x01	Mallard BASIC protected program data (v1.29+)
+
+0	string	MIOPEN		Mallard BASIC Jetsam data
+0	string	Jetsam0		Mallard BASIC Jetsam index data
+

+ 6 - 4
magic/Magdir/msooxml

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msooxml,v 1.1 2011/01/25 18:36:19 christos Exp $
+# $File: msooxml,v 1.2 2013/01/25 23:04:37 christos Exp $
 # msooxml:  file(1) magic for Microsoft Office XML
 # From: Ralf Brown <ralf.brown@gmail.com>
 
@@ -23,11 +23,13 @@
 >>>&26          search/1000     PK\003\004
 # 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+
-!:mime application/msword
+!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
 >>>>&26         string          ppt/            Microsoft PowerPoint 2007+
-!:mime application/vnd.ms-powerpoint
+!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
 >>>>&26         string          xl/             Microsoft Excel 2007+
-!:mime application/vnd.ms-excel
+!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
 >>>>&26         default         x               Microsoft OOXML
 !:strength +10

+ 2 - 2
magic/Magdir/natinst

@@ -1,10 +1,10 @@
 
 #-----------------------------------------------------------------------------
-# $File: natinst,v 1.4 2009/09/19 16:28:11 christos Exp $
+# $File: natinst,v 1.5 2013/02/06 14:18:52 christos Exp $
 # natinst:  file(1) magic for National Instruments Code Files
 
 #
-# From <egamez@fcfm.buap.mx> Enrique Gámez-Flores
+# From <egamez@fcfm.buap.mx> Enrique Gamez-Flores
 # version 1
 # Many formats still missing, we use, for the moment LabVIEW
 # We guess VXI format file. VISA, LabWindowsCVI, BridgeVIEW, etc, are missing

+ 4 - 6
magic/Magdir/netbsd

@@ -1,16 +1,14 @@
 
 #------------------------------------------------------------------------------
-# $File: netbsd,v 1.19 2011/10/31 17:23:34 christos Exp $
+# $File: netbsd,v 1.20 2013/01/09 22:37:24 christos Exp $
 # netbsd:  file(1) magic for NetBSD objects
 #
 # All new-style magic numbers are in network byte order.
+# The old-style magic numbers are indistinguishable from the same magic
+# numbers used in other systems, and are handled, for all those systems,
+# in aout.
 #
 
-0	lelong			000000407	a.out NetBSD little-endian object file
->16	lelong			>0		not stripped
-0	belong			000000407	a.out NetBSD big-endian object file
->16	belong			>0		not stripped
-
 0	belong&0377777777	041400413	a.out NetBSD/i386 demand paged
 >0	byte			&0x80		
 >>20	lelong			<4096		shared library

+ 6 - 3
magic/Magdir/perl

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: perl,v 1.17 2011/12/16 16:24:40 rrt Exp $
+# $File: perl,v 1.20 2012/06/21 01:16:49 christos Exp $
 # perl:  file(1) magic for Larry Wall's perl language.
 #
 # The `eval' lines recognizes an outrageously clever hack.
@@ -28,12 +28,12 @@
 # check the first line
 0	search/1	package
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;	Perl5 module source text
+!:strength + 10
 # not 'p', check other lines
 0	search/1	!p
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;
 >>0	regex		\^1\ *;|\^(use|sub|my)\ .*[(;{=]	Perl5 module source text
-
-
+!:strength + 10
 
 # Perl POD documents
 # From: Tom Hukins <tom@eborcom.com>
@@ -43,6 +43,9 @@
 0	search/1/W	\n\=head1\ 	Perl POD document text
 0	search/1/W	\=head2\ 	Perl POD document text
 0	search/1/W	\n\=head2\ 	Perl POD document text
+0	search/1/W	\=encoding\ 	Perl POD document text
+0	search/1/W	\n\=encoding\ 	Perl POD document text
+
 
 # Perl Storable data files.
 0	string	perl-store	perl Storable (v0.6) data

+ 14 - 0
magic/Magdir/pwsafe

@@ -0,0 +1,14 @@
+
+#------------------------------------------------------------------------------
+# $File: pwsafe,v 1.1 2012/10/25 00:12:19 christos Exp $
+# pwsafe: file(1) magic for passwordsafe file
+#
+# Password Safe
+# http://passwordsafe.sourceforge.net/
+# file format specs
+# http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV3.txt
+# V2 http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/formatV2.txt
+# V1 http://passwordsafe.svn.sourceforge.net/viewvc/passwordsafe/trunk/pwsafe/pwsafe/docs/notes.txt
+# V2 and V1 have no easy identifier that I can find
+# .psafe3
+0	string	PWS3	Password Safe V3 database

+ 6 - 1
magic/Magdir/python

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: python,v 1.20 2011/12/13 13:53:14 christos Exp $
+# $File: python,v 1.21 2012/06/21 01:12:51 christos Exp $
 # python:  file(1) magic for python
 #
 # Outlook puts """ too for urgent messages
@@ -59,3 +59,8 @@
 !:mime text/x-python
 >&0	search/4096	finally:	Python script text executable
 !:mime text/x-python
+
+# def name(args, args):
+0	regex	 \^(\ |\\t)*def\ +[a-zA-Z]+
+>&0	regex	\ *\\(([a-zA-Z]|,|\ )*\\):$ Python script text executable
+!:mime text/x-python

+ 2 - 2
magic/Magdir/revision

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: revision,v 1.8 2010/11/25 15:00:12 christos Exp $
+# $File: revision,v 1.9 2013/02/06 14:18:52 christos Exp $
 # file(1) magic for revision control files
 # From Hendrik Scholz <hendrik@scholz.net>
 0	string/t	/1\ :pserver:	cvs password text file
@@ -29,7 +29,7 @@
 >4	belong	=2		\b, version 2
 
 # Type: Git index file
-# From: Frédéric Brière <fbriere@fbriere.net>
+# From: Frederic Briare <fbriere@fbriere.net>
 0	string	DIRC		Git index
 >4	belong	>0		\b, version %d
 >>8	belong	>0		\b, %d entries

+ 3 - 3
magic/Magdir/riff

@@ -1,12 +1,12 @@
 
 #------------------------------------------------------------------------------
-# $File: riff,v 1.22 2011/09/06 11:00:06 christos Exp $
+# $File: riff,v 1.23 2013/02/06 14:18:52 christos Exp $
 # riff:  file(1) magic for RIFF format
 # See
 #
 #	http://www.seanet.com/users/matts/riffmci/riffmci.htm
 #
-# AVI section extended by Patrik Rådman <patrik+file-magic@iki.fi>
+# AVI section extended by Patrik Radman <patrik+file-magic@iki.fi>
 #
 0	string		RIFF		RIFF (little-endian) data
 # RIFF Palette format
@@ -247,7 +247,7 @@
 
 #------------------------------------------------------------------------------
 # MBWF/RF64
-# see EBU TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
+# see EBU TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
 0	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
 !:mime	audio/x-wav
 >40	search/256	fmt\x20		\b

+ 10 - 17
magic/Magdir/rpm

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: rpm,v 1.11 2011/06/14 12:47:41 christos Exp $
+# $File: rpm,v 1.12 2013/01/11 16:45:23 christos Exp $
 #
 # RPM: file(1) magic for Red Hat Packages   Erik Troan (ewt@redhat.com)
 #
@@ -31,22 +31,15 @@
 >>8	beshort		255		noarch
 
 #delta RPM    Daniel Novotny (dnovotny@redhat.com)
-0	string	drpm	Delta RPM
+0	string		drpm		Delta RPM
 !:mime  application/x-rpm
 >12	string 	x	%s
-
->>>8	beshort		11		MIPSel
->>>8	beshort		12		ARM
->>>8	beshort		13		MiNT
->>>8	beshort		14		S/390
->>>8	beshort		15		S/390x
->>>8	beshort		16		PowerPC64
->>>8	beshort		17		SuperH
->>>8	beshort		18		Xtensa
+>>8	beshort		11		MIPSel
+>>8	beshort		12		ARM
+>>8	beshort		13		MiNT
+>>8	beshort		14		S/390
+>>8	beshort		15		S/390x
+>>8	beshort		16		PowerPC64
+>>8	beshort		17		SuperH
+>>8	beshort		18		Xtensa
 >>10	string		x		%s
-
-# Type:	Delta RPM
-# From:	Daniel Novotny (dnovotny@redhat.com)
-0	string		drpm		Delta RPM
-!:mime application/x-rpm
->12	string		x		%s

+ 69 - 2
magic/Magdir/sgi

@@ -1,7 +1,74 @@
 
 #------------------------------------------------------------------------------
-# $File: sgi,v 1.18 2010/11/25 15:00:12 christos Exp $
-# sgi:  file(1) magic for Silicon Graphics applications
+# $File: sgi,v 1.19 2013/01/12 03:09:51 christos Exp $
+# sgi:  file(1) magic for Silicon Graphics operating systems and applications
+#
+# Executable images are handled either in aout (for old-style a.out
+# files for 68K; they are indistinguishable from other big-endian 32-bit
+# a.out files) or in mips (for MIPS ECOFF and Ucode files)
+#
+
+# kbd file definitions
+0	string	kbd!map		kbd map file
+>8	byte	>0		Ver %d:
+>10	short	>0		with %d table(s)
+
+0	beshort	0x8765		disk quotas file
+
+0	beshort	0x0506		IRIS Showcase file
+>2	byte	0x49		-
+>3	byte	x		- version %ld
+0	beshort	0x0226		IRIS Showcase template
+>2	byte	0x63		-
+>3	byte	x		- version %ld
+0	belong	0x5343464d	IRIS Showcase file
+>4	byte	x		- version %ld
+0	belong	0x5443464d	IRIS Showcase template
+>4	byte	x		- version %ld
+0	belong	0xdeadbabe	IRIX Parallel Arena
+>8	belong	>0		- version %ld
+
+# core files
+#
+# 32bit core file
+0	belong	0xdeadadb0	IRIX core dump
+>4	belong	1		of
+>16	string	>\0		'%s'
+# 64bit core file
+0	belong	0xdeadad40	IRIX 64-bit core dump
+>4	belong	1		of
+>16	string	>\0		'%s'
+# N32bit core file
+0       belong	0xbabec0bb	IRIX N32 core dump
+>4      belong	1               of
+>16     string	>\0             '%s'
+# New style crash dump file
+0	string	\x43\x72\x73\x68\x44\x75\x6d\x70	IRIX vmcore dump of
+>36	string	>\0					'%s'
+
+# Trusted IRIX info
+0	string	SGIAUDIT	SGI Audit file
+>8	byte	x		- version %d
+>9	byte	x		\b.%ld
+#
+0	string	WNGZWZSC	Wingz compiled script
+0	string	WNGZWZSS	Wingz spreadsheet
+0	string	WNGZWZHP	Wingz help file
+#
+0	string	#Inventor V	IRIS Inventor 1.0 file
+0	string	#Inventor V2	Open Inventor 2.0 file
+# GLF is OpenGL stream encoding
+0	string	glfHeadMagic();		GLF_TEXT
+4	belong	0x7d000000		GLF_BINARY_LSB_FIRST
+!:strength -30
+4	belong	0x0000007d		GLF_BINARY_MSB_FIRST
+!:strength -30
+# GLS is OpenGL stream encoding; GLS is the successor of GLF
+0	string	glsBeginGLS(		GLS_TEXT
+4	belong	0x10000000		GLS_BINARY_LSB_FIRST
+!:strength -30
+4	belong	0x00000010		GLS_BINARY_MSB_FIRST
+!:strength -30
 
 #
 #

+ 15 - 3
magic/Magdir/sgml

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: sgml,v 1.27 2011/12/07 12:01:24 rrt Exp $
+# $File: sgml,v 1.29 2012/08/26 10:25:41 christos Exp $
 # Type:	SVG Vectorial Graphics
 # From:	Noel Torres <tecnico@ejerciciosresueltos.com>
 0	string		\<?xml\ version="
@@ -36,35 +36,47 @@
 # adapted to string extenstions by Anthon van der Neut <anthon@mnt.org)
 0	search/4096/cWt	\<!doctype\ html	HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<head			HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<title			HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<html			HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<script 		HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<style 		HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<table			HTML document text
 !:mime	text/html
+!:strength + 5
 0	search/4096/cwt	\<a\ href=		HTML document text
 !:mime	text/html
+!:strength + 5
 
 # Extensible markup language (XML), a subset of SGML
 # from Marc Prud'hommeaux (marc@apocalypse.org)
 0	search/1/cwt	\<?xml			XML document text
 !:mime	application/xml
+!:strength + 5
 0	string/t		\<?xml\ version\ "	XML
 !:mime	application/xml
+!:strength + 5
 0	string/t		\<?xml\ version="	XML
 !:mime	application/xml
->15	search/1	>\0			%.3s document text
+!:strength + 5
+>15	string/t	>\0			%.3s document text
 >>23	search/1	\<xsl:stylesheet	(XSL stylesheet)
 >>24	search/1	\<xsl:stylesheet	(XSL stylesheet)
 0	string		\<?xml\ version='	XML
 !:mime	application/xml
->15	search/1	>\0			%.3s document text
+!:strength + 5
+>15	string/t	>\0			%.3s document text
 >>23	search/1	\<xsl:stylesheet	(XSL stylesheet)
 >>24	search/1	\<xsl:stylesheet	(XSL stylesheet)
 0	search/1/wbt	\<?xml			XML document text

+ 60 - 104
magic/Magdir/sniffer

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: sniffer,v 1.18 2011/08/08 08:49:27 christos Exp $
+# $File: sniffer,v 1.19 2013/01/06 01:11:04 christos Exp $
 # sniffer:  file(1) magic for packet capture files
 #
 # From: guy@alum.mit.edu (Guy Harris)
@@ -17,6 +17,7 @@
 >6	leshort		2		(Token Ring)
 >6	leshort		3		(FDDI)
 >6	leshort		4		(ATM)
+>6	leshort		>4		(type %d)
 
 #
 # Microsoft Network Monitor 2.x capture files.
@@ -29,6 +30,12 @@
 >6	leshort		2		(Token Ring)
 >6	leshort		3		(FDDI)
 >6	leshort		4		(ATM)
+>6	leshort		5		(IP-over-IEEE 1394)
+>6	leshort		6		(802.11)
+>6	leshort		7		(Raw IP)
+>6	leshort		8		(Raw IP)
+>6	leshort		9		(Raw IP)
+>6	leshort		>9		(type %d)
 
 #
 # Network General Sniffer capture files.
@@ -57,6 +64,7 @@
 # Sorry, make that "Network Associates Sniffer Basic, and Windows
 # Sniffer Pro", capture files."
 # Sorry, make that "Network General Sniffer capture files."
+# Sorry, make that "NetScout Sniffer capture files."
 #
 0	string		XCP\0		NetXRay capture file
 >4	string		>\0		- version %s
@@ -73,8 +81,7 @@
 # the main program that uses that format, but there are other programs
 # that use "libpcap", or that use the same capture file format.)
 #
-0	ubelong		0xa1b2c3d4	tcpdump capture file (big-endian)
-!:mime	application/vnd.tcpdump.pcap
+0	name		pcap-be
 >4	beshort		x		- version %d
 >6	beshort		x		\b.%d
 >20	belong		0		(No link-layer encapsulation
@@ -116,8 +123,10 @@
 >20	belong		127		(802.11 with radiotap header
 >20	belong		129		(Linux ARCNET
 >20	belong		138		(Apple IP over IEEE 1394
+>20	belong		139		(MTP2 with pseudo-header
 >20	belong		140		(MTP2
 >20	belong		141		(MTP3
+>20	belong		142		(SCCP
 >20	belong		143		(DOCSIS
 >20	belong		144		(IrDA
 >20	belong		147		(Private use 0
@@ -137,72 +146,53 @@
 >20	belong		161		(Private use 14
 >20	belong		162		(Private use 15
 >20	belong		163		(802.11 with AVS header
+>20	belong		165		(BACnet MS/TP
+>20	belong		166		(PPPD
+>20	belong		169		(GPRS LLC
+>20	belong		177		(Linux LAPD
+>20	belong		187		(Bluetooth HCI H4
+>20	belong		189		(Linux USB
+>20	belong		192		(PPI
+>20	belong		195		(802.15.4
+>20	belong		196		(SITA
+>20	belong		197		(Endace ERF
+>20	belong		201		(Bluetooth HCI H4 with pseudo-header
+>20	belong		202		(AX.25 with KISS header
+>20	belong		203		(LAPD
+>20	belong		204		(PPP with direction pseudo-header
+>20	belong		205		(Cisco HDLC with direction pseudo-header
+>20	belong		206		(Frame Relay with direction pseudo-header
+>20	belong		209		(Linux IPMB
+>20	belong		215		(802.15.4 with non-ASK PHY header
+>20	belong		220		(Memory-mapped Linux USB
+>20	belong		224		(Fibre Channel FC-2
+>20	belong		225		(Fibre Channel FC-2 with frame delimiters
+>20	belong		226		(Solaris IPNET
+>20	belong		227		(SocketCAN
+>20	belong		228		(Raw IPv4
+>20	belong		229		(Raw IPv6
+>20	belong		230		(802.15.4 without FCS
+>20	belong		231		(D-Bus messages
+>20	belong		235		(DVB-CI
+>20	belong		236		(MUX27010
+>20	belong		237		(STANAG 5066 D_PDUs
+>20	belong		239		(Linux netlink NFLOG messages
+>20	belong		240		(Hilscher netAnalyzer
+>20	belong		241		(Hilscher netAnalyzer with delimiters
+>20	belong		242		(IP-over-Infiniband
+>20	belong		243		(MPEG-2 Transport Stream packets
+>20	belong		244		(ng4t ng40
+>20	belong		245		(NFC LLCP
+>20	belong		247		(Infiniband
+>20	belong		248		(SCTP
 >16	belong		x		\b, capture length %d)
+
+0	ubelong		0xa1b2c3d4	tcpdump capture file (big-endian)
+!:mime	application/vnd.tcpdump.pcap
+>0	use	pcap-be
 0	ulelong		0xa1b2c3d4	tcpdump capture file (little-endian)
 !:mime	application/vnd.tcpdump.pcap
->4	leshort		x		- version %d
->6	leshort		x		\b.%d
->20	lelong		0		(No link-layer encapsulation
->20	lelong		1		(Ethernet
->20	lelong		2		(3Mb Ethernet
->20	lelong		3		(AX.25
->20	lelong		4		(ProNET
->20	lelong		5		(CHAOS
->20	lelong		6		(Token Ring
->20	lelong		7		(ARCNET
->20	lelong		8		(SLIP
->20	lelong		9		(PPP
->20	lelong		10		(FDDI
->20	lelong		11		(RFC 1483 ATM
->20	lelong		12		(raw IP
->20	lelong		13		(BSD/OS SLIP
->20	lelong		14		(BSD/OS PPP
->20	lelong		19		(Linux ATM Classical IP
->20	lelong		50		(PPP or Cisco HDLC
->20	lelong		51		(PPP-over-Ethernet
->20	lelong		99		(Symantec Enterprise Firewall
->20	lelong		100		(RFC 1483 ATM
->20	lelong		101		(raw IP
->20	lelong		102		(BSD/OS SLIP
->20	lelong		103		(BSD/OS PPP
->20	lelong		104		(BSD/OS Cisco HDLC
->20	lelong		105		(802.11
->20	lelong		106		(Linux Classical IP over ATM
->20	lelong		107		(Frame Relay
->20	lelong		108		(OpenBSD loopback
->20	lelong		109		(OpenBSD IPsec encrypted
->20	lelong		112		(Cisco HDLC
->20	lelong		113		(Linux "cooked"
->20	lelong		114		(LocalTalk
->20	lelong		117		(OpenBSD PFLOG
->20	lelong		119		(802.11 with Prism header
->20	lelong		122		(RFC 2625 IP over Fibre Channel
->20	lelong		123		(SunATM
->20	lelong		127		(802.11 with radiotap header
->20	lelong		129		(Linux ARCNET
->20	lelong		138		(Apple IP over IEEE 1394
->20	lelong		140		(MTP2
->20	lelong		141		(MTP3
->20	lelong		143		(DOCSIS
->20	lelong		144		(IrDA
->20	lelong		147		(Private use 0
->20	lelong		148		(Private use 1
->20	lelong		149		(Private use 2
->20	lelong		150		(Private use 3
->20	lelong		151		(Private use 4
->20	lelong		152		(Private use 5
->20	lelong		153		(Private use 6
->20	lelong		154		(Private use 7
->20	lelong		155		(Private use 8
->20	lelong		156		(Private use 9
->20	lelong		157		(Private use 10
->20	lelong		158		(Private use 11
->20	lelong		159		(Private use 12
->20	lelong		160		(Private use 13
->20	lelong		161		(Private use 14
->20	lelong		162		(Private use 15
->20	lelong		163		(802.11 with AVS header
->16	lelong		x		\b, capture length %d)
+>0	use	\^pcap-be
 
 #
 # "libpcap"-with-Alexey-Kuznetsov's-patches capture files.
@@ -211,43 +201,9 @@
 # that use "libpcap", or that use the same capture file format.)
 #
 0	ubelong		0xa1b2cd34	extended tcpdump capture file (big-endian)
->4	beshort		x		- version %d
->6	beshort		x		\b.%d
->20	belong		0		(No link-layer encapsulation
->20	belong		1		(Ethernet
->20	belong		2		(3Mb Ethernet
->20	belong		3		(AX.25
->20	belong		4		(ProNET
->20	belong		5		(CHAOS
->20	belong		6		(Token Ring
->20	belong		7		(ARCNET
->20	belong		8		(SLIP
->20	belong		9		(PPP
->20	belong		10		(FDDI
->20	belong		11		(RFC 1483 ATM
->20	belong		12		(raw IP
->20	belong		13		(BSD/OS SLIP
->20	belong		14		(BSD/OS PPP
->16	belong		x		\b, capture length %d)
+>0	use	pcap-be
 0	ulelong		0xa1b2cd34	extended tcpdump capture file (little-endian)
->4	leshort		x		- version %d
->6	leshort		x		\b.%d
->20	lelong		0		(No link-layer encapsulation
->20	lelong		1		(Ethernet
->20	lelong		2		(3Mb Ethernet
->20	lelong		3		(AX.25
->20	lelong		4		(ProNET
->20	lelong		5		(CHAOS
->20	lelong		6		(Token Ring
->20	lelong		7		(ARCNET
->20	lelong		8		(SLIP
->20	lelong		9		(PPP
->20	lelong		10		(FDDI
->20	lelong		11		(RFC 1483 ATM
->20	lelong		12		(raw IP
->20	lelong		13		(BSD/OS SLIP
->20	lelong		14		(BSD/OS PPP
->16	lelong		x		\b, capture length %d)
+>0	use	\^pcap-be
 
 #
 # "pcap-ng" capture files.
@@ -295,9 +251,9 @@
 >8	lelong		x		\b, %d stations found
 
 #
-# EtherPeek/AiroPeek "version 9" capture files.
+# *Peek tagged capture files.
 #
-0	string		\177ver		EtherPeek/AiroPeek capture file
+0	string		\177ver		EtherPeek/AiroPeek/OmniPeek capture file
 
 #
 # Visual Networks traffic capture files.

+ 23 - 4
magic/Magdir/sql

@@ -1,22 +1,34 @@
 
 #------------------------------------------------------------------------------
-# $File: sql,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: sql,v 1.11 2013/02/21 15:27:01 christos Exp $
 # sql:  file(1) magic for SQL files
 #
 # From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
 # Recognize some MySQL files.
+# Elan Ruusamae <glen@delfi.ee>, added MariaDB signatures
+# from https://bazaar.launchpad.net/~maria-captains/maria/5.5/view/head:/support-files/magic
 #
 0	beshort			0xfe01		MySQL table definition file
 >2	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0300	MySQL MISAM index file
+0	belong&0xffffff00	0xfefe0700	MySQL MyISAM index file
 >3	byte			x		Version %d
-0	belong&0xffffff00	0xfefe0700	MySQL MISAM compressed data file
+0	belong&0xffffff00	0xfefe0800	MySQL MyISAM compressed data file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0900	MySQL Maria index file
+>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0A00	MySQL Maria compressed data file
 >3	byte			x		Version %d
 0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
 >3	byte			x		Version %d
 0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
 >3	byte			x		Version %d
-0	string		 	\376bin		MySQL replication log
+0	string			\376bin		MySQL replication log
+0	belong&0xffffff00	0xfefe0b00
+>4	string			MARIALOG	MySQL Maria transaction log file
+>>3	byte			x		Version %d
+0	belong&0xffffff00	0xfefe0c00
+>4	string			MACF		MySQL Maria control file
+>>3	byte			x		Version %d
 
 #------------------------------------------------------------------------------
 # iRiver H Series database file 
@@ -44,3 +56,10 @@
 >60 string  _MTN               Monotone source repository
 >60 belong  !0                 SQLite 3.x database, user version %u
 >60 belong  0                  SQLite 3.x database
+
+# 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/
+# pceditor_V2003.jar
+0	string		PSDB\0			Panasonic channel list database
+>126	string		SQLite\ format\ 3	
+>>&-15	indirect	x			\b; contains 

+ 37 - 30
magic/Magdir/sun

@@ -1,12 +1,15 @@
 
 #------------------------------------------------------------------------------
-# $File: sun,v 1.22 2011/02/10 01:52:51 christos Exp $
+# $File: sun,v 1.25 2013/01/09 22:37:24 christos Exp $
 # sun:  file(1) magic for Sun machines
 #
 # Values for big-endian Sun (MC680x0, SPARC) binaries on pre-5.x
-# releases.  (5.x uses ELF.)
+# releases.  (5.x uses ELF.)  Entries for executables without an
+# architecture type, used before the 68020-based Sun-3's came out,
+# are in aout, as they're indistinguishable from other big-endian
+# 32-bit a.out files.
 #
-0	belong&077777777	0600413		sparc demand paged
+0	belong&077777777	0600413		a.out SunOS sparc demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -14,17 +17,17 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0600410		sparc pure
+0	belong&077777777	0600410		a.out SunOS sparc pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0600407		sparc
+0	belong&077777777	0600407		a.out SunOS sparc
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400413		mc68020 demand paged
+0	belong&077777777	0400413		a.out SunOS mc68020 demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -32,17 +35,17 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400410		mc68020 pure
+0	belong&077777777	0400410		a.out SunOS mc68020 pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0400407		mc68020
+0	belong&077777777	0400407		a.out SunOS mc68020
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200413		mc68010 demand paged
+0	belong&077777777	0200413		a.out SunOS mc68010 demand paged
 >0	byte		&0x80
 >>20	belong		<4096		shared library
 >>20	belong		=4096		dynamically linked executable
@@ -50,24 +53,16 @@
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200410		mc68010 pure
+0	belong&077777777	0200410		a.out SunOS mc68010 pure
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-0	belong&077777777	0200407		mc68010
+0	belong&077777777	0200407		a.out SunOS mc68010
 >0	byte		&0x80		dynamically linked executable
 >0	byte		^0x80		executable
 >16	belong		>0		not stripped
 
-# reworked these to avoid anything beginning with zero becoming "old sun-2"
-0	belong		0407		old sun-2 executable
->16	belong		>0		not stripped
-0	belong		0410		old sun-2 pure executable
->16	belong		>0		not stripped
-0	belong		0413		old sun-2 demand paged executable
->16	belong		>0		not stripped
-
 #
 # Core files.  "SPARC 4.x BCP" means "core file from a SunOS 4.x SPARC
 # binary executed in compatibility mode under SunOS 5.x".
@@ -96,7 +91,10 @@
 # Sun SunPC
 0	long		0xfa33c08e	SunPC 4.0 Hard Disk
 0	string		#SUNPC_CONFIG	SunPC 4.0 Properties Values
-# Sun snoop (see RFC 1761, which describes the capture file format).
+# Sun snoop (see RFC 1761, which describes the capture file format,
+# RFC 3827, which describes some additional datalink types, and
+# http://www.iana.org/assignments/snoop-datalink-types/snoop-datalink-types.xml,
+# which is the IANA registry of Snoop datalink types)
 #
 0	string		snoop		Snoop capture file
 >8	belong		>0		- version %ld
@@ -109,14 +107,25 @@
 >12	belong		6		(Character synchronous)
 >12	belong		7		(IBM channel-to-channel adapter)
 >12	belong		8		(FDDI)
->12	belong		9		(Unknown)
-
-# Microsoft ICM color profile
-36	string		acspMSFT	Microsoft ICM Color Profile
-!:mime	application/vnd.iccprofile
-# Sun KCMS
-36	string		acsp		Kodak Color Management System, ICC Profile
-!:mime	application/vnd.iccprofile
+>12	belong		9		(Other)
+>12	belong		10		(type %ld)
+>12	belong		11		(type %ld)
+>12	belong		12		(type %ld)
+>12	belong		13		(type %ld)
+>12	belong		14		(type %ld)
+>12	belong		15		(type %ld)
+>12	belong		16		(Fibre Channel)
+>12	belong		17		(ATM)
+>12	belong		18		(ATM Classical IP)
+>12	belong		19		(type %ld)
+>12	belong		20		(type %ld)
+>12	belong		21		(type %ld)
+>12	belong		22		(type %ld)
+>12	belong		23		(type %ld)
+>12	belong		24		(type %ld)
+>12	belong		25		(type %ld)
+>12	belong		26		(IP over Infiniband)
+>12	belong		>26		(type %ld)
 
 #---------------------------------------------------------------------------
 # The following entries have been tested by Duncan Laurie <duncan@sun.com> (a
@@ -130,5 +139,3 @@
 # New format for Sun/Cobalt boot ROMs is annoying, it stores the version code
 # at the very end where file(1) can't get it.
 0       string CRfs     COBALT boot rom data (Flat boot rom or file system)
-
-

+ 23 - 24
magic/Magdir/unknown

@@ -1,35 +1,34 @@
 
 #------------------------------------------------------------------------------
-# $File: unknown,v 1.7 2009/09/19 16:28:13 christos Exp $
+# $File: unknown,v 1.8 2013/01/09 22:37:24 christos Exp $
 # unknown:  file(1) magic for unknown machines
 #
-# XXX - this probably should be pruned, as it'll match PDP-11 and
-# VAX image formats.
-#
-# 0x107 is 0407; 0x108 is 0410; both are PDP-11 (executable and pure,
-# respectively).
-#
-# 0x109 is 0411; that's PDP-11 split I&D, but the PDP-11 version doesn't
-# have the "version %ld", which may be a bogus COFFism (I don't think
-# there ever was COFF for the PDP-11).
+# 0x107 is 0407, 0x108 is 0410, and 0x109 is 0411; those are all PDP-11
+# (executable, pure, and split I&D, respectively), but the PDP-11 version
+# doesn't have the "version %ld", which may be a bogus COFFism (I don't
+# think there was ever COFF for the PDP-11).
 #
 # 0x10B is 0413; that's VAX demand-paged, but this is a short, not a
-# long, as it would be on a VAX.
+# long, as it would be on a VAX.  In any case, that could collide with
+# VAX demand-paged files, as the magic number is little-endian on those
+# binaries, so the first 16 bits of the file would contain 0x10B.
+#
+# Therefore, those entries are commented out.
 #
-# 0x10C is 0414 and 0x10E is 416; those *are* unknown.
+# 0x10C is 0414 and 0x10E is 0416; those *are* unknown.
 #
-0	short		0x107		unknown machine executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x108		unknown pure executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x109		PDP-11 separate I&D
->8	short		>0		not stripped
->15	byte		>0		- version %ld
-0	short		0x10b		unknown pure executable
->8	short		>0		not stripped
->15	byte		>0		- version %ld
+#0	short		0x107		unknown machine executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x108		unknown pure executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x109		PDP-11 separate I&D
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
+#0	short		0x10b		unknown pure executable
+#>8	short		>0		not stripped
+#>15	byte		>0		- version %ld
 0	long		0x10c		unknown demand paged pure executable
 >16	long		>0		not stripped
 0	long		0x10e		unknown readable demand paged pure executable

+ 16 - 0
magic/Magdir/uterus

@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# $File: uterus,v 1.1 2012/12/18 18:53:32 christos Exp $
+# file(1) magic for uterus files
+# http://freecode.com/projects/uterus
+#
+0	string		UTE+	uterus file
+>4	string		v	\b, version
+>5	byte		x	%c
+>6	string		.	\b.
+>7	byte		x	\b%c
+>8	string		\<\>	\b, big-endian
+>>16	belong		>0	\b, slut size %u
+>8	string		\>\<	\b, litte-endian
+>>16	lelong		>0	\b, slut size %u
+>10	byte		&8	\b, compressed

+ 5 - 13
magic/Magdir/vax

@@ -1,30 +1,22 @@
 
 #------------------------------------------------------------------------------
-# $File: vax,v 1.7 2009/09/19 16:28:13 christos Exp $
+# $File: vax,v 1.8 2013/01/09 22:37:24 christos Exp $
 # vax:  file(1) magic for VAX executable/object and APL workspace
 #
 0	lelong		0101557		VAX single precision APL workspace
 0	lelong		0101556		VAX double precision APL workspace
 
 #
-# VAX a.out (32V, BSD)
+# VAX a.out (BSD; others collide with 386 and other 32-bit little-endian
+# executables, and are handled in aout)
 #
-0	lelong		0407		VAX executable
->16	lelong		>0		not stripped
-
-0	lelong		0410		VAX pure executable
->16	lelong		>0		not stripped
-
-0	lelong		0413		VAX demand paged pure executable
->16	lelong		>0		not stripped
-
-0	lelong		0420		VAX demand paged (first page unmapped) pure executable
+0	lelong		0420		a.out VAX demand paged (first page unmapped) pure executable
 >16	lelong		>0		not stripped
 
 #
 # VAX COFF
 #
-# The `versions' should be un-commented if they work for you.
+# The `versions' were commented out, but have been un-commented out.
 # (Was the problem just one of endianness?)
 #
 0	leshort		0570		VAX COFF executable

+ 46 - 3
magic/Magdir/windows

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: windows,v 1.4 2009/09/19 16:28:13 christos Exp $
+# $File: windows,v 1.5 2012/04/03 22:25:07 christos Exp $
 # windows:  file(1) magic for Microsoft Windows
 #
 # This file is mainly reserved for files where programs
@@ -75,12 +75,55 @@
 0	string		HyperTerminal\ 
 >15	string		1.0\ --\ HyperTerminal\ data\ file	MS Windows HyperTerminal profile
 
-
+# http://ithreats.files.wordpress.com/2009/05/\
+# lnk_the_windows_shortcut_file_format.pdf
 # Summary: Windows shortcut
 # Extension: .lnk
 # Created by: unknown
+# 'L' + GUUID
 0	string		\114\0\0\0\001\024\002\0\0\0\0\0\300\0\0\0\0\0\0\106	MS Windows shortcut
-
+>20	lelong&1	1	\b, Item id list present
+>20	lelong&2	2	\b, Points to a file or directory
+>20	lelong&4	4	\b, Has Description string
+>20	lelong&8	8	\b, Has Relative path
+>20	lelong&16	16	\b, Has Working directory
+>20	lelong&32	32	\b, Has command line arguments
+>20	lelong&64	64	\b, Icon
+>>56	lelong			\b number=%d
+>24	lelong&1	1	\b, Read-Only
+>24	lelong&2	2	\b, Hidden
+>24	lelong&4	4	\b, System
+>24	lelong&8	8	\b, Volume Label
+>24	lelong&16	16	\b, Directory
+>24	lelong&32	32	\b, Archive
+>24	lelong&64	64	\b, Encrypted
+>24	lelong&128	128	\b, Normal
+>24	lelong&256	256	\b, Temporary
+>24	lelong&512	512	\b, Sparse
+>24	lelong&1024	1024	\b, Reparse point
+>24	lelong&2048	2048	\b, Compressed
+>24	lelong&4096	4096	\b, Offline
+>28	leqwdate	x	\b, ctime=%s
+>36	leqwdate	x	\b, mtime=%s
+>44	leqwdate	x	\b, atime=%s
+>52	lelong		x	\b, length=%u, window=
+>60	lelong&1	1	\bhide
+>60	lelong&2	2	\bnormal
+>60	lelong&4	4	\bshowminimized
+>60	lelong&8	8	\bshowmaximized
+>60	lelong&16	16	\bshownoactivate
+>60	lelong&32	32	\bminimize
+>60	lelong&64	64	\bshowminnoactive
+>60	lelong&128	128	\bshowna
+>60	lelong&256	256	\brestore
+>60	lelong&512	512	\bshowdefault
+#>20	lelong&1	0
+#>>20	lelong&2	2
+#>>>(72.l-64)	pstring/h	x	\b [%s]
+#>20	lelong&1	1
+#>>20	lelong&2	2
+#>>>(72.s)	leshort	x
+#>>>&75	pstring/h	x	\b [%s]
 
 # Summary: Outlook Personal Folders
 # Created by: unknown

+ 6 - 2
magic/Magdir/wordprocessors

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: wordprocessors,v 1.15 2010/09/20 19:19:17 rrt Exp $
+# $File: wordprocessors,v 1.17 2013/02/06 14:18:52 christos Exp $
 # wordprocessors:  file(1) magic fo word processors.
 #
 ####### PWP file format used on Smith Corona Personal Word Processors:
@@ -110,7 +110,7 @@
 512	string		R\0o\0o\0t\0	Hangul (Korean) Word Processor File 2000
 !:mime	application/x-hwp
 
-# CosmicBook, from Benoît Rouits
+# CosmicBook, from Benoit Rouits
 0       string  CSBK    Ted Neslson's CosmicBook hypertext file
 
 2       string  EYWR    AmigaWriter file
@@ -161,3 +161,7 @@
 0	string	\<SCRIBUSUTF8\ Version		Scribus Document
 0	string	\<SCRIBUSUTF8NEW\ Version	Scribus Document
 !:mime	application/x-scribus
+
+# help files .hlp compiled from html and used by gfxboot added by Joerg Jenderek
+# markups page=0x04,label=0x12, followed by strings like "opt" or "main" and title=0x14
+0	ulelong&0x8080FFFF	0x00001204	gfxboot compiled html help file

+ 2 - 2
magic/Magdir/wsdl

@@ -1,11 +1,11 @@
 
 #------------------------------------------------------------------------------
-# $File: wsdl,v 1.1 2011/01/19 19:34:50 christos Exp $
+# $File: wsdl,v 1.3 2013/02/06 14:18:52 christos Exp $
 # wsdl: PHP WSDL Cache, http://www.php.net/manual/en/book.soap.php
 # Cache format extracted from source:
 # http://svn.php.net/viewvc/php/php-src/trunk/ext/soap/php_sdl.c?revision=HEAD&view=markup
 # Requires file >= 5.05, see http://mx.gw.com/pipermail/file/2010/000683.html
-# By Elan Ruusamäe <glen@delfi.ee>, Patryk Zawadzki <patrys@pld-linux.org>, 2010-2011
+# By Elan Ruusamae <glen@delfi.ee>, Patryk Zawadzki <patrys@pld-linux.org>, 2010-2011
 0		string		wsdl		PHP WSDL cache,
 >4		byte		x		version 0x%02x
 >6		ledate		x		\b, created %s

+ 4 - 1
magic/Magdir/xilinx

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: xilinx,v 1.4 2009/09/19 16:28:13 christos Exp $
+# $File: xilinx,v 1.5 2013/01/08 03:06:50 christos Exp $
 # This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
 # Xilinx-Magic@RevRagnarok.com
 # Got the info from FPGA-FAQ 0026
@@ -33,3 +33,6 @@
 >>>>>>>>&1	byte	0x00
 >>>>>>>>&2	string	e
 >>>>>>>>&4	belong	x	- data length 0x%lx
+# Raw bitstream files
+0	long	0xffffffff	
+>&0	belong	0xaa995566	Xilinx RAW bitstream (.BIN)

+ 2 - 2
magic/Magdir/xwindows

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: xwindows,v 1.7 2011/05/03 01:44:17 christos Exp $
+# $File: xwindows,v 1.8 2013/02/08 17:25:57 christos Exp $
 # xwindows:  file(1) magic for various X/Window system file formats.
 
 # Compiled X Keymap 
@@ -10,7 +10,7 @@
 >0	byte	=0				obsolete
 0	string	xkm				Compiled XKB Keymap: msb,
 >3	byte	>0				version %d
->0	byte	=0				obsolete
+>3	byte	=0				obsolete
 
 # xfsdump archive
 0	string	xFSdump0			xfsdump archive

+ 11 - 2
magic/Makefile.am

@@ -1,5 +1,5 @@
 #
-# $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
+# $File: Makefile.am,v 1.89 2013/02/18 18:31:09 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -18,6 +18,7 @@ $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
 $(MAGIC_FRAGMENT_DIR)/animation \
+$(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apple \
 $(MAGIC_FRAGMENT_DIR)/applix \
@@ -53,6 +54,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/database \
@@ -84,9 +86,10 @@ $(MAGIC_FRAGMENT_DIR)/gcc \
 $(MAGIC_FRAGMENT_DIR)/geo \
 $(MAGIC_FRAGMENT_DIR)/geos \
 $(MAGIC_FRAGMENT_DIR)/gimp \
-$(MAGIC_FRAGMENT_DIR)/gnome-keyring \
+$(MAGIC_FRAGMENT_DIR)/gnome \
 $(MAGIC_FRAGMENT_DIR)/gnu \
 $(MAGIC_FRAGMENT_DIR)/gnumeric \
+$(MAGIC_FRAGMENT_DIR)/gpt \
 $(MAGIC_FRAGMENT_DIR)/grace \
 $(MAGIC_FRAGMENT_DIR)/graphviz \
 $(MAGIC_FRAGMENT_DIR)/gringotts \
@@ -96,6 +99,7 @@ $(MAGIC_FRAGMENT_DIR)/hp \
 $(MAGIC_FRAGMENT_DIR)/human68k \
 $(MAGIC_FRAGMENT_DIR)/ibm370 \
 $(MAGIC_FRAGMENT_DIR)/ibm6000 \
+$(MAGIC_FRAGMENT_DIR)/icc \
 $(MAGIC_FRAGMENT_DIR)/iff \
 $(MAGIC_FRAGMENT_DIR)/images \
 $(MAGIC_FRAGMENT_DIR)/inform \
@@ -105,9 +109,11 @@ $(MAGIC_FRAGMENT_DIR)/island \
 $(MAGIC_FRAGMENT_DIR)/ispell \
 $(MAGIC_FRAGMENT_DIR)/isz \
 $(MAGIC_FRAGMENT_DIR)/java \
+$(MAGIC_FRAGMENT_DIR)/javascript \
 $(MAGIC_FRAGMENT_DIR)/jpeg \
 $(MAGIC_FRAGMENT_DIR)/karma \
 $(MAGIC_FRAGMENT_DIR)/kde \
+$(MAGIC_FRAGMENT_DIR)/keepass \
 $(MAGIC_FRAGMENT_DIR)/kml \
 $(MAGIC_FRAGMENT_DIR)/lecter \
 $(MAGIC_FRAGMENT_DIR)/lex \
@@ -119,6 +125,7 @@ $(MAGIC_FRAGMENT_DIR)/lua \
 $(MAGIC_FRAGMENT_DIR)/luks \
 $(MAGIC_FRAGMENT_DIR)/m4 \
 $(MAGIC_FRAGMENT_DIR)/mach \
+$(MAGIC_FRAGMENT_DIR)/macos \
 $(MAGIC_FRAGMENT_DIR)/macintosh \
 $(MAGIC_FRAGMENT_DIR)/magic \
 $(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -178,6 +185,7 @@ $(MAGIC_FRAGMENT_DIR)/printer \
 $(MAGIC_FRAGMENT_DIR)/project \
 $(MAGIC_FRAGMENT_DIR)/psdbms \
 $(MAGIC_FRAGMENT_DIR)/pulsar \
+$(MAGIC_FRAGMENT_DIR)/pwsafe \
 $(MAGIC_FRAGMENT_DIR)/pyramid \
 $(MAGIC_FRAGMENT_DIR)/python \
 $(MAGIC_FRAGMENT_DIR)/revision \
@@ -222,6 +230,7 @@ $(MAGIC_FRAGMENT_DIR)/tuxedo \
 $(MAGIC_FRAGMENT_DIR)/typeset \
 $(MAGIC_FRAGMENT_DIR)/unicode \
 $(MAGIC_FRAGMENT_DIR)/unknown \
+$(MAGIC_FRAGMENT_DIR)/uterus \
 $(MAGIC_FRAGMENT_DIR)/uuencode \
 $(MAGIC_FRAGMENT_DIR)/varied.out \
 $(MAGIC_FRAGMENT_DIR)/varied.script \

+ 17 - 5
magic/Makefile.in

@@ -39,7 +39,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -90,6 +91,7 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -104,6 +106,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -196,7 +199,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #
-# $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
+# $File: Makefile.am,v 1.89 2013/02/18 18:31:09 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -213,6 +216,7 @@ $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/amanda \
 $(MAGIC_FRAGMENT_DIR)/amigaos \
 $(MAGIC_FRAGMENT_DIR)/animation \
+$(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apple \
 $(MAGIC_FRAGMENT_DIR)/applix \
@@ -248,6 +252,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/cubemap \
 $(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/database \
@@ -279,9 +284,10 @@ $(MAGIC_FRAGMENT_DIR)/gcc \
 $(MAGIC_FRAGMENT_DIR)/geo \
 $(MAGIC_FRAGMENT_DIR)/geos \
 $(MAGIC_FRAGMENT_DIR)/gimp \
-$(MAGIC_FRAGMENT_DIR)/gnome-keyring \
+$(MAGIC_FRAGMENT_DIR)/gnome \
 $(MAGIC_FRAGMENT_DIR)/gnu \
 $(MAGIC_FRAGMENT_DIR)/gnumeric \
+$(MAGIC_FRAGMENT_DIR)/gpt \
 $(MAGIC_FRAGMENT_DIR)/grace \
 $(MAGIC_FRAGMENT_DIR)/graphviz \
 $(MAGIC_FRAGMENT_DIR)/gringotts \
@@ -291,6 +297,7 @@ $(MAGIC_FRAGMENT_DIR)/hp \
 $(MAGIC_FRAGMENT_DIR)/human68k \
 $(MAGIC_FRAGMENT_DIR)/ibm370 \
 $(MAGIC_FRAGMENT_DIR)/ibm6000 \
+$(MAGIC_FRAGMENT_DIR)/icc \
 $(MAGIC_FRAGMENT_DIR)/iff \
 $(MAGIC_FRAGMENT_DIR)/images \
 $(MAGIC_FRAGMENT_DIR)/inform \
@@ -300,9 +307,11 @@ $(MAGIC_FRAGMENT_DIR)/island \
 $(MAGIC_FRAGMENT_DIR)/ispell \
 $(MAGIC_FRAGMENT_DIR)/isz \
 $(MAGIC_FRAGMENT_DIR)/java \
+$(MAGIC_FRAGMENT_DIR)/javascript \
 $(MAGIC_FRAGMENT_DIR)/jpeg \
 $(MAGIC_FRAGMENT_DIR)/karma \
 $(MAGIC_FRAGMENT_DIR)/kde \
+$(MAGIC_FRAGMENT_DIR)/keepass \
 $(MAGIC_FRAGMENT_DIR)/kml \
 $(MAGIC_FRAGMENT_DIR)/lecter \
 $(MAGIC_FRAGMENT_DIR)/lex \
@@ -314,6 +323,7 @@ $(MAGIC_FRAGMENT_DIR)/lua \
 $(MAGIC_FRAGMENT_DIR)/luks \
 $(MAGIC_FRAGMENT_DIR)/m4 \
 $(MAGIC_FRAGMENT_DIR)/mach \
+$(MAGIC_FRAGMENT_DIR)/macos \
 $(MAGIC_FRAGMENT_DIR)/macintosh \
 $(MAGIC_FRAGMENT_DIR)/magic \
 $(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -373,6 +383,7 @@ $(MAGIC_FRAGMENT_DIR)/printer \
 $(MAGIC_FRAGMENT_DIR)/project \
 $(MAGIC_FRAGMENT_DIR)/psdbms \
 $(MAGIC_FRAGMENT_DIR)/pulsar \
+$(MAGIC_FRAGMENT_DIR)/pwsafe \
 $(MAGIC_FRAGMENT_DIR)/pyramid \
 $(MAGIC_FRAGMENT_DIR)/python \
 $(MAGIC_FRAGMENT_DIR)/revision \
@@ -417,6 +428,7 @@ $(MAGIC_FRAGMENT_DIR)/tuxedo \
 $(MAGIC_FRAGMENT_DIR)/typeset \
 $(MAGIC_FRAGMENT_DIR)/unicode \
 $(MAGIC_FRAGMENT_DIR)/unknown \
+$(MAGIC_FRAGMENT_DIR)/uterus \
 $(MAGIC_FRAGMENT_DIR)/uuencode \
 $(MAGIC_FRAGMENT_DIR)/varied.out \
 $(MAGIC_FRAGMENT_DIR)/varied.script \
@@ -465,9 +477,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu magic/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign magic/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu magic/Makefile
+	  $(AUTOMAKE) --foreign magic/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

+ 6 - 3
python/Makefile.in

@@ -38,7 +38,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -66,6 +67,7 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -80,6 +82,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -183,9 +186,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu python/Makefile
+	  $(AUTOMAKE) --foreign python/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

+ 8 - 1
src/Makefile.am

@@ -5,7 +5,7 @@ include_HEADERS = magic.h
 bin_PROGRAMS = file
 
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CFLAGS = @WARNINGS@
+AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
@@ -21,3 +21,10 @@ libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
 
 file_SOURCES = file.c
 file_LDADD = libmagic.la
+CLEANFILES = magic.h
+EXTRA_DIST = magic.h.in
+HDR= $(top_srcdir)/src/magic.h.in
+BUILT_SOURCES = magic.h
+
+magic.h:	${HDR}
+	sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@

+ 40 - 18
src/Makefile.in

@@ -38,13 +38,15 @@ host_triplet = @host@
 bin_PROGRAMS = file$(EXEEXT)
 subdir = src
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in asprintf.c getline.c getopt_long.c \
-	strlcat.c strlcpy.c vasprintf.c
+	$(srcdir)/Makefile.in asctime_r.c asprintf.c ctime_r.c \
+	getline.c getopt_long.c pread.c strlcat.c strlcpy.c \
+	vasprintf.c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -136,6 +138,7 @@ AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
@@ -150,6 +153,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -244,7 +248,7 @@ MAGIC = $(pkgdatadir)/magic
 lib_LTLIBRARIES = libmagic.la
 include_HEADERS = magic.h
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CFLAGS = @WARNINGS@
+AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
 	funcs.c file.h readelf.h tar.h apptype.c \
@@ -256,7 +260,12 @@ libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
 libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
 file_SOURCES = file.c
 file_LDADD = libmagic.la
-all: all-am
+CLEANFILES = magic.h
+EXTRA_DIST = magic.h.in
+HDR = $(top_srcdir)/src/magic.h.in
+BUILT_SOURCES = magic.h
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
@@ -269,9 +278,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/Makefile
+	  $(AUTOMAKE) --foreign src/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -376,9 +385,12 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asctime_r.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ctime_r.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)/pread.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)/vasprintf.Plo@am__quote@
@@ -400,24 +412,27 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
 @am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
 @am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@@ -532,7 +547,8 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 install-binPROGRAMS: install-libLTLIBRARIES
 
@@ -540,7 +556,8 @@ installdirs:
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -557,6 +574,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -565,6 +583,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
@@ -637,7 +656,7 @@ ps-am:
 uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
 	uninstall-libLTLIBRARIES
 
-.MAKE: 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 ctags \
@@ -656,6 +675,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
 	uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
 
+magic.h:	${HDR}
+	sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

File diff suppressed because it is too large
+ 686 - 276
src/apprentice.c


+ 2 - 2
src/ascmagic.c

@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef	lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.84 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.85 2012/08/09 16:33:15 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
@@ -134,7 +134,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
 		goto done;
 	}
 
-	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
+	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
 		/* Convert ubuf to UTF-8 and try text soft magic */
 		/* malloc size is a conservative overestimate; could be
 		   improved, or at least realloced after conversion. */

+ 19 - 0
src/asctime_r.c

@@ -0,0 +1,19 @@
+/*	$File: asctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $	*/
+
+#include "file.h"
+#ifndef	lint
+FILE_RCSID("@(#)$File: asctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $")
+#endif	/* lint */
+#include <time.h>
+#include <string.h>
+
+/* asctime_r is not thread-safe anyway */
+char *
+asctime_r(const struct tm *t, char *dst)
+{
+	char *p = asctime(t);
+	if (p == NULL)
+		return NULL;
+	memcpy(dst, p, 26);
+	return dst;
+}

+ 5 - 6
src/cdf.c

@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.50 2012/02/20 22:35:29 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.52 2013/02/18 15:40:59 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -268,10 +268,10 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
 	const char *b = (const char *)sst->sst_tab;
 	const char *e = ((const char *)p) + tail;
 	(void)&line;
-	if (e >= b && (size_t)(e - b) < CDF_SEC_SIZE(h) * sst->sst_len)
+	if (e >= b && (size_t)(e - b) <= CDF_SEC_SIZE(h) * sst->sst_len)
 		return 0;
-	DPRINTF(("%d: offset begin %p end %p %" SIZE_T_FORMAT "u"
-	    " >= %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
+	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
+	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
 	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
 	    CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
 	errno = EFTYPE;
@@ -296,10 +296,9 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
 	if (info->i_fd == -1)
 		return -1;
 
-	if (lseek(info->i_fd, off, SEEK_SET) == (off_t)-1)
 		return -1;
 
-	if (read(info->i_fd, buf, len) != (ssize_t)len)
+	if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
 		return -1;
 
 	return (ssize_t)len;

+ 1 - 1
src/cdf.h

@@ -308,7 +308,7 @@ int cdf_print_elapsed_time(char *, size_t, cdf_timestamp_t);
 uint16_t cdf_tole2(uint16_t);
 uint32_t cdf_tole4(uint32_t);
 uint64_t cdf_tole8(uint64_t);
-char *cdf_ctime(const time_t *);
+char *cdf_ctime(const time_t *, char *);
 
 #ifdef CDF_DEBUG
 void cdf_dump_header(const cdf_header_t *);

+ 8 - 9
src/cdf_time.c

@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf_time.c,v 1.11 2011/12/13 13:48:41 christos Exp $")
+FILE_RCSID("@(#)$File: cdf_time.c,v 1.12 2012/05/15 17:14:36 christos Exp $")
 #endif
 
 #include <time.h>
@@ -166,15 +166,13 @@ cdf_timespec_to_timestamp(cdf_timestamp_t *t, const struct timespec *ts)
 }
 
 char *
-cdf_ctime(const time_t *sec)
+cdf_ctime(const time_t *sec, char *buf)
 {
-	static char ctbuf[26];
-	char *ptr = ctime(sec);
+	char *ptr = ctime_r(sec, buf);
 	if (ptr != NULL)
-		return ptr;
-	(void)snprintf(ctbuf, sizeof(ctbuf), "*Bad* 0x%16.16llx\n",
-	    (long long)*sec);
-	return ctbuf;
+		return buf;
+	(void)snprintf(buf, 26, "*Bad* 0x%16.16llx\n", (long long)*sec);
+	return buf;
 }
 
 
@@ -183,12 +181,13 @@ int
 main(int argc, char *argv[])
 {
 	struct timespec ts;
+	char buf[25];
 	static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
 	static const char *ref = "Sat Apr 23 01:30:00 1977";
 	char *p, *q;
 
 	cdf_timestamp_to_timespec(&ts, tst);
-	p = cdf_ctime(&ts.tv_sec);
+	p = cdf_ctime(&ts.tv_sec, buf);
 	if ((q = strchr(p, '\n')) != NULL)
 		*q = '\0';
 	if (strcmp(ref, p) != 0)

+ 17 - 16
src/compress.c

@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.68 2011/12/08 12:38:24 rrt Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.70 2012/11/07 17:54:48 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -168,12 +168,9 @@ swrite(int fd, const void *buf, size_t n)
  * `safe' read for sockets and pipes.
  */
 protected ssize_t
-sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
+sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
 {
 	ssize_t rv;
-#ifdef FD_ZERO
-	ssize_t cnt;
-#endif
 #ifdef FIONREAD
 	int t = 0;
 #endif
@@ -183,8 +180,9 @@ sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
 		goto nocheck;
 
 #ifdef FIONREAD
-	if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {
+	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
 #ifdef FD_ZERO
+		ssize_t cnt;
 		for (cnt = 0;; cnt++) {
 			fd_set check;
 			struct timeval tout = {0, 100 * 1000};
@@ -241,9 +239,6 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 	char buf[4096];
 	ssize_t r;
 	int tfd;
-#ifdef HAVE_MKSTEMP
-	int te;
-#endif
 
 	(void)strlcpy(buf, "/tmp/file.XXXXXX", sizeof buf);
 #ifndef HAVE_MKSTEMP
@@ -255,10 +250,13 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
 		errno = r;
 	}
 #else
-	tfd = mkstemp(buf);
-	te = errno;
-	(void)unlink(buf);
-	errno = te;
+	{
+		int te;
+		tfd = mkstemp(buf);
+		te = errno;
+		(void)unlink(buf);
+		errno = te;
+	}
 #endif
 	if (tfd == -1) {
 		file_error(ms, errno,
@@ -399,16 +397,19 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
 	case 0:	/* child */
 		(void) close(0);
 		if (fd != -1) {
-		    (void) dup(fd);
+		    if (dup(fd) == -1)
+			_exit(1);
 		    (void) lseek(0, (off_t)0, SEEK_SET);
 		} else {
-		    (void) dup(fdin[0]);
+		    if (dup(fdin[0]) == -1)
+			_exit(1);
 		    (void) close(fdin[0]);
 		    (void) close(fdin[1]);
 		}
 
 		(void) close(1);
-		(void) dup(fdout[1]);
+		if (dup(fdout[1]) == -1)
+			_exit(1);
 		(void) close(fdout[0]);
 		(void) close(fdout[1]);
 #ifndef DEBUG

+ 0 - 0
src/ctime_r.c


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