Browse Source

Import upstream version 5.38

Christos Zoulas 11 months ago
parent
commit
460653f3ba
99 changed files with 11337 additions and 6622 deletions
  1. 20 0
      ChangeLog
  2. 15 11
      Makefile.in
  3. 6 1
      README
  4. 123 140
      aclocal.m4
  5. 7 6
      compile
  6. 358 312
      config.guess
  7. 19 5
      config.h.in
  8. 1249 1282
      config.sub
  9. 1543 1044
      configure
  10. 39 2
      configure.ac
  11. 5 5
      depcomp
  12. 9 5
      doc/Makefile.in
  13. 7 4
      doc/file.man
  14. 5 3
      doc/libmagic.man
  15. 3 3
      doc/magic.man
  16. 3501 2008
      ltmain.sh
  17. 1474 1087
      m4/libtool.m4
  18. 90 37
      m4/ltoptions.m4
  19. 4 3
      m4/ltsugar.m4
  20. 6 6
      m4/ltversion.m4
  21. 4 3
      m4/lt~obsolete.m4
  22. 13 3
      magic/Magdir/android
  23. 45 44
      magic/Magdir/animation
  24. 36 24
      magic/Magdir/apple
  25. 53 7
      magic/Magdir/archive
  26. 37 12
      magic/Magdir/audio
  27. 1 1
      magic/Magdir/bsi
  28. 2 2
      magic/Magdir/c-lang
  29. 157 30
      magic/Magdir/cad
  30. 4 1
      magic/Magdir/commands
  31. 10 10
      magic/Magdir/compress
  32. 81 14
      magic/Magdir/console
  33. 19 18
      magic/Magdir/database
  34. 4 5
      magic/Magdir/elf
  35. 2 2
      magic/Magdir/espressif
  36. 25 35
      magic/Magdir/filesystems
  37. 30 26
      magic/Magdir/fonts
  38. 80 0
      magic/Magdir/forth
  39. 18 6
      magic/Magdir/frame
  40. 5 1
      magic/Magdir/games
  41. 31 1
      magic/Magdir/gimp
  42. 13 0
      magic/Magdir/git
  43. 2 2
      magic/Magdir/icc
  44. 281 9
      magic/Magdir/images
  45. 6 1
      magic/Magdir/javascript
  46. 3 3
      magic/Magdir/kml
  47. 6 1
      magic/Magdir/linux
  48. 36 3
      magic/Magdir/macintosh
  49. 11 2
      magic/Magdir/mail.news
  50. 78 1
      magic/Magdir/map
  51. 9 0
      magic/Magdir/modulefile
  52. 173 109
      magic/Magdir/msdos
  53. 3 1
      magic/Magdir/msooxml
  54. 456 18
      magic/Magdir/ole2compounddocs
  55. 17 0
      magic/Magdir/openfst
  56. 16 0
      magic/Magdir/opentimestamps
  57. 7 1
      magic/Magdir/pdf
  58. 46 0
      magic/Magdir/pmem
  59. 19 6
      magic/Magdir/python
  60. 15 1
      magic/Magdir/rpi
  61. 11 0
      magic/Magdir/rst
  62. 3 3
      magic/Magdir/ruby
  63. 3 3
      magic/Magdir/sgml
  64. 5 3
      magic/Magdir/sniffer
  65. 40 0
      magic/Magdir/sosi
  66. 6 0
      magic/Magdir/ssh
  67. 1 6
      magic/Magdir/uuencode
  68. 9 1
      magic/Magdir/varied.script
  69. 12 7
      magic/Magdir/vax
  70. 117 5
      magic/Magdir/windows
  71. 46 4
      magic/Magdir/wordprocessors
  72. 2 2
      magic/Magdir/zip
  73. 9 1
      magic/Makefile.am
  74. 18 6
      magic/Makefile.in
  75. 8 8
      missing
  76. 9 5
      python/Makefile.in
  77. 2 2
      src/Makefile.am
  78. 188 91
      src/Makefile.in
  79. 2 12
      src/apprentice.c
  80. 1 2
      src/ascmagic.c
  81. 2 1
      src/buffer.c
  82. 20 7
      src/cdf.c
  83. 1 0
      src/cdf.h
  84. 165 31
      src/compress.c
  85. 1 2
      src/encoding.c
  86. 8 10
      src/file.c
  87. 2 1
      src/file.h
  88. 4 3
      src/file_opts.h
  89. 7 1
      src/fsmagic.c
  90. 20 3
      src/funcs.c
  91. 197 0
      src/is_csv.c
  92. 2 0
      src/magic.h.in
  93. 8 3
      src/readcdf.c
  94. 12 2
      src/readelf.c
  95. 21 3
      src/seccomp.c
  96. 2 2
      src/vasprintf.c
  97. 1 1
      tests/JW07022A.mp3.result
  98. 33 22
      tests/Makefile.in
  99. 2 2
      tests/test.c

+ 20 - 0
ChangeLog

@@ -1,3 +1,23 @@
+2019-12-16  21:11  Christos Zoulas <christos@zoulas.com>
+
+	* release 5.38
+
+2019-12-15  22:13  Christos Zoulas <christos@zoulas.com>
+    Document changes since the previous release:
+	- Always accept -S (no sandbox) even if we don't support sandboxing
+	- More syscalls elided for sandboxiing
+	- For ELF dynamic means having an interpreter not just PT_DYNAMIC
+	- Check for large ELF session header offset
+	- When saving and restoring a locale, keep the locale name in our
+	  own storage.
+	- Add a flag to disable CSV file detection.
+	- Don't pass NULL/0 to memset to appease sanitizers.
+	- Avoid spurious prints when looks for extensions or apple strings
+	  in fsmagic.
+	- Add builtin decompressors for xz and and bzip.
+	- Add a limit for the number of CDF elements.
+	- More checks for overflow in CDF.
+
 2019-05-14  22:26  Christos Zoulas <christos@zoulas.com>
 
 	* release 5.37

+ 15 - 11
Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -136,7 +136,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	cscope distdir dist dist-all distcheck
+	cscope distdir distdir-am dist dist-all distcheck
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
 	$(LISP)config.h.in
 # Read a list of newline-separated strings from the standard input,
@@ -161,7 +161,7 @@ CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
 	COPYING ChangeLog INSTALL NEWS README TODO compile \
-	config.guess config.sub depcomp install-sh ltmain.sh missing
+	config.guess config.sub install-sh ltmain.sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -246,6 +246,7 @@ LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
@@ -352,8 +353,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	    echo ' $(SHELL) ./config.status'; \
 	    $(SHELL) ./config.status;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -495,7 +496,10 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	$(am__remove_distdir)
 	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -560,7 +564,7 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
 	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -586,7 +590,7 @@ dist-shar: distdir
 	@echo WARNING: "Support for shar distribution archives is" \
 	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -604,7 +608,7 @@ dist dist-all:
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lz*) \
@@ -614,7 +618,7 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac

+ 6 - 1
README

@@ -1,6 +1,6 @@
 ## README for file(1) Command and the libmagic(3) library ##
 
-    @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $
+    @(#) $File: README,v 1.59 2019/09/19 01:04:01 christos Exp $
 
 Mailing List: file@astron.com
 Mailing List archives: http://mailman.astron.com/pipermail/file/
@@ -24,6 +24,10 @@ A public read-only git repository of the same sources is available at:
 
 	https://github.com/file/file
 
+We are continuously being fuzzed by OSS-FUZZ:
+
+	https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:file
+
 The major changes for 5.x are CDF file parsing, indirect magic, name/use
 (recursion) and overhaul in mime and ascii encoding handling.
 
@@ -91,6 +95,7 @@ src/funcs.c - utilility functions
 src/getline.c - replacement for OS's that don't have it.
 src/getopt_long.c - replacement for OS's that don't have it.
 src/gmtime_r.c - replacement for OS's that don't have it.
+src/is_csv.c - knows about Comma Separated Value file format (RFC 4180).
 src/is_json.c - knows about JavaScript Object Notation format (RFC 8259).
 src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore).
 src/localtime_r.c - replacement for OS's that don't have it.

+ 123 - 140
aclocal.m4

@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,8 +20,8 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# visibility.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc.
+# visibility.m4 serial 6
+dnl Copyright (C) 2005, 2008, 2010-2019 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.
@@ -51,42 +51,42 @@ AC_DEFUN([gl_VISIBILITY],
     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])
+    AC_CACHE_CHECK([whether the -Werror option is usable],
+      [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"
+      ])
     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])
+    AC_CACHE_CHECK([for simple visibility declarations],
+      [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"
+      ])
     if test $gl_cv_cc_visibility = yes; then
       CFLAG_VISIBILITY="-fvisibility=hidden"
       HAVE_VISIBILITY=1
@@ -98,7 +98,7 @@ AC_DEFUN([gl_VISIBILITY],
     [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
 ])
 
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,10 +110,10 @@ AC_DEFUN([gl_VISIBILITY],
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.15'
+[am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.16.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -129,14 +129,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -188,7 +188,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -219,7 +219,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -410,13 +410,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -424,49 +423,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  AS_CASE([$CONFIG_FILES],
+          [*\'*], [eval set x "$CONFIG_FILES"],
+          [*], [set x $CONFIG_FILES])
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`AS_DIRNAME(["$am_mf"])`
+    am_filepart=`AS_BASENAME(["$am_mf"])`
+    AM_RUN_LOG([cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles]) || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  Try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).])
+  fi
+  AS_UNSET([am_dirpart])
+  AS_UNSET([am_filepart])
+  AS_UNSET([am_mf])
+  AS_UNSET([am_rc])
+  rm -f conftest-deps.mk
 }
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
@@ -475,18 +466,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # -----------------------------
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -573,8 +563,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target (and possibly the TAP driver).  The
 # system "awk" is bad on some platforms.
@@ -641,7 +631,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.
 
 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
 
 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -683,7 +673,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -704,7 +694,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -725,7 +715,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -733,49 +723,42 @@ AC_SUBST([am__leading_dot])])
 
 # AM_MAKE_INCLUDE()
 # -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
 AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
 am__doit:
-	@echo this is the am__doit target
+	@echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+      ['0:this is the am__doit target'],
+      [AS_CASE([$s],
+          [BSD], [am__include='.include' am__quote='"'],
+          [am__include='include' am__quote=''])])
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -814,7 +797,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -843,7 +826,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -890,7 +873,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -909,7 +892,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -990,7 +973,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1050,7 +1033,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1078,7 +1061,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1097,7 +1080,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,

+ 7 - 6
compile

@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -255,7 +255,8 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -339,9 +340,9 @@ exit $ret
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:

File diff suppressed because it is too large
+ 358 - 312
config.guess


+ 19 - 5
config.h.in

@@ -6,6 +6,9 @@
 /* Define in built-in ELF support is used */
 #undef BUILTIN_ELF
 
+/* Enable bzlib compression support */
+#undef BZLIBSUPPORT
+
 /* Define for ELF core file support */
 #undef ELFCORE
 
@@ -15,6 +18,9 @@
 /* Define to 1 if you have the `asprintf' function. */
 #undef HAVE_ASPRINTF
 
+/* Define to 1 if you have the <bzlib.h> header file. */
+#undef HAVE_BZLIB_H
+
 /* Define to 1 if you have the `ctime_r' function. */
 #undef HAVE_CTIME_R
 
@@ -74,9 +80,15 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#undef HAVE_LIBBZ2
+
 /* Define to 1 if you have the `gnurx' library (-lgnurx). */
 #undef HAVE_LIBGNURX
 
+/* Define to 1 if you have the `lzma' library (-llzma). */
+#undef HAVE_LIBLZMA
+
 /* Define to 1 if you have the `seccomp' library (-lseccomp). */
 #undef HAVE_LIBSECCOMP
 
@@ -86,6 +98,9 @@
 /* Define to 1 if you have the `localtime_r' function. */
 #undef HAVE_LOCALTIME_R
 
+/* Define to 1 if you have the <lzma.h> header file. */
+#undef HAVE_LZMA_H
+
 /* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #undef HAVE_MBRTOWC
 
@@ -240,8 +255,7 @@
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
 #undef LT_OBJDIR
 
 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
@@ -316,6 +330,9 @@
 # endif
 #endif
 
+/* Enable xzlib compression support */
+#undef XZLIBSUPPORT
+
 /* Enable zlib compression support */
 #undef ZLIBSUPPORT
 
@@ -358,9 +375,6 @@
    #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

File diff suppressed because it is too large
+ 1249 - 1282
config.sub


File diff suppressed because it is too large
+ 1543 - 1044
configure


+ 39 - 2
configure.ac

@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.37],[christos@astron.com])
+AC_INIT([file],[5.38],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
@@ -39,6 +39,16 @@ AC_ARG_ENABLE([zlib],
 [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])])
 AC_MSG_RESULT($enable_zlib)
 
+AC_MSG_CHECKING(for bzlib support)
+AC_ARG_ENABLE([bzlib],
+[AS_HELP_STRING([--disable-bzlib], [disable bz2lib compression support @<:@default=auto@:>@])])
+AC_MSG_RESULT($enable_bzlib)
+
+AC_MSG_CHECKING(for xzlib support)
+AC_ARG_ENABLE([xzlib],
+[AS_HELP_STRING([--disable-xzlib], [disable liblzma/xz compression support @<:@default=auto@:>@])])
+AC_MSG_RESULT($enable_xzlib)
+
 AC_MSG_CHECKING(for libseccomp support)
 AC_ARG_ENABLE([libseccomp],
 [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
@@ -97,10 +107,15 @@ AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sy
 if test "$enable_zlib" != "no"; then
   AC_CHECK_HEADERS(zlib.h)
 fi
+if test "$enable_bzlib" != "no"; then
+  AC_CHECK_HEADERS(bzlib.h)
+fi
+if test "$enable_xzlib" != "no"; then
+  AC_CHECK_HEADERS(lzma.h)
+fi
 AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_CHECK_MEMBERS([struct stat.st_rdev])
@@ -160,6 +175,12 @@ dnl Checks for libraries
 if test "$enable_zlib" != "no"; then
   AC_CHECK_LIB(z, gzopen)
 fi
+if test "$enable_bzlib" != "no"; then
+  AC_CHECK_LIB(bz2, BZ2_bzCompressInit)
+fi
+if test "$enable_xzlib" != "no"; then
+  AC_CHECK_LIB(lzma, lzma_stream_decoder)
+fi
 if test "$enable_libseccomp" != "no"; then
     AC_CHECK_LIB(seccomp, seccomp_init)
 fi
@@ -179,6 +200,22 @@ fi
 if  test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then
   AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support])
 fi
+if test "$enable_bzlib" = "yes"; then
+  if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" != "yesyes"; then
+    AC_MSG_ERROR([bzlib support requested but not found])
+  fi
+fi
+if  test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yesyes"; then
+  AC_DEFINE([BZLIBSUPPORT], 1, [Enable bzlib compression support])
+fi
+if test "$enable_xzlib" = "yes"; then
+  if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" != "yesyes"; then
+    AC_MSG_ERROR([xzlib support requested but not found])
+  fi
+fi
+if  test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; then
+  AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support])
+fi
 
 AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
 AC_OUTPUT

+ 5 - 5
depcomp

@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2013-05-30.07; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -783,9 +783,9 @@ exit 0
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:

+ 9 - 5
doc/Makefile.in

@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -198,6 +198,7 @@ LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
 MINGW = @MINGW@
@@ -302,8 +303,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -499,7 +500,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \

+ 7 - 4
doc/file.man

@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.135 2019/03/03 02:32:40 christos Exp $
-.Dd February 18, 2019
+.\" $File: file.man,v 1.138 2019/10/15 18:00:40 christos Exp $
+.Dd July 13, 2019
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -212,6 +212,8 @@ Ignored for backwards compatibility.
 Prints details of Compound Document Files.
 .It compress
 Checks for, and looks inside, compressed files.
+.It csv
+Checks Comma Separated Value files.
 .It elf
 Prints ELF file details, provided soft magic tests are enabled and the
 elf magic is found.
@@ -289,7 +291,7 @@ The magic pattern with the highest strength (see the
 option) comes first.
 .It Fl l , Fl Fl list
 Shows a list of patterns and their strength sorted descending by
-.Xr magic 4
+.Xr magic __FSECTION__
 strength
 which is used for the matching (see also the
 .Fl k
@@ -363,10 +365,11 @@ On systems where libseccomp
 is available, the
 .Fl S
 flag disables sandboxing which is enabled by default.
-This option is needed for file to execute external descompressing programs,
+This option is needed for file to execute external decompressing programs,
 i.e. when the
 .Fl z
 flag is specified and the built-in decompressors are not available.
+On systems where sandboxing is not available, this option has no effect.
 .It Fl v , Fl Fl version
 Print the version of the program and exit.
 .It Fl z , Fl Fl uncompress

+ 5 - 3
doc/libmagic.man

@@ -1,4 +1,4 @@
-.\" $File: libmagic.man,v 1.44 2018/09/09 20:33:28 christos Exp $
+.\" $File: libmagic.man,v 1.45 2019/06/08 22:16:24 christos Exp $
 .\"
 .\" Copyright (c) Christos Zoulas 2003, 2018.
 .\" All Rights Reserved.
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 18, 2018
+.Dd June 8, 2019
 .Dt LIBMAGIC 3
 .Os
 .Sh NAME
@@ -160,7 +160,9 @@ Don't check for various types of text files.
 .It Dv MAGIC_NO_CHECK_TOKENS
 Don't look for known tokens inside ascii files.
 .It Dv MAGIC_NO_CHECK_JSON
-Don't example JSON files.
+Don't examine JSON files.
+.It Dv MAGIC_NO_CHECK_CSV
+Don't examine CSV files.
 .El
 .Pp
 The

+ 3 - 3
doc/magic.man

@@ -1,4 +1,4 @@
-.\" $File: magic.man,v 1.96 2019/01/21 14:56:53 christos Exp $
+.\" $File: magic.man,v 1.97 2019/11/15 21:03:14 christos Exp $
 .Dd January 21, 2019
 .Dt MAGIC __FSECTION__
 .Os
@@ -44,7 +44,7 @@ This offset can be a negative number if it is:
 The first direct offset of the magic entry (at continuation level 0),
 in which case it is interpreted an offset from end end of the file
 going backwards.
-This works only when a file descriptor to the file is a available and it
+This works only when a file descriptor to the file is available and it
 is a regular file.
 .It
 A continuation offset relative to the end of the last up-level field
@@ -136,7 +136,7 @@ format.
 .It Dv date
 A four-byte value interpreted as a UNIX date.
 .It Dv qdate
-A eight-byte value interpreted as a UNIX date.
+An eight-byte value interpreted as a UNIX date.
 .It Dv ldate
 A four-byte value interpreted as a UNIX-style date, but interpreted as
 local time rather than UTC.

File diff suppressed because it is too large
+ 3501 - 2008
ltmain.sh


File diff suppressed because it is too large
+ 1474 - 1087
m4/libtool.m4


+ 90 - 37
m4/ltoptions.m4

@@ -1,14 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 7 ltoptions.m4
+# serial 8 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
         _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
+    [m4_warning([Unknown $1 option '$2'])])[]dnl
 ])
 
 
@@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
   dnl
   dnl If no reference was made to various pairs of opposing options, then
   dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
   dnl archives by default:
   _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
   _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
+		   [_LT_ENABLE_FAST_INSTALL])
+  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
+		   [_LT_WITH_AIX_SONAME([aix])])
   ])
 ])# _LT_SET_OPTIONS
 
@@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
 [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
+put the 'dlopen' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
+put the 'win32-dll' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
 
 # _LT_ENABLE_SHARED([DEFAULT])
 # ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-shared flag, and supports the 'shared' and
+# 'disable-shared' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_SHARED],
 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([shared],
@@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_shared=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
@@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
 
 # _LT_ENABLE_STATIC([DEFAULT])
 # ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-static flag, and support the 'static' and
+# 'disable-static' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_STATIC],
 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([static],
@@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_static=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
@@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
 
 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
 # ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-fast-install flag, and support the 'fast-install'
+# and 'disable-fast-install' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_FAST_INSTALL],
 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([fast-install],
@@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_fast_install=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
@@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
+the 'fast-install' option into LT_INIT's first parameter.])
 ])
 
 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
+the 'disable-fast-install' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 
+# _LT_WITH_AIX_SONAME([DEFAULT])
+# ----------------------------------
+# implement the --with-aix-soname flag, and support the `aix-soname=aix'
+# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
+# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+m4_define([_LT_WITH_AIX_SONAME],
+[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
+shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[[5-9]]*,yes)
+  AC_MSG_CHECKING([which variant of shared library versioning to provide])
+  AC_ARG_WITH([aix-soname],
+    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
+    [case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname],
+    [AC_CACHE_VAL([lt_cv_with_aix_soname],
+      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
+    with_aix_soname=$lt_cv_with_aix_soname])
+  AC_MSG_RESULT([$with_aix_soname])
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+_LT_DECL([], [shared_archive_member_spec], [0],
+    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
+])# _LT_WITH_AIX_SONAME
+
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
+
+
 # _LT_WITH_PIC([MODE])
 # --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
 # LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
     [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
@@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$lt_pkg" = "X$lt_p"; then
 	  pic_mode=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+    [pic_mode=m4_default([$1], [default])])
 
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC
@@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
 [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
+put the 'pic-only' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:

+ 4 - 3
m4/ltsugar.m4

@@ -1,6 +1,7 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
+# Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,7 +34,7 @@ m4_define([_lt_join],
 # ------------
 # Manipulate m4 lists.
 # These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
+# Autoconf-2.59, which quotes differently.
 m4_define([lt_car], [[$1]])
 m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
 
 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
 # ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
 # Note that neither SEPARATOR nor STRING are expanded; they are appended
 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
 # No SEPARATOR is output if MACRO-NAME was previously undefined (different

+ 6 - 6
m4/ltversion.m4

@@ -1,6 +1,6 @@
 # ltversion.m4 -- version numbers			-*- Autoconf -*-
 #
-#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 3337 ltversion.m4
+# serial 4179 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
+[macro_version='2.4.6'
+macro_revision='2.4.6'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])

+ 4 - 3
m4/lt~obsolete.m4

@@ -1,6 +1,7 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
@@ -11,7 +12,7 @@
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
 # which have later been changed to m4_define as they aren't part of the
 # exported API, or moved to Autoconf or Automake where they belong.
 #
@@ -25,7 +26,7 @@
 # included after everything else.  This provides aclocal with the
 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
 # because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
 #
 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
 # Yes, that means every name once taken will need to remain here until

+ 13 - 3
magic/Magdir/android

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------
-# $File: android,v 1.12 2019/04/19 00:42:27 christos Exp $
+# $File: android,v 1.16 2019/11/15 21:03:14 christos Exp $
 # Various android related magic entries
 #------------------------------------------------------------
 
@@ -18,8 +18,11 @@
 # Android bootimg format
 # From https://android.googlesource.com/\
 # platform/system/core/+/master/mkbootimg/bootimg.h
+# https://github.com/djrbliss/loki/blob/master/loki.h#L43
 0		string	ANDROID!	Android bootimg
->1024	string	LOKI\01		\b, LOKI'd
+>1024	string	LOKI		\b, LOKI'd
+>>1028	lelong	0			\b (boot)
+>>1028	lelong	1			\b (recovery)
 >8		lelong	>0			\b, kernel
 >>12	lelong	>0			\b (0x%x)
 >16		lelong	>0			\b, ramdisk
@@ -47,7 +50,7 @@
 0	string/b	ANDROID\ BACKUP\n	Android Backup
 # maybe look for some more characteristics like linefeed '\n' or version
 #>16	string		\n			
-# No mime-type defined offically
+# No mime-type defined officially
 !:mime	application/x-google-ab
 !:ext	ab
 # on 2nd line version (often 1, 2 on kitkat 4.4.3+, 4 on 7.1.2)
@@ -178,3 +181,10 @@
 # RES_XML_TYPE = 0x0003 followed by the size of the header (ResXMLTree_header),
 # which is 8 bytes (2 bytes type + 2 bytes header size + 4 bytes size).
 0	lelong	0x00080003	Android binary XML
+
+# Android cryptfs footer
+# From https://android.googlesource.com/\
+# platform/system/vold/+/refs/heads/master/cryptfs.h
+0	lelong	0xd0b5b1c4	Android cryptfs footer
+>4	leshort	x	\b, version: %d
+>6	leshort	x	\b.%d

+ 45 - 44
magic/Magdir/animation

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.71 2019/04/19 00:42:27 christos Exp $
+# $File: animation,v 1.74 2019/10/29 01:06:20 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -445,52 +445,43 @@
 # modified by Joerg Jenderek
 # GRR the original test are too common for many DOS files
 # so don't accept as MP3 until we've tested the rate
+# But also beat GEMDOS fonts
 0       beshort&0xFFFE  0xFFFA
 # rates
->2      byte&0xF0       0x10           MPEG ADTS, layer III, v1,  32 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x20           MPEG ADTS, layer III, v1,  40 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x30           MPEG ADTS, layer III, v1,  48 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x40           MPEG ADTS, layer III, v1,  56 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x50           MPEG ADTS, layer III, v1,  64 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x60           MPEG ADTS, layer III, v1,  80 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x70           MPEG ADTS, layer III, v1,  96 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x80           MPEG ADTS, layer III, v1, 112 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0x90           MPEG ADTS, layer III, v1, 128 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0xA0           MPEG ADTS, layer III, v1, 160 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0xB0           MPEG ADTS, layer III, v1, 192 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0xC0           MPEG ADTS, layer III, v1, 224 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0xD0           MPEG ADTS, layer III, v1, 256 kbps
-!:mime	audio/mpeg
->2      byte&0xF0       0xE0           MPEG ADTS, layer III, v1, 320 kbps
+>2	byte&0xF0	!0	
+>>2	byte&0xF0	!0xF0		MPEG ADTS, layer III, v1
+!:strength +20
 !:mime	audio/mpeg
+>2	byte&0xF0	0x10		\b, 32 kbps
+>2	byte&0xF0	0x20		\b, 40 kbps
+>2	byte&0xF0	0x30		\b, 48 kbps
+>2	byte&0xF0	0x40		\b, 56 kbps
+>2	byte&0xF0	0x50		\b, 64 kbps
+>2	byte&0xF0	0x60		\b, 80 kbps
+>2	byte&0xF0	0x70		\b, 96 kbps
+>2	byte&0xF0	0x80		\b, 112 kbps
+>2	byte&0xF0	0x90		\b, 128 kbps
+>2	byte&0xF0	0xA0		\b, 160 kbps
+>2	byte&0xF0	0xB0		\b, 192 kbps
+>2	byte&0xF0	0xC0		\b, 224 kbps
+>2	byte&0xF0	0xD0		\b, 256 kbps
+>2	byte&0xF0	0xE0		\b, 320 kbps
 # timing
->2      byte&0x0C       0x00           \b, 44.1 kHz
->2      byte&0x0C       0x04           \b, 48 kHz
->2      byte&0x0C       0x08           \b, 32 kHz
+>2	byte&0x0C	0x00		\b, 44.1 kHz
+>2	byte&0x0C	0x04		\b, 48 kHz
+>2	byte&0x0C	0x08		\b, 32 kHz
 # channels/options
->3      byte&0xC0       0x00           \b, Stereo
->3      byte&0xC0       0x40           \b, JntStereo
->3      byte&0xC0       0x80           \b, 2x Monaural
->3      byte&0xC0       0xC0           \b, Monaural
-#>1     byte            ^0x01          \b, Data Verify
-#>2     byte            &0x02          \b, Packet Pad
-#>2     byte            &0x01          \b, Custom Flag
-#>3     byte            &0x08          \b, Copyrighted
-#>3     byte            &0x04          \b, Original Source
-#>3     byte&0x03       1              \b, NR: 50/15 ms
-#>3     byte&0x03       3              \b, NR: CCIT J.17
+>3	byte&0xC0	0x00		\b, Stereo
+>3	byte&0xC0	0x40		\b, JntStereo
+>3	byte&0xC0	0x80		\b, 2x Monaural
+>3	byte&0xC0	0xC0		\b, Monaural
+#>1	byte		^0x01		\b, Data Verify
+#>2	byte		&0x02		\b, Packet Pad
+#>2	byte		&0x01		\b, Custom Flag
+#>3	byte		&0x08		\b, Copyrighted
+#>3	byte		&0x04		\b, Original Source
+#>3	byte&0x03	1		\b, NR: 50/15 ms
+#>3	byte&0x03	3		\b, NR: CCIT J.17
 
 # MP2, M1A
 0       beshort&0xFFFE  0xFFFC         MPEG ADTS, layer II, v1
@@ -887,6 +878,9 @@
 # Vivo video (Wolfram Kleff)
 3	string		\x0D\x0AVersion:Vivo	Vivo video data
 
+# ABC (alembic.io 3d models)
+0	string	0gawa		ABC 3d model
+
 # VRML (Virtual Reality Modelling Language)
 0       string/w        #VRML\ V1.0\ ascii	VRML 1 file
 !:mime	model/vrml
@@ -970,8 +964,7 @@
 # Extension: .bik
 # URL:  https://wiki.multimedia.cx/index.php?title=Bink_Container
 # From: <hoehle@users.sourceforge.net>  2008-07-18
-0	string		BIK	Bink Video
->3	regex		=[a-z]	rev.%s
+0	name		bik
 #>4	ulelong		x	size %d
 >20	ulelong		x	\b, %d
 >24	ulelong		x	\bx%d
@@ -988,6 +981,14 @@
 #>>51	byte&0x10	0	FFT
 #>>51	byte&0x10	!0	DCT
 
+0	string		BIK
+>3	regex		=[bdfghi]	Bink Video rev.%s
+>>0	use		bik
+
+0	string		KB2
+>3	regex		=[adfghi]	Bink Video 2 rev.%s
+>>0	use		bik
+
 # Type:	NUT Container
 # URL:	https://wiki.multimedia.cx/index.php?title=NUT
 # From:	Adam Buchbinder <adam.buchbinder@gmail.com>

+ 36 - 24
magic/Magdir/apple

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.43 2019/04/19 00:42:27 christos Exp $
+# $File: apple,v 1.44 2019/10/18 15:21:02 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
@@ -75,33 +75,45 @@
 >>>>0xb06	pstring x		\b, Volume %s:
 >>>>0xb0e	leshort x		\b, %u Blocks
 >>>>0xb10	leshort x		\b, %u Files
+#
+# Diversi Dos boot loader?
+0		string	\x01\xA8\xAD\x81\xC0\xEE\x09\x08\xAD
+>0x11001	string	\x11\x0F\x03	Apple Diversi Dos Image
+>>0x11006	byte	x		\b, Volume %u
+>>0x11034	byte	x		\b, %u Tracks
+>>0x11035	byte	x		\b, %u Sectors
+>>0x11036	leshort	x		\b, %u bytes per sector
 
 # Type: Apple Emulator 2IMG format
 # From: Radek Vokal <rvokal@redhat.com>
 # Update: Greg Wildman <greg@apple2.org.za>
-0	string		2IMG		Apple ][ 2IMG Disk Image
->4	clear		x
->4	string		XGS!		\b, XGS
->4	string		CTKG		\b, Catakig
->4	string		ShIm		\b, Sheppy's ImageMaker
->4	string		SHEP		\b, Sheppy's ImageMaker
->4	string		WOOF		\b, Sweet 16
->4	string		B2TR		\b, Bernie ][ the Rescue
->4	string		\!nfc		\b, ASIMOV2
->4	string		\>BD\<		\b, Brutal Deluxe's Cadius
->4	string		CdrP		\b, CiderPress
->4	string		Vi][		\b, Virtual ][
->4	string		PRFS		\b, ProFUSE
->4	string		FISH		\b, FishWings
->4	string		RVLW		\b, Revival for Windows
->4	default		x
->>4	string		x		\b, Creator tag "%-4.4s"
->0xc	byte		00		\b, DOS 3.3 sector order
->>0x10	byte		00		\b, Volume 254
->>0x10	byte&0x7f	x		\b, Volume %u
->0xc	byte		01		\b, ProDOS sector order
->>0x14	short		x		\b, %u Blocks
->0xc	byte		02		\b, NIB data
+0		string	2IMG		Apple ][ 2IMG Disk Image
+>4		clear	x
+>4		string	XGS!		\b, XGS
+>4		string	CTKG		\b, Catakig
+>4		string	ShIm		\b, Sheppy's ImageMaker
+>4		string	SHEP		\b, Sheppy's ImageMaker
+>4		string	WOOF		\b, Sweet 16
+>4		string	B2TR		\b, Bernie ][ the Rescue
+>4		string	\!nfc		\b, ASIMOV2
+>4		string	\>BD\<		\b, Brutal Deluxe's Cadius
+>4		string	CdrP		\b, CiderPress
+>4		string	Vi][		\b, Virtual ][
+>4		string	PRFS		\b, ProFUSE
+>4		string	FISH		\b, FishWings
+>4		string	RVLW		\b, Revival for Windows
+>4		default	x
+>>4		string	x		\b, Creator tag "%-4.4s"
+>0xc		byte	00		\b, DOS 3.3 sector order
+>>0x10		byte	00		\b, Volume 254
+>>0x10		byte&0x7f x		\b, Volume %u
+>0xc		byte	01		\b, ProDOS sector order
+# Detect Volume Directory block ($02) + 2mg header offset
+>>0x440		string	\x00\x00\x03\x00
+>>>0x444	byte	&0xF0
+>>>>0x445	string	x		\b, Volume /%s
+>>>>0x469	leshort	x		\b, %u Blocks
+>0xc		byte	02		\b, NIB data
 
 # magic for Newton PDA package formats
 # from Ruda Moura <ruda@helllabs.org>

+ 53 - 7
magic/Magdir/archive

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.129 2019/05/09 18:58:02 christos Exp $
+# $File: archive,v 1.133 2019/11/15 21:03:14 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -263,7 +263,7 @@
 # NL terminated original package length
 >>>>>&1	string		x		\b, unsplitted size %s
 # NL terminated part length
->>>>>>&1	string	x		\b, part lenght %s
+>>>>>>&1	string	x		\b, part length %s
 # NL terminated package part like n/m
 >>>>>>>&1	string	x		\b, part %s
 # NL terminated package architecture like armhf since dpkg 1.16.1 or later
@@ -439,6 +439,34 @@
 # skip keyword with low entropy
 >12	default		x	TTComp archive, binary, 4K dictionary
 # (version 5.25) labeled the above entry as "TTComp archive data"
+# From:		Joerg Jenderek
+# URL:		https://wiki.68kmla.org/DiskCopy_4.2_format_specification
+# reference:	http://nulib.com/library/FTN.e00005.htm
+0x52	ubeshort	0x0100
+# test for disk size equal or above 400k
+>0x40	ubelong		>409599	Apple DiskCopy 4.2 image
+#!:mime	application/octet-stream
+!:apple	dCpydImg
+!:ext	image/dc42
+# image pascal name padded with NULs like Microsoft Mail
+>>00	pstring/B	x	%s
+# data size in bytes like 409600
+>>0x40	ubelong		x	\b, %u bytes
+# tag size in bytes
+>>0x44	ubelong		>0	\b, 0x%x tag size
+# data checksum
+#>>0x48	ubelong		x	\b, 0x%x checksum
+# tag checksum
+#>>0x4c	ubelong		x	\b, 0x%x tag checksum
+# disk encoding
+>>0x50	ubyte		0	\b, GCR CLV ssdd (400k)
+>>0x50	ubyte		1	\b, GCR CLV dsdd (800k)
+>>0x50	ubyte		2	\b, MFM CAV dsdd (720k)
+>>0x50	ubyte		3	\b, MFM CAV dshd (1440k)
+>>0x50	ubyte		>3	\b, 0x%x encoding
+# format byte
+>>0x51	ubyte		x	\b, 0x%x format
+#>>0x54	ubequad		x	\b, data 0x%16.16llx
 # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
 0	string	ESP ESP archive data
 # ZPack
@@ -1168,17 +1196,31 @@
 >>50	string	epub+zip	EPUB document
 !:mime application/epub+zip
 
+# From:	Joerg Jenderek
+# URL:	http://en.wikipedia.org/wiki/CorelDRAW
+# NOTE:	version; til 2 WL-based; from 3 til 13 by ./riff; from 14 zip based
+>>50	string	x-vnd.corel.	 Corel
+>>>62	string	draw.document+zip	Draw drawing, version 14-16
+!:mime	application/x-vnd.corel.draw.document+zip
+!:ext	cdr
+>>>62	string	draw.template+zip	Draw template, version 14-16
+!:mime	application/x-vnd.corel.draw.template+zip
+!:ext	cdrt
+>>>62	string	zcf.draw.document+zip	Draw drawing, version 17-21
+!:mime	application/x-vnd.corel.zcf.draw.document+zip
+!:ext	cdr
+>>>62	string	zcf.draw.template+zip	Draw template, version 17-21
+!:mime	application/x-vnd.corel.zcf.draw.template+zip
+!:ext	cdt/cdrt
+
 #  Catch other ZIP-with-mimetype formats
 #	In a ZIP file, the bytes immediately after a member's contents are
 #	always "PK". The 2 regex rules here print the "mimetype" member's
 #	contents up to the first 'P'. Luckily, most MIME types don't contain
 #	any capital 'P's. This is a kludge.
 #    (mimetype contains "application/<OTHER>")
->>50		string	!epub+zip
->>>50		string	!vnd.oasis.opendocument.
->>>>50		string	!vnd.sun.xml.
->>>>>50		string	!vnd.kde.
->>>>>>38	regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
+>>50		default	x			Zip data
+>>>38		regex	[!-OQ-~]+		(MIME type "%s"?)
 !:mime	application/zip
 #    (mimetype contents other than "application/*")
 >26		string	\x8\0\0\0mimetype
@@ -1290,6 +1332,10 @@
 # Durval Menezes, <jmgthbfile at durval dot com>
 0	string	d13:announce-list	BitTorrent file
 !:mime	application/x-bittorrent
+0	string	d7:comment	BitTorrent file
+!:mime	application/x-bittorrent
+0	string	d4:info		BitTorrent file
+!:mime	application/x-bittorrent
 
 # Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
 0	beshort 0x0e0f		Atari MSA archive data

+ 37 - 12
magic/Magdir/audio

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.111 2019/05/08 18:02:45 christos Exp $
+# $File: audio,v 1.118 2019/11/19 05:30:07 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -139,6 +139,11 @@
 
 0x2c	string		SCRM		ScreamTracker III Module sound data
 >0	string		>\0		Title: "%s"
+!:mime	audio/x-s3m
+
+# .stm before it got above .s3m extension
+0x16	string		\!Scream\!	ScreamTracker Module sound data
+>0	string		>\0		Title: "%s"
 
 # Gravis UltraSound patches
 # From <ache@nagual.ru>
@@ -553,6 +558,8 @@
 >21	byte	x	\b.%u
 >20	byte	x	\b.%u
 
+0	string		CC2x		CheeseCutter 2 song
+
 0    	string		RAWADATA	RdosPlay RAW
 
 1068	string		RoR		AMUSIC Adlib Tracker
@@ -614,7 +621,13 @@
 1	string	[licq]			LICQ configuration file
 
 # Atari ST audio files by Dirk Jagdmann <doj@cubic.org>
-0	string		ICE!		SNDH Atari ST music
+# NOTE: Most SNDH music is packed using ICE, which has
+# magic numbers "ICE!" and "Ice!". Some SNDH music is
+# not packed, so we check for both packed and unpacked.
+12	string			SNDH	SNDH Atari ST music
+0	belong&0xFFDFDFFF	0x49434521
+>14	search/40		NDH	SNDH Atari ST music
+>14	search/40		TITL	SNDH Atari ST music
 0	string		SC68\ Music-file\ /\ (c)\ (BeN)jami	sc68 Atari ST music
 
 # musepak support From: "Jiri Pejchal" <jiri.pejchal@gmail.com>
@@ -743,6 +756,8 @@
 >>>>0x78 ubyte		0x03	AY-3-8930,
 >>>>0x78 ubyte		0x10	YM2149,
 >>>>0x78 ubyte		0x11	YM3439,
+>>>>0x78 ubyte		0x12	YMZ284,
+>>>>0x78 ubyte		0x13	YMZ294,
 # VGM 1.61
 >>0x34	ulelong		>0x4C
 >>>0x80	ulelong		>0	DMG,
@@ -993,17 +1008,27 @@
 # Used for audio rips for various consoles.
 # http://fileformats.archiveteam.org/wiki/Portable_Sound_Format
 # Added by David Korth <gerbilsoft@gerbilsoft.com>
-0	string	PSF	Portable Sound Format
+0	string	PSF
+>3	byte	0x01
+>3	byte	0x02
+>3	byte	0x11
+>3	byte	0x12
+>3	byte	0x13
+>3	byte	0x21
+>3	byte	0x22
+>3	byte	0x23
+>3	byte	0x41
+>>0	string	PSF	Portable Sound Format
 !:mime	audio/x-psf
->3	byte	0x01	(Sony PlayStation)
->3	byte	0x02	(Sony PlayStation 2)
->3	byte	0x11	(Sega Saturn)
->3	byte	0x12	(Sega Dreamcast)
->3	byte	0x13	(Sega Mega Drive)
->3	byte	0x21	(Nintendo 64)
->3	byte	0x22	(Game Boy Advance)
->3	byte	0x23	(Super NES)
->3	byte	0x41	(Capcom QSound)
+>>>3	byte	0x01	(Sony PlayStation)
+>>>3	byte	0x02	(Sony PlayStation 2)
+>>>3	byte	0x11	(Sega Saturn)
+>>>3	byte	0x12	(Sega Dreamcast)
+>>>3	byte	0x13	(Sega Mega Drive)
+>>>3	byte	0x21	(Nintendo 64)
+>>>3	byte	0x22	(Game Boy Advance)
+>>>3	byte	0x23	(Super NES)
+>>>3	byte	0x41	(Capcom QSound)
 
 # Atari 8-bit SAP audio format
 # http://asap.sourceforge.net/sap-format.html

+ 1 - 1
magic/Magdir/bsi

@@ -1,4 +1,4 @@
-# Chiasmus is a encryption standard developed by the German Federal
+# Chiasmus is an encryption standard developed by the German Federal
 # Office for Information Security (Bundesamt fuer Sicherheit in der
 # Informationstechnik).
 

+ 2 - 2
magic/Magdir/c-lang

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.27 2019/02/27 16:46:23 christos Exp $
+# $File: c-lang,v 1.28 2019/11/15 21:03:14 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 # The strength is to beat standard HTML
@@ -11,7 +11,7 @@
 !:mime	text/x-bcpl
 
 # C
-# Check for class if include is found, otherwise class is beaten by include becouse of lowered strength
+# Check for class if include is found, otherwise class is beaten by include because of lowered strength
 0	search/8192	#include
 >0	regex	\^#include			C
 >>0	regex	\^class[[:space:]]+

+ 157 - 30
magic/Magdir/cad

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: cad,v 1.19 2019/04/19 00:42:27 christos Exp $
+# $File: cad,v 1.20 2019/08/10 13:34:17 christos Exp $
 # autocad:  file(1) magic for cad files
 #
 
@@ -18,29 +18,162 @@
 # 3F86C928&method=display&p_objectid=97F351F5-9C35-4E5E-89C280A93F86C928
 # https://www.bentley.com/products/default.cfm?objectid=A5C2FD43-3AC9-4C71-B682
 # 721C479F&method=display&p_objectid=A5C2FD43-3AC9-4C71-B682C7BE721C479F
-0	string	\010\011\376			Microstation
->3	string	\002
->>30	string	\026\105			DGNFile
->>30	string	\034\105			DGNFile
->>30	string	\073\107			DGNFile
->>30	string	\073\110			DGNFile
->>30	string	\106\107			DGNFile
->>30	string	\110\103			DGNFile
->>30	string	\120\104			DGNFile
->>30	string	\172\104			DGNFile
->>30	string	\172\105			DGNFile
->>30	string	\172\106			DGNFile
->>30	string	\234\106			DGNFile
->>30	string	\273\105			DGNFile
->>30	string	\306\106			DGNFile
->>30	string	\310\104			DGNFile
->>30	string	\341\104			DGNFile
->>30	string	\372\103			DGNFile
->>30	string	\372\104			DGNFile
->>30	string	\372\106			DGNFile
->>30	string	\376\103			DGNFile
->4	string	\030\000\000			CITFile
->4	string	\030\000\003			CITFile
+# 
+# URL:		https://en.wikipedia.org/wiki/MicroStation
+# reference:	http://dgnlib.maptools.org/dgn.html
+#		http://dgnlib.maptools.org/dl/ref18.pdf
+# Update:	Joerg Jenderek
+# Note: verfied by command like `dgndump seed2d_b.dgn`
+# test for level 8 and type 5 or 9
+0	beshort&0x3F73	0x0801
+# level of element like 8
+#>0	ubyte&0x3F	x			\b, level %u
+#>0	ubyte		&0x80			\b, complex
+#>0	ubyte		&0x40			\b, reserved
+# type of element 9~TCB 8~Digitizer setup 5~Group Data Elements
+#>1	ubyte&0x7F	x			\b, type %u
+# words to follow in element: 17H~CEL libray 2FEh~DGN 9FEh,DFEh~CIT
+#>2	uleshort	x			\b, words 0x%4.4x to follow
+# test for 3 reserved 0 bytes in CIT or "conversion" in ViewInfo structure (DGN CEL)
+#>508	ubelong		x			\b, RESERVED %8.8x
+>508	ubelong&0xFFffFF00	=0
+# test for level 8 and type 9 for INGR raster image
+>>0	beshort		0x0809
+# test for length of 1st element is multiple of blocks a 512 bytes
+>>>2	ubyte		0xfe
+>>>>0 	use		ingr-image
+# test for DGN or CEL by jump words (uleshort) forward to next element
+>(2.s*2)	ulong		x
+# 2nd element type: 8~Digitizer~DesiGNfile 1~library cell header other~CIT
+#>>&1		ubyte&0x7F	x		\b, 2nd type %u
+# DGN
+>>&1		ubyte&0x7F	8
+>>>2		uleshort	=0x02FE		Bentley/Intergraph Microstation CAD drawing
+!:mime		application/x-bentley-dgn
+!:ext		dgn
+# The 0x40 bit of this byte is 1 if the file is 3D, otherwise 0
+>>>>1214	ubyte  		&0x40		3D
+>>>>1214	ubyte  		^0x40		2D
+# 2 chars for name of subunits like ft FT in IN mu m mm '\0 '\040
+>>>>1120	string		x		\b, units %-.2s
+# 2 chars for name of master unit like IN in ML SU tn th TH HU mm "\0 "\040 \0\0
+>>>>1122	string		>\0		%-.2s
+#>>>>1120	ubelong		x		\b, units 0x%8.8x
+# element range low,high x y z like xlow=0 08010000h 01080000h
+#>>>>4		ubelong	  	!0		\b, xlow %8.8x
+#>>>>8		ubelong	  	!0		\b, ylow %8.8x
+#>>>>12		ubelong	  	!0		\b, zlow %8.8x
+#>>>>16		ubelong	  	!0		\b, xhigh %8.8x
+#>>>>20		ubelong	  	!0		\b, yhigh %8.8x
+#>>>>24		ubelong	  	!0		\b, zhigh %8.8x
+# graphic group number; all other elements in that group have same non-0 number
+#>>>>28		leshort		x		\b, grphgrp 0x%4.4x
+# words to optional attribute linkage
+#>>>>30		ubyte		x		\b, attindx \%o
+#>>>>31		ubyte		x		\b\%o
+# >>30	string	\026\105			DGNFile
+# >>30	string	\034\105			DGNFile
+# >>30	string	\073\107			DGNFile
+# >>30	string	\073\110			DGNFile
+# >>30	string	\106\107			DGNFile
+# >>30	string	\110\103			DGNFile
+# >>30	string	\120\104			DGNFile
+# >>30	string	\172\104			DGNFile
+# >>30	string	\172\105			DGNFile
+# >>30	string	\172\106			DGNFile
+# >>30	string	\234\106			DGNFile
+# >>30	string	\273\105			DGNFile
+# >>30	string	\306\106			DGNFile
+# >>30	string	\310\104			DGNFile
+# >>30	string	\341\104			DGNFile
+# >>30	string	\372\103			DGNFile
+# >>30	string	\372\104			DGNFile
+# >>30	string	\372\106			DGNFile
+# >>30	string	\376\103			DGNFile
+# elements properties indicator
+#>>>>32		uleshort	!0		\b, properties 0x%4.4x
+# class 0~Primary
+#>>>>>32		uleshort&0x000F	!0		\b, class 0x%4.4x
+# Symbology
+#>>>>>34		uleshort	x		\b, Symbology 0x%4.4x
+# test for 2nd element type 1~library cell header
+>>&1		ubyte&0x7F	1
+# test for 1st element with level 8 and type 5 for cell library
+>>>0		beshort		0x0805		Bentley/Intergraph Microstation CAD cell library
+!:mime		application/x-bentley-cel
+!:ext		cel
+#
+# URL:		http://fileformats.archiveteam.org/wiki/Intergraph_Raster
+# reference:	https://web.archive.org/web/20140903185431/
+#		http://oreilly.com/www/centers/gff/formats/ingr/index.htm
+# note:		verfied by command like `nconvert -fullinfo LONGLAT.CIT`
+# display information for intergraph raster bitmap
+0	name	ingr-image
+# in 5.37 "Microstation CITFile" "Bentley/Intergraph MicroStation CIT raster CAD"
+# DataTypeCode indicates format, depth of the pixel data and used compression 
+>4	uleshort	x			Intergraph raster image
+>>4	uleshort	0x0009			\b, Run-Length Encoded 1-bit
+!:mime	image/x-intergraph-rle
+!:ext	rel
+>>4	uleshort	0x0018			\b, CCITT Group 4 1-bit
+!:mime	image/x-intergraph-cit
+!:ext	cit
+>>4	uleshort	27			\b, Adaptive RLE RGB
+!:mime	image/x-intergraph-rgb
+!:ext	rgb
+>>4	default		x
+>>>4	uleshort	x			\b, Type %u
+!:mime	image/x-intergraph
+# TODO:
+#>4	uleshort	0			\b, no data
+# ...
+#>4	uleshort	0x0045			\b, Continuous Tone CMKY (Uncompressed)
+# ApplicationType: 0~generic raster image 3~drawing, scanning
+# 8~I/IMAGE and MicroStation Imager 9~ModelView
+>6	uleshort	!0			\b, ApplicationType %u
+#>6	uleshort	x			\b, ApplicationType %u
+# XViewOrigin; Raster grid data X origin
+#>8	ulequad		!0			\b, XViewOrigin %llx
+# PixelsPerLine is the number of pixels in a scan line of bitmapp
+>184	ulelong		x			\b, %u x
+# NumberOfLines is height of the raster data in scanlines
+>188	ulelong		x			%u
+# DeviceResolution; resolution of scanning device
+# positive indicates number of micros between lines; negative indicates DPI
+#>192	leshort		x			\b, DeviceResolution %d
+# ScanlineOrient indicates the origin and the orientation of the scan lines
+#>194	ubyte		x			\b, ScanlineOrient %x
+>194	ubyte		x			\b, orientation
+>194	ubyte		&0x01			right
+>194	ubyte		^0x01			left
+>194	ubyte		&0x02			down
+>194	ubyte		^0x02			top
+>194	ubyte		&0x04			horizontal
+>194	ubyte		^0x04			vertical
+# ScannableFlag; Scanline indexing method used
+#>195	ubyte		!0			\b, ScannableFlag 0x%x
+# RotationAngle; Rotation angle of raster data
+#>196	ubequad		!0			\b, RotationAngle 0x%llx
+# SkewAngle; Skew angle of raster data
+#>204	ubequad		!0			\b, SkewAngle %llx
+# DataTypeModifier; Additional raster data format info
+#>212	uleshort	!0			\b, DataTypeModifier 0x%4.4x
+# DesignFile[66]; Name of the design file
+>214	string		>\0			\b, DesignFile %-.66s
+# DatabaseFile[66]; Name of the database file
+>280	string		>\0			\b, DatabaseFile %-.66s
+# ParentGridFile[66]; Name of parent grid file
+>346	string		>\0			\b, ParentGridFile %-.66s
+# FileDescription[80]; Text description of file and contents
+>412	string		>\0			\b, FileDescription %-.80s
+# MinValue
+#>492	ubequad		!0			\b, MinValue 0x%llx
+# MaxValue
+#>500	ubequad		!0			\b, MaxValue 0x%llx
+# Reserved[3]; Unused (always 0)
+#>508	ubelong&0xFFffFF00	x		\b, RESERVED %8.8x
+# GridFileVersion; Grid File Version like 2 3
+#>511	ubyte		x			\b, GridFileVersion %x
 
 # AutoCAD
 # Merge of the different contributions and updates from https://en.wikipedia.org/wiki/Dwg
@@ -140,12 +273,6 @@
 # Phillip Griffith <phillip dot griffith at gmail dot com>
 # AutoCAD magic taken from the Open Design Alliance's OpenDWG specifications.
 #
-0	belong	0x08051700	Bentley/Intergraph MicroStation DGN cell library
-0	belong	0x0809fe02	Bentley/Intergraph MicroStation DGN vector CAD
-0	belong	0xc809fe02	Bentley/Intergraph MicroStation DGN vector CAD
-0	beshort	0x0809		Bentley/Intergraph MicroStation
->0x02	byte	0xfe
->>0x04	beshort	0x1800		CIT raster CAD
 
 # 3DS (3d Studio files)
 0	leshort		0x4d4d

+ 4 - 1
magic/Magdir/commands

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.60 2019/04/19 00:42:27 christos Exp $
+# $File: commands,v 1.61 2019/10/30 03:16:43 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
 #0	string/w	:			shell archive or script for antique kernel text
@@ -35,6 +35,9 @@
 !:mime	text/x-shellscript
 0	string/wt	#!\ /usr/local/bin/zsh	Paul Falstad's zsh script text executable
 !:mime	text/x-shellscript
+0	search/1	#!/usr/bin/env\ zsh	Paul Falstad's zsh script text executable
+!:mime	text/x-shellscript
+
 0	string/wt	#!\ /usr/local/bin/ash	Neil Brown's ash script text executable
 !:mime	text/x-shellscript
 0	string/wt	#!\ /usr/local/bin/ae	Neil Brown's ae script text executable

+ 10 - 10
magic/Magdir/compress

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: compress,v 1.75 2019/04/19 00:42:27 christos Exp $
+# $File: compress,v 1.77 2019/10/08 20:25:13 christos Exp $
 # compress:  file(1) magic for pure-compression formats (no archives)
 #
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -58,11 +58,11 @@
 >>>13	string		09			\b, version 9
 # other gzipped binary like gzipped tar, VirtualBox extension package,...
 >>10	default		x		gzip compressed data
+!:mime	application/gzip
 >>>0	use	gzip-info
 # size of the original (uncompressed) input data modulo 2^32
 >>>-4	ulelong		x		\b, original size modulo 2^32 %u
 # gzipped TAR or VirtualBox extension package
-!:mime	application/gzip
 #!:mime	application/x-compressed-tar
 #!:mime	application/x-virtualbox-vbox-extpack
 # https://www.w3.org/TR/SVG/mimereg.html
@@ -308,25 +308,25 @@
 # Zstandard compressed data
 # https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
 0     lelong       0xFD2FB522  Zstandard compressed data (v0.2)
-!:mime  application/x-zstd
+!:mime  application/zstd
 0     lelong       0xFD2FB523  Zstandard compressed data (v0.3)
-!:mime  application/x-zstd
+!:mime  application/zstd
 0     lelong       0xFD2FB524  Zstandard compressed data (v0.4)
-!:mime  application/x-zstd
+!:mime  application/zstd
 0     lelong       0xFD2FB525  Zstandard compressed data (v0.5)
-!:mime  application/x-zstd
+!:mime  application/zstd
 0     lelong       0xFD2FB526  Zstandard compressed data (v0.6)
-!:mime  application/x-zstd
+!:mime  application/zstd
 0     lelong       0xFD2FB527  Zstandard compressed data (v0.7)
-!:mime  application/x-zstd
+!:mime  application/zstd
 >4    use          zstd-dictionary-id
 0     lelong       0xFD2FB528  Zstandard compressed data (v0.8+)
-!:mime  application/x-zstd
+!:mime  application/zstd
 >4    use          zstd-dictionary-id
 
 # https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
 0  lelong    0xEC30A437  Zstandard dictionary
-!:mime  application/x-zstd-dictionary
+!:mime  application/x-std-dictionary
 >4 lelong    x           (ID %u)
 
 # AFX compressed files (Wolfram Kleff)

+ 81 - 14
magic/Magdir/console

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: console,v 1.45 2019/04/19 00:42:27 christos Exp $
+# $File: console,v 1.49 2019/05/27 01:33:32 christos Exp $
 # Console game magic
 # Toby Deshane <hac@shoelace.digivill.net>
 
@@ -508,6 +508,8 @@
 #------------------------------------------------------------------------------
 # Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
 0	string	XBEH	Microsoft Xbox executable
+!:mime	audio/x-xbox-executable
+!:ext	xbe
 # expect base address of 0x10000
 >0x0104                 ulelong =0x10000
 >>(0x0118.l-0x0FFF4)    lestring16 x       \b: "%.40s"
@@ -546,25 +548,90 @@
 0		name	xbox-360-xex-execution-id
 >(0.L+0xC)	byte	x	(%c
 >(0.L+0xD)	byte	x	\b%c
->(0.L+0xE)	beshort	x	\b-%04u)
+>(0.L+0xE)	beshort	x	\b-%04u, media ID:
+>(0.L)		belong	x	%08X)
+
+# Region code (part of Security Info)
+0	name	xbox-360-xex-region-code
+>0	ubelong	0xFFFFFFFF	\b, all regions
+>0	ubelong	!0xFFFFFFFF
+>>0	ubelong	>0		(regions:
+>>0	ubelong&0x000000FF	0x000000FF	USA
+>>0	ubelong&0x00000100	0x00000100	Japan
+>>0	ubelong&0x00000200	0x00000200	China
+>>0	ubelong&0x0000FC00	0x0000FC00	Asia
+>>0	ubelong&0x00FF0000	0x00FF0000	PAL
+>>0	ubelong&0x00FF0000	0x00FE0000	PAL [except AU/NZ]
+>>0	ubelong&0x00FF0000	0x00010000	AU/NZ
+>>0	ubelong&0xFF000000	0xFF000000	Other
+>>0	ubelong	>0		\b)
 
 0	string	XEX2	Microsoft Xbox 360 executable
+!:mime	audio/x-xbox360-executable
+!:ext	xex
 >0x18	search/0x100	\x00\x04\x00\x06
 >>&0	use	xbox-360-xex-execution-id
->(0x010.L+0x178)	ubelong	0xFFFFFFFF	\b, all regions
->(0x010.L+0x178)	ubelong	!0xFFFFFFFF
->>(0x010.L+0x178)	ubelong	>0		(regions:
->>(0x010.L+0x178)	ubelong&0x000000FF	0x000000FF	USA
->>(0x010.L+0x178)	ubelong&0x00000100	0x00000100	Japan
->>(0x010.L+0x178)	ubelong&0x00000200	0x00000200	China
->>(0x010.L+0x178)	ubelong&0x0000FC00	0x0000FC00	Asia
->>(0x010.L+0x178)	ubelong&0x00FF0000	0x00FF0000	PAL
->>(0x010.L+0x178)	ubelong&0x00FF0000	0x00FE0000	PAL [except AU/NZ]
->>(0x010.L+0x178)	ubelong&0x00FF0000	0x00010000	AU/NZ
->>(0x010.L+0x178)	ubelong&0xFF000000	0xFF000000	Other
->>(0x010.L+0x178)	ubelong	>0		\b)
+>(0x010.L+0x178)	use	xbox-360-xex-region-code
 
+0	string	XEX1	Microsoft Xbox 360 executable (XEX1)
+!:mime	audio/x-xbox360-executable
+!:ext	xex
+>0x18	search/0x100	\x00\x04\x00\x06
+>>&0	use	xbox-360-xex-execution-id
+>(0x010.L+0x154)	use	xbox-360-xex-region-code
+
+#------------------------------------------------------------------------------
+# Microsoft Xbox 360 packages
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# References:
+# - https://free60project.github.io/wiki/STFS.html
+# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h
 
+# TODO: More information for console-signed packages.
+
+0	name	xbox-360-package
+>0x360	byte	x	(%c
+>0x361	byte	x	\b%c
+>0x362	beshort	x	\b-%04u, media ID:
+>0x354	belong	x	%08X)
+>0x344	belong	x	\b, content type:
+>>0x344	belong	0x1		Saved Game
+>>0x344	belong	0x2		Marketplace Content
+>>0x344	belong	0x3		Publisher
+>>0x344	belong	0x1000		Xbox 360 Title
+>>0x344	belong	0x2000		IPTV Pause Buffer
+>>0x344	belong	0x4000		Installed Game
+>>0x344	belong	0x5000		Original Xbox Game
+>>0x344	belong	0x9000		Avatar Item
+>>0x344	belong	0x10000		Profile
+>>0x344	belong	0x20000		Gamer Picture
+>>0x344	belong	0x30000		Theme
+>>0x344	belong	0x40000		Cache File
+>>0x344	belong	0x50000		Storage Download
+>>0x344	belong	0x60000		Xbox Saved Game
+>>0x344	belong	0x70000		Xbox Download
+>>0x344	belong	0x80000		Game Demo
+>>0x344	belong	0x90000		Video
+>>0x344	belong	0xA0000		Game
+>>0x344	belong	0xB0000		Installer
+>>0x344	belong	0xC0000		Game Trailer
+>>0x344	belong	0xD0000		Arcade Title
+>>0x344	belong	0xE0000		XNA
+>>0x344	belong	0xF0000		License Store
+>>0x344	belong	0x100000	Movie
+>>0x344	belong	0x200000	TV
+>>0x344	belong	0x300000	Music Video
+>>0x344	belong	0x400000	Game Video
+>>0x344	belong	0x500000	Podcast Video
+>>0x344	belong	0x600000	Viral Video
+>>0x344	belong	0x2000000	Community Game
+
+0	string	CON\x20	Microsoft Xbox 360 package (console-signed)
+>0	use	xbox-360-package
+0	string	PIRS	Microsoft Xbox 360 package (non-Xbox Live)
+>0	use	xbox-360-package
+0	string	LIVE	Microsoft Xbox 360 package (Xbox Live)
+>0	use	xbox-360-package
 
 # Atari Lynx cartridge dump (EXE/BLL header)
 # From: "Stefan A. Haubenthal" <polluks@web.de>

+ 19 - 18
magic/Magdir/database

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: database,v 1.55 2019/04/19 00:42:27 christos Exp $
+# $File: database,v 1.56 2019/06/14 20:12:00 christos Exp $
 # database:  file(1) magic for various databases
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@@ -149,7 +149,6 @@
 # updated by Joerg Jenderek at Feb 2013
 # https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
 # https://www.clicketyclick.dk/databases/xbase/format/dbf.html
-# http://home.f1.htw-berlin.de/scheibl/db/intern/dBase.htm
 # inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
 0	ubelong&0x0000FFFF		<0x00000C20
 # skip Infocom game Z-machine
@@ -339,7 +338,7 @@
 # next free block index is positive
 >>>0		ulelong		>0
 # skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
->>>>17		ubelong&0xFFfdFE00	0x00000000
+>>>>17		ubelong&0xFFfdFEff	0x00000000
 # skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
 >>>>>20		ubelong&0xFF01209B	0x00000000
 # dBASE III
@@ -355,36 +354,34 @@
 >>>>>>>>>6	ubeshort	>0
 # skip emacs.PIF
 >>>>>>>>>>4	ushort		0
->>>>>>>>>>>0	use		foxpro-memo-print
+# check for valid FoxPro field type
+>>>>>>>>>>>512	ubelong		<3
+>>>>>>>>>>>>0	use		foxpro-memo-print
 # dBASE III DBT , garbage
->>>>>>>>>6	ubeshort	0
-# skip MM*DD*.bin by test for for reserved NULL byte
->>>>>>>>>>510	ubeshort	0
-# skip TK-DOS11.img image by looking for memo text
->>>>>>>>>>>512	ubelong		<0xfeffff03
-# skip EFI executables by looking for memo text
->>>>>>>>>>>>512	ubelong		>0x1F202020
->>>>>>>>>>>>>513 ubyte		>0
+# skip WORD1XW.DOC with improbably high free block index
+>>>>>>>>>0	lelong		<2205083
 # unusual dBASE III DBT like adressen.dbt
->>>>>>>>>>>>>>0	use		dbase3-memo-print
+>>>>>>>>>>0	use		dbase3-memo-print
 # dBASE III DBT like angest.dbt, or garbage PCX DBF
 >>>>>>>>8	ubelong		!0
 # skip PCX and some DBF by test for for reserved NULL bytes
 >>>>>>>>>510	ubeshort	0
-# skip some DBF by test of invalid version
->>>>>>>>>>0	ubyte		>5
->>>>>>>>>>>0	ubyte		<48
->>>>>>>>>>>>0	use		dbase3-memo-print
+# skip AI070GEP.EPS with improbably high free block index
+>>>>>>>>>>0	lelong		<458766
+>>>>>>>>>>>0	use		dbase3-memo-print
 # dBASE IV DBT with positive block size
 >>>>>>>20	uleshort	>0
 # dBASE IV DBT with valid block length like 512, 1024
 # multiple of 2 in between 16 and 16 K ,implies upper and lower bits are zero
->>>>>>>>20	uleshort&0x800f	0
+# skip also 3600h 3E00h size
+>>>>>>>>20	uleshort&0xE00f	0
 >>>>>>>>>0	use		dbase4-memo-print
 
 #		Print the information of dBase III DBT memo file
 0	name				dbase3-memo-print
 >0	ubyte			x		dBase III DBT
+!:mime	application/x-dbt
+!:ext	dbt
 # instead 3 as version number 0 for unusual examples like biblio.dbt
 >16	ubyte			!3		\b, version number %u
 # Number of next available block for appending data
@@ -395,6 +392,7 @@
 >20	uleshort		!0		\b, block length %u
 # dBase III memo field terminated by \032\032
 >512	string			>\0		\b, 1st item "%s"
+# https://www.clicketyclick.dk/databases/xbase/format/dbt.html
 #		Print the information of dBase IV DBT memo file
 0	name				dbase4-memo-print
 >0		lelong		x		dBase IV DBT
@@ -433,9 +431,12 @@
 # length of memo field
 >>4		lelong		x		\b, field length %d
 >>>8		string		>\0		\b, 1st used item "%s"
+# http://www.dbfree.org/webdocs/1-documentation/0018-developers_stuff_(advanced)/os_related_stuff/xbase_file_format.htm
 #		Print the information of FoxPro FPT memo file
 0	name				foxpro-memo-print
 >0		belong		x		FoxPro FPT
+!:mime	application/x-fpt
+!:ext	fpt
 # Size of blocks for FoxPro ( 64,256 )
 >6		ubeshort	x		\b, blocks size %u
 # next available block

+ 4 - 5
magic/Magdir/elf

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: elf,v 1.77 2019/01/16 19:33:35 christos Exp $
+# $File: elf,v 1.79 2019/12/16 04:24:01 christos Exp $
 # elf:  file(1) magic for ELF executables
 #
 # We have to check the byte order flag to see what byte order all the
@@ -38,7 +38,7 @@
 >0	lelong&0x3		2		relaxed memory ordering,
 
 0	name		elf-pa-risc
->2	leshort		0x0208		1.0
+>2	leshort		0x020b		1.0
 >2	leshort		0x0210		1.1
 >2	leshort		0x0214		2.0
 >0	leshort		&0x0008		(LP64)
@@ -50,9 +50,8 @@
 !:mime	application/x-object
 >16	leshort		2		executable,
 !:mime	application/x-executable
->16	leshort		3		${x?pie executable:shared object},
-
-!:mime	application/x-${x?pie-executable:sharedlib}
+>16	leshort		3		shared object,
+!:mime	application/x-sharedlib
 >16	leshort		4		core file,
 !:mime	application/x-coredump
 # OS-specific

+ 2 - 2
magic/Magdir/espressif

@@ -1,5 +1,5 @@
 
-# $File: espressif,v 1.1 2018/11/20 18:57:17 christos Exp $
+# $File: espressif,v 1.2 2019/11/15 21:03:14 christos Exp $
 # configuration dump of Tasmota firmware for ESP8266 based devices by Espressif
 # URL: https://github.com/arendst/Sonoff-Tasmota/
 # Reference: https://codeload.github.com/arendst/Sonoff-Tasmota/zip/release-6.2/
@@ -8,7 +8,7 @@
 #
 # cfg_holder=4617=0x1209
 0		uleshort	4617
-# remainig settings normally 0x5A+offset XORed; free_1D5[20] empty since 5.12.0e
+# remaining settings normally 0x5A+offset XORed; free_1D5[20] empty since 5.12.0e
 >0x1D5		ubequad		0x2f30313233343536	configuration of Tasmota firmware (ESP8266)
 !:mime	application/x-tasmota-dmp
 !:ext	dmp

+ 25 - 35
magic/Magdir/filesystems

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.128 2019/04/23 15:43:27 christos Exp $
+# $File: filesystems,v 1.131 2019/11/15 23:49:38 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
 0	name	partid
@@ -2057,10 +2057,6 @@
 >0x10040	lelong	2		yura hash
 >0x10040	lelong	3		r5 hash
 
-# JFFS - russell@coker.com.au
-0	lelong	0x34383931	Linux Journalled Flash File system, little endian
-0	belong	0x34383931	Linux Journalled Flash File system, big endian
-
 # EST flat binary format (which isn't, but anyway)
 # From: Mark Brown <broonie@sirena.org.uk>
 0	string	ESTFBINR	EST flat binary
@@ -2122,6 +2118,7 @@
 >29	byte	23		\bDesignWare ARC,
 >29	byte	24		\bx86_64,
 >29	byte	25		\bXtensa,
+>29	byte	26		\bRISC-V,
 >30	byte	0		Invalid Image
 >30	byte	1		Standalone Program
 >30	byte	2		OS Kernel Image
@@ -2144,55 +2141,48 @@
 
 # JFFS2 file system
 0	leshort	0x1984		Linux old jffs2 filesystem data little endian
+0	beshort	0x1984		Linux old jffs2 filesystem data big endian
 0	leshort	0x1985		Linux jffs2 filesystem data little endian
+0	beshort	0x1985		Linux jffs2 filesystem data big endian
 
 # Squashfs
-0	string	sqsh	Squashfs filesystem, big endian,
+0	name	squashfs
 >28	beshort	x	version %d.
->30	beshort x	\b%d,
+>30	beshort	x	\b%d,
+>20	beshort 0	uncompressed,
+>20	beshort 1	zlib
+>20	beshort 2	lzma
+>20	beshort 3	lzo
+>20	beshort 4	xz
+>20	beshort 5	lz4
+>20	beshort 6	zstd
+>20	beshort >0	compressed,
 >28	beshort <3
 >>8	belong	x	%d bytes,
 >28	beshort >2
->>28 beshort <4
+>>28	beshort <4
 >>>63	bequad x	%lld bytes,
->>28 beshort >3
+>>28	beshort >3
 >>>40	bequad x	%lld bytes,
 #>>67	belong	x	%d bytes,
 >4	belong	x	%d inodes,
 >28	beshort <2
 >>32	beshort	x	blocksize: %d bytes,
 >28	beshort >1
->>28 beshort <4
+>>28	beshort <4
 >>>51	belong	x	blocksize: %d bytes,
->>28 beshort >3
+>>28	beshort >3
 >>>12	belong	x	blocksize: %d bytes,
->28 beshort <4
+>28	beshort <4
 >>39	bedate	x	created: %s
->28 beshort >3
+>28	beshort >3
 >>8	bedate	x	created: %s
+
+0	string	sqsh	Squashfs filesystem, big endian,
+>0	use	squashfs
+
 0	string	hsqs	Squashfs filesystem, little endian,
->28	leshort	x	version %d.
->30	leshort	x	\b%d,
->28	leshort <3
->>8	lelong	x	%d bytes,
->28	leshort >2
->>28 leshort <4
->>>63	lequad x	%lld bytes,
->>28 leshort >3
->>>40	lequad x	%lld bytes,
-#>>63	lelong	x	%d bytes,
->4	lelong	x	%d inodes,
->28	leshort <2
->>32	leshort	x	blocksize: %d bytes,
->28	leshort >1
->>28 leshort <4
->>>51	lelong	x	blocksize: %d bytes,
->>28 leshort >3
->>>12	lelong	x	blocksize: %d bytes,
->28 leshort <4
->>39	ledate	x	created: %s
->28 leshort >3
->>8	ledate	x	created: %s
+>0	use	^squashfs
 
 # AFS Dump Magic
 # From: Ty Sarna <tsarna@sarna.org>

+ 30 - 26
magic/Magdir/fonts

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.41 2019/05/05 16:44:04 christos Exp $
+# $File: fonts,v 1.43 2019/07/16 11:11:31 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0	search/1	FONT		ASCII vfont text
@@ -133,51 +133,55 @@
 # Reference: http://cd.textfiles.com/ataricompendium/BOOK/HTML/APPENDC.HTM#cnt
 #
 # usual case with lightening mask and skewing mask 5555h~UU
-62	ulelong		0x55555555
->0	use		gdos-font
+#62	ulelong		0x55555555
+# skip cl8m8ocofedso.testfile by looking for face size lower/equal 72
+#>2	uleshort	<73
+#>>0	use		gdos-font
 # BOX18.GFT COWBOY30.GFT ROYALK30.GFT
-62	ulelong		0
+#62	ulelong		0
 # skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
->2	uleshort	>2
-# skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 48
->>2	uleshort	<49
-# skip MS Windows ICO ./msdos by looking for valid face name
->>>4	ubeshort	>0x1F00
-# skip DOS executable BACKM212.COM by looking for horizontal offset table after header
-#>>>>68	ulelong		>87		OFFSET_OK
->>>>0	use		gdos-font
+#>2	uleshort	>2
+# skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 72
+#>>2	uleshort	<73
+# skip MS oem.hlp, some Windows ICO ./msdos by looking for valid long name like WYE
+#>>>4	ulelong		>0x001F1f1F
+# skip Microsoft WinWord 2.0 ./msdos by looking for positive offset to font data
+#>>>>76	ulelong		>83
+#>>>>>0	use		gdos-font
 0	name		gdos-font
 >0	uleshort	x		GEM GDOS font
 !:mime	application/x-font-gdos
 # also .eps found like AA070GEP.EPS AI360GEP.EPS
 !:ext	fnt/gtf
-# font name like University Bold
+# font name like Big&Tall, Celtic #s, Courier, University Bold, WYE
 >4	string		x		%.32s
-# face size in points 3-48
+# face size in points 3-72 SLSS03CG.FNT H1CELT72.FNT
 >2	uleshort	x		%u
 # face ID (must be unique)
 >0	uleshort	x		\b, ID 0x%4.4x
-# lowest character index in face (usually 32 for disk-loaded fonts).
-#>36	uleshort	x		\b, low character index %u
-# width of the widest character
+# lowest character index in face (4 but usually 32 for disk-loaded fonts)
+#>36	uleshort	!32		\b, unusual character index %u
+# width of the widest character like 0 8 10 12 16 24 32
 #>50	uleshort	x		\b, %u char width
-# width of the widest character cell
+# width of the widest character cell like 8 11 12 14 15 16 33 67
 #>52	uleshort	x		\b, %u cell width
-# thickening size
+# thickening size in pixel like 0 1 2 3 4 5 6 7 8
 #>58	uleshort	x		\b, %u thick
 # lightening mask to eliminate pixels, usually 5555h
 >62	uleshort	!0x5555		\b, lightening mask 0x%x
 # skewing mask to determine when to perform additional rotation when skewing, usually 5555h
 >64	uleshort	!0x5555		\b, skewing mask 0x%x
-# offset to horizontal offset table 58h~88 5eh
-#>68	ulelong		>88		\b, 0x%x horizontal table offset
-# offset character offset table
+# offset to optional horizontal offset table 0 58h~88 5eh 252h
+#>68	ulelong		x		\b, 0x%x horizontal table offset
+# offset of character offset table 54h for many *.GFT 55h 58h 5Eh 120h 1D4h 202h 220h
 #>72	ulelong		x		\b, 0x%x coffset
-# offset to font data
-#>72	ulelong		x		\b, 0x%x foffset