Reducing external/bsd/file differences

Change-Id: I0d025059ba0b200ac1162ea5a764fd756600ecd0
This commit is contained in:
Lionel Sambuc 2013-04-10 11:08:42 +02:00
parent c979136e4e
commit 08ff44c446
67 changed files with 1177 additions and 734 deletions

View file

@ -12,8 +12,8 @@ MFILESDIR?= /usr/share/misc
MFILES?= magic.mgc MFILES?= magic.mgc
MAGIC?= ${MFILESDIR}/magic MAGIC?= ${MFILESDIR}/magic
#LSC FIXME Is this still needed ? -DQUICK #this is still required (will not compile without removing it): -DQUICK
CPPFLAGS+= -DMAGIC='"${MAGIC}"' -DHAVE_CONFIG_H -DBUILTIN_ELF \ CPPFLAGS+= -DMAGIC='"${MAGIC}"' -DHAVE_CONFIG_H -DBUILTIN_ELF \
-DELFCORE -DELFCORE
CPPFLAGS+= -I${.CURDIR}/../include -I${DIST}/src CPPFLAGS+= -I${.CURDIR}/../include -I${DIST}/src

View file

@ -11,9 +11,6 @@ FILES= ${MFILES}
.endif .endif
PROG= file PROG= file
.if defined(__MINIX)
LDADD+= -L../lib
.endif
LDADD+= -lmagic -lz LDADD+= -lmagic -lz
DPADD+= ${LIBMAGIC} ${LIBZ} DPADD+= ${LIBMAGIC} ${LIBZ}
MAN= file.1 magic.5 MAN= file.1 magic.5

View file

@ -1,3 +1,55 @@
2012-02-20 17:33 Christos Zoulas <christos@zoulas.com>
* Fix CDF parsing issues found by CERT's fuzzing tool (Will Dormann)
2011-12-15 12:17 Chris Metcalf <cmetcalf@tilera.com>
* Support Tilera architectures (tile64, tilepro, tilegx).
2011-12-16 16:33 Reuben Thomas <rrt@sc3d.org>
* Add magic for /usr/bin/env Perl scripts
* Weaken generic script magic to avoid clashing with
language-specific magic.
2011-12-08 13:37 Reuben Thomas <rrt@sc3d.org>
* Simplify if (p) free(p) to free(p).
2011-12-08 13:07 Reuben Thomas <rrt@sc3d.org>
* Remove hardwired token finding (names.h), turning it into soft
magic. Patterns are either anchored regexs or search/8192. English
language detection and PL/1 detection have been removed as they
were too fragile. -e tokens is still accepted for backwards
compatibility.
* Move 3ds patterns (which are commented out anyway) into autodesk
(they were, oddly, in c-lang).
2011-12-06 00:16 Reuben Thomas <rrt@sc3d.org>
* Tweak strength of generic hash-bang detectors to be less than
specific ones.
* Make an inconsistent description of Python scripts consistent.
2011-12-05 23:58 Reuben Thomas <rrt@sc3d.org>
* Fix minor error in file(1).
2011-11-05 00:00 Reuben Thomas <rrt@sc3d.org>
* Fix issue #150 (I hope).
2011-09-22 12:57 Christos Zoulas <christos@zoulas.com>
* Python3 binding fixes from Kelly Anderson
2011-09-20 11:32 Christos Zoulas <christos@zoulas.com>
* If a string type magic entry is marked as text or binary
only match text files against text entries and binary
files against binary entries.
2011-09-01 12:12 Christos Zoulas <christos@zoulas.com> 2011-09-01 12:12 Christos Zoulas <christos@zoulas.com>
* Don't wait for any subprocess, just the one we forked. * Don't wait for any subprocess, just the one we forked.

View file

@ -977,6 +977,9 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;; exit ;;

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for file 5.09. # Generated by GNU Autoconf 2.68 for file 5.11.
# #
# Report bugs to <christos@astron.com>. # Report bugs to <christos@astron.com>.
# #
@ -698,8 +698,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='file' PACKAGE_NAME='file'
PACKAGE_TARNAME='file' PACKAGE_TARNAME='file'
PACKAGE_VERSION='5.09' PACKAGE_VERSION='5.11'
PACKAGE_STRING='file 5.09' PACKAGE_STRING='file 5.11'
PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_BUGREPORT='christos@astron.com'
PACKAGE_URL='' PACKAGE_URL=''
@ -1431,7 +1431,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures file 5.09 to adapt to many kinds of systems. \`configure' configures file 5.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1501,7 +1501,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of file 5.09:";; short | recursive ) echo "Configuration of file 5.11:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1609,8 +1609,8 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
file configure 5.09 file configure 5.11
generated by GNU Autoconf 2.64 generated by GNU Autoconf 2.68
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation This configure script is free software; the Free Software Foundation
@ -2308,8 +2308,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by file $as_me 5.09, which was It was created by file $as_me 5.11, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@ $ $0 $@
@ -3116,7 +3116,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='file' PACKAGE='file'
VERSION='5.09' VERSION='5.11'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -13477,8 +13477,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by file $as_me 5.09, which was This file was extended by file $as_me 5.11, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_HEADERS = $CONFIG_HEADERS
@ -13541,9 +13541,9 @@ Report bugs to <christos@astron.com>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
file config.status 5.09 file config.status 5.11
configured by $0, generated by GNU Autoconf 2.64, configured by $0, generated by GNU Autoconf 2.68,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation This config.status script is free software; the Free Software Foundation

View file

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(file, 5.09, christos@astron.com) AC_INIT(file, 5.11, christos@astron.com)
AM_INIT_AUTOMAKE() AM_INIT_AUTOMAKE()
AM_MAINTAINER_MODE(disable) AM_MAINTAINER_MODE(disable)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

View file

@ -1,7 +1,7 @@
.\" $NetBSD: file.1,v 1.8 2011/09/16 21:06:25 christos Exp $ .\" $NetBSD: file.1,v 1.9 2012/02/22 17:53:50 christos Exp $
.\" .\"
.\" $File: file.man,v 1.96 2011/07/12 11:23:38 rrt Exp $ .\" $File: file.man,v 1.98 2011/12/08 12:12:46 rrt Exp $
.Dd April 20, 2011 .Dd October 17, 2011
.Dt FILE 1 .Dt FILE 1
.Os .Os
.Sh NAME .Sh NAME
@ -26,7 +26,7 @@
.Nm .Nm
.Op Fl Fl help .Op Fl Fl help
.Sh DESCRIPTION .Sh DESCRIPTION
This manual page documents version 5.09 of the This manual page documents version 5.11 of the
.Nm .Nm
command. command.
.Pp .Pp
@ -194,7 +194,7 @@ option).
.It encoding .It encoding
Different text encodings for soft magic tests. Different text encodings for soft magic tests.
.It tokens .It tokens
Looks for known tokens inside text files. Ignored for backwards compatibility.
.It cdf .It cdf
Prints details of Compound Document Files. Prints details of Compound Document Files.
.It compress .It compress
@ -222,6 +222,19 @@ or at least one filename argument must be present;
to test the standard input, use to test the standard input, use
.Sq - .Sq -
as a filename argument. as a filename argument.
Please note that
.Ar namefile
is unwrapped and the enclosed filenames are processed when this option is
encountered and before any further options processing is done.
This allows one to process multiple lists of files with different command line
arguments on the same
.Nm
invocation.
Thus if you want to set the delimiter, you need to do it before you specify
the list of files, like:
.Dq Fl F Ar @ Fl f Ar namefile ,
instead of:
.Dq Fl f Ar namefile Fl F Ar @ .
.It Fl h , Fl Fl no-dereference .It Fl h , Fl Fl no-dereference
option causes symlinks not to be followed option causes symlinks not to be followed
(on systems that support symbolic links). (on systems that support symbolic links).

View file

@ -1,6 +1,6 @@
.\" $NetBSD: libmagic.3,v 1.9 2011/11/10 13:41:00 christos Exp $ .\" $NetBSD: libmagic.3,v 1.10 2012/02/22 17:53:50 christos Exp $
.\" .\"
.\" $File: libmagic.man,v 1.24 2011/05/13 22:11:44 christos Exp $ .\" $File: libmagic.man,v 1.26 2011/12/19 17:49:31 christos Exp $
.\" .\"
.\" Copyright (c) Christos Zoulas 2003. .\" Copyright (c) Christos Zoulas 2003.
.\" All Rights Reserved. .\" All Rights Reserved.
@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd January 14, 2011 .Dd December 19, 2011
.Dt LIBMAGIC 3 .Dt LIBMAGIC 3
.Os .Os
.Sh NAME .Sh NAME
@ -66,6 +66,8 @@
.Ft int .Ft int
.Fn magic_compile "magic_t cookie" "const char *filename" .Fn magic_compile "magic_t cookie" "const char *filename"
.Ft int .Ft int
.Fn magic_list "magic_t cookie" "const char *filename"
.Ft int
.Fn magic_load "magic_t cookie" "const char *filename" .Fn magic_load "magic_t cookie" "const char *filename"
.Sh DESCRIPTION .Sh DESCRIPTION
These functions These functions
@ -221,6 +223,17 @@ of each file argument with
appended to it. appended to it.
.Pp .Pp
The The
.Fn magic_list
function dumps all magic entries in a human readable format,
dumping first the entries that are matched against binary files and then the
ones that match text files.
It takes and optional
.Fa filename
argument which is a colon separated list of database files, or
.Dv NULL
for the default database.
.Pp
The
.Fn magic_load .Fn magic_load
function must be used to load the the colon function must be used to load the the colon
separated list of database files passed in as separated list of database files passed in as
@ -246,15 +259,17 @@ It will set errno to
.Er EINVAL .Er EINVAL
if an unsupported value for flags was given. if an unsupported value for flags was given.
The The
.Fn magic_list ,
.Fn magic_load , .Fn magic_load ,
.Fn magic_compile , .Fn magic_compile ,
and and
.Fn magic_check .Fn magic_check
functions return 0 on success and \-1 on failure. functions return 0 on success and \-1 on failure.
The The
.Fn magic_file , .Fn magic_buffer ,
.Fn magic_getpath ,
and and
.Fn magic_buffer .Fn magic_file ,
functions return a string on success and functions return a string on success and
.Dv NULL .Dv NULL
on failure. on failure.

View file

@ -1,6 +1,6 @@
.\" $NetBSD: magic.5,v 1.6 2011/09/16 21:06:25 christos Exp $ .\" $NetBSD: magic.5,v 1.7 2012/02/22 17:53:50 christos Exp $
.\" .\"
.\" $File: magic.man,v 1.69 2011/05/13 22:11:44 christos Exp $ .\" $File: magic.man,v 1.71 2011/12/07 11:58:24 rrt Exp $
.Dd April 20, 2011 .Dd April 20, 2011
.Dt MAGIC 5 .Dt MAGIC 5
.Os .Os
@ -12,7 +12,7 @@
This manual page documents the format of the magic file as This manual page documents the format of the magic file as
used by the used by the
.Xr file 1 .Xr file 1
command, version 5.09. command, version 5.11.
The The
.Xr file 1 .Xr file 1
command identifies the type of a file using, command identifies the type of a file using,
@ -65,16 +65,16 @@ consecutive blanks, the target needs at least
consecutive blanks to match. consecutive blanks to match.
The The
.Dq w .Dq w
flag treats every blank in the target as an optional blank. flag treats every blank in the magic as an optional blank.
The The
.Dq c .Dq c
flag, specifies case insensitive matching: lower case flag specifies case insensitive matching: lower case
characters in the magic match both lower and upper case characters in the characters in the magic match both lower and upper case characters in the
target, whereas upper case characters in the magic only match upper case target, whereas upper case characters in the magic only match upper case
characters in the target. characters in the target.
The The
.Dq C .Dq C
flag, specifies case insensitive matching: upper case flag specifies case insensitive matching: upper case
characters in the magic match both lower and upper case characters in the characters in the magic match both lower and upper case characters in the
target, whereas lower case characters in the magic only match upper case target, whereas lower case characters in the magic only match upper case
characters in the target. characters in the target.
@ -84,9 +84,9 @@ and
.Dq C . .Dq C .
The The
.Dq t .Dq t
flag, forces the test to be done for text files, while the flag forces the test to be done for text files, while the
.Dq b .Dq b
flag, forces the test to be done for binary files. flag forces the test to be done for binary files.
.It Dv pstring .It Dv pstring
A Pascal-style string where the first byte/short/int is interpreted as the an A Pascal-style string where the first byte/short/int is interpreted as the an
unsigned length. unsigned length.

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# $NetBSD: install-sh,v 1.4 2011/09/25 18:18:44 christos Exp $ # NetBSD: install-sh.in,v 1.5 2010/10/08 19:57:05 tez Exp
# This script now also installs multiple files, but might choke on installing # This script now also installs multiple files, but might choke on installing
# multiple files with spaces in the file names. # multiple files with spaces in the file names.
# #

View file

@ -1,5 +1,5 @@
# #
# $File: Makefile.am,v 1.73 2011/09/08 21:58:42 christos Exp $ # $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
# #
MAGIC_FRAGMENT_BASE = magdir MAGIC_FRAGMENT_BASE = magdir
MAGIC_DIR = $(top_srcdir)/magic MAGIC_DIR = $(top_srcdir)/magic
@ -22,6 +22,7 @@ $(MAGIC_FRAGMENT_DIR)/apl \
$(MAGIC_FRAGMENT_DIR)/apple \ $(MAGIC_FRAGMENT_DIR)/apple \
$(MAGIC_FRAGMENT_DIR)/applix \ $(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/archive \ $(MAGIC_FRAGMENT_DIR)/archive \
$(MAGIC_FRAGMENT_DIR)/assembler \
$(MAGIC_FRAGMENT_DIR)/asterix \ $(MAGIC_FRAGMENT_DIR)/asterix \
$(MAGIC_FRAGMENT_DIR)/att3b \ $(MAGIC_FRAGMENT_DIR)/att3b \
$(MAGIC_FRAGMENT_DIR)/audio \ $(MAGIC_FRAGMENT_DIR)/audio \
@ -52,6 +53,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
$(MAGIC_FRAGMENT_DIR)/convex \ $(MAGIC_FRAGMENT_DIR)/convex \
$(MAGIC_FRAGMENT_DIR)/cracklib \ $(MAGIC_FRAGMENT_DIR)/cracklib \
$(MAGIC_FRAGMENT_DIR)/ctags \ $(MAGIC_FRAGMENT_DIR)/ctags \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \ $(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \ $(MAGIC_FRAGMENT_DIR)/database \
$(MAGIC_FRAGMENT_DIR)/diamond \ $(MAGIC_FRAGMENT_DIR)/diamond \
@ -88,6 +90,7 @@ $(MAGIC_FRAGMENT_DIR)/gnumeric \
$(MAGIC_FRAGMENT_DIR)/grace \ $(MAGIC_FRAGMENT_DIR)/grace \
$(MAGIC_FRAGMENT_DIR)/graphviz \ $(MAGIC_FRAGMENT_DIR)/graphviz \
$(MAGIC_FRAGMENT_DIR)/gringotts \ $(MAGIC_FRAGMENT_DIR)/gringotts \
$(MAGIC_FRAGMENT_DIR)/guile \
$(MAGIC_FRAGMENT_DIR)/hitachi-sh \ $(MAGIC_FRAGMENT_DIR)/hitachi-sh \
$(MAGIC_FRAGMENT_DIR)/hp \ $(MAGIC_FRAGMENT_DIR)/hp \
$(MAGIC_FRAGMENT_DIR)/human68k \ $(MAGIC_FRAGMENT_DIR)/human68k \
@ -114,10 +117,12 @@ $(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \ $(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/lua \ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \ $(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \ $(MAGIC_FRAGMENT_DIR)/mach \
$(MAGIC_FRAGMENT_DIR)/macintosh \ $(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/magic \ $(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \ $(MAGIC_FRAGMENT_DIR)/mail.news \
$(MAGIC_FRAGMENT_DIR)/make \
$(MAGIC_FRAGMENT_DIR)/maple \ $(MAGIC_FRAGMENT_DIR)/maple \
$(MAGIC_FRAGMENT_DIR)/marc21 \ $(MAGIC_FRAGMENT_DIR)/marc21 \
$(MAGIC_FRAGMENT_DIR)/mathcad \ $(MAGIC_FRAGMENT_DIR)/mathcad \
@ -140,6 +145,7 @@ $(MAGIC_FRAGMENT_DIR)/msdos \
$(MAGIC_FRAGMENT_DIR)/msooxml \ $(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \ $(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/mup \ $(MAGIC_FRAGMENT_DIR)/mup \
$(MAGIC_FRAGMENT_DIR)/music \
$(MAGIC_FRAGMENT_DIR)/natinst \ $(MAGIC_FRAGMENT_DIR)/natinst \
$(MAGIC_FRAGMENT_DIR)/ncr \ $(MAGIC_FRAGMENT_DIR)/ncr \
$(MAGIC_FRAGMENT_DIR)/netbsd \ $(MAGIC_FRAGMENT_DIR)/netbsd \
@ -159,6 +165,7 @@ $(MAGIC_FRAGMENT_DIR)/osf1 \
$(MAGIC_FRAGMENT_DIR)/palm \ $(MAGIC_FRAGMENT_DIR)/palm \
$(MAGIC_FRAGMENT_DIR)/parix \ $(MAGIC_FRAGMENT_DIR)/parix \
$(MAGIC_FRAGMENT_DIR)/parrot \ $(MAGIC_FRAGMENT_DIR)/parrot \
$(MAGIC_FRAGMENT_DIR)/pascal \
$(MAGIC_FRAGMENT_DIR)/pbm \ $(MAGIC_FRAGMENT_DIR)/pbm \
$(MAGIC_FRAGMENT_DIR)/pdf \ $(MAGIC_FRAGMENT_DIR)/pdf \
$(MAGIC_FRAGMENT_DIR)/pdp \ $(MAGIC_FRAGMENT_DIR)/pdp \
@ -238,6 +245,7 @@ $(MAGIC_FRAGMENT_DIR)/xenix \
$(MAGIC_FRAGMENT_DIR)/xilinx \ $(MAGIC_FRAGMENT_DIR)/xilinx \
$(MAGIC_FRAGMENT_DIR)/xo65 \ $(MAGIC_FRAGMENT_DIR)/xo65 \
$(MAGIC_FRAGMENT_DIR)/xwindows \ $(MAGIC_FRAGMENT_DIR)/xwindows \
$(MAGIC_FRAGMENT_DIR)/zfs \
$(MAGIC_FRAGMENT_DIR)/zilog \ $(MAGIC_FRAGMENT_DIR)/zilog \
$(MAGIC_FRAGMENT_DIR)/zyxel $(MAGIC_FRAGMENT_DIR)/zyxel

View file

@ -197,7 +197,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
# #
# $File: Makefile.am,v 1.73 2011/09/08 21:58:42 christos Exp $ # $File: Makefile.am,v 1.78 2012/01/27 01:41:26 christos Exp $
# #
MAGIC_FRAGMENT_BASE = magdir MAGIC_FRAGMENT_BASE = magdir
MAGIC_DIR = $(top_srcdir)/magic MAGIC_DIR = $(top_srcdir)/magic
@ -218,6 +218,7 @@ $(MAGIC_FRAGMENT_DIR)/apl \
$(MAGIC_FRAGMENT_DIR)/apple \ $(MAGIC_FRAGMENT_DIR)/apple \
$(MAGIC_FRAGMENT_DIR)/applix \ $(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/archive \ $(MAGIC_FRAGMENT_DIR)/archive \
$(MAGIC_FRAGMENT_DIR)/assembler \
$(MAGIC_FRAGMENT_DIR)/asterix \ $(MAGIC_FRAGMENT_DIR)/asterix \
$(MAGIC_FRAGMENT_DIR)/att3b \ $(MAGIC_FRAGMENT_DIR)/att3b \
$(MAGIC_FRAGMENT_DIR)/audio \ $(MAGIC_FRAGMENT_DIR)/audio \
@ -248,6 +249,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
$(MAGIC_FRAGMENT_DIR)/convex \ $(MAGIC_FRAGMENT_DIR)/convex \
$(MAGIC_FRAGMENT_DIR)/cracklib \ $(MAGIC_FRAGMENT_DIR)/cracklib \
$(MAGIC_FRAGMENT_DIR)/ctags \ $(MAGIC_FRAGMENT_DIR)/ctags \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \ $(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \ $(MAGIC_FRAGMENT_DIR)/database \
$(MAGIC_FRAGMENT_DIR)/diamond \ $(MAGIC_FRAGMENT_DIR)/diamond \
@ -284,6 +286,7 @@ $(MAGIC_FRAGMENT_DIR)/gnumeric \
$(MAGIC_FRAGMENT_DIR)/grace \ $(MAGIC_FRAGMENT_DIR)/grace \
$(MAGIC_FRAGMENT_DIR)/graphviz \ $(MAGIC_FRAGMENT_DIR)/graphviz \
$(MAGIC_FRAGMENT_DIR)/gringotts \ $(MAGIC_FRAGMENT_DIR)/gringotts \
$(MAGIC_FRAGMENT_DIR)/guile \
$(MAGIC_FRAGMENT_DIR)/hitachi-sh \ $(MAGIC_FRAGMENT_DIR)/hitachi-sh \
$(MAGIC_FRAGMENT_DIR)/hp \ $(MAGIC_FRAGMENT_DIR)/hp \
$(MAGIC_FRAGMENT_DIR)/human68k \ $(MAGIC_FRAGMENT_DIR)/human68k \
@ -310,10 +313,12 @@ $(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \ $(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/lua \ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \ $(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \ $(MAGIC_FRAGMENT_DIR)/mach \
$(MAGIC_FRAGMENT_DIR)/macintosh \ $(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/magic \ $(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \ $(MAGIC_FRAGMENT_DIR)/mail.news \
$(MAGIC_FRAGMENT_DIR)/make \
$(MAGIC_FRAGMENT_DIR)/maple \ $(MAGIC_FRAGMENT_DIR)/maple \
$(MAGIC_FRAGMENT_DIR)/marc21 \ $(MAGIC_FRAGMENT_DIR)/marc21 \
$(MAGIC_FRAGMENT_DIR)/mathcad \ $(MAGIC_FRAGMENT_DIR)/mathcad \
@ -336,6 +341,7 @@ $(MAGIC_FRAGMENT_DIR)/msdos \
$(MAGIC_FRAGMENT_DIR)/msooxml \ $(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \ $(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/mup \ $(MAGIC_FRAGMENT_DIR)/mup \
$(MAGIC_FRAGMENT_DIR)/music \
$(MAGIC_FRAGMENT_DIR)/natinst \ $(MAGIC_FRAGMENT_DIR)/natinst \
$(MAGIC_FRAGMENT_DIR)/ncr \ $(MAGIC_FRAGMENT_DIR)/ncr \
$(MAGIC_FRAGMENT_DIR)/netbsd \ $(MAGIC_FRAGMENT_DIR)/netbsd \
@ -355,6 +361,7 @@ $(MAGIC_FRAGMENT_DIR)/osf1 \
$(MAGIC_FRAGMENT_DIR)/palm \ $(MAGIC_FRAGMENT_DIR)/palm \
$(MAGIC_FRAGMENT_DIR)/parix \ $(MAGIC_FRAGMENT_DIR)/parix \
$(MAGIC_FRAGMENT_DIR)/parrot \ $(MAGIC_FRAGMENT_DIR)/parrot \
$(MAGIC_FRAGMENT_DIR)/pascal \
$(MAGIC_FRAGMENT_DIR)/pbm \ $(MAGIC_FRAGMENT_DIR)/pbm \
$(MAGIC_FRAGMENT_DIR)/pdf \ $(MAGIC_FRAGMENT_DIR)/pdf \
$(MAGIC_FRAGMENT_DIR)/pdp \ $(MAGIC_FRAGMENT_DIR)/pdp \
@ -434,6 +441,7 @@ $(MAGIC_FRAGMENT_DIR)/xenix \
$(MAGIC_FRAGMENT_DIR)/xilinx \ $(MAGIC_FRAGMENT_DIR)/xilinx \
$(MAGIC_FRAGMENT_DIR)/xo65 \ $(MAGIC_FRAGMENT_DIR)/xo65 \
$(MAGIC_FRAGMENT_DIR)/xwindows \ $(MAGIC_FRAGMENT_DIR)/xwindows \
$(MAGIC_FRAGMENT_DIR)/zfs \
$(MAGIC_FRAGMENT_DIR)/zilog \ $(MAGIC_FRAGMENT_DIR)/zilog \
$(MAGIC_FRAGMENT_DIR)/zyxel $(MAGIC_FRAGMENT_DIR)/zyxel

View file

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

View file

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: archive,v 1.68 2011/09/07 15:47:51 christos Exp $ # $File: archive,v 1.70 2011/10/26 15:44:47 christos Exp $
# archive: file(1) magic for archive formats (see also "msdos" for self- # archive: file(1) magic for archive formats (see also "msdos" for self-
# extracting compressed archives) # extracting compressed archives)
# #
@ -12,6 +12,11 @@
257 string ustar\040\040\0 GNU tar archive 257 string ustar\040\040\0 GNU tar archive
!:mime application/x-tar # encoding: gnu !:mime application/x-tar # encoding: gnu
# Incremental snapshot gnu-tar format from:
# http://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
0 string GNU\ tar- GNU tar incremental snapshot data
>&0 regex [0-9]\.[0-9]+-[0-9]+ version %s
# cpio archives # cpio archives
# #
# Yes, the top two "cpio archive" formats *are* supposed to just be "short". # Yes, the top two "cpio archive" formats *are* supposed to just be "short".

View file

@ -0,0 +1,14 @@
#------------------------------------------------------------------------------
# $File: assembler,v 1.1 2011/12/08 12:12:46 rrt Exp $
# make: file(1) magic for assembler source
#
0 regex \^\.asciiz\? assembler source text
!:mime text/x-asm
0 regex \^\.byte assembler source text
!:mime text/x-asm
0 regex \^\.even assembler source text
!:mime text/x-asm
0 regex \^\.globl assembler source text
!:mime text/x-asm
0 regex \^\.text assembler source text
!:mime text/x-asm

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: audio,v 1.63 2011/09/06 11:00:06 christos Exp $ # $File: audio,v 1.64 2012/02/20 16:37:34 christos Exp $
# audio: file(1) magic for sound formats (see also "iff") # audio: file(1) magic for sound formats (see also "iff")
# #
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com), # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@ -491,6 +491,7 @@
# From danny.milo@gmx.net (Danny Milosavljevic) # From danny.milo@gmx.net (Danny Milosavljevic)
# New version from Abel Cheung <abel (@) oaka.org> # New version from Abel Cheung <abel (@) oaka.org>
0 string MAC\040 Monkey's Audio compressed format 0 string MAC\040 Monkey's Audio compressed format
!:mime audio/x-ape
>4 uleshort >0x0F8B version %d >4 uleshort >0x0F8B version %d
>>(0x08.l) uleshort =1000 with fast compression >>(0x08.l) uleshort =1000 with fast compression
>>(0x08.l) uleshort =2000 with normal compression >>(0x08.l) uleshort =2000 with normal compression

View file

@ -1,21 +1,49 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: c-lang,v 1.14 2009/09/19 16:28:08 christos Exp $ # $File: c-lang,v 1.16 2011/12/09 08:02:16 rrt Exp $
# c-lang: file(1) magic for C programs (or REXX) # c-lang: file(1) magic for C and related languages programs
# #
# XPM icons (Greg Roelofs, newt@uchicago.edu) # BCPL
# if you uncomment "/*" for C/REXX below, also uncomment this entry 0 search/8192 "libhdr" BCPL source text
#0 string /*\ XPM\ */ X pixmap image data !:mime text/x-bcpl
#!:mime image/x-xpmi 0 search/8192 "LIBHDR" BCPL source text
!:mime text/x-bcpl
# 3DS (3d Studio files) Conflicts with diff output 0x3d '=' # C
#16 beshort 0x3d3d image/x-3ds 0 regex \^#include C source text
!:mime text/x-c
0 regex \^char C source text
!:mime text/x-c
0 regex \^double C source text
!:mime text/x-c
0 regex \^extern C source text
!:mime text/x-c
0 regex \^float C source text
!:mime text/x-c
0 regex \^struct C source text
!:mime text/x-c
0 regex \^union C source text
!:mime text/x-c
0 search/8192 main( C source text
!:mime text/x-c
# this first will upset you if you're a PL/1 shop... # C++
# in which case rm it; ascmagic will catch real C programs # The strength of these rules is increased so they beat the C rules above
#0 search/1 /* C or REXX program text 0 regex \^template C++ source text
#0 search/1 // C++ program text !:strength + 10
!:mime text/x-c++
0 regex \^virtual C++ source text
!:strength + 10
!:mime text/x-c++
0 regex \^class C++ source text
!:strength + 10
!:mime text/x-c++
0 regex \^public: C++ source text
!:strength + 10
!:mime text/x-c++
0 regex \^private: C++ source text
!:strength + 10
!:mime text/x-c++
# From: Mikhail Teterin <mi@aldan.algebra.com> # From: Mikhail Teterin <mi@aldan.algebra.com>
0 string cscope cscope reference data 0 string cscope cscope reference data

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: cad,v 1.10 2010/12/25 14:33:43 christos Exp $ # $File: cad,v 1.11 2011/12/08 12:12:46 rrt Exp $
# autocad: file(1) magic for cad files # autocad: file(1) magic for cad files
# #
@ -113,3 +113,6 @@
0 string AC1012 AutoDesk AutoCAD R13 0 string AC1012 AutoDesk AutoCAD R13
0 string AC1014 AutoDesk AutoCAD R14 0 string AC1014 AutoDesk AutoCAD R14
0 string AC1015 AutoDesk AutoCAD R2000 0 string AC1015 AutoDesk AutoCAD R2000
# 3DS (3d Studio files) Conflicts with diff output 0x3d '='
#16 beshort 0x3d3d image/x-3ds

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: commands,v 1.41 2011/05/02 12:36:41 christos Exp $ # $File: commands,v 1.42 2011/12/05 23:14:02 rrt Exp $
# commands: file(1) magic for various shells and interpreters # commands: file(1) magic for various shells and interpreters
# #
#0 string/w : shell archive or script for antique kernel text #0 string/w : shell archive or script for antique kernel text
@ -64,12 +64,6 @@
0 string/wt #!\ /usr/local/bin/bash Bourne-Again shell script text executable 0 string/wt #!\ /usr/local/bin/bash Bourne-Again shell script text executable
!:mime text/x-shellscript !:mime text/x-shellscript
# using env
0 string/t #!/usr/bin/env a
>15 string/t >\0 %s script text executable
0 string/t #!\ /usr/bin/env a
>16 string/t >\0 %s script text executable
# PHP scripts # PHP scripts
# Ulf Harnhammar <ulfh@update.uu.se> # Ulf Harnhammar <ulfh@update.uu.se>
0 search/1/c =<?php PHP script text 0 search/1/c =<?php PHP script text

View file

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: compress,v 1.47 2011/03/08 00:39:46 christos Exp $ # $File: compress,v 1.49 2011/12/07 22:04:27 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives) # compress: file(1) magic for pure-compression formats (no archives)
# #
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@ -190,9 +190,10 @@
!:mime application/x-7z-compressed !:mime application/x-7z-compressed
# Type: LZMA # Type: LZMA
0 lelong 0x8000005d LZMA compressed data, 0 lelong&0xffffff =0x5d
>5 lequad =0xffffffffffffffff streamed >12 leshort =0xff LZMA compressed data,
>5 lequad !0xffffffffffffffff non-streamed, size %lld >>5 lequad =0xffffffffffffffff streamed
>>5 lequad !0xffffffffffffffff non-streamed, size %lld
!:mime application/x-lzma !:mime application/x-lzma
# http://tukaani.org/xz/xz-file-format.txt # http://tukaani.org/xz/xz-file-format.txt

View file

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

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: elf,v 1.53 2009/09/19 16:28:09 christos Exp $ # $File: elf,v 1.54 2011/12/17 17:16:29 christos Exp $
# elf: file(1) magic for ELF executables # elf: file(1) magic for ELF executables
# #
# We have to check the byte order flag to see what byte order all the # We have to check the byte order flag to see what byte order all the
@ -40,9 +40,10 @@
>>18 leshort 2 SPARC - invalid byte order, >>18 leshort 2 SPARC - invalid byte order,
>>18 leshort 3 Intel 80386, >>18 leshort 3 Intel 80386,
>>18 leshort 4 Motorola >>18 leshort 4 Motorola
>>>36 lelong &0x01000000 68000 - invalid byte order, >>>4 byte 1
>>>36 lelong &0x00810000 CPU32 - invalid byte order, >>>>36 lelong &0x01000000 68000 - invalid byte order,
>>>36 lelong 0 68020 - invalid byte order, >>>>36 lelong &0x00810000 CPU32 - invalid byte order,
>>>>36 lelong 0 68020 - invalid byte order,
>>18 leshort 5 Motorola 88000 - invalid byte order, >>18 leshort 5 Motorola 88000 - invalid byte order,
>>18 leshort 6 Intel 80486, >>18 leshort 6 Intel 80486,
>>18 leshort 7 Intel 80860, >>18 leshort 7 Intel 80860,
@ -50,9 +51,11 @@
# The second number (#10) will be deprecated later. For now, we still # The second number (#10) will be deprecated later. For now, we still
# say something if #10 is encountered, but only gory details for #8. # say something if #10 is encountered, but only gory details for #8.
>>18 leshort 8 MIPS, >>18 leshort 8 MIPS,
>>>36 lelong &0x20 N32 >>>4 byte 1
>>>>36 lelong &0x20 N32
>>18 leshort 10 MIPS, >>18 leshort 10 MIPS,
>>>36 lelong &0x20 N32 >>>4 byte 1
>>>>36 lelong &0x20 N32
>>18 leshort 8 >>18 leshort 8
# only for 32-bit # only for 32-bit
>>>4 byte 1 >>>4 byte 1
@ -80,8 +83,14 @@
>>18 leshort 10 MIPS (deprecated), >>18 leshort 10 MIPS (deprecated),
>>18 leshort 11 RS6000 - invalid byte order, >>18 leshort 11 RS6000 - invalid byte order,
>>18 leshort 15 PA-RISC - invalid byte order, >>18 leshort 15 PA-RISC - invalid byte order,
>>>50 leshort 0x0214 2.0 # only for 32-bit
>>>48 leshort &0x0008 (LP64), >>>4 byte 1
>>>>38 leshort 0x0214 2.0
>>>>36 leshort &0x0008 (LP64)
# only for 64-bit
>>>4 byte 2
>>>>50 leshort 0x0214 2.0
>>>>48 leshort &0x0008 (LP64)
>>18 leshort 16 nCUBE, >>18 leshort 16 nCUBE,
>>18 leshort 17 Fujitsu VPP500, >>18 leshort 17 Fujitsu VPP500,
>>18 leshort 18 SPARC32PLUS - invalid byte order, >>18 leshort 18 SPARC32PLUS - invalid byte order,
@ -92,6 +101,9 @@
>>18 leshort 38 TRW RH-32, >>18 leshort 38 TRW RH-32,
>>18 leshort 39 Motorola RCE, >>18 leshort 39 Motorola RCE,
>>18 leshort 40 ARM, >>18 leshort 40 ARM,
>>>4 byte 1
>>>>36 lelong&0xff000000 0x04000000 EABI4
>>>>36 lelong&0xff000000 0x05000000 EABI5
>>18 leshort 41 Alpha, >>18 leshort 41 Alpha,
>>18 leshort 0xa390 IBM S/390 (obsolete), >>18 leshort 0xa390 IBM S/390 (obsolete),
>>18 leshort 42 Renesas SH, >>18 leshort 42 Renesas SH,
@ -149,12 +161,14 @@
>>18 leshort 106 Analog Devices Blackfin, >>18 leshort 106 Analog Devices Blackfin,
>>18 leshort 113 Altera Nios II, >>18 leshort 113 Altera Nios II,
>>18 leshort 0xae META, >>18 leshort 0xae META,
>>18 leshort 187 Tilera TILE64,
>>18 leshort 188 Tilera TILEPro,
>>18 leshort 191 Tilera TILE-Gx,
>>18 leshort 0x3426 OpenRISC (obsolete), >>18 leshort 0x3426 OpenRISC (obsolete),
>>18 leshort 0x8472 OpenRISC (obsolete), >>18 leshort 0x8472 OpenRISC (obsolete),
>>18 leshort 0x9026 Alpha (unofficial), >>18 leshort 0x9026 Alpha (unofficial),
>>20 lelong 0 invalid version >>20 lelong 0 invalid version
>>20 lelong 1 version 1 >>20 lelong 1 version 1
>>36 lelong 1 MathCoPro/FPU/MAU Required
>5 byte 2 MSB >5 byte 2 MSB
>>16 beshort 0 no file type, >>16 beshort 0 no file type,
!:mime application/octet-stream !:mime application/octet-stream
@ -174,17 +188,20 @@
>>18 beshort 2 SPARC, >>18 beshort 2 SPARC,
>>18 beshort 3 Intel 80386 - invalid byte order, >>18 beshort 3 Intel 80386 - invalid byte order,
>>18 beshort 4 Motorola >>18 beshort 4 Motorola
>>>36 belong &0x01000000 68000, >>>4 byte 1
>>>36 belong &0x00810000 CPU32, >>>>36 belong &0x01000000 68000,
>>>36 belong 0 68020, >>>>36 belong &0x00810000 CPU32,
>>>>36 belong 0 68020,
>>18 beshort 5 Motorola 88000, >>18 beshort 5 Motorola 88000,
>>18 beshort 6 Intel 80486 - invalid byte order, >>18 beshort 6 Intel 80486 - invalid byte order,
>>18 beshort 7 Intel 80860, >>18 beshort 7 Intel 80860,
# only for MIPS - see comment in little-endian section above. # only for MIPS - see comment in little-endian section above.
>>18 beshort 8 MIPS, >>18 beshort 8 MIPS,
>>>36 belong &0x20 N32 >>>4 byte 1
>>>>36 belong &0x20 N32
>>18 beshort 10 MIPS, >>18 beshort 10 MIPS,
>>>36 belong &0x20 N32 >>>4 byte 1
>>>>36 belong &0x20 N32
>>18 beshort 8 >>18 beshort 8
# only for 32-bit # only for 32-bit
>>>4 byte 1 >>>4 byte 1
@ -212,15 +229,23 @@
>>18 beshort 10 MIPS (deprecated), >>18 beshort 10 MIPS (deprecated),
>>18 beshort 11 RS6000, >>18 beshort 11 RS6000,
>>18 beshort 15 PA-RISC >>18 beshort 15 PA-RISC
>>>50 beshort 0x0214 2.0 # only for 32-bit
>>>48 beshort &0x0008 (LP64) >>>4 byte 1
>>>>38 beshort 0x0214 2.0
>>>>36 beshort &0x0008 (LP64)
# only for 64-bit
>>>4 byte 2
>>>>50 beshort 0x0214 2.0
>>>>48 beshort &0x0008 (LP64)
>>18 beshort 16 nCUBE, >>18 beshort 16 nCUBE,
>>18 beshort 17 Fujitsu VPP500, >>18 beshort 17 Fujitsu VPP500,
>>18 beshort 18 SPARC32PLUS, >>18 beshort 18 SPARC32PLUS,
>>>36 belong&0xffff00 0x000100 V8+ Required, # only for 32-bit
>>>36 belong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required, >>>4 byte 1
>>>36 belong&0xffff00 0x000400 HaL R1 Extensions Required, >>>>36 belong&0xffff00 0x000100 V8+ Required,
>>>36 belong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required, >>>>36 belong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required,
>>>>36 belong&0xffff00 0x000400 HaL R1 Extensions Required,
>>>>36 belong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required,
>>18 beshort 20 PowerPC or cisco 4500, >>18 beshort 20 PowerPC or cisco 4500,
>>18 beshort 21 64-bit PowerPC or cisco 7500, >>18 beshort 21 64-bit PowerPC or cisco 7500,
>>18 beshort 22 IBM S/390, >>18 beshort 22 IBM S/390,
@ -232,15 +257,19 @@
>>18 beshort 38 TRW RH-32, >>18 beshort 38 TRW RH-32,
>>18 beshort 39 Motorola RCE, >>18 beshort 39 Motorola RCE,
>>18 beshort 40 ARM, >>18 beshort 40 ARM,
>>>4 byte 2
>>>>36 belong&0xff000000 0x04000000 EABI4
>>>>36 belong&0xff000000 0x05000000 EABI5
>>18 beshort 41 Alpha, >>18 beshort 41 Alpha,
>>18 beshort 42 Renesas SH, >>18 beshort 42 Renesas SH,
>>18 beshort 43 SPARC V9, >>18 beshort 43 SPARC V9,
>>>48 belong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required, >>>4 byte 2
>>>48 belong&0xffff00 0x000400 HaL R1 Extensions Required, >>>>48 belong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required,
>>>48 belong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required, >>>>48 belong&0xffff00 0x000400 HaL R1 Extensions Required,
>>>48 belong&0x3 0 total store ordering, >>>>48 belong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required,
>>>48 belong&0x3 1 partial store ordering, >>>>48 belong&0x3 0 total store ordering,
>>>48 belong&0x3 2 relaxed memory ordering, >>>>48 belong&0x3 1 partial store ordering,
>>>>48 belong&0x3 2 relaxed memory ordering,
>>18 beshort 44 Siemens Tricore Embedded Processor, >>18 beshort 44 Siemens Tricore Embedded Processor,
>>18 beshort 45 Argonaut RISC Core, Argonaut Technologies Inc., >>18 beshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
>>18 beshort 46 Renesas H8/300, >>18 beshort 46 Renesas H8/300,
@ -259,12 +288,16 @@
>>18 leshort 0x8472 OpenRISC (obsolete), >>18 leshort 0x8472 OpenRISC (obsolete),
>>18 beshort 94 Tensilica Xtensa, >>18 beshort 94 Tensilica Xtensa,
>>18 beshort 97 NatSemi 32k, >>18 beshort 97 NatSemi 32k,
>>18 beshort 187 Tilera TILE64,
>>18 beshort 188 Tilera TILEPro,
>>18 beshort 191 Tilera TILE-Gx,
>>18 beshort 0x18ad AVR32 (unofficial), >>18 beshort 0x18ad AVR32 (unofficial),
>>18 beshort 0x9026 Alpha (unofficial), >>18 beshort 0x9026 Alpha (unofficial),
>>18 beshort 0xa390 IBM S/390 (obsolete), >>18 beshort 0xa390 IBM S/390 (obsolete),
>>20 belong 0 invalid version >>>20 belong 0 invalid version
>>20 belong 1 version 1 >>>20 belong 1 version 1
>>36 belong 1 MathCoPro/FPU/MAU Required >>>4 byte 1
>>>>36 belong 1 MathCoPro/FPU/MAU Required
# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
# like proper ELF, but extracting the string had bad results. # like proper ELF, but extracting the string had bad results.
>4 byte <0x80 >4 byte <0x80

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: games,v 1.12 2010/11/25 15:00:12 christos Exp $ # $File: games,v 1.13 2012/02/13 22:50:50 christos Exp $
# games: file(1) for games # games: file(1) for games
# Fabio Bonelli <fabiobonelli@libero.it> # Fabio Bonelli <fabiobonelli@libero.it>
@ -255,3 +255,11 @@
>2 regex/c GM\\[19\\] - Octi Game >2 regex/c GM\\[19\\] - Octi Game
>2 regex/c GM\\[20\\] - Gess Game >2 regex/c GM\\[20\\] - Gess Game
>2 regex/c GM\\[21\\] - twix Game >2 regex/c GM\\[21\\] - twix Game
# Epic Games/Unreal Engine Package
#
0 lelong 0x9E2A83C1 Unreal Engine Package,
>4 leshort x version: %i
>12 lelong !0 \b, names: %i
>28 lelong !0 \b, imports: %i
>20 lelong !0 \b, exports: %i

View file

@ -1,19 +1,28 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: gnu,v 1.11 2009/09/19 16:28:09 christos Exp $ # $File: gnu,v 1.13 2012/01/03 17:16:54 christos Exp $
# gnu: file(1) magic for various GNU tools # gnu: file(1) magic for various GNU tools
# #
# GNU nlsutils message catalog file format # GNU nlsutils message catalog file format
# #
# GNU message catalog (.mo and .gmo files)
0 string \336\22\4\225 GNU message catalog (little endian), 0 string \336\22\4\225 GNU message catalog (little endian),
>4 lelong x revision %d, >6 leshort x revision %d.
>8 lelong x %d messages >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 string \225\4\22\336 GNU message catalog (big endian), 0 string \225\4\22\336 GNU message catalog (big endian),
>4 belong x revision %d, >4 beshort x revision %d.
>8 belong x %d messages >6 beshort >0 \b%d,
# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk> >>8 belong x %d messages,
0 string *nazgul* Nazgul style compiled message catalog >>36 belong x %d sysdep messages
>8 lelong >0 \b, version %ld >6 beshort =0 \b%d,
>>8 belong x %d messages
# GnuPG # GnuPG
# The format is very similar to pgp # The format is very similar to pgp
@ -42,3 +51,7 @@
# Files produced by GNU gettext # Files produced by GNU gettext
0 long 0xDE120495 GNU-format message catalog data 0 long 0xDE120495 GNU-format message catalog data
0 long 0x950412DE GNU-format message catalog data 0 long 0x950412DE GNU-format message catalog data
# gettext message catalogue
0 regex \^msgid\ GNU gettext message catalogue text
!:mime text/x-po

View file

@ -0,0 +1,13 @@
#------------------------------------------------------------------------------
# $File: guile,v 1.1 2011/12/16 17:44:33 christos Exp $
# Guile file magic from <dalepsmith@gmail.com>
# http://www.gnu.org/s/guile/
# http://git.savannah.gnu.org/gitweb/?p=guile.git;f=libguile/_scm.h;hb=HEAD#l250
0 string GOOF---- Guile Object
>8 string LE \b, little endian
>8 string BE \b, big endian
>11 string 4 \b, 32bit
>11 string 8 \b, 64bit
>13 regex .\.. \b, bytecode v%s

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: images,v 1.70 2010/11/25 15:00:12 christos Exp $ # $File: images,v 1.72 2011/12/08 12:12:46 rrt Exp $
# images: file(1) magic for image formats (see also "iff", and "c-lang" for # images: file(1) magic for image formats (see also "iff", and "c-lang" for
# XPM bitmaps) # XPM bitmaps)
# #
@ -90,6 +90,11 @@
0 string II\x2a\x00 TIFF image data, little-endian 0 string II\x2a\x00 TIFF image data, little-endian
!:mime image/tiff !:mime image/tiff
0 string MM\x00\x2b Big TIFF image data, big-endian
!:mime image/tiff
0 string II\x2b\x00 Big TIFF image data, little-endian
!:mime image/tiff
# PNG [Portable Network Graphics, or "PNG's Not GIF"] images # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
# (Greg Roelofs, newt@uchicago.edu) # (Greg Roelofs, newt@uchicago.edu)
# (Albert Cahalan, acahalan@cs.uml.edu) # (Albert Cahalan, acahalan@cs.uml.edu)
@ -228,8 +233,8 @@
#0 string BA PC bitmap array data #0 string BA PC bitmap array data
# XPM icons (Greg Roelofs, newt@uchicago.edu) # XPM icons (Greg Roelofs, newt@uchicago.edu)
# note possible collision with C/REXX entry in c-lang; currently commented out
0 search/1 /*\ XPM\ */ X pixmap image text 0 search/1 /*\ XPM\ */ X pixmap image text
!:mime image/x-xpmi
# Utah Raster Toolkit RLE images (janl@ifi.uio.no) # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
0 leshort 0xcc52 RLE image data, 0 leshort 0xcc52 RLE image data,

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------ #------------------------------------------------------------
# $File: java,v 1.12 2009/09/19 16:28:10 christos Exp $ # $File: java,v 1.13 2011/12/08 12:12:46 rrt Exp $
# Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the # Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
# same magic number, 0xcafebabe, so they are both handled # same magic number, 0xcafebabe, so they are both handled
# in the entry called "cafebabe". # in the entry called "cafebabe".
@ -24,3 +24,6 @@
>0 regex dey\n[0-9][0-9][0-9]\0 Dalvik dex file (optimized for host) >0 regex dey\n[0-9][0-9][0-9]\0 Dalvik dex file (optimized for host)
>4 string >000 version %s >4 string >000 version %s
# Java source
0 regex ^import.*;$ Java source
!:mime text/x-java

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: linux,v 1.41 2011/04/20 18:57:10 christos Exp $ # $File: linux,v 1.42 2012/02/07 21:35:03 christos Exp $
# linux: file(1) magic for Linux files # linux: file(1) magic for Linux files
# #
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@ -182,6 +182,11 @@
>>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel >>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel
>>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel >>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel
# Linux ARM compressed kernel image
# From: Kevin Cernekee <cernekee@gmail.com>
36 lelong 0x016f2818 Linux kernel ARM boot executable zImage (little-endian)
36 belong 0x016f2818 Linux kernel ARM boot executable zImage (big-endian)
############################################################################ ############################################################################
# Linux 8086 executable # Linux 8086 executable
0 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 0 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless

View file

@ -0,0 +1,6 @@
#------------------------------------------------------------------------------
# $File: m4,v 1.1 2011/12/08 12:12:46 rrt Exp $
# make: file(1) magic for M4 scripts
#
0 regex \^dnl\ M4 macro processor script text
!:mime text/x-m4

View file

@ -1,11 +1,9 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: mail.news,v 1.19 2011/01/25 13:55:57 christos Exp $ # $File: mail.news,v 1.20 2011/12/08 12:12:46 rrt Exp $
# mail.news: file(1) magic for mail and news # mail.news: file(1) magic for mail and news
# #
# Unfortunately, saved netnews also has From line added in some news software. # Unfortunately, saved netnews also has From line added in some news software.
#0 string From mail text #0 string From mail text
# There are tests to ascmagic.c to cope with mail and news.
0 string/t Relay-Version: old news text 0 string/t Relay-Version: old news text
!:mime message/rfc822 !:mime message/rfc822
0 string/t #!\ rnews batched news text 0 string/t #!\ rnews batched news text
@ -16,7 +14,9 @@
!:mime message/rfc822 !:mime message/rfc822
0 string/t Pipe\ to mail piping text 0 string/t Pipe\ to mail piping text
!:mime message/rfc822 !:mime message/rfc822
0 string/t Return-Path: smtp mail text 0 string/t Delivered-To: SMTP mail text
!:mime message/rfc822
0 string/t Return-Path: SMTP mail text
!:mime message/rfc822 !:mime message/rfc822
0 string/t Path: news text 0 string/t Path: news text
!:mime message/news !:mime message/news

View file

@ -0,0 +1,15 @@
#------------------------------------------------------------------------------
# $File: make,v 1.1 2011/12/08 12:12:46 rrt Exp $
# make: file(1) magic for makefiles
#
0 regex \^CFLAGS makefile script text
!:mime text/x-makefile
0 regex \^LDFLAGS makefile script text
!:mime text/x-makefile
0 regex \^all: makefile script text
!:mime text/x-makefile
0 regex \^.PRECIOUS makefile script text
!:mime text/x-makefile
0 regex \^SUBDIRS automake makefile script text
!:mime text/x-makefile

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: msdos,v 1.75 2011/08/08 08:56:17 christos Exp $ # $File: msdos,v 1.77 2011/12/07 22:05:05 christos Exp $
# msdos: file(1) magic for MS-DOS files # msdos: file(1) magic for MS-DOS files
# #
@ -41,7 +41,7 @@
# #
# Many of the compressed formats were extraced from IDARC 1.23 source code. # Many of the compressed formats were extraced from IDARC 1.23 source code.
# #
0 string MZ 0 string/b MZ
!:mime application/x-dosexec !:mime application/x-dosexec
# All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file. # All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file.
>0x18 leshort <0x40 MS-DOS executable >0x18 leshort <0x40 MS-DOS executable
@ -294,7 +294,7 @@
# added by Joerg Jenderek of http://www.freedos.org/software/?prog=kc # added by Joerg Jenderek of http://www.freedos.org/software/?prog=kc
# and http://www.freedos.org/software/?prog=kpdos # and http://www.freedos.org/software/?prog=kpdos
# for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD # for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD
0 string KCF FreeDOS KEYBoard Layout collection 0 string/b KCF FreeDOS KEYBoard Layout collection
# only version=0x100 found # only version=0x100 found
>3 uleshort x \b, version 0x%x >3 uleshort x \b, version 0x%x
# length of string containing author,info and special characters # length of string containing author,info and special characters
@ -305,7 +305,7 @@
#>>>&0 string x \b%-s #>>>&0 string x \b%-s
>>>&0 string x \b%-.15s >>>&0 string x \b%-.15s
# for FreeDOS *.KL files # for FreeDOS *.KL files
0 string KLF FreeDOS KEYBoard Layout file 0 string/b KLF FreeDOS KEYBoard Layout file
# only version=0x100 or 0x101 found # only version=0x100 or 0x101 found
>3 uleshort x \b, version 0x%x >3 uleshort x \b, version 0x%x
# stringlength # stringlength
@ -402,12 +402,12 @@
# byte 0xeb conflicts with "sequent" magic leshort 0xn2eb # byte 0xeb conflicts with "sequent" magic leshort 0xn2eb
0 ubeshort&0xeb8d >0xeb00 0 ubeshort&0xeb8d >0xeb00
# DR-DOS STACKER.COM SCREATE.SYS missed # DR-DOS STACKER.COM SCREATE.SYS missed
>0 byte 0xeb DOS executable (COM) >0 byte 0xeb
>>0x1FE leshort 0xAA55 \b, boot code >>0x1FE leshort 0xAA55 DOS executable (COM), boot code
>>85 string UPX \b, UPX compressed >>85 string UPX DOS executable (COM), UPX compressed
>>4 string \ $ARX \b, ARX self-extracting archive >>4 string \ $ARX DOS executable (COM), ARX self-extracting archive
>>4 string \ $LHarc \b, LHarc self-extracting archive >>4 string \ $LHarc DOS executable (COM), LHarc self-extracting archive
>>0x20e string SFX\ by\ LARC \b, LARC self-extracting archive >>0x20e string SFX\ by\ LARC DOS executable (COM), LARC self-extracting archive
# updated by Joerg Jenderek at Oct 2008 # updated by Joerg Jenderek at Oct 2008
#0 byte 0xb8 COM executable #0 byte 0xb8 COM executable
0 uleshort&0x80ff 0x00b8 0 uleshort&0x80ff 0x00b8
@ -421,11 +421,11 @@
# syslinux:doc/comboot.txt # syslinux:doc/comboot.txt
# A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov # A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov
# eax,21cd4cfeh) as a magic number. # eax,21cd4cfeh) as a magic number.
0 string \xb8\xfe\x4c\xcd\x21 COM executable (COM32R) 0 string/b \xb8\xfe\x4c\xcd\x21 COM executable (COM32R)
# start with assembler instructions mov eax,21cd4cfeh # start with assembler instructions mov eax,21cd4cfeh
0 uleshort&0xc0ff 0xc0b8 0 uleshort&0xc0ff 0xc0b8
>1 lelong 0x21cd4cfe COM executable (32-bit COMBOOT, relocatable) >1 lelong 0x21cd4cfe COM executable (32-bit COMBOOT, relocatable)
0 string \x81\xfc 0 string/b \x81\xfc
>4 string \x77\x02\xcd\x20\xb9 >4 string \x77\x02\xcd\x20\xb9
>>36 string UPX! FREE-DOS executable (COM), UPX compressed >>36 string UPX! FREE-DOS executable (COM), UPX compressed
252 string Must\ have\ DOS\ version DR-DOS executable (COM) 252 string Must\ have\ DOS\ version DR-DOS executable (COM)
@ -466,16 +466,16 @@
# FIXME: missing diet .com compression # FIXME: missing diet .com compression
# miscellaneous formats # miscellaneous formats
0 string LZ MS-DOS executable (built-in) 0 string/b LZ MS-DOS executable (built-in)
#0 byte 0xf0 MS-DOS program library data #0 byte 0xf0 MS-DOS program library data
# #
# AAF files: # AAF files:
# <stuartc@rd.bbc.co.uk> Stuart Cunningham # <stuartc@rd.bbc.co.uk> Stuart Cunningham
0 string \320\317\021\340\241\261\032\341AAFB\015\000OM\006\016\053\064\001\001\001\377 AAF legacy file using MS Structured Storage 0 string/b \320\317\021\340\241\261\032\341AAFB\015\000OM\006\016\053\064\001\001\001\377 AAF legacy file using MS Structured Storage
>30 byte 9 (512B sectors) >30 byte 9 (512B sectors)
>30 byte 12 (4kB sectors) >30 byte 12 (4kB sectors)
0 string \320\317\021\340\241\261\032\341\001\002\001\015\000\002\000\000\006\016\053\064\003\002\001\001 AAF file using MS Structured Storage 0 string/b \320\317\021\340\241\261\032\341\001\002\001\015\000\002\000\000\006\016\053\064\003\002\001\001 AAF file using MS Structured Storage
>30 byte 9 (512B sectors) >30 byte 9 (512B sectors)
>30 byte 12 (4kB sectors) >30 byte 12 (4kB sectors)
@ -491,14 +491,14 @@
0 belong 0x31be0000 Microsoft Word Document 0 belong 0x31be0000 Microsoft Word Document
!:mime application/msword !:mime application/msword
# #
0 string PO^Q` Microsoft Word 6.0 Document 0 string/b PO^Q` Microsoft Word 6.0 Document
!:mime application/msword !:mime application/msword
# #
0 string \376\067\0\043 Microsoft Office Document 0 string/b \376\067\0\043 Microsoft Office Document
!:mime application/msword !:mime application/msword
0 string \333\245-\0\0\0 Microsoft Office Document 0 string/b \333\245-\0\0\0 Microsoft Office Document
!:mime application/msword !:mime application/msword
512 string \354\245\301 Microsoft Word Document 512 string/b \354\245\301 Microsoft Word Document
!:mime application/msword !:mime application/msword
# #
2080 string Microsoft\ Excel\ 5.0\ Worksheet %s 2080 string Microsoft\ Excel\ 5.0\ Worksheet %s
@ -513,7 +513,7 @@
# Italian MS-Excel # Italian MS-Excel
2121 string Biff5 Microsoft Excel 5.0 Worksheet 2121 string Biff5 Microsoft Excel 5.0 Worksheet
!:mime application/vnd.ms-excel !:mime application/vnd.ms-excel
0 string \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet 0 string/b \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet
!:mime application/vnd.ms-excel !:mime application/vnd.ms-excel
# #
0 belong 0x00001a00 Lotus 1-2-3 0 belong 0x00001a00 Lotus 1-2-3
@ -527,9 +527,9 @@
!:mime application/x-123 !:mime application/x-123
>4 belong 0x06040600 wk1 document data >4 belong 0x06040600 wk1 document data
>4 belong 0x06800200 fmt document data >4 belong 0x06800200 fmt document data
0 string WordPro\0 Lotus WordPro 0 string/b WordPro\0 Lotus WordPro
!:mime application/vnd.lotus-wordpro !:mime application/vnd.lotus-wordpro
0 string WordPro\r\373 Lotus WordPro 0 string/b WordPro\r\373 Lotus WordPro
!:mime application/vnd.lotus-wordpro !:mime application/vnd.lotus-wordpro
@ -542,17 +542,17 @@
# Winamp .avs # Winamp .avs
#0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player #0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player
0 string Nullsoft\ AVS\ Preset\ Winamp plug in 0 string/b Nullsoft\ AVS\ Preset\ Winamp plug in
# Windows Metafont .WMF # Windows Metafont .WMF
0 string \327\315\306\232 ms-windows metafont .wmf 0 string/b \327\315\306\232 ms-windows metafont .wmf
0 string \002\000\011\000 ms-windows metafont .wmf 0 string/b \002\000\011\000 ms-windows metafont .wmf
0 string \001\000\011\000 ms-windows metafont .wmf 0 string/b \001\000\011\000 ms-windows metafont .wmf
#tz3 files whatever that is (MS Works files) #tz3 files whatever that is (MS Works files)
0 string \003\001\001\004\070\001\000\000 tz3 ms-works file 0 string/b \003\001\001\004\070\001\000\000 tz3 ms-works file
0 string \003\002\001\004\070\001\000\000 tz3 ms-works file 0 string/b \003\002\001\004\070\001\000\000 tz3 ms-works file
0 string \003\003\001\004\070\001\000\000 tz3 ms-works file 0 string/b \003\003\001\004\070\001\000\000 tz3 ms-works file
# PGP sig files .sig # PGP sig files .sig
#0 string \211\000\077\003\005\000\063\237\127 065 to \027\266\151\064\005\045\101\233\021\002 PGP sig #0 string \211\000\077\003\005\000\063\237\127 065 to \027\266\151\064\005\045\101\233\021\002 PGP sig
@ -564,14 +564,14 @@
0 string \211\000\225\003\005\000\062\122\207\304\100\345\042 PGP sig 0 string \211\000\225\003\005\000\062\122\207\304\100\345\042 PGP sig
# windows zips files .dmf # windows zips files .dmf
0 string MDIF\032\000\010\000\000\000\372\046\100\175\001\000\001\036\001\000 MS Windows special zipped file 0 string/b MDIF\032\000\010\000\000\000\372\046\100\175\001\000\001\036\001\000 MS Windows special zipped file
#ico files #ico files
0 string \102\101\050\000\000\000\056\000\000\000\000\000\000\000 Icon for MS Windows 0 string/b \102\101\050\000\000\000\056\000\000\000\000\000\000\000 Icon for MS Windows
# Windows icons (Ian Springer <ips@fpk.hp.com>) # Windows icons (Ian Springer <ips@fpk.hp.com>)
0 string \000\000\001\000 MS Windows icon resource 0 string/b \000\000\001\000 MS Windows icon resource
!:mime image/x-icon !:mime image/x-icon
>4 byte 1 - 1 icon >4 byte 1 - 1 icon
>4 byte >1 - %d icons >4 byte >1 - %d icons
@ -582,13 +582,13 @@
# .chr files # .chr files
0 string PK\010\010BGI Borland font 0 string/b PK\010\010BGI Borland font
>4 string >\0 %s >4 string >\0 %s
# then there is a copyright notice # then there is a copyright notice
# .bgi files # .bgi files
0 string pk\010\010BGI Borland device 0 string/b pk\010\010BGI Borland device
>4 string >\0 %s >4 string >\0 %s
# then there is a copyright notice # then there is a copyright notice
@ -703,28 +703,28 @@
!:mime application/vnd.ms-tnef !:mime application/vnd.ms-tnef
# HtmlHelp files (.chm) # HtmlHelp files (.chm)
0 string ITSF\003\000\000\000\x60\000\000\000\001\000\000\000 MS Windows HtmlHelp Data 0 string/b ITSF\003\000\000\000\x60\000\000\000\001\000\000\000 MS Windows HtmlHelp Data
# GFA-BASIC (Wolfram Kleff) # GFA-BASIC (Wolfram Kleff)
2 string GFA-BASIC3 GFA-BASIC 3 data 2 string/b GFA-BASIC3 GFA-BASIC 3 data
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# From Stuart Caie <kyzer@4u.net> (developer of cabextract) # From Stuart Caie <kyzer@4u.net> (developer of cabextract)
# Microsoft Cabinet files # Microsoft Cabinet files
0 string MSCF\0\0\0\0 Microsoft Cabinet archive data 0 string/b MSCF\0\0\0\0 Microsoft Cabinet archive data
!:mime application/vnd.ms-cab-compressed !:mime application/vnd.ms-cab-compressed
>8 lelong x \b, %u bytes >8 lelong x \b, %u bytes
>28 leshort 1 \b, 1 file >28 leshort 1 \b, 1 file
>28 leshort >1 \b, %u files >28 leshort >1 \b, %u files
# InstallShield Cabinet files # InstallShield Cabinet files
0 string ISc( InstallShield Cabinet archive data 0 string/b ISc( InstallShield Cabinet archive data
>5 byte&0xf0 =0x60 version 6, >5 byte&0xf0 =0x60 version 6,
>5 byte&0xf0 !0x60 version 4/5, >5 byte&0xf0 !0x60 version 4/5,
>(12.l+40) lelong x %u files >(12.l+40) lelong x %u files
# Windows CE package files # Windows CE package files
0 string MSCE\0\0\0\0 Microsoft WinCE install header 0 string/b MSCE\0\0\0\0 Microsoft WinCE install header
>20 lelong 0 \b, architecture-independent >20 lelong 0 \b, architecture-independent
>20 lelong 103 \b, Hitachi SH3 >20 lelong 103 \b, Hitachi SH3
>20 lelong 104 \b, Hitachi SH4 >20 lelong 104 \b, Hitachi SH4
@ -748,7 +748,7 @@
>>44 ulelong x version 0x%x >>44 ulelong x version 0x%x
# From: Alex Beregszaszi <alex@fsn.hu> # From: Alex Beregszaszi <alex@fsn.hu>
0 string COWD VMWare3 0 string/b COWD VMWare3
>4 byte 3 disk image >4 byte 3 disk image
>>32 lelong x (%d/ >>32 lelong x (%d/
>>36 lelong x \b%d/ >>36 lelong x \b%d/
@ -756,8 +756,8 @@
>4 byte 2 undoable disk image >4 byte 2 undoable disk image
>>32 string >\0 (%s) >>32 string >\0 (%s)
0 string VMDK VMware4 disk image 0 string/b VMDK VMware4 disk image
0 string KDMV VMware4 disk image 0 string/b KDMV VMware4 disk image
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Qemu Emulator Images # Qemu Emulator Images
@ -765,11 +765,11 @@
# Updated by Adam Buchbinder (adam.buchbinder@gmail.com) # Updated by Adam Buchbinder (adam.buchbinder@gmail.com)
# Made by reading sources, reading documentation, and doing trial and error # Made by reading sources, reading documentation, and doing trial and error
# on existing QCOW files # on existing QCOW files
0 string QFI\xFB QEMU QCOW Image 0 string/b QFI\xFB QEMU QCOW Image
# Uncomment the following line to display Magic (only used for debugging # Uncomment the following line to display Magic (only used for debugging
# this magic number) # this magic number)
#>0 string x , Magic: %s #>0 string/b x , Magic: %s
# There are currently 2 Versions: "1" and "2". # There are currently 2 Versions: "1" and "2".
# http://www.gnome.org/~markmc/qcow-image-format-version-1.html # http://www.gnome.org/~markmc/qcow-image-format-version-1.html
@ -813,9 +813,9 @@
>4 default x (unknown version) >4 default x (unknown version)
0 string QEVM QEMU suspend to disk image 0 string/b QEVM QEMU suspend to disk image
0 string Bochs\ Virtual\ HD\ Image Bochs disk image, 0 string/b Bochs\ Virtual\ HD\ Image Bochs disk image,
>32 string x type %s, >32 string x type %s,
>48 string x subtype %s >48 string x subtype %s
@ -823,8 +823,8 @@
# from http://filext.com by Derek M Jones <derek@knosof.co.uk> # from http://filext.com by Derek M Jones <derek@knosof.co.uk>
# False positive with PPT (also currently this string is too long) # False positive with PPT (also currently this string is too long)
#0 string \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 \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 \320\317\021\340\241\261\032\341 Microsoft Office Document 0 string/b \320\317\021\340\241\261\032\341 Microsoft Office Document
#>48 byte 0x1B Excel Document #>48 byte 0x1B Excel Document
#!:mime application/vnd.ms-excel #!:mime application/vnd.ms-excel
>546 string bjbj Microsoft Word Document >546 string bjbj Microsoft Word Document
@ -832,7 +832,7 @@
>546 string jbjb Microsoft Word Document >546 string jbjb Microsoft Word Document
!:mime application/msword !:mime application/msword
0 string \224\246\056 Microsoft Word Document 0 string/b \224\246\056 Microsoft Word Document
!:mime application/msword !:mime application/msword
512 string R\0o\0o\0t\0\ \0E\0n\0t\0r\0y Microsoft Word Document 512 string R\0o\0o\0t\0\ \0E\0n\0t\0r\0y Microsoft Word Document
@ -841,7 +841,7 @@
# From: "Nelson A. de Oliveira" <naoliv@gmail.com> # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
# Magic type for Dell's BIOS .hdr files # Magic type for Dell's BIOS .hdr files
# Dell's .hdr # Dell's .hdr
0 string $RBU 0 string/b $RBU
>23 string Dell %s system BIOS >23 string Dell %s system BIOS
>5 byte 2 >5 byte 2
>>48 byte x version %d. >>48 byte x version %d.
@ -853,7 +853,7 @@
# Type: Microsoft DirectDraw Surface # Type: Microsoft DirectDraw Surface
# URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp # URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
# From: Morten Hustveit <morten@debian.org> # From: Morten Hustveit <morten@debian.org>
0 string DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS), 0 string/b DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS),
>16 lelong >0 %hd x >16 lelong >0 %hd x
>12 lelong >0 %hd, >12 lelong >0 %hd,
>84 string x %.4s >84 string x %.4s
@ -864,13 +864,13 @@
0 short 0x5045 Microsoft Document Imaging Format 0 short 0x5045 Microsoft Document Imaging Format
# MS eBook format (.lit) # MS eBook format (.lit)
0 string ITOLITLS Microsoft Reader eBook Data 0 string/b ITOLITLS Microsoft Reader eBook Data
>8 lelong x \b, version %u >8 lelong x \b, version %u
!:mime application/x-ms-reader !:mime application/x-ms-reader
# Windows CE Binary Image Data Format # Windows CE Binary Image Data Format
# From: Dr. Jesus <j@hug.gs> # From: Dr. Jesus <j@hug.gs>
0 string B000FF\n Windows Embedded CE binary image 0 string/b B000FF\n Windows Embedded CE binary image
# Windows Imaging (WIM) Image # Windows Imaging (WIM) Image
0 string MSWIM\000\000\000 Windows imaging (WIM) image 0 string/b MSWIM\000\000\000 Windows imaging (WIM) image

View file

@ -0,0 +1,17 @@
#------------------------------------------------------------------------------
# $File: music,v 1.1 2011/11/25 03:28:17 christos Exp $
# music: file (1) magic for music formats
# BWW format used by Bagpipe Music Writer Gold by Robert MacNeil Musicworks
# and Bagpipe Writer by Doug Wickstrom
#
0 string Bagpipe Bagpipe
>8 string Reader Reader
>>15 string >\0 (version %.3s)
>8 string Music\ Writer Music Writer
>>20 string :
>>>21 string >\0 (version %.3s)
>>21 string Gold Gold
>>>25 string :
>>>>26 string >\0 (version %.3s)

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: netbsd,v 1.18 2009/09/19 16:28:11 christos Exp $ # $File: netbsd,v 1.19 2011/10/31 17:23:34 christos Exp $
# netbsd: file(1) magic for NetBSD objects # netbsd: file(1) magic for NetBSD objects
# #
# All new-style magic numbers are in network byte order. # All new-style magic numbers are in network byte order.
@ -245,3 +245,42 @@
0 belong&0377777777 043600507 a.out NetBSD/arm core 0 belong&0377777777 043600507 a.out NetBSD/arm core
>12 string >\0 from '%s' >12 string >\0 from '%s'
>32 lelong !0 (signal %d) >32 lelong !0 (signal %d)
# Kernel core dump format
0 belong&0x0000ffff 0x00008fca NetBSD kernel core file
>0 belong&0x03ff0000 0x00000000 \b, Unknown
>0 belong&0x03ff0000 0x00001000 \b, sun 68010/68020
>0 belong&0x03ff0000 0x00020000 \b, sun 68020
>0 belong&0x03ff0000 0x00640000 \b, 386 PC
>0 belong&0x03ff0000 0x00860000 \b, i386 BSD
>0 belong&0x03ff0000 0x00870000 \b, m68k BSD (8K pages)
>0 belong&0x03ff0000 0x00880000 \b, m68k BSD (4K pages)
>0 belong&0x03ff0000 0x00890000 \b, ns32532 BSD
>0 belong&0x03ff0000 0x008a0000 \b, sparc/32 BSD
>0 belong&0x03ff0000 0x008b0000 \b, pmax BSD
>0 belong&0x03ff0000 0x008c0000 \b, vax BSD (1K pages)
>0 belong&0x03ff0000 0x008d0000 \b, alpha BSD
>0 belong&0x03ff0000 0x008e0000 \b, mips BSD (Big Endian)
>0 belong&0x03ff0000 0x008f0000 \b, arm6 BSD
>0 belong&0x03ff0000 0x00900000 \b, m68k BSD (2K pages)
>0 belong&0x03ff0000 0x00910000 \b, sh3 BSD
>0 belong&0x03ff0000 0x00920000 \b, ppc BSD (Big Endian)
>0 belong&0x03ff0000 0x00930000 \b, vax BSD (4K pages)
>0 belong&0x03ff0000 0x00940000 \b, mips1 BSD
>0 belong&0x03ff0000 0x00950000 \b, mips2 BSD
>0 belong&0x03ff0000 0x00960000 \b, parisc BSD
>0 belong&0x03ff0000 0x00970000 \b, sh5/64 BSD
>0 belong&0x03ff0000 0x00980000 \b, sparc/64 BSD
>0 belong&0x03ff0000 0x00990000 \b, amd64 BSD
>0 belong&0x03ff0000 0x009a0000 \b, hp200 (68010) BSD
>0 belong&0x03ff0000 0x009b0000 \b, hp300 (68020+68881) BSD
>0 belong&0x03ff0000 0x009b0000 \b, hp300 (68020+68881) BSD
>0 belong&0x03ff0000 0x00c80000 \b, hp200
>0 belong&0x03ff0000 0x020b0000 \b, hp300 (68020+68881) HP-UX
>0 belong&0x03ff0000 0x020c0000 \b, hp300 (68020+68881) HP-UX
>0 belong&0xfc000000 0x04000000 \b, CPU
>0 belong&0xfc000000 0x08000000 \b, DATA
>0 belong&0xfc000000 0x10000000 \b, STACK
>4 leshort x \b, (headersize = %d
>6 leshort x \b, segmentsize = %d
>6 lelong x \b, segments = %d)

View file

@ -1,65 +1,72 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: palm,v 1.7 2009/09/19 16:28:11 christos Exp $ # $File: palm,v 1.9 2012/01/16 15:16:43 christos Exp $
# palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks # palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
# #
# Brian Lalor <blalor@hcirisc.cs.binghamton.edu> # Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
# These are weak, byte 59 is not guaranteed to be 0 and there are
# 8 character identifiers at byte 60, one I found for appl is BIGb.
# What are the possibilities and where is this documented?
# appl # appl
60 belong 0x6170706c PalmOS application #59 byte \0
>0 string >\0 "%s" #>60 string appl PalmOS application
#>0 string >\0 "%s"
# TEXt # TEXt
60 belong 0x54455874 AportisDoc file #59 byte \0
>0 string >\0 "%s" #>60 belong TEXt AportisDoc file
#>0 string >\0 "%s"
# HACK # HACK
60 belong 0x4841434b HackMaster hack #59 byte \0
>0 string >\0 "%s" #>60 string HACK HackMaster hack
#>0 string >\0 "%s"
# Variety of PalmOS document types # Variety of PalmOS document types
# Michael-John Turner <mj@debian.org> # Michael-John Turner <mj@debian.org>
# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType # Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType
60 string BVokBDIC BDicty PalmOS document 60 string BVokBDIC BDicty PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DB99DBOS DB PalmOS document 60 string DB99DBOS DB PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string vIMGView FireViewer/ImageViewer PalmOS document 60 string vIMGView FireViewer/ImageViewer PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string PmDBPmDB HanDBase PalmOS document 60 string PmDBPmDB HanDBase PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string InfoINDB InfoView PalmOS document 60 string InfoINDB InfoView PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string ToGoToGo iSilo PalmOS document 60 string ToGoToGo iSilo PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string JfDbJBas JFile PalmOS document 60 string JfDbJBas JFile PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string JfDbJFil JFile Pro PalmOS document 60 string JfDbJFil JFile Pro PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DATALSdb List PalmOS document 60 string DATALSdb List PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string Mdb1Mdb1 MobileDB PalmOS document 60 string Mdb1Mdb1 MobileDB PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string PNRdPPrs PeanutPress PalmOS document 60 string PNRdPPrs PeanutPress PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DataPlkr Plucker PalmOS document 60 string DataPlkr Plucker PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DataSprd QuickSheet PalmOS document 60 string DataSprd QuickSheet PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string SM01SMem SuperMemo PalmOS document 60 string SM01SMem SuperMemo PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string TEXtTlDc TealDoc PalmOS document 60 string TEXtTlDc TealDoc PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string InfoTlIf TealInfo PalmOS document 60 string InfoTlIf TealInfo PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DataTlMl TealMeal PalmOS document 60 string DataTlMl TealMeal PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string DataTlPt TealPaint PalmOS document 60 string DataTlPt TealPaint PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string dataTDBP ThinkDB PalmOS document 60 string dataTDBP ThinkDB PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string TdatTide Tides PalmOS document 60 string TdatTide Tides PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
60 string ToRaTRPW TomeRaider PalmOS document 60 string ToRaTRPW TomeRaider PalmOS document
>0 string >\0 "%s" >0 string >\0 "%s"
# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net) # A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net)
# For version 1.xx zTXTs, outputs version and numbers of bookmarks and # For version 1.xx zTXTs, outputs version and numbers of bookmarks and
@ -88,5 +95,5 @@
>0 string >\0 "%s" >0 string >\0 "%s"
# Mobipocket (www.mobipocket.com), donated by Carl Witty # Mobipocket (www.mobipocket.com), donated by Carl Witty
60 string BOOKMOBI Mobipocket E-book 60 string BOOKMOBI Mobipocket E-book
>0 string >\0 "%s" >0 string >\0 "%s"

View file

@ -0,0 +1,10 @@
#------------------------------------------------------------------------------
# $File: pascal,v 1.1 2011/12/08 12:12:46 rrt Exp $
# pascal: file(1) magic for Pascal source
#
0 search/8192 (input, Pascal source text
!:mime text/x-pascal
0 regex \^program Pascal source text
!:mime text/x-pascal
0 regex \^record Pascal source text
!:mime text/x-pascal

View file

@ -1,6 +1,5 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: perl,v 1.16 2009/09/19 16:28:11 christos Exp $ # $File: perl,v 1.17 2011/12/16 16:24:40 rrt Exp $
# perl: file(1) magic for Larry Wall's perl language. # perl: file(1) magic for Larry Wall's perl language.
# #
# The `eval' lines recognizes an outrageously clever hack. # The `eval' lines recognizes an outrageously clever hack.
@ -20,7 +19,10 @@
!:mime text/x-perl !:mime text/x-perl
0 search/1 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text 0 search/1 eval\ '(exit\ $?0)'\ &&\ eval\ 'exec Perl script text
!:mime text/x-perl !:mime text/x-perl
0 search/1 #!/usr/bin/env\ perl Perl script text executable
!:mime text/x-perl
0 search/1 #!\ /usr/bin/env\ perl Perl script text executable
!:mime text/x-perl
# by Dmitry V. Levin and Alexey Tourbin # by Dmitry V. Levin and Alexey Tourbin
# check the first line # check the first line

View file

@ -1,11 +1,12 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: python,v 1.18 2011/02/26 02:33:38 christos Exp $ # $File: python,v 1.20 2011/12/13 13:53:14 christos Exp $
# python: file(1) magic for python # python: file(1) magic for python
# #
# Outlook puts """ too for urgent messages
# From: David Necas <yeti@physics.muni.cz> # From: David Necas <yeti@physics.muni.cz>
# often the module starts with a multiline string # often the module starts with a multiline string
0 string/t """ a python script text executable 0 string/t """ Python script text executable
# MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming # MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming
# that Py_UnicodeFlag is off for Python 2) # that Py_UnicodeFlag is off for Python 2)
# 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n" # 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n"

View file

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: sgml,v 1.26 2011/04/16 15:20:04 christos Exp $ # $File: sgml,v 1.27 2011/12/07 12:01:24 rrt Exp $
# Type: SVG Vectorial Graphics # Type: SVG Vectorial Graphics
# From: Noel Torres <tecnico@ejerciciosresueltos.com> # From: Noel Torres <tecnico@ejerciciosresueltos.com>
0 string \<?xml\ version=" 0 string \<?xml\ version="
@ -18,15 +18,15 @@
# xhtml # xhtml
0 string/t \<?xml\ version=" 0 string/t \<?xml\ version="
>15 string >\0 >15 string >\0
>>19 search/4096/cWbt \<!doctype\ html xHTML document text >>19 search/4096/cWbt \<!doctype\ html XHTML document text
!:mime text/html !:mime text/html
0 string/t \<?xml\ version=' 0 string/t \<?xml\ version='
>15 string >\0 >15 string >\0
>>19 search/4096/cWbt \<!doctype\ html xHTML document text >>19 search/4096/cWbt \<!doctype\ html XHTML document text
!:mime text/html !:mime text/html
0 string/t \<?xml\ version=" 0 string/t \<?xml\ version="
>15 string >\0 >15 string >\0
>>19 search/4096/cWbt \<html broken xHTML document text >>19 search/4096/cWbt \<html broken XHTML document text
!:mime text/html !:mime text/html
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -1,16 +1,27 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: varied.script,v 1.7 2010/11/25 15:00:12 christos Exp $ # $File: varied.script,v 1.9 2011/12/16 16:32:48 rrt Exp $
# varied.script: file(1) magic for various interpreter scripts # varied.script: file(1) magic for various interpreter scripts
0 string/t #!\ / a 0 string/t #!\ / a
>3 string >\0 %s script text executable >3 string >\0 %s script text executable
!:strength / 2
0 string/t #!\t/ a 0 string/t #!\t/ a
>3 string >\0 %s script text executable >3 string >\0 %s script text executable
!:strength / 2
0 string/t #!/ a 0 string/t #!/ a
>2 string >\0 %s script text executable >2 string >\0 %s script text executable
!:strength / 2
0 string/t #!\ script text executable 0 string/t #!\ script text executable
>3 string >\0 for %s >3 string >\0 for %s
!:strength / 3
# using env
0 string/t #!/usr/bin/env a
>15 string/t >\0 %s script text executable
!:strength / 10
0 string/t #!\ /usr/bin/env a
>16 string/t >\0 %s script text executable
!:strength / 10
# From: arno <arenevier@fdn.fr> # From: arno <arenevier@fdn.fr>
# mozilla xpconnect typelib # mozilla xpconnect typelib

View file

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# $File: virtual,v 1.1 2009/12/25 16:04:30 christos Exp $ # $File: virtual,v 1.2 2011/11/22 13:30:05 christos Exp $
# From: James Nobis <quel@quelrod.net> # From: James Nobis <quel@quelrod.net>
# Microsoft hard disk images for: # Microsoft hard disk images for:
# Virtual Server # Virtual Server
@ -10,8 +10,8 @@
0 string conectix Microsoft Disk Image, Virtual Server or Virtual PC 0 string conectix Microsoft Disk Image, Virtual Server or Virtual PC
# Sun xVM VirtualBox Disk Image # Sun xVM VirtualBox Disk Image
# string <<< Sun xVM VirtualBox Disk Image >>> # From: Richard W.M. Jones <rich@annexia.org>
# .vdi # VirtualBox Disk Image
0 string \<\<\<\ Sun\ xVM\ VirtualBox\ Disk Sun xVM VirtualBox Disk Image 0x40 ulelong 0xbeda107f VirtualBox Disk Image
>0x44 uleshort >0 \b, major %u
>0x46 uleshort >0 \b, minor %u

96
external/bsd/file/dist/magic/magdir/zfs vendored Normal file
View file

@ -0,0 +1,96 @@
#------------------------------------------------------------------------------
# zfs: file(1) magic for ZFS dumps
#
# From <rea-fbsd@codelabs.ru>
# ZFS dump header has the following structure (as per zfs_ioctl.h
# in FreeBSD with drr_type is set to DRR_BEGIN)
#
# enum {
# DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
# DRR_WRITE, DRR_FREE, DRR_END,
# } drr_type;
# uint32_t drr_pad;
# uint64_t drr_magic;
# uint64_t drr_version;
# uint64_t drr_creation_time;
# dmu_objset_type_t drr_type;
# uint32_t drr_pad;
# uint64_t drr_toguid;
# uint64_t drr_fromguid;
# char drr_toname[MAXNAMELEN];
#
# Backup magic is 0x00000002f5bacbac (quad word)
# The drr_type is defined as
# typedef enum dmu_objset_type {
# DMU_OST_NONE,
# DMU_OST_META,
# DMU_OST_ZFS,
# DMU_OST_ZVOL,
# DMU_OST_OTHER, /* For testing only! */
# DMU_OST_ANY, /* Be careful! */
# DMU_OST_NUMTYPES
# } dmu_objset_type_t;
#
# Almost all uint64_t fields are printed as the 32-bit ones (with high
# 32 bits zeroed), because there is no simple way to print them as the
# full 64-bit values.
# Big-endian values
8 string \000\000\000\002\365\272\313\254 ZFS shapshot (big-endian machine),
>20 belong x version %lu,
>32 belong 0 type: NONE,
>32 belong 1 type: META,
>32 belong 2 type: ZFS,
>32 belong 3 type: ZVOL,
>32 belong 4 type: OTHER,
>32 belong 5 type: ANY,
>32 belong >5 type: UNKNOWN (%lu),
>40 byte x destination GUID: %02X
>41 byte x %02X
>42 byte x %02X
>43 byte x %02X
>44 byte x %02X
>45 byte x %02X
>46 byte x %02X
>47 byte x %02X,
>48 ulong >0
>>52 ulong >0
>>>48 byte x source GUID: %02X
>>>49 byte x %02X
>>>50 byte x %02X
>>>51 byte x %02X
>>>52 byte x %02X
>>>53 byte x %02X
>>>54 byte x %02X
>>>55 byte x %02X,
>56 string >\0 name: '%s'
# Little-endian values
8 string \254\313\272\365\002\000\000\000 ZFS shapshot (little-endian machine),
>16 lelong x version %lu,
>32 lelong 0 type: NONE,
>32 lelong 1 type: META,
>32 lelong 2 type: ZFS,
>32 lelong 3 type: ZVOL,
>32 lelong 4 type: OTHER,
>32 lelong 5 type: ANY,
>32 lelong >5 type: UNKNOWN (%lu),
>47 byte x destination GUID: %02X
>46 byte x %02X
>45 byte x %02X
>44 byte x %02X
>43 byte x %02X
>42 byte x %02X
>41 byte x %02X
>40 byte x %02X,
>48 ulong >0
>>52 ulong >0
>>>55 byte x source GUID: %02X
>>>54 byte x %02X
>>>53 byte x %02X
>>>52 byte x %02X
>>>51 byte x %02X
>>>50 byte x %02X
>>>49 byte x %02X
>>>48 byte x %02X,
>56 string >\0 name: '%s'

View file

@ -109,13 +109,17 @@ class Magic(object):
""" """
_close(self._magic_t) _close(self._magic_t)
def file(self, file): def file(self, filename):
""" """
Returns a textual description of the contents of the argument passed Returns a textual description of the contents of the argument passed
as a filename or None if an error occurred and the MAGIC_ERROR flag as a filename or None if an error occurred and the MAGIC_ERROR flag
is set. A call to errno() will return the numeric error code. is set. A call to errno() will return the numeric error code.
""" """
return _file(self._magic_t, file) try: # attempt python3 approach first
bi = bytes(filename, 'utf-8')
return str(_file(self._magic_t, bi), 'utf-8')
except:
return _file(self._magic_t, filename)
def descriptor(self, fd): def descriptor(self, fd):
""" """
@ -129,14 +133,20 @@ class Magic(object):
as a buffer or None if an error occurred and the MAGIC_ERROR flag as a buffer or None if an error occurred and the MAGIC_ERROR flag
is set. A call to errno() will return the numeric error code. is set. A call to errno() will return the numeric error code.
""" """
return _buffer(self._magic_t, buf, len(buf)) try: # attempt python3 approach first
return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
except:
return _buffer(self._magic_t, buf, len(buf))
def error(self): def error(self):
""" """
Returns a textual explanation of the last error or None Returns a textual explanation of the last error or None
if there was no error. if there was no error.
""" """
return _error(self._magic_t) try: # attempt python3 approach first
return str(_error(self._magic_t), 'utf-8')
except:
return _error(self._magic_t)
def setflags(self, flags): def setflags(self, flags):
""" """
@ -149,7 +159,7 @@ class Magic(object):
""" """
return _setflags(self._magic_t, flags) return _setflags(self._magic_t, flags)
def load(self, file=None): def load(self, filename=None):
""" """
Must be called to load entries in the colon separated list of database files Must be called to load entries in the colon separated list of database files
passed as argument or the default database file if no argument before passed as argument or the default database file if no argument before
@ -157,7 +167,7 @@ class Magic(object):
Returns 0 on success and -1 on failure. Returns 0 on success and -1 on failure.
""" """
return _load(self._magic_t, file) return _load(self._magic_t, filename)
def compile(self, dbs): def compile(self, dbs):
""" """

View file

@ -9,7 +9,7 @@ AM_CFLAGS = @WARNINGS@
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \ encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
funcs.c file.h names.h readelf.h tar.h apptype.c \ funcs.c file.h readelf.h tar.h apptype.c \
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
if MINGW if MINGW

View file

@ -248,7 +248,7 @@ AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
AM_CFLAGS = @WARNINGS@ AM_CFLAGS = @WARNINGS@
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \ encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
funcs.c file.h names.h readelf.h tar.h apptype.c \ funcs.c file.h readelf.h tar.h apptype.c \
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0

View file

@ -1,4 +1,4 @@
/* $NetBSD: apprentice.c,v 1.5 2011/09/16 21:06:26 christos Exp $ */ /* $NetBSD: apprentice.c,v 1.7 2012/04/07 17:30:55 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -35,9 +35,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: apprentice.c,v 1.170 2011/06/10 09:23:28 christos Exp $") FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
#else #else
__RCSID("$NetBSD: apprentice.c,v 1.5 2011/09/16 21:06:26 christos Exp $"); __RCSID("$NetBSD: apprentice.c,v 1.7 2012/04/07 17:30:55 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -218,7 +218,7 @@ static const struct type_tbl_s {
{ XX("ledouble"), FILE_LEDOUBLE, FILE_FMT_DOUBLE }, { XX("ledouble"), FILE_LEDOUBLE, FILE_FMT_DOUBLE },
{ XX("leid3"), FILE_LEID3, FILE_FMT_NUM }, { XX("leid3"), FILE_LEID3, FILE_FMT_NUM },
{ XX("beid3"), FILE_BEID3, FILE_FMT_NUM }, { XX("beid3"), FILE_BEID3, FILE_FMT_NUM },
{ XX("indirect"), FILE_INDIRECT, FILE_FMT_NONE }, { XX("indirect"), FILE_INDIRECT, FILE_FMT_NUM },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE }, { XX_NULL, FILE_INVALID, FILE_FMT_NONE },
# undef XX # undef XX
# undef XX_NULL # undef XX_NULL
@ -477,6 +477,9 @@ apprentice_magic_strength(const struct magic *m)
val += 8 * MULT; val += 8 * MULT;
break; break;
case FILE_INDIRECT:
break;
default: default:
val = 0; val = 0;
(void)fprintf(stderr, "Bad type %d\n", m->type); (void)fprintf(stderr, "Bad type %d\n", m->type);
@ -742,8 +745,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
break; break;
} }
} }
if (line) free(line);
free(line);
(void)fclose(f); (void)fclose(f);
} }
@ -796,6 +798,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
file_oomem(ms, file_oomem(ms,
strlen(fn) + strlen(d->d_name) + 2); strlen(fn) + strlen(d->d_name) + 2);
errs++; errs++;
closedir(dir);
goto out; goto out;
} }
if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) { if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
@ -810,6 +813,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
realloc(filearr, mlen))) == NULL) { realloc(filearr, mlen))) == NULL) {
file_oomem(ms, mlen); file_oomem(ms, mlen);
free(mfn); free(mfn);
closedir(dir);
errs++; errs++;
goto out; goto out;
} }
@ -2306,7 +2310,7 @@ private int
apprentice_compile(struct magic_set *ms, struct magic **magicp, apprentice_compile(struct magic_set *ms, struct magic **magicp,
uint32_t *nmagicp, const char *fn) uint32_t *nmagicp, const char *fn)
{ {
int fd; int fd = -1;
char *dbname; char *dbname;
int rv = -1; int rv = -1;
@ -2337,7 +2341,8 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp,
goto out; goto out;
} }
(void)close(fd); if (fd != -1)
(void)close(fd);
rv = 0; rv = 0;
out: out:
free(dbname); free(dbname);

View file

@ -1,4 +1,4 @@
/* $NetBSD: ascmagic.c,v 1.1.1.2 2011/05/12 20:46:52 christos Exp $ */ /* $NetBSD: ascmagic.c,v 1.1.1.3 2012/02/22 17:48:22 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -38,9 +38,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: ascmagic.c,v 1.81 2011/03/15 22:16:29 christos Exp $") FILE_RCSID("@(#)$File: ascmagic.c,v 1.84 2011/12/08 12:38:24 rrt Exp $")
#else #else
__RCSID("$NetBSD: ascmagic.c,v 1.1.1.2 2011/05/12 20:46:52 christos Exp $"); __RCSID("$NetBSD: ascmagic.c,v 1.1.1.3 2012/02/22 17:48:22 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -52,13 +52,11 @@ __RCSID("$NetBSD: ascmagic.c,v 1.1.1.2 2011/05/12 20:46:52 christos Exp $");
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "names.h"
#define MAXLINELEN 300 /* longest sane line length */ #define MAXLINELEN 300 /* longest sane line length */
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \ #define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
|| (x) == 0x85 || (x) == '\f') || (x) == 0x85 || (x) == '\f')
private int ascmatch(const unsigned char *, const unichar *, size_t);
private unsigned char *encode_utf8(unsigned char *, size_t, unichar *, size_t); private unsigned char *encode_utf8(unsigned char *, size_t, unichar *, size_t);
private size_t trim_nuls(const unsigned char *, size_t); private size_t trim_nuls(const unsigned char *, size_t);
@ -76,7 +74,8 @@ trim_nuls(const unsigned char *buf, size_t nbytes)
} }
protected int protected int
file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes) file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
int text)
{ {
unichar *ubuf = NULL; unichar *ubuf = NULL;
size_t ulen; size_t ulen;
@ -93,17 +92,13 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
/* If file doesn't look like any sort of text, give up. */ /* 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, buf, nbytes, &ubuf, &ulen, &code, &code_mime,
&type) == 0) { &type) == 0)
rv = 0; rv = 0;
goto done; else
} rv = file_ascmagic_with_encoding(ms, buf, nbytes, ubuf, ulen, code,
type, text);
rv = file_ascmagic_with_encoding(ms, buf, nbytes, ubuf, ulen, code, free(ubuf);
type);
done:
if (ubuf)
free(ubuf);
return rv; return rv;
} }
@ -111,11 +106,10 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
protected int protected int
file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf, file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
size_t nbytes, unichar *ubuf, size_t ulen, const char *code, size_t nbytes, unichar *ubuf, size_t ulen, const char *code,
const char *type) const char *type, int text)
{ {
unsigned char *utf8_buf = NULL, *utf8_end; unsigned char *utf8_buf = NULL, *utf8_end;
size_t mlen, i; size_t mlen, i;
const struct names *p;
int rv = -1; int rv = -1;
int mime = ms->flags & MAGIC_MIME; int mime = ms->flags & MAGIC_MIME;
@ -130,7 +124,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
int n_lf = 0; int n_lf = 0;
int n_cr = 0; int n_cr = 0;
int n_nel = 0; int n_nel = 0;
int score, curtype, executable = 0; int executable = 0;
size_t last_line_end = (size_t)-1; size_t last_line_end = (size_t)-1;
int has_long_lines = 0; int has_long_lines = 0;
@ -159,57 +153,10 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
== NULL) == NULL)
goto done; goto done;
if ((rv = file_softmagic(ms, utf8_buf, if ((rv = file_softmagic(ms, utf8_buf,
(size_t)(utf8_end - utf8_buf), TEXTTEST)) != 0) (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
goto subtype_identified;
else
rv = -1; rv = -1;
} }
/* look for tokens from names.h - this is expensive! */
if ((ms->flags & MAGIC_NO_CHECK_TOKENS) != 0)
goto subtype_identified;
i = 0;
score = 0;
curtype = -1;
while (i < ulen) {
size_t end;
/* skip past any leading space */
while (i < ulen && ISSPC(ubuf[i]))
i++;
if (i >= ulen)
break;
/* find the next whitespace */
for (end = i + 1; end < nbytes; end++)
if (ISSPC(ubuf[end]))
break;
/* compare the word thus isolated against the token list */
for (p = names; p < names + NNAMES; p++) {
if (ascmatch((const unsigned char *)p->name, ubuf + i,
end - i)) {
if (curtype == -1)
curtype = p->type;
else if (curtype != p->type) {
score = p->score;
curtype = p->type;
} else
score += p->score;
if (score > 1) {
subtype = types[p->type].human;
subtype_mime = types[p->type].mime;
goto subtype_identified;
}
}
}
i = end;
}
subtype_identified:
/* Now try to discover other details about the file. */ /* Now try to discover other details about the file. */
for (i = 0; i < ulen; i++) { for (i = 0; i < ulen; i++) {
if (ubuf[i] == '\n') { if (ubuf[i] == '\n') {
@ -355,28 +302,11 @@ subtype_identified:
} }
rv = 1; rv = 1;
done: done:
if (utf8_buf) free(utf8_buf);
free(utf8_buf);
return rv; return rv;
} }
private int
ascmatch(const unsigned char *s, const unichar *us, size_t ulen)
{
size_t i;
for (i = 0; i < ulen; i++) {
if (s[i] != us[i])
return 0;
}
if (s[i])
return 0;
else
return 1;
}
/* /*
* Encode Unicode string as UTF-8, returning pointer to character * Encode Unicode string as UTF-8, returning pointer to character
* after end of string, or NULL if an invalid character is found. * after end of string, or NULL if an invalid character is found.

View file

@ -1,4 +1,4 @@
/* $NetBSD: cdf.c,v 1.5 2011/09/16 21:06:26 christos Exp $ */ /* $NetBSD: cdf.c,v 1.6 2012/02/22 17:53:51 christos Exp $ */
/*- /*-
* Copyright (c) 2008 Christos Zoulas * Copyright (c) 2008 Christos Zoulas
@ -38,9 +38,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: cdf.c,v 1.45 2011/08/28 08:38:48 christos Exp $") FILE_RCSID("@(#)$File: cdf.c,v 1.50 2012/02/20 22:35:29 christos Exp $")
#else #else
__RCSID("$NetBSD: cdf.c,v 1.5 2011/09/16 21:06:26 christos Exp $"); __RCSID("$NetBSD: cdf.c,v 1.6 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif #endif
@ -63,10 +63,6 @@ __RCSID("$NetBSD: cdf.c,v 1.5 2011/09/16 21:06:26 christos Exp $");
#include "cdf.h" #include "cdf.h"
#ifndef __arraycount
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
#endif
#ifdef CDF_DEBUG #ifdef CDF_DEBUG
#define DPRINTF(a) printf a, fflush(stdout) #define DPRINTF(a) printf a, fflush(stdout)
#else #else
@ -85,6 +81,7 @@ static union {
#define CDF_TOLE2(x) ((uint16_t)(NEED_SWAP ? _cdf_tole2(x) : (uint16_t)(x))) #define CDF_TOLE2(x) ((uint16_t)(NEED_SWAP ? _cdf_tole2(x) : (uint16_t)(x)))
#define CDF_GETUINT32(x, y) cdf_getuint32(x, y) #define CDF_GETUINT32(x, y) cdf_getuint32(x, y)
/* /*
* swap a short * swap a short
*/ */
@ -351,18 +348,27 @@ ssize_t
cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len, cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len,
const cdf_header_t *h, cdf_secid_t id) const cdf_header_t *h, cdf_secid_t id)
{ {
assert((size_t)CDF_SEC_SIZE(h) == len); size_t ss = CDF_SEC_SIZE(h);
return cdf_read(info, (off_t)CDF_SEC_POS(h, id), size_t pos = CDF_SEC_POS(h, id);
((char *)buf) + offs, len); assert(ss == len);
return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);
} }
ssize_t ssize_t
cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs, cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
size_t len, const cdf_header_t *h, cdf_secid_t id) size_t len, const cdf_header_t *h, cdf_secid_t id)
{ {
assert((size_t)CDF_SHORT_SEC_SIZE(h) == len); size_t ss = CDF_SHORT_SEC_SIZE(h);
size_t pos = CDF_SHORT_SEC_POS(h, id);
assert(ss == len);
if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
SIZE_T_FORMAT "u\n",
pos, CDF_SEC_SIZE(h) * sst->sst_len));
return -1;
}
(void)memcpy(((char *)buf) + offs, (void)memcpy(((char *)buf) + offs,
((const char *)sst->sst_tab) + CDF_SHORT_SEC_POS(h, id), len); ((const char *)sst->sst_tab) + pos, len);
return len; return len;
} }
@ -429,8 +435,8 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
if (sec < 0) if (sec < 0)
goto out; goto out;
if (i >= sat->sat_len) { if (i >= sat->sat_len) {
DPRINTF(("Out of bounds reading MSA %u >= %u", DPRINTF(("Out of bounds reading MSA %" SIZE_T_FORMAT
i, sat->sat_len)); "u >= %" SIZE_T_FORMAT "u", i, sat->sat_len));
errno = EFTYPE; errno = EFTYPE;
goto out2; goto out2;
} }
@ -503,7 +509,8 @@ cdf_read_long_sector_chain(const cdf_info_t *info, const cdf_header_t *h,
} }
if (i >= scn->sst_len) { if (i >= scn->sst_len) {
DPRINTF(("Out of bounds reading long sector chain " DPRINTF(("Out of bounds reading long sector chain "
"%u > %u\n", i, scn->sst_len)); "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
scn->sst_len));
errno = EFTYPE; errno = EFTYPE;
goto out; goto out;
} }
@ -548,7 +555,8 @@ cdf_read_short_sector_chain(const cdf_header_t *h,
} }
if (i >= scn->sst_len) { if (i >= scn->sst_len) {
DPRINTF(("Out of bounds reading short sector chain " DPRINTF(("Out of bounds reading short sector chain "
"%u > %u\n", i, scn->sst_len)); "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
i, scn->sst_len));
errno = EFTYPE; errno = EFTYPE;
goto out; goto out;
} }
@ -656,7 +664,8 @@ cdf_read_ssat(const cdf_info_t *info, const cdf_header_t *h,
} }
if (i >= ssat->sat_len) { if (i >= ssat->sat_len) {
DPRINTF(("Out of bounds reading short sector chain " DPRINTF(("Out of bounds reading short sector chain "
"%u > %u\n", i, ssat->sat_len)); "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
ssat->sat_len));
errno = EFTYPE; errno = EFTYPE;
goto out; goto out;
} }
@ -796,17 +805,18 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1) if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
goto out; goto out;
for (i = 0; i < sh.sh_properties; i++) { for (i = 0; i < sh.sh_properties; i++) {
size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
q = (const uint8_t *)(const void *) q = (const uint8_t *)(const void *)
((const char *)(const void *)p + ((const char *)(const void *)p + ofs
CDF_GETUINT32(p, (i << 1) + 1)) - 2 * sizeof(uint32_t); - 2 * sizeof(uint32_t));
if (q > e) { if (q > e) {
DPRINTF(("Ran of the end %p > %p\n", q, e)); DPRINTF(("Ran of the end %p > %p\n", q, e));
goto out; goto out;
} }
inp[i].pi_id = CDF_GETUINT32(p, i << 1); inp[i].pi_id = CDF_GETUINT32(p, i << 1);
inp[i].pi_type = CDF_GETUINT32(q, 0); inp[i].pi_type = CDF_GETUINT32(q, 0);
DPRINTF(("%d) id=%x type=%x offs=%x,%d\n", i, inp[i].pi_id, DPRINTF(("%" SIZE_T_FORMAT "u) id=%x type=%x offs=0x%tx,0x%x\n",
inp[i].pi_type, q - p, CDF_GETUINT32(p, (i << 1) + 1))); i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
if (inp[i].pi_type & CDF_VECTOR) { if (inp[i].pi_type & CDF_VECTOR) {
nelements = CDF_GETUINT32(q, 1); nelements = CDF_GETUINT32(q, 1);
o = 2; o = 2;
@ -852,6 +862,20 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
(void)memcpy(&u64, &q[o4], sizeof(u64)); (void)memcpy(&u64, &q[o4], sizeof(u64));
inp[i].pi_u64 = CDF_TOLE8((uint64_t)u64); inp[i].pi_u64 = CDF_TOLE8((uint64_t)u64);
break; break;
case CDF_FLOAT:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u32, &q[o4], sizeof(u32));
u32 = CDF_TOLE4(u32);
memcpy(&inp[i].pi_f, &u32, sizeof(inp[i].pi_f));
break;
case CDF_DOUBLE:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u64, &q[o4], sizeof(u64));
u64 = CDF_TOLE8((uint64_t)u64);
memcpy(&inp[i].pi_d, &u64, sizeof(inp[i].pi_d));
break;
case CDF_LENGTH32_STRING: case CDF_LENGTH32_STRING:
case CDF_LENGTH32_WSTRING: case CDF_LENGTH32_WSTRING:
if (nelements > 1) { if (nelements > 1) {
@ -867,17 +891,22 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
*info = inp; *info = inp;
inp = *info + nelem; inp = *info + nelem;
} }
DPRINTF(("nelements = %d\n", nelements)); DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
nelements));
for (j = 0; j < nelements; j++, i++) { for (j = 0; j < nelements; j++, i++) {
uint32_t l = CDF_GETUINT32(q, o); uint32_t l = CDF_GETUINT32(q, o);
inp[i].pi_str.s_len = l; inp[i].pi_str.s_len = l;
inp[i].pi_str.s_buf = (const char *) inp[i].pi_str.s_buf = (const char *)
(const void *)(&q[o4 + sizeof(l)]); (const void *)(&q[o4 + sizeof(l)]);
DPRINTF(("l = %d, r = %d, s = %s\n", l, DPRINTF(("l = %d, r = %" SIZE_T_FORMAT
"u, s = %s\n", l,
CDF_ROUND(l, sizeof(l)), CDF_ROUND(l, sizeof(l)),
inp[i].pi_str.s_buf)); inp[i].pi_str.s_buf));
l = 4 + (uint32_t)CDF_ROUND(l, sizeof(l)); if (l & 1)
o += l >> 2; l++;
o += l >> 1;
if (q + o >= e)
goto out;
o4 = o * sizeof(uint32_t); o4 = o * sizeof(uint32_t);
} }
i--; i--;
@ -896,7 +925,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
unknown: unknown:
DPRINTF(("Don't know how to deal with %x\n", DPRINTF(("Don't know how to deal with %x\n",
inp[i].pi_type)); inp[i].pi_type));
goto out; break;
} }
} }
return 0; return 0;
@ -935,8 +964,9 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
return -1; return -1;
} }
if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
info, count, &maxcount) == -1) info, count, &maxcount) == -1) {
return -1; return -1;
}
} }
return 0; return 0;
} }
@ -1061,14 +1091,14 @@ cdf_dump_sat(const char *prefix, const cdf_sat_t *sat, size_t size)
size_t i, j, s = size / sizeof(cdf_secid_t); size_t i, j, s = size / sizeof(cdf_secid_t);
for (i = 0; i < sat->sat_len; i++) { for (i = 0; i < sat->sat_len; i++) {
(void)fprintf(stderr, "%s[%" SIZE_T_FORMAT "u]:\n%.6d: ", (void)fprintf(stderr, "%s[%" SIZE_T_FORMAT "u]:\n%.6"
prefix, i, i * s); SIZE_T_FORMAT "u: ", prefix, i, i * s);
for (j = 0; j < s; j++) { for (j = 0; j < s; j++) {
(void)fprintf(stderr, "%5d, ", (void)fprintf(stderr, "%5d, ",
CDF_TOLE4(sat->sat_tab[s * i + j])); CDF_TOLE4(sat->sat_tab[s * i + j]));
if ((j + 1) % 10 == 0) if ((j + 1) % 10 == 0)
(void)fprintf(stderr, "\n%.6d: ", (void)fprintf(stderr, "\n%.6" SIZE_T_FORMAT
i * s + j + 1); "u: ", i * s + j + 1);
} }
(void)fprintf(stderr, "\n"); (void)fprintf(stderr, "\n");
} }
@ -1087,7 +1117,8 @@ cdf_dump(void *v, size_t len)
if (j == 16) { if (j == 16) {
j = 0; j = 0;
abuf[15] = '\0'; abuf[15] = '\0';
(void)fprintf(stderr, "%s\n%.4x: ", abuf, i + 1); (void)fprintf(stderr, "%s\n%.4" SIZE_T_FORMAT "x: ",
abuf, i + 1);
} }
} }
(void)fprintf(stderr, "\n"); (void)fprintf(stderr, "\n");
@ -1185,6 +1216,14 @@ cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
(void)fprintf(stderr, "unsigned 32 [%u]\n", (void)fprintf(stderr, "unsigned 32 [%u]\n",
info[i].pi_u32); info[i].pi_u32);
break; break;
case CDF_FLOAT:
(void)fprintf(stderr, "float [%g]\n",
info[i].pi_f);
break;
case CDF_DOUBLE:
(void)fprintf(stderr, "double [%g]\n",
info[i].pi_d);
break;
case CDF_LENGTH32_STRING: case CDF_LENGTH32_STRING:
(void)fprintf(stderr, "string %u [%.*s]\n", (void)fprintf(stderr, "string %u [%.*s]\n",
info[i].pi_str.s_len, info[i].pi_str.s_len,

View file

@ -1,4 +1,4 @@
/* $NetBSD: cdf.h,v 1.1.1.2 2011/05/12 20:46:55 christos Exp $ */ /* $NetBSD: cdf.h,v 1.1.1.3 2012/02/22 17:48:26 christos Exp $ */
/*- /*-
* Copyright (c) 2008 Christos Zoulas * Copyright (c) 2008 Christos Zoulas
@ -53,136 +53,140 @@ typedef int32_t cdf_secid_t;
#define CDF_SECID_NULL 0 #define CDF_SECID_NULL 0
#define CDF_SECID_FREE -1 #define CDF_SECID_FREE -1
#define CDF_SECID_END_OF_CHAIN -2 #define CDF_SECID_END_OF_CHAIN -2
#define CDF_SECID_SECTOR_ALLOCATION_TABLE -3 #define CDF_SECID_SECTOR_ALLOCATION_TABLE -3
#define CDF_SECID_MASTER_SECTOR_ALLOCATION_TABLE -4 #define CDF_SECID_MASTER_SECTOR_ALLOCATION_TABLE -4
typedef struct { typedef struct {
uint64_t h_magic; uint64_t h_magic;
#define CDF_MAGIC 0xE11AB1A1E011CFD0LL #define CDF_MAGIC 0xE11AB1A1E011CFD0LL
uint64_t h_uuid[2]; uint64_t h_uuid[2];
uint16_t h_revision; uint16_t h_revision;
uint16_t h_version; uint16_t h_version;
uint16_t h_byte_order; uint16_t h_byte_order;
uint16_t h_sec_size_p2; uint16_t h_sec_size_p2;
uint16_t h_short_sec_size_p2; uint16_t h_short_sec_size_p2;
uint8_t h_unused0[10]; uint8_t h_unused0[10];
uint32_t h_num_sectors_in_sat; uint32_t h_num_sectors_in_sat;
uint32_t h_secid_first_directory; uint32_t h_secid_first_directory;
uint8_t h_unused1[4]; uint8_t h_unused1[4];
uint32_t h_min_size_standard_stream; uint32_t h_min_size_standard_stream;
cdf_secid_t h_secid_first_sector_in_short_sat; cdf_secid_t h_secid_first_sector_in_short_sat;
uint32_t h_num_sectors_in_short_sat; uint32_t h_num_sectors_in_short_sat;
cdf_secid_t h_secid_first_sector_in_master_sat; cdf_secid_t h_secid_first_sector_in_master_sat;
uint32_t h_num_sectors_in_master_sat; uint32_t h_num_sectors_in_master_sat;
cdf_secid_t h_master_sat[436/4]; cdf_secid_t h_master_sat[436/4];
} cdf_header_t; } cdf_header_t;
#define CDF_SEC_SIZE(h) (1 << (h)->h_sec_size_p2) #define CDF_SEC_SIZE(h) ((size_t)(1 << (h)->h_sec_size_p2))
#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h)) #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
#define CDF_SHORT_SEC_SIZE(h) (1 << (h)->h_short_sec_size_p2) #define CDF_SHORT_SEC_SIZE(h) ((size_t)(1 << (h)->h_short_sec_size_p2))
#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h)) #define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
typedef int32_t cdf_dirid_t; typedef int32_t cdf_dirid_t;
#define CDF_DIRID_NULL -1 #define CDF_DIRID_NULL -1
typedef int64_t cdf_timestamp_t; typedef int64_t cdf_timestamp_t;
#define CDF_BASE_YEAR 1601 #define CDF_BASE_YEAR 1601
#define CDF_TIME_PREC 10000000 #define CDF_TIME_PREC 10000000
typedef struct { typedef struct {
uint16_t d_name[32]; uint16_t d_name[32];
uint16_t d_namelen; uint16_t d_namelen;
uint8_t d_type; uint8_t d_type;
#define CDF_DIR_TYPE_EMPTY 0 #define CDF_DIR_TYPE_EMPTY 0
#define CDF_DIR_TYPE_USER_STORAGE 1 #define CDF_DIR_TYPE_USER_STORAGE 1
#define CDF_DIR_TYPE_USER_STREAM 2 #define CDF_DIR_TYPE_USER_STREAM 2
#define CDF_DIR_TYPE_LOCKBYTES 3 #define CDF_DIR_TYPE_LOCKBYTES 3
#define CDF_DIR_TYPE_PROPERTY 4 #define CDF_DIR_TYPE_PROPERTY 4
#define CDF_DIR_TYPE_ROOT_STORAGE 5 #define CDF_DIR_TYPE_ROOT_STORAGE 5
uint8_t d_color; uint8_t d_color;
#define CDF_DIR_COLOR_READ 0 #define CDF_DIR_COLOR_READ 0
#define CDF_DIR_COLOR_BLACK 1 #define CDF_DIR_COLOR_BLACK 1
cdf_dirid_t d_left_child; cdf_dirid_t d_left_child;
cdf_dirid_t d_right_child; cdf_dirid_t d_right_child;
cdf_dirid_t d_storage; cdf_dirid_t d_storage;
uint64_t d_storage_uuid[2]; uint64_t d_storage_uuid[2];
uint32_t d_flags; uint32_t d_flags;
cdf_timestamp_t d_created; cdf_timestamp_t d_created;
cdf_timestamp_t d_modified; cdf_timestamp_t d_modified;
cdf_secid_t d_stream_first_sector; cdf_secid_t d_stream_first_sector;
uint32_t d_size; uint32_t d_size;
uint32_t d_unused0; uint32_t d_unused0;
} cdf_directory_t; } cdf_directory_t;
#define CDF_DIRECTORY_SIZE 128 #define CDF_DIRECTORY_SIZE 128
typedef struct { typedef struct {
cdf_secid_t *sat_tab; cdf_secid_t *sat_tab;
size_t sat_len; size_t sat_len;
} cdf_sat_t; } cdf_sat_t;
typedef struct { typedef struct {
cdf_directory_t *dir_tab; cdf_directory_t *dir_tab;
size_t dir_len; size_t dir_len;
} cdf_dir_t; } cdf_dir_t;
typedef struct { typedef struct {
void *sst_tab; void *sst_tab;
size_t sst_len; size_t sst_len;
size_t sst_dirlen; size_t sst_dirlen;
} cdf_stream_t; } cdf_stream_t;
typedef struct { typedef struct {
uint32_t cl_dword; uint32_t cl_dword;
uint16_t cl_word[2]; uint16_t cl_word[2];
uint8_t cl_two[2]; uint8_t cl_two[2];
uint8_t cl_six[6]; uint8_t cl_six[6];
} cdf_classid_t; } cdf_classid_t;
typedef struct { typedef struct {
uint16_t si_byte_order; uint16_t si_byte_order;
uint16_t si_zero; uint16_t si_zero;
uint16_t si_os_version; uint16_t si_os_version;
uint16_t si_os; uint16_t si_os;
cdf_classid_t si_class; cdf_classid_t si_class;
uint32_t si_count; uint32_t si_count;
} cdf_summary_info_header_t; } cdf_summary_info_header_t;
#define CDF_SECTION_DECLARATION_OFFSET 0x1c #define CDF_SECTION_DECLARATION_OFFSET 0x1c
typedef struct { typedef struct {
cdf_classid_t sd_class; cdf_classid_t sd_class;
uint32_t sd_offset; uint32_t sd_offset;
} cdf_section_declaration_t; } cdf_section_declaration_t;
typedef struct { typedef struct {
uint32_t sh_len; uint32_t sh_len;
uint32_t sh_properties; uint32_t sh_properties;
} cdf_section_header_t; } cdf_section_header_t;
typedef struct { typedef struct {
uint32_t pi_id; uint32_t pi_id;
uint32_t pi_type; uint32_t pi_type;
union { union {
uint16_t _pi_u16; uint16_t _pi_u16;
int16_t _pi_s16; int16_t _pi_s16;
uint32_t _pi_u32; uint32_t _pi_u32;
int32_t _pi_s32; int32_t _pi_s32;
uint64_t _pi_u64; uint64_t _pi_u64;
int64_t _pi_s64; int64_t _pi_s64;
cdf_timestamp_t _pi_tp; cdf_timestamp_t _pi_tp;
struct { float _pi_f;
uint32_t s_len; double _pi_d;
const char *s_buf; struct {
} _pi_str; uint32_t s_len;
} pi_val; const char *s_buf;
} _pi_str;
} pi_val;
#define pi_u64 pi_val._pi_u64 #define pi_u64 pi_val._pi_u64
#define pi_s64 pi_val._pi_s64 #define pi_s64 pi_val._pi_s64
#define pi_u32 pi_val._pi_u32 #define pi_u32 pi_val._pi_u32
#define pi_s32 pi_val._pi_s32 #define pi_s32 pi_val._pi_s32
#define pi_u16 pi_val._pi_u16 #define pi_u16 pi_val._pi_u16
#define pi_s16 pi_val._pi_s16 #define pi_s16 pi_val._pi_s16
#define pi_f pi_val._pi_f
#define pi_d pi_val._pi_d
#define pi_tp pi_val._pi_tp #define pi_tp pi_val._pi_tp
#define pi_str pi_val._pi_str #define pi_str pi_val._pi_str
} cdf_property_info_t; } cdf_property_info_t;
@ -191,13 +195,13 @@ typedef struct {
/* Variant type definitions */ /* Variant type definitions */
#define CDF_EMPTY 0x00000000 #define CDF_EMPTY 0x00000000
#define CDF_NULL 0x00000001 #define CDF_NULL 0x00000001
#define CDF_SIGNED16 0x00000002 #define CDF_SIGNED16 0x00000002
#define CDF_SIGNED32 0x00000003 #define CDF_SIGNED32 0x00000003
#define CDF_FLOAT 0x00000004 #define CDF_FLOAT 0x00000004
#define CDF_DOUBLE 0x00000005 #define CDF_DOUBLE 0x00000005
#define CDF_CY 0x00000006 #define CDF_CY 0x00000006
#define CDF_DATE 0x00000007 #define CDF_DATE 0x00000007
#define CDF_BSTR 0x00000008 #define CDF_BSTR 0x00000008
#define CDF_DISPATCH 0x00000009 #define CDF_DISPATCH 0x00000009
#define CDF_ERROR 0x0000000a #define CDF_ERROR 0x0000000a
@ -208,7 +212,7 @@ typedef struct {
#define CDF_SIGNED8 0x00000010 #define CDF_SIGNED8 0x00000010
#define CDF_UNSIGNED8 0x00000011 #define CDF_UNSIGNED8 0x00000011
#define CDF_UNSIGNED16 0x00000012 #define CDF_UNSIGNED16 0x00000012
#define CDF_UNSIGNED32 0x00000013 #define CDF_UNSIGNED32 0x00000013
#define CDF_SIGNED64 0x00000014 #define CDF_SIGNED64 0x00000014
#define CDF_UNSIGNED64 0x00000015 #define CDF_UNSIGNED64 0x00000015
#define CDF_INT 0x00000016 #define CDF_INT 0x00000016
@ -243,7 +247,7 @@ typedef struct {
#define CDF_PROPERTY_SUBJECT 0x00000003 #define CDF_PROPERTY_SUBJECT 0x00000003
#define CDF_PROPERTY_AUTHOR 0x00000004 #define CDF_PROPERTY_AUTHOR 0x00000004
#define CDF_PROPERTY_KEYWORDS 0x00000005 #define CDF_PROPERTY_KEYWORDS 0x00000005
#define CDF_PROPERTY_COMMENTS 0x00000006 #define CDF_PROPERTY_COMMENTS 0x00000006
#define CDF_PROPERTY_TEMPLATE 0x00000007 #define CDF_PROPERTY_TEMPLATE 0x00000007
#define CDF_PROPERTY_LAST_SAVED_BY 0x00000008 #define CDF_PROPERTY_LAST_SAVED_BY 0x00000008
#define CDF_PROPERTY_REVISION_NUMBER 0x00000009 #define CDF_PROPERTY_REVISION_NUMBER 0x00000009
@ -260,9 +264,9 @@ typedef struct {
#define CDF_PROPERTY_LOCALE_ID 0x80000000 #define CDF_PROPERTY_LOCALE_ID 0x80000000
typedef struct { typedef struct {
int i_fd; int i_fd;
const unsigned char *i_buf; const unsigned char *i_buf;
size_t i_len; size_t i_len;
} cdf_info_t; } cdf_info_t;
struct timespec; struct timespec;

View file

@ -1,4 +1,4 @@
/* $NetBSD: cdf_time.c,v 1.3 2011/05/13 01:52:13 christos Exp $ */ /* $NetBSD: cdf_time.c,v 1.4 2012/02/22 17:53:51 christos Exp $ */
/*- /*-
* Copyright (c) 2008 Christos Zoulas * Copyright (c) 2008 Christos Zoulas
@ -30,9 +30,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: cdf_time.c,v 1.10 2011/02/10 17:03:16 christos Exp $") FILE_RCSID("@(#)$File: cdf_time.c,v 1.11 2011/12/13 13:48:41 christos Exp $")
#else #else
__RCSID("$NetBSD: cdf_time.c,v 1.3 2011/05/13 01:52:13 christos Exp $"); __RCSID("$NetBSD: cdf_time.c,v 1.4 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif #endif
@ -127,7 +127,7 @@ cdf_timestamp_to_timespec(struct timespec *ts, cdf_timestamp_t t)
tm.tm_year = (int)(CDF_BASE_YEAR + (t / 365)); tm.tm_year = (int)(CDF_BASE_YEAR + (t / 365));
rdays = cdf_getdays(tm.tm_year); rdays = cdf_getdays(tm.tm_year);
t -= rdays; t -= rdays - 1;
tm.tm_mday = cdf_getday(tm.tm_year, (int)t); tm.tm_mday = cdf_getday(tm.tm_year, (int)t);
tm.tm_mon = cdf_getmonth(tm.tm_year, (int)t); tm.tm_mon = cdf_getmonth(tm.tm_year, (int)t);
tm.tm_wday = 0; tm.tm_wday = 0;

View file

@ -1,4 +1,4 @@
/* $NetBSD: compress.c,v 1.4 2011/09/16 21:06:26 christos Exp $ */ /* $NetBSD: compress.c,v 1.5 2012/02/22 17:53:51 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -38,9 +38,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: compress.c,v 1.67 2011/09/01 12:12:37 christos Exp $") FILE_RCSID("@(#)$File: compress.c,v 1.68 2011/12/08 12:38:24 rrt Exp $")
#else #else
__RCSID("$NetBSD: compress.c,v 1.4 2011/09/16 21:06:26 christos Exp $"); __RCSID("$NetBSD: compress.c,v 1.5 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif #endif
@ -140,8 +140,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
} }
} }
error: error:
if (newbuf) free(newbuf);
free(newbuf);
ms->flags |= MAGIC_COMPRESS; ms->flags |= MAGIC_COMPRESS;
return rv; return rv;
} }

View file

@ -1,4 +1,4 @@
/* $NetBSD: encoding.c,v 1.1.1.2 2011/05/12 20:46:52 christos Exp $ */ /* $NetBSD: encoding.c,v 1.1.1.3 2012/02/22 17:48:23 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -38,9 +38,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: encoding.c,v 1.5 2010/07/21 16:47:17 christos Exp $") FILE_RCSID("@(#)$File: encoding.c,v 1.7 2012/01/24 19:02:02 christos Exp $")
#else #else
__RCSID("$NetBSD: encoding.c,v 1.1.1.2 2011/05/12 20:46:52 christos Exp $"); __RCSID("$NetBSD: encoding.c,v 1.1.1.3 2012/02/22 17:48:23 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -77,6 +77,7 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
int rv = 1, ucs_type; int rv = 1, ucs_type;
unsigned char *nbuf = NULL; unsigned char *nbuf = NULL;
*type = "text";
mlen = (nbytes + 1) * sizeof(nbuf[0]); mlen = (nbytes + 1) * sizeof(nbuf[0]);
if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) { if ((nbuf = CAST(unsigned char *, calloc((size_t)1, mlen))) == NULL) {
file_oomem(ms, mlen); file_oomem(ms, mlen);
@ -88,7 +89,6 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
goto done; goto done;
} }
*type = "text";
if (looks_ascii(buf, nbytes, *ubuf, ulen)) { if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen)); DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
*code = "ASCII"; *code = "ASCII";
@ -139,8 +139,7 @@ file_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, uni
} }
done: done:
if (nbuf) free(nbuf);
free(nbuf);
return rv; return rv;
} }

View file

@ -1,4 +1,4 @@
/* $NetBSD: file.c,v 1.1.1.2 2011/05/12 20:46:56 christos Exp $ */ /* $NetBSD: file.c,v 1.1.1.3 2012/02/22 17:48:26 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -35,9 +35,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: file.c,v 1.144 2011/05/10 17:08:14 christos Exp $") FILE_RCSID("@(#)$File: file.c,v 1.145 2011/12/08 12:12:46 rrt Exp $")
#else #else
__RCSID("$NetBSD: file.c,v 1.1.1.2 2011/05/12 20:46:56 christos Exp $"); __RCSID("$NetBSD: file.c,v 1.1.1.3 2012/02/22 17:48:26 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -122,7 +122,7 @@ private const struct {
{ "soft", MAGIC_NO_CHECK_SOFT }, { "soft", MAGIC_NO_CHECK_SOFT },
{ "tar", MAGIC_NO_CHECK_TAR }, { "tar", MAGIC_NO_CHECK_TAR },
{ "text", MAGIC_NO_CHECK_TEXT }, /* synonym for ascii */ { "text", MAGIC_NO_CHECK_TEXT }, /* synonym for ascii */
{ "tokens", MAGIC_NO_CHECK_TOKENS }, { "tokens", MAGIC_NO_CHECK_TOKENS }, /* OBSOLETE: ignored for backwards compatibility */
}; };
private char *progname; /* used throughout */ private char *progname; /* used throughout */

View file

@ -1,4 +1,4 @@
/* $NetBSD: file.h,v 1.5 2011/09/16 21:06:26 christos Exp $ */ /* $NetBSD: file.h,v 1.6 2012/02/22 17:53:51 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -29,18 +29,12 @@
*/ */
/* /*
* file.h - definitions for file(1) program * file.h - definitions for file(1) program
* @(#)$File: file.h,v 1.133 2011/05/13 22:15:40 christos Exp $ * @(#)$File: file.h,v 1.135 2011/09/20 15:30:14 christos Exp $
*/ */
#ifndef __file_h__ #ifndef __file_h__
#define __file_h__ #define __file_h__
#ifdef __minix
/* LSC We are being compiled on a minix host, for some reasons
* this is not included fast enough, so ugly patch: */
#include <sys/featuretest.h>
#endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -94,6 +88,10 @@
#endif #endif
#define public #define public
#ifndef __arraycount
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
#endif
#ifndef __GNUC_PREREQ__ #ifndef __GNUC_PREREQ__
#ifdef __GNUC__ #ifdef __GNUC__
#define __GNUC_PREREQ__(x, y) \ #define __GNUC_PREREQ__(x, y) \
@ -409,15 +407,16 @@ protected int file_trycdf(struct magic_set *, int, const unsigned char *,
protected int file_zmagic(struct magic_set *, int, const char *, protected int file_zmagic(struct magic_set *, int, const char *,
const unsigned char *, size_t); const unsigned char *, size_t);
#endif #endif
protected int file_ascmagic(struct magic_set *, const unsigned char *, size_t); protected int file_ascmagic(struct magic_set *, const unsigned char *, size_t,
int);
protected int file_ascmagic_with_encoding(struct magic_set *, protected int file_ascmagic_with_encoding(struct magic_set *,
const unsigned char *, size_t, unichar *, size_t, const char *, const unsigned char *, size_t, unichar *, size_t, const char *,
const char *); const char *, int);
protected int file_encoding(struct magic_set *, const unsigned char *, size_t, protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
unichar **, size_t *, const char **, const char **, const char **); 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_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_softmagic(struct magic_set *, const unsigned char *, size_t,
int); int, int);
protected struct mlist *file_apprentice(struct magic_set *, const char *, int); protected struct mlist *file_apprentice(struct magic_set *, const char *, int);
protected uint64_t file_signextend(struct magic_set *, struct magic *, protected uint64_t file_signextend(struct magic_set *, struct magic *,
uint64_t); uint64_t);

View file

@ -1,4 +1,4 @@
/* $NetBSD: funcs.c,v 1.3 2011/05/13 01:52:13 christos Exp $ */ /* $NetBSD: funcs.c,v 1.4 2012/02/22 17:53:51 christos Exp $ */
/* /*
* Copyright (c) Christos Zoulas 2003. * Copyright (c) Christos Zoulas 2003.
@ -30,9 +30,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: funcs.c,v 1.57 2011/05/11 01:02:41 christos Exp $") FILE_RCSID("@(#)$File: funcs.c,v 1.60 2011/12/08 12:38:24 rrt Exp $")
#else #else
__RCSID("$NetBSD: funcs.c,v 1.3 2011/05/13 01:52:13 christos Exp $"); __RCSID("$NetBSD: funcs.c,v 1.4 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -235,7 +235,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
/* try soft magic tests */ /* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
if ((m = file_softmagic(ms, ubuf, nb, BINTEST)) != 0) { if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
looks_text)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0) if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "softmagic %d\n", m); (void)fprintf(stderr, "softmagic %d\n", m);
#ifdef BUILTIN_ELF #ifdef BUILTIN_ELF
@ -259,10 +260,10 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
goto done; goto done;
} }
/* try text properties (and possibly text tokens) */ /* try text properties */
if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) { if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
if ((m = file_ascmagic(ms, ubuf, nb)) != 0) { if ((m = file_ascmagic(ms, ubuf, nb, looks_text)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0) if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "ascmagic %d\n", m); (void)fprintf(stderr, "ascmagic %d\n", m);
goto done; goto done;
@ -272,7 +273,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) { if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
if (looks_text == 0) if (looks_text == 0)
if ((m = file_ascmagic_with_encoding( ms, ubuf, if ((m = file_ascmagic_with_encoding( ms, ubuf,
nb, u8buf, ulen, code, type)) != 0) { nb, u8buf, ulen, code, type, looks_text))
!= 0) {
if ((ms->flags & MAGIC_DEBUG) != 0) if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, (void)fprintf(stderr,
"ascmagic/enc %d\n", m); "ascmagic/enc %d\n", m);
@ -295,8 +297,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
if (file_printf(ms, "%s", code_mime) == -1) if (file_printf(ms, "%s", code_mime) == -1)
rv = -1; rv = -1;
} }
if (u8buf) free(u8buf);
free(u8buf);
if (rv) if (rv)
return rv; return rv;

View file

@ -1,4 +1,6 @@
/* $NetBSD: getline.c,v 1.1.1.1 2011/05/12 20:46:50 christos Exp $ */ /* $NetBSD: getline.c,v 1.1.1.2 2012/02/22 17:48:20 christos Exp $ */
/* NetBSD: fgetln.c,v 1.9 2008/04/29 06:53:03 martin Exp */
/*- /*-
* Copyright (c) 2011 The NetBSD Foundation, Inc. * Copyright (c) 2011 The NetBSD Foundation, Inc.

View file

@ -1,4 +1,6 @@
/* $NetBSD: getopt_long.c,v 1.1.1.1 2009/05/08 16:35:05 christos Exp $ */ /* $NetBSD: getopt_long.c,v 1.1.1.2 2012/02/22 17:48:18 christos Exp $ */
/* NetBSD: getopt_long.c,v 1.21.4.1 2008/01/09 01:34:14 matt Exp */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -35,7 +37,7 @@
#if 0 #if 0
FILE_RCSID("@(#)$File: getopt_long.c,v 1.6 2009/02/13 18:48:05 christos Exp $") FILE_RCSID("@(#)$File: getopt_long.c,v 1.6 2009/02/13 18:48:05 christos Exp $")
#else #else
__RCSID("$NetBSD: getopt_long.c,v 1.1.1.1 2009/05/08 16:35:05 christos Exp $"); __RCSID("$NetBSD: getopt_long.c,v 1.1.1.2 2012/02/22 17:48:18 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */

View file

@ -1,4 +1,4 @@
/* $NetBSD: magic.h,v 1.1.1.2 2011/05/12 20:46:49 christos Exp $ */ /* $NetBSD: magic.h,v 1.1.1.3 2012/02/22 17:48:18 christos Exp $ */
/* /*
* Copyright (c) Christos Zoulas 2003. * Copyright (c) Christos Zoulas 2003.
@ -57,7 +57,17 @@
#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */ #define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
/* No built-in tests; only consult the magic file */ /* No built-in tests; only consult the magic file */
#define MAGIC_NO_CHECK_BUILTIN 0x3fb000 #define MAGIC_NO_CHECK_BUILTIN ( \
MAGIC_NO_CHECK_COMPRESS | \
MAGIC_NO_CHECK_TAR | \
/* MAGIC_NO_CHECK_SOFT | */ \
MAGIC_NO_CHECK_APPTYPE | \
MAGIC_NO_CHECK_ELF | \
MAGIC_NO_CHECK_TEXT | \
MAGIC_NO_CHECK_CDF | \
MAGIC_NO_CHECK_TOKENS | \
MAGIC_NO_CHECK_ENCODING | \
)
/* Defined for backwards compatibility (renamed) */ /* Defined for backwards compatibility (renamed) */
#define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT #define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT

View file

@ -1,4 +1,6 @@
/* $NetBSD: mygetopt.h,v 1.1.1.1 2009/05/08 16:35:06 christos Exp $ */ /* $NetBSD: mygetopt.h,v 1.1.1.2 2012/02/22 17:48:20 christos Exp $ */
/* NetBSD: getopt.h,v 1.8 2007/11/06 19:21:18 christos Exp */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.

View file

@ -1,178 +0,0 @@
/* $NetBSD: names.h,v 1.1.1.2 2011/05/12 20:46:54 christos Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
* maintained 1995-present by Christos Zoulas and others.
*
* 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.
*/
/*
* Names.h - names and types used by ascmagic in file(1).
* These tokens are here because they can appear anywhere in
* the first HOWMANY bytes, while tokens in MAGIC must
* appear at fixed offsets into the file. Don't make HOWMANY
* too high unless you have a very fast CPU.
*
* $File: names.h,v 1.33 2010/10/08 21:58:44 christos Exp $
*/
/*
modified by Chris Lowth - 9 April 2000
to add mime type strings to the types table.
*/
/* these types are used to index the table 'types': keep em in sync! */
#define L_C 0 /* first and foremost on UNIX */
#define L_CC 1 /* Bjarne's postincrement */
#define L_MAKE 2 /* Makefiles */
#define L_PLI 3 /* PL/1 */
#define L_MACH 4 /* some kinda assembler */
#define L_ENG 5 /* English */
#define L_PAS 6 /* Pascal */
#define L_MAIL 7 /* Electronic mail */
#define L_NEWS 8 /* Usenet Netnews */
#define L_JAVA 9 /* Java code */
#define L_HTML 10 /* HTML */
#define L_BCPL 11 /* BCPL */
#define L_M4 12 /* M4 */
#define L_PO 13 /* PO */
static const struct {
char human[48];
char mime[16];
} types[] = {
{ "C program", "text/x-c", },
{ "C++ program", "text/x-c++" },
{ "make commands", "text/x-makefile" },
{ "PL/1 program", "text/x-pl1" },
{ "assembler program", "text/x-asm" },
{ "English", "text/plain" },
{ "Pascal program", "text/x-pascal" },
{ "mail", "text/x-mail" },
{ "news", "text/x-news" },
{ "Java program", "text/x-java" },
{ "HTML document", "text/html", },
{ "BCPL program", "text/x-bcpl" },
{ "M4 macro language pre-processor", "text/x-m4" },
{ "PO (gettext message catalogue)", "text/x-po" },
{ "cannot happen error on names.h/types", "error/x-error" }
};
/*
* XXX - how should we distinguish Java from C++?
* The trick used in a Debian snapshot, of having "extends" or "implements"
* as tags for Java, doesn't work very well, given that those keywords
* are often preceded by "class", which flags it as C++.
*
* Perhaps we need to be able to say
*
* If "class" then
*
* if "extends" or "implements" then
* Java
* else
* C++
* endif
*
* Or should we use other keywords, such as "package" or "import"?
* Unfortunately, Ada95 uses "package", and Modula-3 uses "import",
* although I infer from the language spec at
*
* http://www.research.digital.com/SRC/m3defn/html/m3.html
*
* that Modula-3 uses "IMPORT" rather than "import", i.e. it must be
* in all caps.
*
* So, for now, we go with "import". We must put it before the C++
* stuff, so that we don't misidentify Java as C++. Not using "package"
* means we won't identify stuff that defines a package but imports
* nothing; hopefully, very little Java code imports nothing (one of the
* reasons for doing OO programming is to import as much as possible
* and write only what you need to, right?).
*
* Unfortunately, "import" may cause us to misidentify English text
* as Java, as it comes after "the" and "The". Perhaps we need a fancier
* heuristic to identify Java?
*/
static const struct names {
char name[14];
unsigned char type;
unsigned char score;
} names[] = {
/* These must be sorted by eye for optimal hit rate */
/* Add to this list only after substantial meditation */
{"msgid", L_PO, 1 },
{"dnl", L_M4, 2 },
{"import", L_JAVA, 2 },
{"\"libhdr\"", L_BCPL, 2 },
{"\"LIBHDR\"", L_BCPL, 2 },
{"//", L_CC, 2 },
{"template", L_CC, 1 },
{"virtual", L_CC, 1 },
{"class", L_CC, 2 },
{"public:", L_CC, 2 },
{"private:", L_CC, 2 },
{"/*", L_C, 2 }, /* must precede "The", "the", etc. */
{"#include", L_C, 2 },
{"char", L_C, 2 },
{"The", L_ENG, 2 },
{"the", L_ENG, 2 },
{"double", L_C, 1 },
{"extern", L_C, 2 },
{"float", L_C, 1 },
{"struct", L_C, 1 },
{"union", L_C, 1 },
{"main(", L_C, 2 },
{"CFLAGS", L_MAKE, 2 },
{"LDFLAGS", L_MAKE, 2 },
{"all:", L_MAKE, 2 },
{".PRECIOUS", L_MAKE, 2 },
{".ascii", L_MACH, 2 },
{".asciiz", L_MACH, 2 },
{".byte", L_MACH, 2 },
{".even", L_MACH, 2 },
{".globl", L_MACH, 2 },
{".text", L_MACH, 2 },
{"clr", L_MACH, 2 },
{"(input,", L_PAS, 2 },
{"program", L_PAS, 1 },
{"record", L_PAS, 1 },
{"dcl", L_PLI, 2 },
{"Received:", L_MAIL, 2 },
{">From", L_MAIL, 2 },
{"Return-Path:",L_MAIL, 2 },
{"Cc:", L_MAIL, 2 },
{"Newsgroups:", L_NEWS, 2 },
{"Path:", L_NEWS, 2 },
{"Organization:",L_NEWS, 2 },
{"href=", L_HTML, 2 },
{"HREF=", L_HTML, 2 },
{"<body", L_HTML, 2 },
{"<BODY", L_HTML, 2 },
{"<html", L_HTML, 2 },
{"<HTML", L_HTML, 2 },
{"<!--", L_HTML, 2 },
};
#define NNAMES (sizeof(names)/sizeof(struct names))

View file

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.3 2011/09/16 21:06:26 christos Exp $ */ /* $NetBSD: print.c,v 1.4 2012/02/22 17:53:51 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -35,9 +35,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: print.c,v 1.70 2011/08/14 09:03:12 christos Exp $") FILE_RCSID("@(#)$File: print.c,v 1.71 2011/09/20 15:28:09 christos Exp $")
#else #else
__RCSID("$NetBSD: print.c,v 1.3 2011/09/16 21:06:26 christos Exp $"); __RCSID("$NetBSD: print.c,v 1.4 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -57,8 +57,8 @@ file_mdump(struct magic *m)
{ {
private const char optyp[] = { FILE_OPS }; private const char optyp[] = { FILE_OPS };
(void) fprintf(stderr, "%.*s %u", (m->cont_level & 7) + 1, ">>>>>>>>", (void) fprintf(stderr, "%u: %.*s %u", m->lineno,
m->offset); (m->cont_level & 7) + 1, ">>>>>>>>", m->offset);
if (m->flag & INDIR) { if (m->flag & INDIR) {
(void) fprintf(stderr, "(%s,", (void) fprintf(stderr, "(%s,",
@ -93,6 +93,24 @@ file_mdump(struct magic *m)
(void) fputc(CHAR_IGNORE_UPPERCASE, stderr); (void) fputc(CHAR_IGNORE_UPPERCASE, stderr);
if (m->str_flags & REGEX_OFFSET_START) if (m->str_flags & REGEX_OFFSET_START)
(void) fputc(CHAR_REGEX_OFFSET_START, stderr); (void) fputc(CHAR_REGEX_OFFSET_START, stderr);
if (m->str_flags & STRING_TEXTTEST)
(void) fputc(CHAR_TEXTTEST, stderr);
if (m->str_flags & STRING_BINTEST)
(void) fputc(CHAR_BINTEST, stderr);
if (m->str_flags & PSTRING_1_BE)
(void) fputc(CHAR_PSTRING_1_BE, stderr);
if (m->str_flags & PSTRING_2_BE)
(void) fputc(CHAR_PSTRING_2_BE, stderr);
if (m->str_flags & PSTRING_2_LE)
(void) fputc(CHAR_PSTRING_2_LE, stderr);
if (m->str_flags & PSTRING_4_BE)
(void) fputc(CHAR_PSTRING_4_BE, stderr);
if (m->str_flags & PSTRING_4_LE)
(void) fputc(CHAR_PSTRING_4_LE, stderr);
if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF)
(void) fputc(
CHAR_PSTRING_LENGTH_INCLUDES_ITSELF,
stderr);
} }
if (m->str_range) if (m->str_range)
(void) fprintf(stderr, "/%u", m->str_range); (void) fprintf(stderr, "/%u", m->str_range);

View file

@ -1,4 +1,4 @@
/* $NetBSD: readcdf.c,v 1.6 2011/09/28 13:50:09 christos Exp $ */ /* $NetBSD: readcdf.c,v 1.7 2012/02/22 17:53:51 christos Exp $ */
/*- /*-
* Copyright (c) 2008 Christos Zoulas * Copyright (c) 2008 Christos Zoulas
@ -29,9 +29,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: readcdf.c,v 1.26 2011/08/26 13:38:28 christos Exp $") FILE_RCSID("@(#)$File: readcdf.c,v 1.29 2012/02/20 20:04:58 christos Exp $")
#else #else
__RCSID("$NetBSD: readcdf.c,v 1.6 2011/09/28 13:50:09 christos Exp $"); __RCSID("$NetBSD: readcdf.c,v 1.7 2012/02/22 17:53:51 christos Exp $");
#endif #endif
#endif #endif
@ -82,6 +82,16 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
info[i].pi_u32) == -1) info[i].pi_u32) == -1)
return -1; return -1;
break; break;
case CDF_FLOAT:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_f) == -1)
return -1;
break;
case CDF_DOUBLE:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_d) == -1)
return -1;
break;
case CDF_LENGTH32_STRING: case CDF_LENGTH32_STRING:
case CDF_LENGTH32_WSTRING: case CDF_LENGTH32_WSTRING:
len = info[i].pi_str.s_len; len = info[i].pi_str.s_len;
@ -154,9 +164,8 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
if (!NOTMIME(ms)) { if (!NOTMIME(ms)) {
if (str == NULL) if (str == NULL)
return 0; return 0;
if (file_printf(ms, "application/%s", str) == -1) if (file_printf(ms, "application/%s", str) == -1)
return -1; return -1;
} }
return 1; return 1;
} }
@ -174,30 +183,31 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
return -1; return -1;
if (NOTMIME(ms)) { if (NOTMIME(ms)) {
if (file_printf(ms, "Composite Document File V2 Document") == -1) if (file_printf(ms, "Composite Document File V2 Document")
== -1)
return -1; return -1;
if (file_printf(ms, ", %s Endian", if (file_printf(ms, ", %s Endian",
si.si_byte_order == 0xfffe ? "Little" : "Big") == -1) si.si_byte_order == 0xfffe ? "Little" : "Big") == -1)
return -1; return -2;
switch (si.si_os) { switch (si.si_os) {
case 2: case 2:
if (file_printf(ms, ", Os: Windows, Version %d.%d", if (file_printf(ms, ", Os: Windows, Version %d.%d",
si.si_os_version & 0xff, si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1) (uint32_t)si.si_os_version >> 8) == -1)
return -1; return -2;
break; break;
case 1: case 1:
if (file_printf(ms, ", Os: MacOS, Version %d.%d", if (file_printf(ms, ", Os: MacOS, Version %d.%d",
(uint32_t)si.si_os_version >> 8, (uint32_t)si.si_os_version >> 8,
si.si_os_version & 0xff) == -1) si.si_os_version & 0xff) == -1)
return -1; return -2;
break; break;
default: default:
if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os, if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
si.si_os_version & 0xff, si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1) (uint32_t)si.si_os_version >> 8) == -1)
return -1; return -2;
break; break;
} }
} }
@ -205,7 +215,7 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
m = cdf_file_property_info(ms, info, count); m = cdf_file_property_info(ms, info, count);
free(info); free(info);
return m; return m == -1 ? -2 : m;
} }
protected int protected int
@ -274,7 +284,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
#ifdef CDF_DEBUG #ifdef CDF_DEBUG
cdf_dump_summary_info(&h, &scn); cdf_dump_summary_info(&h, &scn);
#endif #endif
if ((i = cdf_file_summary_info(ms, &h, &scn)) == -1) if ((i = cdf_file_summary_info(ms, &h, &scn)) < 0)
expn = "Can't expand summary_info"; expn = "Can't expand summary_info";
if (i == 0) { if (i == 0) {
const char *str = "vnd.ms-office"; const char *str = "vnd.ms-office";
@ -305,8 +315,10 @@ out1:
free(sat.sat_tab); free(sat.sat_tab);
out0: out0:
if (i != 1) { if (i != 1) {
if (file_printf(ms, "Composite Document File V2 Document") == -1) if (i == -1)
return -1; if (file_printf(ms, "Composite Document File V2 Document")
== -1)
return -1;
if (*expn) if (*expn)
if (file_printf(ms, ", %s%s", corrupt, expn) == -1) if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
return -1; return -1;

View file

@ -1,4 +1,4 @@
/* $NetBSD: softmagic.c,v 1.4 2011/09/16 21:06:27 christos Exp $ */ /* $NetBSD: softmagic.c,v 1.6 2012/04/07 17:30:56 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -35,9 +35,9 @@
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: softmagic.c,v 1.145 2011/05/13 22:15:40 christos Exp $") FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11/05 15:44:22 rrt Exp $")
#else #else
__RCSID("$NetBSD: softmagic.c,v 1.4 2011/09/16 21:06:27 christos Exp $"); __RCSID("$NetBSD: softmagic.c,v 1.6 2012/04/07 17:30:56 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -49,9 +49,9 @@ __RCSID("$NetBSD: softmagic.c,v 1.4 2011/09/16 21:06:27 christos Exp $");
private int match(struct magic_set *, struct magic *, uint32_t, private int match(struct magic_set *, struct magic *, uint32_t,
const unsigned char *, size_t, int); const unsigned char *, size_t, int, int);
private int mget(struct magic_set *, const unsigned char *, private int mget(struct magic_set *, const unsigned char *,
struct magic *, size_t, unsigned int); struct magic *, size_t, unsigned int, int);
private int magiccheck(struct magic_set *, struct magic *); private int magiccheck(struct magic_set *, struct magic *);
private int32_t mprint(struct magic_set *, struct magic *); private int32_t mprint(struct magic_set *, struct magic *);
private int32_t moffset(struct magic_set *, struct magic *); private int32_t moffset(struct magic_set *, struct magic *);
@ -72,12 +72,14 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
*/ */
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ /*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
protected int protected int
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes, int mode) file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
int mode, int text)
{ {
struct mlist *ml; struct mlist *ml;
int rv; int rv;
for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next) for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode)) != 0) if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode,
text)) != 0)
return rv; return rv;
return 0; return 0;
@ -112,7 +114,7 @@ file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes, in
*/ */
private int private int
match(struct magic_set *ms, struct magic *magic, uint32_t nmagic, match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
const unsigned char *s, size_t nbytes, int mode) const unsigned char *s, size_t nbytes, int mode, int text)
{ {
uint32_t magindex = 0; uint32_t magindex = 0;
unsigned int cont_level = 0; unsigned int cont_level = 0;
@ -129,7 +131,10 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
int flush = 0; int flush = 0;
struct magic *m = &magic[magindex]; struct magic *m = &magic[magindex];
if ((m->flag & mode) != mode) { if ((IS_STRING(m->type) &&
((text && (m->str_flags & (STRING_BINTEST | STRING_TEXTTEST)) == STRING_BINTEST) ||
(!text && (m->str_flags & (STRING_TEXTTEST | STRING_BINTEST)) == STRING_TEXTTEST))) ||
(m->flag & mode) != mode) {
/* Skip sub-tests */ /* Skip sub-tests */
while (magic[magindex + 1].cont_level != 0 && while (magic[magindex + 1].cont_level != 0 &&
++magindex < nmagic) ++magindex < nmagic)
@ -141,7 +146,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
ms->line = m->lineno; ms->line = m->lineno;
/* if main entry matches, print it... */ /* if main entry matches, print it... */
switch (mget(ms, s, m, nbytes, cont_level)) { switch (mget(ms, s, m, nbytes, cont_level, text)) {
case -1: case -1:
return -1; return -1;
case 0: case 0:
@ -224,7 +229,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
continue; continue;
} }
#endif #endif
switch (mget(ms, s, m, nbytes, cont_level)) { switch (mget(ms, s, m, nbytes, cont_level, text)) {
case -1: case -1:
return -1; return -1;
case 0: case 0:
@ -1019,10 +1024,12 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
private int private int
mget(struct magic_set *ms, const unsigned char *s, mget(struct magic_set *ms, const unsigned char *s,
struct magic *m, size_t nbytes, unsigned int cont_level) struct magic *m, size_t nbytes, unsigned int cont_level, int text)
{ {
uint32_t offset = ms->offset; uint32_t offset = ms->offset;
uint32_t count = m->str_range; uint32_t count = m->str_range;
int rv;
char *sbuf, *rbuf;
union VALUETYPE *p = &ms->ms_value; union VALUETYPE *p = &ms->ms_value;
if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1) if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1)
@ -1071,6 +1078,8 @@ mget(struct magic_set *ms, const unsigned char *s,
(q->hl[3]<<8)|(q->hl[2])); (q->hl[3]<<8)|(q->hl[2]));
break; break;
} }
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect offs=%u\n", off);
} }
switch (m->in_type) { switch (m->in_type) {
case FILE_BYTE: case FILE_BYTE:
@ -1511,6 +1520,8 @@ mget(struct magic_set *ms, const unsigned char *s,
if (m->flag & INDIROFFADD) { if (m->flag & INDIROFFADD) {
offset += ms->c.li[cont_level-1].off; offset += ms->c.li[cont_level-1].off;
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect +offs=%u\n", offset);
} }
if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1) if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
return -1; return -1;
@ -1578,13 +1589,26 @@ mget(struct magic_set *ms, const unsigned char *s,
break; break;
case FILE_INDIRECT: case FILE_INDIRECT:
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
file_printf(ms, "%s", m->desc) == -1)
return -1;
if (nbytes < offset) if (nbytes < offset)
return 0; return 0;
return file_softmagic(ms, s + offset, nbytes - offset, sbuf = ms->o.buf;
BINTEST); ms->o.buf = NULL;
rv = file_softmagic(ms, s + offset, nbytes - offset,
BINTEST, text);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
if (rv == 1) {
rbuf = ms->o.buf;
ms->o.buf = sbuf;
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
file_printf(ms, m->desc, offset) == -1)
return -1;
if (file_printf(ms, "%s", rbuf) == -1)
return -1;
free(rbuf);
} else
ms->o.buf = sbuf;
return rv;
case FILE_DEFAULT: /* nothing to check */ case FILE_DEFAULT: /* nothing to check */
default: default:

View file

@ -1,4 +1,4 @@
/* $NetBSD: vasprintf.c,v 1.1.1.1 2009/05/08 16:35:05 christos Exp $ */ /* $NetBSD: vasprintf.c,v 1.1.1.2 2012/02/22 17:48:20 christos Exp $ */
/* /*
* Copyright (c) Ian F. Darwin 1986-1995. * Copyright (c) Ian F. Darwin 1986-1995.
@ -111,9 +111,9 @@ you use strange formats.
#ifndef lint #ifndef lint
#if 0 #if 0
FILE_RCSID("@(#)$File: vasprintf.c,v 1.7 2009/02/03 20:27:52 christos Exp $") FILE_RCSID("@(#)$File: vasprintf.c,v 1.8 2011/12/08 12:38:24 rrt Exp $")
#else #else
__RCSID("$NetBSD: vasprintf.c,v 1.1.1.1 2009/05/08 16:35:05 christos Exp $"); __RCSID("$NetBSD: vasprintf.c,v 1.1.1.2 2012/02/22 17:48:20 christos Exp $");
#endif #endif
#endif /* lint */ #endif /* lint */
@ -614,8 +614,7 @@ static int core(xprintf_struct *s)
return s->pseudo_len; return s->pseudo_len;
free_EOF: free_EOF:
if (s->buffer_base != NULL) free(s->buffer_base);
free(s->buffer_base);
return EOF; return EOF;
} }

View file

@ -13,6 +13,14 @@
/* HAVE_DAYLIGHT */ /* HAVE_DAYLIGHT */
#define HAVE_DAYLIGHT 1 #define HAVE_DAYLIGHT 1
/* Define to 1 if you have the declaration of `daylight', and to 0 if you
don't. */
#define HAVE_DECL_DAYLIGHT 1
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
*/
#define HAVE_DECL_TZNAME 1
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1 #define HAVE_DLFCN_H 1
@ -22,9 +30,15 @@
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1 #define HAVE_FCNTL_H 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#define HAVE_FSEEKO 1 #define HAVE_FSEEKO 1
/* Define to 1 if you have the `getline' function. */
#define HAVE_GETLINE 1
/* Define to 1 if you have the <getopt.h> header file. */ /* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1 #define HAVE_GETOPT_H 1
@ -65,7 +79,7 @@
#define HAVE_MKSTEMP 1 #define HAVE_MKSTEMP 1
/* Define to 1 if you have the `mmap' function. */ /* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP /* #undef HAVE_MMAP */
/* Define to 1 if the system has the type `pid_t'. */ /* Define to 1 if the system has the type `pid_t'. */
#define HAVE_PID_T 1 #define HAVE_PID_T 1
@ -112,10 +126,8 @@
/* Define to 1 if `struct tm' is a member of `tm_zone'. */ /* Define to 1 if `struct tm' is a member of `tm_zone'. */
#define HAVE_STRUCT_TM_TM_ZONE 1 #define HAVE_STRUCT_TM_TM_ZONE 1
#ifndef __minix
/* Define to 1 if you have the <sys/mman.h> header file. */ /* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1 /* #undef HAVE_SYS_MMAN_H */
#endif
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1 #define HAVE_SYS_STAT_H 1
@ -159,10 +171,8 @@
/* Define to 1 if you have the `utime' function. */ /* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1 #define HAVE_UTIME 1
#ifndef __minix
/* Define to 1 if you have the `utimes' function. */ /* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1 /* #undef HAVE_UTIMES */
#endif
/* Define to 1 if you have the <utime.h> header file. */ /* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1 #define HAVE_UTIME_H 1
@ -182,6 +192,10 @@
/* Define to 1 if you have the <zlib.h> header file. */ /* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1 #define HAVE_ZLIB_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/ */
/* #undef MAJOR_IN_MKDEV */ /* #undef MAJOR_IN_MKDEV */
@ -203,7 +217,7 @@
#define PACKAGE_NAME "file" #define PACKAGE_NAME "file"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "file 5.09" #define PACKAGE_STRING "file 5.11"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "file" #define PACKAGE_TARNAME "file"
@ -212,7 +226,7 @@
#define PACKAGE_URL "" #define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "5.09" #define PACKAGE_VERSION "5.11"
/* The size of `long long', as computed by sizeof. */ /* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8 #define SIZEOF_LONG_LONG 8
@ -246,7 +260,7 @@
/* Version number of package */ /* Version number of package */
#define VERSION "5.09" #define VERSION "5.11"
/* Number of bits in a file offset, on hosts where this is settable. */ /* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */ /* #undef _FILE_OFFSET_BITS */

View file

@ -1,2 +1,4 @@
# $NetBSD: shlib_version,v 1.2 2011/05/13 01:52:13 christos Exp $
#
major=0 major=0
minor=0 minor=0

View file

@ -135,7 +135,7 @@ SUBDIR+= libnpf # depends on libprop
SUBDIR+= ../crypto/external/bsd/openssl/lib # depends on libcrypt SUBDIR+= ../crypto/external/bsd/openssl/lib # depends on libcrypt
.endif .endif
#SUBDIR+= ../external/bsd/file/lib # depends on libz SUBDIR+= ../external/bsd/file/lib # depends on libz
.if (${MKISCSI} != "no") .if (${MKISCSI} != "no")
SUBDIR+= ../external/bsd/iscsi/lib # depends on libpthread SUBDIR+= ../external/bsd/iscsi/lib # depends on libpthread