Vendor import of file 5.33
This commit is contained in:
parent
aa60f242e9
commit
1c37767822
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2018-04-15 14:52 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* release 5.33
|
||||
|
||||
2018-02-24 14:50 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* extend the support for ${x?:} expansions for magic descriptions
|
||||
|
||||
2018-02-21 16:25 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* add support for ${x?:} in mime types to handle
|
||||
pie binaries.
|
||||
|
||||
2017-11-03 9:23 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* add support for negative offsets (offsets from the end of file)
|
||||
|
||||
2017-09-26 8:22 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* close the file on error when writing magic (Steve Grubb)
|
||||
|
||||
2017-09-24 12:02 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* seccomp support (Paul Moore)
|
||||
|
||||
2017-09-02 11:53 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
* release 5.32
|
||||
|
115
Makefile.in
115
Makefile.in
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,61 +14,23 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -87,6 +49,11 @@ 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 \
|
||||
@ -94,8 +61,6 @@ 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
|
||||
@ -159,9 +124,6 @@ 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)
|
||||
@ -216,7 +178,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -232,7 +193,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -346,6 +306,7 @@ $(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*) \
|
||||
@ -366,8 +327,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@test -f $@ || rm -f stamp-h1
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
|
||||
@if test ! -f $@; then rm -f stamp-h1; else :; fi
|
||||
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
@ -396,12 +357,13 @@ distclean-libtool:
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
@ -576,16 +538,10 @@ dist-xz: distdir
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
@ -620,17 +576,16 @@ distcheck: dist
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
mkdir $(distdir)/_build $(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/sub \
|
||||
&& ../../configure \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
@ -807,8 +762,6 @@ 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.
|
||||
|
48
README
48
README
@ -1,13 +1,12 @@
|
||||
## README for file(1) Command ##
|
||||
|
||||
@(#) $File: README,v 1.50 2016/04/16 22:40:54 christos Exp $
|
||||
@(#) $File: README,v 1.53 2018/03/11 13:06:47 glen Exp $
|
||||
|
||||
Mailing List: file@mx.gw.com
|
||||
Mailing List archives: http://mx.gw.com/pipermail/file/
|
||||
Bug tracker: http://bugs.gw.com/
|
||||
Mailing List: file@mx.gw.com [currently down]
|
||||
Mailing List archives: http://mx.gw.com/pipermail/file/ [currently down]
|
||||
Bug tracker: http://bugs.gw.com/ [currently down]
|
||||
E-mail: christos@astron.com
|
||||
|
||||
[![Build Status](https://travis-ci.org/file/file.png?branch=master)](https://travis-ci.org/file/file)
|
||||
Build Status: https://travis-ci.org/file/file
|
||||
|
||||
Phone: Do not even think of telephoning me about this program. Send cash first!
|
||||
|
||||
@ -67,28 +66,6 @@ in magic(5) format please, to the maintainer, Christos Zoulas.
|
||||
COPYING - read this first.
|
||||
README - read this second (you are currently reading this file).
|
||||
INSTALL - read on how to install
|
||||
src/localtime_r.c
|
||||
src/magic.c
|
||||
src/magic.h
|
||||
src/mygetopt.h
|
||||
src/newtest2.c
|
||||
src/newtest3.c
|
||||
src/pread.c
|
||||
src/print.c
|
||||
src/readcdf.c
|
||||
src/readelf.c
|
||||
src/readelf.h
|
||||
src/regex.c
|
||||
src/regex2.c
|
||||
src/softmagic.c
|
||||
src/strcasestr.c
|
||||
src/strlcat.c
|
||||
src/strlcpy.c
|
||||
src/strndup.c
|
||||
src/tar.h
|
||||
src/teststrchr.c
|
||||
src/vasprintf.c
|
||||
src/x.c
|
||||
src/apprentice.c - parses /etc/magic to learn magic
|
||||
src/apptype.c - used for OS/2 specific application type magic
|
||||
src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
|
||||
@ -96,6 +73,7 @@ src/asctime_r.c - replacement for OS's that don't have it.
|
||||
src/asprintf.c - replacement for OS's that don't have it.
|
||||
src/asctime_r.c - replacement for OS's that don't have it.
|
||||
src/asprintf.c - replacement for OS's that don't have it.
|
||||
src/buffer.c - buffer handling functions.
|
||||
src/cdf.[ch] - parser for Microsoft Compound Document Files
|
||||
src/cdf_time.c - time converter for CDF.
|
||||
src/compress.c - handles decompressing files to look inside.
|
||||
@ -128,6 +106,7 @@ src/mygetopt.h - replacement for OS's that don't have it.
|
||||
src/strcasestr.c - replacement for OS's that don't have it.
|
||||
src/strlcat.c - replacement for OS's that don't have it.
|
||||
src/strlcpy.c - replacement for OS's that don't have it.
|
||||
src/strndup.c - replacement for OS's that don't have it.
|
||||
src/tar.h - tar file definitions
|
||||
src/vasprintf.c - for systems that don't have it.
|
||||
doc/file.man - man page for the command
|
||||
@ -156,6 +135,19 @@ guidelines:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
gpg for dummies:
|
||||
|
||||
$ gpg --verify file-X.YY.tar.gz.asc file-X.YY.tar.gz
|
||||
gpg: assuming signed data in `file-X.YY.tar.gz'
|
||||
gpg: Signature made WWW MMM DD HH:MM:SS YYYY ZZZ using DSA key ID KKKKKKKK
|
||||
|
||||
To download the key:
|
||||
|
||||
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys KKKKKKKK
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Parts of this software were developed at SoftQuad Inc., developers
|
||||
of SGML/HTML/XML publishing software, in Toronto, Canada.
|
||||
SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.
|
||||
|
15
TODO
15
TODO
@ -31,6 +31,19 @@ could require structural changes to the matching code :-(
|
||||
# rule 2
|
||||
>0 ....
|
||||
...
|
||||
---
|
||||
- Merge the stat code dance in one place and keep it in one place
|
||||
(perhaps struct buffer).
|
||||
- Enable seeking around if offset > nbytes if possible (the fd
|
||||
is seekable).
|
||||
- We could use file_pipe2file more (for EOF offsets, CDF documents),
|
||||
but that is expensive; perhaps we should provide a way to disable it
|
||||
- The implementation of struct buffer needs re-thinking and more work.
|
||||
For example we don't always pass the fd in the child. This is not
|
||||
important yet as we don't have yet cases where use/indirect magic
|
||||
needs negative offsets.
|
||||
- Really the whole thing just needs here's an (offset, buffer, size)
|
||||
you have (filebuffer, filebuffersize &&|| fd), fill the buffer with
|
||||
data from offset. The buffer API should be changed to just do that.
|
||||
|
||||
christos
|
||||
|
||||
|
443
aclocal.m4
vendored
443
aclocal.m4
vendored
@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.15 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.13.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -20,85 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# visibility.m4 serial 5 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
dnl Tests whether the compiler supports the command-line option
|
||||
dnl -fvisibility=hidden and the function and variable attributes
|
||||
dnl __attribute__((__visibility__("hidden"))) and
|
||||
dnl __attribute__((__visibility__("default"))).
|
||||
dnl Does *not* test for __visibility__("protected") - which has tricky
|
||||
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
|
||||
dnl Mac OS X.
|
||||
dnl Does *not* test for __visibility__("internal") - which has processor
|
||||
dnl dependent semantics.
|
||||
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
|
||||
dnl "really only recommended for legacy code".
|
||||
dnl Set the variable CFLAG_VISIBILITY.
|
||||
dnl Defines and sets the variable HAVE_VISIBILITY.
|
||||
|
||||
AC_DEFUN([gl_VISIBILITY],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
CFLAG_VISIBILITY=
|
||||
HAVE_VISIBILITY=0
|
||||
if test -n "$GCC"; then
|
||||
dnl First, check whether -Werror can be added to the command line, or
|
||||
dnl whether it leads to an error because of some other option that the
|
||||
dnl user has put into $CC $CFLAGS $CPPFLAGS.
|
||||
AC_MSG_CHECKING([whether the -Werror option is usable])
|
||||
AC_CACHE_VAL([gl_cv_cc_vis_werror], [
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cc_vis_werror=yes],
|
||||
[gl_cv_cc_vis_werror=no])
|
||||
CFLAGS="$gl_save_CFLAGS"])
|
||||
AC_MSG_RESULT([$gl_cv_cc_vis_werror])
|
||||
dnl Now check whether visibility declarations are supported.
|
||||
AC_MSG_CHECKING([for simple visibility declarations])
|
||||
AC_CACHE_VAL([gl_cv_cc_visibility], [
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
dnl We use the option -Werror and a function dummyfunc, because on some
|
||||
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
|
||||
dnl "visibility attribute not supported in this configuration; ignored"
|
||||
dnl at the first function definition in every compilation unit, and we
|
||||
dnl don't want to use the option in this case.
|
||||
if test $gl_cv_cc_vis_werror = yes; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
|
||||
extern __attribute__((__visibility__("default"))) int exportedvar;
|
||||
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
||||
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
|
||||
void dummyfunc (void) {}
|
||||
]],
|
||||
[[]])],
|
||||
[gl_cv_cc_visibility=yes],
|
||||
[gl_cv_cc_visibility=no])
|
||||
CFLAGS="$gl_save_CFLAGS"])
|
||||
AC_MSG_RESULT([$gl_cv_cc_visibility])
|
||||
if test $gl_cv_cc_visibility = yes; then
|
||||
CFLAG_VISIBILITY="-fvisibility=hidden"
|
||||
HAVE_VISIBILITY=1
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CFLAG_VISIBILITY])
|
||||
AC_SUBST([HAVE_VISIBILITY])
|
||||
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
|
||||
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
|
||||
])
|
||||
|
||||
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -110,10 +32,10 @@ AC_DEFUN([gl_VISIBILITY],
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.15'
|
||||
[am__api_version='1.13'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.15], [],
|
||||
m4_if([$1], [1.13.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@ -129,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.15])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.13.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -181,14 +103,15 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
||||
# Expand $ac_aux_dir to an absolute path.
|
||||
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
[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`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -219,7 +142,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -410,7 +333,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -450,7 +373,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "$am__include" && continue
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
@ -486,7 +409,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -495,12 +418,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
|
||||
m4_define([AC_PROG_CC],
|
||||
m4_defn([AC_PROG_CC])
|
||||
[_AM_PROG_CC_C_O
|
||||
])
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
@ -576,8 +493,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 (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
# We need awk for the "check" target. 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
|
||||
@ -609,51 +526,6 @@ dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell bug-automake@gnu.org about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi
|
||||
dnl 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
|
||||
@ -662,6 +534,7 @@ dnl mangled by Autoconf and run in a shell conditional statement.
|
||||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
@ -683,7 +556,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -694,7 +567,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+set}" != xset; then
|
||||
if test x"${install_sh}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
@ -704,7 +577,7 @@ if test x"${install_sh+set}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -725,7 +598,7 @@ AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -773,9 +646,41 @@ AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_CC_C_O
|
||||
# --------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake.
|
||||
AC_DEFUN([AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
# FIXME: we rely on the cache variable name because
|
||||
# there is no other way.
|
||||
set dummy $CC
|
||||
am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
|
||||
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
|
||||
if test "$am_t" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
dnl Make sure AC_PROG_CC is never called again, or it will override our
|
||||
dnl setting of CC.
|
||||
m4_define([AC_PROG_CC],
|
||||
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -814,7 +719,7 @@ fi
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -843,73 +748,9 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_PROG_CC_C_O
|
||||
# ---------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
|
||||
# to automatically call this.
|
||||
AC_DEFUN([_AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
AC_LANG_PUSH([C])dnl
|
||||
AC_CACHE_CHECK(
|
||||
[whether $CC understands -c and -o together],
|
||||
[am_cv_prog_cc_c_o],
|
||||
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
|
||||
# Make sure it works both with $CC and with simple cc.
|
||||
# Following AC_PROG_CC_C_O, we do the test twice because some
|
||||
# compilers refuse to overwrite an existing .o file with -o,
|
||||
# though they will create one.
|
||||
am_cv_prog_cc_c_o=yes
|
||||
for am_i in 1 2; do
|
||||
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
|
||||
&& test -f conftest2.$ac_objext; then
|
||||
: OK
|
||||
else
|
||||
am_cv_prog_cc_c_o=no
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
unset am_i])
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
AC_LANG_POP([C])])
|
||||
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_RUN_LOG(COMMAND)
|
||||
# -------------------
|
||||
# Run COMMAND, save the exit status in ac_status, and log it.
|
||||
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
|
||||
AC_DEFUN([AM_RUN_LOG],
|
||||
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
|
||||
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
|
||||
(exit $ac_status); }])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -990,7 +831,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1050,7 +891,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1078,7 +919,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1097,7 +938,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -1116,114 +957,76 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
#
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility. Yes, it's still used
|
||||
# in the wild :-( We should find a proper way to deprecate it ...
|
||||
AC_SUBST([AMTAR], ['$${TAR-tar}'])
|
||||
|
||||
# We'll loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
|
||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of '-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
[m4_case([$1],
|
||||
[ustar],
|
||||
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
|
||||
# There is notably a 21 bits limit for the UID and the GID. In fact,
|
||||
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
|
||||
# and bug#13588).
|
||||
am_max_uid=2097151 # 2^21 - 1
|
||||
am_max_gid=$am_max_uid
|
||||
# The $UID and $GID variables are not portable, so we need to resort
|
||||
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
|
||||
# below are definitely unexpected, so allow the users to see them
|
||||
# (that is, avoid stderr redirection).
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
|
||||
if test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi
|
||||
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
|
||||
if test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi],
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
[pax],
|
||||
[],
|
||||
|
||||
[m4_fatal([Unknown tar format])])
|
||||
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
|
||||
# Go ahead even if we have the value already cached. We do so because we
|
||||
# need to set the values for the 'am__tar' and 'am__untar' variables.
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
|
||||
for _am_tool in $_am_tools; do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar; do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works.
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
AM_RUN_LOG([cat conftest.dir/file])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
2
compile
2
compile
@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
469
config.guess
vendored
469
config.guess
vendored
@ -1,8 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2017-01-01'
|
||||
timestamp='2012-12-29'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -24,12 +26,12 @@ timestamp='2017-01-01'
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
#
|
||||
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||
# Originally written by Per Bothner.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
#
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
@ -50,7 +52,9 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -132,27 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_SYSTEM}" in
|
||||
Linux|GNU|GNU/*)
|
||||
# If the system lacks a compiler, then just pick glibc.
|
||||
# We could probably try harder.
|
||||
LIBC=gnu
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat <<-EOF > $dummy.c
|
||||
#include <features.h>
|
||||
#if defined(__UCLIBC__)
|
||||
LIBC=uclibc
|
||||
#elif defined(__dietlibc__)
|
||||
LIBC=dietlibc
|
||||
#else
|
||||
LIBC=gnu
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
|
||||
;;
|
||||
esac
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
@ -168,29 +151,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# Note: NetBSD doesn't particularly care about the vendor
|
||||
# portion of the name. We always set it to "unknown".
|
||||
sysctl="sysctl -n hw.machine_arch"
|
||||
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
|
||||
/sbin/$sysctl 2>/dev/null || \
|
||||
/usr/sbin/$sysctl 2>/dev/null || \
|
||||
echo unknown)`
|
||||
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
|
||||
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
armeb) machine=armeb-unknown ;;
|
||||
arm*) machine=arm-unknown ;;
|
||||
sh3el) machine=shl-unknown ;;
|
||||
sh3eb) machine=sh-unknown ;;
|
||||
sh5el) machine=sh5le-unknown ;;
|
||||
earmv*)
|
||||
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
|
||||
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
|
||||
machine=${arch}${endian}-unknown
|
||||
;;
|
||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
# to ELF recently (or will in the future) and ABI.
|
||||
# to ELF recently, or will in the future.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
earm*)
|
||||
os=netbsdelf
|
||||
;;
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
@ -207,13 +180,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
os=netbsd
|
||||
;;
|
||||
esac
|
||||
# Determine ABI tags.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
earm*)
|
||||
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
|
||||
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
# Debian GNU/NetBSD machines have a different userland, and
|
||||
# thus, need a distinct triplet. However, they do not need
|
||||
@ -224,13 +190,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
release='-gnu'
|
||||
;;
|
||||
*)
|
||||
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
|
||||
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
;;
|
||||
esac
|
||||
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
||||
# contains redundant information, the shorter form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}${abi}"
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
@ -240,10 +206,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:LibertyBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:ekkoBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -256,9 +218,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:Sortix:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-sortix
|
||||
exit ;;
|
||||
alpha:OSF1:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
@ -275,42 +234,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
|
||||
case "$ALPHA_CPU_TYPE" in
|
||||
"EV4 (21064)")
|
||||
UNAME_MACHINE=alpha ;;
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
"EV4.5 (21064)")
|
||||
UNAME_MACHINE=alpha ;;
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
"LCA4 (21066/21068)")
|
||||
UNAME_MACHINE=alpha ;;
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
"EV5 (21164)")
|
||||
UNAME_MACHINE=alphaev5 ;;
|
||||
UNAME_MACHINE="alphaev5" ;;
|
||||
"EV5.6 (21164A)")
|
||||
UNAME_MACHINE=alphaev56 ;;
|
||||
UNAME_MACHINE="alphaev56" ;;
|
||||
"EV5.6 (21164PC)")
|
||||
UNAME_MACHINE=alphapca56 ;;
|
||||
UNAME_MACHINE="alphapca56" ;;
|
||||
"EV5.7 (21164PC)")
|
||||
UNAME_MACHINE=alphapca57 ;;
|
||||
UNAME_MACHINE="alphapca57" ;;
|
||||
"EV6 (21264)")
|
||||
UNAME_MACHINE=alphaev6 ;;
|
||||
UNAME_MACHINE="alphaev6" ;;
|
||||
"EV6.7 (21264A)")
|
||||
UNAME_MACHINE=alphaev67 ;;
|
||||
UNAME_MACHINE="alphaev67" ;;
|
||||
"EV6.8CB (21264C)")
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
"EV6.8AL (21264B)")
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
"EV6.8CX (21264D)")
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
"EV6.9A (21264/EV69A)")
|
||||
UNAME_MACHINE=alphaev69 ;;
|
||||
UNAME_MACHINE="alphaev69" ;;
|
||||
"EV7 (21364)")
|
||||
UNAME_MACHINE=alphaev7 ;;
|
||||
UNAME_MACHINE="alphaev7" ;;
|
||||
"EV7.9 (21364A)")
|
||||
UNAME_MACHINE=alphaev79 ;;
|
||||
UNAME_MACHINE="alphaev79" ;;
|
||||
esac
|
||||
# A Pn.n version is a patched version.
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
@ -383,16 +342,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH=i386
|
||||
SUN_ARCH="i386"
|
||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||
# This test works for both compilers.
|
||||
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
SUN_ARCH=x86_64
|
||||
SUN_ARCH="x86_64"
|
||||
fi
|
||||
fi
|
||||
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
@ -417,7 +376,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
exit ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
@ -603,9 +562,8 @@ EOF
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/lslpp ] ; then
|
||||
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
|
||||
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
||||
fi
|
||||
@ -642,13 +600,13 @@ EOF
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH=hppa2.0n ;;
|
||||
64) HP_ARCH=hppa2.0w ;;
|
||||
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
@ -687,11 +645,11 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
fi ;;
|
||||
esac
|
||||
if [ ${HP_ARCH} = hppa2.0w ]
|
||||
if [ ${HP_ARCH} = "hppa2.0w" ]
|
||||
then
|
||||
eval $set_cc_for_build
|
||||
|
||||
@ -704,12 +662,12 @@ EOF
|
||||
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
|
||||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep -q __LP64__
|
||||
then
|
||||
HP_ARCH=hppa2.0w
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
HP_ARCH=hppa64
|
||||
HP_ARCH="hppa64"
|
||||
fi
|
||||
fi
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
@ -814,14 +772,14 @@ EOF
|
||||
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
|
||||
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
@ -851,7 +809,7 @@ EOF
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
*:MSYS*:*)
|
||||
i*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
@ -899,21 +857,21 @@ EOF
|
||||
exit ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
@ -926,60 +884,59 @@ EOF
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
|
||||
fi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
e2k:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
LIBC=gnu
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
k1om:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
@ -998,69 +955,54 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64el:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
openrisc*:Linux:*:*)
|
||||
echo or1k-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:* | or1k*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
or32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-${LIBC}
|
||||
echo sparc-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-${LIBC}
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
esac
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-${LIBC}
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
riscv32:Linux:*:* | riscv64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
exit ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
@ -1136,7 +1078,7 @@ EOF
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configure will decide that
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
@ -1285,9 +1227,6 @@ EOF
|
||||
SX-8R:SUPER-UX:*:*)
|
||||
echo sx8r-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-ACE:SUPER-UX:*:*)
|
||||
echo sxace-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
Power*:Rhapsody:*:*)
|
||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -1296,36 +1235,24 @@ EOF
|
||||
exit ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
eval $set_cc_for_build
|
||||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||
# that puts up a graphical alert prompting to install
|
||||
# developer tools. Any system running Mac OS X 10.7 or
|
||||
# later (Darwin 11 and later) is required to have a 64-bit
|
||||
# processor. This is not true of the ARM version of Darwin
|
||||
# that Apple uses in portable devices.
|
||||
UNAME_PROCESSOR=x86_64
|
||||
fi
|
||||
case $UNAME_PROCESSOR in
|
||||
i386)
|
||||
eval $set_cc_for_build
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
fi ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
if test "$UNAME_PROCESSOR" = x86; then
|
||||
if test "$UNAME_PROCESSOR" = "x86"; then
|
||||
UNAME_PROCESSOR=i386
|
||||
UNAME_MACHINE=pc
|
||||
fi
|
||||
@ -1356,7 +1283,7 @@ EOF
|
||||
# "uname -m" is not consistent, so use $cputype instead. 386
|
||||
# is converted to i386 for consistency with other x86
|
||||
# operating systems.
|
||||
if test "$cputype" = 386; then
|
||||
if test "$cputype" = "386"; then
|
||||
UNAME_MACHINE=i386
|
||||
else
|
||||
UNAME_MACHINE="$cputype"
|
||||
@ -1398,7 +1325,7 @@ EOF
|
||||
echo i386-pc-xenix
|
||||
exit ;;
|
||||
i*86:skyos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
|
||||
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
|
||||
exit ;;
|
||||
i*86:rdos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-rdos
|
||||
@ -1409,25 +1336,171 @@ EOF
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
amd64:Isilon\ OneFS:*:*)
|
||||
echo x86_64-unknown-onefs
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
if (version < 4)
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
else
|
||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
# if !defined (ultrix)
|
||||
# include <sys/param.h>
|
||||
# if defined (BSD)
|
||||
# if BSD == 43
|
||||
printf ("vax-dec-bsd4.3\n"); exit (0);
|
||||
# else
|
||||
# if BSD == 199006
|
||||
printf ("vax-dec-bsd4.3reno\n"); exit (0);
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
|
||||
{ echo "$SYSTEM_NAME"; exit; }
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
cat >&2 <<EOF
|
||||
$0: unable to guess system type
|
||||
|
||||
This script (version $timestamp), has failed to recognize the
|
||||
operating system you are using. If your script is old, overwrite
|
||||
config.guess and config.sub with the latest versions from:
|
||||
This script, last modified $timestamp, has failed to recognize
|
||||
the operating system you are using. It is advised that you
|
||||
download the most up to date version of the config scripts from
|
||||
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
and
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
If $0 has already been updated, send the following data and any
|
||||
information you think might be pertinent to config-patches@gnu.org to
|
||||
provide the necessary information to handle your system.
|
||||
If the version you run ($0) is already up to date, please
|
||||
send the following data and any information you think might be
|
||||
pertinent to <config-patches@gnu.org> in order to provide the needed
|
||||
information to handle your system.
|
||||
|
||||
config.guess timestamp = $timestamp
|
||||
|
||||
|
10
config.h.in
10
config.h.in
@ -77,6 +77,9 @@
|
||||
/* Define to 1 if you have the `gnurx' library (-lgnurx). */
|
||||
#undef HAVE_LIBGNURX
|
||||
|
||||
/* Define to 1 if you have the `seccomp' library (-lseccomp). */
|
||||
#undef HAVE_LIBSECCOMP
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
@ -227,10 +230,6 @@
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 or 0, depending whether the compiler supports simple visibility
|
||||
declarations. */
|
||||
#undef HAVE_VISIBILITY
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
@ -264,6 +263,9 @@
|
||||
<sysmacros.h>. */
|
||||
#undef MAJOR_IN_SYSMACROS
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
|
120
config.sub
vendored
120
config.sub
vendored
@ -1,8 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2017-01-01'
|
||||
timestamp='2012-12-29'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -25,7 +27,7 @@ timestamp='2017-01-01'
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
@ -33,7 +35,7 @@ timestamp='2017-01-01'
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
@ -53,7 +55,8 @@ timestamp='2017-01-01'
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
@ -67,7 +70,9 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -116,8 +121,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||
kopensolaris*-gnu* | cloudabi*-eabi* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
@ -251,21 +256,19 @@ case $basic_machine in
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arceb \
|
||||
| arc \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| ba \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | c8051 | clipper \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| e2k | epiphany \
|
||||
| fido | fr30 | frv | ft32 \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
@ -283,30 +286,26 @@ case $basic_machine in
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| open8 | or1k | or1knd | or32 \
|
||||
| open8 \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pru \
|
||||
| pyramid \
|
||||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
@ -314,7 +313,6 @@ case $basic_machine in
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| visium \
|
||||
| we32k \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
@ -329,10 +327,7 @@ case $basic_machine in
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
leon|leon[3-9])
|
||||
basic_machine=sparc-$basic_machine
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
@ -374,23 +369,21 @@ case $basic_machine in
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| ba-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| e2k-* | elxsi-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
@ -410,34 +403,28 @@ case $basic_machine in
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| or1k*-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pru-* \
|
||||
| pyramid-* \
|
||||
| riscv32-* | riscv64-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
@ -445,7 +432,6 @@ case $basic_machine in
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| visium-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
@ -522,9 +508,6 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
asmjs)
|
||||
basic_machine=asmjs-unknown
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@ -645,14 +628,6 @@ case $basic_machine in
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
e500v[12])
|
||||
basic_machine=powerpc-unknown
|
||||
os=$os"spe"
|
||||
;;
|
||||
e500v[12]-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=$os"spe"
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
@ -794,9 +769,6 @@ case $basic_machine in
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
leon-*|leon[3-9]-*)
|
||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
@ -824,7 +796,7 @@ case $basic_machine in
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i686-pc
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
@ -852,10 +824,6 @@ case $basic_machine in
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
moxiebox)
|
||||
basic_machine=moxie-unknown
|
||||
os=-moxiebox
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@ -864,7 +832,7 @@ case $basic_machine in
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
basic_machine=i386-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
@ -1032,7 +1000,7 @@ case $basic_machine in
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle)
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
@ -1042,7 +1010,7 @@ case $basic_machine in
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little)
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
@ -1386,30 +1354,29 @@ case $os in
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1533,6 +1500,9 @@ case $os in
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
@ -1541,8 +1511,6 @@ case $os in
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-ios)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@ -1583,9 +1551,6 @@ case $basic_machine in
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
@ -1638,9 +1603,6 @@ case $basic_machine in
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
pru-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
|
413
configure
vendored
413
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.32.
|
||||
# Generated by GNU Autoconf 2.69 for file 5.33.
|
||||
#
|
||||
# Report bugs to <christos@astron.com>.
|
||||
#
|
||||
@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='file'
|
||||
PACKAGE_TARNAME='file'
|
||||
PACKAGE_VERSION='5.32'
|
||||
PACKAGE_STRING='file 5.32'
|
||||
PACKAGE_VERSION='5.33'
|
||||
PACKAGE_STRING='file 5.33'
|
||||
PACKAGE_BUGREPORT='christos@astron.com'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -638,8 +638,6 @@ LTLIBOBJS
|
||||
IS_CROSS_COMPILE_FALSE
|
||||
IS_CROSS_COMPILE_TRUE
|
||||
LIBOBJS
|
||||
HAVE_VISIBILITY
|
||||
CFLAG_VISIBILITY
|
||||
OTOOL64
|
||||
OTOOL
|
||||
LIPO
|
||||
@ -767,6 +765,7 @@ enable_silent_rules
|
||||
enable_elf
|
||||
enable_elf_core
|
||||
enable_zlib
|
||||
enable_libseccomp
|
||||
enable_fsect_man5
|
||||
enable_dependency_tracking
|
||||
enable_static
|
||||
@ -1328,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.32 to adapt to many kinds of systems.
|
||||
\`configure' configures file 5.33 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1398,7 +1397,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of file 5.32:";;
|
||||
short | recursive ) echo "Configuration of file 5.33:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -1411,6 +1410,7 @@ Optional Features:
|
||||
--disable-elf disable builtin ELF support
|
||||
--disable-elf-core disable ELF core file support
|
||||
--disable-zlib disable zlib compression support [default=auto]
|
||||
--disable-libseccomp disable libseccomp sandboxing [default=auto]
|
||||
--enable-fsect-man5 enable file formats in man section 5
|
||||
--enable-dependency-tracking
|
||||
do not reject slow dependency extractors
|
||||
@ -1509,7 +1509,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
file configure 5.32
|
||||
file configure 5.33
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@ -2165,7 +2165,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.32, which was
|
||||
It was created by file $as_me 5.33, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -2516,7 +2516,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.15'
|
||||
am__api_version='1.13'
|
||||
|
||||
ac_aux_dir=
|
||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||
@ -2717,8 +2717,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
|
||||
@ -2737,7 +2737,7 @@ else
|
||||
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
|
||||
fi
|
||||
|
||||
if test x"${install_sh+set}" != xset; then
|
||||
if test x"${install_sh}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
@ -3031,7 +3031,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='file'
|
||||
VERSION='5.32'
|
||||
VERSION='5.33'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -3065,65 +3065,18 @@ 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 (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
# We need awk for the "check" target. 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}'
|
||||
|
||||
|
||||
# We'll loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar pax cpio none'
|
||||
|
||||
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell bug-automake@gnu.org about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
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;
|
||||
@ -3230,6 +3183,16 @@ fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_zlib" >&5
|
||||
$as_echo "$enable_zlib" >&6; }
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libseccomp support" >&5
|
||||
$as_echo_n "checking for libseccomp support... " >&6; }
|
||||
# Check whether --enable-libseccomp was given.
|
||||
if test "${enable_libseccomp+set}" = set; then :
|
||||
enableval=$enable_libseccomp;
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libseccomp" >&5
|
||||
$as_echo "$enable_libseccomp" >&6; }
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for file formats in man section 5" >&5
|
||||
$as_echo_n "checking for file formats in man section 5... " >&6; }
|
||||
# Check whether --enable-fsect-man5 was given.
|
||||
@ -4208,65 +4171,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
|
||||
$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
|
||||
if ${am_cv_prog_cc_c_o+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
# Make sure it works both with $CC and with simple cc.
|
||||
# Following AC_PROG_CC_C_O, we do the test twice because some
|
||||
# compilers refuse to overwrite an existing .o file with -o,
|
||||
# though they will create one.
|
||||
am_cv_prog_cc_c_o=yes
|
||||
for am_i in 1 2; do
|
||||
if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
|
||||
($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } \
|
||||
&& test -f conftest2.$ac_objext; then
|
||||
: OK
|
||||
else
|
||||
am_cv_prog_cc_c_o=no
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
unset am_i
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
|
||||
$as_echo "$am_cv_prog_cc_c_o" >&6; }
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
depcc="$CC" am_compiler_list=
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
|
||||
@ -5146,6 +5050,131 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
|
||||
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
|
||||
|
||||
|
||||
if test "x$CC" != xcc; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
|
||||
$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
|
||||
$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
|
||||
fi
|
||||
set dummy $CC; ac_cc=`$as_echo "$2" |
|
||||
sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
|
||||
if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
# Make sure it works both with $CC and with simple cc.
|
||||
# We do the test twice because some compilers refuse to overwrite an
|
||||
# existing .o file with -o, though they will create one.
|
||||
ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
|
||||
rm -f conftest2.*
|
||||
if { { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; } &&
|
||||
test -f conftest2.$ac_objext && { { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; };
|
||||
then
|
||||
eval ac_cv_prog_cc_${ac_cc}_c_o=yes
|
||||
if test "x$CC" != xcc; then
|
||||
# Test first that cc exists at all.
|
||||
if { ac_try='cc -c conftest.$ac_ext >&5'
|
||||
{ { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }; then
|
||||
ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
|
||||
rm -f conftest2.*
|
||||
if { { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; } &&
|
||||
test -f conftest2.$ac_objext && { { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; };
|
||||
then
|
||||
# cc works too.
|
||||
:
|
||||
else
|
||||
# cc exists but doesn't like -o.
|
||||
eval ac_cv_prog_cc_${ac_cc}_c_o=no
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
eval ac_cv_prog_cc_${ac_cc}_c_o=no
|
||||
fi
|
||||
rm -f core conftest*
|
||||
|
||||
fi
|
||||
if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
|
||||
$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# FIXME: we rely on the cache variable name because
|
||||
# there is no other way.
|
||||
set dummy $CC
|
||||
am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
|
||||
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
|
||||
if test "$am_t" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
|
||||
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
|
||||
@ -12483,92 +12512,7 @@ CC="$lt_save_CC"
|
||||
# Only expand once:
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAG_VISIBILITY=
|
||||
HAVE_VISIBILITY=0
|
||||
if test -n "$GCC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5
|
||||
$as_echo_n "checking whether the -Werror option is usable... " >&6; }
|
||||
if ${gl_cv_cc_vis_werror+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
gl_cv_cc_vis_werror=yes
|
||||
else
|
||||
gl_cv_cc_vis_werror=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$gl_save_CFLAGS"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
|
||||
$as_echo "$gl_cv_cc_vis_werror" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5
|
||||
$as_echo_n "checking for simple visibility declarations... " >&6; }
|
||||
if ${gl_cv_cc_visibility+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
if test $gl_cv_cc_vis_werror = yes; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
extern __attribute__((__visibility__("hidden"))) int hiddenvar;
|
||||
extern __attribute__((__visibility__("default"))) int exportedvar;
|
||||
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
||||
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
|
||||
void dummyfunc (void) {}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
gl_cv_cc_visibility=yes
|
||||
else
|
||||
gl_cv_cc_visibility=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$gl_save_CFLAGS"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
|
||||
$as_echo "$gl_cv_cc_visibility" >&6; }
|
||||
if test $gl_cv_cc_visibility = yes; then
|
||||
CFLAG_VISIBILITY="-fvisibility=hidden"
|
||||
HAVE_VISIBILITY=1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_VISIBILITY $HAVE_VISIBILITY
|
||||
_ACEOF
|
||||
|
||||
|
||||
gl_VISIBILITY
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
|
||||
$as_echo_n "checking for ANSI C header files... " >&6; }
|
||||
if ${ac_cv_header_stdc+:} false; then :
|
||||
@ -14460,6 +14404,53 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
if test "$enable_libseccomp" != "no"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for seccomp_init in -lseccomp" >&5
|
||||
$as_echo_n "checking for seccomp_init in -lseccomp... " >&6; }
|
||||
if ${ac_cv_lib_seccomp_seccomp_init+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lseccomp $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char seccomp_init ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return seccomp_init ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_seccomp_seccomp_init=yes
|
||||
else
|
||||
ac_cv_lib_seccomp_seccomp_init=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_seccomp_seccomp_init" >&5
|
||||
$as_echo "$ac_cv_lib_seccomp_seccomp_init" >&6; }
|
||||
if test "x$ac_cv_lib_seccomp_seccomp_init" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBSECCOMP 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lseccomp $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
if test "$MINGW" = 1; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regexec in -lgnurx" >&5
|
||||
@ -15075,7 +15066,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.32, which was
|
||||
This file was extended by file $as_me 5.33, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -15141,7 +15132,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.32
|
||||
file config.status 5.33
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
@ -16203,7 +16194,7 @@ $as_echo X"$mf" |
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "$am__include" && continue
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
|
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.32],[christos@astron.com])
|
||||
AC_INIT([file],[5.33],[christos@astron.com])
|
||||
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
@ -39,6 +39,11 @@ AC_ARG_ENABLE(zlib,
|
||||
[AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])])
|
||||
AC_MSG_RESULT($enable_zlib)
|
||||
|
||||
AC_MSG_CHECKING(for libseccomp support)
|
||||
AC_ARG_ENABLE(libseccomp,
|
||||
[AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
|
||||
AC_MSG_RESULT($enable_libseccomp)
|
||||
|
||||
AC_MSG_CHECKING(for file formats in man section 5)
|
||||
AC_ARG_ENABLE(fsect-man5,
|
||||
[ --enable-fsect-man5 enable file formats in man section 5],
|
||||
@ -158,6 +163,9 @@ dnl Checks for libraries
|
||||
if test "$enable_zlib" != "no"; then
|
||||
AC_CHECK_LIB(z, gzopen)
|
||||
fi
|
||||
if test "$enable_libseccomp" != "no"; then
|
||||
AC_CHECK_LIB(seccomp, seccomp_init)
|
||||
fi
|
||||
if test "$MINGW" = 1; then
|
||||
AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
|
||||
fi
|
||||
|
5
depcomp
5
depcomp
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
scriptversion=2012-10-18.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2013 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
|
||||
@ -552,7 +552,6 @@ $ {
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,61 +14,23 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -87,6 +49,7 @@ 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 \
|
||||
@ -94,7 +57,6 @@ 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 =
|
||||
@ -154,7 +116,6 @@ 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@
|
||||
@ -168,7 +129,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -184,7 +144,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -297,6 +256,7 @@ $(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*) \
|
||||
@ -652,8 +612,6 @@ 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 $@
|
||||
|
153
doc/file.man
153
doc/file.man
@ -1,5 +1,5 @@
|
||||
.\" $File: file.man,v 1.125 2017/01/03 11:24:46 christos Exp $
|
||||
.Dd October 19, 2016
|
||||
.\" $File: file.man,v 1.129 2018/03/02 16:17:54 christos Exp $
|
||||
.Dd March 2, 2018
|
||||
.Dt FILE __CSECTION__
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -8,7 +8,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Bk -words
|
||||
.Op Fl bcdEhiklLNnprsvzZ0
|
||||
.Op Fl bcdEhiklLNnprsSvzZ0
|
||||
.Op Fl Fl apple
|
||||
.Op Fl Fl extension
|
||||
.Op Fl Fl mime-encoding
|
||||
@ -168,7 +168,8 @@ in any of the character sets listed above is simply said to be
|
||||
.Bl -tag -width indent
|
||||
.It Fl Fl apple
|
||||
Causes the file command to output the file type and creator code as
|
||||
used by older MacOS versions. The code consists of eight letters,
|
||||
used by older MacOS versions.
|
||||
The code consists of eight letters,
|
||||
the first describing the file type, the latter the creator.
|
||||
.It Fl b , Fl Fl brief
|
||||
Do not prepend filenames to output lines (brief mode).
|
||||
@ -215,12 +216,14 @@ elf magic is found.
|
||||
.It soft
|
||||
Consults magic files.
|
||||
.It tar
|
||||
Examines tar files.
|
||||
Examines tar files by verifying the checksum of the 512 byte tar header.
|
||||
Excluding this test can provide more detailed content description by using
|
||||
the soft magic method.
|
||||
.It text
|
||||
A synonym for
|
||||
.Sq ascii .
|
||||
.El
|
||||
.It Fl Fl extension
|
||||
.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
|
||||
@ -350,6 +353,16 @@ This option also causes
|
||||
to disregard the file size as reported by
|
||||
.Xr stat 2
|
||||
since on some systems it reports a zero size for raw disk partitions.
|
||||
.If Fl S , Fl Fl no-sandbox
|
||||
On systems where libseccomp
|
||||
.Pa ( https://github.com/seccomp/libseccomp )
|
||||
is available, the
|
||||
.Fl S
|
||||
flag disables sandboxing which is enabled by default.
|
||||
This option is needed for file to execute external descompressing programs,
|
||||
i.e. when the
|
||||
.Fl z
|
||||
flag is specified and the built-in decompressors are not available.
|
||||
.It Fl v , Fl Fl version
|
||||
Print the version of the program and exit.
|
||||
.It Fl z , Fl Fl uncompress
|
||||
@ -366,20 +379,13 @@ Nice to
|
||||
the output.
|
||||
This does not affect the separator, which is still printed.
|
||||
.Pp
|
||||
If this option is repeated more than once, then
|
||||
If this option is repeated more than once, then
|
||||
.Nm
|
||||
prints just the filename followed by a NUL followed by the description
|
||||
(or ERROR: text) followed by a second NUL for each entry.
|
||||
.It Fl -help
|
||||
Print a help message and exit.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width __MAGIC__.mgc -compact
|
||||
.It Pa __MAGIC__.mgc
|
||||
Default compiled list of magic.
|
||||
.It Pa __MAGIC__
|
||||
Directory containing default magic files.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
The environment variable
|
||||
.Ev MAGIC
|
||||
@ -392,11 +398,6 @@ will not attempt to open
|
||||
adds
|
||||
.Dq Pa .mgc
|
||||
to the value of this variable as appropriate.
|
||||
However,
|
||||
.Pa file
|
||||
has to exist in order for
|
||||
.Pa file.mime
|
||||
to be considered.
|
||||
The environment variable
|
||||
.Ev POSIXLY_CORRECT
|
||||
controls (on systems that support symbolic links), whether
|
||||
@ -410,6 +411,65 @@ This is also controlled by the
|
||||
and
|
||||
.Fl h
|
||||
options.
|
||||
.Sh FILES
|
||||
.Bl -tag -width __MAGIC__.mgc -compact
|
||||
.It Pa __MAGIC__.mgc
|
||||
Default compiled list of magic.
|
||||
.It Pa __MAGIC__
|
||||
Directory containing default magic files.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Nm
|
||||
will exit with
|
||||
.Dv 0
|
||||
if the operation was successful or
|
||||
.Dv >0
|
||||
if an error was encountered.
|
||||
The following errors cause diagnostic messages, but don't affect the program
|
||||
exit code (as POSIX requires), unless
|
||||
.Fl E
|
||||
is specified:
|
||||
.Bl -bullet -compact -offset indent
|
||||
.It
|
||||
A file cannot be found
|
||||
.It
|
||||
There is no permission to read a file
|
||||
.It
|
||||
The file type cannot be determined
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -offset indent
|
||||
$ file file.c file /dev/{wd0a,hda}
|
||||
file.c: C program text
|
||||
file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
|
||||
dynamically linked (uses shared libs), stripped
|
||||
/dev/wd0a: block special (0/0)
|
||||
/dev/hda: block special (3/0)
|
||||
|
||||
$ file -s /dev/wd0{b,d}
|
||||
/dev/wd0b: data
|
||||
/dev/wd0d: x86 boot sector
|
||||
|
||||
$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
|
||||
/dev/hda: x86 boot sector
|
||||
/dev/hda1: Linux/i386 ext2 filesystem
|
||||
/dev/hda2: x86 boot sector
|
||||
/dev/hda3: x86 boot sector, extended partition table
|
||||
/dev/hda4: Linux/i386 ext2 filesystem
|
||||
/dev/hda5: Linux/i386 swap file
|
||||
/dev/hda6: Linux/i386 swap file
|
||||
/dev/hda7: Linux/i386 swap file
|
||||
/dev/hda8: Linux/i386 swap file
|
||||
/dev/hda9: empty
|
||||
/dev/hda10: empty
|
||||
|
||||
$ file -i file.c file /dev/{wd0a,hda}
|
||||
file.c: text/x-c
|
||||
file: application/x-executable
|
||||
/dev/hda: application/x-not-regular-file
|
||||
/dev/wd0a: application/x-not-regular-file
|
||||
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr hexdump 1 ,
|
||||
.Xr od 1 ,
|
||||
@ -461,6 +521,23 @@ for example,
|
||||
.Bd -literal -offset indent
|
||||
\*[Gt]16 long\*[Am]0x7fffffff \*[Gt]0 not stripped
|
||||
.Ed
|
||||
.Sh SECURITY
|
||||
On systems where libseccomp
|
||||
.Pa ( https://github.com/seccomp/libseccomp )
|
||||
is available,
|
||||
.Nm
|
||||
is enforces limiting system calls to only the ones necessary for the
|
||||
operation of the program.
|
||||
This enforcement does not provide any security benefit when
|
||||
.Nm
|
||||
is asked to decompress input files running external programs with
|
||||
the
|
||||
.Fl z
|
||||
option.
|
||||
To enable execution of external decompressors, one needs to disable
|
||||
sandboxing using the
|
||||
.Fl S
|
||||
flag.
|
||||
.Sh MAGIC DIRECTORY
|
||||
The magic file entries have been collected from various sources,
|
||||
mainly USENET, and contributed by various authors.
|
||||
@ -478,39 +555,6 @@ command uses a magic file,
|
||||
keep the old magic file around for comparison purposes
|
||||
(rename it to
|
||||
.Pa __MAGIC__.orig ) .
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -offset indent
|
||||
$ file file.c file /dev/{wd0a,hda}
|
||||
file.c: C program text
|
||||
file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
|
||||
dynamically linked (uses shared libs), stripped
|
||||
/dev/wd0a: block special (0/0)
|
||||
/dev/hda: block special (3/0)
|
||||
|
||||
$ file -s /dev/wd0{b,d}
|
||||
/dev/wd0b: data
|
||||
/dev/wd0d: x86 boot sector
|
||||
|
||||
$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
|
||||
/dev/hda: x86 boot sector
|
||||
/dev/hda1: Linux/i386 ext2 filesystem
|
||||
/dev/hda2: x86 boot sector
|
||||
/dev/hda3: x86 boot sector, extended partition table
|
||||
/dev/hda4: Linux/i386 ext2 filesystem
|
||||
/dev/hda5: Linux/i386 swap file
|
||||
/dev/hda6: Linux/i386 swap file
|
||||
/dev/hda7: Linux/i386 swap file
|
||||
/dev/hda8: Linux/i386 swap file
|
||||
/dev/hda9: empty
|
||||
/dev/hda10: empty
|
||||
|
||||
$ file -i file.c file /dev/{wd0a,hda}
|
||||
file.c: text/x-c
|
||||
file: application/x-executable
|
||||
/dev/hda: application/x-not-regular-file
|
||||
/dev/wd0a: application/x-not-regular-file
|
||||
|
||||
.Ed
|
||||
.Sh HISTORY
|
||||
There has been a
|
||||
.Nm
|
||||
@ -532,7 +576,7 @@ Geoff Collyer found several inadequacies
|
||||
and provided some magic file entries.
|
||||
Contributions of the
|
||||
.Sq \*[Am]
|
||||
operator by Rob McMahon,
|
||||
operator by Rob McMahon,
|
||||
.Aq cudcv@warwick.ac.uk ,
|
||||
1989.
|
||||
.Pp
|
||||
@ -582,9 +626,6 @@ and
|
||||
were written by John Gilmore from his public-domain
|
||||
.Xr tar 1
|
||||
program, and are not covered by the above license.
|
||||
.Sh RETURN CODE
|
||||
.Nm
|
||||
returns 0 on success, and non-zero on error.
|
||||
.Sh BUGS
|
||||
Please report bugs and send patches to the bug tracker at
|
||||
.Pa http://bugs.gw.com/
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $File: magic.man,v 1.91 2017/02/12 15:30:08 christos Exp $
|
||||
.Dd February 12, 2017
|
||||
.\" $File: magic.man,v 1.92 2017/11/04 01:11:32 christos Exp $
|
||||
.Dd Noveber 3, 2017
|
||||
.Dt MAGIC __FSECTION__
|
||||
.Os
|
||||
.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
|
||||
@ -36,8 +36,20 @@ If the test succeeds, a message is printed.
|
||||
The line consists of the following fields:
|
||||
.Bl -tag -width ".Dv message"
|
||||
.It Dv offset
|
||||
A number specifying the offset, in bytes, into the file of the data
|
||||
A number specifying the offset (in bytes) into the file of the data
|
||||
which is to be tested.
|
||||
This offset can be a negative number if it is:
|
||||
.Bl -bullet -compact
|
||||
.It
|
||||
The first direct offset of the magic entry (at continuation level 0),
|
||||
in which case it is interpreted an offset from end end of the file
|
||||
going backwards.
|
||||
This works only when a file descriptor to the file is a available and it
|
||||
is a regular file.
|
||||
.It
|
||||
A continuation offset relative to the end of the last up-level field
|
||||
.Dv ( \*[Am] ) .
|
||||
.El
|
||||
.It Dv type
|
||||
The type of the data to be tested.
|
||||
The possible values are:
|
||||
|
758
install-sh
758
install-sh
@ -1,301 +1,527 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: install-sh.in,v 1.6 2012/01/11 13:07:31 hans Exp $
|
||||
# This script now also installs multiple files, but might choke on installing
|
||||
# multiple files with spaces in the file names.
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
|
||||
scriptversion=2011-11-20.07; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
awkprog="${AWKPROG-awk}"
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
instcmd="$cpprog"
|
||||
instflags=""
|
||||
pathcompchmodcmd="$chmodprog 755"
|
||||
chmodcmd="$chmodprog 755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
stripflags=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
msrc=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
suffix=""
|
||||
suffixfmt=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-b) suffix=".old"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-B) suffixfmt="$2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m*)
|
||||
chmodcmd="$chmodprog ${1#-m}"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-S) stripcmd="$stripprog"
|
||||
stripflags="-S $2 $stripflags"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-p) instflags="-p"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$msrc" = x ]
|
||||
then
|
||||
msrc="$dst"
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
fi
|
||||
src="$dst"
|
||||
dst="$1"
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$dir_arg" = x ]
|
||||
then
|
||||
dstisfile=""
|
||||
if [ ! -d "$dst" ]
|
||||
then
|
||||
if [ x"$msrc" = x"$src" ]
|
||||
then
|
||||
dstisfile=true
|
||||
else
|
||||
echo "install: destination is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
if [ x"$msrc" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
for srcarg in $msrc; do
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
|
||||
dstarg="$srcarg"
|
||||
else
|
||||
dstarg="$dst"
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$srcarg" ]
|
||||
then
|
||||
doinst="$instcmd $instflags"
|
||||
elif [ -d "$srcarg" ]
|
||||
then
|
||||
echo "install: $srcarg: not a regular file"
|
||||
exit 1
|
||||
elif [ "$srcarg" = "/dev/null" ]
|
||||
then
|
||||
doinst="$cpprog"
|
||||
else
|
||||
echo "install: $srcarg does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d "$dstarg" ]
|
||||
then
|
||||
dstarg="$dstarg"/`basename "$srcarg"`
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
posix_mkdir=
|
||||
|
||||
pathcomp=''
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$doit $mkdirprog "${pathcomp}"
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
else
|
||||
true
|
||||
fi
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
if [ -d "$dstarg" ]; then
|
||||
true
|
||||
else
|
||||
$doit $mkdirprog "$dstarg" &&
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
|
||||
fi
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
|
||||
if [ x"$dstisfile" = x ]
|
||||
then
|
||||
file=$srcarg
|
||||
else
|
||||
file=$dst
|
||||
fi
|
||||
|
||||
dstfile=`basename "$file"`
|
||||
dstfinal="$dstdir/$dstfile"
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Make a backup file name in the proper directory.
|
||||
case x$suffixfmt in
|
||||
*%*) suffix=`echo x |
|
||||
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
|
||||
{ cnt = 0;
|
||||
do {
|
||||
sfx = sprintf(fmt, cnt++);
|
||||
name = bname sfx;
|
||||
} while (system("test -f " name) == 0);
|
||||
print sfx; }' -`;;
|
||||
x) ;;
|
||||
*) suffix="$suffixfmt";;
|
||||
esac
|
||||
dstbackup="$dstfinal$suffix"
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $doinst $srcarg "$dsttmp" &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
|
||||
then
|
||||
$doit $mvcmd "$dstfinal" "$dstbackup"
|
||||
else
|
||||
$doit $rmcmd -f "$dstfinal"
|
||||
fi &&
|
||||
$doit $mvcmd "$dsttmp" "$dstfinal"
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
done &&
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
24
ltmain.sh
24
ltmain.sh
@ -133,9 +133,8 @@ $lt_unset CDPATH
|
||||
# function.
|
||||
progpath="$0"
|
||||
|
||||
unset CP
|
||||
unset MV
|
||||
unset RM
|
||||
|
||||
|
||||
: ${CP="cp -f"}
|
||||
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
|
||||
: ${MAKE="make"}
|
||||
@ -6900,11 +6899,7 @@ func_mode_link ()
|
||||
# Finalize command for both is simple: just hardcode it.
|
||||
if test "$hardcode_direct" = yes &&
|
||||
test "$hardcode_direct_absolute" = no; then
|
||||
if test -f "$inst_prefix_dir$libdir/$linklib"; then
|
||||
add="$inst_prefix_dir$libdir/$linklib"
|
||||
else
|
||||
add="$libdir/$linklib"
|
||||
fi
|
||||
add="$libdir/$linklib"
|
||||
elif test "$hardcode_minus_L" = yes; then
|
||||
add_dir="-L$libdir"
|
||||
add="-l$name"
|
||||
@ -7396,7 +7391,6 @@ func_mode_link ()
|
||||
# Calculate the version variables.
|
||||
major=
|
||||
versuffix=
|
||||
versuffix2=
|
||||
verstring=
|
||||
case $version_type in
|
||||
none) ;;
|
||||
@ -7457,7 +7451,6 @@ func_mode_link ()
|
||||
func_arith $current - $age
|
||||
major=.$func_arith_result
|
||||
versuffix="$major.$age.$revision"
|
||||
versuffix2="$major.$age"
|
||||
;;
|
||||
|
||||
osf)
|
||||
@ -7518,10 +7511,8 @@ func_mode_link ()
|
||||
esac
|
||||
if test "$need_version" = no; then
|
||||
versuffix=
|
||||
versuffix2=
|
||||
else
|
||||
versuffix=".0.0"
|
||||
versuffix2=".0.0"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -7529,7 +7520,6 @@ func_mode_link ()
|
||||
if test "$avoid_version" = yes && test "$need_version" = no; then
|
||||
major=
|
||||
versuffix=
|
||||
versuffix2=
|
||||
verstring=""
|
||||
fi
|
||||
|
||||
@ -7640,7 +7630,7 @@ func_mode_link ()
|
||||
*-*-netbsd*)
|
||||
# Don't link with libc until the a.out ld.so is fixed.
|
||||
;;
|
||||
*-*-openbsd* | *-*-mirbsd* | *-*-freebsd* | *-*-dragonfly*)
|
||||
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
||||
# Do not include libc due to us having libc/libc_r.
|
||||
;;
|
||||
*-*-sco3.2v5* | *-*-sco5v6*)
|
||||
@ -7663,14 +7653,12 @@ func_mode_link ()
|
||||
libname_save=$libname
|
||||
release_save=$release
|
||||
versuffix_save=$versuffix
|
||||
versuffix2_save=$versuffix2
|
||||
major_save=$major
|
||||
# I'm not sure if I'm treating the release correctly. I think
|
||||
# release should show up in the -l (ie -lgmp5) so we don't want to
|
||||
# add it in twice. Is that correct?
|
||||
release=""
|
||||
versuffix=""
|
||||
versuffix2=""
|
||||
major=""
|
||||
newdeplibs=
|
||||
droppeddeps=no
|
||||
@ -7947,7 +7935,6 @@ EOF
|
||||
;;
|
||||
esac
|
||||
versuffix=$versuffix_save
|
||||
versuffix2=$versuffix2_save
|
||||
major=$major_save
|
||||
release=$release_save
|
||||
libname=$libname_save
|
||||
@ -9432,8 +9419,7 @@ dlpreopen='$dlprefiles'
|
||||
|
||||
# Directory that this library needs to be installed in:
|
||||
libdir='$install_libdir'"
|
||||
if test "$installed" = no && test "$need_relink" = yes && \
|
||||
test -n "$relink_command"; then
|
||||
if test "$installed" = no && test "$need_relink" = yes; then
|
||||
$ECHO >> $output "\
|
||||
relink_command=\"$relink_command\""
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: acorn,v 1.5 2009/09/19 16:28:07 christos Exp $
|
||||
# $File: acorn,v 1.6 2017/10/19 16:40:37 christos Exp $
|
||||
# acorn: file(1) magic for files found on Acorn systems
|
||||
#
|
||||
|
||||
@ -67,3 +67,36 @@
|
||||
>>8 byte x version %d,
|
||||
>>10 leshort =1 1 pattern
|
||||
>>10 leshort !1 %d patterns
|
||||
|
||||
# From: Joerg Jenderek
|
||||
# URL: https://www.kyzer.me.uk/pack/xad/#PackDir
|
||||
# reference: https://www.kyzer.me.uk/pack/xad/xad_PackDir.lha/PackDir.c
|
||||
# GRR: line below is too general as it matches also "Git pack" in ./revision
|
||||
0 string PACK\0
|
||||
# check for valid compression method 0-4
|
||||
>5 ulelong <5
|
||||
# https://www.riscosopen.org/wiki/documentation/show/Introduction%20To%20Filing%20Systems
|
||||
# To skip "Git pack" version 0 test for root directory object like
|
||||
# ADFS::RPC.$.websitezip.FONTFIX
|
||||
>>9 string >ADFS\ PackDir archive (RISC OS)
|
||||
# TrID labels above as "Acorn PackDir compressed Archive"
|
||||
# compression mode y (0 - 4) for GIF LZW with a maximum n bits
|
||||
# (y~n,0~12,1~13,2~14,3~15,4~16)
|
||||
>>>5 ulelong+12 x \b, LZW %u-bits compression
|
||||
# http://www.filebase.org.uk/filetypes
|
||||
# !Packdir compressed archive has three hexadecimal digits code 68E
|
||||
!:mime application/x-acorn-68E
|
||||
!:ext pkd/bin
|
||||
# null terminated root directory object like IDEFS::IDE-4.$.Apps.GRAPHICS.!XFMPdemo
|
||||
>>>9 string x \b, root "%s"
|
||||
# load address 0xFFFtttdd, ttt is the object filetype and dddddddddd is time
|
||||
>>>>&1 ulelong x \b, load address 0x%x
|
||||
# execution address 0xdddddddd dddddddddd is 40 bit unsigned centiseconds since 1.1.1900 UTC
|
||||
>>>>&5 ulelong x \b, exec address 0x%x
|
||||
# attributes (bits: 0~owner read,1~owner write,3~no delete,4~public read,5~public write)
|
||||
>>>>&9 ulelong x \b, attributes 0x%x
|
||||
# number of entries in this directory. for root dir 0
|
||||
#>>>&13 ulelong x \b, entries 0x%x
|
||||
# the entries start here with object name
|
||||
>>>>&17 string x \b, 1st object "%s"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: animation,v 1.63 2017/05/26 14:33:07 christos Exp $
|
||||
# $File: animation,v 1.66 2017/10/06 15:36:38 christos Exp $
|
||||
# animation: file(1) magic for animation/movie formats
|
||||
#
|
||||
# animation formats
|
||||
@ -56,20 +56,20 @@
|
||||
>>11 byte 6 \b, Release 6 MBMS Extended Presentations
|
||||
>>11 byte 7 \b, Release 7 MBMS Extended Presentations
|
||||
>8 string 3gg \b, MPEG v4 system, 3GPP
|
||||
>11 byte 6 \b, Release 6 General Profile
|
||||
!:mime video/3gpp
|
||||
>>11 byte 6 \b, Release 6 General Profile
|
||||
>8 string 3gp \b, MPEG v4 system, 3GPP
|
||||
>11 byte 1 \b, Release %d (non existent)
|
||||
>11 byte 2 \b, Release %d (non existent)
|
||||
>11 byte 3 \b, Release %d (non existent)
|
||||
>11 byte 4 \b, Release %d
|
||||
>11 byte 5 \b, Release %d
|
||||
>11 byte 6 \b, Release %d
|
||||
>11 byte 7 \b, Release %d Streaming Servers
|
||||
!:mime video/3gpp
|
||||
>>11 byte 1 \b, Release %d (non existent)
|
||||
>>11 byte 2 \b, Release %d (non existent)
|
||||
>>11 byte 3 \b, Release %d (non existent)
|
||||
>>11 byte 4 \b, Release %d
|
||||
>>11 byte 5 \b, Release %d
|
||||
>>11 byte 6 \b, Release %d
|
||||
>>11 byte 7 \b, Release %d Streaming Servers
|
||||
>8 string 3gs \b, MPEG v4 system, 3GPP
|
||||
>11 byte 7 \b, Release %d Streaming Servers
|
||||
!:mime video/3gpp
|
||||
>>11 byte 7 \b, Release %d Streaming Servers
|
||||
>8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC [ISO 14496-12:2005]
|
||||
!:mime video/mp4
|
||||
>8 string/W qt \b, Apple QuickTime movie
|
||||
@ -188,6 +188,36 @@
|
||||
>8 string pana \b, Panasonic Digital Camera
|
||||
>8 string qt \b, Apple QuickTime (.MOV/QT)
|
||||
!:mime video/quicktime
|
||||
# HEIF image format
|
||||
# see https://nokiatech.github.io/heif/technical.html
|
||||
>8 string mif1 \b, HEIF Image
|
||||
!:mime image/heif
|
||||
>8 string msf1 \b, HEIF Image Sequence
|
||||
!:mime image/heif-sequence
|
||||
>8 string heic \b, HEIF Image HEVC Main or Main Still Picture Profile
|
||||
!:mime image/heic
|
||||
>8 string heix \b, HEIF Image HEVC Main 10 Profile
|
||||
!:mime image/heic
|
||||
>8 string hevc \b, HEIF Image Sequenz HEVC Main or Main Still Picture Profile
|
||||
!:mime image/heic-sequence
|
||||
>8 string hevx \b, HEIF Image Sequence HEVC Main 10 Profile
|
||||
!:mime image/heic-sequence
|
||||
# following HEIF brands are not mentioned in the heif technical info currently (Oct 2017)
|
||||
# but used in the reference implementation:
|
||||
# https://github.com/nokiatech/heif/blob/d5e9a21c8ba8df712bdf643021dd9f6518134776/Srcs/reader/hevcimagefilereader.cpp
|
||||
>8 string heim \b, HEIF Image L-HEVC
|
||||
!:mime image/heif
|
||||
>8 string heis \b, HEIF Image L-HEVC
|
||||
!:mime image/heif
|
||||
>8 string avic \b, HEIF Image AVC
|
||||
!:mime image/heif
|
||||
>8 string hevm \b, HEIF Image Sequence L-HEVC
|
||||
!:mime image/heif-sequence
|
||||
>8 string hevs \b, HEIF Image Sequence L-HEVC
|
||||
!:mime image/heif-sequence
|
||||
>8 string avcs \b, HEIF Image Sequence AVC
|
||||
!:mime image/heif-sequence
|
||||
|
||||
>8 string ROSS \b, Ross Video
|
||||
>8 string sdv \b, SD Memory Card Video
|
||||
>8 string ssc1 \b, Samsung stereo, single stream (patent pending)
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: apple,v 1.36 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: apple,v 1.39 2018/03/02 15:26:39 christos Exp $
|
||||
# apple: file(1) magic for Apple file formats
|
||||
#
|
||||
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
|
||||
@ -431,3 +431,19 @@
|
||||
>>>>0 use appleworks
|
||||
>0 belong 0x0481ad00
|
||||
>>0 use appleworks
|
||||
|
||||
# magic for Apple File System (APFS)
|
||||
# from Alex Myczko <alex@aiei.ch>
|
||||
32 string NXSB Apple File System (APFS)
|
||||
>36 ulelong x \b, blocksize %u
|
||||
|
||||
# iTunes cover art (versions 1 and 2)
|
||||
4 string itch
|
||||
>24 string artw
|
||||
>>0x1e8 string data iTunes cover art
|
||||
>>>0x1ed string PNG (PNG)
|
||||
>>>0x1ec beshort 0xffd8 (JPEG)
|
||||
|
||||
# MacPaint image
|
||||
65 string PNTGMPNT MacPaint image data
|
||||
#0 belong 2 MacPaint image data
|
||||
|
@ -1,16 +1,150 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: archive,v 1.108 2017/08/30 13:45:10 christos Exp $
|
||||
# $File: archive,v 1.117 2018/03/17 02:11:04 christos Exp $
|
||||
# archive: file(1) magic for archive formats (see also "msdos" for self-
|
||||
# extracting compressed archives)
|
||||
#
|
||||
# cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc.
|
||||
# pre-POSIX "tar" archives are handled in the C code.
|
||||
# pre-POSIX "tar" archives are also handled in the C code ../../src/is_tar.c.
|
||||
|
||||
# POSIX tar archives
|
||||
257 string ustar\0 POSIX tar archive
|
||||
!:mime application/x-tar # encoding: posix
|
||||
257 string ustar\040\040\0 GNU tar archive
|
||||
!:mime application/x-tar # encoding: gnu
|
||||
# URL: https://en.wikipedia.org/wiki/Tar_(computing)
|
||||
# Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current
|
||||
# header mainly padded with nul bytes
|
||||
500 quad 0
|
||||
# filename or extended attribute printable strings in range space null til umlaut ue
|
||||
>0 ubeshort >0x1F00
|
||||
>>0 ubeshort <0xFCFD
|
||||
# last 4 header bytes often null but tar\0 in gtarfail2.tar gtarfail.tar-bad
|
||||
# at https://sourceforge.net/projects/s-tar/files/testscripts/
|
||||
>>>508 ubelong&0x8B9E8DFF 0
|
||||
# nul, space or ascii digit 0-7 at start of mode
|
||||
>>>>100 ubyte&0xC8 =0
|
||||
>>>>>101 ubyte&0xC8 =0
|
||||
# nul, space at end of check sum
|
||||
>>>>>>155 ubyte&0xDF =0
|
||||
# space or ascii digit 0 at start of check sum
|
||||
>>>>>>>148 ubyte&0xEF =0x20
|
||||
>>>>>>>>0 use tar-file
|
||||
# minimal check and then display tar archive information which can also be
|
||||
# embedded inside others like Android Backup, Clam AntiVirus database
|
||||
0 name tar-file
|
||||
>257 string !ustar
|
||||
# header padded with nuls
|
||||
>>257 ulong =0
|
||||
# GNU tar version 1.29 with non pax format option without refusing
|
||||
# creates misleading V7 header for Long path, Multi-volume, Volume type
|
||||
>>>156 ubyte 0x4c GNU tar archive
|
||||
!:mime application/x-gtar
|
||||
!:ext tar/gtar
|
||||
>>>156 ubyte 0x4d GNU tar archive
|
||||
!:mime application/x-gtar
|
||||
!:ext tar/gtar
|
||||
>>>156 ubyte 0x56 GNU tar archive
|
||||
!:mime application/x-gtar
|
||||
!:ext tar/gtar
|
||||
>>>156 default x tar archive (V7)
|
||||
!:mime application/x-tar
|
||||
!:ext tar
|
||||
# other stuff in padding
|
||||
# some implementations add new fields to the blank area at the end of the header record
|
||||
# created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option
|
||||
>>257 ulong !0 tar archive (old)
|
||||
!:mime application/x-tar
|
||||
!:ext tar
|
||||
# magic in newer, GNU, posix variants
|
||||
>257 string =ustar
|
||||
# 2 last char of magic and UStar version because string expression does not work
|
||||
# 2 space characters followed by a null for GNU variant
|
||||
>>261 ubelong =0x72202000 POSIX tar archive (GNU)
|
||||
!:mime application/x-gtar
|
||||
!:ext tar/gtar
|
||||
# UStar version with ASCII "00"
|
||||
>>261 ubelong 0x72003030 POSIX
|
||||
# gLOBAL and ExTENSION type only found in POSIX.1-2001 format
|
||||
>>>156 ubyte 0x67 \b.1-2001
|
||||
>>>156 ubyte 0x78 \b.1-2001
|
||||
>>>156 ubyte x tar archive
|
||||
!:mime application/x-ustar
|
||||
!:ext tar/ustar
|
||||
# version with 2 binary nuls embedded in Android Backup like com.android.settings.ab
|
||||
>>261 ubelong 0x72000000 tar archive (ustar)
|
||||
!:mime application/x-ustar
|
||||
!:ext tar/ustar
|
||||
# not seen ustar variant with garbish version
|
||||
>>261 default x tar archive (unknown ustar)
|
||||
!:mime application/x-ustar
|
||||
!:ext tar/ustar
|
||||
# type flag of 1st tar archive member
|
||||
#>156 ubyte x \b, %c-type
|
||||
>156 ubyte x
|
||||
>>156 ubyte 0 \b, file
|
||||
>>156 ubyte 0x30 \b, file
|
||||
>>156 ubyte 0x31 \b, hard link
|
||||
>>156 ubyte 0x32 \b, symlink
|
||||
>>156 ubyte 0x33 \b, char device
|
||||
>>156 ubyte 0x34 \b, block device
|
||||
>>156 ubyte 0x35 \b, directory
|
||||
>>156 ubyte 0x36 \b, fifo
|
||||
>>156 ubyte 0x37 \b, reserved
|
||||
>>156 ubyte 0x4c \b, long path
|
||||
>>156 ubyte 0x4d \b, multi volume
|
||||
>>156 ubyte 0x56 \b, volume
|
||||
>>156 ubyte 0x67 \b, global
|
||||
>>156 ubyte 0x78 \b, extension
|
||||
>>156 default x \b, type
|
||||
>>>156 ubyte x '%c'
|
||||
# name[100]
|
||||
>0 string >\0 %-.60s
|
||||
# mode mainly stored as an octal number in ASCII null or space terminated
|
||||
>100 string >\0 \b, mode %-.7s
|
||||
# user id mainly as octal numbers in ASCII null or space terminated
|
||||
>108 string >\0 \b, uid %-.7s
|
||||
# group id mainly as octal numbers in ASCII null or space terminated
|
||||
>116 string >\0 \b, gid %-.7s
|
||||
# size mainly as octal number in ASCII
|
||||
>124 ubyte <0x38
|
||||
>>124 string >\0 \b, size %-.12s
|
||||
# coding indicated by setting the high-order bit of the leftmost byte
|
||||
>124 ubyte >0xEF \b, size 0x
|
||||
>>124 ubyte !0xff \b%2.2x
|
||||
>>125 ubyte !0xff \b%2.2x
|
||||
>>126 ubyte !0xff \b%2.2x
|
||||
>>127 ubyte !0xff \b%2.2x
|
||||
>>128 ubyte !0xff \b%2.2x
|
||||
>>129 ubyte !0xff \b%2.2x
|
||||
>>130 ubyte !0xff \b%2.2x
|
||||
>>131 ubyte !0xff \b%2.2x
|
||||
>>132 ubyte !0xff \b%2.2x
|
||||
>>133 ubyte !0xff \b%2.2x
|
||||
>>134 ubyte !0xff \b%2.2x
|
||||
>>135 ubyte !0xff \b%2.2x
|
||||
# seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated
|
||||
>136 string >\0 \b, seconds %-.11s
|
||||
# header checksum stored as an octal number in ASCII null or space terminated
|
||||
#>148 string x \b, cksum %.7s
|
||||
# linkname[100]
|
||||
>157 string >\0 \b, linkname %-.40s
|
||||
# additional fields for ustar
|
||||
>257 string =ustar
|
||||
# owner user name null terminated
|
||||
>>265 string >\0 \b, user %-.32s
|
||||
# group name null terminated
|
||||
>>297 string >\0 \b, group %-.32s
|
||||
# device major minor if not zero
|
||||
>>329 ubequad&0xCFCFCFCFcFcFcFdf !0
|
||||
>>>329 string x \b, devmaj %-.7s
|
||||
>>337 ubequad&0xCFCFCFCFcFcFcFdf !0
|
||||
>>>337 string x \b, devmin %-.7s
|
||||
# prefix[155]
|
||||
>>345 string >\0 \b, prefix %-.155s
|
||||
# old non ustar/POSIX tar
|
||||
>257 string !ustar
|
||||
>>508 string =tar\0
|
||||
# padding[255] in old star
|
||||
>>>257 string >\0 \b, padding: %-.40s
|
||||
>>508 default x
|
||||
# padding[255] in old tar sometimes comment field
|
||||
>>>257 string >\0 \b, comment: %-.40s
|
||||
|
||||
# Incremental snapshot gnu-tar format from:
|
||||
# http://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
|
||||
@ -272,15 +406,115 @@
|
||||
# PPMZ
|
||||
0 string PPMZ PPMZ archive data
|
||||
# MS Compress
|
||||
4 string \x88\xf0\x27 MS Compress archive data
|
||||
# updated by Joerg Jenderek
|
||||
>9 string \0
|
||||
>>0 string KWAJ
|
||||
>>>7 string \321\003 MS Compress archive data
|
||||
>>>>14 ulong >0 \b, original size: %d bytes
|
||||
>>>>18 ubyte >0x65
|
||||
>>>>>18 string x \b, was %.8s
|
||||
>>>>>(10.b-4) string x \b.%.3s
|
||||
# Update: Joerg Jenderek
|
||||
# URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
|
||||
# Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html
|
||||
# Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z
|
||||
4 string \x88\xf0\x27
|
||||
# KWAJ variant
|
||||
>0 string KWAJ MS Compress archive data, KWAJ variant
|
||||
!:mime application/x-ms-compress-kwaj
|
||||
# extension not working in version 5.32
|
||||
# magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?'
|
||||
# file: line 284: Bad magic entry ' ??_'
|
||||
!:ext ??_
|
||||
# compression method (0-4)
|
||||
>>8 uleshort x \b, %u method
|
||||
# offset of compressed data
|
||||
>>10 uleshort x \b, 0x%x offset
|
||||
#>>(10.s) uleshort x
|
||||
#>>>&-6 string x \b, TEST extension %-.3s
|
||||
# header flags to mark header extensions
|
||||
>>12 uleshort >0 \b, 0x%x flags
|
||||
# 4 bytes: decompressed length of file
|
||||
>>12 uleshort &0x01
|
||||
>>>14 ulelong x \b, original size: %u bytes
|
||||
# 2 bytes: unknown purpose
|
||||
# 2 bytes: length of unknown data + mentioned bytes
|
||||
# 1-9 bytes: null-terminated file name
|
||||
# 1-4 bytes: null-terminated file extension
|
||||
>>12 uleshort &0x08
|
||||
>>>12 uleshort ^0x01
|
||||
>>>>12 uleshort ^0x02
|
||||
>>>>>12 uleshort ^0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>14 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>14 string x \b, %-.8s
|
||||
>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>>12 uleshort &0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>(14.s) uleshort x
|
||||
>>>>>>>>&14 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>(14.s) uleshort x
|
||||
>>>>>>>>&14 string x \b, %-.8s
|
||||
>>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>12 uleshort &0x02
|
||||
>>>>>12 uleshort ^0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>16 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>16 string x \b, %-.8s
|
||||
>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>>12 uleshort &0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>(16.s) uleshort x
|
||||
>>>>>>>>&16 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>(16.s) uleshort x
|
||||
>>>>>>>&16 string x %-.8s
|
||||
>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>12 uleshort &0x01
|
||||
>>>>12 uleshort ^0x02
|
||||
>>>>>12 uleshort ^0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>18 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>18 string x \b, %-.8s
|
||||
>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>>12 uleshort &0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>(18.s) uleshort x
|
||||
>>>>>>>>&18 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>(18.s) uleshort x
|
||||
>>>>>>>>&18 string x \b, %-.8s
|
||||
>>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>12 uleshort &0x02
|
||||
>>>>>12 uleshort ^0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>20 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>20 string x \b, %-.8s
|
||||
>>>>>>>>&1 string x \b.%-.3s
|
||||
>>>>>12 uleshort &0x04
|
||||
>>>>>>12 uleshort ^0x10
|
||||
>>>>>>>(20.s) uleshort x
|
||||
>>>>>>>>&20 string x \b, %-.8s
|
||||
>>>>>>12 uleshort &0x10
|
||||
>>>>>>>(20.s) uleshort x
|
||||
>>>>>>>>&20 string x \b, %-.8s
|
||||
>>>>>>>>>&1 string x \b.%-.3s
|
||||
# 2 bytes: length of data + mentioned bytes
|
||||
#
|
||||
# SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
|
||||
>0 string SZDD MS Compress archive data, SZDD variant
|
||||
!:mime application/x-ms-compress-szdd
|
||||
!:ext ??_
|
||||
# The character missing from the end of the filename (0=unknown)
|
||||
>>9 string >\0 \b, %-.1s is last character of original name
|
||||
# https://www.betaarchive.com/forum/viewtopic.php?t=26161
|
||||
# Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
|
||||
>>8 string !A \b, %-.1s method
|
||||
>>10 ulelong >0 \b, original size: %u bytes
|
||||
# QBasic SZDD variant
|
||||
3 string \x88\xf0\x27
|
||||
>0 string SZ\x20 MS Compress archive data, QBasic variant
|
||||
!:mime application/x-ms-compress-sz
|
||||
!:ext ??$
|
||||
>>8 ulelong >0 \b, original size: %u bytes
|
||||
|
||||
# MP3 (archiver, not lossy audio compression)
|
||||
0 string MP3\x1a MP3-Archiver archive data
|
||||
# ZET
|
||||
@ -483,9 +717,19 @@
|
||||
|
||||
# These were inspired by idarc, but actually verified
|
||||
# Dzip archiver (.dz)
|
||||
0 string DZ Dzip archive data
|
||||
>2 byte x \b, version %i
|
||||
>3 byte x \b.%i
|
||||
# Update: Joerg Jenderek
|
||||
# URL: http://speeddemosarchive.com/dzip/
|
||||
# reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c
|
||||
# GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt
|
||||
0 string DZ
|
||||
# latest version is 2.9 dated 7 may 2003
|
||||
>2 byte <4 Dzip archive data
|
||||
!:mime application/x-dzip
|
||||
!:ext dz
|
||||
>>2 byte x \b, version %i
|
||||
>>3 byte x \b.%i
|
||||
>>4 ulelong x \b, offset 0x%x
|
||||
>>8 ulelong x \b, %u files
|
||||
# ZZip archiver (.zz)
|
||||
0 string ZZ\ \0\0 ZZip archive data
|
||||
0 string ZZ0 ZZip archive data
|
||||
@ -857,6 +1101,9 @@
|
||||
!:mime application/vnd.oasis.opendocument.formula-template
|
||||
>>>73 string database Database
|
||||
!:mime application/vnd.oasis.opendocument.database
|
||||
# Valid for LibreOffice Base 6.0.1.1 at least
|
||||
>>>73 string base Database
|
||||
!:mime application/vnd.oasis.opendocument.base
|
||||
>>>73 string image
|
||||
>>>>78 byte !0x2d Image
|
||||
!:mime application/vnd.oasis.opendocument.image
|
||||
@ -904,21 +1151,9 @@
|
||||
>(26.s+30) leshort !0xcafe
|
||||
>>26 string !\x8\0\0\0mimetype Zip archive data
|
||||
!:mime application/zip
|
||||
>>>4 byte 0x09 \b, at least v0.9 to extract
|
||||
>>>4 byte 0x0a \b, at least v1.0 to extract
|
||||
>>>4 byte 0x0b \b, at least v1.1 to extract
|
||||
>>>4 byte 0x14 \b, at least v2.0 to extract
|
||||
>>>4 byte 0x15 \b, at least v2.1 to extract
|
||||
>>>4 byte 0x19 \b, at least v2.5 to extract
|
||||
>>>4 byte 0x1b \b, at least v2.7 to extract
|
||||
>>>4 byte 0x2d \b, at least v4.5 to extract
|
||||
>>>4 byte 0x2e \b, at least v4.6 to extract
|
||||
>>>4 byte 0x32 \b, at least v5.0 to extract
|
||||
>>>4 byte 0x33 \b, at least v5.1 to extract
|
||||
>>>4 byte 0x34 \b, at least v5.2 to extract
|
||||
>>>4 byte 0x3d \b, at least v6.1 to extract
|
||||
>>>4 byte 0x3e \b, at least v6.2 to extract
|
||||
>>>4 byte 0x3f \b, at least v6.3 to extract
|
||||
>>>4 beshort x \b, at least
|
||||
>>>4 use zipversion
|
||||
>>>4 beshort x to extract
|
||||
>>>0x161 string WINZIP \b, WinZIP self-extracting
|
||||
|
||||
# StarView Metafile
|
||||
@ -1014,6 +1249,8 @@
|
||||
|
||||
# Alternate ZIP string (amc@arwen.cs.berkeley.edu)
|
||||
0 string PK00PK\003\004 Zip archive data
|
||||
!:mime application/zip
|
||||
!:ext zip/cbz
|
||||
|
||||
# ACE archive (from http://www.wotsit.org/download.asp?f=ace)
|
||||
# by Stefan `Sec` Zehl <sec@42.org>
|
||||
@ -1186,3 +1423,6 @@
|
||||
# reference: https://github.com/MarcoPon/SeqBox
|
||||
0 string SBx SeqBox,
|
||||
>3 byte x version %d
|
||||
|
||||
# LyNX archive
|
||||
56 string USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE LyNX archive
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: audio,v 1.80 2017/08/13 00:21:47 christos Exp $
|
||||
# $File: audio,v 1.86 2018/03/11 00:53:11 christos Exp $
|
||||
# audio: file(1) magic for sound formats (see also "iff")
|
||||
#
|
||||
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
|
||||
@ -450,7 +450,7 @@
|
||||
# Free lossless audio codec <http://flac.sourceforge.net>
|
||||
# From: Przemyslaw Augustyniak <silvathraec@rpg.pl>
|
||||
0 string fLaC FLAC audio bitstream data
|
||||
!:mime audio/x-flac
|
||||
!:mime audio/flac
|
||||
>4 byte&0x7f >0 \b, unknown version
|
||||
>4 byte&0x7f 0 \b
|
||||
# some common bits/sample values
|
||||
@ -468,20 +468,25 @@
|
||||
>>20 byte&0xe 0xa \b, 6 channels
|
||||
>>20 byte&0xe 0xc \b, 7 channels
|
||||
>>20 byte&0xe 0xe \b, 8 channels
|
||||
# some common sample rates
|
||||
>>17 belong&0xfffff0 0x2ee000 \b, 192 kHz
|
||||
>>17 belong&0xfffff0 0x158880 \b, 88.2 kHz
|
||||
>>17 belong&0xfffff0 0x0ac440 \b, 44.1 kHz
|
||||
>>17 belong&0xfffff0 0x0bb800 \b, 48 kHz
|
||||
>>17 belong&0xfffff0 0x07d000 \b, 32 kHz
|
||||
>>17 belong&0xfffff0 0x056220 \b, 22.05 kHz
|
||||
>>17 belong&0xfffff0 0x05dc00 \b, 24 kHz
|
||||
>>17 belong&0xfffff0 0x03e800 \b, 16 kHz
|
||||
>>17 belong&0xfffff0 0x02b110 \b, 11.025 kHz
|
||||
>>17 belong&0xfffff0 0x02ee00 \b, 12 kHz
|
||||
>>17 belong&0xfffff0 0x01f400 \b, 8 kHz
|
||||
>>17 belong&0xfffff0 0x177000 \b, 96 kHz
|
||||
>>17 belong&0xfffff0 0x0fa000 \b, 64 kHz
|
||||
# sample rates derived from known oscillator frequencies;
|
||||
# 24.576 MHz (video/fs=48kHz), 22.5792 (audio/fs=44.1kHz) and
|
||||
# 16.384 (other/fs=32kHz).
|
||||
>>17 belong&0xfffff0 0x02b110 \b, 11.025 kHz
|
||||
>>17 belong&0xfffff0 0x03e800 \b, 16 kHz
|
||||
>>17 belong&0xfffff0 0x056220 \b, 22.05 kHz
|
||||
>>17 belong&0xfffff0 0x05dc00 \b, 24 kHz
|
||||
>>17 belong&0xfffff0 0x07d000 \b, 32 kHz
|
||||
>>17 belong&0xfffff0 0x0ac440 \b, 44.1 kHz
|
||||
>>17 belong&0xfffff0 0x0bb800 \b, 48 kHz
|
||||
>>17 belong&0xfffff0 0x0fa000 \b, 64 kHz
|
||||
>>17 belong&0xfffff0 0x158880 \b, 88.2 kHz
|
||||
>>17 belong&0xfffff0 0x177000 \b, 96 kHz
|
||||
>>17 belong&0xfffff0 0x1f4000 \b, 128 kHz
|
||||
>>17 belong&0xfffff0 0x2b1100 \b, 176.4 kHz
|
||||
>>17 belong&0xfffff0 0x2ee000 \b, 192 kHz
|
||||
>>17 belong&0xfffff0 0x3e8000 \b, 256 kHz
|
||||
>>17 belong&0xfffff0 0x562200 \b, 352.8 kHz
|
||||
>>17 belong&0xfffff0 0x5dc000 \b, 384 kHz
|
||||
>>21 byte&0xf >0 \b, >4G samples
|
||||
>>21 byte&0xf 0 \b
|
||||
>>>22 belong >0 \b, %u samples
|
||||
@ -529,7 +534,7 @@
|
||||
>>12 ulelong x \b, sample rate %d
|
||||
|
||||
# adlib sound files
|
||||
# From Gurkan Sengun <gurkan@linuks.mine.nu>, http://www.linuks.mine.nu
|
||||
# From: Alex Myczko <alex@aiei.ch>
|
||||
0 string RAWADATA RdosPlay RAW
|
||||
|
||||
1068 string RoR AMUSIC Adlib Tracker
|
||||
@ -810,3 +815,46 @@
|
||||
>>>0x31 byte/16 x Version %d.
|
||||
>>>0x31 byte&0x0F x \b%02d
|
||||
>>>>0x4 string >\0 \b, title: "%s"
|
||||
|
||||
# magic for Klystrack, http://kometbomb.github.io/klystrack/
|
||||
# from Alex Myczko <alex@aiei.ch>
|
||||
0 string cyd!song Klystrack song
|
||||
>8 byte >0 \b, version %u
|
||||
>8 byte >26
|
||||
#>>9 byte x \b, channels %u
|
||||
#>>10 leshort x \b, time signature %u
|
||||
#>>12 leshort x \b, sequence step %u
|
||||
#>>14 byte x \b, instruments %u
|
||||
#>>15 leshort x \b, patterns %u
|
||||
#>>17 leshort x \b, sequences %u
|
||||
#>>19 leshort x \b, length %u
|
||||
#>>21 leshort x \b, loop point %u
|
||||
#>>23 byte x \b, master volume %u
|
||||
#>>24 byte x \b, song speed %u
|
||||
#>>25 byte x \b, song speed2 %u
|
||||
#>>26 byte x \b, song rate %u
|
||||
#>>27 belong x \b, flags %#x
|
||||
#>>31 byte x \b, multiplex period %u
|
||||
#>>32 byte x \b, pitch inaccuracy %u
|
||||
>>149 pstring x \b, title %s
|
||||
|
||||
0 string cyd!inst Klystrack instrument
|
||||
|
||||
# magic for WOPL instrument files, https://github.com/Wohlstand/OPL3BankEditor
|
||||
# see Specifications/WOPL-and-OPLI-Specification.txt
|
||||
|
||||
0 string WOPL3-INST\0 WOPL instrument
|
||||
>11 leshort x \b, version %u
|
||||
0 string WOPL3-BANK\0 WOPL instrument bank
|
||||
>11 leshort x \b, version %u
|
||||
|
||||
# AdLib/OPL instrument files. Format specifications on
|
||||
# http://www.shikadi.net/moddingwiki
|
||||
0 string Junglevision\ Patch\ File Junglevision instrument data
|
||||
0 string #OPL_II# DMX OP2 instrument data
|
||||
0 string IBK\x1a IBK instrument data
|
||||
0 string 2OP\x1a IBK instrument data, 2 operators
|
||||
0 string 4OP\x1a IBK instrument data, 4 operators
|
||||
2 string ADLIB- AdLib instrument data
|
||||
>0 byte x \b, version %u
|
||||
>1 byte x \b.%u
|
||||
|
7
magic/Magdir/beetle
Normal file
7
magic/Magdir/beetle
Normal file
@ -0,0 +1,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: beetle,v 1.2 2018/02/05 23:42:17 rrt Exp $
|
||||
# beetle: file(1) magic for Beetle VM object files
|
||||
# https://github.com/rrthomas/beetle/
|
||||
|
||||
# Beetle object module
|
||||
0 string BEETLE\000 Beetle VM object file
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: c64,v 1.6 2015/08/24 05:17:42 christos Exp $
|
||||
# $File: c64,v 1.7 2017/11/15 12:19:06 christos Exp $
|
||||
# c64: file(1) magic for various commodore 64 related files
|
||||
#
|
||||
# From: Dirk Jagdmann <doj@cubic.org>
|
||||
@ -46,4 +46,13 @@
|
||||
# Esa Hyyti <esa@netlab.tkk.fi>
|
||||
0 string C64-TAPE-RAW C64 Raw Tape File (.tap),
|
||||
>0x0c byte x Version:%u,
|
||||
>0x10 lelong x Length:%u cycles
|
||||
>0x10 lelong x Length:%u cycles
|
||||
|
||||
# magic for Goattracker2, http://covertbitops.c64.org/
|
||||
# from Alex Myczko <alex@aiei.ch>
|
||||
0 string GTS5 GoatTracker 2 song
|
||||
>4 string >\0 \b, "%s"
|
||||
>36 string >\0 \b by %s
|
||||
>68 string >\0 \b (C) %s
|
||||
>100 byte >0 \b, %u subsong(s)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: compress,v 1.68 2017/05/25 20:07:23 christos Exp $
|
||||
# $File: compress,v 1.72 2018/03/27 23:26:41 christos Exp $
|
||||
# compress: file(1) magic for pure-compression formats (no archives)
|
||||
#
|
||||
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
||||
@ -49,6 +49,7 @@
|
||||
>9 byte =0x0B \b, from NTFS filesystem (NT)
|
||||
>9 byte =0x0C \b, from QDOS
|
||||
>9 byte =0x0D \b, from Acorn RISCOS
|
||||
>-4 lelong x \b, original size %d
|
||||
|
||||
# packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
|
||||
0 string \037\036 packed data
|
||||
@ -77,6 +78,12 @@
|
||||
!:mime application/x-bzip2
|
||||
>3 byte >47 \b, block size = %c00k
|
||||
|
||||
# bzip a block-sorting file compressor
|
||||
# by Julian Seward <sewardj@cs.man.ac.uk> and others
|
||||
0 string BZ0 bzip compressed data
|
||||
!:mime application/x-bzip
|
||||
>3 byte >47 \b, block size = %c00k
|
||||
|
||||
# lzip
|
||||
0 string LZIP lzip compressed data
|
||||
!:mime application/x-lzip
|
||||
@ -113,21 +120,6 @@
|
||||
#>99 byte&0xF0 0xd0
|
||||
#>132 byte&0xF0 0xd0 GSM 06.10 compressed audio
|
||||
|
||||
# bzip a block-sorting file compressor
|
||||
# by Julian Seward <sewardj@cs.man.ac.uk> and others
|
||||
#
|
||||
#0 string BZ bzip compressed data
|
||||
#>2 byte x \b, version: %c
|
||||
#>3 string =1 \b, compression block size 100k
|
||||
#>3 string =2 \b, compression block size 200k
|
||||
#>3 string =3 \b, compression block size 300k
|
||||
#>3 string =4 \b, compression block size 400k
|
||||
#>3 string =5 \b, compression block size 500k
|
||||
#>3 string =6 \b, compression block size 600k
|
||||
#>3 string =7 \b, compression block size 700k
|
||||
#>3 string =8 \b, compression block size 800k
|
||||
#>3 string =9 \b, compression block size 900k
|
||||
|
||||
# lzop from <markus.oberhumer@jk.uni-linz.ac.at>
|
||||
0 string \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data
|
||||
>9 beshort <0x0940
|
||||
@ -314,3 +306,22 @@
|
||||
>>0 byte&0xf =8
|
||||
>>>0 byte&0x80 =0 zlib compressed data
|
||||
!:mime application/zlib
|
||||
|
||||
# BWC compression
|
||||
0 string BWC
|
||||
>3 byte 0 BWC compressed data
|
||||
|
||||
# UCL compression
|
||||
0 bequad 0x00e955434cff011a UCL compressed data
|
||||
|
||||
# Softlib archive
|
||||
0 string SLIB Softlib archive
|
||||
>4 leshort x \b, version %d
|
||||
>6 leshort x (contains %d files)
|
||||
|
||||
# URL: https://github.com/lzfse/lzfse/blob/master/src/lzfse_internal.h#L276
|
||||
# From: Eric Hall <eric.hall@darkart.com>
|
||||
0 string bvx- lzfse encoded, no compression
|
||||
0 string bvx1 lzfse compressed, uncompressed tables
|
||||
0 string bvx2 lzfse compressed, compressed tables
|
||||
0 string bvxn lzfse encoded, lzvn compressed
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: console,v 1.32 2017/08/13 00:21:47 christos Exp $
|
||||
# $File: console,v 1.35 2017/11/14 15:48:36 christos Exp $
|
||||
# Console game magic
|
||||
# Toby Deshane <hac@shoelace.digivill.net>
|
||||
|
||||
@ -510,7 +510,7 @@
|
||||
# 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: Alex Myczko <alex@aiei.ch>
|
||||
# From: David Pflug <david@pflug.email>
|
||||
# is the offset 12 or the offset 16 correct?
|
||||
# GBS (Game Boy Sound) magic
|
||||
|
17
magic/Magdir/dbpf
Normal file
17
magic/Magdir/dbpf
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: dbpf,v 1.1 2017/10/13 20:47:14 christos Exp $
|
||||
# dppf: Maxis Database Packed Files, the stored data file format used by all
|
||||
# Maxis games after the Sims: http://wiki.niotso.org/DBPF
|
||||
# http://www.wiki.sc4devotion.com/index.php?title=DBPF
|
||||
# 13 Oct 2017, Kip Warner <kip at thevertigo dot com>
|
||||
0 string DBPF Maxis Database Packed File
|
||||
>4 ulelong x \b, version: %u.
|
||||
>>8 ulelong x \b%u
|
||||
>>>36 ulelong x \b, files: %u
|
||||
!:ext dbpf/package/dat/sc4
|
||||
!:mime application/x-maxis-dbpf
|
||||
4 ulelong 1
|
||||
>8 ulelong !1
|
||||
>>24 ledate !0 \b, created: %s
|
||||
>>>28 ledate !0 \b, modified: %s
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: elf,v 1.70 2016/06/02 12:36:30 christos Exp $
|
||||
# $File: elf,v 1.72 2018/02/24 19:50:04 christos Exp $
|
||||
# elf: file(1) magic for ELF executables
|
||||
#
|
||||
# We have to check the byte order flag to see what byte order all the
|
||||
@ -48,8 +48,9 @@
|
||||
!:mime application/x-object
|
||||
>16 leshort 2 executable,
|
||||
!:mime application/x-executable
|
||||
>16 leshort 3 shared object,
|
||||
!:mime application/x-sharedlib
|
||||
>16 leshort 3 ${x?pie executable:shared object}
|
||||
|
||||
!:mime application/x-${x?pie-executable:sharedlib}
|
||||
>16 leshort 4 core file
|
||||
!:mime application/x-coredump
|
||||
# Core file detection is not reliable.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: filesystems,v 1.122 2017/07/21 10:34:41 christos Exp $
|
||||
# $File: filesystems,v 1.124 2018/01/12 12:35:30 christos Exp $
|
||||
# filesystems: file(1) magic for different filesystems
|
||||
#
|
||||
0 name partid
|
||||
@ -1732,6 +1732,16 @@
|
||||
#>0x464 lelong &0x0000020 (many subdirs)
|
||||
#>0x463 lelong &0x0000040 (extra isize)
|
||||
|
||||
# f2fs filesystem - Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
0x400 lelong 0xF2F52010 F2FS filesystem
|
||||
>0x46c belong x \b, UUID=%08x
|
||||
>0x470 beshort x \b-%04x
|
||||
>0x472 beshort x \b-%04x
|
||||
>0x474 beshort x \b-%04x
|
||||
>0x476 belong x \b-%08x
|
||||
>0x47a beshort x \b%04x
|
||||
>0x147c lestring16 x \b, volume name "%s"
|
||||
|
||||
# Minix filesystems - Juan Cespedes <cespedes@debian.org>
|
||||
0x410 leshort 0x137f
|
||||
!:strength / 2
|
||||
@ -1937,8 +1947,10 @@
|
||||
0 name cdrom
|
||||
>38913 string !NSR0 ISO 9660 CD-ROM filesystem data
|
||||
!:mime application/x-iso9660-image
|
||||
!:ext iso/iso9660
|
||||
>38913 string NSR0 UDF filesystem data
|
||||
!:mime application/x-iso9660-image
|
||||
!:ext iso/udf
|
||||
>>38917 string 1 (version 1.0)
|
||||
>>38917 string 2 (version 1.5)
|
||||
>>38917 string 3 (version 2.0)
|
||||
@ -1964,6 +1976,16 @@
|
||||
!:strength +34
|
||||
>0 use cdrom
|
||||
|
||||
# URL: https://en.wikipedia.org/wiki/NRG_(file_format)
|
||||
# Reference: https://dl.opendesktop.org/api/files/download/id/1460731811/
|
||||
# 11577-mount-iso-0.9.5.tar.bz2/mount-iso-0.9.5/install.sh
|
||||
# From: Joerg Jenderek
|
||||
# Note: Only for nero disc with once (DAO) type after 300 KB header
|
||||
339969 string CD001 Nero CD image at 0x4B000
|
||||
!:mime application/x-nrg
|
||||
!:ext nrg
|
||||
>307200 use cdrom
|
||||
|
||||
# .cso files
|
||||
# Reference: http://pismotec.com/ciso/ciso.h
|
||||
# NOTE: There are two other formats with the same magic but
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: fonts,v 1.37 2017/06/24 00:39:00 christos Exp $
|
||||
# $File: fonts,v 1.38 2017/11/14 15:48:36 christos Exp $
|
||||
# fonts: file(1) magic for font data
|
||||
#
|
||||
0 search/1 FONT ASCII vfont text
|
||||
@ -294,7 +294,7 @@
|
||||
0 string OTTO OpenType font data
|
||||
!:mime application/vnd.ms-opentype
|
||||
|
||||
# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
# From: Alex Myczko <alex@aiei.ch>
|
||||
0 string SplineFontDB: Spline Font Database
|
||||
!:mime application/vnd.font-fontforge-sfd
|
||||
>14 string x version %s
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: games,v 1.15 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: games,v 1.16 2017/10/19 16:40:37 christos Exp $
|
||||
# games: file(1) for games
|
||||
|
||||
# Fabio Bonelli <fabiobonelli@libero.it>
|
||||
@ -34,8 +34,44 @@
|
||||
|
||||
# Quake
|
||||
|
||||
0 string PACK Quake I or II world or extension
|
||||
>8 lelong >0 \b, %d entries
|
||||
# Update: Joerg Jenderek
|
||||
# URL: http://fileformats.archiveteam.org/wiki/PAK
|
||||
# reference: https://quakewiki.org/wiki/.pak
|
||||
# GRR: line below is too general as it matches also Acorn PackDir compressed Archive
|
||||
# and Git pack ./revision
|
||||
0 string PACK
|
||||
# real Quake examples like pak0.pak have only some hundreds like 150 files
|
||||
# So test for few files
|
||||
>8 ulelong <0x01000000
|
||||
# in file version 5.32 test for null terminator is only true for
|
||||
# offset ~< FILE_BYTES_MAX = 1 MB defined in ../../src/file.h
|
||||
# look for null terminator of 1st entry name
|
||||
>>(4.l+55) ubyte 0 Quake I or II world or extension
|
||||
!:mime application/x-dzip
|
||||
!:ext pak
|
||||
#>>>8 ulelong x \b, table size %u
|
||||
# dividing this by entry size (64) gives number of files
|
||||
>>>8 ulelong/64 x \b, %u files
|
||||
# offset to the beginning of the file table
|
||||
>>>4 ulelong x \b, offset 0x%x
|
||||
# 1st file entry
|
||||
>>>(4.l) use pak-entry
|
||||
# 2nd file entry
|
||||
#>>>4 ulelong+64 x \b, offset 0x%x
|
||||
#>>>(4.l+64) use pak-entry
|
||||
#
|
||||
# display file table entry of Quake PAK archive
|
||||
0 name pak-entry
|
||||
# normally entry start after header which implies offset 12 or higher
|
||||
>56 ulelong >11
|
||||
# the offset from the beginning of pak to beginning of this entry file contents
|
||||
>>56 ulelong x at 0x%x
|
||||
# the size of file for this entry
|
||||
>>60 ulelong x %u bytes
|
||||
# 56 byte null-terminated entry name string includes path like maps/e1m1.bsp
|
||||
>>0 string x '%-.56s'
|
||||
# inspect entry content by jumping to entry offset
|
||||
>>(56) indirect x \b:
|
||||
|
||||
#0 string -1\x0a Quake I demo
|
||||
#>30 string x version %.4s
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: geo,v 1.4 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: geo,v 1.6 2018/03/11 00:48:16 christos Exp $
|
||||
# Geo- files from Kurt Schwehr <schwehr@ccom.unh.edu>
|
||||
|
||||
######################################################################
|
||||
@ -115,3 +115,16 @@
|
||||
>40 ledouble x \b, minz=%g
|
||||
>48 ledouble x \b, maxz=%g
|
||||
|
||||
# magic for LAS format files
|
||||
# alex myczko <alex@aiei.ch>
|
||||
# http://www.asprs.org/wp-content/uploads/2010/12/LAS_1_3_r11.pdf
|
||||
0 string LASF LIDAR point data records
|
||||
>24 byte >0 \b, version %u
|
||||
>25 byte >0 \b.%u
|
||||
>26 string >\0 \b, SYSID %s
|
||||
>58 string >\0 \b, Generating Software %s
|
||||
|
||||
# magic for PCD format files
|
||||
# alex myczko <alex@aiei.ch>
|
||||
# http://pointclouds.org/documentation/tutorials/pcd_file_format.php
|
||||
0 string #\ .PCD Point Cloud Data
|
||||
|
118
magic/Magdir/gnu
118
magic/Magdir/gnu
@ -1,21 +1,111 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: gnu,v 1.18 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: gnu,v 1.20 2018/02/24 16:11:23 christos Exp $
|
||||
# gnu: file(1) magic for various GNU tools
|
||||
#
|
||||
# GNU nlsutils message catalog file format
|
||||
#
|
||||
# GNU message catalog (.mo and .gmo files)
|
||||
|
||||
# Update: Joerg Jenderek
|
||||
# URL: https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
|
||||
# Reference: ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.tar.gz/
|
||||
# gettext-0.19.8.1/gettext-runtime/intl/gmo.h
|
||||
# Note: maybe call it like "GNU translation gettext machine object"
|
||||
0 string \336\22\4\225 GNU message catalog (little endian),
|
||||
>6 leshort x revision %d.
|
||||
>4 leshort >0 \b%d,
|
||||
>>8 lelong x %d messages,
|
||||
>>36 lelong x %d sysdep messages
|
||||
>4 leshort =0 \b%d,
|
||||
>>8 lelong x %d messages
|
||||
#0 ulelong 0x950412DE GNU-format message catalog data
|
||||
# TODO: write lines in such a way that code can also be called for big endian variant
|
||||
#>0 use gettext-object
|
||||
#0 name gettext-object
|
||||
>4 ulelong x revision
|
||||
!:mime application/x-gettext-translation
|
||||
# mo extension is also used for Easeus Partition Master PE32 executable module
|
||||
# like ConvertFatToNTFS.mo
|
||||
!:ext gmo/mo
|
||||
# only found three revision combinations 0.0 0.1 1.1 as unsigned 32-bit
|
||||
# major revision
|
||||
>4 ulelong/0xFFff x %u.
|
||||
# minor revision
|
||||
>4 ulelong&0x0000FFff x \b%u
|
||||
>>8 ulelong x \b, %u message
|
||||
# plural s
|
||||
>>8 ulelong >1 \bs
|
||||
# size of hashing table
|
||||
#>20 ulelong x \b, %u hash
|
||||
#>20 ulelong >1 \bes
|
||||
#>24 ulelong x at 0x%x
|
||||
# for revsion x.0 offset of table with originals is 1Ch if directly after header
|
||||
>4 ulelong&0x0000FFff =0
|
||||
>>12 ulelong !0x1C \b, at 0x%x string table
|
||||
# but for x.1 table offset i found is 30h. That means directly after bigger header
|
||||
>4 ulelong&0x0000FFff >0
|
||||
>>12 ulelong !0x30 \b, at 0x%x string table
|
||||
# The following variables are only used in .mo files with minor revision >= 1
|
||||
# number of system dependent segments
|
||||
#>>28 ulelong x \b, %u segment
|
||||
#>>28 ulelong >1 \bs
|
||||
# offset of table describing system dependent segments
|
||||
#>>32 ulelong x at 0x%x
|
||||
# number of system dependent strings pairs
|
||||
>>36 ulelong x \b, %u sysdep message
|
||||
>>36 ulelong >1 \bs
|
||||
# offset of table with start offsets of original sysdep strings
|
||||
#>>40 ulelong x \b, at 0x%x sysdep strings
|
||||
# offset of table with start offsets of translated sysdep strings
|
||||
#>>44 ulelong x \b, at 0x%x sysdep translations
|
||||
# >>(44.l) ulelong x 0x%x chars
|
||||
# >>>&0 ulelong x at 0x%x
|
||||
# >>>>(&-4) string x "%s"
|
||||
# string table after big header
|
||||
#>>48 ubequad x \b, string table 0x%llx
|
||||
#
|
||||
# 0th string length seems to be always 0
|
||||
#>(12.l) ulelong x \b, %u chars
|
||||
#>>&0 ulelong x at 0x%x
|
||||
# if 1st string length positiv inspect offset and string
|
||||
#>(12.l+8) ulelong >0 \b, %u chars
|
||||
#>>&0 ulelong x at 0x%x
|
||||
# if 2nd string length positiv inspect offset and string
|
||||
# >(12.l+16) ulelong >0 \b, %u chars
|
||||
# >>&0 ulelong x at 0x%x
|
||||
# skip newline byte
|
||||
#>>>(&-4) ubyte =0x0A
|
||||
#>>>>&0 string x "%s"
|
||||
#>>>(&-4) ubyte !0x0A
|
||||
#>>>>&-1 string x '%s'
|
||||
# offset of table with translation strings
|
||||
#>16 ulelong x \b, at 0x%x translation table
|
||||
# check translation 0 length and offset
|
||||
>(16.l) ulelong >0
|
||||
>>&0 ulelong x
|
||||
# translation 0 seems to be often Project-Id with name and version
|
||||
>>>(&-4) string x \b, %s
|
||||
# trans. 1 with bytes >= 1 unlike icoutils-0.31.0\po\en@boldquot.gmo with 1 NL
|
||||
>(16.l+8) ulelong >1
|
||||
>>&0 ulelong x
|
||||
>>>(&-4) ubyte !0x0A
|
||||
>>>>&-1 string x '%s'
|
||||
# 1 New Line like in tar-1.29\po\de.gmo
|
||||
>>>(&-4) ubyte =0x0A
|
||||
>>>>&0 ubyte !0x0A
|
||||
>>>>>&-1 string x '%s'
|
||||
# 2nd New Line like in parted-3.1\po\de.gmo
|
||||
>>>>&0 ubyte =0x0A
|
||||
>>>>>&0 string x '%s'
|
||||
|
||||
0 string \225\4\22\336 GNU message catalog (big endian),
|
||||
#0 ubelong 0x950412DE GNU-format message catalog data
|
||||
!:mime application/x-gettext-translation
|
||||
!:ext gmo/mo
|
||||
# TODO: for big endian use same code as for little endian
|
||||
#>0 use \^gettext-object
|
||||
# DEBUG code
|
||||
#>16 ubelong x \b, at 0x%x translation table
|
||||
#>(16.L) ubelong x 0x%x chars
|
||||
#>>&0 ubelong x at 0x%x
|
||||
# unexpected value HERE!
|
||||
#>>>(&-4) ubequad x 0x%llx
|
||||
#
|
||||
>4 beshort x revision %d.
|
||||
>6 beshort >0 \b%d,
|
||||
>>8 belong x %d messages,
|
||||
@ -32,13 +122,15 @@
|
||||
0 beshort 0x8502 GPG encrypted data
|
||||
!:mime text/PGP # encoding: data
|
||||
|
||||
# Update: Joerg Jenderek
|
||||
# Note: PGP and GPG use same data structure.
|
||||
# So recognition is now done by ./pgp with start test for byte 0x99
|
||||
# This magic is not particularly good, as the keyrings don't have true
|
||||
# magic. Nevertheless, it covers many keyrings.
|
||||
0 ubeshort-0x9901 <2
|
||||
>3 byte 4
|
||||
>>4 bedate x GPG key public ring, created %s
|
||||
!:mime application/x-gnupg-keyring
|
||||
|
||||
# 0 ubeshort-0x9901 <2
|
||||
# >3 byte 4
|
||||
# >>4 bedate x GPG key public ring, created %s
|
||||
# !:mime application/x-gnupg-keyring
|
||||
|
||||
# Symmetric encryption
|
||||
0 leshort 0x0d8c
|
||||
@ -78,8 +170,6 @@
|
||||
>7 string 02 \b (frcode)
|
||||
|
||||
# Files produced by GNU gettext
|
||||
0 long 0xDE120495 GNU-format message catalog data
|
||||
0 long 0x950412DE GNU-format message catalog data
|
||||
|
||||
# gettext message catalogue
|
||||
0 search/1024 \nmsgid
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: images,v 1.126 2017/06/11 22:25:44 christos Exp $
|
||||
# $File: images,v 1.131 2018/02/16 15:44:28 christos Exp $
|
||||
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
||||
# XPM bitmaps)
|
||||
#
|
||||
@ -27,27 +27,23 @@
|
||||
# and Image Type 1 2 3 9 10 11 32 33
|
||||
# and Color Map Entry Size 0 15 16 24 32
|
||||
0 ubequad&0x00FeC400000000C0 0
|
||||
# skip more garbage by looking for positive image type
|
||||
# skip more garbage like *.iso by looking for positive image type
|
||||
>2 ubyte >0
|
||||
# skip some compiled terminfo by looking for image type less equal 33
|
||||
# skip some compiled terminfo like xterm+tmux by looking for image type less equal 33
|
||||
>>2 ubyte <34
|
||||
# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel sizes 15 16 24 32
|
||||
>>>16 ubyte <33
|
||||
# skip more by looking for pixel size 0Fh 10h 18h 20h
|
||||
>>>>16 ubyte&0xC0 0x00
|
||||
# Color Map
|
||||
>>>>>1 belong&0xfff7ffff 0x01010000
|
||||
>>>>>>0 use tga-image
|
||||
>>>>>1 belong&0xfff7ffff 0x00020000
|
||||
>>>>>>0 use tga-image
|
||||
>>>>>1 belong&0xfff7ffff 0x00030000
|
||||
>>>>>>0 use tga-image
|
||||
>>>>>1 default x
|
||||
# skip 260-16.ico by looking for no color map
|
||||
>>>>>>1 ubyte 0
|
||||
# implies no first map entry
|
||||
>>>>>>>3 uleshort 0
|
||||
>>>>>>>>0 use tga-image
|
||||
# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel depth 1 8 15 16 24 32
|
||||
>>>16 ubyte 1
|
||||
>>>>0 use tga-image
|
||||
>>>16 ubyte 8
|
||||
>>>>0 use tga-image
|
||||
>>>16 ubyte 15
|
||||
>>>>0 use tga-image
|
||||
>>>16 ubyte 16
|
||||
>>>>0 use tga-image
|
||||
>>>16 ubyte 24
|
||||
>>>>0 use tga-image
|
||||
>>>16 ubyte 32
|
||||
>>>>0 use tga-image
|
||||
# display tga bitmap image information
|
||||
0 name tga-image
|
||||
>2 ubyte <34 Targa image data
|
||||
@ -81,7 +77,7 @@
|
||||
# image height. 0 interpreted as 65536
|
||||
>14 uleshort >0 %d
|
||||
>14 uleshort =0 65536
|
||||
# Image Pixel Size 15 16 24 32
|
||||
# Image Pixel depth 1 8 15 16 24 32
|
||||
>16 ubyte x x %d
|
||||
# X origin of image. 0 normal
|
||||
>8 uleshort >0 +%d
|
||||
@ -752,7 +748,7 @@
|
||||
>5 byte 0x00 (white background)
|
||||
>5 byte 0xFF (black background)
|
||||
|
||||
# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
# From: Alex Myczko <alex@aiei.ch>
|
||||
# http://www.atarimax.com/jindroush.atari.org/afmtatr.html
|
||||
0 leshort 0x0296 Atari ATR image
|
||||
|
||||
@ -1065,7 +1061,9 @@
|
||||
>>&16 byte 5 pxr24
|
||||
>>&16 byte 6 b44
|
||||
>>&16 byte 7 b44a
|
||||
>>&16 byte >7 unknown
|
||||
>>&16 byte 8 dwaa
|
||||
>>&16 byte 9 dwab
|
||||
>>&16 byte >9 unknown
|
||||
>8 search/0x1000 dataWindow\0 \b, dataWindow:
|
||||
>>&10 lelong x (%d
|
||||
>>&14 lelong x %d)-
|
||||
@ -1087,8 +1085,15 @@
|
||||
# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
|
||||
# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
|
||||
# Robert Minsk <robertminsk at yahoo.com>
|
||||
# Modified by Harry Mallon <hjmallon at gmail.com>
|
||||
0 string SDPX DPX image data, big-endian,
|
||||
!:mime image/x-dpx
|
||||
>0 use dpx_info
|
||||
0 string XPDS DPX image data, little-endian,
|
||||
!:mime image/x-dpx
|
||||
>0 use \^dpx_info
|
||||
|
||||
0 name dpx_info
|
||||
>768 beshort <4
|
||||
>>772 belong x %dx
|
||||
>>776 belong x \b%d,
|
||||
@ -1101,8 +1106,8 @@
|
||||
>768 beshort 3 right to left/bottom to top
|
||||
>768 beshort 4 top to bottom/left to right
|
||||
>768 beshort 5 top to bottom/right to left
|
||||
>768 leshort 6 bottom to top/left to right
|
||||
>768 leshort 7 bottom to top/right to left
|
||||
>768 beshort 6 bottom to top/left to right
|
||||
>768 beshort 7 bottom to top/right to left
|
||||
|
||||
# From: Tom Hilinski <tom.hilinski@comcast.net>
|
||||
# http://www.unidata.ucar.edu/packages/netcdf/
|
||||
@ -1479,3 +1484,30 @@
|
||||
>4 belong 0x0D0A1A0A
|
||||
>12 belong 0x00000000 Lytro Light Field Picture
|
||||
>8 belong x \b, version %d
|
||||
|
||||
# Type: Vision Research Phantom CINE Format
|
||||
# URL: https://www.phantomhighspeed.com/
|
||||
# URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
|
||||
# From: Harry Mallon <hjmallon at gmail.com>
|
||||
#
|
||||
# This has a short "CI" code but the 44 is the size of the struct which is
|
||||
# stable
|
||||
0 string CI
|
||||
>2 leshort 44 Vision Research CINE Video,
|
||||
>>4 leshort 0 Grayscale,
|
||||
>>4 leshort 1 JPEG Compressed,
|
||||
>>4 leshort 2 RAW,
|
||||
>>6 leshort x version %d,
|
||||
>>20 lelong x %d frames,
|
||||
>>48 lelong x %dx
|
||||
>>52 lelong x \b%d
|
||||
|
||||
# Type: ARRI Raw Image
|
||||
# Info: SMPTE RDD30:2014
|
||||
# From: Harry Mallon <hjmallon at gmail.com>
|
||||
0 string ARRI ARRI ARI image data,
|
||||
>4 lelong 0x78563412 little-endian,
|
||||
>4 lelong 0x12345678 big-endian,
|
||||
>12 lelong x version %d,
|
||||
>20 lelong x %dx
|
||||
>24 lelong x \b%d
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: intel,v 1.15 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: intel,v 1.16 2017/11/14 15:48:36 christos Exp $
|
||||
# intel: file(1) magic for x86 Unix
|
||||
#
|
||||
# Various flavors of x86 UNIX executable/object (other than Xenix, which
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
# rom: file(1) magic for BIOS ROM Extensions found in intel machines
|
||||
# mapped into memory between 0xC0000 and 0xFFFFF
|
||||
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
|
||||
# From: Alex Myczko <alex@aiei.ch>
|
||||
# updated by Joerg Jenderek
|
||||
# https://en.wikipedia.org/wiki/Option_ROM
|
||||
0 beshort 0x55AA BIOS (ia32) ROM Ext.
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: macintosh,v 1.27 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: macintosh,v 1.28 2017/12/05 02:17:48 christos Exp $
|
||||
# macintosh description
|
||||
#
|
||||
# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
|
||||
@ -60,182 +60,272 @@
|
||||
#>2 string x : %s
|
||||
|
||||
# MacBinary format (Eric Fischer, enf@pobox.com)
|
||||
# Update: Joerg Jenderek
|
||||
# URL: https://en.wikipedia.org/wiki/MacBinary
|
||||
# Reference: http://files.stairways.com/other/macbinaryii-standard-info.txt
|
||||
#
|
||||
# Unfortunately MacBinary doesn't really have a magic number prior
|
||||
# to the MacBinary III format. The checksum is really the way to
|
||||
# do it, but the magic file format isn't up to the challenge.
|
||||
# to the MacBinary III format.
|
||||
#
|
||||
# 0 byte 0
|
||||
# 1 byte # filename length
|
||||
# 2 string # filename
|
||||
# 65 string # file type
|
||||
# 69 string # file creator
|
||||
# 73 byte # Finder flags
|
||||
# 74 byte 0
|
||||
|
||||
# old version number, must be kept at zero for compatibility
|
||||
0 byte 0
|
||||
# length of filename (must be in the range 1-63)
|
||||
>1 ubyte >0
|
||||
# skip T.PIC.LZ INSTRUMENT.7T INVENTORY
|
||||
>>1 ubyte <64
|
||||
# skip Docs.MWII ReadMe.MacWrite "Notes (MacWrite II)"
|
||||
# by looking for printable characters at beginning of file name
|
||||
>>>2 ubelong >0x1F000000
|
||||
# zero fill, must be zero for compatibility
|
||||
>>>>74 byte 0
|
||||
# zero fill, must be zero for compatibility
|
||||
>>>>>82 byte 0
|
||||
# MacBinary I test for valid version numbers
|
||||
>>>>>>122 ubeshort 0
|
||||
# additional check for creation date after 1 Jan 1970 ~ 7C25B080h
|
||||
#>>>>>>>91 ubelong >0x7c25b07F
|
||||
# additional check for undefined header fields in MacBinary I
|
||||
#>>>>>>>101 ulong 0
|
||||
>>>>>>>0 use mac-bin
|
||||
# MacBinary II the newer versions begins at 129
|
||||
>>>>>>122 ubeshort 0x8181
|
||||
>>>>>>>0 use mac-bin
|
||||
# MacBinary III with MacBinary II to read
|
||||
>>>>>122 ubeshort 0x8281
|
||||
>>>>>>0 use mac-bin
|
||||
|
||||
# display information of MacBinary file
|
||||
0 name mac-bin
|
||||
>122 ubyte x MacBinary
|
||||
# versions for MacBinary II/III
|
||||
>122 ubyte 129 II
|
||||
>122 ubyte 130 III
|
||||
# only in MacBinary III
|
||||
>>102 string !mBIN with surprising version
|
||||
!:mime application/x-macbinary
|
||||
!:apple PSPTBINA
|
||||
!:ext bin/macbin
|
||||
# THIS SHOULD NEVER HAPPEN! Maybe another file type is misidetified as MacBinary
|
||||
#>1 ubyte >63 \b, name length %u too BIG!
|
||||
#>122 ubeshort x \b, version 0x%x
|
||||
# Finder flags if not 0
|
||||
# >73 byte !0 \b, flags 0x
|
||||
# >73 byte =0
|
||||
# >>101 byte !0 \b, flags 0x
|
||||
# # original Finder flags (Bits 8-15)
|
||||
# >73 byte !0 \b%x
|
||||
# # finder flags, bits 0-7
|
||||
# >101 byte !0 \b%x
|
||||
>73 byte &0x01 \b, inited
|
||||
>73 byte &0x02 \b, changed
|
||||
>73 byte &0x04 \b, busy
|
||||
>73 byte &0x08 \b, bozo
|
||||
>73 byte &0x10 \b, system
|
||||
>73 byte &0x20 \b, bundle
|
||||
>73 byte &0x40 \b, invisible
|
||||
>73 byte &0x80 \b, locked
|
||||
|
||||
# 75 beshort # vertical posn in window
|
||||
#>75 beshort !0 \b, v.pos %u
|
||||
# 77 beshort # horiz posn in window
|
||||
#>77 beshort !0 \b, h.pos %u
|
||||
# 79 beshort # window or folder ID
|
||||
# 81 byte # protected?
|
||||
# 82 byte 0
|
||||
# 83 belong # length of data segment
|
||||
# 87 belong # length of resource segment
|
||||
# 91 belong # file creation date
|
||||
# 95 belong # file modification date
|
||||
# 99 beshort # length of comment after resource
|
||||
# 101 byte # new Finder flags
|
||||
# 102 string mBIN # (only in MacBinary III)
|
||||
# 106 byte # char. code of file name
|
||||
# 107 byte # still more Finder flags
|
||||
# 116 belong # total file length
|
||||
>79 ubeshort !0 \b, ID 0x%x
|
||||
# protected flag
|
||||
>81 byte !0 \b, protected 0x%x
|
||||
# length of comment after resource
|
||||
>99 ubeshort !0 \b, comment length %u
|
||||
# char. code of file name
|
||||
>106 ubyte !0 \b, char. code 0x%x
|
||||
# still more Finder flags
|
||||
>107 ubyte !0 \b, more flags 0x%x
|
||||
# length of total files when unpacked only used when pack and unpack on the fly
|
||||
>116 ubelong !0 \b, total length %u
|
||||
# 120 beshort # length of add'l header
|
||||
# 122 byte 129 # for MacBinary II
|
||||
# 122 byte 130 # for MacBinary III
|
||||
# 123 byte 129 # minimum version that can read fmt
|
||||
>120 ubeshort !0 \b, 2nd header length %u
|
||||
# 124 beshort # checksum
|
||||
#
|
||||
# This attempts to use the version numbers as a magic number, requiring
|
||||
# that the first one be 0x80, 0x81, 0x82, or 0x83, and that the second
|
||||
# be 0x81. This works for the files I have, but maybe not for everyone's.
|
||||
#>124 ubeshort !0 \b, CRC 0x%x
|
||||
# creation date in seconds since MacOS epoch start. So 1 Jan 1970 ~ 7C25B080
|
||||
>91 beldate-0x7C25B080 x \b, %s
|
||||
# THIS SHOULD NEVER HAPPEN! Maybe another file type is misidetified or time overflow
|
||||
>91 ubelong <0x7c25b080 INVALID date
|
||||
#>91 belong-0x7C25B080 x \b, DEBUG DATE %d
|
||||
# last modified date
|
||||
>95 beldate-0x7C25B080 x \b, modified %s
|
||||
# Apple creator+typ if not null
|
||||
# file creator (normally expressed as four characters)
|
||||
>69 ulong !0 \b, creator
|
||||
# instead 4 character code display full creator name
|
||||
>>69 use apple-creator
|
||||
# file type (normally expressed as four characters)
|
||||
>65 ulong !0 \b, type
|
||||
>>65 use apple-type
|
||||
# length of data segment
|
||||
>83 ubelong !0 \b, %u bytes
|
||||
# filename (in the range 1-63)
|
||||
>1 pstring x "%s"
|
||||
# print 1 space and then at offset 128 inspect data fork content if it has one
|
||||
>83 ubelong !0 \b
|
||||
>>128 indirect x
|
||||
# Afterwards resource fork if length of resource segment not zero
|
||||
>87 ubelong !0
|
||||
# calculate resource fork offset
|
||||
>>83 ubelong+128 x \b, at 0x%x
|
||||
# length of resource segment
|
||||
>>87 ubelong !0 %u bytes
|
||||
>>(83.S+128) ubequad x resource
|
||||
# further resource fork content inspection
|
||||
>>>&-8 indirect x
|
||||
|
||||
# Unfortunately, this magic is quite weak - MPi
|
||||
#122 beshort&0xFCFF 0x8081 Macintosh MacBinary data
|
||||
|
||||
# MacBinary I doesn't have the version number field at all, but MacBinary II
|
||||
# has been in use since 1987 so I hope there aren't many really old files
|
||||
# floating around that this will miss. The original spec calls for using
|
||||
# the nulls in 0, 74, and 82 as the magic number.
|
||||
#
|
||||
# Another possibility, that would also work for MacBinary I, is to use
|
||||
# the assumption that 65-72 will all be ASCII (0x20-0x7F), that 73 will
|
||||
# have bits 1 (changed), 2 (busy), 3 (bozo), and 6 (invisible) unset,
|
||||
# and that 74 will be 0. So something like
|
||||
#
|
||||
# 71 belong&0x80804EFF 0x00000000 Macintosh MacBinary data
|
||||
#
|
||||
# >73 byte&0x01 0x01 \b, inited
|
||||
# >73 byte&0x02 0x02 \b, changed
|
||||
# >73 byte&0x04 0x04 \b, busy
|
||||
# >73 byte&0x08 0x08 \b, bozo
|
||||
# >73 byte&0x10 0x10 \b, system
|
||||
# >73 byte&0x10 0x20 \b, bundle
|
||||
# >73 byte&0x10 0x40 \b, invisible
|
||||
# >73 byte&0x10 0x80 \b, locked
|
||||
# Apple Type/Creator Database
|
||||
# URL: https://en.wikipedia.org/wiki/Type_code
|
||||
# Reference: http://www.lacikam.co.il/tcdb/
|
||||
# http://www.macdisk.com/macsigen.php
|
||||
# Note: classic Mac OS files have two 4 character codes for type and creator.
|
||||
# Thereby the Finder attach documents types to applications.
|
||||
|
||||
#>65 string x \b, type "%4.4s"
|
||||
|
||||
#>65 string 8BIM (PhotoShop)
|
||||
#>65 string ALB3 (PageMaker 3)
|
||||
#>65 string ALB4 (PageMaker 4)
|
||||
#>65 string ALT3 (PageMaker 3)
|
||||
#>65 string APPL (application)
|
||||
#>65 string AWWP (AppleWorks word processor)
|
||||
#>65 string CIRC (simulated circuit)
|
||||
#>65 string DRWG (MacDraw)
|
||||
#>65 string EPSF (Encapsulated PostScript)
|
||||
#>65 string FFIL (font suitcase)
|
||||
#>65 string FKEY (function key)
|
||||
#>65 string FNDR (Macintosh Finder)
|
||||
#>65 string GIFf (GIF image)
|
||||
#>65 string Gzip (GNU gzip)
|
||||
#>65 string INIT (system extension)
|
||||
#>65 string LIB\ (library)
|
||||
#>65 string LWFN (PostScript font)
|
||||
#>65 string MSBC (Microsoft BASIC)
|
||||
#>65 string PACT (Compact Pro archive)
|
||||
#>65 string PDF\ (Portable Document Format)
|
||||
#>65 string PICT (picture)
|
||||
#>65 string PNTG (MacPaint picture)
|
||||
#>65 string PREF (preferences)
|
||||
#>65 string PROJ (Think C project)
|
||||
#>65 string QPRJ (Think Pascal project)
|
||||
#>65 string SCFL (Defender scores)
|
||||
#>65 string SCRN (startup screen)
|
||||
#>65 string SITD (StuffIt Deluxe)
|
||||
#>65 string SPn3 (SuperPaint)
|
||||
#>65 string STAK (HyperCard stack)
|
||||
#>65 string Seg\ (StuffIt segment)
|
||||
#>65 string TARF (Unix tar archive)
|
||||
#>65 string TEXT (ASCII)
|
||||
#>65 string TIFF (TIFF image)
|
||||
#>65 string TOVF (Eudora table of contents)
|
||||
#>65 string WDBN (Microsoft Word word processor)
|
||||
#>65 string WORD (MacWrite word processor)
|
||||
#>65 string XLS\ (Microsoft Excel)
|
||||
#>65 string ZIVM (compress (.Z))
|
||||
#>65 string ZSYS (Pre-System 7 system file)
|
||||
#>65 string acf3 (Aldus FreeHand)
|
||||
#>65 string cdev (control panel)
|
||||
#>65 string dfil (Desk Accessory suitcase)
|
||||
#>65 string libr (library)
|
||||
#>65 string nX^d (WriteNow word processor)
|
||||
#>65 string nX^w (WriteNow dictionary)
|
||||
#>65 string rsrc (resource)
|
||||
#>65 string scbk (Scrapbook)
|
||||
#>65 string shlb (shared library)
|
||||
#>65 string ttro (SimpleText read-only)
|
||||
#>65 string zsys (system file)
|
||||
# display information about apple type
|
||||
0 name apple-type
|
||||
>0 string 8BIM PhotoShop
|
||||
>0 string ALB3 PageMaker 3
|
||||
>0 string ALB4 PageMaker 4
|
||||
>0 string ALT3 PageMaker 3
|
||||
>0 string APPL application
|
||||
>0 string AWWP AppleWorks word processor
|
||||
>0 string CIRC simulated circuit
|
||||
>0 string DRWG MacDraw
|
||||
>0 string EPSF Encapsulated PostScript
|
||||
>0 string FFIL font suitcase
|
||||
>0 string FKEY function key
|
||||
>0 string FNDR Macintosh Finder
|
||||
>0 string GIFf GIF image
|
||||
>0 string Gzip GNU gzip
|
||||
>0 string INIT system extension
|
||||
>0 string LIB\ library
|
||||
>0 string LWFN PostScript font
|
||||
>0 string MSBC Microsoft BASIC
|
||||
>0 string PACT Compact Pro archive
|
||||
>0 string PDF\ Portable Document Format
|
||||
>0 string PICT picture
|
||||
>0 string PNTG MacPaint picture
|
||||
>0 string PREF preferences
|
||||
>0 string PROJ Think C project
|
||||
>0 string QPRJ Think Pascal project
|
||||
>0 string SCFL Defender scores
|
||||
>0 string SCRN startup screen
|
||||
>0 string SITD StuffIt Deluxe
|
||||
>0 string SPn3 SuperPaint
|
||||
>0 string STAK HyperCard stack
|
||||
>0 string Seg\ StuffIt segment
|
||||
>0 string TARF Unix tar archive
|
||||
>0 string TEXT ASCII
|
||||
>0 string TIFF TIFF image
|
||||
>0 string TOVF Eudora table of contents
|
||||
>0 string WDBN Microsoft Word word processor
|
||||
>0 string WORD MacWrite word processor
|
||||
>0 string XLS\ Microsoft Excel
|
||||
>0 string ZIVM compress (.Z)
|
||||
>0 string ZSYS Pre-System 7 system file
|
||||
>0 string acf3 Aldus FreeHand
|
||||
>0 string cdev control panel
|
||||
>0 string dfil Desk Accessory suitcase
|
||||
>0 string libr library
|
||||
>0 string nX^d WriteNow word processor
|
||||
>0 string nX^w WriteNow dictionary
|
||||
>0 string rsrc resource
|
||||
>0 string scbk Scrapbook
|
||||
>0 string shlb shared library
|
||||
>0 string ttro SimpleText read-only
|
||||
>0 string zsys system file
|
||||
|
||||
# additional types added in Dec 2017
|
||||
>0 string BINA binary file
|
||||
>0 string BMPp BMP image
|
||||
>0 string JPEG JPEG image
|
||||
#>0 string W4BN Microsoft Word x.y word processor?
|
||||
# if type name is not known display 4 character identifier
|
||||
>0 default x
|
||||
>>0 string x '%4.4s'
|
||||
|
||||
#>69 string x \b, creator "%4.4s"
|
||||
|
||||
# Somewhere, Apple has a repository of registered Creator IDs. These are
|
||||
# Now Apple has no repository of registered Creator IDs any more. These are
|
||||
# just the ones that I happened to have files from and was able to identify.
|
||||
|
||||
#>69 string 8BIM (Adobe Photoshop)
|
||||
#>69 string ALD3 (PageMaker 3)
|
||||
#>69 string ALD4 (PageMaker 4)
|
||||
#>69 string ALFA (Alpha editor)
|
||||
#>69 string APLS (Apple Scanner)
|
||||
#>69 string APSC (Apple Scanner)
|
||||
#>69 string BRKL (Brickles)
|
||||
#>69 string BTFT (BitFont)
|
||||
#>69 string CCL2 (Common Lisp 2)
|
||||
#>69 string CCL\ (Common Lisp)
|
||||
#>69 string CDmo (The Talking Moose)
|
||||
#>69 string CPCT (Compact Pro)
|
||||
#>69 string CSOm (Eudora)
|
||||
#>69 string DMOV (Font/DA Mover)
|
||||
#>69 string DSIM (DigSim)
|
||||
#>69 string EDIT (Macintosh Edit)
|
||||
#>69 string ERIK (Macintosh Finder)
|
||||
#>69 string EXTR (self-extracting archive)
|
||||
#>69 string Gzip (GNU gzip)
|
||||
#>69 string KAHL (Think C)
|
||||
#>69 string LWFU (LaserWriter Utility)
|
||||
#>69 string LZIV (compress)
|
||||
#>69 string MACA (MacWrite)
|
||||
#>69 string MACS (Macintosh operating system)
|
||||
#>69 string MAcK (MacKnowledge terminal emulator)
|
||||
#>69 string MLND (Defender)
|
||||
#>69 string MPNT (MacPaint)
|
||||
#>69 string MSBB (Microsoft BASIC (binary))
|
||||
#>69 string MSWD (Microsoft Word)
|
||||
#>69 string NCSA (NCSA Telnet)
|
||||
#>69 string PJMM (Think Pascal)
|
||||
#>69 string PSAL (Hunt the Wumpus)
|
||||
#>69 string PSI2 (Apple File Exchange)
|
||||
#>69 string R*ch (BBEdit)
|
||||
#>69 string RMKR (Resource Maker)
|
||||
#>69 string RSED (Resource Editor)
|
||||
#>69 string Rich (BBEdit)
|
||||
#>69 string SIT! (StuffIt)
|
||||
#>69 string SPNT (SuperPaint)
|
||||
#>69 string Unix (NeXT Mac filesystem)
|
||||
#>69 string VIM! (Vim editor)
|
||||
#>69 string WILD (HyperCard)
|
||||
#>69 string XCEL (Microsoft Excel)
|
||||
#>69 string aCa2 (Fontographer)
|
||||
#>69 string aca3 (Aldus FreeHand)
|
||||
#>69 string dosa (Macintosh MS-DOS file system)
|
||||
#>69 string movr (Font/DA Mover)
|
||||
#>69 string nX^n (WriteNow)
|
||||
#>69 string pdos (Apple ProDOS file system)
|
||||
#>69 string scbk (Scrapbook)
|
||||
#>69 string ttxt (SimpleText)
|
||||
#>69 string ufox (Foreign File Access)
|
||||
|
||||
# Just in case...
|
||||
|
||||
102 string mBIN MacBinary III data with surprising version number
|
||||
# display information about apple creator
|
||||
0 name apple-creator
|
||||
>0 string 8BIM Adobe Photoshop
|
||||
>0 string ALD3 PageMaker 3
|
||||
>0 string ALD4 PageMaker 4
|
||||
>0 string ALFA Alpha editor
|
||||
>0 string APLS Apple Scanner
|
||||
>0 string APSC Apple Scanner
|
||||
>0 string BRKL Brickles
|
||||
>0 string BTFT BitFont
|
||||
>0 string CCL2 Common Lisp 2
|
||||
>0 string CCL\ Common Lisp
|
||||
>0 string CDmo The Talking Moose
|
||||
>0 string CPCT Compact Pro
|
||||
>0 string CSOm Eudora
|
||||
>0 string DMOV Font/DA Mover
|
||||
>0 string DSIM DigSim
|
||||
>0 string EDIT Macintosh Edit
|
||||
>0 string ERIK Macintosh Finder
|
||||
>0 string EXTR self-extracting archive
|
||||
>0 string Gzip GNU gzip
|
||||
>0 string KAHL Think C
|
||||
>0 string LWFU LaserWriter Utility
|
||||
>0 string LZIV compress
|
||||
>0 string MACA MacWrite
|
||||
>0 string MACS Macintosh operating system
|
||||
>0 string MAcK MacKnowledge terminal emulator
|
||||
>0 string MLND Defender
|
||||
>0 string MPNT MacPaint
|
||||
>0 string MSBB Microsoft BASIC (binary)
|
||||
>0 string MSWD Microsoft Word
|
||||
>0 string NCSA NCSA Telnet
|
||||
>0 string PJMM Think Pascal
|
||||
>0 string PSAL Hunt the Wumpus
|
||||
#>0 string PSI2 Apple File Exchange
|
||||
>0 string R*ch BBEdit
|
||||
>0 string RMKR Resource Maker
|
||||
>0 string RSED Resource Editor
|
||||
>0 string Rich BBEdit
|
||||
>0 string SIT! StuffIt
|
||||
>0 string SPNT SuperPaint
|
||||
>0 string Unix NeXT Mac filesystem
|
||||
>0 string VIM! Vim editor
|
||||
>0 string WILD HyperCard
|
||||
>0 string XCEL Microsoft Excel
|
||||
>0 string aCa2 Fontographer
|
||||
>0 string aca3 Aldus FreeHand
|
||||
>0 string dosa Macintosh MS-DOS file system
|
||||
>0 string movr Font/DA Mover
|
||||
>0 string nX^n WriteNow
|
||||
>0 string pdos Apple ProDOS file system
|
||||
>0 string scbk Scrapbook
|
||||
>0 string ttxt SimpleText
|
||||
>0 string ufox Foreign File Access
|
||||
# additional creators added in Dec 2017
|
||||
# Claris/Apple Works
|
||||
>0 string BOBO Apple Works
|
||||
# CU-SeeMe_0.87b3_(68K).bin
|
||||
#>0 string CUce bar
|
||||
>0 string PSPT Apple File Exchange
|
||||
# Disk_Copy_4.2.sea.bin
|
||||
#>0 string NCse foo
|
||||
# probably StuffIt/Aladdin by Smith Micro Software, Inc.
|
||||
>0 string STi0 stuffit
|
||||
# MacGzip-1.1.3.sea.bin
|
||||
#>0 string aust bar
|
||||
# D-Disk_Copy_6.3.3.smi.bin
|
||||
>0 string oneb Disk Copy Self Mounting
|
||||
# if creator name is not known display 4 character identifier
|
||||
>0 default x
|
||||
>>0 string x '%4.4s'
|
||||
|
||||
# sas magic from Bruce Foster (bef@nwu.edu)
|
||||
#
|
||||
|
39
magic/Magdir/measure
Normal file
39
magic/Magdir/measure
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: measure,v 1.1 2017/11/28 14:01:14 christos Exp $
|
||||
# measure: file(1) magic for measurement data
|
||||
|
||||
# DIY-Thermocam raw data
|
||||
0 name diy-thermocam-parser
|
||||
>0 beshort x scale %d-
|
||||
>2 beshort x \b%d,
|
||||
>4 lefloat x spot sensor temperature %f,
|
||||
>9 byte 0 unit celsius,
|
||||
>9 byte 1 unit fahrenheit,
|
||||
>8 byte x color scheme %d
|
||||
>10 byte 1 \b, show spot sensor
|
||||
>11 byte 1 \b, show scale bar
|
||||
>12 byte &1 \b, minimum point enabled
|
||||
>12 byte &2 \b, maximum point enabled
|
||||
>13 lefloat x \b, calibration: offset %f,
|
||||
>17 lefloat x slope %f
|
||||
|
||||
0 name diy-thermocam-checker
|
||||
>9 byte <2
|
||||
>>10 byte <2
|
||||
>>>11 byte <2
|
||||
>>>>12 byte <4
|
||||
>>>>>17 lefloat >0.0001 DIY-Thermocam raw data
|
||||
|
||||
# V2 and Leption 3.x:
|
||||
38408 byte <19
|
||||
>38400 use diy-thermocam-checker
|
||||
>>38400 default x (Lepton 3.x),
|
||||
>>>38400 use diy-thermocam-parser
|
||||
|
||||
# V1 or Lepton 2.x
|
||||
9608 byte <19
|
||||
>9600 use diy-thermocam-checker
|
||||
>>9600 default x (Lepton 2.x),
|
||||
>>>9600 use diy-thermocam-parser
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: mozilla,v 1.7 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: mozilla,v 1.8 2018/01/17 12:08:36 christos Exp $
|
||||
# mozilla: file(1) magic for Mozilla XUL fastload files
|
||||
# (XUL.mfasl and XPC.mfasl)
|
||||
# URL: http://www.mozilla.org/
|
||||
@ -8,3 +8,15 @@
|
||||
|
||||
0 string XPCOM\nMozFASL\r\n\x1A Mozilla XUL fastload data
|
||||
0 string mozLz4a Mozilla lz4 compressed bookmark data
|
||||
|
||||
# From: Joerg Jenderek
|
||||
# URL: https://en.wikipedia.org/wiki/Firefox_4
|
||||
# Reference: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
|
||||
# Note: Most ZIP utilities are able to extract such archives
|
||||
# maybe only partly or after some warnings. Example:
|
||||
# zip -FF omni.ja --out omni.zip
|
||||
4 string PK\001\002 Mozilla archive omni.ja
|
||||
!:mime application/x-zip
|
||||
!:ext ja
|
||||
# TODO:
|
||||
#>4 use zip-dir-entry
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: msdos,v 1.120 2017/08/13 00:21:47 christos Exp $
|
||||
# $File: msdos,v 1.121 2017/10/27 21:43:23 christos Exp $
|
||||
# msdos: file(1) magic for MS-DOS files
|
||||
#
|
||||
|
||||
@ -597,8 +597,9 @@
|
||||
0 string/b \333\245-\0\0\0 Microsoft Word 2.0 Document
|
||||
!:mime application/msword
|
||||
!:ext doc
|
||||
512 string/b \354\245\301 Microsoft Word Document
|
||||
!:mime application/msword
|
||||
# Note: seems already recognized as "OLE 2 Compound Document" in ./ole2compounddocs
|
||||
#512 string/b \354\245\301 Microsoft Word Document
|
||||
#!:mime application/msword
|
||||
|
||||
#
|
||||
0 string/b \xDB\xA5\x2D\x00 Microsoft WinWord 2.0 Document
|
||||
@ -1068,16 +1069,6 @@
|
||||
>40 string \ EMF Windows Enhanced Metafile (EMF) image data
|
||||
>>44 ulelong x version 0x%x
|
||||
|
||||
# from http://filext.com by Derek M Jones <derek@knosof.co.uk>
|
||||
# False positive with PPT (also currently this string is too long)
|
||||
#0 string/b \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF\x09\x00\x06 Microsoft Installer
|
||||
0 string/b \320\317\021\340\241\261\032\341 Microsoft Office Document
|
||||
#>48 byte 0x1B Excel Document
|
||||
#!:mime application/vnd.ms-excel
|
||||
>546 string bjbj Microsoft Word Document
|
||||
!:mime application/msword
|
||||
>546 string jbjb Microsoft Word Document
|
||||
!:mime application/msword
|
||||
|
||||
0 string/b \224\246\056 Microsoft Word Document
|
||||
!:mime application/msword
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: msooxml,v 1.5 2014/08/05 07:38:45 christos Exp $
|
||||
# $File: msooxml,v 1.7 2018/03/12 12:38:59 christos Exp $
|
||||
# msooxml: file(1) magic for Microsoft Office XML
|
||||
# From: Ralf Brown <ralf.brown@gmail.com>
|
||||
|
||||
@ -12,6 +12,14 @@
|
||||
# file of ePub or OpenDocument, we'll have to scan for a filename
|
||||
# which can distinguish between the three types
|
||||
|
||||
0 name msooxml
|
||||
>0 string word/ Microsoft Word 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||
>0 string ppt/ Microsoft PowerPoint 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||
>0 string xl/ Microsoft Excel 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
|
||||
# start by checking for ZIP local file header signature
|
||||
0 string PK\003\004
|
||||
!:strength +10
|
||||
@ -27,10 +35,9 @@
|
||||
# and check the subdirectory name to determine which type of OOXML
|
||||
# file we have. Correct the mimetype with the registered ones:
|
||||
# http://technet.microsoft.com/en-us/library/cc179224.aspx
|
||||
>>>>&26 string word/ Microsoft Word 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||
>>>>&26 string ppt/ Microsoft PowerPoint 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||
>>>>&26 string xl/ Microsoft Excel 2007+
|
||||
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
>>>>&26 default x Microsoft OOXML
|
||||
>>>>&26 use msooxml
|
||||
>>>>&26 default x
|
||||
# OpenOffice/Libreoffice orders ZIP entry differently, so check the 4th file
|
||||
>>>>>&26 search/1000 PK\003\004
|
||||
>>>>>>&26 use msooxml
|
||||
>>>>>>&26 default x Microsoft OOXML
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: netbsd,v 1.24 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: netbsd,v 1.25 2017/09/28 02:37:47 christos Exp $
|
||||
# netbsd: file(1) magic for NetBSD objects
|
||||
#
|
||||
# All new-style magic numbers are in network byte order.
|
||||
@ -285,7 +285,7 @@
|
||||
>0 belong&0xfc000000 0x10000000 \b, STACK
|
||||
>4 leshort x \b, (headersize = %d
|
||||
>6 leshort x \b, segmentsize = %d
|
||||
>6 lelong x \b, segments = %d)
|
||||
>8 lelong x \b, segments = %d)
|
||||
|
||||
# little endian only for now.
|
||||
0 name ktrace
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: ole2compounddocs,v 1.4 2009/09/19 16:28:11 christos Exp $
|
||||
# $File: ole2compounddocs,v 1.5 2017/10/27 21:43:23 christos Exp $
|
||||
# Microsoft OLE 2 Compound Documents : file(1) magic for Microsoft Structured
|
||||
# storage (http://en.wikipedia.org/wiki/Structured_Storage)
|
||||
# storage (https://en.wikipedia.org/wiki/Compound_File_Binary_Format)
|
||||
# Additional tests for OLE 2 Compound Documents should be under this recipe.
|
||||
|
||||
0 string \320\317\021\340\241\261\032\341 OLE 2 Compound Document
|
||||
@ -12,3 +12,22 @@
|
||||
# - Visio documents
|
||||
# Last update on 10/23/2006 by Lester Hightower
|
||||
> 0x480 string V\000i\000s\000i\000o\000D\000o\000c : Visio Document
|
||||
|
||||
# Note: moved & merged Microsoft Office parts from ./msdos Oct 2017
|
||||
# Update: Joerg Jenderek
|
||||
# from http://filext.com by Derek M Jones <derek@knosof.co.uk>
|
||||
# False positive with PPT (also currently this string is too long)
|
||||
#0 string/b \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF\x09\x00\x06 Microsoft Installer
|
||||
#0 string/b \320\317\021\340\241\261\032\341 Microsoft Office Document
|
||||
#>48 byte 0x1B Excel Document
|
||||
#!:mime application/vnd.ms-excel
|
||||
>546 string bjbj : Microsoft Word Document
|
||||
!:mime application/msword
|
||||
# https://www.macdisk.com/macsigen.php
|
||||
!:apple MSWDWDBN
|
||||
!:ext doc/dot
|
||||
>546 string jbjb : Microsoft Word Document
|
||||
!:mime application/msword
|
||||
!:apple MSWDWDBN
|
||||
!:ext doc
|
||||
|
||||
|
@ -1,11 +1,50 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: pgp,v 1.14 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: pgp,v 1.15 2018/02/24 16:11:23 christos Exp $
|
||||
# pgp: file(1) magic for Pretty Good Privacy
|
||||
# see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
|
||||
#
|
||||
0 beshort 0x9900 PGP key public ring
|
||||
!:mime application/x-pgp-keyring
|
||||
# Update: Joerg Jenderek
|
||||
# Note: verified by `gpg -v --debug 0x02 --list-packets < PUBRING263_10.PGP`
|
||||
#0 byte 0x99 MAYBE PGP 0x99
|
||||
0 byte 0x99
|
||||
# 99h~10;0110;01~2=old packet type;tag 6=Public-Key Packet;1=two-octet length
|
||||
# A two-octet body header encodes packet lengths of 192~00C0h - 8383~20BFh
|
||||
#>1 ubeshort x \b, body length 0x%.4x
|
||||
# skip Basic.Image Beauty.320 Pic.Icons by looking for low version number
|
||||
#>3 ubyte x \b, V=%u
|
||||
#>3 ubyte <5 VERSION OK
|
||||
>3 ubyte <5
|
||||
# next packet type often b4h~(tag 13)~User ID Packet, b0h~(tag 12)~Trust packet
|
||||
#>>(1.S+3) ubyte x \b, next packet type 0x%x
|
||||
# skip 9900-v4.bin 9902-v4.bin by looking for valid second packet type (bit 7=1)
|
||||
#>>(1.S+3) ubyte >0x7F TYPE OK,
|
||||
>>(1.S+3) ubyte >0x7F
|
||||
# old versions 2,3 implies Pretty Good Privacy
|
||||
>>>3 ubyte <4 PGP key public ring (v%u)
|
||||
!:mime application/pgp-keys
|
||||
!:ext pgp/ASD
|
||||
>>>>4 beldate x created %s
|
||||
# days that this key is valid. If this number is zero, then it does not expire
|
||||
>>>>8 ubeshort >0 \b, %u days valid
|
||||
>>>>8 ubeshort =0 \b, not expire
|
||||
# display key algorithm 1~RSA (Encrypt or Sign)
|
||||
>>>>10 use key_algo
|
||||
# Multiprecision Integers (MPI) size
|
||||
>>>>11 ubeshort x %u bits
|
||||
# MPI
|
||||
>>>>13 ubequad x MPI=0x%16.16llx...
|
||||
# new version implies Pretty Good Privacy (PGP) >= 5.0 or Gnu Privacy Guard (GPG)
|
||||
>>>3 ubyte >3 PGP/GPG key public ring (v%u)
|
||||
!:mime application/pgp-keys
|
||||
!:ext pgp/gpg/pkr/asd
|
||||
>>>>4 beldate x created %s
|
||||
# display key algorithm 17~DSA
|
||||
>>>>8 use key_algo
|
||||
# Multiprecision Integers (MPI) size
|
||||
>>>>9 ubeshort x %u bits
|
||||
>>>>11 ubequad x MPI=0x%16.16llx...
|
||||
|
||||
0 beshort 0x9501 PGP key security ring
|
||||
!:mime application/x-pgp-keyring
|
||||
0 beshort 0x9500 PGP key security ring
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: revision,v 1.9 2013/02/06 14:18:52 christos Exp $
|
||||
# $File: revision,v 1.10 2017/10/19 16:40:37 christos Exp $
|
||||
# file(1) magic for revision control files
|
||||
# From Hendrik Scholz <hendrik@scholz.net>
|
||||
0 string/t /1\ :pserver: cvs password text file
|
||||
@ -15,13 +15,27 @@
|
||||
|
||||
# Type: Git pack
|
||||
# From: Adam Buchbinder <adam.buchbinder@gmail.com>
|
||||
# Update: Joerg Jenderek
|
||||
# URL: http://fileformats.archiveteam.org/wiki/Git
|
||||
# reference: https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt
|
||||
# The actual magic is 'PACK', but that clashes with Doom/Quake packs. However,
|
||||
# those have a little-endian offset immediately following the magic 'PACK',
|
||||
# the first byte of which is never 0, while the first byte of the Git pack
|
||||
# version, since it's a tiny number stored in big-endian format, is always 0.
|
||||
0 string PACK\0 Git pack
|
||||
>4 belong >0 \b, version %d
|
||||
>>8 belong >0 \b, %d objects
|
||||
0 string PACK
|
||||
# GRR: line above is too general as it matches also PackDir archive ./acorn
|
||||
# test for major version. Git 2017 accepts version number 2 or 3
|
||||
>4 ubelong <9
|
||||
# Acorn PackDir with method 0 compression has root like ADFS::HardDisc4.$.AsylumSrc
|
||||
# or SystemDevice::foobar
|
||||
>>9 search/13 ::
|
||||
# but in git binary
|
||||
>>9 default x Git pack
|
||||
!:mime application/x-git
|
||||
!:ext pack
|
||||
# 4 GB limit implies unsigned integer
|
||||
>>>4 ubelong x \b, version %u
|
||||
>>>8 ubelong x \b, %u objects
|
||||
|
||||
# Type: Git pack index
|
||||
# From: Adam Buchbinder <adam.buchbinder@gmail.com>
|
||||
|
@ -1,10 +1,11 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: riff,v 1.32 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: riff,v 1.33 2017/10/06 01:11:24 christos Exp $
|
||||
# riff: file(1) magic for RIFF format
|
||||
# See
|
||||
#
|
||||
# http://www.seanet.com/users/matts/riffmci/riffmci.htm
|
||||
# http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf
|
||||
#
|
||||
|
||||
# audio format tag. Assume limits: max 1024 bit, 128 channels, 1 MHz
|
||||
@ -70,9 +71,31 @@
|
||||
#
|
||||
0 string RIFF RIFF (little-endian) data
|
||||
# RIFF Palette format
|
||||
>8 string PAL \b, palette
|
||||
>>16 leshort x \b, version %d
|
||||
>>18 leshort x \b, %d entries
|
||||
# Update: Joerg Jenderek
|
||||
# URL: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
|
||||
# Reference: http://worms2d.info/Palette_file
|
||||
>8 string PAL\ \b, palette
|
||||
!:mime application/x-riff
|
||||
# color palette by Microsoft Corporation
|
||||
!:ext pal
|
||||
# file size = chunk size + 8 in most cases
|
||||
>>4 ulelong+8 x \b, %u bytes
|
||||
# Extended PAL Format
|
||||
>>12 string plth \b, extended
|
||||
# Simple PAL Format
|
||||
>>12 string data
|
||||
# data chunk size = color entries * 4 + 4 + sometimes extra (4) appended bytes
|
||||
>>>16 ulelong x \b, data size %u
|
||||
# palVersion is always 0x0300
|
||||
#>>>20 leshort x \b, version 0x%4.4x
|
||||
# palNumEntries specifies the number of palette color entries
|
||||
>>>22 uleshort x \b, %u entries
|
||||
# after palPalEntry sized (number of color entries * 4 ) vector
|
||||
>>>(22.s*4) ubequad x
|
||||
# jump relative 22 ( 8 + 16) bytes forward points after end of file or to
|
||||
# appended extra bytes like in http://safecolours.rigdenage.com/set(ms).zip/Protan(MS).pal
|
||||
>>>>&16 ubelong x \b, extra bytes
|
||||
>>>>>&-4 ubelong >0 0x%8.8x
|
||||
# RIFF Device Independent Bitmap format
|
||||
>8 string RDIB \b, device-independent bitmap
|
||||
>>16 string BM
|
||||
|
15
magic/Magdir/rpi
Normal file
15
magic/Magdir/rpi
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: rpi,v 1.1 2018/01/01 05:25:17 christos Exp $
|
||||
# rpi: file(1) magic for Raspberry Pi images
|
||||
-44 lelong 0
|
||||
>4 lelong 0
|
||||
>>8 lelong 1
|
||||
>>12 lelong 4
|
||||
>>>16 string 283x
|
||||
>>>>20 lelong 1
|
||||
>>>>>24 lelong 4
|
||||
>>>>>>28 string DTOK
|
||||
>>>>>>>32 lelong 44
|
||||
>>>>>>>>36 lelong 4
|
||||
>>>>>>>>>40 string RPTL Raspberry PI kernel image
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: sgml,v 1.37 2017/07/23 08:23:33 christos Exp $
|
||||
# $File: sgml,v 1.38 2017/10/11 11:40:43 christos Exp $
|
||||
# Type: SVG Vectorial Graphics
|
||||
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
|
||||
0 string \<?xml\ version=
|
||||
@ -132,3 +132,14 @@
|
||||
0 search/1 #\ HTTP\ Cookie\ File Web browser cookie text
|
||||
0 search/1 #\ Netscape\ HTTP\ Cookie\ File Netscape cookie text
|
||||
0 search/1 #\ KDE\ Cookie\ File Konqueror cookie text
|
||||
|
||||
# XML-based format representing braille pages in a digital format.
|
||||
#
|
||||
# Specification:
|
||||
# http://files.pef-format.org/specifications/pef-2008-1/pef-specification.html
|
||||
#
|
||||
# Simon Aittamaa <simon.aittamaa@gmail.com>
|
||||
0 string \<?xml\ version=
|
||||
>14 regex ['"\ \t]*[0-9.]+['"\ \t]*
|
||||
>>19 search/4096 \<pef Portable Embosser Format
|
||||
!:mime application/x-pef+xml
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: spectrum,v 1.7 2010/09/20 18:55:20 rrt Exp $
|
||||
# $File: spectrum,v 1.8 2017/09/11 23:51:12 christos Exp $
|
||||
# spectrum: file(1) magic for Spectrum emulator files.
|
||||
#
|
||||
# John Elliott <jce@seasip.demon.co.uk>
|
||||
@ -52,3 +52,29 @@
|
||||
# Hard disk images
|
||||
0 string RS-IDE\x1a Spectrum .HDF hard disk image
|
||||
>7 byte x \b, version 0x%02x
|
||||
|
||||
# SZX snapshots (fuse and spectaculator)
|
||||
# Martin M. S. Pedersen <martin@linux.com>
|
||||
# http://www.spectaculator.com/docs/zx-state/header.shtml
|
||||
#
|
||||
0 string ZXST zx-state snapshot
|
||||
>4 byte x version %d
|
||||
>5 byte x \b.%d
|
||||
>>6 byte 0 16k ZX Spectrum
|
||||
>>6 byte 1 48k ZX Spectrum/ZX Spectrum+
|
||||
>>6 byte 2 ZX Spectrum 128
|
||||
>>6 byte 3 ZX Spectrum +2
|
||||
>>6 byte 4 ZX Spectrum +2A/+2B
|
||||
>>6 byte 5 ZX Spectrum +3
|
||||
>>6 byte 6 ZX Spectrum +3e
|
||||
>>6 byte 7 Pentagon 128
|
||||
>>6 byte 8 Timex Sinclair TC2048
|
||||
>>6 byte 9 Timex Sinclair TC2068
|
||||
>>6 byte 10 Scorpion ZS-256
|
||||
>>6 byte 11 ZX Spectrum SE
|
||||
>>6 byte 12 Timex Sinclair TS2068
|
||||
>>6 byte 13 Pentagon 512
|
||||
>>6 byte 14 Pentagon 1024
|
||||
>>6 byte 15 48k ZX Spectrum (NTSC)
|
||||
>>6 byte 16 ZX Spectrum 12Ke
|
||||
>>>7 byte 1 (alternate timings)
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: ssl,v 1.4 2017/01/22 21:14:25 christos Exp $
|
||||
# $File: ssl,v 1.5 2017/12/29 04:00:07 christos Exp $
|
||||
# ssl: file(1) magic for SSL file formats
|
||||
|
||||
# Type: OpenSSL certificates/key files
|
||||
@ -17,4 +17,4 @@
|
||||
# OpenSSL enc file (recognized by a magic string preceding the password's salt)
|
||||
0 string Salted__ openssl enc'd data with salted password
|
||||
# Using the -a or -base64 option, OpenSSL will base64-encode the data.
|
||||
0 string U2FsdGVkX19 openssl enc'd data with salted password, base64 encoded
|
||||
0 string U2FsdGVkX1 openssl enc'd data with salted password, base64 encoded
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: terminfo,v 1.9 2017/04/28 16:28:58 christos Exp $
|
||||
# $File: terminfo,v 1.10 2018/01/21 03:26:33 christos Exp $
|
||||
# terminfo: file(1) magic for terminfo
|
||||
#
|
||||
# URL: http://invisible-island.net/ncurses/man/term.5.html
|
||||
@ -19,6 +19,17 @@
|
||||
# no extension
|
||||
#!:ext
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# The following was added for ncurses6 development:
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
0 string \036\002
|
||||
# imitate the legacy compiled-format, to get the entry-name printed
|
||||
>16 ubyte >32
|
||||
# namelist, if more than 1 separated by "|" like "st|stterm| simpleterm 0. 4.1"
|
||||
>>12 regex \^[a-zA-Z0-9][a-zA-Z0-9.][^|]* Compiled 32-bit terminfo entry "%-s"
|
||||
!:mime application/x-terminfo2
|
||||
#
|
||||
# While the compiled terminfo uses little-endian format irregardless of
|
||||
# platform, SystemV screen dumps do not. They came later, and that detail was
|
||||
# overlooked.
|
||||
|
82
magic/Magdir/tplink
Normal file
82
magic/Magdir/tplink
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: tplink,v 1.2 2017/12/14 05:52:56 christos Exp $
|
||||
# tplink: File magic for openwrt firmware files
|
||||
|
||||
# URL: https://wiki.openwrt.org/doc/techref/header
|
||||
# Reference: http://git.openwrt.org/?p=openwrt.git;a=blob;f=tools/firmware-utils/src/mktplinkfw.c
|
||||
# From: Joerg Jenderek
|
||||
# check for valid header version 1 or 2
|
||||
0 ulelong <3
|
||||
>0 ulelong !0
|
||||
# test for header padding with nulls
|
||||
>>0x100 long 0
|
||||
>>>0 use firmware-tplink
|
||||
|
||||
0 name firmware-tplink
|
||||
>0 ubyte x firmware
|
||||
!:mime application/x-tplink-bin
|
||||
!:ext bin
|
||||
# hardware id like 10430001 07410001 09410004 09410006
|
||||
>0x40 ubeshort x %x
|
||||
>0x42 ubeshort x v%x
|
||||
# hardware revision like 1
|
||||
>0x44 ubelong !1 (revision %u)
|
||||
# vendor_name[24] like OpenWrt or TP-LINK Technologies
|
||||
>4 string x %.24s
|
||||
# fw_version[36] like r49389 or ver. 1.0
|
||||
>0x1c string x %.36s
|
||||
# header version 1 or 2
|
||||
>0 ubyte !1 V%X
|
||||
# ver_hi.ver_mid.ver_lo
|
||||
>0x98 long !0 \b, version
|
||||
>>0x98 ubeshort x %u
|
||||
>>0x9A ubeshort x \b.%u
|
||||
>>0x9C ubeshort x \b.%u
|
||||
# region code 0~universal 1~US
|
||||
>0x48 ubelong x
|
||||
#>>0x48 ubelong 0 (universal)
|
||||
>>0x48 ubelong 1 (US)
|
||||
>>0x48 ubelong >1 (region %u)
|
||||
# total length of the firmware. not always true
|
||||
>0x7C ubelong x \b, %u bytes or less
|
||||
# unknown 1
|
||||
>0x48 ubelong !0 \b, UNKNOWN1 0x%x
|
||||
# md5sum1[16]
|
||||
#>0x4c ubequad x \b, MD5 %llx
|
||||
#>>0x54 ubequad x \b%llx
|
||||
# unknown 2
|
||||
>0x5c ubelong !0 \b, UNKNOWN2 0x%x
|
||||
# md5sum2[16]
|
||||
#>0x60 ubequad !0 \b, 2nd MD5 %llx
|
||||
#>>0x68 ubequad x \b%llx
|
||||
# unknown 3
|
||||
>0x70 ubelong !0 \b, UNKNOWN3 0x%x
|
||||
# kernel load address
|
||||
#>0x74 ubelong x \b, 0x%x load
|
||||
# kernel entry point
|
||||
#>0x78 ubelong x \b, 0x%x entry
|
||||
# kernel data offset. 200h means direct after header
|
||||
>0x80 ubelong x \b, at 0x%x
|
||||
# kernel data length and 1 space
|
||||
>0x84 ubelong x %u bytes
|
||||
# look for kernel type (gzip compressed vmlinux.bin by ./compress)
|
||||
>(0x80.L) indirect x
|
||||
# root file system data offset
|
||||
>0x88 ubelong x \b, at 0x%x
|
||||
# rootfs data length and 1 space
|
||||
>0x8C ubelong x %u bytes
|
||||
# in 5.32 only true for offset ~< FILE_BYTES_MAX=9 MB defined in ../../src/file.h
|
||||
>(0x88.L) indirect x
|
||||
#>(0x88.L) string x \b, file system '%.4s'
|
||||
#>(0x88.L) ubequad x \b, file system 0x%llx
|
||||
# bootloader data offset
|
||||
>0x90 ubelong !0 \b, at 0x%x
|
||||
# bootloader data length only resonable if bootloader offset not null
|
||||
>>0x94 ubelong !0 %u bytes
|
||||
# pad[354] should be 354 null bytes.
|
||||
#>0x9E ubequad !0 \b, padding 0x%llx
|
||||
# But at 0x120 18 non null bytes in examples like
|
||||
# wr940nv4_eu_3_16_9_up_boot(160620).bin
|
||||
# wr940nv6_us_3_18_1_up_boot(171030).bin
|
||||
#>0x120 ubequad !0 \b, other padding 0x%llx
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: vorbis,v 1.23 2017/03/17 21:35:28 christos Exp $
|
||||
# $File: vorbis,v 1.24 2018/03/14 04:38:44 christos Exp $
|
||||
# vorbis: file(1) magic for Ogg/Vorbis files
|
||||
#
|
||||
# From Felix von Leitner <leitner@fefe.de>
|
||||
@ -122,6 +122,15 @@
|
||||
>>>>>>(84.b+117) string 20020717 (1.0)
|
||||
>>>>>>(84.b+117) string 20030909 (1.0.1)
|
||||
>>>>>>(84.b+117) string 20040629 (1.1.0 RC1)
|
||||
>>>>>>(84.b+117) string 20050304 (1.1.2)
|
||||
>>>>>>(84.b+117) string 20070622 (1.2.0)
|
||||
>>>>>>(84.b+117) string 20090624 (1.2.2)
|
||||
>>>>>>(84.b+117) string 20090709 (1.2.3)
|
||||
>>>>>>(84.b+117) string 20100325 (1.3.1)
|
||||
>>>>>>(84.b+117) string 20101101 (1.3.2)
|
||||
>>>>>>(84.b+117) string 20120203 (1.3.3)
|
||||
>>>>>>(84.b+117) string 20140122 (1.3.4)
|
||||
>>>>>>(84.b+117) string 20150105 (1.3.5)
|
||||
|
||||
# non-Vorbis content: Opus https://tools.ietf.org/html/draft-ietf-codec-oggopus-06#section-5
|
||||
>>28 string OpusHead \b, Opus audio,
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: windows,v 1.16 2017/03/17 22:20:22 christos Exp $
|
||||
# $File: windows,v 1.22 2018/02/16 15:44:00 christos Exp $
|
||||
# windows: file(1) magic for Microsoft Windows
|
||||
#
|
||||
# This file is mainly reserved for files where programs
|
||||
@ -143,7 +143,7 @@
|
||||
# remaining files should be HeLP Bookmark WinHlp32.BMK (XP 32-bit) or WinHlp32 (Windows 8.1 64-bit)
|
||||
>>>>16 default x Windows help Bookmark
|
||||
!:mime application/x-winhelp
|
||||
!:ext /bmk
|
||||
!:ext bmk
|
||||
## FirstFreeBlock normally FFFFFFFFh 10h for *ANN
|
||||
##>>8 lelong x \b, FirstFreeBlock 0x%8.8x
|
||||
# EntireFileSize
|
||||
@ -290,35 +290,86 @@
|
||||
|
||||
|
||||
# Summary: Windows Registry text
|
||||
# Extension: .reg
|
||||
# URL: https://en.wikipedia.org/wiki/Windows_Registry#.REG_files
|
||||
# Reference: http://fileformats.archiveteam.org/wiki/Windows_Registry
|
||||
# Submitted by: Abel Cheung <abelcheung@gmail.com>
|
||||
0 string REGEDIT4\r\n\r\n Windows Registry text (Win95 or above)
|
||||
0 string Windows\ Registry\ Editor\040
|
||||
# Update: Joerg Jenderek
|
||||
# Windows 3-9X variant
|
||||
0 string REGEDIT
|
||||
# skip ASCII text like "REGEDITor.txt" but match
|
||||
# L1WMAP.REG with only 1 CRNL or org.gnome.gnumeric.reg with 2 NL
|
||||
>7 search/3 \n Windows Registry text
|
||||
!:mime text/x-ms-regedit
|
||||
!:ext reg
|
||||
# Windows 9X variant
|
||||
>>0 string REGEDIT4 (Win95 or above)
|
||||
# Windows 2K ANSI variant
|
||||
0 string Windows\ Registry\ Editor\
|
||||
>&0 string Version\ 5.00\r\n\r\n Windows Registry text (Win2K or above)
|
||||
!:mime text/x-ms-regedit
|
||||
!:ext reg
|
||||
# Windows 2K UTF-16 variant
|
||||
2 lestring16 Windows\ Registry\ Editor\
|
||||
>0x32 lestring16 Version\ 5.00\r\n\r\n Windows Registry little-endian text (Win2K or above)
|
||||
# relative offset not working
|
||||
#>&0 lestring16 Version\ 5.00\r\n\r\n Windows Registry little-endian text (Win2K or above)
|
||||
!:mime text/x-ms-regedit
|
||||
!:ext reg
|
||||
# WINE variant
|
||||
# URL: https://en.wikipedia.org/wiki/Wine_(software)
|
||||
# Reference: https://www.winehq.org/pipermail/wine-cvs/2005-October/018763.html
|
||||
# Note: WINE use text based registry (system.reg,user.reg,userdef.reg)
|
||||
# instead binary hiv structure like Windows
|
||||
0 string WINE\ REGISTRY\ Version\ WINE registry text
|
||||
# version 2
|
||||
>&0 string x \b, version %s
|
||||
!:mime text/x-wine-extension-reg
|
||||
!:ext reg
|
||||
|
||||
# Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013
|
||||
# Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013, Feb 2018
|
||||
# empty ,comment , section
|
||||
# PR/383: remove unicode BOM because it is not portable across regex impls
|
||||
0 regex/s \\`(\\r\\n|;|[[])
|
||||
# left bracket in section line
|
||||
>&0 search/8192 [
|
||||
#0 regex/s \\`(\\r\\n|;|[[])
|
||||
# empty line CRLF
|
||||
0 ubeshort 0x0D0A
|
||||
>0 use ini-file
|
||||
# comment line
|
||||
0 string ;
|
||||
>0 use ini-file
|
||||
# section line
|
||||
0 string [
|
||||
>0 use ini-file
|
||||
# check and then display Windows INItialization configuration
|
||||
0 name ini-file
|
||||
# look for left bracket in section line
|
||||
>0 search/8192 [
|
||||
# http://en.wikipedia.org/wiki/Autorun.inf
|
||||
# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
|
||||
>>&0 regex/c \^(autorun)]\r\n
|
||||
>>>&0 ubyte =0x5b INItialization configuration
|
||||
!:mime application/x-wine-extension-ini
|
||||
# space after right bracket
|
||||
# or AutoRun.Amd64 for 64 bit systems
|
||||
# or only NL separator
|
||||
>>&0 regex/c \^(autorun)
|
||||
# but sometimes total commander directory tree file "treeinfo.wc" with lines like
|
||||
# [AUTORUN]
|
||||
# [boot]
|
||||
>>>&0 string =]\r\n[ Total commander directory treeinfo.wc
|
||||
!:mime text/plain
|
||||
!:ext wc
|
||||
# From: Pal Tamas <folti@balabit.hu>
|
||||
# Autorun File
|
||||
>>>&0 ubyte !0x5b Microsoft Windows Autorun file
|
||||
>>>&0 string !]\r\n[ Microsoft Windows Autorun file
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
# http://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
|
||||
# version strings ASCII coded case-independent for Windows setup information script file
|
||||
>>&0 regex/c \^(version|strings)] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
#!:mime application/inf
|
||||
#!:mime application/x-wine-extension-inf
|
||||
!:ext inf
|
||||
# NETCRC.INF OEMCPL.INF
|
||||
>>&0 regex/c \^(WinsockCRCList|OEMCPL)] Windows setup INFormation
|
||||
!:mime text/inf
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
# http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
|
||||
# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
|
||||
# .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
|
||||
@ -328,50 +379,82 @@
|
||||
# http://support.microsoft.com/kb/84709/
|
||||
>>&0 regex/c \^(don't\ load)] Windows CONTROL.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
>>&0 regex/c \^(ndishlp\\$|protman\\$|NETBEUI\\$)] Windows PROTOCOL.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# http://technet.microsoft.com/en-us/library/cc722567.aspx
|
||||
# http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
|
||||
>>&0 regex/c \^(windows|Compatibility|embedding)] Windows WIN.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# http://en.wikipedia.org/wiki/SYSTEM.INI
|
||||
>>&0 regex/c \^(boot|386enh|drivers)] Windows SYSTEM.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# http://www.mdgx.com/newtip6.htm
|
||||
>>&0 regex/c \^(SafeList)] Windows IOS.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# http://en.wikipedia.org/wiki/NTLDR Windows Boot Loader information
|
||||
>>&0 regex/c \^(boot\x20loader)] Windows boot.ini
|
||||
!:mime application/x-wine-extension-ini
|
||||
>>>&0 ubyte x
|
||||
!:ext ini
|
||||
# http://en.wikipedia.org/wiki/CONFIG.SYS
|
||||
>>&0 regex/c \^(menu)]\r\n MS-DOS CONFIG.SYS
|
||||
>>&0 regex/c \^(menu)] MS-DOS CONFIG.SYS
|
||||
# @CONFIG.UI configuration file of previous DOS version saved by Caldera OPENDOS INSTALL.EXE
|
||||
# CONFIG.PSS saved version of file CONFIG.SYS created by %WINDIR%\SYTEM\MSCONFIG.EXE
|
||||
# CONFIG.TSH renamed file CONFIG.SYS.BAT by %WINDIR%\SYTEM\MSCONFIG.EXE
|
||||
# dos and w40 used in dual booting scene
|
||||
!:ext sys/dos/w40
|
||||
# http://support.microsoft.com/kb/118579/
|
||||
>>&0 regex/c \^(Paths)]\r\n MS-DOS MSDOS.SYS
|
||||
# VERS string unicoded case-independent
|
||||
>>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0056004500520053
|
||||
# ION] string unicoded case-independent
|
||||
>>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x0049004f004e005d Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
# STRI string unicoded case-independent
|
||||
>>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0053005400520049
|
||||
# NGS] string unicoded case-independent
|
||||
>>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x004e00470053005D Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext sys/dos
|
||||
# http://chmspec.nongnu.org/latest/INI.html#HHP
|
||||
>>&0 regex/c \^(options)]\r\n Microsoft HTML Help Project
|
||||
!:mime text/plain
|
||||
!:ext hhp
|
||||
# unknown keyword after opening bracket
|
||||
>>&0 default x
|
||||
#>>>&0 string/c x UNKNOWN [%s
|
||||
# look for left bracket of second section
|
||||
>>>&0 search/8192 [
|
||||
# version Strings FileIdentification
|
||||
>>>>&0 string/c version Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
# VERS string unicoded case-independent
|
||||
>>>>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0056004500520053
|
||||
# ION] string unicoded case-independent
|
||||
>>>>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x0049004f004e005d Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
# http://en.wikipedia.org/wiki/Initialization_file Windows Initialization File or other
|
||||
#>>>>&0 default x Generic INItialization configuration
|
||||
#!:mime application/x-wine-extension-ini
|
||||
>>>>&0 default x
|
||||
>>>>>&0 ubyte x
|
||||
# characters, digits, underscore and white space followed by right bracket
|
||||
# terminated by CR implies section line to skip BOOTLOG.TXT DETLOG.TXT
|
||||
>>>>>>&-1 regex \^([A-Za-z0-9_\(\)\ ]+)\]\r Generic INItialization configuration [%-.40s
|
||||
# NETDEF.INF multiarc.ini
|
||||
#!:mime application/x-setupscript
|
||||
!:mime application/x-wine-extension-ini
|
||||
#!:mime text/plain
|
||||
!:ext ini/inf
|
||||
# UTF-16 BOM followed by CR~0D00 , comment~semicolon~3B00 , section~bracket~5B00
|
||||
0 ubelong&0xFFff89FF =0xFFFE0900
|
||||
# look for left bracket in section line
|
||||
>2 search/8192 [
|
||||
# keyword without 1st letter which is maybe up-/down-case
|
||||
>>&3 lestring16 ersion] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
>>&3 lestring16 trings] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
>>&3 lestring16 ourceDisksNames] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
# netnwcli.inf start with ;---[ NetNWCli.INX ]
|
||||
>>&3 default x
|
||||
# look for NL followed by left bracket
|
||||
>>>&0 search/8192 \x0A\x00\x5b
|
||||
>>>>&3 lestring16 ersion] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
|
||||
# Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
|
||||
# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
|
||||
@ -573,3 +656,63 @@
|
||||
#>>>>>>93 ubyte x \b, MFT version %x
|
||||
#
|
||||
|
||||
# URL: https://en.wikipedia.org/wiki/PaintShop_Pro
|
||||
# Reference: http://www.cryer.co.uk/file-types/p/pal.htm
|
||||
# Created by: Joerg Jenderek
|
||||
# Note: there exist other color palette formats also with .pal extension
|
||||
0 string JASC-PAL\r\n PaintShop Pro color palette
|
||||
#!:mime text/plain
|
||||
# PspPalette extension is used by newer (probably 8) PaintShopPro versions
|
||||
!:ext pal/PspPalette
|
||||
# 2nd line contains palette file version. For example "0100"
|
||||
>10 string !0100 \b, version %.4s
|
||||
# third line contains the number of colours: 16 256 ...
|
||||
>16 string x \b, %.3s colors
|
||||
|
||||
# URL: http://en.wikipedia.org/wiki/Innosetup
|
||||
# Reference: https://github.com/jrsoftware/issrc/blob/master/Projects/Undo.pas
|
||||
# Created by: Joerg Jenderek
|
||||
# Note: created by like "InnoSetup self-extracting archive" inside ./msdos
|
||||
# TrID labeles the entry as "Inno Setup Uninstall Log"
|
||||
# TUninstallLogID
|
||||
0 string Inno\ Setup\ Uninstall\ Log\ (b) InnoSetup Log
|
||||
!:mime application/x-innosetup
|
||||
# unins000.dat, unins001.dat, ...
|
||||
!:ext dat
|
||||
# " 64-bit" variant
|
||||
>0x1c string >\0 \b%.7s
|
||||
# AppName[0x80] like "Minimal SYStem", ClamWin Free Antivirus , ...
|
||||
>0xc0 string x %s
|
||||
# AppId[0x80] is simliar to AppName or
|
||||
# GUID like {4BB0DCDC-BC24-49EC-8937-72956C33A470} start with left brace
|
||||
>0x40 ubyte 0x7b
|
||||
>>0x40 string x %-.38s
|
||||
# do not know how this log version correlates to program version
|
||||
>0x140 ulelong x \b, version 0x%x
|
||||
# NumRecs
|
||||
#>0x144 ulelong x \b, 0x%4.4x records
|
||||
# EndOffset means files size
|
||||
>0x148 ulelong x \b, %u bytes
|
||||
# Flags 5 25h 35h
|
||||
#>0x14c ulelong x \b, flags %8.8x
|
||||
# Reserved: array[0..26] of Longint
|
||||
# the non Unicode HighestSupportedVersion may never become greater than or equal to 1000
|
||||
>0x140 ulelong <1000
|
||||
# hostname
|
||||
>>0x1d6 pstring x \b, %s
|
||||
# user name
|
||||
>>>&0 pstring x \b\%s
|
||||
# directory like C:\Program Files (x86)\GnuWin32
|
||||
>>>>&0 pstring x \b, "%s"
|
||||
# version 1000 or higher implies unicode
|
||||
>0x140 ulelong >999
|
||||
# hostname
|
||||
>>0x1db lestring16 x \b, %-.9s
|
||||
# utf string variant with prepending fe??ffFFff
|
||||
>>0x1db search/43 \xFF\xFF\xFF
|
||||
# user name
|
||||
>>>&0 lestring16 x \b\%-.9s
|
||||
>>>&0 search/43 \xFF\xFF\xFF
|
||||
# directory like C:\Program Files\GIMP 2
|
||||
>>>>&0 lestring16 x \b, %-.42s
|
||||
|
||||
|
63
magic/Magdir/zip
Normal file
63
magic/Magdir/zip
Normal file
@ -0,0 +1,63 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: zip,v 1.1 2017/11/03 23:36:17 christos Exp $
|
||||
# zip: file(1) magic for zip files; this is not use
|
||||
# Note the version of magic in archive is currently stronger, this is
|
||||
# just an example until negative offsets are supported better
|
||||
|
||||
# Zip Central Cirectory record
|
||||
0 name zipcd
|
||||
>0 string PK\001\002
|
||||
>>4 leshort x \b, made by
|
||||
>>4 use zipversion
|
||||
>>6 leshort x \b, extract using at least
|
||||
>>6 use zipversion
|
||||
>>12 ledate x \b, last modified %s
|
||||
>>24 lelong >0 \b, uncompressed size %d
|
||||
>>10 leshort x \b, method=
|
||||
>>10 use zipcompression
|
||||
|
||||
# Zip known compressions
|
||||
0 name zipcompression
|
||||
>0 leshort 0 \bstore
|
||||
>0 leshort 8 \bdeflate
|
||||
>0 leshort 9 \bdeflate64
|
||||
>0 leshort 12 \bbzip2
|
||||
>0 leshort 14 \blzma
|
||||
>0 leshort 94 \bMP3
|
||||
>0 leshort 95 \bxz
|
||||
>0 leshort 96 \bJpeg
|
||||
>0 leshort 97 \bWavPack
|
||||
>0 leshort 98 \bPPMd
|
||||
>0 leshort 99 \bAES Encrypted
|
||||
>0 default x
|
||||
>>0 leshort x \b[%#x]
|
||||
|
||||
# Zip known versions
|
||||
0 name zipversion
|
||||
>0 leshort 0x09 v0.9
|
||||
>0 leshort 0x0a v1.0
|
||||
>0 leshort 0x0b v1.1
|
||||
>0 leshort 0x14 v2.0
|
||||
>0 leshort 0x15 v2.1
|
||||
>0 leshort 0x19 v2.5
|
||||
>0 leshort 0x1b v2.7
|
||||
>0 leshort 0x2d v4.5
|
||||
>0 leshort 0x2e v4.6
|
||||
>0 leshort 0x32 v5.0
|
||||
>0 leshort 0x33 v5.1
|
||||
>0 leshort 0x34 v5.2
|
||||
>0 leshort 0x3d v6.1
|
||||
>0 leshort 0x3e v6.2
|
||||
>0 leshort 0x3f v6.3
|
||||
>0 default x
|
||||
>>0 leshort x v?[%#x]
|
||||
|
||||
# Zip End Of Central Directory record
|
||||
-22 string PK\005\006 Zip archive data
|
||||
#>4 leshort >1 \b, %d disks
|
||||
#>6 leshort >1 \b, central directory disk %d
|
||||
#>8 leshort >1 \b, %d central directories on this disk
|
||||
#>10 leshort >1 \b, %d central directories
|
||||
#>12 lelong x \b, %d central directory bytes
|
||||
>(16.l) use zipcd
|
||||
>20 pstring/l >0 \b, %s
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $File: Makefile.am,v 1.126 2017/08/10 11:01:38 christos Exp $
|
||||
# $File: Makefile.am,v 1.132 2018/01/28 00:00:17 rrt Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@ -34,6 +34,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
|
||||
$(MAGIC_FRAGMENT_DIR)/audio \
|
||||
$(MAGIC_FRAGMENT_DIR)/basis \
|
||||
$(MAGIC_FRAGMENT_DIR)/ber \
|
||||
$(MAGIC_FRAGMENT_DIR)/beetle \
|
||||
$(MAGIC_FRAGMENT_DIR)/bflt \
|
||||
$(MAGIC_FRAGMENT_DIR)/bhl \
|
||||
$(MAGIC_FRAGMENT_DIR)/bioinformatics \
|
||||
@ -71,6 +72,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
|
||||
$(MAGIC_FRAGMENT_DIR)/cups \
|
||||
$(MAGIC_FRAGMENT_DIR)/dact \
|
||||
$(MAGIC_FRAGMENT_DIR)/database \
|
||||
$(MAGIC_FRAGMENT_DIR)/dbpf \
|
||||
$(MAGIC_FRAGMENT_DIR)/der \
|
||||
$(MAGIC_FRAGMENT_DIR)/diamond \
|
||||
$(MAGIC_FRAGMENT_DIR)/diff \
|
||||
@ -156,6 +158,7 @@ $(MAGIC_FRAGMENT_DIR)/mathcad \
|
||||
$(MAGIC_FRAGMENT_DIR)/mathematica \
|
||||
$(MAGIC_FRAGMENT_DIR)/matroska \
|
||||
$(MAGIC_FRAGMENT_DIR)/mcrypt \
|
||||
$(MAGIC_FRAGMENT_DIR)/measure \
|
||||
$(MAGIC_FRAGMENT_DIR)/mercurial \
|
||||
$(MAGIC_FRAGMENT_DIR)/metastore \
|
||||
$(MAGIC_FRAGMENT_DIR)/meteorological \
|
||||
@ -222,6 +225,7 @@ $(MAGIC_FRAGMENT_DIR)/python \
|
||||
$(MAGIC_FRAGMENT_DIR)/qt \
|
||||
$(MAGIC_FRAGMENT_DIR)/revision \
|
||||
$(MAGIC_FRAGMENT_DIR)/riff \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpi \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpm \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/ruby \
|
||||
@ -258,6 +262,7 @@ $(MAGIC_FRAGMENT_DIR)/tex \
|
||||
$(MAGIC_FRAGMENT_DIR)/tgif \
|
||||
$(MAGIC_FRAGMENT_DIR)/ti-8x \
|
||||
$(MAGIC_FRAGMENT_DIR)/timezone \
|
||||
$(MAGIC_FRAGMENT_DIR)/tplink \
|
||||
$(MAGIC_FRAGMENT_DIR)/troff \
|
||||
$(MAGIC_FRAGMENT_DIR)/tuxedo \
|
||||
$(MAGIC_FRAGMENT_DIR)/typeset \
|
||||
@ -293,6 +298,7 @@ $(MAGIC_FRAGMENT_DIR)/xwindows \
|
||||
$(MAGIC_FRAGMENT_DIR)/yara \
|
||||
$(MAGIC_FRAGMENT_DIR)/zfs \
|
||||
$(MAGIC_FRAGMENT_DIR)/zilog \
|
||||
$(MAGIC_FRAGMENT_DIR)/zip \
|
||||
$(MAGIC_FRAGMENT_DIR)/zyxel
|
||||
|
||||
MAGIC = magic.mgc
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -15,61 +15,23 @@
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -88,6 +50,7 @@ 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 \
|
||||
@ -95,7 +58,6 @@ 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 =
|
||||
@ -149,7 +111,6 @@ 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@
|
||||
@ -163,7 +124,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -179,7 +139,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -273,7 +232,7 @@ top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
#
|
||||
# $File: Makefile.am,v 1.126 2017/08/10 11:01:38 christos Exp $
|
||||
# $File: Makefile.am,v 1.132 2018/01/28 00:00:17 rrt Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@ -306,6 +265,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
|
||||
$(MAGIC_FRAGMENT_DIR)/audio \
|
||||
$(MAGIC_FRAGMENT_DIR)/basis \
|
||||
$(MAGIC_FRAGMENT_DIR)/ber \
|
||||
$(MAGIC_FRAGMENT_DIR)/beetle \
|
||||
$(MAGIC_FRAGMENT_DIR)/bflt \
|
||||
$(MAGIC_FRAGMENT_DIR)/bhl \
|
||||
$(MAGIC_FRAGMENT_DIR)/bioinformatics \
|
||||
@ -343,6 +303,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
|
||||
$(MAGIC_FRAGMENT_DIR)/cups \
|
||||
$(MAGIC_FRAGMENT_DIR)/dact \
|
||||
$(MAGIC_FRAGMENT_DIR)/database \
|
||||
$(MAGIC_FRAGMENT_DIR)/dbpf \
|
||||
$(MAGIC_FRAGMENT_DIR)/der \
|
||||
$(MAGIC_FRAGMENT_DIR)/diamond \
|
||||
$(MAGIC_FRAGMENT_DIR)/diff \
|
||||
@ -428,6 +389,7 @@ $(MAGIC_FRAGMENT_DIR)/mathcad \
|
||||
$(MAGIC_FRAGMENT_DIR)/mathematica \
|
||||
$(MAGIC_FRAGMENT_DIR)/matroska \
|
||||
$(MAGIC_FRAGMENT_DIR)/mcrypt \
|
||||
$(MAGIC_FRAGMENT_DIR)/measure \
|
||||
$(MAGIC_FRAGMENT_DIR)/mercurial \
|
||||
$(MAGIC_FRAGMENT_DIR)/metastore \
|
||||
$(MAGIC_FRAGMENT_DIR)/meteorological \
|
||||
@ -494,6 +456,7 @@ $(MAGIC_FRAGMENT_DIR)/python \
|
||||
$(MAGIC_FRAGMENT_DIR)/qt \
|
||||
$(MAGIC_FRAGMENT_DIR)/revision \
|
||||
$(MAGIC_FRAGMENT_DIR)/riff \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpi \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpm \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/ruby \
|
||||
@ -530,6 +493,7 @@ $(MAGIC_FRAGMENT_DIR)/tex \
|
||||
$(MAGIC_FRAGMENT_DIR)/tgif \
|
||||
$(MAGIC_FRAGMENT_DIR)/ti-8x \
|
||||
$(MAGIC_FRAGMENT_DIR)/timezone \
|
||||
$(MAGIC_FRAGMENT_DIR)/tplink \
|
||||
$(MAGIC_FRAGMENT_DIR)/troff \
|
||||
$(MAGIC_FRAGMENT_DIR)/tuxedo \
|
||||
$(MAGIC_FRAGMENT_DIR)/typeset \
|
||||
@ -565,6 +529,7 @@ $(MAGIC_FRAGMENT_DIR)/xwindows \
|
||||
$(MAGIC_FRAGMENT_DIR)/yara \
|
||||
$(MAGIC_FRAGMENT_DIR)/zfs \
|
||||
$(MAGIC_FRAGMENT_DIR)/zilog \
|
||||
$(MAGIC_FRAGMENT_DIR)/zip \
|
||||
$(MAGIC_FRAGMENT_DIR)/zyxel
|
||||
|
||||
MAGIC = magic.mgc
|
||||
@ -591,6 +556,7 @@ $(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*) \
|
||||
@ -790,8 +756,6 @@ 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=2013-10-28.13; # UTC
|
||||
scriptversion=2012-06-26.16; # UTC
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -160,7 +160,7 @@ give_advice ()
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
echo "the 'automa4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,61 +14,23 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -87,6 +49,7 @@ 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 \
|
||||
@ -94,7 +57,6 @@ 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 =
|
||||
@ -119,7 +81,6 @@ 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@
|
||||
@ -133,7 +94,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -149,7 +109,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -257,6 +216,7 @@ $(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*) \
|
||||
@ -431,8 +391,6 @@ 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.
|
||||
|
@ -7,7 +7,7 @@ bin_PROGRAMS = file
|
||||
AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
|
||||
AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
|
||||
|
||||
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
|
||||
funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
|
||||
@ -19,7 +19,7 @@ MINGWLIBS =
|
||||
endif
|
||||
libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
|
||||
|
||||
file_SOURCES = file.c
|
||||
file_SOURCES = file.c seccomp.c
|
||||
file_LDADD = libmagic.la
|
||||
CLEANFILES = magic.h
|
||||
EXTRA_DIST = magic.h.in
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -17,61 +17,23 @@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -91,6 +53,10 @@ build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = file$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am asprintf.c \
|
||||
getopt_long.c localtime_r.c ctime_r.c getline.c pread.c \
|
||||
strcasestr.c dprintf.c fmtcheck.c strlcpy.c asctime_r.c \
|
||||
gmtime_r.c strlcat.c vasprintf.c $(top_srcdir)/depcomp
|
||||
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 \
|
||||
@ -98,7 +64,6 @@ 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 =
|
||||
@ -135,7 +100,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libmagic_la_DEPENDENCIES = $(LTLIBOBJS) $(am__DEPENDENCIES_1)
|
||||
am_libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo \
|
||||
am_libmagic_la_OBJECTS = buffer.lo magic.lo apprentice.lo softmagic.lo \
|
||||
ascmagic.lo encoding.lo compress.lo is_tar.lo readelf.lo \
|
||||
print.lo fsmagic.lo funcs.lo apptype.lo der.lo cdf.lo \
|
||||
cdf_time.lo readcdf.lo
|
||||
@ -148,7 +113,7 @@ libmagic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libmagic_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_file_OBJECTS = file.$(OBJEXT)
|
||||
am_file_OBJECTS = file.$(OBJEXT) seccomp.$(OBJEXT)
|
||||
file_OBJECTS = $(am_file_OBJECTS)
|
||||
file_DEPENDENCIES = libmagic.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
@ -212,10 +177,6 @@ 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 dprintf.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@
|
||||
@ -229,7 +190,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -245,7 +205,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -342,7 +301,7 @@ lib_LTLIBRARIES = libmagic.la
|
||||
nodist_include_HEADERS = magic.h
|
||||
AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
|
||||
AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
|
||||
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
|
||||
funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
|
||||
@ -351,7 +310,7 @@ libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
|
||||
@MINGW_FALSE@MINGWLIBS =
|
||||
@MINGW_TRUE@MINGWLIBS = -lgnurx -lshlwapi
|
||||
libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS)
|
||||
file_SOURCES = file.c
|
||||
file_SOURCES = file.c seccomp.c
|
||||
file_LDADD = libmagic.la
|
||||
CLEANFILES = magic.h
|
||||
EXTRA_DIST = magic.h.in
|
||||
@ -374,6 +333,7 @@ $(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*) \
|
||||
@ -426,7 +386,6 @@ clean-libLTLIBRARIES:
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@ -478,7 +437,6 @@ clean-binPROGRAMS:
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES)
|
||||
@rm -f file$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
|
||||
@ -506,6 +464,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apprentice.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apptype.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascmagic.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_time.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@
|
||||
@ -519,6 +478,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readcdf.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@ -788,8 +748,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-libLTLIBRARIES uninstall-nodist_includeHEADERS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
magic.h: ${HDR}
|
||||
sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@
|
||||
|
152
src/apprentice.c
152
src/apprentice.c
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.262 2017/08/28 13:39:18 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.270 2018/02/21 21:26:48 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -652,7 +652,7 @@ protected int
|
||||
file_apprentice(struct magic_set *ms, const char *fn, int action)
|
||||
{
|
||||
char *p, *mfn;
|
||||
int file_err, errs = -1;
|
||||
int fileerr, errs = -1;
|
||||
size_t i;
|
||||
|
||||
(void)file_reset(ms, 0);
|
||||
@ -687,8 +687,8 @@ file_apprentice(struct magic_set *ms, const char *fn, int action)
|
||||
*p++ = '\0';
|
||||
if (*fn == '\0')
|
||||
break;
|
||||
file_err = apprentice_1(ms, fn, action);
|
||||
errs = MAX(errs, file_err);
|
||||
fileerr = apprentice_1(ms, fn, action);
|
||||
errs = MAX(errs, fileerr);
|
||||
fn = p;
|
||||
}
|
||||
|
||||
@ -1910,12 +1910,23 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
}
|
||||
|
||||
/* get offset, then skip over it */
|
||||
m->offset = (uint32_t)strtoul(l, &t, 0);
|
||||
m->offset = (int32_t)strtol(l, &t, 0);
|
||||
if (l == t) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "offset `%s' invalid", l);
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
if (m->offset < 0 && cont_level != 0 &&
|
||||
(m->flag & (OFFADD | INDIROFFADD)) == 0) {
|
||||
if (ms->flags & MAGIC_CHECK) {
|
||||
file_magwarn(ms,
|
||||
"negative direct offset `%s' at level %u",
|
||||
l, cont_level);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
l = t;
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@ -2337,7 +2348,7 @@ parse_ext(struct magic_set *ms, struct magic_entry *me, const char *line)
|
||||
|
||||
return parse_extra(ms, me, line,
|
||||
CAST(off_t, offsetof(struct magic, ext)),
|
||||
sizeof(m->ext), "EXTENSION", ",!+-/@", 0);
|
||||
sizeof(m->ext), "EXTENSION", ",!+-/@?_$", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2351,7 +2362,7 @@ parse_mime(struct magic_set *ms, struct magic_entry *me, const char *line)
|
||||
|
||||
return parse_extra(ms, me, line,
|
||||
CAST(off_t, offsetof(struct magic, mimetype)),
|
||||
sizeof(m->mimetype), "MIME", "+-/.", 1);
|
||||
sizeof(m->mimetype), "MIME", "+-/.$?:{}", 1);
|
||||
}
|
||||
|
||||
private int
|
||||
@ -2608,6 +2619,9 @@ check_format(struct magic_set *ms, struct magic *m)
|
||||
private int
|
||||
getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
||||
{
|
||||
char *ep;
|
||||
uint64_t ull;
|
||||
|
||||
switch (m->type) {
|
||||
case FILE_BESTRING16:
|
||||
case FILE_LESTRING16:
|
||||
@ -2636,79 +2650,78 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
||||
return rc ? -1 : 0;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
if (m->reln == 'x')
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m->type) {
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
if (m->reln != 'x') {
|
||||
char *ep;
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
#ifdef HAVE_STRTOF
|
||||
m->value.f = strtof(*p, &ep);
|
||||
m->value.f = strtof(*p, &ep);
|
||||
#else
|
||||
m->value.f = (float)strtod(*p, &ep);
|
||||
m->value.f = (float)strtod(*p, &ep);
|
||||
#endif
|
||||
if (errno == 0)
|
||||
*p = ep;
|
||||
}
|
||||
if (errno == 0)
|
||||
*p = ep;
|
||||
return 0;
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
if (m->reln != 'x') {
|
||||
char *ep;
|
||||
errno = 0;
|
||||
m->value.d = strtod(*p, &ep);
|
||||
if (errno == 0)
|
||||
*p = ep;
|
||||
}
|
||||
errno = 0;
|
||||
m->value.d = strtod(*p, &ep);
|
||||
if (errno == 0)
|
||||
*p = ep;
|
||||
return 0;
|
||||
default:
|
||||
if (m->reln != 'x') {
|
||||
char *ep;
|
||||
uint64_t ull;
|
||||
errno = 0;
|
||||
ull = (uint64_t)strtoull(*p, &ep, 0);
|
||||
m->value.q = file_signextend(ms, m, ull);
|
||||
if (*p == ep) {
|
||||
file_magwarn(ms, "Unparseable number `%s'", *p);
|
||||
} else {
|
||||
size_t ts = typesize(m->type);
|
||||
uint64_t x;
|
||||
const char *q;
|
||||
errno = 0;
|
||||
ull = (uint64_t)strtoull(*p, &ep, 0);
|
||||
m->value.q = file_signextend(ms, m, ull);
|
||||
if (*p == ep) {
|
||||
file_magwarn(ms, "Unparseable number `%s'", *p);
|
||||
} else {
|
||||
size_t ts = typesize(m->type);
|
||||
uint64_t x;
|
||||
const char *q;
|
||||
|
||||
if (ts == (size_t)~0) {
|
||||
file_magwarn(ms, "Expected numeric type got `%s'",
|
||||
type_tbl[m->type].name);
|
||||
}
|
||||
for (q = *p; isspace((unsigned char)*q); q++)
|
||||
continue;
|
||||
if (*q == '-')
|
||||
ull = -(int64_t)ull;
|
||||
switch (ts) {
|
||||
case 1:
|
||||
x = ull & ~0xffULL;
|
||||
break;
|
||||
case 2:
|
||||
x = ull & ~0xffffULL;
|
||||
break;
|
||||
case 4:
|
||||
x = ull & ~0xffffffffULL;
|
||||
break;
|
||||
case 8:
|
||||
x = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
if (x) {
|
||||
file_magwarn(ms, "Overflow for numeric type `%s' value %#" PRIx64,
|
||||
type_tbl[m->type].name, ull);
|
||||
}
|
||||
if (ts == (size_t)~0) {
|
||||
file_magwarn(ms,
|
||||
"Expected numeric type got `%s'",
|
||||
type_tbl[m->type].name);
|
||||
}
|
||||
if (errno == 0) {
|
||||
*p = ep;
|
||||
eatsize(p);
|
||||
for (q = *p; isspace((unsigned char)*q); q++)
|
||||
continue;
|
||||
if (*q == '-')
|
||||
ull = -(int64_t)ull;
|
||||
switch (ts) {
|
||||
case 1:
|
||||
x = (uint64_t)(ull & ~0xffULL);
|
||||
break;
|
||||
case 2:
|
||||
x = (uint64_t)(ull & ~0xffffULL);
|
||||
break;
|
||||
case 4:
|
||||
x = (uint64_t)(ull & ~0xffffffffULL);
|
||||
break;
|
||||
case 8:
|
||||
x = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
if (x) {
|
||||
file_magwarn(ms, "Overflow for numeric"
|
||||
" type `%s' value %#" PRIx64,
|
||||
type_tbl[m->type].name, ull);
|
||||
}
|
||||
}
|
||||
if (errno == 0) {
|
||||
*p = ep;
|
||||
eatsize(p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -3175,20 +3188,21 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
|
||||
|
||||
if (write(fd, &hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) {
|
||||
file_error(ms, errno, "error writing `%s'", dbname);
|
||||
goto out;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAGIC_SETS; i++) {
|
||||
len = m * map->nmagic[i];
|
||||
if (write(fd, map->magic[i], len) != (ssize_t)len) {
|
||||
file_error(ms, errno, "error writing `%s'", dbname);
|
||||
goto out;
|
||||
goto out2;
|
||||
}
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
out2:
|
||||
if (fd != -1)
|
||||
(void)close(fd);
|
||||
rv = 0;
|
||||
out:
|
||||
apprentice_unmap(map);
|
||||
free(dbname);
|
||||
@ -3321,7 +3335,7 @@ private void
|
||||
bs1(struct magic *m)
|
||||
{
|
||||
m->cont_level = swap2(m->cont_level);
|
||||
m->offset = swap4((uint32_t)m->offset);
|
||||
m->offset = swap4((int32_t)m->offset);
|
||||
m->in_offset = swap4((uint32_t)m->in_offset);
|
||||
m->lineno = swap4((uint32_t)m->lineno);
|
||||
if (IS_STRING(m->type)) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.97 2016/06/27 20:56:25 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.98 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -68,26 +68,27 @@ trim_nuls(const unsigned char *buf, size_t nbytes)
|
||||
}
|
||||
|
||||
protected int
|
||||
file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
int text)
|
||||
file_ascmagic(struct magic_set *ms, const struct buffer *b, int text)
|
||||
{
|
||||
unichar *ubuf = NULL;
|
||||
size_t ulen = 0;
|
||||
int rv = 1;
|
||||
struct buffer bb;
|
||||
|
||||
const char *code = NULL;
|
||||
const char *code_mime = NULL;
|
||||
const char *type = NULL;
|
||||
|
||||
nbytes = trim_nuls(buf, nbytes);
|
||||
bb = *b;
|
||||
bb.flen = trim_nuls(b->fbuf, b->flen);
|
||||
|
||||
/* If file doesn't look like any sort of text, give up. */
|
||||
if (file_encoding(ms, buf, nbytes, &ubuf, &ulen, &code, &code_mime,
|
||||
if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
|
||||
&type) == 0)
|
||||
rv = 0;
|
||||
else
|
||||
rv = file_ascmagic_with_encoding(ms, buf, nbytes, ubuf, ulen, code,
|
||||
type, text);
|
||||
rv = file_ascmagic_with_encoding(ms, &bb,
|
||||
ubuf, ulen, code, type, text);
|
||||
|
||||
free(ubuf);
|
||||
|
||||
@ -95,10 +96,13 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
}
|
||||
|
||||
protected int
|
||||
file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
|
||||
size_t nbytes, unichar *ubuf, size_t ulen, const char *code,
|
||||
file_ascmagic_with_encoding(struct magic_set *ms,
|
||||
const struct buffer *b, unichar *ubuf, size_t ulen, const char *code,
|
||||
const char *type, int text)
|
||||
{
|
||||
struct buffer bb;
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
unsigned char *utf8_buf = NULL, *utf8_end;
|
||||
size_t mlen, i;
|
||||
int rv = -1;
|
||||
@ -140,10 +144,13 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
|
||||
if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
|
||||
== NULL)
|
||||
goto done;
|
||||
if ((rv = file_softmagic(ms, utf8_buf,
|
||||
(size_t)(utf8_end - utf8_buf), NULL, NULL,
|
||||
buffer_init(&bb, b->fd, utf8_buf,
|
||||
(size_t)(utf8_end - utf8_buf));
|
||||
|
||||
if ((rv = file_softmagic(ms, &bb, NULL, NULL,
|
||||
TEXTTEST, text)) == 0)
|
||||
rv = -1;
|
||||
buffer_fini(&bb);
|
||||
if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
|
||||
rv = rv == -1 ? 0 : 1;
|
||||
goto done;
|
||||
|
84
src/buffer.c
Normal file
84
src/buffer.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2017.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: buffer.c,v 1.4 2018/02/21 21:26:00 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
void
|
||||
buffer_init(struct buffer *b, int fd, const void *data, size_t len)
|
||||
{
|
||||
b->fd = fd;
|
||||
if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
|
||||
memset(&b->st, 0, sizeof(b->st));
|
||||
b->fbuf = data;
|
||||
b->flen = len;
|
||||
b->eoff = 0;
|
||||
b->ebuf = NULL;
|
||||
b->elen = 0;
|
||||
}
|
||||
|
||||
void
|
||||
buffer_fini(struct buffer *b)
|
||||
{
|
||||
free(b->ebuf);
|
||||
}
|
||||
|
||||
int
|
||||
buffer_fill(const struct buffer *bb)
|
||||
{
|
||||
struct buffer *b = CCAST(struct buffer *, bb);
|
||||
|
||||
if (b->elen != 0)
|
||||
return b->elen == (size_t)~0 ? -1 : 0;
|
||||
|
||||
if (!S_ISREG(b->st.st_mode))
|
||||
goto out;
|
||||
|
||||
b->elen = (size_t)b->st.st_size < b->flen ?
|
||||
(size_t)b->st.st_size : b->flen;
|
||||
if ((b->ebuf = malloc(b->elen)) == NULL)
|
||||
goto out;
|
||||
|
||||
b->eoff = b->st.st_size - b->elen;
|
||||
if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
|
||||
free(b->ebuf);
|
||||
goto out;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
b->elen = (size_t)~0;
|
||||
return -1;
|
||||
}
|
23
src/cdf.c
23
src/cdf.c
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.106 2017/04/30 17:05:02 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.110 2017/12/19 00:21:21 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@ -85,6 +85,7 @@ static union {
|
||||
#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void *
|
||||
cdf_malloc(const char *file __attribute__((__unused__)),
|
||||
size_t line __attribute__((__unused__)), size_t n)
|
||||
@ -93,6 +94,7 @@ cdf_malloc(const char *file __attribute__((__unused__)),
|
||||
return malloc(n);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void *
|
||||
cdf_realloc(const char *file __attribute__((__unused__)),
|
||||
size_t line __attribute__((__unused__)), void *p, size_t n)
|
||||
@ -101,6 +103,7 @@ cdf_realloc(const char *file __attribute__((__unused__)),
|
||||
return realloc(p, n);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void *
|
||||
cdf_calloc(const char *file __attribute__((__unused__)),
|
||||
size_t line __attribute__((__unused__)), size_t n, size_t u)
|
||||
@ -436,7 +439,7 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
|
||||
if (h->h_master_sat[i] == CDF_SECID_FREE)
|
||||
break;
|
||||
|
||||
#define CDF_SEC_LIMIT (UINT32_MAX / (8 * ss))
|
||||
#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
|
||||
if ((nsatpersec > 0 &&
|
||||
h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
|
||||
i > CDF_SEC_LIMIT) {
|
||||
@ -846,8 +849,8 @@ cdf_find_stream(const cdf_dir_t *dir, const char *name, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CDF_SHLEN_LIMIT (UINT32_MAX / 8)
|
||||
#define CDF_PROP_LIMIT (UINT32_MAX / (8 * sizeof(cdf_property_info_t)))
|
||||
#define CDF_SHLEN_LIMIT (UINT32_MAX / 64)
|
||||
#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
|
||||
|
||||
static const void *
|
||||
cdf_offset(const void *p, size_t l)
|
||||
@ -1570,32 +1573,32 @@ main(int argc, char *argv[])
|
||||
info.i_len = 0;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if ((info.i_fd = open(argv[1], O_RDONLY)) == -1)
|
||||
err(1, "Cannot open `%s'", argv[1]);
|
||||
err(EXIT_FAILURE, "Cannot open `%s'", argv[1]);
|
||||
|
||||
if (cdf_read_header(&info, &h) == -1)
|
||||
err(1, "Cannot read header");
|
||||
err(EXIT_FAILURE, "Cannot read header");
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_header(&h);
|
||||
#endif
|
||||
|
||||
if (cdf_read_sat(&info, &h, &sat) == -1)
|
||||
err(1, "Cannot read sat");
|
||||
err(EXIT_FAILURE, "Cannot read sat");
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
|
||||
#endif
|
||||
|
||||
if (cdf_read_ssat(&info, &h, &sat, &ssat) == -1)
|
||||
err(1, "Cannot read ssat");
|
||||
err(EXIT_FAILURE, "Cannot read ssat");
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
|
||||
#endif
|
||||
|
||||
if (cdf_read_dir(&info, &h, &sat, &dir) == -1)
|
||||
err(1, "Cannot read dir");
|
||||
err(EXIT_FAILURE, "Cannot read dir");
|
||||
|
||||
if (cdf_read_short_stream(&info, &h, &sat, &dir, &sst, &root)
|
||||
== -1)
|
||||
err(1, "Cannot read short stream");
|
||||
err(EXIT_FAILURE, "Cannot read short stream");
|
||||
#ifdef CDF_DEBUG
|
||||
cdf_dump_stream(&sst);
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.105 2017/05/25 00:13:03 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.106 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@ -184,8 +184,7 @@ static int makeerror(unsigned char **, size_t *, const char *, ...)
|
||||
private const char *methodname(size_t);
|
||||
|
||||
protected int
|
||||
file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||
const unsigned char *buf, size_t nbytes)
|
||||
file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
|
||||
{
|
||||
unsigned char *newbuf = NULL;
|
||||
size_t i, nsz;
|
||||
@ -193,6 +192,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||
file_pushbuf_t *pb;
|
||||
int urv, prv, rv = 0;
|
||||
int mime = ms->flags & MAGIC_MIME;
|
||||
int fd = b->fd;
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
sig_t osigpipe;
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.13 2015/06/04 19:16:28 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.14 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -66,11 +66,21 @@ private void from_ebcdic(const unsigned char *, size_t, unsigned char *);
|
||||
* ubuf, and the number of characters converted in ulen.
|
||||
*/
|
||||
protected int
|
||||
file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, unichar **ubuf, size_t *ulen, const char **code, const char **code_mime, const char **type)
|
||||
file_encoding(struct magic_set *ms, const struct buffer *b, unichar **ubuf,
|
||||
size_t *ulen, const char **code, const char **code_mime, const char **type)
|
||||
{
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
size_t mlen;
|
||||
int rv = 1, ucs_type;
|
||||
unsigned char *nbuf = NULL;
|
||||
unichar *udefbuf;
|
||||
size_t udeflen;
|
||||
|
||||
if (ubuf == NULL)
|
||||
ubuf = &udefbuf;
|
||||
if (ulen == NULL)
|
||||
ulen = &udeflen;
|
||||
|
||||
*type = "text";
|
||||
*ulen = 0;
|
||||
@ -144,6 +154,8 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
|
||||
|
||||
done:
|
||||
free(nbuf);
|
||||
if (ubuf == &udefbuf)
|
||||
free(udefbuf);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
176
src/file.c
176
src/file.c
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.172 2016/10/24 15:21:07 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.175 2018/03/02 16:11:37 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -59,26 +59,38 @@ FILE_RCSID("@(#)$File: file.c,v 1.172 2016/10/24 15:21:07 christos Exp $")
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETOPT_H) && defined(HAVE_STRUCT_OPTION)
|
||||
#include <getopt.h>
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
int getopt_long(int argc, char * const *argv, const char *optstring, const struct option *longopts, int *longindex);
|
||||
#endif
|
||||
#else
|
||||
#include "mygetopt.h"
|
||||
# include <getopt.h>
|
||||
# ifndef HAVE_GETOPT_LONG
|
||||
int getopt_long(int, char * const *, const char *,
|
||||
const struct option *, int *);
|
||||
# endif
|
||||
# else
|
||||
# include "mygetopt.h"
|
||||
#endif
|
||||
|
||||
#ifdef S_IFLNK
|
||||
#define FILE_FLAGS "-bcEhikLlNnprsvzZ0"
|
||||
# define IFLNK_h "h"
|
||||
# define IFLNK_L "L"
|
||||
#else
|
||||
#define FILE_FLAGS "-bcEiklNnprsvzZ0"
|
||||
# define IFLNK_h ""
|
||||
# define IFLNK_L ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
# define SECCOMP_S "S"
|
||||
#else
|
||||
# define SECCOMP_S ""
|
||||
#endif
|
||||
|
||||
#define FILE_FLAGS "bcCdE" IFLNK_h "ik" IFLNK_L "lNnprs" SECCOMP_S "vzZ0"
|
||||
#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsSvzZ0"
|
||||
|
||||
# define USAGE \
|
||||
"Usage: %s [" FILE_FLAGS \
|
||||
"] [--apple] [--extension] [--mime-encoding] [--mime-type]\n" \
|
||||
" [-e testname] [-F separator] [-f namefile] [-m magicfiles] " \
|
||||
"file ...\n" \
|
||||
" %s -C [-m magicfiles]\n" \
|
||||
"Usage: %s [-" FILE_FLAGS "] [--apple] [--extension] [--mime-encoding]\n" \
|
||||
" [--mime-type] [-e <testname>] [-F <separator>] " \
|
||||
" [-f <namefile>]\n" \
|
||||
" [-m <magicfiles>] [-P <parameter=value>] <file> ...\n" \
|
||||
" %s -C [-m <magicfiles>]\n" \
|
||||
" %s [--help]\n"
|
||||
|
||||
private int /* Global command-line options */
|
||||
@ -102,8 +114,7 @@ private const struct option long_options[] = {
|
||||
#undef OPT
|
||||
#undef OPT_LONGONLY
|
||||
{0, 0, NULL, 0}
|
||||
};
|
||||
#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvzZ0"
|
||||
};
|
||||
|
||||
private const struct {
|
||||
const char *name;
|
||||
@ -135,7 +146,6 @@ private struct {
|
||||
{ "bytes", MAGIC_PARAM_BYTES_MAX, 0 },
|
||||
};
|
||||
|
||||
private char *progname; /* used throughout */
|
||||
private int posixly;
|
||||
|
||||
#ifdef __dead
|
||||
@ -165,9 +175,13 @@ main(int argc, char *argv[])
|
||||
size_t i;
|
||||
int action = 0, didsomefiles = 0, errflg = 0;
|
||||
int flags = 0, e = 0;
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
int sandbox = 1;
|
||||
#endif
|
||||
struct magic_set *magic = NULL;
|
||||
int longindex;
|
||||
const char *magicfile = NULL; /* where the magic is */
|
||||
char *progname;
|
||||
|
||||
/* makes islower etc work for other langs */
|
||||
#ifdef HAVE_SETLOCALE
|
||||
@ -184,6 +198,9 @@ main(int argc, char *argv[])
|
||||
else
|
||||
progname = argv[0];
|
||||
|
||||
file_setprogname(progname);
|
||||
|
||||
|
||||
#ifdef S_IFLNK
|
||||
posixly = getenv("POSIXLY_CORRECT") != NULL;
|
||||
flags |= posixly ? MAGIC_SYMLINK : 0;
|
||||
@ -280,12 +297,18 @@ main(int argc, char *argv[])
|
||||
case 's':
|
||||
flags |= MAGIC_DEVICES;
|
||||
break;
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
case 'S':
|
||||
sandbox = 0;
|
||||
break;
|
||||
#endif
|
||||
case 'v':
|
||||
if (magicfile == NULL)
|
||||
magicfile = magic_getpath(magicfile, action);
|
||||
(void)fprintf(stdout, "%s-%s\n", progname, VERSION);
|
||||
(void)fprintf(stdout, "%s-%s\n", file_getprogname(),
|
||||
VERSION);
|
||||
(void)fprintf(stdout, "magic file from %s\n",
|
||||
magicfile);
|
||||
magicfile);
|
||||
return 0;
|
||||
case 'z':
|
||||
flags |= MAGIC_COMPRESS;
|
||||
@ -314,10 +337,19 @@ main(int argc, char *argv[])
|
||||
if (e)
|
||||
return e;
|
||||
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
#if 0
|
||||
if (sandbox && enable_sandbox_basic() == -1)
|
||||
#else
|
||||
if (sandbox && enable_sandbox_full() == -1)
|
||||
#endif
|
||||
file_err(EXIT_FAILURE, "SECCOMP initialisation failed");
|
||||
#endif /* HAVE_LIBSECCOMP */
|
||||
|
||||
if (MAGIC_VERSION != magic_version())
|
||||
(void)fprintf(stderr, "%s: compiled magic version [%d] "
|
||||
file_warnx("Compiled magic version [%d] "
|
||||
"does not match with shared library magic version [%d]\n",
|
||||
progname, MAGIC_VERSION, magic_version());
|
||||
MAGIC_VERSION, magic_version());
|
||||
|
||||
switch(action) {
|
||||
case FILE_CHECK:
|
||||
@ -329,8 +361,7 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
magic = magic_open(flags|MAGIC_CHECK);
|
||||
if (magic == NULL) {
|
||||
(void)fprintf(stderr, "%s: %s\n", progname,
|
||||
strerror(errno));
|
||||
file_warn("Can't create magic");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -349,8 +380,7 @@ main(int argc, char *argv[])
|
||||
abort();
|
||||
}
|
||||
if (c == -1) {
|
||||
(void)fprintf(stderr, "%s: %s\n", progname,
|
||||
magic_error(magic));
|
||||
file_warnx("%s", magic_error(magic));
|
||||
e = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -398,11 +428,8 @@ applyparam(magic_t magic)
|
||||
for (i = 0; i < __arraycount(pm); i++) {
|
||||
if (pm[i].value == 0)
|
||||
continue;
|
||||
if (magic_setparam(magic, pm[i].tag, &pm[i].value) == -1) {
|
||||
(void)fprintf(stderr, "%s: Can't set %s %s\n", progname,
|
||||
pm[i].name, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (magic_setparam(magic, pm[i].tag, &pm[i].value) == -1)
|
||||
file_err(EXIT_FAILURE, "Can't set %s", pm[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,8 +449,7 @@ setparam(const char *p)
|
||||
return;
|
||||
}
|
||||
badparm:
|
||||
(void)fprintf(stderr, "%s: Unknown param %s\n", progname, p);
|
||||
exit(1);
|
||||
file_errx(EXIT_FAILURE, "Unknown param %s", p);
|
||||
}
|
||||
|
||||
private struct magic_set *
|
||||
@ -434,17 +460,16 @@ load(const char *magicfile, int flags)
|
||||
const char *e;
|
||||
|
||||
if (magic == NULL) {
|
||||
(void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
|
||||
file_warn("Can't create magic");
|
||||
return NULL;
|
||||
}
|
||||
if (magic_load(magic, magicfile) == -1) {
|
||||
(void)fprintf(stderr, "%s: %s\n",
|
||||
progname, magic_error(magic));
|
||||
file_warn("%s", magic_error(magic));
|
||||
magic_close(magic);
|
||||
return NULL;
|
||||
}
|
||||
if ((e = magic_error(magic)) != NULL)
|
||||
(void)fprintf(stderr, "%s: Warning: %s\n", progname, e);
|
||||
file_warn("%s", e);
|
||||
return magic;
|
||||
}
|
||||
|
||||
@ -466,8 +491,7 @@ unwrap(struct magic_set *ms, const char *fn)
|
||||
wid = 1;
|
||||
} else {
|
||||
if ((f = fopen(fn, "r")) == NULL) {
|
||||
(void)fprintf(stderr, "%s: Cannot open `%s' (%s).\n",
|
||||
progname, fn, strerror(errno));
|
||||
file_warn("Cannot open `%s'", fn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -567,8 +591,9 @@ file_mbswidth(const char *s)
|
||||
private void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, USAGE, progname, progname, progname);
|
||||
exit(1);
|
||||
const char *pn = file_getprogname();
|
||||
(void)fprintf(stderr, USAGE, pn, pn, pn);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
private void
|
||||
@ -629,5 +654,74 @@ help(void)
|
||||
#undef OPT
|
||||
#undef OPT_LONGONLY
|
||||
fprintf(stdout, "\nReport bugs to http://bugs.gw.com/\n");
|
||||
exit(0);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
private const char *file_progname;
|
||||
|
||||
protected void
|
||||
file_setprogname(const char *progname)
|
||||
{
|
||||
file_progname = progname;
|
||||
}
|
||||
|
||||
protected const char *
|
||||
file_getprogname(void)
|
||||
{
|
||||
return file_progname;
|
||||
}
|
||||
|
||||
protected void
|
||||
file_err(int e, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int se = errno;
|
||||
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", file_progname);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, " (%s)\n", strerror(se));
|
||||
exit(e);
|
||||
}
|
||||
|
||||
protected void
|
||||
file_errx(int e, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", file_progname);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
exit(e);
|
||||
}
|
||||
|
||||
protected void
|
||||
file_warn(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int se = errno;
|
||||
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", file_progname);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, " (%s)\n", strerror(se));
|
||||
errno = se;
|
||||
}
|
||||
|
||||
protected void
|
||||
file_warnx(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int se = errno;
|
||||
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "%s: ", file_progname);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
errno = se;
|
||||
}
|
||||
|
66
src/file.h
66
src/file.h
@ -27,7 +27,7 @@
|
||||
*/
|
||||
/*
|
||||
* file.h - definitions for file(1) program
|
||||
* @(#)$File: file.h,v 1.183 2017/08/28 13:39:18 christos Exp $
|
||||
* @(#)$File: file.h,v 1.191 2018/02/21 21:26:00 christos Exp $
|
||||
*/
|
||||
|
||||
#ifndef __file_h__
|
||||
@ -145,6 +145,16 @@
|
||||
#define FILE_COMPILE 2
|
||||
#define FILE_LIST 3
|
||||
|
||||
struct buffer {
|
||||
int fd;
|
||||
struct stat st;
|
||||
const void *fbuf;
|
||||
size_t flen;
|
||||
off_t eoff;
|
||||
void *ebuf;
|
||||
size_t elen;
|
||||
};
|
||||
|
||||
union VALUETYPE {
|
||||
uint8_t b;
|
||||
uint16_t h;
|
||||
@ -287,7 +297,7 @@ struct magic {
|
||||
#endif /* ENABLE_CONDITIONALS */
|
||||
|
||||
/* Word 4 */
|
||||
uint32_t offset; /* offset to magic number */
|
||||
int32_t offset; /* offset to magic number */
|
||||
/* Word 5 */
|
||||
int32_t in_offset; /* offset from indirection */
|
||||
/* Word 6 */
|
||||
@ -394,7 +404,9 @@ struct magic_set {
|
||||
char *buf; /* Accumulation buffer */
|
||||
char *pbuf; /* Printable buffer */
|
||||
} o;
|
||||
uint32_t offset;
|
||||
uint32_t offset; /* a copy of m->offset while we */
|
||||
/* are working on the magic entry */
|
||||
uint32_t eoffset; /* offset from end of file */
|
||||
int error;
|
||||
int flags; /* Control magic tests. */
|
||||
int event_flags; /* Note things that happened. */
|
||||
@ -448,23 +460,20 @@ protected int file_replace(struct magic_set *, const char *, const char *);
|
||||
protected int file_printf(struct magic_set *, const char *, ...)
|
||||
__attribute__((__format__(__printf__, 2, 3)));
|
||||
protected int file_reset(struct magic_set *, int);
|
||||
protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
protected int file_trycdf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
protected int file_tryelf(struct magic_set *, const struct buffer *);
|
||||
protected int file_trycdf(struct magic_set *, const struct buffer *);
|
||||
#if HAVE_FORK
|
||||
protected int file_zmagic(struct magic_set *, int, const char *,
|
||||
const unsigned char *, size_t);
|
||||
protected int file_zmagic(struct magic_set *, const struct buffer *,
|
||||
const char *);
|
||||
#endif
|
||||
protected int file_ascmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
protected int file_ascmagic(struct magic_set *, const struct buffer *,
|
||||
int);
|
||||
protected int file_ascmagic_with_encoding(struct magic_set *,
|
||||
const unsigned char *, size_t, unichar *, size_t, const char *,
|
||||
const char *, int);
|
||||
protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
|
||||
const struct buffer *, unichar *, size_t, const char *, const char *, int);
|
||||
protected int file_encoding(struct magic_set *, const struct buffer *,
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
protected int file_is_tar(struct magic_set *, const struct buffer *);
|
||||
protected int file_softmagic(struct magic_set *, const struct buffer *,
|
||||
uint16_t *, uint16_t *, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int buffer_apprentice(struct magic_set *, struct magic **,
|
||||
@ -497,6 +506,10 @@ protected int file_os2_apptype(struct magic_set *, const char *, const void *,
|
||||
size_t);
|
||||
#endif /* __EMX__ */
|
||||
|
||||
protected void buffer_init(struct buffer *, int, const void *, size_t);
|
||||
protected void buffer_fini(struct buffer *);
|
||||
protected int buffer_fill(const struct buffer *);
|
||||
|
||||
#if defined(HAVE_LOCALE_H)
|
||||
#include <locale.h>
|
||||
#endif
|
||||
@ -590,6 +603,29 @@ const char *fmtcheck(const char *, const char *)
|
||||
__attribute__((__format_arg__(2)));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
// basic filter
|
||||
// this mode should not interfere with normal operations
|
||||
// only some dangerous syscalls are blacklisted
|
||||
int enable_sandbox_basic(void);
|
||||
|
||||
// enhanced filter
|
||||
// this mode allows only the necessary syscalls used during normal operation
|
||||
// extensive testing required !!!
|
||||
int enable_sandbox_full(void);
|
||||
#endif
|
||||
|
||||
protected const char *file_getprogname(void);
|
||||
protected void file_setprogname(const char *);
|
||||
protected void file_err(int, const char *, ...)
|
||||
__attribute__((__format__(__printf__, 2, 3)));
|
||||
protected void file_errx(int, const char *, ...)
|
||||
__attribute__((__format__(__printf__, 2, 3)));
|
||||
protected void file_warn(const char *, ...)
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
protected void file_warnx(const char *, ...)
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
#endif
|
||||
|
@ -54,5 +54,8 @@ OPT('P', "parameter", 1, 0, " set file engine parameter limits\n"
|
||||
OPT('r', "raw", 0, 0, " don't translate unprintable chars to \\ooo\n")
|
||||
OPT('s', "special-files", 0, 0, " treat special (block/char devices) files as\n"
|
||||
" ordinary ones\n")
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
OPT('S', "no-sandbox", 0, 0, " disable system call sandboxing\n")
|
||||
#endif
|
||||
OPT('C', "compile", 0, 0, " compile file specified by -m\n")
|
||||
OPT('d', "debug", 0, 0, " print debugging messages\n")
|
||||
|
27
src/funcs.c
27
src/funcs.c
@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.93 2017/08/28 13:39:18 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.94 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -178,14 +178,14 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
const void *buf, size_t nb)
|
||||
{
|
||||
int m = 0, rv = 0, looks_text = 0;
|
||||
const unsigned char *ubuf = CAST(const unsigned char *, buf);
|
||||
unichar *u8buf = NULL;
|
||||
size_t ulen;
|
||||
const char *code = NULL;
|
||||
const char *code_mime = "binary";
|
||||
const char *type = "application/octet-stream";
|
||||
const char *def = "data";
|
||||
const char *ftype = NULL;
|
||||
struct buffer b;
|
||||
|
||||
buffer_init(&b, fd, buf, nb);
|
||||
|
||||
if (nb == 0) {
|
||||
def = "empty";
|
||||
@ -197,13 +197,13 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
}
|
||||
|
||||
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
|
||||
looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
|
||||
looks_text = file_encoding(ms, &b, NULL, 0,
|
||||
&code, &code_mime, &ftype);
|
||||
}
|
||||
|
||||
#ifdef __EMX__
|
||||
if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
|
||||
m = file_os2_apptype(ms, inname, buf, nb);
|
||||
m = file_os2_apptype(ms, inname, &b);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
|
||||
switch (m) {
|
||||
@ -219,7 +219,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
#if HAVE_FORK
|
||||
/* try compression stuff */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
|
||||
m = file_zmagic(ms, fd, inname, ubuf, nb);
|
||||
m = file_zmagic(ms, &b, inname);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try zmagic %d]\n", m);
|
||||
if (m) {
|
||||
@ -229,7 +229,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
#endif
|
||||
/* Check if we have a tar file */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
|
||||
m = file_is_tar(ms, ubuf, nb);
|
||||
m = file_is_tar(ms, &b);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try tar %d]\n", m);
|
||||
if (m) {
|
||||
@ -240,7 +240,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
|
||||
/* Check if we have a CDF file */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
|
||||
m = file_trycdf(ms, fd, ubuf, nb);
|
||||
m = file_trycdf(ms, &b);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try cdf %d]\n", m);
|
||||
if (m) {
|
||||
@ -251,8 +251,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
|
||||
/* try soft magic tests */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
|
||||
m = file_softmagic(ms, ubuf, nb, NULL, NULL, BINTEST,
|
||||
looks_text);
|
||||
m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try softmagic %d]\n", m);
|
||||
if (m) {
|
||||
@ -268,7 +267,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
* ELF headers that cannot easily * be
|
||||
* extracted with rules in the magic file.
|
||||
*/
|
||||
m = file_tryelf(ms, fd, ubuf, nb);
|
||||
m = file_tryelf(ms, &b);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try elf %d]\n",
|
||||
m);
|
||||
@ -282,7 +281,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
/* try text properties */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
|
||||
|
||||
m = file_ascmagic(ms, ubuf, nb, looks_text);
|
||||
m = file_ascmagic(ms, &b, looks_text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "[try ascmagic %d]\n", m);
|
||||
if (m) {
|
||||
@ -319,7 +318,7 @@ simple:
|
||||
#if HAVE_FORK
|
||||
done_encoding:
|
||||
#endif
|
||||
free(u8buf);
|
||||
buffer_fini(&b);
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
|
12
src/is_tar.c
12
src/is_tar.c
@ -40,7 +40,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.39 2017/03/17 20:45:01 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.41 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@ -53,15 +53,17 @@ FILE_RCSID("@(#)$File: is_tar.c,v 1.39 2017/03/17 20:45:01 christos Exp $")
|
||||
private int is_tar(const unsigned char *, size_t);
|
||||
private int from_oct(const char *, size_t); /* Decode octal number */
|
||||
|
||||
static const char tartype[][32] = {
|
||||
"tar archive",
|
||||
static const char tartype[][32] = { /* should be equal to messages */
|
||||
"tar archive", /* found in ../magic/Magdir/archive */
|
||||
"POSIX tar archive",
|
||||
"POSIX tar archive (GNU)",
|
||||
"POSIX tar archive (GNU)", /* */
|
||||
};
|
||||
|
||||
protected int
|
||||
file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
|
||||
file_is_tar(struct magic_set *ms, const struct buffer *b)
|
||||
{
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
/*
|
||||
* Do the tar test first, because if the first file in the tar
|
||||
* archive starts with a dot, we can confuse it with an nroff file.
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.65 2017/04/08 20:58:03 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.66 2017/11/02 20:25:39 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@ -537,9 +537,11 @@ cdf_file_dir_info(struct magic_set *ms, const cdf_dir_t *dir)
|
||||
}
|
||||
|
||||
protected int
|
||||
file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
size_t nbytes)
|
||||
file_trycdf(struct magic_set *ms, const struct buffer *b)
|
||||
{
|
||||
int fd = b->fd;
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
cdf_info_t info;
|
||||
cdf_header_t h;
|
||||
cdf_sat_t sat, ssat;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.138 2017/08/27 07:55:02 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.141 2018/04/12 16:50:52 christos Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef BUILTIN_ELF
|
||||
@ -310,18 +310,19 @@ private const char os_style_names[][8] = {
|
||||
"NetBSD",
|
||||
};
|
||||
|
||||
#define FLAGS_CORE_STYLE 0x003
|
||||
#define FLAGS_CORE_STYLE 0x0003
|
||||
|
||||
#define FLAGS_DID_CORE 0x004
|
||||
#define FLAGS_DID_OS_NOTE 0x008
|
||||
#define FLAGS_DID_BUILD_ID 0x010
|
||||
#define FLAGS_DID_CORE_STYLE 0x020
|
||||
#define FLAGS_DID_NETBSD_PAX 0x040
|
||||
#define FLAGS_DID_NETBSD_MARCH 0x080
|
||||
#define FLAGS_DID_NETBSD_CMODEL 0x100
|
||||
#define FLAGS_DID_NETBSD_UNKNOWN 0x200
|
||||
#define FLAGS_IS_CORE 0x400
|
||||
#define FLAGS_DID_AUXV 0x800
|
||||
#define FLAGS_DID_CORE 0x0004
|
||||
#define FLAGS_DID_OS_NOTE 0x0008
|
||||
#define FLAGS_DID_BUILD_ID 0x0010
|
||||
#define FLAGS_DID_CORE_STYLE 0x0020
|
||||
#define FLAGS_DID_NETBSD_PAX 0x0040
|
||||
#define FLAGS_DID_NETBSD_MARCH 0x0080
|
||||
#define FLAGS_DID_NETBSD_CMODEL 0x0100
|
||||
#define FLAGS_DID_NETBSD_EMULATION 0x0200
|
||||
#define FLAGS_DID_NETBSD_UNKNOWN 0x0400
|
||||
#define FLAGS_IS_CORE 0x0800
|
||||
#define FLAGS_DID_AUXV 0x1000
|
||||
|
||||
private int
|
||||
dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
||||
@ -726,11 +727,11 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",
|
||||
file_printable(sbuf, sizeof(sbuf),
|
||||
CAST(char *, pi.cpi_name)),
|
||||
elf_getu32(swap, pi.cpi_pid),
|
||||
elf_getu32(swap, (uint32_t)pi.cpi_pid),
|
||||
elf_getu32(swap, pi.cpi_euid),
|
||||
elf_getu32(swap, pi.cpi_egid),
|
||||
elf_getu32(swap, pi.cpi_nlwps),
|
||||
elf_getu32(swap, pi.cpi_siglwp),
|
||||
elf_getu32(swap, (uint32_t)pi.cpi_siglwp),
|
||||
elf_getu32(swap, pi.cpi_signo),
|
||||
elf_getu32(swap, pi.cpi_sigcode)) == -1)
|
||||
return 1;
|
||||
@ -908,6 +909,7 @@ get_string_on_virtaddr(struct magic_set *ms,
|
||||
}
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
private int
|
||||
do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
int swap, uint32_t namesz __attribute__((__unused__)),
|
||||
@ -1134,6 +1136,14 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
|
||||
(int)descsz, (const char *)&nbuf[doff]) == -1)
|
||||
return offset;
|
||||
break;
|
||||
case NT_NETBSD_EMULATION:
|
||||
if (*flags & FLAGS_DID_NETBSD_EMULATION)
|
||||
return offset;
|
||||
*flags |= FLAGS_DID_NETBSD_EMULATION;
|
||||
if (file_printf(ms, ", emulation: %.*s",
|
||||
(int)descsz, (const char *)&nbuf[doff]) == -1)
|
||||
return offset;
|
||||
break;
|
||||
default:
|
||||
if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
|
||||
return offset;
|
||||
@ -1570,9 +1580,11 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
||||
|
||||
|
||||
protected int
|
||||
file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
|
||||
size_t nbytes)
|
||||
file_tryelf(struct magic_set *ms, const struct buffer *b)
|
||||
{
|
||||
int fd = b->fd;
|
||||
const unsigned char *buf = b->fbuf;
|
||||
size_t nbytes = b->flen;
|
||||
union {
|
||||
int32_t l;
|
||||
char c[sizeof (int32_t)];
|
||||
|
246
src/seccomp.c
Normal file
246
src/seccomp.c
Normal file
@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* libseccomp hooks.
|
||||
*/
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: seccomp.c,v 1.2 2017/11/04 01:14:25 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#if HAVE_LIBSECCOMP
|
||||
#include <seccomp.h> /* libseccomp */
|
||||
#include <sys/prctl.h> /* prctl */
|
||||
#include <sys/socket.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define DENY_RULE(call) \
|
||||
do \
|
||||
if (seccomp_rule_add (ctx, SCMP_ACT_KILL, SCMP_SYS(call), 0) == -1) \
|
||||
goto out; \
|
||||
while (/*CONSTCOND*/0)
|
||||
#define ALLOW_RULE(call) \
|
||||
do \
|
||||
if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(call), 0) == -1) \
|
||||
goto out; \
|
||||
while (/*CONSTCOND*/0)
|
||||
|
||||
static scmp_filter_ctx ctx;
|
||||
|
||||
|
||||
int
|
||||
enable_sandbox_basic(void)
|
||||
{
|
||||
|
||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
|
||||
return -1;
|
||||
|
||||
#if 0
|
||||
// prevent escape via ptrace
|
||||
prctl(PR_SET_DUMPABLE, 0);
|
||||
#endif
|
||||
|
||||
if (prctl (PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
|
||||
return -1;
|
||||
|
||||
// initialize the filter
|
||||
ctx = seccomp_init(SCMP_ACT_ALLOW);
|
||||
if (ctx == NULL)
|
||||
return 1;
|
||||
|
||||
DENY_RULE(_sysctl);
|
||||
DENY_RULE(acct);
|
||||
DENY_RULE(add_key);
|
||||
DENY_RULE(adjtimex);
|
||||
DENY_RULE(chroot);
|
||||
DENY_RULE(clock_adjtime);
|
||||
DENY_RULE(create_module);
|
||||
DENY_RULE(delete_module);
|
||||
DENY_RULE(fanotify_init);
|
||||
DENY_RULE(finit_module);
|
||||
DENY_RULE(get_kernel_syms);
|
||||
DENY_RULE(get_mempolicy);
|
||||
DENY_RULE(init_module);
|
||||
DENY_RULE(io_cancel);
|
||||
DENY_RULE(io_destroy);
|
||||
DENY_RULE(io_getevents);
|
||||
DENY_RULE(io_setup);
|
||||
DENY_RULE(io_submit);
|
||||
DENY_RULE(ioperm);
|
||||
DENY_RULE(iopl);
|
||||
DENY_RULE(ioprio_set);
|
||||
DENY_RULE(kcmp);
|
||||
#ifdef __NR_kexec_file_load
|
||||
DENY_RULE(kexec_file_load);
|
||||
#endif
|
||||
DENY_RULE(kexec_load);
|
||||
DENY_RULE(keyctl);
|
||||
DENY_RULE(lookup_dcookie);
|
||||
DENY_RULE(mbind);
|
||||
DENY_RULE(nfsservctl);
|
||||
DENY_RULE(migrate_pages);
|
||||
DENY_RULE(modify_ldt);
|
||||
DENY_RULE(mount);
|
||||
DENY_RULE(move_pages);
|
||||
DENY_RULE(name_to_handle_at);
|
||||
DENY_RULE(open_by_handle_at);
|
||||
DENY_RULE(perf_event_open);
|
||||
DENY_RULE(pivot_root);
|
||||
DENY_RULE(process_vm_readv);
|
||||
DENY_RULE(process_vm_writev);
|
||||
DENY_RULE(ptrace);
|
||||
DENY_RULE(reboot);
|
||||
DENY_RULE(remap_file_pages);
|
||||
DENY_RULE(request_key);
|
||||
DENY_RULE(set_mempolicy);
|
||||
DENY_RULE(swapoff);
|
||||
DENY_RULE(swapon);
|
||||
DENY_RULE(sysfs);
|
||||
DENY_RULE(syslog);
|
||||
DENY_RULE(tuxcall);
|
||||
DENY_RULE(umount2);
|
||||
DENY_RULE(uselib);
|
||||
DENY_RULE(vmsplice);
|
||||
|
||||
// blocking dangerous syscalls that file should not need
|
||||
DENY_RULE (execve);
|
||||
DENY_RULE (socket);
|
||||
// ...
|
||||
|
||||
|
||||
// applying filter...
|
||||
if (seccomp_load (ctx) == -1)
|
||||
goto out;
|
||||
// free ctx after the filter has been loaded into the kernel
|
||||
seccomp_release(ctx);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
seccomp_release(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
enable_sandbox_full(void)
|
||||
{
|
||||
|
||||
// prevent child processes from getting more priv e.g. via setuid,
|
||||
// capabilities, ...
|
||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
|
||||
return -1;
|
||||
|
||||
if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
|
||||
return -1;
|
||||
|
||||
// initialize the filter
|
||||
ctx = seccomp_init(SCMP_ACT_KILL);
|
||||
if (ctx == NULL)
|
||||
return -1;
|
||||
|
||||
ALLOW_RULE(access);
|
||||
ALLOW_RULE(brk);
|
||||
ALLOW_RULE(close);
|
||||
ALLOW_RULE(dup2);
|
||||
ALLOW_RULE(exit);
|
||||
ALLOW_RULE(exit_group);
|
||||
ALLOW_RULE(fcntl);
|
||||
ALLOW_RULE(fstat);
|
||||
ALLOW_RULE(getdents);
|
||||
ALLOW_RULE(ioctl);
|
||||
ALLOW_RULE(lseek);
|
||||
ALLOW_RULE(lstat);
|
||||
ALLOW_RULE(mmap);
|
||||
ALLOW_RULE(mprotect);
|
||||
ALLOW_RULE(mremap);
|
||||
ALLOW_RULE(munmap);
|
||||
ALLOW_RULE(open);
|
||||
ALLOW_RULE(openat);
|
||||
ALLOW_RULE(pread64);
|
||||
ALLOW_RULE(read);
|
||||
ALLOW_RULE(readlink);
|
||||
ALLOW_RULE(rt_sigaction);
|
||||
ALLOW_RULE(rt_sigprocmask);
|
||||
ALLOW_RULE(rt_sigreturn);
|
||||
ALLOW_RULE(select);
|
||||
ALLOW_RULE(stat);
|
||||
ALLOW_RULE(sysinfo);
|
||||
ALLOW_RULE(unlink);
|
||||
ALLOW_RULE(write);
|
||||
|
||||
|
||||
#if 0
|
||||
// needed by valgrind
|
||||
ALLOW_RULE(gettid);
|
||||
ALLOW_RULE(getpid);
|
||||
ALLOW_RULE(rt_sigtimedwait);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* special restrictions for socket, only allow AF_UNIX/AF_LOCAL */
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socket), 1,
|
||||
SCMP_CMP(0, SCMP_CMP_EQ, AF_UNIX)) == -1)
|
||||
goto out;
|
||||
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socket), 1,
|
||||
SCMP_CMP(0, SCMP_CMP_EQ, AF_LOCAL)) == -1)
|
||||
goto out;
|
||||
|
||||
|
||||
/* special restrictions for open, prevent opening files for writing */
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) == -1)
|
||||
goto out;
|
||||
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY, O_WRONLY)) == -1)
|
||||
goto out;
|
||||
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_RDWR, O_RDWR)) == -1)
|
||||
goto out;
|
||||
|
||||
|
||||
/* allow stderr */
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 1,
|
||||
SCMP_CMP(0, SCMP_CMP_EQ, 2)) == -1)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
// applying filter...
|
||||
if (seccomp_load(ctx) == -1)
|
||||
goto out;
|
||||
// free ctx after the filter has been loaded into the kernel
|
||||
seccomp_release(ctx);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
// something went wrong
|
||||
seccomp_release(ctx);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
273
src/softmagic.c
273
src/softmagic.c
@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.249 2017/06/19 18:30:25 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.259 2018/03/11 01:23:52 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@ -44,20 +44,26 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.249 2017/06/19 18:30:25 christos Exp $")
|
||||
#include "der.h"
|
||||
|
||||
private int match(struct magic_set *, struct magic *, uint32_t,
|
||||
const unsigned char *, size_t, size_t, int, int, int, uint16_t *,
|
||||
const struct buffer *, size_t, int, int, int, uint16_t *,
|
||||
uint16_t *, int *, int *, int *);
|
||||
private int mget(struct magic_set *, const unsigned char *,
|
||||
struct magic *, size_t, size_t, unsigned int, int, int, int, uint16_t *,
|
||||
private int mget(struct magic_set *, struct magic *, const struct buffer *,
|
||||
const unsigned char *, size_t,
|
||||
size_t, unsigned int, int, int, int, uint16_t *,
|
||||
uint16_t *, int *, int *, int *);
|
||||
private int msetoffset(struct magic_set *, struct magic *, struct buffer *,
|
||||
const struct buffer *, size_t, unsigned int);
|
||||
private int magiccheck(struct magic_set *, struct magic *);
|
||||
private int32_t mprint(struct magic_set *, struct magic *);
|
||||
private int moffset(struct magic_set *, struct magic *, size_t, int32_t *);
|
||||
private int32_t mprint(struct magic_set *, struct magic *,
|
||||
const struct buffer *);
|
||||
private int moffset(struct magic_set *, struct magic *, const struct buffer *,
|
||||
int32_t *);
|
||||
private void mdebug(uint32_t, const char *, size_t);
|
||||
private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
|
||||
const unsigned char *, uint32_t, size_t, struct magic *);
|
||||
private int mconvert(struct magic_set *, struct magic *, int);
|
||||
private int print_sep(struct magic_set *, int);
|
||||
private int handle_annotation(struct magic_set *, struct magic *, int);
|
||||
private int handle_annotation(struct magic_set *, struct magic *,
|
||||
const struct buffer *, int);
|
||||
private int cvt_8(union VALUETYPE *, const struct magic *);
|
||||
private int cvt_16(union VALUETYPE *, const struct magic *);
|
||||
private int cvt_32(union VALUETYPE *, const struct magic *);
|
||||
@ -88,7 +94,7 @@ private int cvt_64(union VALUETYPE *, const struct magic *);
|
||||
*/
|
||||
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
|
||||
protected int
|
||||
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
file_softmagic(struct magic_set *ms, const struct buffer *b,
|
||||
uint16_t *indir_count, uint16_t *name_count, int mode, int text)
|
||||
{
|
||||
struct mlist *ml;
|
||||
@ -105,7 +111,7 @@ file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
}
|
||||
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, b, 0, mode,
|
||||
text, 0, indir_count, name_count,
|
||||
&printed_something, &need_separator, NULL)) != 0)
|
||||
return rv;
|
||||
@ -118,18 +124,18 @@ file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
|
||||
|
||||
private const char * __attribute__((__format_arg__(3)))
|
||||
file_fmtcheck(struct magic_set *ms, const struct magic *m, const char *def,
|
||||
file_fmtcheck(struct magic_set *ms, const char *desc, const char *def,
|
||||
const char *file, size_t line)
|
||||
{
|
||||
const char *ptr = fmtcheck(m->desc, def);
|
||||
const char *ptr = fmtcheck(desc, def);
|
||||
if (ptr == def)
|
||||
file_magerror(ms,
|
||||
"%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
|
||||
" with `%s'", file, line, m->desc, def);
|
||||
" with `%s'", file, line, desc, def);
|
||||
return ptr;
|
||||
}
|
||||
#else
|
||||
#define F(a, b, c) fmtcheck((b)->desc, (c))
|
||||
#define F(a, b, c) fmtcheck((b), (c))
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -161,7 +167,7 @@ file_fmtcheck(struct magic_set *ms, const struct magic *m, const char *def,
|
||||
*/
|
||||
private int
|
||||
match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
|
||||
const unsigned char *s, size_t nbytes, size_t offset, int mode, int text,
|
||||
const struct buffer *b, size_t offset, int mode, int text,
|
||||
int flip, uint16_t *indir_count, uint16_t *name_count,
|
||||
int *printed_something, int *need_separator, int *returnval)
|
||||
{
|
||||
@ -169,6 +175,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 */
|
||||
struct buffer bb;
|
||||
int print = (ms->flags & MAGIC_NODESC) == 0;
|
||||
|
||||
if (returnval == NULL)
|
||||
@ -196,12 +203,13 @@ flush:
|
||||
continue; /* Skip to next top-level test*/
|
||||
}
|
||||
|
||||
ms->offset = m->offset;
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
|
||||
goto flush;
|
||||
ms->line = m->lineno;
|
||||
|
||||
/* if main entry matches, print it... */
|
||||
switch (mget(ms, s, m, nbytes, offset, cont_level, mode, text,
|
||||
flip, indir_count, name_count,
|
||||
switch (mget(ms, m, b, bb.fbuf, bb.flen, offset, cont_level,
|
||||
mode, text, flip, indir_count, name_count,
|
||||
printed_something, need_separator, returnval)) {
|
||||
case -1:
|
||||
return -1;
|
||||
@ -232,7 +240,7 @@ flush:
|
||||
goto flush;
|
||||
}
|
||||
|
||||
if ((e = handle_annotation(ms, m, firstline)) != 0) {
|
||||
if ((e = handle_annotation(ms, m, b, firstline)) != 0) {
|
||||
*need_separator = 1;
|
||||
*printed_something = 1;
|
||||
*returnval = 1;
|
||||
@ -250,11 +258,10 @@ flush:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (print && mprint(ms, m) == -1)
|
||||
if (print && mprint(ms, m, b) == -1)
|
||||
return -1;
|
||||
|
||||
switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) {
|
||||
switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
|
||||
case -1:
|
||||
case 0:
|
||||
goto flush;
|
||||
@ -280,7 +287,8 @@ flush:
|
||||
*/
|
||||
cont_level = m->cont_level;
|
||||
}
|
||||
ms->offset = m->offset;
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
|
||||
goto flush;
|
||||
if (m->flag & OFFADD) {
|
||||
ms->offset +=
|
||||
ms->c.li[cont_level - 1].off;
|
||||
@ -293,9 +301,10 @@ flush:
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
switch (mget(ms, s, m, nbytes, offset, cont_level, mode,
|
||||
text, flip, indir_count, name_count,
|
||||
printed_something, need_separator, returnval)) {
|
||||
switch (mget(ms, m, b, bb.fbuf, bb.flen, offset,
|
||||
cont_level, mode, text, flip, indir_count,
|
||||
name_count, printed_something, need_separator,
|
||||
returnval)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 0:
|
||||
@ -330,7 +339,8 @@ flush:
|
||||
} else
|
||||
ms->c.li[cont_level].got_match = 1;
|
||||
|
||||
if ((e = handle_annotation(ms, m, firstline)) != 0) {
|
||||
if ((e = handle_annotation(ms, m, b, firstline))
|
||||
!= 0) {
|
||||
*need_separator = 1;
|
||||
*printed_something = 1;
|
||||
*returnval = 1;
|
||||
@ -363,10 +373,10 @@ flush:
|
||||
return -1;
|
||||
*need_separator = 0;
|
||||
}
|
||||
if (print && mprint(ms, m) == -1)
|
||||
if (print && mprint(ms, m, b) == -1)
|
||||
return -1;
|
||||
|
||||
switch (moffset(ms, m, nbytes,
|
||||
switch (moffset(ms, m, &bb,
|
||||
&ms->c.li[cont_level].off)) {
|
||||
case -1:
|
||||
case 0:
|
||||
@ -404,19 +414,19 @@ flush:
|
||||
}
|
||||
|
||||
private int
|
||||
check_fmt(struct magic_set *ms, struct magic *m)
|
||||
check_fmt(struct magic_set *ms, const char *fmt)
|
||||
{
|
||||
file_regex_t rx;
|
||||
int rc, rv = -1;
|
||||
|
||||
if (strchr(m->desc, '%') == NULL)
|
||||
if (strchr(fmt, '%') == NULL)
|
||||
return 0;
|
||||
|
||||
rc = file_regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
|
||||
if (rc) {
|
||||
file_regerror(&rx, rc, ms);
|
||||
} else {
|
||||
rc = file_regexec(&rx, m->desc, 0, 0, 0);
|
||||
rc = file_regexec(&rx, fmt, 0, 0, 0);
|
||||
rv = !rc;
|
||||
}
|
||||
file_regfree(&rx);
|
||||
@ -442,30 +452,91 @@ strndup(const char *str, size_t n)
|
||||
}
|
||||
#endif /* HAVE_STRNDUP */
|
||||
|
||||
static int
|
||||
varexpand(char *buf, size_t len, const struct buffer *b, const char *str)
|
||||
{
|
||||
const char *ptr, *sptr, *e, *t, *ee, *et;
|
||||
size_t l;
|
||||
|
||||
for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
|
||||
l = (size_t)(ptr - sptr);
|
||||
if (l >= len)
|
||||
return -1;
|
||||
memcpy(buf, sptr, l);
|
||||
buf += l;
|
||||
len -= l;
|
||||
ptr += 2;
|
||||
if (!*ptr || ptr[1] != '?')
|
||||
return -1;
|
||||
for (et = t = ptr + 2; *et && *et != ':'; et++)
|
||||
continue;
|
||||
if (*et != ':')
|
||||
return -1;
|
||||
for (ee = e = et + 1; *ee && *ee != '}'; ee++)
|
||||
continue;
|
||||
if (*ee != '}')
|
||||
return -1;
|
||||
switch (*ptr) {
|
||||
case 'x':
|
||||
if (b->st.st_mode & 0111) {
|
||||
ptr = t;
|
||||
l = et - t;
|
||||
} else {
|
||||
ptr = e;
|
||||
l = ee - e;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
if (l >= len)
|
||||
return -1;
|
||||
memcpy(buf, ptr, l);
|
||||
buf += l;
|
||||
len -= l;
|
||||
sptr = ee + 1;
|
||||
}
|
||||
|
||||
l = strlen(sptr);
|
||||
if (l >= len)
|
||||
return -1;
|
||||
|
||||
memcpy(buf, sptr, l);
|
||||
buf[l] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private int32_t
|
||||
mprint(struct magic_set *ms, struct magic *m)
|
||||
mprint(struct magic_set *ms, struct magic *m, const struct buffer *b)
|
||||
{
|
||||
uint64_t v;
|
||||
float vf;
|
||||
double vd;
|
||||
int64_t t = 0;
|
||||
char buf[128], tbuf[26], sbuf[512];
|
||||
char buf[128], tbuf[26], sbuf[512], ebuf[512];
|
||||
const char *desc;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
|
||||
if (varexpand(ebuf, sizeof(ebuf), b, m->desc) == -1)
|
||||
desc = m->desc;
|
||||
else
|
||||
desc = ebuf;
|
||||
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
v = file_signextend(ms, m, (uint64_t)p->b);
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%d",
|
||||
(unsigned char)v);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%d"),
|
||||
if (file_printf(ms, F(ms, desc, "%d"),
|
||||
(unsigned char) v) == -1)
|
||||
return -1;
|
||||
break;
|
||||
@ -477,17 +548,17 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
v = file_signextend(ms, m, (uint64_t)p->h);
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%u",
|
||||
(unsigned short)v);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%u"),
|
||||
if (file_printf(ms, F(ms, desc, "%u"),
|
||||
(unsigned short) v) == -1)
|
||||
return -1;
|
||||
break;
|
||||
@ -500,16 +571,16 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_LELONG:
|
||||
case FILE_MELONG:
|
||||
v = file_signextend(ms, m, (uint64_t)p->l);
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%u", (uint32_t) v);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%u"), (uint32_t) v) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%u"), (uint32_t) v) == -1)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@ -520,17 +591,17 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEQUAD:
|
||||
case FILE_LEQUAD:
|
||||
v = file_signextend(ms, m, p->q);
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%" INT64_T_FORMAT "u",
|
||||
(unsigned long long)v);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%" INT64_T_FORMAT "u"),
|
||||
if (file_printf(ms, F(ms, desc, "%" INT64_T_FORMAT "u"),
|
||||
(unsigned long long) v) == -1)
|
||||
return -1;
|
||||
break;
|
||||
@ -543,7 +614,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BESTRING16:
|
||||
case FILE_LESTRING16:
|
||||
if (m->reln == '=' || m->reln == '!') {
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_printable(sbuf, sizeof(sbuf), m->value.s))
|
||||
== -1)
|
||||
return -1;
|
||||
@ -571,7 +642,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
*++last = '\0';
|
||||
}
|
||||
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_printable(sbuf, sizeof(sbuf), str)) == -1)
|
||||
return -1;
|
||||
|
||||
@ -584,7 +655,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEDATE:
|
||||
case FILE_LEDATE:
|
||||
case FILE_MEDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_fmttime(p->l, 0, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint32_t);
|
||||
@ -594,7 +665,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BELDATE:
|
||||
case FILE_LELDATE:
|
||||
case FILE_MELDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_fmttime(p->l, FILE_T_LOCAL, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint32_t);
|
||||
@ -603,7 +674,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_QDATE:
|
||||
case FILE_BEQDATE:
|
||||
case FILE_LEQDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_fmttime(p->q, 0, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
@ -612,7 +683,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_QLDATE:
|
||||
case FILE_BEQLDATE:
|
||||
case FILE_LEQLDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_fmttime(p->q, FILE_T_LOCAL, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
@ -621,7 +692,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_QWDATE:
|
||||
case FILE_BEQWDATE:
|
||||
case FILE_LEQWDATE:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_fmttime(p->q, FILE_T_WINDOWS, tbuf)) == -1)
|
||||
return -1;
|
||||
t = ms->offset + sizeof(uint64_t);
|
||||
@ -631,16 +702,16 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
vf = p->f;
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%g", vf);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%g"), vf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@ -651,16 +722,16 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
vd = p->d;
|
||||
switch (check_fmt(ms, m)) {
|
||||
switch (check_fmt(ms, desc)) {
|
||||
case -1:
|
||||
return -1;
|
||||
case 1:
|
||||
(void)snprintf(buf, sizeof(buf), "%g", vd);
|
||||
if (file_printf(ms, F(ms, m, "%s"), buf) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (file_printf(ms, F(ms, m, "%g"), vd) == -1)
|
||||
if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@ -677,7 +748,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
file_oomem(ms, ms->search.rm_len);
|
||||
return -1;
|
||||
}
|
||||
rval = file_printf(ms, F(ms, m, "%s"),
|
||||
rval = file_printf(ms, F(ms, desc, "%s"),
|
||||
file_printable(sbuf, sizeof(sbuf), cp));
|
||||
free(cp);
|
||||
|
||||
@ -704,7 +775,7 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
t = ms->offset;
|
||||
break;
|
||||
case FILE_DER:
|
||||
if (file_printf(ms, F(ms, m, "%s"),
|
||||
if (file_printf(ms, F(ms, desc, "%s"),
|
||||
file_printable(sbuf, sizeof(sbuf), ms->ms_value.s)) == -1)
|
||||
return -1;
|
||||
t = ms->offset;
|
||||
@ -717,8 +788,10 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
}
|
||||
|
||||
private int
|
||||
moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
|
||||
moffset(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
int32_t *op)
|
||||
{
|
||||
size_t nbytes = b->flen;
|
||||
int32_t o;
|
||||
|
||||
switch (m->type) {
|
||||
@ -1232,7 +1305,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
last = RCAST(const char *, s) + bytecnt;
|
||||
last = end;
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@ -1337,12 +1410,58 @@ do_ops(struct magic *m, intmax_t lhs, intmax_t off)
|
||||
}
|
||||
|
||||
private int
|
||||
mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
size_t nbytes, size_t o, unsigned int cont_level, int mode, int text,
|
||||
int flip, uint16_t *indir_count, uint16_t *name_count,
|
||||
msetoffset(struct magic_set *ms, struct magic *m, struct buffer *bb,
|
||||
const struct buffer *b, size_t o, unsigned int cont_level)
|
||||
{
|
||||
if (m->offset < 0) {
|
||||
if (cont_level > 0) {
|
||||
if (m->flag & (OFFADD|INDIROFFADD))
|
||||
goto normal;
|
||||
#if 0
|
||||
file_error(ms, 0, "negative offset %d at continuation"
|
||||
"level %u", m->offset, cont_level);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
if (buffer_fill(b) == -1)
|
||||
return -1;
|
||||
if (o != 0) {
|
||||
// Not yet!
|
||||
file_magerror(ms, "non zero offset %zu at"
|
||||
" level %u", o, cont_level);
|
||||
return -1;
|
||||
}
|
||||
if ((size_t)-m->offset > b->elen)
|
||||
return -1;
|
||||
buffer_init(bb, -1, b->ebuf, b->elen);
|
||||
ms->eoffset = ms->offset = b->elen + m->offset;
|
||||
} else {
|
||||
if (cont_level == 0) {
|
||||
normal:
|
||||
// XXX: Pass real fd, then who frees bb?
|
||||
buffer_init(bb, -1, b->fbuf, b->flen);
|
||||
ms->offset = m->offset;
|
||||
ms->eoffset = 0;
|
||||
} else {
|
||||
ms->offset = ms->eoffset + m->offset;
|
||||
}
|
||||
}
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
fprintf(stderr, "bb=[%p,%zu], %d [b=%p,%zu], [o=%#x, c=%d]\n",
|
||||
bb->fbuf, bb->flen, ms->offset, b->fbuf, b->flen,
|
||||
m->offset, cont_level);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int
|
||||
mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
const unsigned char *s, size_t nbytes, size_t o, unsigned int cont_level,
|
||||
int mode, int text, int flip, uint16_t *indir_count, uint16_t *name_count,
|
||||
int *printed_something, int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t offset = ms->offset;
|
||||
struct buffer bb;
|
||||
intmax_t lhs;
|
||||
file_pushbuf_t *pb;
|
||||
int rv, oneed_separator, in_type;
|
||||
@ -1362,6 +1481,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
(uint32_t)nbytes, m) == -1)
|
||||
return -1;
|
||||
@ -1559,7 +1680,10 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
return -1;
|
||||
|
||||
(*indir_count)++;
|
||||
rv = file_softmagic(ms, s + offset, nbytes - offset,
|
||||
bb = *b;
|
||||
bb.fbuf = s + offset;
|
||||
bb.flen = nbytes - offset;
|
||||
rv = file_softmagic(ms, &bb,
|
||||
indir_count, name_count, BINTEST, text);
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
@ -1571,7 +1695,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & MAGIC_NODESC) == 0 &&
|
||||
file_printf(ms, F(ms, m, "%u"), offset) == -1) {
|
||||
file_printf(ms, F(ms, m->desc, "%u"), offset) == -1) {
|
||||
free(rbuf);
|
||||
return -1;
|
||||
}
|
||||
@ -1599,12 +1723,12 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
oneed_separator = *need_separator;
|
||||
if (m->flag & NOSPACE)
|
||||
*need_separator = 0;
|
||||
rv = match(ms, ml.magic, ml.nmagic, s, nbytes, offset + o,
|
||||
rv = match(ms, ml.magic, ml.nmagic, b, offset + o,
|
||||
mode, text, flip, indir_count, name_count,
|
||||
printed_something, need_separator, returnval);
|
||||
if (rv != 1)
|
||||
*need_separator = oneed_separator;
|
||||
return 1;
|
||||
return rv;
|
||||
|
||||
case FILE_NAME:
|
||||
if (ms->flags & MAGIC_NODESC)
|
||||
@ -2035,7 +2159,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
|
||||
}
|
||||
|
||||
private int
|
||||
handle_annotation(struct magic_set *ms, struct magic *m, int firstline)
|
||||
handle_annotation(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
int firstline)
|
||||
{
|
||||
if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
|
||||
if (!firstline && file_printf(ms, "\n- ") == -1)
|
||||
@ -2052,9 +2177,15 @@ handle_annotation(struct magic_set *ms, struct magic *m, int firstline)
|
||||
return 1;
|
||||
}
|
||||
if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
|
||||
char buf[1024];
|
||||
const char *p;
|
||||
if (!firstline && file_printf(ms, "\n- ") == -1)
|
||||
return -1;
|
||||
if (file_printf(ms, "%s", m->mimetype) == -1)
|
||||
if (varexpand(buf, sizeof(buf), b, m->mimetype) == -1)
|
||||
p = m->mimetype;
|
||||
else
|
||||
p = buf;
|
||||
if (file_printf(ms, "%s", p) == -1)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.13.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -14,61 +14,23 @@
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
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 \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@ -88,6 +50,8 @@ 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 \
|
||||
@ -95,7 +59,6 @@ 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 =
|
||||
@ -167,7 +130,6 @@ 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@
|
||||
@ -181,7 +143,6 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
@ -197,7 +158,6 @@ EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -318,6 +278,7 @@ $(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*) \
|
||||
@ -344,7 +305,6 @@ clean-checkPROGRAMS:
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES)
|
||||
@rm -f test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
|
||||
@ -606,8 +566,6 @@ 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
|
||||
set -e; for i in $T/*.testfile; do echo Running test: $$i; TZ=UTC MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
|
||||
|
Loading…
x
Reference in New Issue
Block a user