Vendor import of file 5.23.
This commit is contained in:
parent
7e650197bf
commit
76c08169d4
50
ChangeLog
50
ChangeLog
@ -1,3 +1,53 @@
|
||||
|
||||
2015-06-10 13:50 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* release 5.23
|
||||
|
||||
2015-06-09 16:10 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* Fix issue with regex range for magic with offset
|
||||
* Always return true from mget with USE (success to mget not match
|
||||
indication). Fixes mime evaluation after USE magic
|
||||
* PR/459: Don't insert magic entries to the list if there are parsing
|
||||
errors for them.
|
||||
|
||||
2015-06-03 16:00 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* PR/455: Add utf-7 encoding
|
||||
|
||||
2015-06-03 14:30 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* PR/455: Implement -Z, look inside, but don't report on compression
|
||||
* PR/454: Fix allocation error on bad magic.
|
||||
|
||||
2015-05-29 10:30 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* handle MAGIC_CONTINUE everywhere, not just in softmagic
|
||||
|
||||
2015-05-21 14:30 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* don't print descriptions for NAME types when mime.
|
||||
|
||||
2015-04-09 15:59 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* Add --extension to list the known extensions for this file type
|
||||
Idea by Andrew J Roazen
|
||||
|
||||
2015-02-14 12:23 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* Bump file search buffer size to 1M.
|
||||
|
||||
2015-01-09 14:35 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* Fix multiple issues with date formats reported by Christoph Biedl:
|
||||
- T_LOCAL meaning was reversed
|
||||
- Arithmetic did not work
|
||||
Also stop adjusting daylight savings for gmt printing.
|
||||
|
||||
2015-01-05 13:00 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* PR/411: Fix memory corruption from corrupt cdf file.
|
||||
|
||||
2015-01-02 15:15 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* release 5.22
|
||||
|
44
Makefile.in
44
Makefile.in
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,7 +14,17 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -77,11 +87,6 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
$(srcdir)/config.h.in AUTHORS COPYING ChangeLog INSTALL NEWS \
|
||||
README TODO compile config.guess config.sub depcomp install-sh \
|
||||
missing ltmain.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
@ -89,6 +94,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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 \
|
||||
$(am__configure_deps) $(am__DIST_COMMON)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -152,6 +159,9 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
|
||||
COPYING ChangeLog INSTALL NEWS README TODO compile \
|
||||
config.guess config.sub depcomp install-sh ltmain.sh missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
@ -336,7 +346,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -567,15 +576,15 @@ dist-xz: distdir
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
@ -611,16 +620,17 @@ distcheck: dist
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
&& $(am__cd) $(distdir)/_build/sub \
|
||||
&& ../../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
@ -797,6 +807,8 @@ uninstall-am:
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
3
TODO
3
TODO
@ -17,3 +17,6 @@ hard-wired routines). In this regard, note that hplip, which is
|
||||
BSD-licensed, has a magic reimplementation in Python.
|
||||
|
||||
Read the kerberos magic entry for more ideas.
|
||||
|
||||
Write a string merger to make magic entry sizes dynamic.
|
||||
Strings will be converted to offsets from the string table.
|
||||
|
67
aclocal.m4
vendored
67
aclocal.m4
vendored
@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.14 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.15 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# visibility.m4 serial 5 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005, 2008, 2010-2014 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.
|
||||
@ -98,7 +98,7 @@ AC_DEFUN([gl_VISIBILITY],
|
||||
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
|
||||
])
|
||||
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -110,10 +110,10 @@ AC_DEFUN([gl_VISIBILITY],
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.14'
|
||||
[am__api_version='1.15'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.14], [],
|
||||
m4_if([$1], [1.15], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@ -129,14 +129,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.14])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.15])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -181,15 +181,14 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
||||
# Expand $ac_aux_dir to an absolute path.
|
||||
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -220,7 +219,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -411,7 +410,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -487,7 +486,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -577,8 +576,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
@ -651,7 +650,11 @@ to "yes", and re-run configure.
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi])
|
||||
fi
|
||||
dnl The trailing newline in this macro's definition is deliberate, for
|
||||
dnl backward compatibility and to allow trailing 'dnl'-style comments
|
||||
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
|
||||
])
|
||||
|
||||
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
|
||||
@ -680,7 +683,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -691,7 +694,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
if test x"${install_sh+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
@ -701,7 +704,7 @@ if test x"${install_sh}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -722,7 +725,7 @@ AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -772,7 +775,7 @@ rm -f confinc confmf
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -811,7 +814,7 @@ fi
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -840,7 +843,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -887,7 +890,7 @@ AC_LANG_POP([C])])
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -906,7 +909,7 @@ AC_DEFUN([AM_RUN_LOG],
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -987,7 +990,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1047,7 +1050,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1075,7 +1078,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1094,7 +1097,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
2
compile
2
compile
@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
12
config.h.in
12
config.h.in
@ -62,6 +62,9 @@
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* Define to 1 if the system has the type `intptr_t'. */
|
||||
#undef HAVE_INTPTR_T
|
||||
|
||||
@ -80,6 +83,9 @@
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
|
||||
#undef HAVE_MBRTOWC
|
||||
|
||||
@ -107,6 +113,12 @@
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
/* Have sig_t type */
|
||||
#undef HAVE_SIG_T
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
|
72
configure
vendored
72
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for file 5.22.
|
||||
# Generated by GNU Autoconf 2.69 for file 5.23.
|
||||
#
|
||||
# Report bugs to <christos@astron.com>.
|
||||
#
|
||||
@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='file'
|
||||
PACKAGE_TARNAME='file'
|
||||
PACKAGE_VERSION='5.22'
|
||||
PACKAGE_STRING='file 5.22'
|
||||
PACKAGE_VERSION='5.23'
|
||||
PACKAGE_STRING='file 5.23'
|
||||
PACKAGE_BUGREPORT='christos@astron.com'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -1327,7 +1327,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.22 to adapt to many kinds of systems.
|
||||
\`configure' configures file 5.23 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1397,7 +1397,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of file 5.22:";;
|
||||
short | recursive ) echo "Configuration of file 5.23:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -1507,7 +1507,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
file configure 5.22
|
||||
file configure 5.23
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@ -2163,7 +2163,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.22, which was
|
||||
It was created by file $as_me 5.23, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -2514,7 +2514,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
am__api_version='1.14'
|
||||
am__api_version='1.15'
|
||||
|
||||
ac_aux_dir=
|
||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||
@ -2715,8 +2715,8 @@ test "$program_suffix" != NONE &&
|
||||
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
|
||||
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
|
||||
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
# Expand $ac_aux_dir to an absolute path.
|
||||
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
@ -2735,7 +2735,7 @@ else
|
||||
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
|
||||
fi
|
||||
|
||||
if test x"${install_sh}" != xset; then
|
||||
if test x"${install_sh+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
@ -3029,7 +3029,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='file'
|
||||
VERSION='5.22'
|
||||
VERSION='5.23'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -3063,8 +3063,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
mkdir_p='$(MKDIR_P)'
|
||||
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
# Always define AMTAR for backward compatibility. Yes, it's still used
|
||||
# in the wild :-( We should find a proper way to deprecate it ...
|
||||
AMTAR='$${TAR-tar}'
|
||||
@ -3121,6 +3121,7 @@ END
|
||||
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-silent-rules was given.
|
||||
if test "${enable_silent_rules+set}" = set; then :
|
||||
enableval=$enable_silent_rules;
|
||||
@ -12785,7 +12786,7 @@ fi
|
||||
|
||||
done
|
||||
|
||||
for ac_header in getopt.h err.h xlocale.h
|
||||
for ac_header in getopt.h err.h xlocale.h signal.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
@ -12823,6 +12824,17 @@ fi
|
||||
|
||||
done
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" "
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_type_sig_t" = xyes; then :
|
||||
|
||||
$as_echo "#define HAVE_SIG_T 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
|
||||
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
|
||||
@ -14308,6 +14320,32 @@ esac
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r"
|
||||
if test "x$ac_cv_func_localtime_r" = xyes; then :
|
||||
$as_echo "#define HAVE_LOCALTIME_R 1" >>confdefs.h
|
||||
|
||||
else
|
||||
case " $LIBOBJS " in
|
||||
*" localtime_r.$ac_objext "* ) ;;
|
||||
*) LIBOBJS="$LIBOBJS localtime_r.$ac_objext"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "gmtime_r" "ac_cv_func_gmtime_r"
|
||||
if test "x$ac_cv_func_gmtime_r" = xyes; then :
|
||||
$as_echo "#define HAVE_GMTIME_R 1" >>confdefs.h
|
||||
|
||||
else
|
||||
case " $LIBOBJS " in
|
||||
*" gmtime_r.$ac_objext "* ) ;;
|
||||
*) LIBOBJS="$LIBOBJS gmtime_r.$ac_objext"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
|
||||
if test "x$ac_cv_func_pread" = xyes; then :
|
||||
$as_echo "#define HAVE_PREAD 1" >>confdefs.h
|
||||
@ -14998,7 +15036,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.22, which was
|
||||
This file was extended by file $as_me 5.23, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -15064,7 +15102,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.22
|
||||
file config.status 5.23
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
10
configure.ac
10
configure.ac
@ -1,5 +1,5 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT([file],[5.22],[christos@astron.com])
|
||||
AC_INIT([file],[5.23],[christos@astron.com])
|
||||
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
@ -82,9 +82,13 @@ AC_HEADER_MAJOR
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
|
||||
AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
|
||||
AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
|
||||
AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h)
|
||||
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
|
||||
AC_CHECK_HEADERS(zlib.h)
|
||||
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
@ -141,7 +145,7 @@ dnl Checks for functions
|
||||
AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale)
|
||||
|
||||
dnl Provide implementation of some required functions if necessary
|
||||
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck)
|
||||
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck)
|
||||
|
||||
dnl Checks for libraries
|
||||
AC_CHECK_LIB(z,gzopen)
|
||||
|
2
depcomp
2
depcomp
@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,7 +14,17 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -77,7 +87,6 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
|
||||
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 \
|
||||
@ -85,6 +94,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -144,6 +154,7 @@ man5dir = $(mandir)/man5
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
@ -286,7 +297,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign doc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -642,6 +652,8 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
|
||||
tags-am uninstall uninstall-am uninstall-man uninstall-man1 \
|
||||
uninstall-man3 uninstall-man4 uninstall-man5
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
file.1: Makefile file.man
|
||||
@rm -f $@
|
||||
|
38
doc/file.man
38
doc/file.man
@ -1,5 +1,5 @@
|
||||
.\" $File: file.man,v 1.111 2014/12/16 23:18:40 christos Exp $
|
||||
.Dd December 16, 2014
|
||||
.\" $File: file.man,v 1.117 2015/06/03 19:51:27 christos Exp $
|
||||
.Dd June 3, 2015
|
||||
.Dt FILE __CSECTION__
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -8,8 +8,9 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Bk -words
|
||||
.Op Fl bcEhiklLNnprsvz0
|
||||
.Op Fl bcEhiklLNnprsvzZ0
|
||||
.Op Fl Fl apple
|
||||
.Op Fl Fl extension
|
||||
.Op Fl Fl mime-encoding
|
||||
.Op Fl Fl mime-type
|
||||
.Op Fl e Ar testname
|
||||
@ -213,6 +214,8 @@ Consults magic files.
|
||||
.It tar
|
||||
Examines tar files.
|
||||
.El
|
||||
.It Fl Fl extension
|
||||
Print a slash-separated list of valid extensions for the file type found.
|
||||
.It Fl F , Fl Fl separator Ar separator
|
||||
Use the specified string as the separator between the filename and the
|
||||
file result returned.
|
||||
@ -343,6 +346,9 @@ since on some systems it reports a zero size for raw disk partitions.
|
||||
Print the version of the program and exit.
|
||||
.It Fl z , Fl Fl uncompress
|
||||
Try to look inside compressed files.
|
||||
.It Fl Z , Fl Fl uncompress-noreport
|
||||
Try to look inside compressed files, but report information about the contents
|
||||
only not the compression.
|
||||
.It Fl 0 , Fl Fl print0
|
||||
Output a null character
|
||||
.Sq \e0
|
||||
@ -586,20 +592,30 @@ last-pushed (most specific, one hopes) value at the end, or
|
||||
use a default if the list is empty.
|
||||
This should not slow down evaluation.
|
||||
.Pp
|
||||
The handling of
|
||||
.Dv MAGIC_CONTINUE
|
||||
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
|
||||
.Pp
|
||||
Continue to squash all magic bugs.
|
||||
See Debian BTS for a good source.
|
||||
.Pp
|
||||
Store arbitrarily long strings, for example for %s patterns, so that
|
||||
they can be printed out.
|
||||
Fixes Debian bug #271672.
|
||||
Would require more complex store/load code in apprentice.
|
||||
This can be done by allocating strings in a string pool, storing the
|
||||
string pool at the end of the magic file and converting all the string
|
||||
pointers to relative offsets from the string pool.
|
||||
.Pp
|
||||
Add syntax for relative offsets after current level (Debian bug #466037).
|
||||
.Pp
|
||||
Make file -ki work, i.e. give multiple MIME types.
|
||||
.Pp
|
||||
Add a zip library so we can peek inside Office2007 documents to
|
||||
figure out what they are.
|
||||
print more details about their contents.
|
||||
.Pp
|
||||
Add an option to print URLs for the sources of the file descriptions.
|
||||
.Pp
|
||||
@ -609,6 +625,9 @@ string to be looked up in a table).
|
||||
This would avoid adding the same magic repeatedly for each new
|
||||
hash-bang interpreter.
|
||||
.Pp
|
||||
When a file descriptor is available, we can skip and adjust the buffer
|
||||
instead of the hacky buffer management we do now.
|
||||
.Pp
|
||||
Fix
|
||||
.Dq name
|
||||
and
|
||||
@ -626,6 +645,15 @@ Make
|
||||
more efficient by keeping a sorted list of names.
|
||||
Special-case ^ to flip endianness in the parser so that it does not
|
||||
have to be escaped, and document it.
|
||||
.Pp
|
||||
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).
|
||||
.Sh AVAILABILITY
|
||||
You can obtain the original author's latest version by anonymous FTP
|
||||
on
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $File: libmagic.man,v 1.34 2014/12/16 23:18:40 christos Exp $
|
||||
.\" $File: libmagic.man,v 1.37 2015/06/03 18:21:24 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) Christos Zoulas 2003.
|
||||
.\" All Rights Reserved.
|
||||
@ -25,7 +25,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 16, 2014
|
||||
.Dd June 3, 2015
|
||||
.Dt LIBMAGIC 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -132,6 +132,10 @@ Treat operating system errors while trying to open files and follow symlinks
|
||||
as real errors, instead of printing them in the magic buffer.
|
||||
.It Dv MAGIC_APPLE
|
||||
Return the Apple creator and type.
|
||||
.It Dv MAGIC_EXTENSION
|
||||
Return a slash-separated list of extensions for this file type.
|
||||
.It Dv MAGIC_COMPRESS_TRANSP
|
||||
Don't report on compression, only report about the uncompressed data.
|
||||
.It Dv MAGIC_NO_CHECK_APPTYPE
|
||||
Don't check for
|
||||
.Dv EMX
|
||||
|
@ -6900,7 +6900,11 @@ func_mode_link ()
|
||||
# Finalize command for both is simple: just hardcode it.
|
||||
if test "$hardcode_direct" = yes &&
|
||||
test "$hardcode_direct_absolute" = no; then
|
||||
add="$libdir/$linklib"
|
||||
if test -f "$inst_prefix_dir$libdir/$linklib"; then
|
||||
add="$inst_prefix_dir$libdir/$linklib"
|
||||
else
|
||||
add="$libdir/$linklib"
|
||||
fi
|
||||
elif test "$hardcode_minus_L" = yes; then
|
||||
add_dir="-L$libdir"
|
||||
add="-l$name"
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------
|
||||
# $File: android,v 1.7 2014/11/10 05:08:23 christos Exp $
|
||||
# $File: android,v 1.8 2015/03/19 18:04:37 christos Exp $
|
||||
# Various android related magic entries
|
||||
#------------------------------------------------------------
|
||||
|
||||
@ -137,3 +137,9 @@
|
||||
>16 lelong x \b, Total of %d
|
||||
>12 lelong x \b %d-byte output blocks in
|
||||
>20 lelong x \b %d input chunks.
|
||||
|
||||
# Android binary XML magic
|
||||
# In include/androidfw/ResourceTypes.h:
|
||||
# RES_XML_TYPE = 0x0003 followed by the size of the header (ResXMLTree_header),
|
||||
# which is 8 bytes (2 bytes type + 2 bytes header size + 4 bytes size).
|
||||
0 lelong 0x00080003 Android binary XML
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: apple,v 1.29 2014/04/30 21:41:02 christos Exp $
|
||||
# $File: apple,v 1.30 2015/04/13 13:09:06 christos Exp $
|
||||
# apple: file(1) magic for Apple file formats
|
||||
#
|
||||
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
|
||||
@ -300,3 +300,12 @@
|
||||
#http://wiki.mozilla.org/DS_Store_File_Format`
|
||||
#http://en.wikipedia.org/wiki/.DS_Store
|
||||
0 string \0\0\0\1Bud1\0 Apple Desktop Services Store
|
||||
|
||||
# HFS/HFS+ Resource fork files (andrew.roazen@nau.edu Apr 13 2015)
|
||||
# Usually not in separate files, but have either filename rsrc with
|
||||
# no extension, or a filename corresponding to another file, with
|
||||
# extensions rsr/rsrc
|
||||
0 string \000\000\001\000
|
||||
>4 leshort 0
|
||||
>>16 lelong 0 Apple HFS/HFS+ resource fork
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: archive,v 1.88 2014/08/16 10:42:17 christos Exp $
|
||||
# $File: archive,v 1.90 2015/04/24 15:44:12 christos Exp $
|
||||
# archive: file(1) magic for archive formats (see also "msdos" for self-
|
||||
# extracting compressed archives)
|
||||
#
|
||||
@ -714,7 +714,7 @@
|
||||
>>>4 byte 0x0a \b, at least v1.0 to extract
|
||||
>>>4 byte 0x0b \b, at least v1.1 to extract
|
||||
>>>4 byte 0x14 \b, at least v2.0 to extract
|
||||
>>>4 byte 0x2d \b, at least v3.0 to extract
|
||||
>>>4 byte 0x2d \b, at least v4.5 to extract
|
||||
>>>0x161 string WINZIP \b, WinZIP self-extracting
|
||||
|
||||
# StarView Metafile
|
||||
@ -911,6 +911,9 @@
|
||||
# ZPAQ: http://mattmahoney.net/dc/zpaq.html
|
||||
0 string zPQ ZPAQ stream
|
||||
>3 byte x \b, level %d
|
||||
# From: Barry Carter <carter.barry@gmail.com>
|
||||
# http://encode.ru/threads/456-zpaq-updates/page32
|
||||
0 string 7kSt ZPAQ file
|
||||
|
||||
# BBeB ebook, unencrypted (LRF format)
|
||||
# URL: http://www.sven.de/librie/Librie/LrfFormat
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: audio,v 1.71 2014/05/14 23:30:28 christos Exp $
|
||||
# $File: audio,v 1.73 2015/03/15 23:21:42 christos Exp $
|
||||
# audio: file(1) magic for sound formats (see also "iff")
|
||||
#
|
||||
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
|
||||
@ -300,7 +300,7 @@
|
||||
>>5 byte &0x40 \b, extended header
|
||||
>>5 byte &0x20 \b, experimental
|
||||
>>5 byte &0x10 \b, footer present
|
||||
>(6.I) indirect x \b, contains:
|
||||
>(6.I+10) indirect x \b, contains:
|
||||
|
||||
# NSF (NES sound file) magic
|
||||
0 string NESM\x1a NES Sound File
|
||||
@ -313,6 +313,21 @@
|
||||
>122 byte&0x1 =1 PAL
|
||||
>122 byte&0x1 =0 NTSC
|
||||
|
||||
# NSFE (Extended NES sound file) magic
|
||||
# http://slickproductions.org/docs/NSF/nsfespec.txt
|
||||
# From: David Pflug <david@pflug.email>
|
||||
0 string NSFE Extended NES Sound File
|
||||
>48 search/0x1000 auth
|
||||
>>&0 string >\0 ("%s"
|
||||
>>>&1 string >\0 by %s
|
||||
>>>>&1 string >\0 \b, copyright %s
|
||||
>>>>>&1 string >\0 \b, ripped by %s
|
||||
>20 byte x \b), %d tracks,
|
||||
>18 byte&0x2 =1 dual PAL/NTSC
|
||||
>18 byte&0x2 =0
|
||||
>>18 byte&0x1 =1 PAL
|
||||
>>18 byte&0x1 =0 NTSC
|
||||
|
||||
# Type: SNES SPC700 sound files
|
||||
# From: Josh Triplett <josh@freedesktop.org>
|
||||
0 string SNES-SPC700\ Sound\ File\ Data\ v SNES SPC700 sound file
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: cafebabe,v 1.17 2015/01/01 17:07:00 christos Exp $
|
||||
# $File: cafebabe,v 1.20 2015/05/29 14:21:58 christos Exp $
|
||||
# Cafe Babes unite!
|
||||
#
|
||||
# Since Java bytecode and Mach-O universal binaries have the same magic number,
|
||||
@ -28,6 +28,8 @@
|
||||
>>4 belong 0x0030 (Java 1.4)
|
||||
>>4 belong 0x0031 (Java 1.5)
|
||||
>>4 belong 0x0032 (Java 1.6)
|
||||
>>4 belong 0x0033 (Java 1.7)
|
||||
>>4 belong 0x0034 (Java 1.8)
|
||||
|
||||
0 belong 0xcafed00d JAR compressed with pack200,
|
||||
>5 byte x version %d.
|
||||
@ -50,14 +52,18 @@
|
||||
|
||||
0 belong 0xcafebabe
|
||||
>4 belong 1 Mach-O universal binary with 1 architecture:
|
||||
!:mime application/x-mach-binary
|
||||
>>8 use mach-o \b
|
||||
>4 belong >1
|
||||
>>4 belong <20 Mach-O universal binary with %d architectures:
|
||||
!:mime application/x-mach-binary
|
||||
>>>8 use mach-o \b
|
||||
>>>28 use mach-o \b
|
||||
>>4 belong >2
|
||||
>>4 belong 2
|
||||
>>>48 use mach-o \b
|
||||
>>4 belong >3
|
||||
>>4 belong 3
|
||||
>>>68 use mach-o \b
|
||||
>>4 belong 4
|
||||
>>>88 use mach-o \b
|
||||
|
||||
### MACH-O END ###
|
||||
|
21
magic/Magdir/cbor
Normal file
21
magic/Magdir/cbor
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: cbor,v 1.1 2015/01/28 01:05:21 christos Exp $
|
||||
# cbor: file(1) magic for CBOR files as defined in RFC 7049
|
||||
|
||||
0 string \xd9\xd9\xf7 Concise Binary Object Representation (CBOR) container
|
||||
!:mime application/cbor
|
||||
>3 ubyte <0x20 (positive integer)
|
||||
>3 ubyte <0x40
|
||||
>>3 ubyte >0x1f (negative integer)
|
||||
>3 ubyte <0x60
|
||||
>>3 ubyte >0x3f (byte string)
|
||||
>3 ubyte <0x80
|
||||
>>3 ubyte >0x5f (text string)
|
||||
>3 ubyte <0xa0
|
||||
>3 ubyte >0x7f (array)
|
||||
>3 ubyte <0xc0
|
||||
>>3 ubyte >0x9f (map)
|
||||
>3 ubyte <0xe0
|
||||
>>3 ubyte >0xbf (tagged)
|
||||
>3 ubyte >0xdf (other)
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: commands,v 1.51 2014/09/27 00:12:55 christos Exp $
|
||||
# $File: commands,v 1.52 2015/06/04 19:16:55 christos Exp $
|
||||
# commands: file(1) magic for various shells and interpreters
|
||||
#
|
||||
#0 string/w : shell archive or script for antique kernel text
|
||||
@ -78,6 +78,8 @@
|
||||
!:mime text/x-shellscript
|
||||
0 string/wb #!\ /usr/local/bin/bash Bourne-Again shell script executable (binary data)
|
||||
!:mime text/x-shellscript
|
||||
0 string/wt #!\ /usr/bin/env\ bash Bourne-Again shell script text executable
|
||||
!:mime text/x-shellscript
|
||||
|
||||
# PHP scripts
|
||||
# Ulf Harnhammar <ulfh@update.uu.se>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: compress,v 1.62 2014/09/13 14:27:12 christos Exp $
|
||||
# $File: compress,v 1.63 2015/03/11 19:27:35 christos Exp $
|
||||
# compress: file(1) magic for pure-compression formats (no archives)
|
||||
#
|
||||
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
||||
@ -201,6 +201,7 @@
|
||||
|
||||
# http://tukaani.org/xz/xz-file-format.txt
|
||||
0 ustring \xFD7zXZ\x00 XZ compressed data
|
||||
!:strength * 2
|
||||
!:mime application/x-xz
|
||||
|
||||
# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: console,v 1.19 2013/02/06 14:18:52 christos Exp $
|
||||
# $File: console,v 1.20 2015/03/15 23:21:42 christos Exp $
|
||||
# Console game magic
|
||||
# Toby Deshane <hac@shoelace.digivill.net>
|
||||
# ines: file(1) magic for Marat's iNES Nintendo Entertainment System
|
||||
@ -177,9 +177,19 @@
|
||||
# From: Serge van den Boom <svdb@stack.nl>
|
||||
0 string \x01ZZZZZ\x01 3DO "Opera" file system
|
||||
|
||||
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
# From: Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
# From: David Pflug <david@pflug.email>
|
||||
# is the offset 12 or the offset 16 correct?
|
||||
# GBS (Game Boy Sound) magic
|
||||
# ftp://ftp.modland.com/pub/documents/format_documentation/\
|
||||
# Gameboy%20Sound%20System%20(.gbs).txt
|
||||
0 string GBS Nintendo Gameboy Music/Audio Data
|
||||
12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
|
||||
#12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
|
||||
>16 string >\0 ("%s" by
|
||||
>48 string >\0 %s, copyright
|
||||
>80 string >\0 %s),
|
||||
>3 byte x version %d,
|
||||
>4 byte x %d tracks
|
||||
|
||||
# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
|
||||
0 string PPF30 Playstation Patch File version 3.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: dyadic,v 1.6 2014/06/01 19:14:42 christos Exp $
|
||||
# $File: dyadic,v 1.7 2015/05/27 18:02:48 christos Exp $
|
||||
# Dyadic: file(1) magic for Dyalog APL.
|
||||
#
|
||||
# updated by Joerg Jenderek at Oct 2013
|
||||
@ -46,6 +46,11 @@
|
||||
>>>1 byte 0x12 component file 64-bit level 3 journaled checksummed
|
||||
>>>1 byte 0x13 component file 32-bit non-journaled checksummed
|
||||
>>>1 byte 0x14 component file 64-bit non-journaled checksummed
|
||||
>>>1 byte 0x15 component file under construction
|
||||
>>>1 byte 0x16 DFS component file 64-bit level 1 journaled checksummed
|
||||
>>>1 byte 0x17 DFS component file 64-bit level 2 journaled checksummed
|
||||
>>>1 byte 0x18 DFS component file 64-bit level 3 journaled checksummed
|
||||
>>>1 byte 0x19 external workspace
|
||||
>>>1 byte 0x80 DDB
|
||||
>>>2 byte x version %d
|
||||
>>>3 byte x \b.%d
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: filesystems,v 1.108 2015/01/01 17:43:47 christos Exp $
|
||||
# $File: filesystems,v 1.109 2015/02/22 01:22:54 christos Exp $
|
||||
# filesystems: file(1) magic for different filesystems
|
||||
#
|
||||
0 name partid
|
||||
@ -1928,6 +1928,7 @@
|
||||
>>38917 string 3 (version 2.0)
|
||||
>>38917 byte >0x33 (unknown version, ID 0x%X)
|
||||
>>38917 byte <0x31 (unknown version, ID 0x%X)
|
||||
>0x1FE leshort 0xAA55 (DOS/MBR boot sector)
|
||||
# "application id" which appears to be used as a volume label
|
||||
>32808 string/T >\0 '%s'
|
||||
>34816 string \000CD001\001EL\ TORITO\ SPECIFICATION (bootable)
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: gnu,v 1.15 2014/02/06 14:21:02 christos Exp $
|
||||
# $File: gnu,v 1.16 2015/04/19 22:59:25 christos Exp $
|
||||
# gnu: file(1) magic for various GNU tools
|
||||
#
|
||||
# GNU nlsutils message catalog file format
|
||||
@ -79,5 +79,7 @@
|
||||
0 long 0x950412DE GNU-format message catalog data
|
||||
|
||||
# gettext message catalogue
|
||||
0 regex \^msgid\ GNU gettext message catalogue text
|
||||
0 search/1024 \nmsgid
|
||||
>&0 search/1024 \nmsgstr GNU gettext message catalogue text
|
||||
!:strength +100
|
||||
!:mime text/x-po
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: images,v 1.102 2015/01/02 02:36:35 christos Exp $
|
||||
# $File: images,v 1.106 2015/02/22 01:26:05 christos Exp $
|
||||
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
||||
# XPM bitmaps)
|
||||
#
|
||||
@ -36,42 +36,48 @@
|
||||
# PBMPLUS images
|
||||
# The next byte following the magic is always whitespace.
|
||||
# strength is changed to try these patterns before "x86 boot sector"
|
||||
0 name netpbm
|
||||
>3 regex/s =[0-9]{1,50}\ [0-9]{1,50} Netpbm PPM image data
|
||||
>>&0 regex =[0-9]{1,50} \b, size = %s x
|
||||
>>>&0 regex =[0-9]{1,50} \b %s
|
||||
|
||||
0 search/1 P1
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PBM image text
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, bitmap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-bitmap
|
||||
|
||||
0 search/1 P2
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PGM image text
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, greymap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-greymap
|
||||
|
||||
0 search/1 P3
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PPM image text
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, pixmap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-pixmap
|
||||
|
||||
|
||||
0 string P4
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PBM "rawbits" image data
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, rawbits, bitmap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-bitmap
|
||||
|
||||
0 string P5
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PGM "rawbits" image data
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, rawbits, greymap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-greymap
|
||||
|
||||
0 string P6
|
||||
>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PPM "rawbits" image data
|
||||
>3 regex =[0-9]{1,50}\ \b, size = %sx
|
||||
>>3 regex =\ [0-9]{1,50} \b%s
|
||||
>0 use netpbm
|
||||
>>0 string x \b, rawbits, pixmap
|
||||
!:strength + 45
|
||||
!:mime image/x-portable-pixmap
|
||||
|
||||
0 string P7 Netpbm PAM image file
|
||||
!:mime image/x-portable-pixmap
|
||||
|
||||
@ -167,6 +173,7 @@
|
||||
>>>>8 leshort x \b(unknown 0x%x)
|
||||
>>>12 use tiff_entry
|
||||
>0 leshort 0x106 \b, PhotometricIntepretation=
|
||||
>>8 clear x
|
||||
>>8 leshort 0 \bWhiteIsZero
|
||||
>>8 leshort 1 \bBlackIsZero
|
||||
>>8 leshort 2 \bRGB
|
||||
@ -175,6 +182,7 @@
|
||||
>>8 leshort 5 \bCMYK
|
||||
>>8 leshort 6 \bYCbCr
|
||||
>>8 leshort 8 \bCIELab
|
||||
>>8 default x
|
||||
>>>8 leshort x \b(unknown=0x%x)
|
||||
>>12 use tiff_entry
|
||||
# FillOrder
|
||||
@ -678,7 +686,26 @@
|
||||
>25 string >\0 dated %.14s
|
||||
|
||||
# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
|
||||
0 belong 0x00010008 GEM Image data
|
||||
# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
|
||||
# See http://fileformats.archiveteam.org/wiki/GEM_Raster
|
||||
# For variations, also see:
|
||||
# http://www.seasip.info/Gem/ff_img.html (Ventura)
|
||||
# http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
|
||||
# http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
|
||||
# http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
|
||||
0 beshort 0x0001
|
||||
>2 beshort 0x0008 GEM Image data
|
||||
>>0 use gem_info
|
||||
>2 beshort 0x0009 GEM Image data (Ventura)
|
||||
>>0 use gem_info
|
||||
16 string XIMG\0 GEM XIMG Image data
|
||||
>0 use gem_info
|
||||
16 string STTT\0\x10 GEM STTT Image data
|
||||
>0 use gem_info
|
||||
16 string TIMG\0 GEM TIMG Image data
|
||||
>0 use gem_info
|
||||
|
||||
0 name gem_info
|
||||
>12 beshort x %d x
|
||||
>14 beshort x %d,
|
||||
>4 beshort x %d planes,
|
||||
@ -1036,11 +1063,6 @@
|
||||
# From: "Tano M. Fotang" <mfotang@quanteq.com>
|
||||
0 string \x46\x4d\x52\x00 ISO/IEC 19794-2 Format Minutiae Record (FMR)
|
||||
|
||||
# WEBP https://developers.google.com/speed/webp/docs/riff_container
|
||||
#0 string RIFF
|
||||
#>8 string WEBP Web/P image data
|
||||
#>>4 lelong x \b, %d bytes
|
||||
|
||||
# doc: http://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
|
||||
# example: http://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
|
||||
90 bequad 0x574D50484F544F00 JPEG-XR Image
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: jpeg,v 1.25 2015/01/02 16:56:50 christos Exp $
|
||||
# $File: jpeg,v 1.29 2015/04/10 15:36:02 christos Exp $
|
||||
# JPEG images
|
||||
# SunOS 5.5.1 had
|
||||
#
|
||||
@ -12,7 +12,8 @@
|
||||
0 beshort 0xffd8 JPEG image data
|
||||
!:mime image/jpeg
|
||||
!:apple 8BIMJPEG
|
||||
!:strength +2
|
||||
!:strength *3
|
||||
!:ext jpeg/jpg/jpe/jfif
|
||||
>6 string JFIF \b, JFIF standard
|
||||
# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
|
||||
# in a vain attempt to add image size reporting for JFIF. Note that these
|
||||
@ -41,7 +42,8 @@
|
||||
# This uses recursion...
|
||||
0 name jpeg_segment
|
||||
>0 beshort 0xFFFE
|
||||
>>(2.S+2) use jpeg_segment
|
||||
# Recursion handled by FFE0
|
||||
#>>(2.S+2) use jpeg_segment
|
||||
>>2 pstring/HJ x \b, comment: "%s"
|
||||
|
||||
>0 beshort 0xFFC0
|
||||
@ -70,6 +72,7 @@
|
||||
>>(2.S+2) use jpeg_segment
|
||||
|
||||
>0 beshort 0xFFE1
|
||||
# Recursion handled by FFE0
|
||||
#>>(2.S+2) use jpeg_segment
|
||||
>>4 string Exif \b, Exif Standard: [
|
||||
>>>10 indirect/r x
|
||||
@ -85,7 +88,8 @@
|
||||
# D9: End of image
|
||||
# Dn: Restart
|
||||
>0 beshort&0xFFD0 =0xFFD0
|
||||
>>(2.S+2) use jpeg_segment
|
||||
>>0 beshort&0xFFE0 !0xFFE0
|
||||
>>>(2.S+2) use jpeg_segment
|
||||
|
||||
#>0 beshort x unknown 0x%x
|
||||
#>>(2.S+2) use jpeg_segment
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: linux,v 1.59 2014/11/03 21:03:36 christos Exp $
|
||||
# $File: linux,v 1.62 2015/05/03 13:06:36 christos Exp $
|
||||
# linux: file(1) magic for Linux files
|
||||
#
|
||||
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
|
||||
@ -432,3 +432,28 @@
|
||||
>12 byte x \b, version %d
|
||||
>13 byte 1 \b, require visibility
|
||||
>16 string x \b, root %s
|
||||
|
||||
# Dump files for iproute2 tool. Generated by the "ip r|a save" command. URL:
|
||||
# https://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
|
||||
# From: Pavel Emelyanov <xemul@parallels.com>
|
||||
0 lelong 0x45311224 iproute2 routes dump
|
||||
0 lelong 0x47361222 iproute2 addresses dump
|
||||
|
||||
# Image and service files for CRIU tool.
|
||||
# URL: http://criu.org
|
||||
# From: Pavel Emelyanov <xemul@parallels.com>
|
||||
0 lelong 0x54564319 CRIU image file v1.1
|
||||
0 lelong 0x55105940 CRIU service file
|
||||
0 lelong 0x58313116 CRIU inventory
|
||||
|
||||
# Kdump compressed dump files
|
||||
# http://sourceforge.net/p/makedumpfile/code/ci/master/tree/IMPLEMENTATION
|
||||
|
||||
0 string KDUMP Kdump compressed dump
|
||||
>8 long x v%d
|
||||
>12 string >\0 \b, system %s
|
||||
>77 string >\0 \b, node %s
|
||||
>142 string >\0 \b, release %s
|
||||
>207 string >\0 \b, version %s
|
||||
>272 string >\0 \b, machine %s
|
||||
>337 string >\0 \b, domain %s
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------
|
||||
# $File: mach,v 1.19 2014/04/30 21:41:02 christos Exp $
|
||||
# $File: mach,v 1.20 2015/05/21 18:28:41 christos Exp $
|
||||
# Mach has two magic numbers, 0xcafebabe and 0xfeedface.
|
||||
# Unfortunately the first, cafebabe, is shared with
|
||||
# Java ByteCode, so they are both handled in the file "cafebabe".
|
||||
@ -207,8 +207,10 @@
|
||||
#
|
||||
0 lelong&0xfffffffe 0xfeedface Mach-O
|
||||
!:strength +1
|
||||
!:mime application/x-mach-binary
|
||||
>0 use \^mach-o-be
|
||||
|
||||
0 belong&0xfffffffe 0xfeedface Mach-O
|
||||
!:strength +1
|
||||
!:mime application/x-mach-binary
|
||||
>0 use mach-o-be
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: mathematica,v 1.7 2009/09/19 16:28:10 christos Exp $
|
||||
# $File: mathematica,v 1.8 2015/04/09 20:01:40 christos Exp $
|
||||
# mathematica: file(1) magic for mathematica files
|
||||
# "H. Nanosecond" <aldomel@ix.netcom.com>
|
||||
# Mathematica a multi-purpose math program
|
||||
@ -8,13 +8,16 @@
|
||||
|
||||
#mathematica .mb
|
||||
0 string \064\024\012\000\035\000\000\000 Mathematica version 2 notebook
|
||||
!:ext mb
|
||||
0 string \064\024\011\000\035\000\000\000 Mathematica version 2 notebook
|
||||
!:ext mb
|
||||
|
||||
# .ma
|
||||
# multiple possibilites:
|
||||
|
||||
0 string (*^\n\n::[\011frontEndVersion\ =\ Mathematica notebook
|
||||
#>41 string >\0 %s
|
||||
!:ext mb
|
||||
|
||||
#0 string (*^\n\n::[\011palette Mathematica notebook version 2.x
|
||||
|
||||
@ -25,13 +28,21 @@
|
||||
|
||||
# generic:
|
||||
0 string (*^\r\r::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\r\n\r\n::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\015 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\n\r\n\r::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\r::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\r\n::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\n\n::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
0 string (*^\n::[\011 Mathematica notebook version 2.x
|
||||
!:ext mb
|
||||
|
||||
|
||||
# Mathematica .mx files
|
||||
|
@ -1,13 +1,22 @@
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# $File: misctools,v 1.14 2014/03/06 16:08:58 christos Exp $
|
||||
# $File: misctools,v 1.15 2015/04/15 18:29:30 christos Exp $
|
||||
# misctools: file(1) magic for miscellaneous UNIX tools.
|
||||
#
|
||||
0 search/1 %%!! X-Post-It-Note text
|
||||
0 string/c BEGIN:VCALENDAR vCalendar calendar file
|
||||
!:mime text/calendar
|
||||
# updated by Joerg Jenderek at Apr 2015
|
||||
# Extension: .vcf
|
||||
# http://en.wikipedia.org/wiki/VCard
|
||||
0 string/c BEGIN:VCARD vCard visiting card
|
||||
!:mime text/x-vcard
|
||||
# deprecated
|
||||
#!:mime text/x-vcard
|
||||
!:mime text/vcard
|
||||
# VERSION must come right after BEGIN for 3.0 or 4.0 except in 2.1 , where it can be anywhere
|
||||
>12 search/14000/c VERSION:
|
||||
# VERSION 2.1 , 3.0 or 4.0
|
||||
>>&0 string x \b, version %-.3s
|
||||
|
||||
# Summary: Libtool library file
|
||||
# Extension: .la
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: modem,v 1.5 2010/09/20 18:55:20 rrt Exp $
|
||||
# $File: modem,v 1.6 2015/02/14 17:35:47 christos Exp $
|
||||
# modem: file(1) magic for modem programs
|
||||
#
|
||||
# From: Florian La Roche <florian@knorke.saar.de>
|
||||
@ -33,3 +33,14 @@
|
||||
0 string PVF2\n portable voice format
|
||||
>5 string >\0 (ascii %s)
|
||||
|
||||
# From: Bernd Nuernberger <bernd.nuernberger@web.de>
|
||||
# Brooktrout G3 fax data incl. 128 byte header
|
||||
# Common suffixes: 3??, BRK, BRT, BTR
|
||||
0 leshort 0x01bb
|
||||
>2 leshort 0x0100 Brooktrout 301 fax image,
|
||||
>>9 leshort x %d x
|
||||
>>0x2d leshort x %d
|
||||
>>6 leshort 200 \b, fine resolution
|
||||
>>6 leshort 100 \b, normal resolution
|
||||
>>11 byte 1 \b, G3 compression
|
||||
>>11 byte 2 \b, G32D compression
|
||||
|
@ -1,9 +1,10 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: mozilla,v 1.4 2009/09/19 16:28:11 christos Exp $
|
||||
# $File: mozilla,v 1.6 2015/01/25 16:20:46 christos Exp $
|
||||
# mozilla: file(1) magic for Mozilla XUL fastload files
|
||||
# (XUL.mfasl and XPC.mfasl)
|
||||
# URL: http://www.mozilla.org/
|
||||
# From: Josh Triplett <josh@freedesktop.org>
|
||||
|
||||
0 string XPCOM\nMozFASL\r\n\x1A Mozilla XUL fastload data
|
||||
0 string mozLz4a Mozilla lz4 compressed bookmark data
|
||||
|
7
magic/Magdir/nasa
Normal file
7
magic/Magdir/nasa
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# nasa: file(1) magic
|
||||
|
||||
# From: Barry Carter <carter.barry@gmail.com>
|
||||
0 string DAF/SPK NASA SPICE file (binary format)
|
||||
0 string DAFETF\ NAIF\ DAF\ ENCODED NASA SPICE file (transfer format)
|
@ -1,13 +1,14 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: os2,v 1.7 2009/09/19 16:28:11 christos Exp $
|
||||
# $File: os2,v 1.8 2015/01/05 00:17:13 christos Exp $
|
||||
# os2: file(1) magic for OS/2 files
|
||||
#
|
||||
|
||||
# Provided 1998/08/22 by
|
||||
# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net>
|
||||
1 search/1 InternetShortcut MS Windows 95 Internet shortcut text
|
||||
>24 search/1 >\ (URL=<%s>)
|
||||
>17 search/100 URL= (URL=<
|
||||
>>&0 string x \b%s>)
|
||||
|
||||
# OS/2 URL objects
|
||||
# Provided 1998/08/22 by
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: pdf,v 1.7 2013/08/22 07:47:26 christos Exp $
|
||||
# $File: pdf,v 1.8 2015/01/11 18:19:18 christos Exp $
|
||||
# pdf: file(1) magic for Portable Document Format
|
||||
#
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
>5 byte x \b, version %c
|
||||
>7 byte x \b.%c
|
||||
|
||||
0 string \012%PDF- PDF document
|
||||
!:mime application/pdf
|
||||
>6 byte x \b, version %c
|
||||
>8 byte x \b.%c
|
||||
|
||||
# From: Nick Schmalenberger <nick@schmalenberger.us>
|
||||
# Forms Data Format
|
||||
0 string %FDF- FDF document
|
||||
|
@ -1,47 +1,57 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: perl,v 1.22 2014/04/28 12:04:35 christos Exp $
|
||||
# $File: perl,v 1.24 2015/03/27 17:58:58 christos Exp $
|
||||
# perl: file(1) magic for Larry Wall's perl language.
|
||||
#
|
||||
# The `eval' lines recognizes an outrageously clever hack.
|
||||
# Keith Waclena <keith@cerberus.uchicago.edu>
|
||||
# Send additions to <perl5-porters@perl.org>
|
||||
0 search/1 eval\ "exec\ /bin/perl Perl script text
|
||||
0 search/1024 eval\ "exec\ perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 eval\ "exec\ /usr/bin/perl Perl script text
|
||||
0 search/1024 eval\ "exec\ /bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 eval\ "exec\ /usr/local/bin/perl Perl script text
|
||||
0 search/1024 eval\ "exec\ /usr/bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text
|
||||
0 search/1024 eval\ "exec\ /usr/local/bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 #!/usr/bin/env\ perl Perl script text executable
|
||||
0 search/1024 eval\ 'exec\ perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 #!\ /usr/bin/env\ perl Perl script text executable
|
||||
0 search/1024 eval\ 'exec\ /bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1 #!
|
||||
>0 regex \^#!.*/bin/perl$ Perl script text executable
|
||||
0 search/1024 eval\ 'exec\ /usr/bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1024 eval\ 'exec\ /usr/local/bin/perl Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1024 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text
|
||||
!:mime text/x-perl
|
||||
0 search/1024 #!/usr/bin/env\ perl Perl script text executable
|
||||
!:mime text/x-perl
|
||||
0 search/1024 #!\ /usr/bin/env\ perl Perl script text executable
|
||||
!:mime text/x-perl
|
||||
0 search/1024 #!
|
||||
>0 regex \^#!.*/bin/perl([[:space:]].*)*$ Perl script text executable
|
||||
!:mime text/x-perl
|
||||
|
||||
# by Dmitry V. Levin and Alexey Tourbin
|
||||
# check the first line
|
||||
0 search/1 package
|
||||
0 search/1024 package
|
||||
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *; Perl5 module source text
|
||||
!:strength + 10
|
||||
# not 'p', check other lines
|
||||
0 search/1 !p
|
||||
0 search/1024 !p
|
||||
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
|
||||
>>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
|
||||
!:strength + 10
|
||||
|
||||
# Perl POD documents
|
||||
# From: Tom Hukins <tom@eborcom.com>
|
||||
0 search/1/W \=pod\n Perl POD document text
|
||||
0 search/1/W \n\=pod\n Perl POD document text
|
||||
0 search/1/W \=head1\ Perl POD document text
|
||||
0 search/1/W \n\=head1\ Perl POD document text
|
||||
0 search/1/W \=head2\ Perl POD document text
|
||||
0 search/1/W \n\=head2\ Perl POD document text
|
||||
0 search/1/W \=encoding\ Perl POD document text
|
||||
0 search/1/W \n\=encoding\ Perl POD document text
|
||||
0 search/1024/W \=pod\n Perl POD document text
|
||||
0 search/1024/W \n\=pod\n Perl POD document text
|
||||
0 search/1024/W \=head1\ Perl POD document text
|
||||
0 search/1024/W \n\=head1\ Perl POD document text
|
||||
0 search/1024/W \=head2\ Perl POD document text
|
||||
0 search/1024/W \n\=head2\ Perl POD document text
|
||||
0 search/1024/W \=encoding\ Perl POD document text
|
||||
0 search/1024/W \n\=encoding\ Perl POD document text
|
||||
|
||||
|
||||
# Perl Storable data files.
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: riff,v 1.30 2014/09/23 17:02:12 christos Exp $
|
||||
# $File: riff,v 1.31 2015/02/14 17:30:03 christos Exp $
|
||||
# riff: file(1) magic for RIFF format
|
||||
# See
|
||||
#
|
||||
@ -230,6 +230,7 @@
|
||||
# AMV-type AVI file: http://wiki.multimedia.cx/index.php?title=AMV
|
||||
>8 string AMV\040 \b, AMV
|
||||
>8 string WEBP \b, Web/P image
|
||||
!:mime image/webp
|
||||
>>12 use riff-walk
|
||||
|
||||
#
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: sereal,v 1.2 2014/11/11 20:10:49 christos Exp $
|
||||
# $File: sereal,v 1.3 2015/02/05 19:14:45 christos Exp $
|
||||
# sereal: file(1) magic the Sereal binary serialization format
|
||||
#
|
||||
# From: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
|
||||
@ -16,10 +16,20 @@
|
||||
#
|
||||
# See https://github.com/Sereal/Sereal/commit/35372ae01d in the
|
||||
# Sereal.git repository for test Sereal data.
|
||||
0 string \=srl Sereal data
|
||||
0 name sereal
|
||||
>4 byte&0x0F x (version %d,
|
||||
>4 byte&0xF0 0x00 uncompressed)
|
||||
>4 byte&0xF0 0x10 compressed with non-incremental Snappy)
|
||||
>4 byte&0xF0 0x20 compressed with incremental Snappy)
|
||||
>4 byte&0xF0 >0x20 unknown subformat, flag: %d>>4)
|
||||
|
||||
0 string/b \=srl Sereal data packet
|
||||
!:mime application/sereal
|
||||
>4 byte&0x0F x (version %d,
|
||||
>4 byte&0xF0 0x00 uncompressed)
|
||||
>4 byte&0xF0 0x10 compressed with non-incremental Snappy)
|
||||
>4 byte&0xF0 0x20 compressed with incremental Snappy)
|
||||
>4 byte&0xF0 >0x20 unknown subformat, flag: %d>>4)
|
||||
>&0 use sereal
|
||||
0 string/b \=\xF3rl Sereal data packet
|
||||
!:mime application/sereal
|
||||
>&0 use sereal
|
||||
0 string/b \=\xC3\xB3rl Sereal data packet, UTF-8 encoded
|
||||
!:mime application/sereal
|
||||
>&0 use sereal
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: sgml,v 1.30 2013/12/21 14:27:24 christos Exp $
|
||||
# $File: sgml,v 1.31 2015/03/11 19:38:04 christos Exp $
|
||||
# Type: SVG Vectorial Graphics
|
||||
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
|
||||
0 string \<?xml\ version="
|
||||
@ -44,24 +44,44 @@
|
||||
0 search/4096/cWt \<!doctype\ html HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<head HTML document text
|
||||
|
||||
0 search/4096/cwt \<head\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<title HTML document text
|
||||
0 search/4096/cWt \<head\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<html HTML document text
|
||||
0 search/4096/cwt \<title\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<script HTML document text
|
||||
0 search/4096/cWt \<title\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<style HTML document text
|
||||
0 search/4096/cwt \<html\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<table HTML document text
|
||||
0 search/4096/cWt \<html\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<script\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cWt \<script\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<style\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cWt \<style\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cwt \<table\> HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
0 search/4096/cWt \<table\ HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
|
||||
0 search/4096/cwt \<a\ href= HTML document text
|
||||
!:mime text/html
|
||||
!:strength + 5
|
||||
|
@ -1,38 +1,30 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: varied.script,v 1.10 2014/03/01 22:32:39 christos Exp $
|
||||
# $File: varied.script,v 1.11 2015/03/27 17:59:39 christos Exp $
|
||||
# varied.script: file(1) magic for various interpreter scripts
|
||||
|
||||
0 string/t #!\ / a
|
||||
>3 string >\0 %s script text executable
|
||||
!:strength / 2
|
||||
|
||||
0 string/b #!\ / a
|
||||
>3 string >\0 %s script executable (binary data)
|
||||
!:strength / 2
|
||||
|
||||
0 string/t #!\t/ a
|
||||
>3 string >\0 %s script text executable
|
||||
!:strength / 2
|
||||
|
||||
0 string/b #!\t/ a
|
||||
>3 string >\0 %s script executable (binary data)
|
||||
!:strength / 2
|
||||
|
||||
0 string/t #!/ a
|
||||
>2 string >\0 %s script text executable
|
||||
!:strength / 2
|
||||
|
||||
0 string/b #!/ a
|
||||
>2 string >\0 %s script executable (binary data)
|
||||
!:strength / 2
|
||||
|
||||
0 string/t #!\ script text executable
|
||||
>3 string >\0 for %s
|
||||
!:strength / 3
|
||||
|
||||
0 string/b #!\ script executable
|
||||
>3 string >\0 for %s (binary data)
|
||||
!:strength / 3
|
||||
|
||||
# using env
|
||||
0 string/t #!/usr/bin/env a
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: vorbis,v 1.20 2014/09/23 16:35:08 christos Exp $
|
||||
# $File: vorbis,v 1.22 2015/03/28 15:14:55 christos Exp $
|
||||
# vorbis: file(1) magic for Ogg/Vorbis files
|
||||
#
|
||||
# From Felix von Leitner <leitner@fefe.de>
|
||||
@ -47,8 +47,8 @@
|
||||
# non-Vorbis content: Skeleton
|
||||
>>28 string fishead\0 \b, Skeleton
|
||||
!:mime video/ogg
|
||||
>>>36 short x v%u
|
||||
>>>40 short x \b.%u
|
||||
>>>36 leshort x v%u
|
||||
>>>40 leshort x \b.%u
|
||||
# non-Vorbis content: Speex
|
||||
>>28 string Speex\ \ \ \b, Speex audio
|
||||
!:mime audio/ogg
|
||||
@ -122,3 +122,25 @@
|
||||
>>>>>>(84.b+117) string 20020717 (1.0)
|
||||
>>>>>>(84.b+117) string 20030909 (1.0.1)
|
||||
>>>>>>(84.b+117) string 20040629 (1.1.0 RC1)
|
||||
|
||||
# non-Vorbis content: Opus https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
|
||||
>>28 string OpusHead \b, Opus audio,
|
||||
!:mime audio/ogg
|
||||
>>>36 ubyte >0x0F UNKNOWN VERSION %u,
|
||||
>>>36 ubyte &0x0F version 0.%d
|
||||
>>>>46 ubyte >1
|
||||
>>>>>46 ubyte !255 unknown channel mapping family %u,
|
||||
>>>>>37 ubyte x %u channels
|
||||
>>>>46 ubyte 0
|
||||
>>>>>37 ubyte 1 mono
|
||||
>>>>>37 ubyte 2 stereo
|
||||
>>>>46 ubyte 1
|
||||
>>>>>37 ubyte 1 mono
|
||||
>>>>>37 ubyte 2 stereo
|
||||
>>>>>37 ubyte 3 linear surround
|
||||
>>>>>37 ubyte 4 quadraphonic
|
||||
>>>>>37 ubyte 5 5.0 surround
|
||||
>>>>>37 ubyte 6 5.1 surround
|
||||
>>>>>37 ubyte 7 6.1 surround
|
||||
>>>>>37 ubyte 8 7.1 surround
|
||||
>>>>40 lelong !0 \b, %u Hz
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $File: Makefile.am,v 1.101 2014/12/12 16:48:39 christos Exp $
|
||||
# $File: Makefile.am,v 1.103 2015/03/17 15:15:12 christos Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@ -42,6 +42,7 @@ $(MAGIC_FRAGMENT_DIR)/c-lang \
|
||||
$(MAGIC_FRAGMENT_DIR)/c64 \
|
||||
$(MAGIC_FRAGMENT_DIR)/cad \
|
||||
$(MAGIC_FRAGMENT_DIR)/cafebabe \
|
||||
$(MAGIC_FRAGMENT_DIR)/cbor \
|
||||
$(MAGIC_FRAGMENT_DIR)/cddb \
|
||||
$(MAGIC_FRAGMENT_DIR)/chord \
|
||||
$(MAGIC_FRAGMENT_DIR)/cisco \
|
||||
@ -160,6 +161,7 @@ $(MAGIC_FRAGMENT_DIR)/msx \
|
||||
$(MAGIC_FRAGMENT_DIR)/msvc \
|
||||
$(MAGIC_FRAGMENT_DIR)/mup \
|
||||
$(MAGIC_FRAGMENT_DIR)/music \
|
||||
$(MAGIC_FRAGMENT_DIR)/nasa \
|
||||
$(MAGIC_FRAGMENT_DIR)/natinst \
|
||||
$(MAGIC_FRAGMENT_DIR)/ncr \
|
||||
$(MAGIC_FRAGMENT_DIR)/neko \
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -15,7 +15,17 @@
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -78,7 +88,6 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = magic
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
|
||||
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 \
|
||||
@ -86,6 +95,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -139,6 +149,7 @@ am__uninstall_files_from_dir = { \
|
||||
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
|
||||
DATA = $(pkgdata_DATA)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
@ -262,7 +273,7 @@ top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
#
|
||||
# $File: Makefile.am,v 1.101 2014/12/12 16:48:39 christos Exp $
|
||||
# $File: Makefile.am,v 1.103 2015/03/17 15:15:12 christos Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@ -303,6 +314,7 @@ $(MAGIC_FRAGMENT_DIR)/c-lang \
|
||||
$(MAGIC_FRAGMENT_DIR)/c64 \
|
||||
$(MAGIC_FRAGMENT_DIR)/cad \
|
||||
$(MAGIC_FRAGMENT_DIR)/cafebabe \
|
||||
$(MAGIC_FRAGMENT_DIR)/cbor \
|
||||
$(MAGIC_FRAGMENT_DIR)/cddb \
|
||||
$(MAGIC_FRAGMENT_DIR)/chord \
|
||||
$(MAGIC_FRAGMENT_DIR)/cisco \
|
||||
@ -421,6 +433,7 @@ $(MAGIC_FRAGMENT_DIR)/msx \
|
||||
$(MAGIC_FRAGMENT_DIR)/msvc \
|
||||
$(MAGIC_FRAGMENT_DIR)/mup \
|
||||
$(MAGIC_FRAGMENT_DIR)/music \
|
||||
$(MAGIC_FRAGMENT_DIR)/nasa \
|
||||
$(MAGIC_FRAGMENT_DIR)/natinst \
|
||||
$(MAGIC_FRAGMENT_DIR)/ncr \
|
||||
$(MAGIC_FRAGMENT_DIR)/neko \
|
||||
@ -555,7 +568,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign magic/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign magic/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -755,6 +767,8 @@ uninstall-am: uninstall-pkgdataDATA
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags-am uninstall uninstall-am uninstall-pkgdataDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
|
||||
@rm -fr magic
|
||||
|
6
missing
6
missing
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2012-06-26.16; # UTC
|
||||
scriptversion=2013-10-28.13; # UTC
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -160,7 +160,7 @@ give_advice ()
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'automa4te' program to be rebuilt."
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,7 +14,17 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -77,7 +87,6 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = python
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
|
||||
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 \
|
||||
@ -85,6 +94,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -109,6 +119,7 @@ am__can_run_installinfo = \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in README
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
@ -246,7 +257,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign python/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -421,6 +431,8 @@ uninstall-am:
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -17,7 +17,17 @@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -81,10 +91,6 @@ build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = file$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ctime_r.c \
|
||||
vasprintf.c asctime_r.c asprintf.c strcasestr.c pread.c \
|
||||
getline.c strlcpy.c strlcat.c fmtcheck.c getopt_long.c \
|
||||
$(top_srcdir)/depcomp $(include_HEADERS)
|
||||
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 \
|
||||
@ -92,6 +98,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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 $(include_HEADERS) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -205,6 +213,10 @@ am__define_uniq_tagged_files = \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
|
||||
asctime_r.c asprintf.c ctime_r.c fmtcheck.c getline.c \
|
||||
getopt_long.c gmtime_r.c localtime_r.c pread.c strcasestr.c \
|
||||
strlcat.c strlcpy.c vasprintf.c
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
@ -363,7 +375,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -485,6 +496,8 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fmtcheck.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gmtime_r.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/localtime_r.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasestr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcat.Plo@am__quote@
|
||||
@ -774,6 +787,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
magic.h: ${HDR}
|
||||
sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.229 2015/01/01 17:07:34 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.233 2015/06/10 00:57:41 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -149,6 +149,7 @@ private int get_op(char);
|
||||
private int parse_mime(struct magic_set *, struct magic_entry *, const char *);
|
||||
private int parse_strength(struct magic_set *, struct magic_entry *, const char *);
|
||||
private int parse_apple(struct magic_set *, struct magic_entry *, const char *);
|
||||
private int parse_ext(struct magic_set *, struct magic_entry *, const char *);
|
||||
|
||||
|
||||
private size_t magicsize = sizeof(struct magic);
|
||||
@ -163,6 +164,7 @@ private struct {
|
||||
#define DECLARE_FIELD(name) { # name, sizeof(# name) - 1, parse_ ## name }
|
||||
DECLARE_FIELD(mime),
|
||||
DECLARE_FIELD(apple),
|
||||
DECLARE_FIELD(ext),
|
||||
DECLARE_FIELD(strength),
|
||||
#undef DECLARE_FIELD
|
||||
{ NULL, 0, NULL }
|
||||
@ -964,8 +966,9 @@ apprentice_list(struct mlist *mlist, int mode)
|
||||
*ml->magic[magindex].mimetype == '\0')
|
||||
magindex++;
|
||||
|
||||
printf("Strength = %3" SIZE_T_FORMAT "u : %s [%s]\n",
|
||||
printf("Strength = %3" SIZE_T_FORMAT "u@%u: %s [%s]\n",
|
||||
apprentice_magic_strength(m),
|
||||
ml->magic[magindex].lineno,
|
||||
ml->magic[magindex].desc,
|
||||
ml->magic[magindex].mimetype);
|
||||
}
|
||||
@ -1839,15 +1842,19 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
}
|
||||
}
|
||||
/* Indirect offsets are not valid at level 0. */
|
||||
if (m->cont_level == 0 && (m->flag & (OFFADD | INDIROFFADD)))
|
||||
if (m->cont_level == 0 && (m->flag & (OFFADD | INDIROFFADD))) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "relative offset at level 0");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* get offset, then skip over it */
|
||||
m->offset = (uint32_t)strtoul(l, &t, 0);
|
||||
if (l == t)
|
||||
if (l == t) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "offset `%s' invalid", l);
|
||||
return -1;
|
||||
}
|
||||
l = t;
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@ -1903,7 +1910,7 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
file_magwarn(ms,
|
||||
"indirect offset type `%c' invalid",
|
||||
*l);
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
l++;
|
||||
}
|
||||
@ -1923,17 +1930,21 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
}
|
||||
if (isdigit((unsigned char)*l) || *l == '-') {
|
||||
m->in_offset = (int32_t)strtol(l, &t, 0);
|
||||
if (l == t)
|
||||
if (l == t) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms,
|
||||
"in_offset `%s' invalid", l);
|
||||
return -1;
|
||||
}
|
||||
l = t;
|
||||
}
|
||||
if (*l++ != ')' ||
|
||||
((m->in_op & FILE_OPINDIRECT) && *l++ != ')'))
|
||||
((m->in_op & FILE_OPINDIRECT) && *l++ != ')')) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms,
|
||||
"missing ')' in indirect offset");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
EATAB;
|
||||
|
||||
@ -2199,7 +2210,7 @@ parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
size_t i;
|
||||
const char *l = line;
|
||||
struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
|
||||
char *buf = (char *)m + off;
|
||||
char *buf = CAST(char *, CAST(void *, m)) + off;
|
||||
|
||||
if (buf[0] != '\0') {
|
||||
len = nt ? strlen(buf) : len;
|
||||
@ -2248,10 +2259,24 @@ parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
|
||||
{
|
||||
struct magic *m = &me->mp[0];
|
||||
|
||||
return parse_extra(ms, me, line, offsetof(struct magic, apple),
|
||||
return parse_extra(ms, me, line,
|
||||
CAST(off_t, offsetof(struct magic, apple)),
|
||||
sizeof(m->apple), "APPLE", "!+-./", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a comma-separated list of extensions
|
||||
*/
|
||||
private int
|
||||
parse_ext(struct magic_set *ms, struct magic_entry *me, const char *line)
|
||||
{
|
||||
struct magic *m = &me->mp[0];
|
||||
|
||||
return parse_extra(ms, me, line,
|
||||
CAST(off_t, offsetof(struct magic, ext)),
|
||||
sizeof(m->ext), "EXTENSION", ",!+-/", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* parse a MIME annotation line from magic file, put into magic[index - 1]
|
||||
* if valid
|
||||
@ -2261,7 +2286,8 @@ parse_mime(struct magic_set *ms, struct magic_entry *me, const char *line)
|
||||
{
|
||||
struct magic *m = &me->mp[0];
|
||||
|
||||
return parse_extra(ms, me, line, offsetof(struct magic, mimetype),
|
||||
return parse_extra(ms, me, line,
|
||||
CAST(off_t, offsetof(struct magic, mimetype)),
|
||||
sizeof(m->mimetype), "MIME", "+-/.", 1);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.91 2014/11/28 02:46:39 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.92 2015/04/09 20:01:41 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -79,7 +79,7 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
const char *code_mime = NULL;
|
||||
const char *type = NULL;
|
||||
|
||||
if (ms->flags & MAGIC_APPLE)
|
||||
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
|
||||
return 0;
|
||||
|
||||
nbytes = trim_nuls(buf, nbytes);
|
||||
@ -123,7 +123,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
|
||||
size_t last_line_end = (size_t)-1;
|
||||
int has_long_lines = 0;
|
||||
|
||||
if (ms->flags & MAGIC_APPLE)
|
||||
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
|
||||
return 0;
|
||||
|
||||
nbytes = trim_nuls(buf, nbytes);
|
||||
|
126
src/cdf.c
126
src/cdf.c
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.69 2014/12/04 15:56:46 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.76 2015/02/28 00:18:02 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@ -73,8 +73,11 @@ static union {
|
||||
#define CDF_TOLE8(x) ((uint64_t)(NEED_SWAP ? _cdf_tole8(x) : (uint64_t)(x)))
|
||||
#define CDF_TOLE4(x) ((uint32_t)(NEED_SWAP ? _cdf_tole4(x) : (uint32_t)(x)))
|
||||
#define CDF_TOLE2(x) ((uint16_t)(NEED_SWAP ? _cdf_tole2(x) : (uint16_t)(x)))
|
||||
#define CDF_TOLE(x) (sizeof(x) == 2 ? CDF_TOLE2(x) : (sizeof(x) == 4 ? \
|
||||
CDF_TOLE4(x) : CDF_TOLE8(x)))
|
||||
#define CDF_TOLE(x) (/*CONSTCOND*/sizeof(x) == 2 ? \
|
||||
CDF_TOLE2(CAST(uint16_t, x)) : \
|
||||
(/*CONSTCOND*/sizeof(x) == 4 ? \
|
||||
CDF_TOLE4(CAST(uint32_t, x)) : \
|
||||
CDF_TOLE8(CAST(uint64_t, x))))
|
||||
#define CDF_GETUINT32(x, y) cdf_getuint32(x, y)
|
||||
|
||||
|
||||
@ -271,7 +274,7 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
const char *e = ((const char *)p) + tail;
|
||||
size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
|
||||
CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
|
||||
(void)&line;
|
||||
/*LINTED*/(void)&line;
|
||||
if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
|
||||
return 0;
|
||||
DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
|
||||
@ -744,26 +747,35 @@ cdf_read_user_stream(const cdf_info_t *info, const cdf_header_t *h,
|
||||
const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
|
||||
const cdf_dir_t *dir, const char *name, cdf_stream_t *scn)
|
||||
{
|
||||
size_t i;
|
||||
const cdf_directory_t *d;
|
||||
size_t name_len = strlen(name) + 1;
|
||||
int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
|
||||
|
||||
for (i = dir->dir_len; i > 0; i--)
|
||||
if (dir->dir_tab[i - 1].d_type == CDF_DIR_TYPE_USER_STREAM &&
|
||||
cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
|
||||
== 0)
|
||||
break;
|
||||
|
||||
if (i == 0) {
|
||||
DPRINTF(("Cannot find user stream `%s'\n", name));
|
||||
errno = ESRCH;
|
||||
if (i <= 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
d = &dir->dir_tab[i - 1];
|
||||
return cdf_read_sector_chain(info, h, sat, ssat, sst,
|
||||
d->d_stream_first_sector, d->d_size, scn);
|
||||
}
|
||||
|
||||
int
|
||||
cdf_find_stream(const cdf_dir_t *dir, const char *name, int type)
|
||||
{
|
||||
size_t i, name_len = strlen(name) + 1;
|
||||
|
||||
for (i = dir->dir_len; i > 0; i--)
|
||||
if (dir->dir_tab[i - 1].d_type == type &&
|
||||
cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
|
||||
== 0)
|
||||
break;
|
||||
if (i > 0)
|
||||
return i;
|
||||
|
||||
DPRINTF(("Cannot find type %d `%s'\n", type, name));
|
||||
errno = ESRCH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)
|
||||
@ -998,9 +1010,13 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
}
|
||||
|
||||
|
||||
#define extract_catalog_field(f, l) \
|
||||
memcpy(&ce[i].f, b + (l), sizeof(ce[i].f)); \
|
||||
ce[i].f = CDF_TOLE(ce[i].f)
|
||||
#define extract_catalog_field(t, f, l) \
|
||||
if (b + l + sizeof(cep->f) > eb) { \
|
||||
cep->ce_namlen = 0; \
|
||||
break; \
|
||||
} \
|
||||
memcpy(&cep->f, b + (l), sizeof(cep->f)); \
|
||||
ce[i].f = CAST(t, CDF_TOLE(cep->f))
|
||||
|
||||
int
|
||||
cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
|
||||
@ -1010,40 +1026,58 @@ cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
|
||||
CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
|
||||
const char *b = CAST(const char *, sst->sst_tab);
|
||||
const char *eb = b + ss * sst->sst_len;
|
||||
size_t nr, i, k;
|
||||
size_t nr, i, j, k;
|
||||
cdf_catalog_entry_t *ce;
|
||||
uint16_t reclen;
|
||||
const uint16_t *np;
|
||||
|
||||
for (nr = 0; b < eb; nr++) {
|
||||
for (nr = 0;; nr++) {
|
||||
memcpy(&reclen, b, sizeof(reclen));
|
||||
reclen = CDF_TOLE2(reclen);
|
||||
if (reclen == 0)
|
||||
break;
|
||||
b += reclen;
|
||||
if (b > eb)
|
||||
break;
|
||||
}
|
||||
nr--;
|
||||
*cat = CAST(cdf_catalog_t *,
|
||||
malloc(sizeof(cdf_catalog_t) + nr * sizeof(*ce)));
|
||||
(*cat)->cat_num = nr;
|
||||
ce = (*cat)->cat_e;
|
||||
memset(ce, 0, nr * sizeof(*ce));
|
||||
b = CAST(const char *, sst->sst_tab);
|
||||
for (i = 0; i < nr; i++) {
|
||||
extract_catalog_field(ce_namlen, 0);
|
||||
extract_catalog_field(ce_num, 2);
|
||||
extract_catalog_field(ce_timestamp, 6);
|
||||
reclen = ce[i].ce_namlen;
|
||||
ce[i].ce_namlen =
|
||||
sizeof(ce[i].ce_name) / sizeof(ce[i].ce_name[0]) - 1;
|
||||
if (ce[i].ce_namlen > reclen - 14)
|
||||
ce[i].ce_namlen = reclen - 14;
|
||||
np = CAST(const uint16_t *, (b + 16));
|
||||
for (k = 0; k < ce[i].ce_namlen; k++) {
|
||||
ce[i].ce_name[k] = np[k];
|
||||
CDF_TOLE2(ce[i].ce_name[k]);
|
||||
for (j = i = 0; i < nr; b += reclen) {
|
||||
cdf_catalog_entry_t *cep = &ce[j];
|
||||
uint16_t rlen;
|
||||
|
||||
extract_catalog_field(uint16_t, ce_namlen, 0);
|
||||
extract_catalog_field(uint16_t, ce_num, 4);
|
||||
extract_catalog_field(uint64_t, ce_timestamp, 8);
|
||||
reclen = cep->ce_namlen;
|
||||
|
||||
if (reclen < 14) {
|
||||
cep->ce_namlen = 0;
|
||||
continue;
|
||||
}
|
||||
ce[i].ce_name[ce[i].ce_namlen] = 0;
|
||||
b += reclen;
|
||||
|
||||
cep->ce_namlen = __arraycount(cep->ce_name) - 1;
|
||||
rlen = reclen - 14;
|
||||
if (cep->ce_namlen > rlen)
|
||||
cep->ce_namlen = rlen;
|
||||
|
||||
np = CAST(const uint16_t *, CAST(const void *, (b + 16)));
|
||||
if (CAST(const char *, np + cep->ce_namlen) > eb) {
|
||||
cep->ce_namlen = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (k = 0; k < cep->ce_namlen; k++)
|
||||
cep->ce_name[k] = np[k]; /* XXX: CDF_TOLE2? */
|
||||
cep->ce_name[cep->ce_namlen] = 0;
|
||||
j = i;
|
||||
i++;
|
||||
}
|
||||
(*cat)->cat_num = j;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1188,11 +1222,12 @@ cdf_dump_sat(const char *prefix, const cdf_sat_t *sat, size_t size)
|
||||
}
|
||||
|
||||
void
|
||||
cdf_dump(void *v, size_t len)
|
||||
cdf_dump(const void *v, size_t len)
|
||||
{
|
||||
size_t i, j;
|
||||
unsigned char *p = v;
|
||||
const unsigned char *p = v;
|
||||
char abuf[16];
|
||||
|
||||
(void)fprintf(stderr, "%.4x: ", 0);
|
||||
for (i = 0, j = 0; i < len; i++, p++) {
|
||||
(void)fprintf(stderr, "%.2x ", *p);
|
||||
@ -1327,10 +1362,10 @@ cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
|
||||
cdf_print_elapsed_time(buf, sizeof(buf), tp);
|
||||
(void)fprintf(stderr, "timestamp %s\n", buf);
|
||||
} else {
|
||||
char buf[26];
|
||||
char tbuf[26];
|
||||
cdf_timestamp_to_timespec(&ts, tp);
|
||||
(void)fprintf(stderr, "timestamp %s",
|
||||
cdf_ctime(&ts.tv_sec, buf));
|
||||
cdf_ctime(&ts.tv_sec, tbuf));
|
||||
}
|
||||
break;
|
||||
case CDF_CLIPBOARD:
|
||||
@ -1401,7 +1436,10 @@ main(int argc, char *argv[])
|
||||
cdf_dir_t dir;
|
||||
cdf_info_t info;
|
||||
const cdf_directory_t *root;
|
||||
|
||||
#ifdef __linux__
|
||||
#define getprogname() __progname
|
||||
extern char *__progname;
|
||||
#endif
|
||||
if (argc < 2) {
|
||||
(void)fprintf(stderr, "Usage: %s <filename>\n", getprogname());
|
||||
return -1;
|
||||
@ -1453,8 +1491,8 @@ main(int argc, char *argv[])
|
||||
else
|
||||
cdf_dump_summary_info(&h, &scn);
|
||||
#endif
|
||||
if (cdf_read_catalog(&info, &h, &sat, &ssat, &sst, &dir,
|
||||
&scn) == -1)
|
||||
if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst,
|
||||
&dir, "Catalog", &scn) == -1)
|
||||
warn("Cannot read catalog");
|
||||
#ifdef CDF_DEBUG
|
||||
else
|
||||
|
@ -314,12 +314,7 @@ int cdf_read_property_info(const cdf_stream_t *, const cdf_header_t *, uint32_t,
|
||||
int cdf_read_user_stream(const cdf_info_t *, const cdf_header_t *,
|
||||
const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
|
||||
const cdf_dir_t *, const char *, cdf_stream_t *);
|
||||
#define cdf_read_catalog(info, header, sat, ssat, stream, dir, scn) \
|
||||
cdf_read_user_stream(info, header, sat, ssat, stream, dir, "Catalog", \
|
||||
scn)
|
||||
#define cdf_read_encrypted_package(info, header, sat, ssat, stream, dir, scn) \
|
||||
cdf_read_user_stream(info, header, sat, ssat, stream, dir, \
|
||||
"EncryptedPackage", scn)
|
||||
int cdf_find_stream(const cdf_dir_t *, const char *, int);
|
||||
int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
|
||||
const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
|
||||
const cdf_dir_t *, cdf_stream_t *);
|
||||
@ -339,7 +334,7 @@ char *cdf_u16tos8(char *, size_t, const uint16_t *);
|
||||
#ifdef CDF_DEBUG
|
||||
void cdf_dump_header(const cdf_header_t *);
|
||||
void cdf_dump_sat(const char *, const cdf_sat_t *, size_t);
|
||||
void cdf_dump(void *, size_t);
|
||||
void cdf_dump(const void *, size_t);
|
||||
void cdf_dump_stream(const cdf_header_t *, const cdf_stream_t *);
|
||||
void cdf_dump_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
|
||||
const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.80 2015/06/03 18:21:24 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@ -45,7 +45,12 @@ FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $")
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
# ifndef HAVE_SIG_T
|
||||
typedef void (*sig_t)(int);
|
||||
# endif /* HAVE_SIG_T */
|
||||
#endif
|
||||
#if !defined(__MINGW32__) && !defined(WIN32)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
@ -104,12 +109,16 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||
size_t i, nsz;
|
||||
int rv = 0;
|
||||
int mime = ms->flags & MAGIC_MIME;
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
sig_t osigpipe;
|
||||
#endif
|
||||
|
||||
if ((ms->flags & MAGIC_COMPRESS) == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
osigpipe = signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
for (i = 0; i < ncompr; i++) {
|
||||
if (nbytes < compr[i].maglen)
|
||||
continue;
|
||||
@ -121,7 +130,8 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||
if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
|
||||
goto error;
|
||||
|
||||
if (mime == MAGIC_MIME || mime == 0) {
|
||||
if ((ms->flags & MAGIC_COMPRESS_TRANSP) == 0 &&
|
||||
(mime == MAGIC_MIME || mime == 0)) {
|
||||
if (file_printf(ms, mime ?
|
||||
" compressed-encoding=" : " (") == -1)
|
||||
goto error;
|
||||
@ -136,7 +146,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||
}
|
||||
}
|
||||
error:
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
(void)signal(SIGPIPE, osigpipe);
|
||||
#endif
|
||||
free(newbuf);
|
||||
ms->flags |= MAGIC_COMPRESS;
|
||||
return rv;
|
||||
@ -383,7 +395,6 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
|
||||
int fdin[2], fdout[2];
|
||||
int status;
|
||||
ssize_t r;
|
||||
pid_t pid;
|
||||
|
||||
#ifdef BUILTIN_DECOMPRESS
|
||||
/* FIXME: This doesn't cope with bzip2 */
|
||||
@ -397,7 +408,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
|
||||
file_error(ms, errno, "cannot create pipe");
|
||||
return NODATA;
|
||||
}
|
||||
switch (pid = fork()) {
|
||||
switch (fork()) {
|
||||
case 0: /* child */
|
||||
(void) close(0);
|
||||
if (fd != -1) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.10 2014/09/11 12:08:52 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.13 2015/06/04 19:16:28 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -47,6 +47,7 @@ FILE_RCSID("@(#)$File: encoding.c,v 1.10 2014/09/11 12:08:52 christos Exp $")
|
||||
private int looks_ascii(const unsigned char *, size_t, unichar *, size_t *);
|
||||
private int looks_utf8_with_BOM(const unsigned char *, size_t, unichar *,
|
||||
size_t *);
|
||||
private int looks_utf7(const unsigned char *, size_t, unichar *, size_t *);
|
||||
private int looks_ucs16(const unsigned char *, size_t, unichar *, size_t *);
|
||||
private int looks_latin1(const unsigned char *, size_t, unichar *, size_t *);
|
||||
private int looks_extended(const unsigned char *, size_t, unichar *, size_t *);
|
||||
@ -88,9 +89,15 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
|
||||
}
|
||||
|
||||
if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
|
||||
DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
|
||||
*code = "ASCII";
|
||||
*code_mime = "us-ascii";
|
||||
if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
|
||||
DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
|
||||
*code = "UTF-7 Unicode";
|
||||
*code_mime = "utf-7";
|
||||
} else {
|
||||
DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
|
||||
*code = "ASCII";
|
||||
*code_mime = "us-ascii";
|
||||
}
|
||||
} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
|
||||
DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
|
||||
*code = "UTF-8 Unicode (with BOM)";
|
||||
@ -199,8 +206,8 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
|
||||
#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
|
||||
|
||||
private char text_chars[256] = {
|
||||
/* BEL BS HT LF FF CR */
|
||||
F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */
|
||||
/* BEL BS HT LF VT FF CR */
|
||||
F, F, F, F, F, F, F, T, T, T, T, T, T, T, F, F, /* 0x0X */
|
||||
/* ESC */
|
||||
F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */
|
||||
T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */
|
||||
@ -371,6 +378,25 @@ looks_utf8_with_BOM(const unsigned char *buf, size_t nbytes, unichar *ubuf,
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int
|
||||
looks_utf7(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen)
|
||||
{
|
||||
if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
|
||||
switch (buf[3]) {
|
||||
case '8':
|
||||
case '9':
|
||||
case '+':
|
||||
case '/':
|
||||
if (ubuf)
|
||||
*ulen = 0;
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int
|
||||
looks_ucs16(const unsigned char *buf, size_t nbytes, unichar *ubuf,
|
||||
size_t *ulen)
|
||||
|
26
src/file.c
26
src/file.c
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.160 2014/12/16 23:18:40 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.164 2015/06/03 18:21:24 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -68,14 +68,14 @@ int getopt_long(int argc, char * const *argv, const char *optstring, const struc
|
||||
#endif
|
||||
|
||||
#ifdef S_IFLNK
|
||||
#define FILE_FLAGS "-bcEhikLlNnprsvz0"
|
||||
#define FILE_FLAGS "-bcEhikLlNnprsvzZ0"
|
||||
#else
|
||||
#define FILE_FLAGS "-bcEiklNnprsvz0"
|
||||
#define FILE_FLAGS "-bcEiklNnprsvzZ0"
|
||||
#endif
|
||||
|
||||
# define USAGE \
|
||||
"Usage: %s [" FILE_FLAGS \
|
||||
"] [--apple] [--mime-encoding] [--mime-type]\n" \
|
||||
"] [--apple] [--extension] [--mime-encoding] [--mime-type]\n" \
|
||||
" [-e testname] [-F separator] [-f namefile] [-m magicfiles] " \
|
||||
"file ...\n" \
|
||||
" %s -C [-m magicfiles]\n" \
|
||||
@ -98,7 +98,7 @@ private const struct option long_options[] = {
|
||||
#undef OPT_LONGONLY
|
||||
{0, 0, NULL, 0}
|
||||
};
|
||||
#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvz0"
|
||||
#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvzZ0"
|
||||
|
||||
private const struct {
|
||||
const char *name;
|
||||
@ -130,8 +130,14 @@ private struct {
|
||||
|
||||
private char *progname; /* used throughout */
|
||||
|
||||
#ifdef __dead
|
||||
__dead
|
||||
#endif
|
||||
private void usage(void);
|
||||
private void docprint(const char *);
|
||||
#ifdef __dead
|
||||
__dead
|
||||
#endif
|
||||
private void help(void);
|
||||
|
||||
private int unwrap(struct magic_set *, const char *);
|
||||
@ -185,9 +191,12 @@ main(int argc, char *argv[])
|
||||
flags |= MAGIC_APPLE;
|
||||
break;
|
||||
case 11:
|
||||
flags |= MAGIC_MIME_TYPE;
|
||||
flags |= MAGIC_EXTENSION;
|
||||
break;
|
||||
case 12:
|
||||
flags |= MAGIC_MIME_TYPE;
|
||||
break;
|
||||
case 13:
|
||||
flags |= MAGIC_MIME_ENCODING;
|
||||
break;
|
||||
}
|
||||
@ -262,7 +271,6 @@ main(int argc, char *argv[])
|
||||
case 'r':
|
||||
flags |= MAGIC_RAW;
|
||||
break;
|
||||
break;
|
||||
case 's':
|
||||
flags |= MAGIC_DEVICES;
|
||||
break;
|
||||
@ -276,6 +284,10 @@ main(int argc, char *argv[])
|
||||
case 'z':
|
||||
flags |= MAGIC_COMPRESS;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
flags |= MAGIC_COMPRESS|MAGIC_COMPRESS_TRANSP;
|
||||
break;
|
||||
#ifdef S_IFLNK
|
||||
case 'L':
|
||||
flags |= MAGIC_SYMLINK;
|
||||
|
21
src/file.h
21
src/file.h
@ -27,7 +27,7 @@
|
||||
*/
|
||||
/*
|
||||
* file.h - definitions for file(1) program
|
||||
* @(#)$File: file.h,v 1.164 2015/01/01 17:07:34 christos Exp $
|
||||
* @(#)$File: file.h,v 1.168 2015/04/09 20:01:41 christos Exp $
|
||||
*/
|
||||
|
||||
#ifndef __file_h__
|
||||
@ -126,7 +126,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef HOWMANY
|
||||
# define HOWMANY (256 * 1024) /* how much of the file to look at */
|
||||
# define HOWMANY (1024 * 1024) /* how much of the file to look at */
|
||||
#endif
|
||||
#define MAXMAGIS 8192 /* max entries in any one magic file
|
||||
or directory */
|
||||
@ -135,8 +135,8 @@
|
||||
#define MAXstring 64 /* max len of "string" types */
|
||||
|
||||
#define MAGICNO 0xF11E041C
|
||||
#define VERSIONNO 12
|
||||
#define FILE_MAGICSIZE 248
|
||||
#define VERSIONNO 13
|
||||
#define FILE_MAGICSIZE 312
|
||||
|
||||
#define FILE_LOAD 0
|
||||
#define FILE_CHECK 1
|
||||
@ -307,7 +307,9 @@ struct magic {
|
||||
/* Words 33-52 */
|
||||
char mimetype[MAXMIME]; /* MIME type */
|
||||
/* Words 53-54 */
|
||||
char apple[8];
|
||||
char apple[8]; /* APPLE CREATOR/TYPE */
|
||||
/* Words 55-63 */
|
||||
char ext[64]; /* Popular extensions */
|
||||
};
|
||||
|
||||
#define BIT(A) (1 << (A))
|
||||
@ -564,6 +566,12 @@ char *ctime_r(const time_t *, char *);
|
||||
#ifndef HAVE_ASCTIME_R
|
||||
char *asctime_r(const struct tm *, char *);
|
||||
#endif
|
||||
#ifndef HAVE_GMTIME_R
|
||||
struct tm *gmtime_r(const time_t *, struct tm *);
|
||||
#endif
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
struct tm *localtime_r(const time_t *, struct tm *);
|
||||
#endif
|
||||
#ifndef HAVE_FMTCHECK
|
||||
const char *fmtcheck(const char *, const char *)
|
||||
__attribute__((__format_arg__(2)));
|
||||
@ -590,5 +598,8 @@ static const char *rcsid(const char *p) { \
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
#endif
|
||||
#ifndef __RCSID
|
||||
#define __RCSID(a)
|
||||
#endif
|
||||
|
||||
#endif /* __file_h__ */
|
||||
|
@ -17,6 +17,7 @@ OPT('v', "version", 0, " output version information and exit\n")
|
||||
OPT('m', "magic-file", 1, " LIST use LIST as a colon-separated list of magic\n"
|
||||
" number files\n")
|
||||
OPT('z', "uncompress", 0, " try to look inside compressed files\n")
|
||||
OPT('Z', "uncompress-noreport", 0, " only print the contents of compressed files\n")
|
||||
OPT('b', "brief", 0, " do not prepend filenames to output lines\n")
|
||||
OPT('c', "checking-printout", 0, " print the parsed form of the magic file, use in\n"
|
||||
" conjunction with -m to debug a new magic file\n"
|
||||
@ -29,6 +30,7 @@ OPT('F', "separator", 1, " STRING use string as separator instead of `:'\n")
|
||||
OPT('i', "mime", 0, " output MIME type strings (--mime-type and\n"
|
||||
" --mime-encoding)\n")
|
||||
OPT_LONGONLY("apple", 0, " output the Apple CREATOR/TYPE\n")
|
||||
OPT_LONGONLY("extension", 0, " output a slash-separated list of extnsions\n")
|
||||
OPT_LONGONLY("mime-type", 0, " output the MIME type\n")
|
||||
OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n")
|
||||
OPT('k', "keep-going", 0, " don't stop at the first match\n")
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: fsmagic.c,v 1.75 2014/12/04 15:56:46 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: fsmagic.c,v 1.76 2015/04/09 20:01:41 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -110,7 +110,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
|
||||
struct stat tstatbuf;
|
||||
#endif
|
||||
|
||||
if (ms->flags & MAGIC_APPLE)
|
||||
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
|
||||
return 0;
|
||||
if (fn == NULL)
|
||||
return 0;
|
||||
|
36
src/funcs.c
36
src/funcs.c
@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.79 2014/12/16 20:52:49 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.82 2015/06/03 18:01:20 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -159,8 +159,20 @@ file_badread(struct magic_set *ms)
|
||||
}
|
||||
|
||||
#ifndef COMPILE_ONLY
|
||||
|
||||
static int
|
||||
checkdone(struct magic_set *ms, int *rv)
|
||||
{
|
||||
if ((ms->flags & MAGIC_CONTINUE) == 0)
|
||||
return 1;
|
||||
if (file_printf(ms, "\n- ") == -1)
|
||||
*rv = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
protected int
|
||||
file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unused)),
|
||||
file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__unused__)),
|
||||
const void *buf, size_t nb)
|
||||
{
|
||||
int m = 0, rv = 0, looks_text = 0;
|
||||
@ -214,7 +226,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
|
||||
if ((m = file_is_tar(ms, ubuf, nb)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "tar %d\n", m);
|
||||
goto done;
|
||||
if (checkdone(ms, &rv))
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check if we have a CDF file */
|
||||
@ -222,7 +235,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
|
||||
if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "cdf %d\n", m);
|
||||
goto done;
|
||||
if (checkdone(ms, &rv))
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* try soft magic tests */
|
||||
@ -249,7 +263,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
|
||||
"elf %d\n", m);
|
||||
}
|
||||
#endif
|
||||
goto done;
|
||||
if (checkdone(ms, &rv))
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* try text properties */
|
||||
@ -258,7 +273,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unu
|
||||
if ((m = file_ascmagic(ms, ubuf, nb, looks_text)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "ascmagic %d\n", m);
|
||||
goto done;
|
||||
if (checkdone(ms, &rv))
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,7 +416,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
|
||||
size_t len;
|
||||
|
||||
if (level >= ms->c.len) {
|
||||
len = (ms->c.len += 20) * sizeof(*ms->c.li);
|
||||
len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
|
||||
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
|
||||
malloc(len) :
|
||||
realloc(ms->c.li, len));
|
||||
@ -549,9 +565,9 @@ file_printable(char *buf, size_t bufsiz, const char *str)
|
||||
if (ptr >= eptr - 3)
|
||||
break;
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = ((*s >> 6) & 7) + '0';
|
||||
*ptr++ = ((*s >> 3) & 7) + '0';
|
||||
*ptr++ = ((*s >> 0) & 7) + '0';
|
||||
*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
|
||||
*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
|
||||
*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
|
||||
}
|
||||
*ptr = '\0';
|
||||
return buf;
|
||||
|
19
src/gmtime_r.c
Normal file
19
src/gmtime_r.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* $File: gmtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $ */
|
||||
|
||||
#include "file.h"
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: gmtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $")
|
||||
#endif /* lint */
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/* asctime_r is not thread-safe anyway */
|
||||
struct tm *
|
||||
gmtime_r(const time_t t, struct tm *tm)
|
||||
{
|
||||
struct tm *tmp = gmtime(t);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
memcpy(tm, tmp, sizeof(*tm));
|
||||
return tmp;
|
||||
}
|
@ -40,7 +40,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.37 2010/11/30 14:58:53 rrt Exp $")
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.38 2015/04/09 20:01:41 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@ -69,7 +69,7 @@ file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
|
||||
int tar;
|
||||
int mime = ms->flags & MAGIC_MIME;
|
||||
|
||||
if ((ms->flags & MAGIC_APPLE) != 0)
|
||||
if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
|
||||
return 0;
|
||||
|
||||
tar = is_tar(buf, nbytes);
|
||||
|
19
src/localtime_r.c
Normal file
19
src/localtime_r.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* $File: localtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $ */
|
||||
|
||||
#include "file.h"
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: localtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $")
|
||||
#endif /* lint */
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/* asctime_r is not thread-safe anyway */
|
||||
struct tm *
|
||||
localtime_r(const time_t t, struct tm *tm)
|
||||
{
|
||||
struct tm *tmp = localtime(t);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
memcpy(tm, tmp, sizeof(*tm));
|
||||
return tmp;
|
||||
}
|
166
src/magic.c
166
src/magic.c
@ -33,7 +33,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: magic.c,v 1.91 2014/12/16 23:18:40 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: magic.c,v 1.93 2015/04/15 23:47:58 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -83,6 +83,86 @@ private const char *file_or_fd(struct magic_set *, const char *, int);
|
||||
#define STDIN_FILENO 0
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
/* HINSTANCE of this shared library. Needed for get_default_magic() */
|
||||
static HINSTANCE _w32_dll_instance = NULL;
|
||||
|
||||
static void
|
||||
_w32_append_path(char **hmagicpath, const char *fmt, ...)
|
||||
{
|
||||
char *tmppath;
|
||||
char *newpath;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (vasprintf(&tmppath, fmt, ap) < 0) {
|
||||
va_end(ap);
|
||||
return;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
if (access(tmppath, R_OK) == -1)
|
||||
goto out;
|
||||
|
||||
if (*hmagicpath == NULL) {
|
||||
*hmagicpath = tmppath;
|
||||
return;
|
||||
}
|
||||
|
||||
if (asprintf(&newpath, "%s%c%s", *hmagicpath, PATHSEP, tmppath) < 0)
|
||||
goto out;
|
||||
|
||||
free(*hmagicpath);
|
||||
free(tmppath);
|
||||
*hmagicpath = newpath;
|
||||
return;
|
||||
out:
|
||||
free(tmppath);
|
||||
}
|
||||
|
||||
static void
|
||||
_w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
|
||||
{
|
||||
static const char *trypaths[] = {
|
||||
"%s/share/misc/magic.mgc",
|
||||
"%s/magic.mgc",
|
||||
};
|
||||
LPSTR dllpath;
|
||||
size_t sp;
|
||||
|
||||
dllpath = calloc(MAX_PATH + 1, sizeof(*dllpath));
|
||||
|
||||
if (!GetModuleFileNameA(module, dllpath, MAX_PATH))
|
||||
goto out;
|
||||
|
||||
PathRemoveFileSpecA(dllpath);
|
||||
|
||||
sp = strlen(dllpath);
|
||||
if (sp > 3 && stricmp(&dllpath[sp - 3], "bin") == 0) {
|
||||
_w32_append_path(hmagicpath,
|
||||
"%s/../share/misc/magic.mgc", dllpath);
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (sp = 0; sp < __arraycount(trypaths); sp++)
|
||||
_w32_append_path(hmagicpath, trypaths[sp], dllpath);
|
||||
out:
|
||||
free(dllpath);
|
||||
}
|
||||
|
||||
/* Placate GCC by offering a sacrificial previous prototype */
|
||||
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||
LPVOID lpvReserved __attribute__((__unused__)))
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
_w32_dll_instance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
private const char *
|
||||
get_default_magic(void)
|
||||
{
|
||||
@ -126,75 +206,33 @@ get_default_magic(void)
|
||||
free(hmagicpath);
|
||||
return MAGIC;
|
||||
#else
|
||||
char *hmagicp;
|
||||
char *tmppath = NULL;
|
||||
LPTSTR dllpath;
|
||||
hmagicpath = NULL;
|
||||
|
||||
#define APPENDPATH() \
|
||||
do { \
|
||||
if (tmppath && access(tmppath, R_OK) != -1) { \
|
||||
if (hmagicpath == NULL) \
|
||||
hmagicpath = tmppath; \
|
||||
else { \
|
||||
if (asprintf(&hmagicp, "%s%c%s", hmagicpath, \
|
||||
PATHSEP, tmppath) >= 0) { \
|
||||
free(hmagicpath); \
|
||||
hmagicpath = hmagicp; \
|
||||
} \
|
||||
free(tmppath); \
|
||||
} \
|
||||
tmppath = NULL; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
if (default_magic) {
|
||||
free(default_magic);
|
||||
default_magic = NULL;
|
||||
}
|
||||
|
||||
/* First, try to get user-specific magic file */
|
||||
if ((home = getenv("LOCALAPPDATA")) == NULL) {
|
||||
if ((home = getenv("USERPROFILE")) != NULL)
|
||||
if (asprintf(&tmppath,
|
||||
"%s/Local Settings/Application Data%s", home,
|
||||
hmagic) < 0)
|
||||
tmppath = NULL;
|
||||
} else {
|
||||
if (asprintf(&tmppath, "%s%s", home, hmagic) < 0)
|
||||
tmppath = NULL;
|
||||
}
|
||||
/* First, try to get a magic file from user-application data */
|
||||
if ((home = getenv("LOCALAPPDATA")) != NULL)
|
||||
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
|
||||
|
||||
APPENDPATH();
|
||||
/* Second, try to get a magic file from the user profile data */
|
||||
if ((home = getenv("USERPROFILE")) != NULL)
|
||||
_w32_append_path(&hmagicpath,
|
||||
"%s/Local Settings/Application Data%s", home, hmagic);
|
||||
|
||||
/* Second, try to get a magic file from Common Files */
|
||||
if ((home = getenv("COMMONPROGRAMFILES")) != NULL) {
|
||||
if (asprintf(&tmppath, "%s%s", home, hmagic) >= 0)
|
||||
APPENDPATH();
|
||||
}
|
||||
/* Third, try to get a magic file from Common Files */
|
||||
if ((home = getenv("COMMONPROGRAMFILES")) != NULL)
|
||||
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
|
||||
|
||||
/* Third, try to get magic file relative to dll location */
|
||||
dllpath = malloc(sizeof(*dllpath) * (MAX_PATH + 1));
|
||||
dllpath[MAX_PATH] = 0; /* just in case long path gets truncated and not null terminated */
|
||||
if (GetModuleFileNameA(NULL, dllpath, MAX_PATH)){
|
||||
PathRemoveFileSpecA(dllpath);
|
||||
if (strlen(dllpath) > 3 &&
|
||||
stricmp(&dllpath[strlen(dllpath) - 3], "bin") == 0) {
|
||||
if (asprintf(&tmppath,
|
||||
"%s/../share/misc/magic.mgc", dllpath) >= 0)
|
||||
APPENDPATH();
|
||||
} else {
|
||||
if (asprintf(&tmppath,
|
||||
"%s/share/misc/magic.mgc", dllpath) >= 0)
|
||||
APPENDPATH();
|
||||
else if (asprintf(&tmppath,
|
||||
"%s/magic.mgc", dllpath) >= 0)
|
||||
APPENDPATH();
|
||||
}
|
||||
}
|
||||
/* Fourth, try to get magic file relative to exe location */
|
||||
_w32_get_magic_relative_to(&hmagicpath, NULL);
|
||||
|
||||
/* Don't put MAGIC constant - it likely points to a file within MSys
|
||||
tree */
|
||||
/* Fifth, try to get magic file relative to dll location */
|
||||
_w32_get_magic_relative_to(&hmagicpath, _w32_dll_instance);
|
||||
|
||||
/* Avoid MAGIC constant - it likely points to a file within MSys tree */
|
||||
default_magic = hmagicpath;
|
||||
return default_magic;
|
||||
#endif
|
||||
@ -543,19 +581,19 @@ magic_setparam(struct magic_set *ms, int param, const void *val)
|
||||
{
|
||||
switch (param) {
|
||||
case MAGIC_PARAM_INDIR_MAX:
|
||||
ms->indir_max = *(const size_t *)val;
|
||||
ms->indir_max = (uint16_t)*(const size_t *)val;
|
||||
return 0;
|
||||
case MAGIC_PARAM_NAME_MAX:
|
||||
ms->name_max = *(const size_t *)val;
|
||||
ms->name_max = (uint16_t)*(const size_t *)val;
|
||||
return 0;
|
||||
case MAGIC_PARAM_ELF_PHNUM_MAX:
|
||||
ms->elf_phnum_max = *(const size_t *)val;
|
||||
ms->elf_phnum_max = (uint16_t)*(const size_t *)val;
|
||||
return 0;
|
||||
case MAGIC_PARAM_ELF_SHNUM_MAX:
|
||||
ms->elf_shnum_max = *(const size_t *)val;
|
||||
ms->elf_shnum_max = (uint16_t)*(const size_t *)val;
|
||||
return 0;
|
||||
case MAGIC_PARAM_ELF_NOTES_MAX:
|
||||
ms->elf_notes_max = *(const size_t *)val;
|
||||
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
|
||||
return 0;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
|
51
src/magic.h
51
src/magic.h
@ -29,30 +29,35 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAGIC_NONE 0x000000 /* No flags */
|
||||
#define MAGIC_DEBUG 0x000001 /* Turn on debugging */
|
||||
#define MAGIC_SYMLINK 0x000002 /* Follow symlinks */
|
||||
#define MAGIC_COMPRESS 0x000004 /* Check inside compressed files */
|
||||
#define MAGIC_DEVICES 0x000008 /* Look at the contents of devices */
|
||||
#define MAGIC_MIME_TYPE 0x000010 /* Return the MIME type */
|
||||
#define MAGIC_CONTINUE 0x000020 /* Return all matches */
|
||||
#define MAGIC_CHECK 0x000040 /* Print warnings to stderr */
|
||||
#define MAGIC_PRESERVE_ATIME 0x000080 /* Restore access time on exit */
|
||||
#define MAGIC_RAW 0x000100 /* Don't translate unprintable chars */
|
||||
#define MAGIC_ERROR 0x000200 /* Handle ENOENT etc as real errors */
|
||||
#define MAGIC_MIME_ENCODING 0x000400 /* Return the MIME encoding */
|
||||
#define MAGIC_NONE 0x0000000 /* No flags */
|
||||
#define MAGIC_DEBUG 0x0000001 /* Turn on debugging */
|
||||
#define MAGIC_SYMLINK 0x0000002 /* Follow symlinks */
|
||||
#define MAGIC_COMPRESS 0x0000004 /* Check inside compressed files */
|
||||
#define MAGIC_DEVICES 0x0000008 /* Look at the contents of devices */
|
||||
#define MAGIC_MIME_TYPE 0x0000010 /* Return the MIME type */
|
||||
#define MAGIC_CONTINUE 0x0000020 /* Return all matches */
|
||||
#define MAGIC_CHECK 0x0000040 /* Print warnings to stderr */
|
||||
#define MAGIC_PRESERVE_ATIME 0x0000080 /* Restore access time on exit */
|
||||
#define MAGIC_RAW 0x0000100 /* Don't convert unprintable chars */
|
||||
#define MAGIC_ERROR 0x0000200 /* Handle ENOENT etc as real errors */
|
||||
#define MAGIC_MIME_ENCODING 0x0000400 /* Return the MIME encoding */
|
||||
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
|
||||
#define MAGIC_APPLE 0x000800 /* Return the Apple creator and type */
|
||||
#define MAGIC_APPLE 0x0000800 /* Return the Apple creator/type */
|
||||
#define MAGIC_EXTENSION 0x1000000 /* Return a /-separated list of
|
||||
* extensions */
|
||||
#define MAGIC_COMPRESS_TRANSP 0x2000000 /* Check inside compressed files
|
||||
* but not report compression */
|
||||
#define MAGIC_NODESC (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
|
||||
|
||||
#define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
|
||||
#define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */
|
||||
#define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */
|
||||
#define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */
|
||||
#define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */
|
||||
#define MAGIC_NO_CHECK_TEXT 0x020000 /* Don't check for text files */
|
||||
#define MAGIC_NO_CHECK_CDF 0x040000 /* Don't check for cdf files */
|
||||
#define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check tokens */
|
||||
#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
|
||||
#define MAGIC_NO_CHECK_COMPRESS 0x0001000 /* Don't check for compressed files */
|
||||
#define MAGIC_NO_CHECK_TAR 0x0002000 /* Don't check for tar files */
|
||||
#define MAGIC_NO_CHECK_SOFT 0x0004000 /* Don't check magic entries */
|
||||
#define MAGIC_NO_CHECK_APPTYPE 0x0008000 /* Don't check application type */
|
||||
#define MAGIC_NO_CHECK_ELF 0x0010000 /* Don't check for elf details */
|
||||
#define MAGIC_NO_CHECK_TEXT 0x0020000 /* Don't check for text files */
|
||||
#define MAGIC_NO_CHECK_CDF 0x0040000 /* Don't check for cdf files */
|
||||
#define MAGIC_NO_CHECK_TOKENS 0x0100000 /* Don't check tokens */
|
||||
#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
|
||||
|
||||
/* No built-in tests; only consult the magic file */
|
||||
#define MAGIC_NO_CHECK_BUILTIN ( \
|
||||
@ -75,7 +80,7 @@
|
||||
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
|
||||
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
|
||||
|
||||
#define MAGIC_VERSION 521 /* This implementation */
|
||||
#define MAGIC_VERSION 522 /* This implementation */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,30 +29,35 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAGIC_NONE 0x000000 /* No flags */
|
||||
#define MAGIC_DEBUG 0x000001 /* Turn on debugging */
|
||||
#define MAGIC_SYMLINK 0x000002 /* Follow symlinks */
|
||||
#define MAGIC_COMPRESS 0x000004 /* Check inside compressed files */
|
||||
#define MAGIC_DEVICES 0x000008 /* Look at the contents of devices */
|
||||
#define MAGIC_MIME_TYPE 0x000010 /* Return the MIME type */
|
||||
#define MAGIC_CONTINUE 0x000020 /* Return all matches */
|
||||
#define MAGIC_CHECK 0x000040 /* Print warnings to stderr */
|
||||
#define MAGIC_PRESERVE_ATIME 0x000080 /* Restore access time on exit */
|
||||
#define MAGIC_RAW 0x000100 /* Don't translate unprintable chars */
|
||||
#define MAGIC_ERROR 0x000200 /* Handle ENOENT etc as real errors */
|
||||
#define MAGIC_MIME_ENCODING 0x000400 /* Return the MIME encoding */
|
||||
#define MAGIC_NONE 0x0000000 /* No flags */
|
||||
#define MAGIC_DEBUG 0x0000001 /* Turn on debugging */
|
||||
#define MAGIC_SYMLINK 0x0000002 /* Follow symlinks */
|
||||
#define MAGIC_COMPRESS 0x0000004 /* Check inside compressed files */
|
||||
#define MAGIC_DEVICES 0x0000008 /* Look at the contents of devices */
|
||||
#define MAGIC_MIME_TYPE 0x0000010 /* Return the MIME type */
|
||||
#define MAGIC_CONTINUE 0x0000020 /* Return all matches */
|
||||
#define MAGIC_CHECK 0x0000040 /* Print warnings to stderr */
|
||||
#define MAGIC_PRESERVE_ATIME 0x0000080 /* Restore access time on exit */
|
||||
#define MAGIC_RAW 0x0000100 /* Don't convert unprintable chars */
|
||||
#define MAGIC_ERROR 0x0000200 /* Handle ENOENT etc as real errors */
|
||||
#define MAGIC_MIME_ENCODING 0x0000400 /* Return the MIME encoding */
|
||||
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
|
||||
#define MAGIC_APPLE 0x000800 /* Return the Apple creator and type */
|
||||
#define MAGIC_APPLE 0x0000800 /* Return the Apple creator/type */
|
||||
#define MAGIC_EXTENSION 0x1000000 /* Return a /-separated list of
|
||||
* extensions */
|
||||
#define MAGIC_COMPRESS_TRANSP 0x2000000 /* Check inside compressed files
|
||||
* but not report compression */
|
||||
#define MAGIC_NODESC (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
|
||||
|
||||
#define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
|
||||
#define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */
|
||||
#define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */
|
||||
#define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */
|
||||
#define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */
|
||||
#define MAGIC_NO_CHECK_TEXT 0x020000 /* Don't check for text files */
|
||||
#define MAGIC_NO_CHECK_CDF 0x040000 /* Don't check for cdf files */
|
||||
#define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check tokens */
|
||||
#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
|
||||
#define MAGIC_NO_CHECK_COMPRESS 0x0001000 /* Don't check for compressed files */
|
||||
#define MAGIC_NO_CHECK_TAR 0x0002000 /* Don't check for tar files */
|
||||
#define MAGIC_NO_CHECK_SOFT 0x0004000 /* Don't check magic entries */
|
||||
#define MAGIC_NO_CHECK_APPTYPE 0x0008000 /* Don't check application type */
|
||||
#define MAGIC_NO_CHECK_ELF 0x0010000 /* Don't check for elf details */
|
||||
#define MAGIC_NO_CHECK_TEXT 0x0020000 /* Don't check for text files */
|
||||
#define MAGIC_NO_CHECK_CDF 0x0040000 /* Don't check for cdf files */
|
||||
#define MAGIC_NO_CHECK_TOKENS 0x0100000 /* Don't check tokens */
|
||||
#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
|
||||
|
||||
/* No built-in tests; only consult the magic file */
|
||||
#define MAGIC_NO_CHECK_BUILTIN ( \
|
||||
|
40
src/print.c
40
src/print.c
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: print.c,v 1.79 2015/01/09 19:28:32 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include <string.h>
|
||||
@ -164,6 +164,7 @@ file_mdump(struct magic *m)
|
||||
case FILE_MELDATE:
|
||||
(void)fprintf(stderr, "%s,",
|
||||
file_fmttime(m->value.l, 0, tbuf));
|
||||
break;
|
||||
case FILE_QDATE:
|
||||
case FILE_LEQDATE:
|
||||
case FILE_BEQDATE:
|
||||
@ -231,40 +232,27 @@ protected const char *
|
||||
file_fmttime(uint64_t v, int flags, char *buf)
|
||||
{
|
||||
char *pp;
|
||||
time_t t = (time_t)v;
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
struct tm *tm, tmz;
|
||||
|
||||
if (flags & FILE_T_WINDOWS) {
|
||||
struct timespec ts;
|
||||
cdf_timestamp_to_timespec(&ts, t);
|
||||
cdf_timestamp_to_timespec(&ts, v);
|
||||
t = ts.tv_sec;
|
||||
} else {
|
||||
// XXX: perhaps detect and print something if overflow
|
||||
// on 32 bit time_t?
|
||||
t = (time_t)v;
|
||||
}
|
||||
|
||||
if (flags & FILE_T_LOCAL) {
|
||||
pp = ctime_r(&t, buf);
|
||||
tm = localtime_r(&t, &tmz);
|
||||
} else {
|
||||
#ifndef HAVE_DAYLIGHT
|
||||
private int daylight = 0;
|
||||
#ifdef HAVE_TM_ISDST
|
||||
private time_t now = (time_t)0;
|
||||
|
||||
if (now == (time_t)0) {
|
||||
struct tm *tm1;
|
||||
(void)time(&now);
|
||||
tm1 = localtime(&now);
|
||||
if (tm1 == NULL)
|
||||
goto out;
|
||||
daylight = tm1->tm_isdst;
|
||||
}
|
||||
#endif /* HAVE_TM_ISDST */
|
||||
#endif /* HAVE_DAYLIGHT */
|
||||
if (daylight)
|
||||
t += 3600;
|
||||
tm = gmtime(&t);
|
||||
if (tm == NULL)
|
||||
goto out;
|
||||
pp = asctime_r(tm, buf);
|
||||
tm = gmtime_r(&t, &tmz);
|
||||
}
|
||||
if (tm == NULL)
|
||||
goto out;
|
||||
pp = asctime_r(tm, buf);
|
||||
|
||||
if (pp == NULL)
|
||||
goto out;
|
||||
|
142
src/readcdf.c
142
src/readcdf.c
@ -26,7 +26,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.49 2014/12/04 15:56:46 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.53 2015/04/09 20:01:41 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@ -39,6 +39,10 @@ FILE_RCSID("@(#)$File: readcdf.c,v 1.49 2014/12/04 15:56:46 christos Exp $")
|
||||
#include "cdf.h"
|
||||
#include "magic.h"
|
||||
|
||||
#ifndef __arraycount
|
||||
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
|
||||
|
||||
static const struct nv {
|
||||
@ -96,6 +100,10 @@ cdf_clsid_to_mime(const uint64_t clsid[2], const struct cv *cv)
|
||||
if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
|
||||
return cv[i].mime;
|
||||
}
|
||||
#ifdef CDF_DEBUG
|
||||
fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
|
||||
clsid[1]);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -117,6 +125,9 @@ cdf_app_to_mime(const char *vbuf, const struct nv *nv)
|
||||
rv = nv[i].mime;
|
||||
break;
|
||||
}
|
||||
#ifdef CDF_DEBUG
|
||||
fprintf(stderr, "unknown app %s\n", vbuf);
|
||||
#endif
|
||||
#ifdef USE_C_LOCALE
|
||||
(void)uselocale(old_lc_ctype);
|
||||
freelocale(c_lc_ctype);
|
||||
@ -343,6 +354,90 @@ format_clsid(char *buf, size_t len, const uint64_t uuid[2]) {
|
||||
}
|
||||
#endif
|
||||
|
||||
private int
|
||||
cdf_file_catalog_info(struct magic_set *ms, const cdf_info_t *info,
|
||||
const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat,
|
||||
const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((i = cdf_read_user_stream(info, h, sat, ssat, sst,
|
||||
dir, "Catalog", scn)) == -1)
|
||||
return i;
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_catalog(&h, &scn);
|
||||
#endif
|
||||
if ((i = cdf_file_catalog(ms, h, scn)) == -1)
|
||||
return -1;
|
||||
return i;
|
||||
}
|
||||
|
||||
private struct sinfo {
|
||||
const char *name;
|
||||
const char *mime;
|
||||
const char *sections[5];
|
||||
const int types[5];
|
||||
} sectioninfo[] = {
|
||||
{ "Encrypted", "encrypted",
|
||||
{
|
||||
"EncryptedPackage", NULL, NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
CDF_DIR_TYPE_USER_STREAM, 0, 0, 0, 0,
|
||||
|
||||
},
|
||||
},
|
||||
{ "QuickBooks", "quickbooks",
|
||||
{
|
||||
#if 0
|
||||
"TaxForms", "PDFTaxForms", "modulesInBackup",
|
||||
#endif
|
||||
"mfbu_header", NULL, NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
#if 0
|
||||
CDF_DIR_TYPE_USER_STORAGE,
|
||||
CDF_DIR_TYPE_USER_STORAGE,
|
||||
CDF_DIR_TYPE_USER_STREAM,
|
||||
#endif
|
||||
CDF_DIR_TYPE_USER_STREAM,
|
||||
0, 0, 0, 0
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
private int
|
||||
cdf_file_dir_info(struct magic_set *ms, const cdf_dir_t *dir)
|
||||
{
|
||||
size_t sd, j;
|
||||
|
||||
for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
|
||||
const struct sinfo *si = §ioninfo[sd];
|
||||
for (j = 0; si->sections[j]; j++) {
|
||||
if (cdf_find_stream(dir, si->sections[j], si->types[j])
|
||||
<= 0) {
|
||||
#ifdef CDF_DEBUG
|
||||
fprintf(stderr, "Can't read %s\n",
|
||||
si->sections[j]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (si->sections[j] != NULL)
|
||||
continue;
|
||||
if (NOTMIME(ms)) {
|
||||
if (file_printf(ms, "CDFV2 %s", si->name) == -1)
|
||||
return -1;
|
||||
} else {
|
||||
if (file_printf(ms, "application/CDFV2-%s",
|
||||
si->mime) == -1)
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int
|
||||
file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
size_t nbytes)
|
||||
@ -354,13 +449,12 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
cdf_dir_t dir;
|
||||
int i;
|
||||
const char *expn = "";
|
||||
const char *corrupt = "corrupt: ";
|
||||
const cdf_directory_t *root_storage;
|
||||
|
||||
info.i_fd = fd;
|
||||
info.i_buf = buf;
|
||||
info.i_len = nbytes;
|
||||
if (ms->flags & MAGIC_APPLE)
|
||||
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
|
||||
return 0;
|
||||
if (cdf_read_header(&info, &h) == -1)
|
||||
return 0;
|
||||
@ -435,30 +529,21 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
|
||||
if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
|
||||
&scn)) == -1) {
|
||||
if (errno == ESRCH) {
|
||||
if ((i = cdf_read_catalog(&info, &h, &sat, &ssat, &sst,
|
||||
&dir, &scn)) == -1) {
|
||||
corrupt = expn;
|
||||
if ((i = cdf_read_encrypted_package(&info, &h,
|
||||
&sat, &ssat, &sst, &dir, &scn)) == -1)
|
||||
expn = "No summary info";
|
||||
else {
|
||||
expn = "Encrypted";
|
||||
i = -1;
|
||||
}
|
||||
goto out4;
|
||||
}
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_catalog(&h, &scn);
|
||||
#endif
|
||||
if ((i = cdf_file_catalog(ms, &h, &scn))
|
||||
< 0)
|
||||
expn = "Can't expand catalog";
|
||||
} else {
|
||||
if (errno != ESRCH) {
|
||||
expn = "Cannot read summary info";
|
||||
}
|
||||
goto out4;
|
||||
}
|
||||
goto out4;
|
||||
}
|
||||
i = cdf_file_catalog_info(ms, &info, &h, &sat, &ssat, &sst,
|
||||
&dir, &scn);
|
||||
if (i > 0)
|
||||
goto out4;
|
||||
i = cdf_file_dir_info(ms, &dir);
|
||||
if (i < 0)
|
||||
expn = "Cannot read section info";
|
||||
goto out4;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_summary_info(&h, &scn);
|
||||
#endif
|
||||
@ -509,11 +594,10 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
"Composite Document File V2 Document") == -1)
|
||||
return -1;
|
||||
if (*expn)
|
||||
if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
|
||||
if (file_printf(ms, ", %s", expn) == -1)
|
||||
return -1;
|
||||
} else {
|
||||
if (file_printf(ms, "application/CDFV2-%s",
|
||||
*corrupt ? "corrupt" : "encrypted") == -1)
|
||||
if (file_printf(ms, "application/CDFV2-unknown") == -1)
|
||||
return -1;
|
||||
}
|
||||
i = 1;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.117 2014/12/16 23:29:42 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.119 2015/04/09 20:01:41 christos Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef BUILTIN_ELF
|
||||
@ -482,6 +482,7 @@ do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
|
||||
}
|
||||
|
||||
private int
|
||||
/*ARGSUSED*/
|
||||
do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
int swap __attribute__((__unused__)), uint32_t namesz, uint32_t descsz,
|
||||
size_t noff, size_t doff, int *flags)
|
||||
@ -622,7 +623,7 @@ do_pax_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < __arraycount(pax); i++) {
|
||||
if (((1 << i) & desc) == 0)
|
||||
if (((1 << (int)i) & desc) == 0)
|
||||
continue;
|
||||
if (file_printf(ms, "%s%s", did++ ? "," : "",
|
||||
pax[i]) == -1)
|
||||
@ -1008,7 +1009,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
|
||||
}
|
||||
|
||||
/* Read offset of name section to be able to read section names later */
|
||||
if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) < (ssize_t)xsh_sizeof) {
|
||||
if (pread(fd, xsh_addr, xsh_sizeof, CAST(off_t, (off + size * strtab)))
|
||||
< (ssize_t)xsh_sizeof) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@ -1351,7 +1353,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
Elf64_Ehdr elf64hdr;
|
||||
uint16_t type, phnum, shnum, notecount;
|
||||
|
||||
if (ms->flags & (MAGIC_MIME|MAGIC_APPLE))
|
||||
if (ms->flags & (MAGIC_MIME|MAGIC_APPLE|MAGIC_EXTENSION))
|
||||
return 0;
|
||||
/*
|
||||
* ELF executables have multiple section headers in arbitrary
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.206 2015/01/01 17:07:34 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.216 2015/06/09 22:17:52 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -147,7 +147,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
|
||||
unsigned int cont_level = 0;
|
||||
int returnvalv = 0, e; /* if a match is found it is set to 1*/
|
||||
int firstline = 1; /* a flag to print X\n X\n- X */
|
||||
int print = (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0;
|
||||
int print = (ms->flags & MAGIC_NODESC) == 0;
|
||||
|
||||
if (returnval == NULL)
|
||||
returnval = &returnvalv;
|
||||
@ -361,6 +361,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
|
||||
if ((ms->flags & MAGIC_CONTINUE) == 0 && *printed_something) {
|
||||
return *returnval; /* don't keep searching */
|
||||
}
|
||||
cont_level = 0;
|
||||
}
|
||||
return *returnval; /* This is hit if -k is set or there is no match */
|
||||
}
|
||||
@ -518,7 +519,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
t = ms->offset + strlen(str);
|
||||
|
||||
if (*m->value.s == '\0')
|
||||
str[strcspn(str, "\n")] = '\0';
|
||||
str[strcspn(str, "\r\n")] = '\0';
|
||||
|
||||
if (m->str_flags & STRING_TRIM) {
|
||||
char *last;
|
||||
@ -547,7 +548,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_LEDATE:
|
||||
case FILE_MEDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_fmttime(p->l + m->num_mask, FILE_T_LOCAL, tbuf)) == -1)
|
||||
file_fmttime(p->l, 0, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint32_t);
|
||||
break;
|
||||
@ -557,7 +558,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_LELDATE:
|
||||
case FILE_MELDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_fmttime(p->l + m->num_mask, 0, tbuf)) == -1)
|
||||
file_fmttime(p->l, FILE_T_LOCAL, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint32_t);
|
||||
break;
|
||||
@ -566,7 +567,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEQDATE:
|
||||
case FILE_LEQDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_fmttime(p->q + m->num_mask, FILE_T_LOCAL, tbuf)) == -1)
|
||||
file_fmttime(p->q, 0, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
break;
|
||||
@ -575,7 +576,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEQLDATE:
|
||||
case FILE_LEQLDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_fmttime(p->q + m->num_mask, 0, tbuf)) == -1)
|
||||
file_fmttime(p->q, FILE_T_LOCAL, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
break;
|
||||
@ -584,14 +585,14 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEQWDATE:
|
||||
case FILE_LEQWDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_fmttime(p->q + m->num_mask, FILE_T_WINDOWS, tbuf)) == -1)
|
||||
file_fmttime(p->q, FILE_T_WINDOWS, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
break;
|
||||
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
vf = p->f;
|
||||
switch (check_fmt(ms, m)) {
|
||||
case -1:
|
||||
@ -609,9 +610,9 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
t = ms->offset + sizeof(float);
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
vd = p->d;
|
||||
switch (check_fmt(ms, m)) {
|
||||
case -1:
|
||||
@ -629,6 +630,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
t = ms->offset + sizeof(double);
|
||||
break;
|
||||
|
||||
case FILE_SEARCH:
|
||||
case FILE_REGEX: {
|
||||
char *cp;
|
||||
int rval;
|
||||
@ -652,16 +654,6 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
break;
|
||||
}
|
||||
|
||||
case FILE_SEARCH:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
file_printable(sbuf, sizeof(sbuf), m->value.s)) == -1)
|
||||
return -1;
|
||||
if ((m->str_flags & REGEX_OFFSET_START))
|
||||
t = ms->search.offset;
|
||||
else
|
||||
t = ms->search.offset + m->vallen;
|
||||
break;
|
||||
|
||||
case FILE_DEFAULT:
|
||||
case FILE_CLEAR:
|
||||
if (file_printf(ms, "%s", m->desc) == -1)
|
||||
@ -716,7 +708,7 @@ moffset(struct magic_set *ms, struct magic *m)
|
||||
uint32_t t;
|
||||
|
||||
if (*m->value.s == '\0')
|
||||
p->s[strcspn(p->s, "\n")] = '\0';
|
||||
p->s[strcspn(p->s, "\r\n")] = '\0';
|
||||
t = CAST(uint32_t, (ms->offset + strlen(p->s)));
|
||||
if (m->type == FILE_PSTRING)
|
||||
t += (uint32_t)file_pstring_length_size(m);
|
||||
@ -978,8 +970,7 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
case FILE_BELDATE:
|
||||
p->l = (int32_t)
|
||||
((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
|
||||
if (type == FILE_BELONG)
|
||||
cvt_32(p, m);
|
||||
cvt_32(p, m);
|
||||
return 1;
|
||||
case FILE_BEQUAD:
|
||||
case FILE_BEQDATE:
|
||||
@ -990,8 +981,7 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
|
||||
((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
|
||||
((uint64_t)p->hq[6]<<8)|((uint64_t)p->hq[7]));
|
||||
if (type == FILE_BEQUAD)
|
||||
cvt_64(p, m);
|
||||
cvt_64(p, m);
|
||||
return 1;
|
||||
case FILE_LESHORT:
|
||||
p->h = (short)((p->hs[1]<<8)|(p->hs[0]));
|
||||
@ -1002,8 +992,7 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
case FILE_LELDATE:
|
||||
p->l = (int32_t)
|
||||
((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
|
||||
if (type == FILE_LELONG)
|
||||
cvt_32(p, m);
|
||||
cvt_32(p, m);
|
||||
return 1;
|
||||
case FILE_LEQUAD:
|
||||
case FILE_LEQDATE:
|
||||
@ -1014,16 +1003,14 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
|
||||
((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
|
||||
((uint64_t)p->hq[1]<<8)|((uint64_t)p->hq[0]));
|
||||
if (type == FILE_LEQUAD)
|
||||
cvt_64(p, m);
|
||||
cvt_64(p, m);
|
||||
return 1;
|
||||
case FILE_MELONG:
|
||||
case FILE_MEDATE:
|
||||
case FILE_MELDATE:
|
||||
p->l = (int32_t)
|
||||
((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
|
||||
if (type == FILE_MELONG)
|
||||
cvt_32(p, m);
|
||||
cvt_32(p, m);
|
||||
return 1;
|
||||
case FILE_FLOAT:
|
||||
cvt_float(p, m);
|
||||
@ -1116,13 +1103,11 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
bytecnt = m->str_range;
|
||||
}
|
||||
|
||||
if (bytecnt == 0)
|
||||
bytecnt = 8192;
|
||||
if (bytecnt > nbytes)
|
||||
bytecnt = nbytes;
|
||||
if (bytecnt == 0 || bytecnt > nbytes - offset)
|
||||
bytecnt = nbytes - offset;
|
||||
|
||||
buf = RCAST(const char *, s) + offset;
|
||||
end = last = RCAST(const char *, s) + bytecnt;
|
||||
end = last = RCAST(const char *, s) + bytecnt + offset;
|
||||
/* mget() guarantees buf <= last */
|
||||
for (lines = linecnt, b = buf; lines && b < end &&
|
||||
((b = CAST(const char *,
|
||||
@ -1582,7 +1567,9 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ((((offset >> 0) & 0x7f) << 0) |
|
||||
(((offset >> 8) & 0x7f) << 7) |
|
||||
(((offset >> 16) & 0x7f) << 14) |
|
||||
(((offset >> 24) & 0x7f) << 21)) + 10;
|
||||
(((offset >> 24) & 0x7f) << 21));
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "id3 offs=%u\n", offset);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1666,7 +1653,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
|
||||
case FILE_INDIRECT:
|
||||
if (m->str_flags & INDIRECT_RELATIVE)
|
||||
offset += o;
|
||||
offset += CAST(uint32_t, o);
|
||||
if (offset == 0)
|
||||
return 0;
|
||||
|
||||
@ -1687,7 +1674,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
return -1;
|
||||
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
if ((ms->flags & MAGIC_NODESC) == 0 &&
|
||||
file_printf(ms, F(ms, m, "%u"), offset) == -1) {
|
||||
free(rbuf);
|
||||
return -1;
|
||||
@ -1721,9 +1708,11 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
printed_something, need_separator, returnval);
|
||||
if (rv != 1)
|
||||
*need_separator = oneed_separator;
|
||||
return rv;
|
||||
return 1;
|
||||
|
||||
case FILE_NAME:
|
||||
if (ms->flags & MAGIC_NODESC)
|
||||
return 1;
|
||||
if (file_printf(ms, "%s", m->desc) == -1)
|
||||
return -1;
|
||||
return 1;
|
||||
@ -1965,6 +1954,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
|
||||
m->str_flags);
|
||||
if (v == 0) { /* found match */
|
||||
ms->search.offset += idx;
|
||||
ms->search.rm_len = m->str_range - idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2148,6 +2138,11 @@ handle_annotation(struct magic_set *ms, struct magic *m)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
if (ms->flags & MAGIC_EXTENSION) {
|
||||
if (file_printf(ms, "%s", m->ext) == -1)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
|
||||
if (file_printf(ms, "%s", m->mimetype) == -1)
|
||||
return -1;
|
||||
@ -2159,7 +2154,7 @@ handle_annotation(struct magic_set *ms, struct magic *m)
|
||||
private int
|
||||
print_sep(struct magic_set *ms, int firstline)
|
||||
{
|
||||
if (ms->flags & MAGIC_MIME)
|
||||
if (ms->flags & MAGIC_NODESC)
|
||||
return 0;
|
||||
if (firstline)
|
||||
return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.14 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,7 +14,17 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
@ -78,8 +88,6 @@ build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
check_PROGRAMS = test$(EXEEXT)
|
||||
subdir = tests
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp README
|
||||
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 \
|
||||
@ -87,6 +95,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.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)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -158,6 +167,7 @@ am__define_uniq_tagged_files = \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
@ -306,7 +316,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign tests/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
@ -595,6 +604,8 @@ uninstall-am:
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
check-local:
|
||||
MAGIC=$(top_builddir)/magic/magic ./test
|
||||
for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
|
||||
|
Loading…
Reference in New Issue
Block a user