Browse Source

Import upstream version 5.41

Christos Zoulas 10 months ago
parent
commit
826ee4ffbf
100 changed files with 3930 additions and 1770 deletions
  1. 78 0
      ChangeLog
  2. 1 1
      Makefile.am
  3. 4 3
      Makefile.in
  4. 0 159
      README
  5. 49 0
      README.DEVELOPER
  6. 29 0
      RELEASE-PROCEDURE
  7. 18 17
      acinclude.m4
  8. 1 78
      aclocal.m4
  9. 3 0
      config.h.in
  10. 103 505
      configure
  11. 3 4
      configure.ac
  12. 2 1
      doc/Makefile.in
  13. 36 25
      doc/file.man
  14. 6 3
      doc/magic.man
  15. 77 0
      m4/visibility.m4
  16. 5 5
      magic/Magdir/acorn
  17. 29 0
      magic/Magdir/aes
  18. 32 10
      magic/Magdir/algol68
  19. 139 8
      magic/Magdir/amigaos
  20. 26 7
      magic/Magdir/android
  21. 139 24
      magic/Magdir/animation
  22. 5 5
      magic/Magdir/apple
  23. 169 38
      magic/Magdir/archive
  24. 41 0
      magic/Magdir/arm
  25. 3 3
      magic/Magdir/asf
  26. 32 32
      magic/Magdir/audio
  27. 33 0
      magic/Magdir/avm
  28. 1 1
      magic/Magdir/biosig
  29. 5 1
      magic/Magdir/blit
  30. 10 0
      magic/Magdir/bm
  31. 4 3
      magic/Magdir/bsi
  32. 30 0
      magic/Magdir/bytecode
  33. 5 2
      magic/Magdir/c-lang
  34. 9 4
      magic/Magdir/c64
  35. 94 15
      magic/Magdir/cad
  36. 45 16
      magic/Magdir/cafebabe
  37. 5 1
      magic/Magdir/citrus
  38. 3 3
      magic/Magdir/clipper
  39. 47 31
      magic/Magdir/coff
  40. 60 40
      magic/Magdir/commands
  41. 7 2
      magic/Magdir/compress
  42. 49 13
      magic/Magdir/console
  43. 2 2
      magic/Magdir/coverage
  44. 5 0
      magic/Magdir/crypto
  45. 188 24
      magic/Magdir/database
  46. 4 3
      magic/Magdir/der
  47. 8 7
      magic/Magdir/diff
  48. 2 1
      magic/Magdir/digital
  49. 5 1
      magic/Magdir/editors
  50. 43 5
      magic/Magdir/elf
  51. 2 2
      magic/Magdir/espressif
  52. 184 113
      magic/Magdir/filesystems
  53. 21 12
      magic/Magdir/fonts
  54. 24 22
      magic/Magdir/forth
  55. 6 6
      magic/Magdir/fsav
  56. 210 5
      magic/Magdir/games
  57. 4 4
      magic/Magdir/git
  58. 3 3
      magic/Magdir/gnome
  59. 21 21
      magic/Magdir/gnu
  60. 2 2
      magic/Magdir/gpt
  61. 5 5
      magic/Magdir/gpu
  62. 0 13
      magic/Magdir/guile
  63. 3 3
      magic/Magdir/hitachi-sh
  64. 2 2
      magic/Magdir/human68k
  65. 5 1
      magic/Magdir/ibm370
  66. 3 1
      magic/Magdir/ibm6000
  67. 13 13
      magic/Magdir/icc
  68. 8 2
      magic/Magdir/iff
  69. 615 121
      magic/Magdir/images
  70. 3 3
      magic/Magdir/intel
  71. 22 3
      magic/Magdir/jpeg
  72. 64 0
      magic/Magdir/lammps
  73. 43 2
      magic/Magdir/lif
  74. 48 31
      magic/Magdir/linux
  75. 4 1
      magic/Magdir/lisp
  76. 12 0
      magic/Magdir/locoscript
  77. 10 1
      magic/Magdir/lua
  78. 96 44
      magic/Magdir/mach
  79. 9 9
      magic/Magdir/macintosh
  80. 10 1
      magic/Magdir/mail.news
  81. 56 56
      magic/Magdir/map
  82. 55 3
      magic/Magdir/maple
  83. 88 7
      magic/Magdir/mathematica
  84. 6 1
      magic/Magdir/measure
  85. 25 10
      magic/Magdir/misctools
  86. 2 2
      magic/Magdir/modem
  87. 2 2
      magic/Magdir/motorola
  88. 3 3
      magic/Magdir/mozilla
  89. 250 63
      magic/Magdir/msdos
  90. 13 10
      magic/Magdir/msooxml
  91. 34 34
      magic/Magdir/msx
  92. 0 12
      magic/Magdir/neko
  93. 5 1
      magic/Magdir/netware
  94. 29 0
      magic/Magdir/nim-lang
  95. 60 11
      magic/Magdir/ole2compounddocs
  96. 136 1
      magic/Magdir/os2
  97. 8 0
      magic/Magdir/pcjr
  98. 9 2
      magic/Magdir/pdf
  99. 3 3
      magic/Magdir/pgf
  100. 0 0
      magic/Magdir/pgp

+ 78 - 0
ChangeLog

@@ -1,3 +1,81 @@
+2021-10-18  11:57  Christos Zoulas <christos@zoulas.com>
+
+	* release 5.41
+
+2021-09-23  03:51  Christos Zoulas <christos@zoulas.com>
+
+	* Avinash Sonawane: Fix tzname detection
+
+2021-09-03  09:17  Christos Zoulas <christos@zoulas.com>
+
+	* Fix relationship tests with "search" magic, don't short circuit
+	  logic
+
+2021-07-13  01:06  Christos Zoulas <christos@zoulas.com>
+
+	* Fix memory leak in compile mode
+
+2021-07-01  03:51  Christos Zoulas <christos@zoulas.com>
+
+	* PR/272: kiefermat: Only set returnval = 1 when we printed something
+	  (in all cases print or !print). This simplifies the logic and fixes
+	  the issue in the PR with -k and --mime-type there was no continuation
+	  printed before the default case.
+
+2021-06-30  13:07  Christos Zoulas <christos@zoulas.com>
+
+	* PR/270: Don't translate unprintable characters in %s magic formats
+	  when -r
+	* PR/269: Avoid undefined behavior with clang (adding offset to NULL)
+
+2021-05-09  18:38  Christos Zoulas <christos@zoulas.com>
+
+	* Add a new flag (f) that requires that the match is a full word,
+	   not a partial word match.
+	* Add varint types (unused)
+
+2021-04-19  17:17  Christos Zoulas <christos@zoulas.com>
+
+	* PR/256: mutableVoid: If the file is less than 3 bytes, use the file
+	  length to determine type
+	* PR/259: aleksandr.v.novichkov: mime printing through indirect magic
+	  is not taken into account, use match directly so that it does.
+
+2021-04-04  17:02  Christos Zoulas <christos@zoulas.com>
+
+	* count the total bytes found not the total byte positions
+	  in order to determine encoding (Anatol Belski)
+
+2021-03-30  20:21  Christos Zoulas <christos@zoulas.com>
+
+	* release 5.40
+
+2021-02-05  16:31  Christos Zoulas <christos@zoulas.com>
+
+	* PR/234: Add limit to the number of bytes to scan for encoding
+	* PR/230: Fix /T (trim flag) for regex
+
+2021-02-01  12:31  Christos Zoulas <christos@zoulas.com>
+	* PR/77: Trim trailing separator.
+
+2020-12-17  15:44  Christos Zoulas <christos@zoulas.com>
+
+	* PR/211: Convert system read errors from corrupt ELF
+	  files into human readable error messages
+
+2020-12-08  16:24  Christos Zoulas <christos@zoulas.com>
+	
+	* fix multithreaded decompression file descriptor issue
+	  by using close-on-exec (Denys Vlasenko)
+
+2020-06-27  11:58  Christos Zoulas <christos@zoulas.com>
+
+	* Exclude surrogate pairs from utf-8 detection (Michael Liu)
+
+2020-06-25  12:53  Christos Zoulas <christos@zoulas.com>
+	
+	* Include # to the list of ignored format chars (Werner Fink)
+
 2020-06-14  20:02  Christos Zoulas <christos@zoulas.com>
 
 	* release 5.39

+ 1 - 1
Makefile.am

@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I m4
 
-EXTRA_DIST = MAINT
+EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER m4/visibility.m4
 
 SUBDIRS = src magic tests doc python
 

+ 4 - 3
Makefile.in

@@ -92,7 +92,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -191,7 +192,7 @@ CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/libmagic.pc.in AUTHORS COPYING ChangeLog INSTALL \
-	NEWS README TODO compile config.guess config.sub install-sh \
+	NEWS TODO compile config.guess config.sub depcomp install-sh \
 	ltmain.sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
@@ -357,7 +358,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = MAINT
+EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER m4/visibility.m4
 SUBDIRS = src magic tests doc python
 
 # This variable must have 'exec' in its name, in order to be installed

+ 0 - 159
README

@@ -1,159 +0,0 @@
-## README for file(1) Command and the libmagic(3) library ##
-
-    @(#) $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/
-Bug tracker: http://bugs.astron.com/
-E-mail: christos@astron.com
-Build Status: https://travis-ci.org/file/file
-
-Phone: Do not even think of telephoning me about this program. Send cash first!
-
-This is Release 5.x of Ian Darwin's (copyright but distributable)
-file(1) command, an implementation of the Unix File(1) command.
-It knows the 'magic number' of several thousands of file types.
-This version is the standard "file" command for Linux,
-*BSD, and other systems. (See "patchlevel.h" for the exact release number).
-
-You can download the latest version of the original sources for file from:
-
-	ftp://ftp.astron.com/pub/file/
-
-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.
-
-The major feature of 4.x is the refactoring of the code into a library,
-and the re-write of the file command in terms of that library. The library
-itself, libmagic can be used by 3rd party programs that wish to identify
-file types without having to fork() and exec() file. The prime contributor
-for 4.0 was Mans Rullgard.
-
-UNIX is a trademark of UNIX System Laboratories.
-
-The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
-including byte-order independence.
-
-The prime contributor to Release 3.0 was Christos Zoulas, who put
-in hundreds of lines of source code changes, including his own
-ANSIfication of the code (I liked my own ANSIfication better, but
-his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
-to include the code...), his HP-like "indirection" (a feature of
-the HP file command, I think), and his mods that finally got the
-uncompress (-z) mode finished and working.
-
-This release has compiled in numerous environments; see PORTING
-for a list and problems.
-
-This fine freeware file(1) follows the USG (System V) model of the file
-command, rather than the Research (V7) version or the V7-derived 4.[23]
-Berkeley one. That is, the file /etc/magic contains much of the ritual
-information that is the source of this program's power. My version
-knows a little more magic (including tar archives) than System V; the
-/etc/magic parsing seems to be compatible with the (poorly documented)
-System V /etc/magic format (with one exception; see the man page).
-
-In addition, the /etc/magic file is built from a subdirectory
-for easier(?) maintenance.  I will act as a clearinghouse for
-magic numbers assigned to all sorts of data files that
-are in reasonable circulation. Send your magic numbers,
-in magic(5) format please, to the maintainer, Christos Zoulas.
-
-COPYING - read this first.
-README - read this second (you are currently reading this file).
-INSTALL - read on how to install
-src/apprentice.c - parses /etc/magic to learn magic
-src/apptype.c - used for OS/2 specific application type magic
-src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
-src/asctime_r.c - replacement for OS's that don't have it.
-src/asprintf.c - replacement for OS's that don't have it.
-src/asctime_r.c - replacement for OS's that don't have it.
-src/asprintf.c - replacement for OS's that don't have it.
-src/buffer.c - buffer handling functions.
-src/cdf.[ch] - parser for Microsoft Compound Document Files
-src/cdf_time.c - time converter for CDF.
-src/compress.c - handles decompressing files to look inside.
-src/ctime_r.c - replacement for OS's that don't have it.
-src/der.[ch] - parser for Distinguished Encoding Rules
-src/dprintf.c - replacement for OS's that don't have it.
-src/elfclass.h - common code for elf 32/64.
-src/encoding.c - handles unicode encodings
-src/file.c - the main program
-src/file.h - header file
-src/file_opts.h - list of options
-src/fmtcheck.c - replacement for OS's that don't have it.
-src/fsmagic.c - first set of tests the program runs, based on filesystem info
-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.
-src/magic.h.in - source file for magic.h
-src/mygetopt.h - replacement for OS's that don't have it.
-src/magic.c - the libmagic api
-src/names.h - header file for ascmagic.c
-src/pread.c - replacement for OS's that don't have it.
-src/print.c - print results, errors, warnings.
-src/readcdf.c - CDF wrapper.
-src/readelf.[ch] - Stand-alone elf parsing code.
-src/softmagic.c - 2nd set of tests, based on /etc/magic
-src/mygetopt.h - replacement for OS's that don't have it.
-src/strcasestr.c - replacement for OS's that don't have it.
-src/strlcat.c - replacement for OS's that don't have it.
-src/strlcpy.c - replacement for OS's that don't have it.
-src/strndup.c - replacement for OS's that don't have it.
-src/tar.h - tar file definitions
-src/vasprintf.c - for systems that don't have it.
-doc/file.man - man page for the command
-doc/magic.man - man page for the magic file, courtesy Guy Harris.
-	Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
-
-Magdir - directory of /etc/magic pieces
-------------------------------------------------------------------------------
-
-If you submit a new magic entry please make sure you read the following
-guidelines:
-
-- Initial match is preferably at least 32 bits long, and is a _unique_ match
-- If this is not feasible, use additional check
-- Match of <= 16 bits are not accepted
-- Delay printing string as much as possible, don't print output too early
-- Avoid printf arbitrary byte as string, which can be a source of
-  crash and buffer overflow
-
-- Provide complete information with entry:
-  * One line short summary
-  * Optional long description
-  * File extension, if applicable
-  * Full name and contact method (for discussion when entry has problem)
-  * Further reference, such as documentation of format
-
-------------------------------------------------------------------------------
-
-gpg for dummies:
-
-$ gpg --verify file-X.YY.tar.gz.asc file-X.YY.tar.gz
-gpg: assuming signed data in `file-X.YY.tar.gz'
-gpg: Signature made WWW MMM DD HH:MM:SS YYYY ZZZ using DSA key ID KKKKKKKK
-
-To download the key:
-
-$ gpg --keyserver hkp://keys.gnupg.net --recv-keys KKKKKKKK
-
-------------------------------------------------------------------------------
-
-
-Parts of this software were developed at SoftQuad Inc., developers
-of SGML/HTML/XML publishing software, in Toronto, Canada.
-SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.

+ 49 - 0
README.DEVELOPER

@@ -0,0 +1,49 @@
+# How to get started developing
+
+@(#) $File: README.DEVELOPER,v 1.9 2021/09/20 14:04:39 christos Exp $
+
+## Auto files
+
+After checking out the source, run the following:
+
+	autoreconf -f -i
+	make distclean	# this can fail if you have not built before
+	./configure --disable-silent-rules
+	make -j4
+	make -C tests check
+
+If you see errors, make sure you have the latest libtool and autoconf
+This has been tested with autoconf-2.69 and libtool-2.4.2
+
+## Installing dependencies
+
+If your platform doesn't have the above tools, install the following
+packages first.
+
+### Debian
+
+	apt-get install \
+	    automake \
+	    gcc \
+	    libtool \
+	    make \
+	    python \
+	    zlib1g-dev \
+
+See also `.travis.yml`.
+
+### Mac OS X (MacPorts)
+
+	port install \
+	    autoconf \
+	    automake \
+	    libtool \
+
+### Mac OS X (HomeBrew)
+
+	brew install autoconf automake libtool
+
+Tested with:
+	autoconf 2.69
+	automake 1.16.1
+	libtool 2.4.6

+ 29 - 0
RELEASE-PROCEDURE

@@ -0,0 +1,29 @@
+# HOW TO RELEASE FILE
+
+@(#) $File: RELEASE-PROCEDURE,v 1.7 2021/10/18 16:38:25 christos Exp $
+
+1)  Update version number in configure.ac
+2)  Note the new version in ChangeLog
+3)  Update README.md if applicable
+4)  Commit changes into CVS
+5)  Rebuild and run tests (see README.DEVELOPER)
+6)  Tag the release with FILEx_yy
+7)  Create the source tarball: make distcheck
+7a) Sign the source tarball.
+	gpg --armor --detach-sign mysoftware-0.4.tar.gz
+8)  Make the source tarball available on ftp
+9)  Add the new version to bugs.astron.com:
+    - Click: Manage > Manage Projects > file
+    - Scroll down to "Versions"
+    - Click on "Edit" next to the HEAD version
+    - Change the "Version" from HEAD to the newly released version
+    - Change the "Date Order" to the current time
+    - Check the "Released" box
+    - Click on "Update Version"
+    - Type HEAD into the box at the bottom of the version list and
+      click on "Add and Edit Version"
+    - Set the "Date Order" to 2030-01-01 (i.e. far in the future)
+    - Click on "Update Version"
+10) Mail an announcement to file@astron.com containing a summary of the
+    ChangeLog changes. Historically we don't mention magic changes in the
+    ChangeLog or the mail message, only source changes.

+ 18 - 17
acinclude.m4

@@ -3,8 +3,9 @@ dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
 AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
 [AC_REQUIRE([AC_STRUCT_TM])dnl
 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
+[AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;])],
   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
 if test "$ac_cv_struct_tm_zone" = yes; then
   AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
@@ -14,19 +15,20 @@ fi
 # consider it declared and we won't give our own extern.
 AC_CHECK_DECLS([tzname], , , [#include <time.h>])
 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
-[AC_TRY_LINK(
-[#include <time.h>
-#if !HAVE_DECL_TZNAME
+[AC_LINK_IFELSE(
+[AC_LANG_PROGRAM([#include <time.h>],
+[[#if !HAVE_DECL_TZNAME
 extern char *tzname[];
-#endif],
-[return tzname[0][0];], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
+#endif
+return tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])])
   if test $ac_cv_var_tzname = yes; then
     AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
   fi
 
 AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
+[AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;])],
   ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
 if test "$ac_cv_struct_tm_isdst" = yes; then
   AC_DEFINE(HAVE_TM_ISDST,1,[HAVE_TM_ISDST])
@@ -35,14 +37,12 @@ fi
 
 AC_CHECK_DECLS([daylight], , , [#include <time.h>])
 AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
-[AC_TRY_LINK(
-changequote(<<, >>)dnl
-<<#include <time.h>
-#if !HAVE_DECL_DAYLIGHT
+[AC_LINK_IFELSE(
+[AC_LANG_PROGRAM([#include <time.h>],
+[#if !HAVE_DECL_DAYLIGHT
 extern int daylight;
-#endif>>,
-changequote([, ])dnl
-[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
+#endif
+atoi(daylight);])], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
   if test $ac_cv_var_daylight = yes; then
     AC_DEFINE(HAVE_DAYLIGHT,1,[HAVE_DAYLIGHT])
   fi
@@ -50,7 +50,8 @@ changequote([, ])dnl
 
 AC_DEFUN([AC_STRUCT_OPTION_GETOPT_H],
 [AC_CACHE_CHECK([for struct option in getopt], ac_cv_struct_option_getopt_h,
-[AC_TRY_COMPILE([#include <getopt.h>], [struct option op; op.name;],
+[AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([#include <getopt.h>], [struct option op; op.name;])],
   ac_cv_struct_option_getopt_h=yes, ac_cv_struct_option_getopt_h=no)])
 if test "$ac_cv_struct_option_getopt_h" = yes; then
   AC_DEFINE(HAVE_STRUCT_OPTION,1,[HAVE_STRUCT_OPTION])

+ 1 - 78
aclocal.m4

@@ -20,84 +20,6 @@ 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 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.
-
-dnl From Bruno Haible.
-
-dnl Tests whether the compiler supports the command-line option
-dnl -fvisibility=hidden and the function and variable attributes
-dnl __attribute__((__visibility__("hidden"))) and
-dnl __attribute__((__visibility__("default"))).
-dnl Does *not* test for __visibility__("protected") - which has tricky
-dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
-dnl Mac OS X.
-dnl Does *not* test for __visibility__("internal") - which has processor
-dnl dependent semantics.
-dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
-dnl "really only recommended for legacy code".
-dnl Set the variable CFLAG_VISIBILITY.
-dnl Defines and sets the variable HAVE_VISIBILITY.
-
-AC_DEFUN([gl_VISIBILITY],
-[
-  AC_REQUIRE([AC_PROG_CC])
-  CFLAG_VISIBILITY=
-  HAVE_VISIBILITY=0
-  if test -n "$GCC"; then
-    dnl First, check whether -Werror can be added to the command line, or
-    dnl whether it leads to an error because of some other option that the
-    dnl user has put into $CC $CFLAGS $CPPFLAGS.
-    AC_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_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
-    fi
-  fi
-  AC_SUBST([CFLAG_VISIBILITY])
-  AC_SUBST([HAVE_VISIBILITY])
-  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
-    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
-])
-
 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -1216,4 +1138,5 @@ m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
+m4_include([m4/visibility.m4])
 m4_include([acinclude.m4])

+ 3 - 0
config.h.in

@@ -125,6 +125,9 @@
 /* Define to 1 if you have the `newlocale' function. */
 #undef HAVE_NEWLOCALE
 
+/* Define to 1 if you have the `pipe2' function. */
+#undef HAVE_PIPE2
+
 /* Define to 1 if you have the `pread' function. */
 #undef HAVE_PREAD
 

+ 103 - 505
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.39.
+# Generated by GNU Autoconf 2.69 for file 5.41.
 #
 # Report bugs to <christos@astron.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.39'
-PACKAGE_STRING='file 5.39'
+PACKAGE_VERSION='5.41'
+PACKAGE_STRING='file 5.41'
 PACKAGE_BUGREPORT='christos@astron.com'
 PACKAGE_URL=''
 
@@ -1334,7 +1334,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.39 to adapt to many kinds of systems.
+\`configure' configures file 5.41 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1404,7 +1404,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of file 5.39:";;
+     short | recursive ) echo "Configuration of file 5.41:";;
    esac
   cat <<\_ACEOF
 
@@ -1524,7 +1524,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.39
+file configure 5.41
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2180,7 +2180,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by file $as_me 5.39, which was
+It was created by file $as_me 5.41, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3046,7 +3046,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.39'
+ VERSION='5.41'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3401,69 +3401,6 @@ fi
 
 
 
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
-$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
-cat > confinc.mk << 'END'
-am__doit:
-	@echo this is the am__doit target >confinc.out
-.PHONY: am__doit
-END
-am__include="#"
-am__quote=
-# 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
-  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
-   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }
-  case $?:`cat confinc.out 2>/dev/null` in #(
-  '0:this is the am__doit target') :
-    case $s in #(
-  BSD) :
-    am__include='.include' am__quote='"' ;; #(
-  *) :
-    am__include='include' am__quote='' ;;
-esac ;; #(
-  *) :
-     ;;
-esac
-  if test "$am__include" != "#"; then
-    _am_result="yes ($s style)"
-    break
-  fi
-done
-rm -f confinc.* confmf.*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
-$as_echo "${_am_result}" >&6; }
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then :
-  enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-  am__nodep='_no'
-fi
- if test "x$enable_dependency_tracking" != xno; then
-  AMDEP_TRUE=
-  AMDEP_FALSE='#'
-else
-  AMDEP_TRUE='#'
-  AMDEP_FALSE=
-fi
-
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4311,6 +4248,69 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
+am__doit:
+	@echo this is the am__doit target >confinc.out
+.PHONY: am__doit
+END
+am__include="#"
+am__quote=
+# 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
+  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  case $?:`cat confinc.out 2>/dev/null` in #(
+  '0:this is the am__doit target') :
+    case $s in #(
+  BSD) :
+    am__include='.include' am__quote='"' ;; #(
+  *) :
+    am__include='include' am__quote='' ;;
+esac ;; #(
+  *) :
+     ;;
+esac
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
 
 depcc="$CC"   am_compiler_list=
 
@@ -4440,298 +4440,6 @@ else
 fi
 
 
-   case $ac_cv_prog_cc_stdc in #(
-  no) :
-    ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
-  *) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
-$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
-if ${ac_cv_prog_cc_c99+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c99=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-
-// Check varargs macros.  These examples are taken from C99 6.10.3.5.
-#define debug(...) fprintf (stderr, __VA_ARGS__)
-#define showlist(...) puts (#__VA_ARGS__)
-#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
-static void
-test_varargs_macros (void)
-{
-  int x = 1234;
-  int y = 5678;
-  debug ("Flag");
-  debug ("X = %d\n", x);
-  showlist (The first, second, and third items.);
-  report (x>y, "x is %d but y is %d", x, y);
-}
-
-// Check long long types.
-#define BIG64 18446744073709551615ull
-#define BIG32 4294967295ul
-#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
-#if !BIG_OK
-  your preprocessor is broken;
-#endif
-#if BIG_OK
-#else
-  your preprocessor is broken;
-#endif
-static long long int bignum = -9223372036854775807LL;
-static unsigned long long int ubignum = BIG64;
-
-struct incomplete_array
-{
-  int datasize;
-  double data[];
-};
-
-struct named_init {
-  int number;
-  const wchar_t *name;
-  double average;
-};
-
-typedef const char *ccp;
-
-static inline int
-test_restrict (ccp restrict text)
-{
-  // See if C++-style comments work.
-  // Iterate through items via the restricted pointer.
-  // Also check for declarations in for loops.
-  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
-    continue;
-  return 0;
-}
-
-// Check varargs and va_copy.
-static void
-test_varargs (const char *format, ...)
-{
-  va_list args;
-  va_start (args, format);
-  va_list args_copy;
-  va_copy (args_copy, args);
-
-  const char *str;
-  int number;
-  float fnumber;
-
-  while (*format)
-    {
-      switch (*format++)
-	{
-	case 's': // string
-	  str = va_arg (args_copy, const char *);
-	  break;
-	case 'd': // int
-	  number = va_arg (args_copy, int);
-	  break;
-	case 'f': // float
-	  fnumber = va_arg (args_copy, double);
-	  break;
-	default:
-	  break;
-	}
-    }
-  va_end (args_copy);
-  va_end (args);
-}
-
-int
-main ()
-{
-
-  // Check bool.
-  _Bool success = false;
-
-  // Check restrict.
-  if (test_restrict ("String literal") == 0)
-    success = true;
-  char *restrict newvar = "Another string";
-
-  // Check varargs.
-  test_varargs ("s, d' f .", "string", 65, 34.234);
-  test_varargs_macros ();
-
-  // Check flexible array members.
-  struct incomplete_array *ia =
-    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
-  ia->datasize = 10;
-  for (int i = 0; i < ia->datasize; ++i)
-    ia->data[i] = i * 1.234;
-
-  // Check named initializers.
-  struct named_init ni = {
-    .number = 34,
-    .name = L"Test wide string",
-    .average = 543.34343,
-  };
-
-  ni.number = 58;
-
-  int dynamic_array[ni.number];
-  dynamic_array[ni.number - 1] = 543;
-
-  // work around unused variable warnings
-  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
-	  || dynamic_array[ni.number - 1] != 543);
-
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c99=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c99" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c99" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c99"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
-$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c99" != xno; then :
-  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
-else
-  ac_cv_prog_cc_stdc=no
-fi
-
-fi
- ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
-$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
-  if ${ac_cv_prog_cc_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
-
-  case $ac_cv_prog_cc_stdc in #(
-  no) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;; #(
-  '') :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;; #(
-  *) :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
-$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
-esac
-
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -13022,12 +12730,13 @@ CC=$lt_save_CC
   if test -n "$GCC"; then
                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5
 $as_echo_n "checking whether the -Werror option is usable... " >&6; }
-if ${gl_cv_cc_vis_werror+:} false; then :
+    if ${gl_cv_cc_vis_werror+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gl_save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -Werror"
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13044,28 +12753,29 @@ else
   gl_cv_cc_vis_werror=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CFLAGS="$gl_save_CFLAGS"
-
+      CFLAGS="$gl_save_CFLAGS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
 $as_echo "$gl_cv_cc_vis_werror" >&6; }
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5
 $as_echo_n "checking for simple visibility declarations... " >&6; }
-if ${gl_cv_cc_visibility+:} false; then :
+    if ${gl_cv_cc_visibility+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gl_save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -fvisibility=hidden"
-                                          if test $gl_cv_cc_vis_werror = yes; then
-         CFLAGS="$CFLAGS -Werror"
-       fi
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+                                    if test $gl_cv_cc_vis_werror = yes; then
+        CFLAGS="$CFLAGS -Werror"
+      fi
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 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) {}
+             extern __attribute__((__visibility__("default"))) int exportedvar;
+             extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+             extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+             void dummyfunc (void) {}
 
 int
 main ()
@@ -13081,10 +12791,10 @@ else
   gl_cv_cc_visibility=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CFLAGS="$gl_save_CFLAGS"
-
+      CFLAGS="$gl_save_CFLAGS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
 $as_echo "$gl_cv_cc_visibility" >&6; }
     if test $gl_cv_cc_visibility = yes; then
       CFLAG_VISIBILITY="-fvisibility=hidden"
@@ -13099,118 +12809,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5
 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
 if ${ac_cv_header_sys_types_h_makedev+:} false; then :
@@ -13605,12 +13203,12 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <time.h>
-#if !HAVE_DECL_TZNAME
-extern char *tzname[];
-#endif
 int
 main ()
 {
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
 return tzname[0][0];
   ;
   return 0;
@@ -13685,12 +13283,12 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <time.h>
-#if !HAVE_DECL_DAYLIGHT
-extern int daylight;
-#endif
 int
 main ()
 {
+#if !HAVE_DECL_DAYLIGHT
+extern int daylight;
+#endif
 atoi(daylight);
   ;
   return 0;
@@ -14692,7 +14290,7 @@ fi
 fi
 
 
-for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem
+for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15712,7 +15310,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by file $as_me 5.39, which was
+This file was extended by file $as_me 5.41, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15778,7 +15376,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-file config.status 5.39
+file config.status 5.41
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

+ 3 - 4
configure.ac

@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.39],[christos@astron.com])
+AC_INIT([file],[5.41],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
@@ -88,7 +88,7 @@ AM_CONDITIONAL(FSECT5, test x$fsect = x5)
 AC_SUBST(WARNINGS)
 
 dnl Checks for programs.
-AC_PROG_CC_STDC
+AC_PROG_CC
 AC_USE_SYSTEM_EXTENSIONS
 AM_PROG_CC_C_O
 AC_C_BIGENDIAN
@@ -97,7 +97,6 @@ AC_PROG_LN_S
 LT_INIT([disable-static pic-only])
 gl_VISIBILITY
 dnl Checks for headers
-AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h)
@@ -166,7 +165,7 @@ else
 fi])
 
 dnl Checks for functions
-AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem)
+AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2)
 
 dnl Provide implementation of some required functions if necessary
 AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)

+ 2 - 1
doc/Makefile.in

@@ -91,7 +91,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
 	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)

+ 36 - 25
doc/file.man

@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.140 2020/06/07 17:41:07 christos Exp $
-.Dd June 7, 2020
+.\" $File: file.man,v 1.144 2021/02/05 22:08:31 christos Exp $
+.Dd February 5, 2021
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -59,7 +59,7 @@ or non-printable).
 Exceptions are well-known file formats (core files, tar archives)
 that are known to contain binary data.
 When modifying magic files or the program itself, make sure to
-.Em "preserve these keywords" .
+.Em preserve these keywords .
 Users depend on knowing that all the readable files in a directory
 have the word
 .Dq text
@@ -91,14 +91,14 @@ and possibly
 .In exec.h
 in the standard include directory.
 These files have a
-.Dq "magic number"
+.Dq magic number
 stored in a particular place
 near the beginning of the file that tells the
 .Tn UNIX
 operating system
 that the file is a binary executable, and which of several types thereof.
 The concept of a
-.Dq "magic"
+.Dq magic number
 has been applied by extension to data files.
 Any file with some invariant identifier at a small fixed
 offset into the file can usually be described in this way.
@@ -168,7 +168,9 @@ in any of the character sets listed above is simply said to be
 .Sh OPTIONS
 .Bl -tag -width indent
 .It Fl Fl apple
-Causes the file command to output the file type and creator code as
+Causes the
+.Nm
+command to output the file type and creator code as
 used by older MacOS versions.
 The code consists of eight letters,
 the first describing the file type, the latter the creator.
@@ -184,7 +186,7 @@ output file that contains a pre-parsed version of the magic file or directory.
 Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with the
 .Fl m
-flag to debug a new magic file before installing it.
+option to debug a new magic file before installing it.
 .It Fl d
 Prints internal debugging information to stderr.
 .It Fl E
@@ -236,7 +238,7 @@ Like
 but ignore tests that
 .Nm
 does not know about.
-This is intended for compatilibity with older versions of
+This is intended for compatibility with older versions of
 .Nm .
 .It Fl Fl extension
 Print a slash-separated list of valid extensions for the file type found.
@@ -270,13 +272,15 @@ the list of files, like:
 instead of:
 .Dq Fl f Ar namefile Fl F Ar @ .
 .It Fl h , Fl Fl no-dereference
-option causes symlinks not to be followed
+This option causes symlinks not to be followed
 (on systems that support symbolic links).
 This is the default if the environment variable
 .Dv POSIXLY_CORRECT
 is not defined.
 .It Fl i , Fl Fl mime
-Causes the file command to output mime type strings rather than the more
+Causes the
+.Nm
+command to output mime type strings rather than the more
 traditional human readable ones.
 Thus it may say
 .Sq text/plain; charset=us-ascii
@@ -306,7 +310,7 @@ which is used for the matching (see also the
 .Fl k
 option).
 .It Fl L , Fl Fl dereference
-option causes symlinks to be followed, as the like-named option in
+This option causes symlinks to be followed, as the like-named option in
 .Xr ls 1
 (on systems that support symbolic links).
 This is the default if the environment variable
@@ -339,6 +343,7 @@ Set various parameter limits.
 .It Li elf_notes Ta 256 Ta max ELF notes processed
 .It Li elf_phnum Ta 2048 Ta max ELF program sections processed
 .It Li elf_shnum Ta 32768 Ta max ELF sections processed
+.It Li encoding Ta 65536 Ta max number of bytes to scan for encoding evaluation
 .It Li indir Ta 50 Ta recursion limit for indirect magic
 .It Li name Ta 50 Ta use count limit for name/use magic
 .It Li regex Ta 8192 Ta length limit for regex searches
@@ -373,11 +378,13 @@ On systems where libseccomp
 .Pa ( https://github.com/seccomp/libseccomp )
 is available, the
 .Fl S
-flag disables sandboxing which is enabled by default.
-This option is needed for file to execute external decompressing programs,
+option disables sandboxing which is enabled by default.
+This option is needed for
+.Nm
+to execute external decompressing programs,
 i.e. when the
 .Fl z
-flag is specified and the built-in decompressors are not available.
+option 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.
@@ -456,9 +463,9 @@ The file type cannot be determined
 .Sh EXAMPLES
 .Bd -literal -offset indent
 $ file file.c file /dev/{wd0a,hda}
-file.c:   C program text
-file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
-          dynamically linked (uses shared libs), stripped
+file.c:	  C program text
+file:	  ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
+	  dynamically linked (uses shared libs), stripped
 /dev/wd0a: block special (0/0)
 /dev/hda: block special (3/0)
 
@@ -480,8 +487,8 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda10: empty
 
 $ file -i file.c file /dev/{wd0a,hda}
-file.c:      text/x-c
-file:        application/x-executable
+file.c:	     text/x-c
+file:	     application/x-executable
 /dev/hda:    application/x-not-regular-file
 /dev/wd0a:   application/x-not-regular-file
 
@@ -506,7 +513,7 @@ is that this version treats any white space
 as a delimiter, so that spaces in pattern strings must be escaped.
 For example,
 .Bd -literal -offset indent
-\*[Gt]10	string	language impress\ 	(imPRESS data)
+\*[Gt]10	string	language impress\	(imPRESS data)
 .Ed
 .Pp
 in an existing magic file would have to be changed to
@@ -553,7 +560,7 @@ option.
 To enable execution of external decompressors, one needs to disable
 sandboxing using the
 .Fl S
-flag.
+option.
 .Sh MAGIC DIRECTORY
 The magic file entries have been collected from various sources,
 mainly USENET, and contributed by various authors.
@@ -665,7 +672,7 @@ and printing \e012- between entries is clumsy and complicated; refactor
 and centralize.
 .Pp
 Some of the encoding logic is hard-coded in encoding.c and can be moved
-to the magic files if we had a !:charset annotation
+to the magic files if we had a !:charset annotation.
 .Pp
 Continue to squash all magic bugs.
 See Debian BTS for a good source.
@@ -718,9 +725,13 @@ If the offsets specified internally in the file exceed the buffer size
 .Dv HOWMANY
 variable in file.h), then we don't seek to that offset, but we give up.
 It would be better if buffer managements was done when the file descriptor
-is available so move around the file.
-One must be careful though because this has performance (and thus security
-considerations).
+is available so we can seek around the file.
+One must be careful though because this has performance and thus security
+considerations, because one can slow down things by repeateadly seeking.
+.Pp
+There is support now for keeping separate buffers and having offsets from
+the end of the file, but the internal buffer management still needs an
+overhaul.
 .Sh AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP
 on

+ 6 - 3
doc/magic.man

@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.98 2020/05/09 18:55:23 christos Exp $
-.Dd May 9, 2020
+.\" $File: magic.man,v 1.99 2021/05/09 22:37:23 christos Exp $
+.Dd May 9, 2021
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -69,7 +69,7 @@ A 64-bit double precision IEEE floating point number in this machine's native by
 .It Dv string
 A string of bytes.
 The string type specification can be optionally followed
-by /[WwcCtbT]*.
+by /[WwcCtbTf]*.
 The
 .Dq W
 flag compacts whitespace in the target, which must
@@ -83,6 +83,9 @@ The
 .Dq w
 flag treats every blank in the magic as an optional blank.
 The
+.Dq f
+flags requires that the matched string is a full word, not a partial word match.
+The
 .Dq c
 flag specifies case insensitive matching: lower case
 characters in the magic match both lower and upper case characters in the

+ 77 - 0
m4/visibility.m4

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

+ 5 - 5
magic/Magdir/acorn

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: acorn,v 1.7 2019/04/19 00:42:27 christos Exp $
+# $File: acorn,v 1.8 2021/04/26 15:56:00 christos Exp $
 # acorn:  file(1) magic for files found on Acorn systems
 #
 
@@ -90,13 +90,13 @@
 # null terminated root directory object like IDEFS::IDE-4.$.Apps.GRAPHICS.!XFMPdemo
 >>>9	string	x	\b, root "%s"
 # load address 0xFFFtttdd, ttt is the object filetype and dddddddddd is time
->>>>&1	ulelong	x	\b, load address 0x%x
+>>>>&1	ulelong	x	\b, load address %#x
 # execution address 0xdddddddd dddddddddd is 40 bit unsigned centiseconds since 1.1.1900 UTC
->>>>&5	ulelong	x	\b, exec address 0x%x
+>>>>&5	ulelong	x	\b, exec address %#x
 # attributes (bits: 0~owner read,1~owner write,3~no delete,4~public read,5~public write)
->>>>&9	ulelong	x	\b, attributes 0x%x 
+>>>>&9	ulelong	x	\b, attributes %#x 
 # number of entries in this directory. for root dir 0
-#>>>&13	ulelong	x	\b, entries 0x%x 
+#>>>&13	ulelong	x	\b, entries %#x 
 # the entries start here with object name
 >>>>&17	string	x	\b, 1st object "%s"
 

+ 29 - 0
magic/Magdir/aes

@@ -0,0 +1,29 @@
+
+#------------------------------------------------------------------------------
+# $File: aes,v 1.1 2020/08/18 21:20:22 christos Exp $
+#
+# aes: magic file for AES encrypted files
+
+# Summary:	AES Crypt Encrypted Data File
+# From:		Joerg Jenderek
+# URL:		https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
+# Reference:	https://www.aescrypt.com/aes_file_format.html
+0	string		AES	
+>3	ubyte		<3		AES encrypted data, version %u
+#!:mime	application/aes
+!:mime	application/x-aes-encrypted
+!:ext	aes
+# For Version 2 the encrypted file can have text tags
+>>3	ubyte		=2
+# length of an extension identifier and contents like: 0 24 33 38
+#>>5	ubeshort	x		\b, tag length %u
+#>>5	pstring/H	x		'%s'
+# standard extension tags like CREATED_BY
+>>>7	string		CREATED_BY	\b, created by
+# software product, manufacturer like "SharpAESCrypt v1.3.3.0" "aescrypt (Windows GUI) 3.10" ...
+>>>>&1	string		x		"%s"
+# TODO: more other tags
+# tag CREATED_DATE like YYYY-MM-DD
+# tag CREATED_TIME like HH:MM:SS
+#
+

+ 32 - 10
magic/Magdir/algol68

@@ -1,19 +1,41 @@
 
 #------------------------------------------------------------------------------
-# $File: algol68,v 1.3 2018/10/19 01:04:21 christos Exp $
+# $File: algol68,v 1.4 2021/08/15 06:00:55 christos Exp $
 # algol68:  file(1) magic for Algol 68 source
 #
-0	search/8192	(input,			Algol 68 source text
-!:mime	text/x-Algol68
-0	regex/1024	\^PROC			Algol 68 source text
-!:mime	text/x-Algol68
-0	regex/1024	\bMODE[\t\ ]		Algol 68 source text
-!:mime	text/x-Algol68
-0	regex/1024	\bREF[\t\ ]		Algol 68 source text
-!:mime	text/x-Algol68
-0	regex/1024	\bFLEX[\t\ ]\*\\[	Algol 68 source text
+# URL: 		https://en.wikipedia.org/wiki/ALGOL_68
+# Reference:	http://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB.pdf
+# Update:	Joerg Jenderek
+0	search/8192	(input,
+>0	use		algol_68
+# graph_2d.a68
+0	regex/4006	\^PROC
+#>&-4	string		x			\b, dBase or Algol "%s"
+# most xBase scripts *.prg with PROCEDURE like: Areacode BarCount Def_mens Vendors
+#>&-4	string		=PROCEDURE		\b, dBase PROCEDURE
+# skip xBase program scripts *.prg with PROCEDURE keyword
+# keyword proc probably followed by white space used to specify algol procedures
+>&-4	string		!PROCEDURE
+>>0	use		algol_68
+0	regex/1024	\bMODE[\t\ ]
+>0	use		algol_68
+0	regex/1024	\bMODE[\t\ ]
+>0	use		algol_68
+0	regex/1024	\bREF[\t\ ]
+>0	use		algol_68
+0	regex/1024	\bFLEX[\t\ ]\*\\[
+>0	use		algol_68
+
+# display information like mime type and file name extension of Algol 68 source text
+0	name		algol_68		Algol 68 source text
 !:mime	text/x-Algol68
+# https://file-extension.net/seeker/file_extension_a68
+!:ext   a68
+#!:ext   a68/alg
+
 #0	regex          	[\t\ ]OD		Algol 68 source text
+#>0	use		algol_68
 #!:mime	text/x-Algol68
 #0	regex          	[\t\ ]FI		Algol 68 source text
+#>0	use		algol_68
 #!:mime	text/x-Algol68

+ 139 - 8
magic/Magdir/amigaos

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: amigaos,v 1.17 2018/10/16 18:57:19 christos Exp $
+# $File: amigaos,v 1.20 2021/09/20 00:42:19 christos Exp $
 # amigaos:  file(1) magic for AmigaOS binary formats:
 
 #
@@ -40,7 +40,62 @@
 #26	string		V.2		Brian Postma's Soundmon Module sound file v2
 
 # The following are from: "Stefan A. Haubenthal" <polluks@web.de>
-0	beshort		0x0f00		AmigaOS bitmap font
+# Update:	Joerg Jenderek
+# URL:		http://fileformats.archiveteam.org/wiki/Amiga_bitmap_font
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/f/font-amiga.trid.xml
+#		https://wiki.amigaos.net/wiki/Graphics_Library_and_Text
+# fch_FileID=FCH_ID=0x0f00
+0	beshort		0x0f00
+# skip some AVM powerline firmware images by check for positive number of font elements
+# https://download.avm.de/fritzpowerline/fritzpowerline-1000e-t/other/fritz.os/fritz.powerline_1000ET_01_05.image
+>2	ubeshort	>0		AmigaOS bitmap font
+#!:mime	application/octet-stream
+!:mime	font/x-amiga-font
+!:ext	font
+# struct FontContents fch_FC; 1st fc_FileName [MAXFONTPATH=256]; ~ filename "/" fc_YSize
+# like: topazb/6 suits/8  Excel/9e emerald/17 Franklin/23 DIAMONDS/60.8C
+>>4	string		x		"%.256s"
+# fc_YSize ~number after slash in fc_FileName; like: 6 7 8 9 11 12 16 17 21 23 45 60
+>>260	beshort		x		\b, fc_YSize %u
+# fch_NumEntries; number of FontContents elements like:
+# 1 (often) 2 3 (IconCondensed.font tempfont.font) 4 (Franklin.font) 6 (mcoop.font)
+>>2	ubeshort	>1		\b, %u elements
+#>>2	beshort		x		\b, %u element
+# plural s
+#>>2	beshort		!1		\bs
+# like: 6 7 8 9 11 12 16 17 21 23 45 60
+#>>262	beshort		x		\b, FLAGS_STYLE
+>>2	beshort		>1		\b, 2nd
+# 2nd fc_FileName like: Franklin/36
+>>>264	string		x		"%.256s"
+>>2	beshort		>2		\b, 3rd
+# 3rd fc_FileName like: Franklin/18
+>>>524	string		x		"%.256s"
+# URL:		http://fileformats.archiveteam.org/wiki/Amiga_bitmap_font
+# Reference:	https://wiki.amigaos.net/wiki/Graphics_Library_and_Text
+#		http://mark0.net/download/triddefs_xml.7z/defs/f/font-amiga-var2.trid.xml
+# Note:		called by TrID "Amiga bitmap Font (var.2)"
+# fch_FileID=TFCH_ID=0x0f02
+0	beshort		0x0f02
+# skip possible misidentified foo by check for positive number of font elements
+>2	ubeshort	>0		AmigaOS bitmap font (TFCH)
+#!:mime	application/octet-stream
+!:mime	font/x-amiga-font
+!:ext	font
+# struct TFontContents fch_TFC[]; 1st tfc_FileName [254]; ~ filename "/" fc_YSize
+# like: Abbey/45 XScript/75 XTriumvirate/45
+>>4	string		x		"%.254s"
+# tfc_TagCount; including the TAG_END tag like: 4
+>>258	ubeshort	x		\b, tfc_TagCount %u
+# tfc_YSize ~number after slash in tfc_FileName; like: 45 75
+>>260	beshort		x		\b, tfc_YSize %u
+# tfc_Style; tfc_Flags like: 8022h 8222h
+#>>262	ubeshort	x		\b, FLAGS_STYLE %#x
+# fch_NumEntries; number of FontContents elements like: 1 (abbey.font) 2 (xscript.font xtriumvirate.font)
+>>2	ubeshort	>1		\b, %u elements
+>>2	beshort		>1		\b, 2nd
+# 2nd tfc_FileName like: XScript/45 XTriumvirate/30
+>>>264	string		x		"%.254s"
 0	beshort		0x0f03		AmigaOS outline font
 0	belong		0x80001001	AmigaOS outline tag
 0	string		##\ version	catalog translation
@@ -49,15 +104,91 @@
 0	string/c	@database	AmigaGuide file
 
 # Amiga disk types
+#	display information like volume name of root block on Amiga (floppy) disk
+0	name   	adf-rootblock
+# block primary type = T_HEADER (value 2)
+>0x000	ubelong		!2		\b, type %u
+# header_key; unused in rootblock (value 0)
+>0x004	ubelong		!0		\b, header_key %u
+# high_seq; unused (value 0)
+>0x008	ubelong		!0		\b, high_seq %u
+# ht_size; hash table size; 0x48 for flopies
+>0x00c	ubelong		!0x48		\b, hash table size %#x
+# bm_flag; bitmap flag, -1 means VALID
+>0x138	belong		!-1		\b, bitmap flag %#x
+# bm_ext; first bitmap extension block (Hard disks only)
+>0x1A0	ubelong		!0		\b, bitmap extension block %#x
+# name_len; volume name length; diskname[30]; volume name
+>0x1B0	pstring		>\0		\b, "%s"
+# first directory cache block for FFS; otherwise 0
+>0x1F8	ubelong		!0		\b, directory cache block %#x
+# block secondary type = ST_ROOT (value 1)
+>0x1FC	ubelong		!1		\b, sec_type %#x
 #
 0	string		RDSK		Rigid Disk Block
 >160	string		x		on %.24s
-0	string		DOS\0		Amiga DOS disk
-0	string		DOS\1		Amiga FFS disk
-0	string		DOS\2		Amiga Inter DOS disk
-0	string		DOS\3		Amiga Inter FFS disk
-0	string		DOS\4		Amiga Fastdir DOS disk
-0	string		DOS\5		Amiga Fastdir FFS disk
+# URL:		http://fileformats.archiveteam.org/wiki/ADF_(Amiga)
+#		https://en.wikipedia.org/wiki/Amiga_Fast_File_System
+# Reference:	http://lclevy.free.fr/adflib/adf_info.html
+# Update:	Joerg Jenderek
+# Note:		created by ADFOpus.exe
+# 		and verified by `unadf -l TURBO_SILVER_SV.ADF`
+0	string		DOS
+# skip DOS Client Message Files like IPXODI.MSG DOSRQSTR.MSG
+>3	ubyte		<8		Amiga
+# https://reposcope.com/mimetype/application/x-amiga-disk-format
+!:mime	application/x-amiga-disk-format
+!:ext	adf
+>>3	ubyte		0		DOS disk
+>>3	ubyte		1		FFS disk
+>>3	ubyte		2		Inter DOS disk
+>>3	ubyte		3		Inter FFS disk
+# For Fastdir mode the international mode is also enabled,
+>>3	ubyte		4		Fastdir DOS disk
+>>3	ubyte		5		Fastdir FFS dis
+# called by TrID "Amiga Disk image File (OFS+INTL+DIRC)"
+>>3	ubyte		6		Inter Fastdir DOS disk
+# called by TrID "Amiga Disk image File (FFS+INTL+DIRC)"
+>>3	ubyte		7		Inter Fastdir FFS disk
+# but according to Wikipedia variants with long name support
+#>>3	ubyte		6		long name DOS disk
+#>>3	ubyte		7		long name FFS disk
+# DOES NOT only work! Partly for file size  ~< FILE_BYTES_MAX=1 MiB defined in ../../src/file.h
+#>>-0		offset	x		\b, %lld bytes
+# Correct file size, but next lines are NOT executed
+#>>-0		offset	901120		(DD 880 KiB floppy)
+# 880 KiB Double Density floppy disk by characteristic hash table size 0x48 and T_HEADER=2
+>>0x6E00C	ubelong	0x48
+>>>0x6E000	ubelong	2		(DD 880 KiB)
+# 1760 KiB High Density floppy disk (1802240 bytes) by characteristic hash table size 0x48
+>>0xDC00C	ubelong	0x48
+>>>0xDC000	ubelong	2		(HD 1760 KiB)
+# Chksum; special block checksum like: 0 0x44ccf4c0 0x51f32cac 0xe33d0e7d ...
+#>>4	ubelong		x		\b, CRC %#x
+# Rootblock: 0 880 (often for DD and HD) 1146049280 (IMAGINE_1_0_DISK_01.ADF TURBO_SILVER_SV.ADF)
+>>8	ubelong		>0		\b, probably root block %d
+# bootblock code
+>>12	quad		!0		\b, bootable
+# assembler instructions: lea exp(pc),a1; moveq 25h,d0; jsr -552(a6)
+>>>12	ubequad	=0x43fa003e70254eae	AmigaDOS 3.0
+>>>12	default	x
+>>>>12	ubequad	!0x43fa003e70254eae	%#llx..
+# 880 KiB Double Density floppy disk (901120 bytes)
+>>0x6E00C	ubelong	0x48
+>>>0x6E000	ubelong	2
+>>>>0x6E000	use			adf-rootblock
+# 1760 KiB High Density floppy disk (1802240 bytes)
+>>0xDC00C	ubelong	0x48
+>>>0xDC000	ubelong	2
+>>>>0xDC000	use			adf-rootblock
+# 1 MiB hard disc by test for T_HEADER=2 and header_key=0=high_seq 
+>>0x80000	ubelong	2
+>>>0x80004	quad	0
+>>>>0x80000	use			adf-rootblock
+# 2 MiB hard disc; only works if in ../../src/file.h FILE_BYTES_MAX is raised to 2 MiB 
+#>>0x100000	ubelong	x		2 MiB TEST
+#>>0x100000	ubelong	2		\b, 2 MiB hard disc rootblock
+#>>>0x100000	use			adf-rootblock
 0	string		KICK		Kickstart disk
 
 # From: Alex Beregszaszi <alex@fsn.hu>

+ 26 - 7
magic/Magdir/android

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------
-# $File: android,v 1.16 2019/11/15 21:03:14 christos Exp $
+# $File: android,v 1.19 2021/04/26 15:56:00 christos Exp $
 # Various android related magic entries
 #------------------------------------------------------------
 
@@ -24,11 +24,11 @@
 >>1028	lelong	0			\b (boot)
 >>1028	lelong	1			\b (recovery)
 >8		lelong	>0			\b, kernel
->>12	lelong	>0			\b (0x%x)
+>>12	lelong	>0			\b (%#x)
 >16		lelong	>0			\b, ramdisk
->>20	lelong	>0			\b (0x%x)
+>>20	lelong	>0			\b (%#x)
 >24		lelong	>0			\b, second stage
->>28	lelong	>0			\b (0x%x)
+>>28	lelong	>0			\b (%#x)
 >36		lelong	>0			\b, page size: %d
 >38		string	>0			\b, name: %s
 >64		string	>0		 	\b, cmdline (%s)
@@ -64,7 +64,7 @@
 # look for backup content after line with encryption info
 #>>19	search/7	\n
 # data part after header for not encrypted Android Backup 
-#>>>&0	ubequad		x	\b, content 0x%16.16llx...
+#>>>&0	ubequad		x	\b, content %#16.16llx...
 # look for zlib compressed by ./compress after message with 1 space at end
 #>>>&0	indirect	x	\b; contains 
 # look for tar archive block by ./archive for package name manifest
@@ -155,9 +155,9 @@
 # flags
 >>>0x0C		ulelong&0x00000002		2			\b+RW
 # partition ID:
-# 0~IPL,MOVINAND,GANG;1~PIT,GPT;2~HIDDEN;3~SBL,HIDDEN;4~SBL2,HIDDEN;5~BOOT;6~KENREl,RECOVER,misc;7~RECOVER
+# 0~IPL,MOVINAND,GANG;1~PIT,GPT;2~HIDDEN;3~SBL,HIDDEN;4~SBL2,HIDDEN;5~BOOT;6~kernel,RECOVER,misc;7~RECOVER
 # ;11~MODEM;20~efs;21~PARAM;22~FACTORY,SYSTEM;23~DBDATAFS,USERDATA;24~CACHE;80~BOOTLOADER;81~TZSW
->>>0x08	ulelong		x			(0x%x)
+>>>0x08	ulelong		x			(%#x)
 # filename
 >>>0x44		string				>\0			"%-.64s"
 #>>>0x18	ulelong				>0
@@ -188,3 +188,22 @@
 0	lelong	0xd0b5b1c4	Android cryptfs footer
 >4	leshort	x	\b, version: %d
 >6	leshort	x	\b.%d
+
+# Android Vdex format
+# From https://android.googlesource.com/\
+# platform/art/+/master/runtime/vdex_file.h
+0	string	vdex	Android vdex file,
+>4	string	>000	verifier deps version: %s,
+>8	string	>000	dex section version: %s,
+>12	lelong	>0	number of dex files: %d,
+>16	lelong	>0	verifier deps size: %d
+
+# Android Vdex format, dexfile is currently being updated
+# by android system
+# From https://android.googlesource.com/\
+# platform/art/+/master/dex2oat/dex2oat.cc
+0	string	wdex	Android vdex file, being processed by dex2oat,
+>4	string	>000	verifier deps version: %s,
+>8	string	>000	dex section version: %s,
+>12	lelong	>0	number of dex files: %d,
+>16	lelong	>0	verifier deps size: %d

+ 139 - 24
magic/Magdir/animation

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.77 2020/04/26 15:23:43 christos Exp $
+# $File: animation,v 1.87 2021/08/24 09:25:11 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -32,7 +32,10 @@
 !:mime	application/x-quicktime-player
 4	string/W	jP		JPEG 2000 image
 !:mime	image/jp2
+
+#### MP4 ####
 # https://www.ftyps.com/ with local additions
+# https://cconcolato.github.io/mp4ra/filetype.html
 4	string		ftyp		ISO Media
 # https://aeroquartet.com/wordpress/2016/03/05/3-xavc-s/
 >8	string		XAVC		\b, MPEG v4 system, Sony XAVC Codec
@@ -53,11 +56,21 @@
 >>11	byte		0x63		\b C.S0050-0-B V1.0
 >8	string		3ge		\b, MPEG v4 system, 3GPP
 !:mime	video/3gpp
->>11	byte		6		\b, Release 6 MBMS Extended Presentations
->>11	byte		7		\b, Release 7 MBMS Extended Presentations
+>>11	byte		6		\b, Release %d MBMS Extended Presentations
+>>11	byte		7		\b, Release %d MBMS Extended Presentations
+>>11	byte		9		\b, Release %d MBMS Extended Presentations
+>8	string		3gf		\b, MPEG v4 system, 3GPP
+>>11	byte		9		\b, Release %d File-delivery profile
 >8	string		3gg		\b, MPEG v4 system, 3GPP
 !:mime	video/3gpp
->>11	byte		6		\b, Release 6 General Profile
+>>11	byte		6		\b, Release %d General Profile
+>>11	byte		9		\b, Release %d General Profile
+>8	string		3gh		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>>11	byte		9		\b, Release %d Adaptive Streaming Profile
+>8	string		3gm		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>>11	byte		9		\b, Release %d Media Segment Profile
 >8	string		3gp		\b, MPEG v4 system, 3GPP
 !:mime	video/3gpp
 >>11	byte		1		\b, Release %d (non existent)
@@ -67,16 +80,49 @@
 >>11	byte		5		\b, Release %d
 >>11	byte		6		\b, Release %d
 >>11	byte		7		\b, Release %d Streaming Servers
+>8	string		3gr		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>>11	byte		6		\b, Release %d Progressive Download Profile
+>>11	byte		9		\b, Release %d Progressive Download Profile
 >8	string		3gs		\b, MPEG v4 system, 3GPP
 !:mime	video/3gpp
+>>11	byte		6		\b, Release %d Streaming Servers
 >>11	byte		7		\b, Release %d Streaming Servers
+>>11	byte		9		\b, Release %d Streaming Servers
+>8	string		3gt		\b, MPEG v4 system, 3GPP
+!:mime	video/3gpp
+>>11	byte		8		\b, Release %d Media Stream Recording Profile
+>>11	byte		9		\b, Release %d Media Stream Recording Profile
+>8	string		ARRI		\b, MPEG v4 system, ARRI Digital Camera
+!:mime	video/mp4
 >8	string		avc1		\b, MPEG v4 system, 3GPP JVT AVC [ISO 14496-12:2005]
 !:mime	video/mp4
+>8	string		bbxm		\b, Blinkbox Master File: H.264 video/16-bit LE LPCM audio
+!:mime	video/mp4
 >8	string/W	qt		\b, Apple QuickTime movie
 !:mime	video/quicktime
 >8	string		CAEP		\b, Canon Digital Camera
 >8	string		caqv		\b, Casio Digital Camera
 >8	string		CDes		\b, Convergent Design
+>8	string		caaa		\b, CMAF Media Profile - AAC Adaptive Audio
+>8	string		caac		\b, CMAF Media Profile - AAC Core
+>8	string		caqv		\b, Casio Digital Camera	Casio
+>8	string		ccea		\b, CMAF Supplemental Data - CEA-608/708
+>8	string		ccff		\b, Common container file format
+>8	string		cfhd		\b, CMAF Media Profile - AVC HD
+>8	string		cfsd		\b, CMAF Media Profile - AVC SD
+>8	string		chd1		\b, CMAF Media Profile - HEVC HDR10
+>8	string		chdf		\b, CMAF Media Profile - AVC HDHF
+>8	string		chhd		\b, CMAF Media Profile - HEVC HHD8
+>8	string		chh1		\b, CMAF Media Profile - HEVC HHD10
+>8	string		clg1		\b, CMAF Media Profile - HEVC HLG10
+>8	string		cmfc		\b, CMAF Track Format
+>8	string		cmff		\b, CMAF Fragment Format
+>8	string		cmfl		\b, CMAF Chunk Format
+>8	string		cmfs		\b, CMAF Segment Format
+>8	string		cud1		\b, CMAF Media Profile - HEVC UHD10
+>8	string		cud8		\b, CMAF Media Profile - HEVC UHD8
+>8	string		cwvt		\b, CMAF Media Profile - WebVTT
 >8	string		da0a		\b, DMB MAF w/ MPEG Layer II aud, MOT slides, DLS, JPG/PNG/MNG
 >8	string		da0b		\b, DMB MAF, ext DA0A, with 3GPP timed text, DID, TVA, REL, IPMP
 >8	string		da1a		\b, DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images
@@ -87,6 +133,12 @@
 >8	string		da3b		\b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP
 >8	string		dash		\b, MPEG v4 system, Dynamic Adaptive Streaming over HTTP
 !:mime	video/mp4
+>8	string		dby1		\b, MP4 files with Dolby content
+>8	string		dsms		\b, Media Segment DASH conformant
+>8	string		dts1		\b, MP4 track file with audio codecs dtsc dtsh or dtse
+>8	string		dts2		\b, MP4 track file with audio codec dtsx
+>8	string		dts3		\b, MP4 track file with audio codec dtsy
+>8	string		dxo$20		\b, DxO ONE camera
 >8	string		dmb1		\b, DMB MAF supporting all the components defined in the spec
 >8	string		dmpf		\b, Digital Media Project
 >8	string		drc1		\b, Dirac (wavelet compression), encap in ISO base media (MP4)
@@ -99,6 +151,7 @@
 >8	string		dvr1		\b, DVB (.DVB) over RTP
 !:mime	video/vnd.dvb.file
 >8	string		dvt1		\b, DVB (.DVB) over MPEG-2 Transport Stream
+>8	string		emsg		\b, Event message box present
 !:mime	video/vnd.dvb.file
 >8	string		F4V		\b, Video for Adobe Flash Player 9+ (.F4V)
 !:mime	video/mp4
@@ -108,12 +161,22 @@
 !:mime	audio/mp4
 >8	string		F4B		\b, Audio Book for Adobe Flash Player 9+ (.F4B)
 !:mime	audio/mp4
+>8	string		ifrm		\b, Apple iFrame Specification, Version 8.1 Jan 2013
+>8	string		im1i		\b, CMAF Media Profile - IMSC1 Image
+>8	string		im1t		\b, CMAF Media Profile - IMSC1 Text
 >8	string		isc2		\b, ISMACryp 2.0 Encrypted File
 #	?/enc-isoff-generic
->8	string		iso2		\b, MP4 Base Media v2 [ISO 14496-12:2005]
+>8	string		iso		\b, MP4 Base Media
 !:mime	video/mp4
->8	string		isom		\b, MP4 Base Media v1 [IS0 14496-12:2003]
+>>11	string		m 		v1 [ISO 14496-12:2003]
+>>11	string		2		v2 [ISO 14496-12:2005]
+>>11	string		4		v4
+>>11	string		5		v5 
+>>11	string		6		v6 
+>8	string		isml		\b, MP4 Base Media v2 [ISO 14496-12:2005]
 !:mime	video/mp4
+>8	string		J2P0		\b, JPEG2000 Profile 0
+>8	string		J2P1		\b, JPEG2000 Profile 1
 >8	string/W	jp2		\b, JPEG 2000
 !:mime	image/jp2
 >8	string		JP2		\b, JPEG 2000 Image (.JP2) [ISO 15444-1 ?]
@@ -121,10 +184,13 @@
 >8	string		JP20		\b, Unknown, from GPAC samples (prob non-existent)
 >8	string		jpm		\b, JPEG 2000 Compound Image (.JPM) [ISO 15444-6]
 !:mime	image/jpm
+>8	string		jpsi		\b, The JPSearch data interchange format
 >8	string		jpx		\b, JPEG 2000 w/ extensions (.JPX) [ISO 15444-2]
 !:mime	image/jpx
 >8	string		KDDI		\b, 3GPP2 EZmovie for KDDI 3G cellphones
 !:mime	video/3gpp2
+>8	string		LCAG		\b,  Leica digital camera
+>8	string		lmsg		\b, Last Media Segment indicator for ISO base media file format.
 >8	string		M4A 		\b, Apple iTunes ALAC/AAC-LC (.M4A) Audio
 !:mime	audio/x-m4a
 >8	string		M4B 		\b, Apple iTunes ALAC/AAC-LC (.M4B) Audio Book
@@ -140,6 +206,8 @@
 >8	string		mj2s		\b, Motion JPEG 2000 [ISO 15444-3] Simple Profile
 !:mime	video/mj2
 >8	string		mjp2		\b, Motion JPEG 2000 [ISO 15444-3] General Profile
+>8	string		MFSM		\b, Media File for Samsung video Metadata
+>8	string		MGSV		\b, Sony Home and Mobile Multimedia Platform (HMMP)
 !:mime	video/mj2
 >8	string		mmp4		\b, MPEG-4/3GPP Mobile Profile (.MP4 / .3GP) (for NTT)
 !:mime	video/mp4
@@ -153,13 +221,16 @@
 >8	string		mp71		\b, MP4 w/ MPEG-7 Metadata [per ISO 14496-12]
 >8	string		mp7t		\b, MPEG v4 system, MPEG v7 XML
 >8	string		mp7b		\b, MPEG v4 system, MPEG v7 binary XML
+>8	string		mpuf		\b, Compliance with the MMT Processing Unit format
+>8	string		msdh		\b, Media Segment conforming to ISO base media file format.
+>8	string		msix		\b, Media Segment conforming to ISO base media file format.
 >8	string		mmp4		\b, MPEG v4 system, 3GPP Mobile
 !:mime	video/mp4
 >8	string		MPPI		\b, Photo Player, MAF [ISO/IEC 23000-3]
 >8	string		mqt		\b, Sony / Mobile QuickTime (.MQV) US Pat 7,477,830
 !:mime	video/quicktime
 >8	string		MSNV		\b, MPEG-4 (.MP4) for SonyPSP
-!:mime	video/mp4
+!:mime	audio/mp4
 >8	string		NDAS		\b, MP4 v2 [ISO 14496-14] Nero Digital AAC Audio
 !:mime	audio/mp4
 >8	string		NDSC		\b, MPEG-4 (.MP4) Nero Cinema Profile
@@ -181,11 +252,14 @@
 >8	string		NDXP		\b, H.264/MPEG-4 AVC (.MP4) Nero Portable Profile
 !:mime	video/mp4
 >8	string		NDXS		\b, H.264/MPEG-4 AVC (.MP4) Nero Standard Profile
+>8	string		niko		\b, Nikon Digital Camera
 !:mime	video/mp4
 >8	string		odcf  		\b, OMA DCF DRM Format 2.0 (OMA-TS-DRM-DCF-V2_0-20060303-A)
 >8	string		opf2 		\b, OMA PDCF DRM Format 2.1 (OMA-TS-DRM-DCF-V2_1-20070724-C)
 >8	string		opx2  		\b, OMA PDCF DRM + XBS ext (OMA-TS-DRM_XBS-V1_0-20070529-C)
 >8	string		pana		\b, Panasonic Digital Camera
+>8	string		piff		\b, Protected Interoperable File Format
+>8	string		pnvi		]b, Panasonic Video Intercom
 >8	string		qt  		\b, Apple QuickTime (.MOV/QT)
 !:mime	video/quicktime
 # HEIF image format
@@ -217,11 +291,24 @@
 !:mime image/heif-sequence
 >8	string		avcs		\b, HEIF Image Sequence AVC
 !:mime image/heif-sequence
-
+# AVIF image format
+# see https://aomediacodec.github.io/av1-avif/
+>8	string		avif		\b, AVIF Image
+!:mime image/avif
+>8	string		avis		\b, AVIF Image Sequence
+!:mime image/avif
+>8	string		risx		\b, Representation Index Segment for MPEG-2 TS Segments
 >8	string		ROSS		\b, Ross Video
 >8	string		sdv		\b, SD Memory Card Video
 >8	string		ssc1		\b, Samsung stereo, single stream (patent pending)
 >8	string		ssc2		\b, Samsung stereo, dual stream (patent pending)
+>8	string		SEAU		\b, Sony Home and Mobile Multimedia Platform (HMMP)
+>8	string		SEBK		\b, Sony Home and Mobile Multimedia Platform (HMMP)
+>8	string		senv		\b, Video contents Sony Entertainment Network
+>8	string		sims		\b, Media Segment for Sub-Indexed Media Segment format
+>8	string		sisx		\b, Single Index Segment forindex MPEG-2 TS
+>8	string		ssss		\b, Subsegment Index Segment used to index MPEG-2 Segments
+>8	string		uvvu		\b, UltraViolet file brand for DECE Common Format
 
 # MPEG sequences
 # Scans for all common MPEG header start codes
@@ -234,6 +321,9 @@
 0        belong&0xFFFFFF00  0x00000100
 >3       byte               0xBA           MPEG sequence
 !:mime  video/mpeg
+# http://fileformats.archiveteam.org/wiki/Enhanced_VOB
+# https://reposcope.com/mimetype/video/mpeg
+!:ext	vob/evo/mpg/mpeg
 >>4      byte               &0x40          \b, v2, program multiplex
 >>4      byte               ^0x40          \b, v1, system multiplex
 >3       byte               0xBB           MPEG sequence, v1/2, multiplex (missing pack header)
@@ -877,21 +967,6 @@
 # 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
-0	string/w	#VRML\ V2.0\ utf8	ISO/IEC 14772 VRML 97 file
-!:mime	model/vrml
-
-# X3D (Extensible 3D) [https://www.web3d.org/specifications/x3d-3.0.dtd]
-# From Michel Briand <michelbriand@free.fr>
-# mimetype from https://www.iana.org/assignments/media-types/model/x3d+xml
-# Example https://www.web3d.org/x3d/content/examples/Basic/course/CreateX3DFromStringRandomSpheres.x3d
-0	string/w	\<?xml\ version=
-!:strength + 5
->20	search/1000/w	\<!DOCTYPE\ X3D		X3D (Extensible 3D) model xml text
-!:mime model/x3d+xml
-
 #---------------------------------------------------------------------------
 # HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
 # From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
@@ -905,12 +980,22 @@
 >0x42	ubeshort	0		no audio
 >0x42	ubeshort	>0		%dHz audio
 
-# From: "Stefan A. Haubenthal" <polluks@web.de>
+# From: Stefan A. Haubenthal <polluks@sdf.lonestar.org>
+# Update: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/VOB
 0	string		DVDVIDEO-VTS	Video title set,
+!:mime	video/x-ifo
+!:ext	ifo/bup
 >0x21	byte		x		v%x
 0	string		DVDVIDEO-VMG	Video manager,
+!:mime	video/x-ifo
+!:ext	ifo/bup
 >0x21	byte		x		v%x
 
+# From: Stefan A. Haubenthal <polluks@sdf.lonestar.org>
+0 string xMovieSetter MovieSetter movie
+0 string xSceneEditor MovieSetter movie
+
 # From: Behan Webster <behanw@websterwood.com>
 # NuppelVideo used by Mythtv (*.nuv)
 # Note: there are two identical stanzas here differing only in the
@@ -1069,3 +1154,33 @@
 # From: David Korth <gerbilsoft@gerbilsoft.com>
 0	string	CRID
 >32	string	@UTF	Scaleform video
+
+# http://www.jerrysguide.com/tips/demystify-tvs-file-format.html
+0	string	TVS\015\012
+>&0	string	Version\040	TeamViewer Session File
+>>&0	string	x		\b, version %s
+
+# SER file format - simple uncompressed video format for astronomical use
+# Initially developed by Lucam Recorder,
+# as of 2021 maintained by Heiko Wilkens, Grischa Hahn
+# Typical extensions: .SER
+# http://www.grischa-hahn.homepage.t-online.de/astro/ser/SER%20Doc%20V3b.pdf
+0	string	LUCAM-RECORDER	SER video sequence
+!:ext	ser
+>18	lelong	0	\b, bayer: mono
+>18	lelong	8	\b, bayer: RGGB
+>18	lelong	9	\b, bayer: GRBG
+>18	lelong	10	\b, bayer: GBRG
+>18	lelong	11	\b, bayer: BGGR
+>18	lelong	16	\b, bayer: CYYM
+>18	lelong	17	\b, bayer: YCMY
+>18	lelong	18	\b, bayer: YMCY
+>18	lelong	19	\b, bayer: MYYC
+>18	lelong	100	\b, bayer: RGB
+>18	lelong	101	\b, bayer: BGR
+>22	lelong	0	\b, big-endian
+>22	lelong	1	\b, little-endian
+>26	lelong	x	\b, width: %d
+>30	lelong	x	\b, height: %d
+>34	lelong	x	\b, %d bit
+>38	lelong	x	\b, frames: %d

+ 5 - 5
magic/Magdir/apple

@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.44 2019/10/18 15:21:02 christos Exp $
+# $File: apple,v 1.45 2021/04/26 15:56:00 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
@@ -180,7 +180,7 @@
 # minimum version needed to read this files. SFMinVers (0 , 30~3.0 )
 >>>183	ubyte		30	3.0
 >>>183	ubyte		!30
->>>>183	ubyte		!0	0x%x
+>>>>183	ubyte		!0	%#x
 # usual tabstop start sequence "=====<"
 >>>5	string		x	\b, tabstop ruler "%6.6s"
 # tabstop ruler
@@ -299,7 +299,7 @@
 #  object is the first object (true for CoreFoundation implementation).
 # From: David Remahl <dremahl@apple.com>
 0		string	bplist
->6		byte	x	\bCoreFoundation binary property list data, version 0x%c
+>6		byte	x	\bCoreFoundation binary property list data, version %#c
 >>7		byte	x	\b%c
 >6		string		00		\b
 >>8		byte&0xF0	0x00	\b
@@ -358,7 +358,7 @@
 
 0	belong		0xfade0c02	Mac OS X Code Directory
 >8	belong		x			version %x
->12	belong		>0			flags 0x%x
+>12	belong		>0			flags %#x
 >4	belong		x			- %d bytes
 
 0	belong		0xfade0cc0	Mac OS X Detached Code Signature (non-executable)
@@ -438,7 +438,7 @@
 # descSize driver size in blocks
 >>4	ubeshort	x		\b, size %u
 # descType driver system type 1 701h F8FFh FFFFh
->>6	ubeshort	x		\b, type 0x%x
+>>6	ubeshort	x		\b, type %#x
 
 # URL: https://en.wikipedia.org/wiki/Apple_Partition_Map
 # Reference: https://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h

+ 169 - 38
magic/Magdir/archive

@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.138 2020/06/07 23:29:26 christos Exp $
+# $File: archive,v 1.151 2021/08/16 10:19:56 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -168,8 +168,11 @@
 0	short		0143561		byte-swapped cpio archive
 !:mime	application/x-cpio # encoding: swapped
 0	string		070707		ASCII cpio archive (pre-SVR4 or odc)
+!:mime	application/x-cpio
 0	string		070701		ASCII cpio archive (SVR4 with no CRC)
+!:mime	application/x-cpio
 0	string		070702		ASCII cpio archive (SVR4 with CRC)
+!:mime	application/x-cpio
 
 #
 # Various archive formats used by various versions of the "ar"
@@ -240,7 +243,7 @@
 !:ext	deb/udeb/ipk
 # This should not happen
 >14	default		x	Unknown Debian package
-# NL terminated version; for most Debian cases this is 2.0 or 2.1 for splitted
+# NL terminated version; for most Debian cases this is 2.0 or 2.1 for split
 >68	string		>\0		(format %s)
 #>68	string		!2.0\n
 #>>68	string		x		(format %.3s)
@@ -261,7 +264,7 @@
 >>>>>>>&-1	ubyte	!0x2f
 # display 4th character of file name extension like a of lzma
 >>>>>>>>&-1	ubyte	x		\b%c
-# splitted debian package case
+# split debian package case
 >68	string		=2.1\n
 # dpkg-1.18.25/dpkg-split/info.c
 # NL terminated ASCII package name like ckermit
@@ -447,36 +450,116 @@
 # look for first keyword of Panorama database *.pan
 >12	search/261	DESIGN
 # skip keyword with low entropy
->12	default		x	TTComp archive, binary, 4K dictionary
-# (version 5.25) labeled the above entry as "TTComp archive data"
+>12	default		x
+# skip DOS 2.0 backup id file, sequence 6 with many nils like BACKUPID_xx6.@@@ handled by ./msdos
+>>8	quad		!0
+>>>0	use	ttcomp
+# variant ASCII, 4K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
+0	string	\1\6
+# TODO:
+# skip VAX-order 68k Blit mpx/mux executable (strength=50) handled by ./blit
+!:strength	-2
+>0	use	ttcomp
+0	string	\0\5
+# skip some DOS 2.0 backup id file, sequence 5 with many nils like BACKUPID_075.@@@ handled by ./msdos
+>8	quad	!0
+>>0	use	ttcomp
+0	string	\1\5
+# TODO:
+# variant ASCII, 2K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
+# skip ctab data (strength=50) handled by ./ibm6000
+# skip locale data table (strength=50) handled by ./digital
+!:strength	-2
+>0	use	ttcomp
+0	string	\0\4
+# skip many Maple help database *.hdb with version tag handled by ./maple
+>1028	string	!version
+# skip veclib maple.hdb by looking for Mable keyword
+>>4	search/1091	Maple\040
+#>4	search/34090	Maple\040
+>>4	default		x
+# skip DOS 2.0-3.2 backed up sequence 4 with many nils like LOTUS5.RAR handled by ./msdos
+# skip xBASE Compound Index file *.CDX with many nils
+>>>0x54	quad		!0
+>>>>0	use	ttcomp
+0	string	\1\4
+# TODO:
+# skip Commodore PET BASIC 4.0 program *.prg
+# variant ASCII, 1K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
+# skip shared library (strength=50) handled by ./ibm6000
+!:strength	-2
+>0	use	ttcomp
+#	display information of TTComp archive
+0	name	ttcomp
+# (version 5.25) labeled the entry as "TTComp archive data"
+>0	ubyte	x	TTComp archive data
+!:mime	application/x-compress-ttcomp
+# PBACKSCR.PI1
+!:ext	$xe/$ts/pi1/__d
+# compression type: 0~binary compression 1~ASCII compression 
+>0	ubyte	0	\b, binary
+>0	ubyte	1	\b, ASCII
+# size of the dictionary:  4~1024 bytes 5~2048 bytes 6~4096 bytes 
+>1	ubyte	4	\b, 1K
+>1	ubyte	5	\b, 2K
+>1	ubyte	6	\b, 4K
+>1	ubyte	x	dictionary
+#	https://mark0.net/forum/index.php?topic=848
+# last 3 bytes probably have only 8 possible bit sequences
+# xxxxxxxx 0000000x 11111111	____FFh
+# xxxxxxxx 10000000 01111111	__807Fh	
+# 0xxxxxxx 11000000 00111111	__C03Fh
+# 00xxxxxx 11100000 00011111	__E01Fh
+# 000xxxxx 11110000 00001111	__F00Fh
+# 0000xxxx 11111000 00000111	__F807h
+# 00000xxx 11111100 00000011	__FC03h
+# 000000xx 11111110 00000001	__FE01h
+# but for quickgif.__d 0A7DD4h
+#>-3	ubyte		x	\b, last 3 bytes 0x%2.2x
+#>-2	ubeshort	x	\b%4.4x
 # 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
+# test for disk image size equal or above 400k
+>0x40	ubelong		>409599
+# test also for disk image size equal or below 1440k to skip
+# windows7en.mbr UNICODE.DAT
+>>0x40	ubelong		<1474561
+# To skip Flags$StringJoiner.class with size 00106A61h test also for only 4 disk image sizes
+# 00064000 for  400k GCR disks
+# 000c8000 for  800k GCR disks
+# 000b4000 for  720k MFM disks
+# 00168000 for 1440k MFM disks
+>>>0x40	ubelong&0xffE03fFF	0
+>>>>0	use	dc42-floppy
+#	display information of Apple DiskCopy 4.2 floppy image
+0	name		dc42-floppy
+# image pascal name padded with NULs like Microsoft Mail
+>00	pstring/B	x	Apple DiskCopy 4.2 image %s
 #!:mime	application/octet-stream
+!:mime	application/x-dc42-floppy-image
 !: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
+>0x40	ubelong		x	\b, %u bytes
+# for debugging purpose size in hexadecimal
+#>0x40	ubelong		x	(%#8.8x)
 # tag size in bytes
->>0x44	ubelong		>0	\b, 0x%x tag size
+>0x44	ubelong		>0	\b, %#x tag size
 # data checksum
-#>>0x48	ubelong		x	\b, 0x%x checksum
+#>0x48	ubelong		x	\b, %#x checksum
 # tag checksum
-#>>0x4c	ubelong		x	\b, 0x%x tag checksum
+#>0x4c	ubelong		x	\b, %#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
+>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, %#x encoding
 # format byte
->>0x51	ubyte		x	\b, 0x%x format
-#>>0x54	ubequad		x	\b, data 0x%16.16llx
+>0x51	ubyte		x	\b, %#x format
+#>0x54	ubequad		x	\b, data %#16.16llx
 # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
 0	string	ESP ESP archive data
 # ZPack
@@ -509,11 +592,11 @@
 # compression method (0-4)
 >>8	uleshort	x	\b, %u method
 # offset of compressed data
->>10	uleshort	x	\b, 0x%x offset
+>>10	uleshort	x	\b, %#x offset
 #>>(10.s)	uleshort	x
 #>>>&-6		string	x	\b, TEST extension %-.3s
 # header flags to mark header extensions
->>12	uleshort	>0	\b, 0x%x flags
+>>12	uleshort	>0	\b, %#x flags
 # 4 bytes: decompressed length of file
 >>12	uleshort	&0x01
 >>>14	ulelong		x	\b, original size: %u bytes
@@ -603,6 +686,21 @@
 !:ext	??$
 >>8	ulelong	>0		\b, original size: %u bytes
 
+# Summary:	FTCOMP compressed archive
+# From:		Joerg Jenderek
+# URL:		http://fileformats.archiveteam.org/wiki/FTCOMP
+# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ftcomp.trid.xml
+# Note:		called by TrID "FTCOMP compressed archive"
+#		extracted by `unpack seahelp.hl_`
+24	string/b	FTCOMP		FTCOMP compressed archive
+#!:mime	application/octet-stream
+!:mime	application/x-compress-ftcomp
+!:ext	??_/??@/dll/drv/pk2/
+# probably A596FDFF magic at the beginning
+>0	ubelong		!0xA596FDFF	\b, at beginning %#x
+# probably original file name with directory like: \OS2\unpack.exe \SYSTEM\8514.DRV MAHJONGG.EXE
+>41	string		x		"%s"
+
 # MP3 (archiver, not lossy audio compression)
 0	string	MP3\x1a MP3-Archiver archive data
 # ZET
@@ -816,7 +914,7 @@
 !:ext	dz
 >>2	byte	x \b, version %i
 >>3	byte	x \b.%i
->>4	ulelong	x \b, offset 0x%x
+>>4	ulelong	x \b, offset %#x
 >>8	ulelong	x \b, %u files
 # ZZip archiver (.zz)
 0	string	ZZ\ \0\0 ZZip archive data
@@ -923,7 +1021,7 @@
 >>>>>>3	regex		\^lh[456]	LHa (2.x) archive data
 >>>>>>>2	string	-lh5		\b 
 # https://en.wikipedia.org/wiki/BIOS
-# Some mainboard BIOS like Award use LHa compression. So archives with unusal extension are found like
+# Some mainboard BIOS like Award use LHa compression. So archives with unusual extension are found like
 # bios.rom , kd7_v14.bin, 1010.004, ...
 !:ext lha/lzh/rom/bin
 # missing -lh?- variants (Joe Jared)
@@ -950,21 +1048,21 @@
 # compressed data size != compressed file size
 #>7	ulelong		x		\b, data size %d
 # attribute: 0x2~?? 0x10~symlink|target 0x20~normal
-#>19	ubyte		x		\b, 19_0x%x
+#>19	ubyte		x		\b, 19_%#x
 # level identifier 0 1 2 3
 #>20	ubyte		x		\b, level %d
 # time stamp
-#>15		ubelong	x		DATE 0x%8.8x
+#>15		ubelong	x		DATE %#8.8x
 # OS ID for level 1
 >20	ubyte		1
 # 0x20 types find for *.rom files
->>(21.b+24)	ubyte	<0x21		\b, 0x%x OS
+>>(21.b+24)	ubyte	<0x21		\b, %#x OS
 # ascii type like M for MSDOS
 >>(21.b+24)	ubyte	>0x20		\b, '%c' OS
 # OS ID for level 2
 >20	ubyte		2
-#>>23	ubyte		x		\b, OS ID 0x%x
->>23	ubyte		<0x21		\b, 0x%x OS
+#>>23	ubyte		x		\b, OS ID %#x
+>>23	ubyte		<0x21		\b, %#x OS
 >>23	ubyte		>0x20		\b, '%c' OS
 # filename only for level 0 and 1
 >20	ubyte		<2
@@ -1319,8 +1417,9 @@
 >>>>38		search/64       .app/   iOS App
 !:mime application/x-ios-app
 
->30	search/100/b application/epub+zip	EPUB document
-!:mime application/epub+zip
+# Dup, see above.
+#>30	search/100/b application/epub+zip	EPUB document
+#!:mime application/epub+zip
 
 # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 #   Next line excludes specialized formats:
@@ -1331,6 +1430,8 @@
 >>>>4	beshort		x			\b, at least
 >>>>4	use		zipversion
 >>>>4	beshort		x			to extract
+>>>>8	beshort		x			\b, compression method=
+>>>>8	use		zipcompression
 >>>>0x161	string		WINZIP		\b, WinZIP self-extracting
 
 # StarView Metafile
@@ -1472,8 +1573,17 @@
 >>0x2A	string	>\0		: %s
 
 # DR-DOS 7.03 Packed File *.??_
-0	string	Packed\ File\ 	Personal NetWare Packed File
->12	string	x		\b, was "%.12s"
+# Reference: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
+# Note:	unpacked by PNUNPACK.EXE
+0	string	Packed\ File\ 
+# by looking for Control-Z skip ASCII text starting with Packed File 
+>0x18	ubyte	0x1a		Personal NetWare Packed File
+!:mime	application/x-novell-compress
+!:ext	??_
+>>12	string	x		\b, was "%.12s"
+# 1 or 2
+#>>0x19	ubyte	x		\b, at 0x19 %u
+>>0x1b	ulelong	x		with %u bytes
 
 # EET archive
 # From: Tilman Sauerbeck <tilman@code-monkey.de>
@@ -1548,7 +1658,7 @@
 >24	belong	2		MD5 checksum
 >24	belong	3		SHA-256 checksum
 >24	belong	4		SHA-512 checksum
->24	belong	>4		unknown 0x%x checksum
+>24	belong	>4		unknown %#x checksum
 #>24	belong	>4		checksum
 #			For no compression jump 0 bytes
 >24	belong	0
@@ -1556,7 +1666,7 @@
 # jump more bytes forward by header size
 >>>&(4.S)	ubyte	x
 # jump more bytes forward by compressed table of contents size
-#>>>>&(8.Q)	ubequad	x	\b, heap data 0x%llx
+#>>>>&(8.Q)	ubequad	x	\b, heap data %#llx
 >>>>&(8.Q)	ubyte	x
 # look for data by ./compress after message with 1 space at end
 >>>>>&-3	indirect x	\b, contains 
@@ -1628,7 +1738,7 @@
 # *.GHS or *.[0-9] with cns program option
 >2		ubyte&0x08		0x08		\b, split file