Module Name:    src
Committed By:   christos
Date:           Wed Feb 22 17:53:52 UTC 2012

Modified Files:
        src/external/bsd/file/dist: configure configure.ac install-sh
        src/external/bsd/file/dist/doc: file.1 libmagic.3 magic.5
        src/external/bsd/file/dist/magic: Makefile.am Makefile.in
        src/external/bsd/file/dist/magic/magdir: archive
        src/external/bsd/file/dist/src: Makefile.in apprentice.c cdf.c
            cdf_time.c compress.c file.h funcs.c print.c readcdf.c softmagic.c
Removed Files:
        src/external/bsd/file/dist/src: names.h

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/configure
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/configure.ac
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/install-sh
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/file/dist/doc/file.1
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/file/dist/doc/libmagic.3
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/doc/magic.5
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/magic/Makefile.am
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/magic/Makefile.in
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/magic/magdir/archive
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/src/Makefile.in \
    src/external/bsd/file/dist/src/compress.c \
    src/external/bsd/file/dist/src/softmagic.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/src/apprentice.c \
    src/external/bsd/file/dist/src/cdf.c \
    src/external/bsd/file/dist/src/file.h
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/src/cdf_time.c \
    src/external/bsd/file/dist/src/funcs.c \
    src/external/bsd/file/dist/src/print.c
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/file/dist/src/names.h
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/src/readcdf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/file/dist/configure
diff -u src/external/bsd/file/dist/configure:1.6 src/external/bsd/file/dist/configure:1.7
--- src/external/bsd/file/dist/configure:1.6	Sun Sep 25 14:18:43 2011
+++ src/external/bsd/file/dist/configure	Wed Feb 22 12:53:48 2012
@@ -1,6 +1,6 @@
 #! /bin/sh
 # 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 <chris...@astron.com>.
 #
@@ -698,8 +698,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.09'
-PACKAGE_STRING='file 5.09'
+PACKAGE_VERSION='5.11'
+PACKAGE_STRING='file 5.11'
 PACKAGE_BUGREPORT='chris...@astron.com'
 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.
   # This message is too long to be a string in the A/UX 3.1 sh.
   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]...
 
@@ -1501,7 +1501,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of file 5.09:";;
+     short | recursive ) echo "Configuration of file 5.11:";;
    esac
   cat <<\_ACEOF
 
@@ -1609,8 +1609,8 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.09
-generated by GNU Autoconf 2.64
+file configure 5.11
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 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
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by file $as_me 5.09, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+It was created by file $as_me 5.11, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -3116,7 +3116,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.09'
+ VERSION='5.11'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13477,8 +13477,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by file $as_me 5.09, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+This file was extended by file $as_me 5.11, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13541,9 +13541,9 @@ Report bugs to <chris...@astron.com>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-file config.status 5.09
-configured by $0, generated by GNU Autoconf 2.64,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+file config.status 5.11
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation

Index: src/external/bsd/file/dist/configure.ac
diff -u src/external/bsd/file/dist/configure.ac:1.3 src/external/bsd/file/dist/configure.ac:1.4
--- src/external/bsd/file/dist/configure.ac:1.3	Fri Sep 16 17:06:24 2011
+++ src/external/bsd/file/dist/configure.ac	Wed Feb 22 12:53:50 2012
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(file, 5.09, chris...@astron.com)
+AC_INIT(file, 5.11, chris...@astron.com)
 AM_INIT_AUTOMAKE()
 AM_MAINTAINER_MODE(disable)
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

Index: src/external/bsd/file/dist/install-sh
diff -u src/external/bsd/file/dist/install-sh:1.4 src/external/bsd/file/dist/install-sh:1.5
--- src/external/bsd/file/dist/install-sh:1.4	Sun Sep 25 14:18:44 2011
+++ src/external/bsd/file/dist/install-sh	Wed Feb 22 12:53:50 2012
@@ -1,6 +1,6 @@
 #!/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
 # multiple files with spaces in the file names.
 #

Index: src/external/bsd/file/dist/doc/file.1
diff -u src/external/bsd/file/dist/doc/file.1:1.8 src/external/bsd/file/dist/doc/file.1:1.9
--- src/external/bsd/file/dist/doc/file.1:1.8	Fri Sep 16 17:06:25 2011
+++ src/external/bsd/file/dist/doc/file.1	Wed Feb 22 12:53:50 2012
@@ -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 $
-.Dd April 20, 2011
+.\" $File: file.man,v 1.98 2011/12/08 12:12:46 rrt Exp $
+.Dd October 17, 2011
 .Dt FILE 1
 .Os
 .Sh NAME
@@ -26,7 +26,7 @@
 .Nm
 .Op Fl Fl help
 .Sh DESCRIPTION
-This manual page documents version 5.09 of the
+This manual page documents version 5.11 of the
 .Nm
 command.
 .Pp
@@ -194,7 +194,7 @@ option).
 .It encoding
 Different text encodings for soft magic tests.
 .It tokens
-Looks for known tokens inside text files.
+Ignored for backwards compatibility.
 .It cdf
 Prints details of Compound Document Files.
 .It compress
@@ -222,6 +222,19 @@ or at least one filename argument must b
 to test the standard input, use
 .Sq -
 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
 option causes symlinks not to be followed
 (on systems that support symbolic links).

Index: src/external/bsd/file/dist/doc/libmagic.3
diff -u src/external/bsd/file/dist/doc/libmagic.3:1.9 src/external/bsd/file/dist/doc/libmagic.3:1.10
--- src/external/bsd/file/dist/doc/libmagic.3:1.9	Thu Nov 10 08:41:00 2011
+++ src/external/bsd/file/dist/doc/libmagic.3	Wed Feb 22 12:53:50 2012
@@ -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.
 .\" All Rights Reserved.
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 14, 2011
+.Dd December 19, 2011
 .Dt LIBMAGIC 3
 .Os
 .Sh NAME
@@ -66,6 +66,8 @@
 .Ft int
 .Fn magic_compile "magic_t cookie" "const char *filename"
 .Ft int
+.Fn magic_list "magic_t cookie" "const char *filename"
+.Ft int
 .Fn magic_load "magic_t cookie" "const char *filename"
 .Sh DESCRIPTION
 These functions
@@ -221,6 +223,17 @@ of each file argument with
 appended to it.
 .Pp
 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
 function must be used to load the the colon
 separated list of database files passed in as
@@ -246,15 +259,17 @@ It will set errno to
 .Er EINVAL
 if an unsupported value for flags was given.
 The
+.Fn magic_list ,
 .Fn magic_load ,
 .Fn magic_compile ,
 and
 .Fn magic_check
 functions return 0 on success and \-1 on failure.
 The
-.Fn magic_file ,
+.Fn magic_buffer ,
+.Fn magic_getpath ,
 and
-.Fn magic_buffer
+.Fn magic_file ,
 functions return a string on success and
 .Dv NULL
 on failure.

Index: src/external/bsd/file/dist/doc/magic.5
diff -u src/external/bsd/file/dist/doc/magic.5:1.6 src/external/bsd/file/dist/doc/magic.5:1.7
--- src/external/bsd/file/dist/doc/magic.5:1.6	Fri Sep 16 17:06:25 2011
+++ src/external/bsd/file/dist/doc/magic.5	Wed Feb 22 12:53:50 2012
@@ -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
 .Dt MAGIC 5
 .Os
@@ -12,7 +12,7 @@
 This manual page documents the format of the magic file as
 used by the
 .Xr file 1
-command, version 5.09.
+command, version 5.11.
 The
 .Xr file 1
 command identifies the type of a file using,
@@ -65,16 +65,16 @@ consecutive blanks, the target needs at 
 consecutive blanks to match.
 The
 .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
 .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
 target, whereas upper case characters in the magic only match upper case
 characters in the target.
 The
 .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
 target, whereas lower case characters in the magic only match upper case
 characters in the target.
@@ -84,9 +84,9 @@ and
 .Dq C .
 The
 .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
-flag, forces the test to be done for binary files.
+flag forces the test to be done for binary files.
 .It Dv pstring
 A Pascal-style string where the first byte/short/int is interpreted as the an
 unsigned length.

Index: src/external/bsd/file/dist/magic/Makefile.am
diff -u src/external/bsd/file/dist/magic/Makefile.am:1.4 src/external/bsd/file/dist/magic/Makefile.am:1.5
--- src/external/bsd/file/dist/magic/Makefile.am:1.4	Fri Sep 16 17:06:25 2011
+++ src/external/bsd/file/dist/magic/Makefile.am	Wed Feb 22 12:53:50 2012
@@ -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_DIR = $(top_srcdir)/magic
@@ -22,6 +22,7 @@ $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apple \
 $(MAGIC_FRAGMENT_DIR)/applix \
 $(MAGIC_FRAGMENT_DIR)/archive \
+$(MAGIC_FRAGMENT_DIR)/assembler \
 $(MAGIC_FRAGMENT_DIR)/asterix \
 $(MAGIC_FRAGMENT_DIR)/att3b \
 $(MAGIC_FRAGMENT_DIR)/audio \
@@ -52,6 +53,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/database \
 $(MAGIC_FRAGMENT_DIR)/diamond \
@@ -88,6 +90,7 @@ $(MAGIC_FRAGMENT_DIR)/gnumeric \
 $(MAGIC_FRAGMENT_DIR)/grace \
 $(MAGIC_FRAGMENT_DIR)/graphviz \
 $(MAGIC_FRAGMENT_DIR)/gringotts \
+$(MAGIC_FRAGMENT_DIR)/guile \
 $(MAGIC_FRAGMENT_DIR)/hitachi-sh \
 $(MAGIC_FRAGMENT_DIR)/hp \
 $(MAGIC_FRAGMENT_DIR)/human68k \
@@ -114,10 +117,12 @@ $(MAGIC_FRAGMENT_DIR)/lisp \
 $(MAGIC_FRAGMENT_DIR)/llvm \
 $(MAGIC_FRAGMENT_DIR)/lua \
 $(MAGIC_FRAGMENT_DIR)/luks \
+$(MAGIC_FRAGMENT_DIR)/m4 \
 $(MAGIC_FRAGMENT_DIR)/mach \
 $(MAGIC_FRAGMENT_DIR)/macintosh \
 $(MAGIC_FRAGMENT_DIR)/magic \
 $(MAGIC_FRAGMENT_DIR)/mail.news \
+$(MAGIC_FRAGMENT_DIR)/make \
 $(MAGIC_FRAGMENT_DIR)/maple \
 $(MAGIC_FRAGMENT_DIR)/marc21 \
 $(MAGIC_FRAGMENT_DIR)/mathcad \
@@ -140,6 +145,7 @@ $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/mup \
+$(MAGIC_FRAGMENT_DIR)/music \
 $(MAGIC_FRAGMENT_DIR)/natinst \
 $(MAGIC_FRAGMENT_DIR)/ncr \
 $(MAGIC_FRAGMENT_DIR)/netbsd \
@@ -159,6 +165,7 @@ $(MAGIC_FRAGMENT_DIR)/osf1 \
 $(MAGIC_FRAGMENT_DIR)/palm \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parrot \
+$(MAGIC_FRAGMENT_DIR)/pascal \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
@@ -238,6 +245,7 @@ $(MAGIC_FRAGMENT_DIR)/xenix \
 $(MAGIC_FRAGMENT_DIR)/xilinx \
 $(MAGIC_FRAGMENT_DIR)/xo65 \
 $(MAGIC_FRAGMENT_DIR)/xwindows \
+$(MAGIC_FRAGMENT_DIR)/zfs \
 $(MAGIC_FRAGMENT_DIR)/zilog \
 $(MAGIC_FRAGMENT_DIR)/zyxel 
 

Index: src/external/bsd/file/dist/magic/Makefile.in
diff -u src/external/bsd/file/dist/magic/Makefile.in:1.6 src/external/bsd/file/dist/magic/Makefile.in:1.7
--- src/external/bsd/file/dist/magic/Makefile.in:1.6	Sun Sep 25 14:18:44 2011
+++ src/external/bsd/file/dist/magic/Makefile.in	Wed Feb 22 12:53:51 2012
@@ -197,7 +197,7 @@ top_builddir = @top_builddir@
 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_DIR = $(top_srcdir)/magic
@@ -218,6 +218,7 @@ $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apple \
 $(MAGIC_FRAGMENT_DIR)/applix \
 $(MAGIC_FRAGMENT_DIR)/archive \
+$(MAGIC_FRAGMENT_DIR)/assembler \
 $(MAGIC_FRAGMENT_DIR)/asterix \
 $(MAGIC_FRAGMENT_DIR)/att3b \
 $(MAGIC_FRAGMENT_DIR)/audio \
@@ -248,6 +249,7 @@ $(MAGIC_FRAGMENT_DIR)/console \
 $(MAGIC_FRAGMENT_DIR)/convex \
 $(MAGIC_FRAGMENT_DIR)/cracklib \
 $(MAGIC_FRAGMENT_DIR)/ctags \
+$(MAGIC_FRAGMENT_DIR)/cups \
 $(MAGIC_FRAGMENT_DIR)/dact \
 $(MAGIC_FRAGMENT_DIR)/database \
 $(MAGIC_FRAGMENT_DIR)/diamond \
@@ -284,6 +286,7 @@ $(MAGIC_FRAGMENT_DIR)/gnumeric \
 $(MAGIC_FRAGMENT_DIR)/grace \
 $(MAGIC_FRAGMENT_DIR)/graphviz \
 $(MAGIC_FRAGMENT_DIR)/gringotts \
+$(MAGIC_FRAGMENT_DIR)/guile \
 $(MAGIC_FRAGMENT_DIR)/hitachi-sh \
 $(MAGIC_FRAGMENT_DIR)/hp \
 $(MAGIC_FRAGMENT_DIR)/human68k \
@@ -310,10 +313,12 @@ $(MAGIC_FRAGMENT_DIR)/lisp \
 $(MAGIC_FRAGMENT_DIR)/llvm \
 $(MAGIC_FRAGMENT_DIR)/lua \
 $(MAGIC_FRAGMENT_DIR)/luks \
+$(MAGIC_FRAGMENT_DIR)/m4 \
 $(MAGIC_FRAGMENT_DIR)/mach \
 $(MAGIC_FRAGMENT_DIR)/macintosh \
 $(MAGIC_FRAGMENT_DIR)/magic \
 $(MAGIC_FRAGMENT_DIR)/mail.news \
+$(MAGIC_FRAGMENT_DIR)/make \
 $(MAGIC_FRAGMENT_DIR)/maple \
 $(MAGIC_FRAGMENT_DIR)/marc21 \
 $(MAGIC_FRAGMENT_DIR)/mathcad \
@@ -336,6 +341,7 @@ $(MAGIC_FRAGMENT_DIR)/msdos \
 $(MAGIC_FRAGMENT_DIR)/msooxml \
 $(MAGIC_FRAGMENT_DIR)/msvc \
 $(MAGIC_FRAGMENT_DIR)/mup \
+$(MAGIC_FRAGMENT_DIR)/music \
 $(MAGIC_FRAGMENT_DIR)/natinst \
 $(MAGIC_FRAGMENT_DIR)/ncr \
 $(MAGIC_FRAGMENT_DIR)/netbsd \
@@ -355,6 +361,7 @@ $(MAGIC_FRAGMENT_DIR)/osf1 \
 $(MAGIC_FRAGMENT_DIR)/palm \
 $(MAGIC_FRAGMENT_DIR)/parix \
 $(MAGIC_FRAGMENT_DIR)/parrot \
+$(MAGIC_FRAGMENT_DIR)/pascal \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
@@ -434,6 +441,7 @@ $(MAGIC_FRAGMENT_DIR)/xenix \
 $(MAGIC_FRAGMENT_DIR)/xilinx \
 $(MAGIC_FRAGMENT_DIR)/xo65 \
 $(MAGIC_FRAGMENT_DIR)/xwindows \
+$(MAGIC_FRAGMENT_DIR)/zfs \
 $(MAGIC_FRAGMENT_DIR)/zilog \
 $(MAGIC_FRAGMENT_DIR)/zyxel 
 

Index: src/external/bsd/file/dist/magic/magdir/archive
diff -u src/external/bsd/file/dist/magic/magdir/archive:1.5 src/external/bsd/file/dist/magic/magdir/archive:1.6
--- src/external/bsd/file/dist/magic/magdir/archive:1.5	Wed Sep 28 09:50:52 2011
+++ src/external/bsd/file/dist/magic/magdir/archive	Wed Feb 22 12:53:51 2012
@@ -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-
 #           extracting compressed archives)
 #
@@ -12,6 +12,11 @@
 257	string		ustar\040\040\0	GNU tar archive
 !: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
 #
 # Yes, the top two "cpio archive" formats *are* supposed to just be "short".

Index: src/external/bsd/file/dist/src/Makefile.in
diff -u src/external/bsd/file/dist/src/Makefile.in:1.4 src/external/bsd/file/dist/src/Makefile.in:1.5
--- src/external/bsd/file/dist/src/Makefile.in:1.4	Sun Sep 25 14:18:45 2011
+++ src/external/bsd/file/dist/src/Makefile.in	Wed Feb 22 12:53:51 2012
@@ -248,7 +248,7 @@ AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
 AM_CFLAGS = @WARNINGS@
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
 	encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
-	funcs.c file.h 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
 
 libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
Index: src/external/bsd/file/dist/src/compress.c
diff -u src/external/bsd/file/dist/src/compress.c:1.4 src/external/bsd/file/dist/src/compress.c:1.5
--- src/external/bsd/file/dist/src/compress.c:1.4	Fri Sep 16 17:06:26 2011
+++ src/external/bsd/file/dist/src/compress.c	Wed Feb 22 12:53:51 2012
@@ -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.
@@ -38,9 +38,9 @@
 
 #ifndef lint
 #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
-__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
 
@@ -140,8 +140,7 @@ file_zmagic(struct magic_set *ms, int fd
 		}
 	}
 error:
-	if (newbuf)
-		free(newbuf);
+	free(newbuf);
 	ms->flags |= MAGIC_COMPRESS;
 	return rv;
 }
Index: src/external/bsd/file/dist/src/softmagic.c
diff -u src/external/bsd/file/dist/src/softmagic.c:1.4 src/external/bsd/file/dist/src/softmagic.c:1.5
--- src/external/bsd/file/dist/src/softmagic.c:1.4	Fri Sep 16 17:06:27 2011
+++ src/external/bsd/file/dist/src/softmagic.c	Wed Feb 22 12:53:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: softmagic.c,v 1.4 2011/09/16 21:06:27 christos Exp $	*/
+/*	$NetBSD: softmagic.c,v 1.5 2012/02/22 17:53:51 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -35,9 +35,9 @@
 
 #ifndef	lint
 #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
-__RCSID("$NetBSD: softmagic.c,v 1.4 2011/09/16 21:06:27 christos Exp $");
+__RCSID("$NetBSD: softmagic.c,v 1.5 2012/02/22 17:53:51 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -49,9 +49,9 @@ __RCSID("$NetBSD: softmagic.c,v 1.4 2011
 
 
 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 *,
-    struct magic *, size_t, unsigned int);
+    struct magic *, size_t, unsigned int, int);
 private int magiccheck(struct magic_set *, struct magic *);
 private int32_t mprint(struct magic_set *, struct magic *);
 private int32_t moffset(struct magic_set *, struct magic *);
@@ -72,12 +72,14 @@ private void cvt_64(union VALUETYPE *, c
  */
 /*ARGSUSED1*/		/* nbytes passed for regularity, maybe need later */
 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;
 	int rv;
 	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 0;
@@ -112,7 +114,7 @@ file_softmagic(struct magic_set *ms, con
  */
 private int
 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;
 	unsigned int cont_level = 0;
@@ -129,7 +131,10 @@ match(struct magic_set *ms, struct magic
 		int flush = 0;
 		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 */
 			while (magic[magindex + 1].cont_level != 0 &&
 			       ++magindex < nmagic)
@@ -141,7 +146,7 @@ match(struct magic_set *ms, struct magic
 		ms->line = m->lineno;
 
 		/* 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:
 			return -1;
 		case 0:
@@ -224,7 +229,7 @@ match(struct magic_set *ms, struct magic
 					continue;
 			}
 #endif
-			switch (mget(ms, s, m, nbytes, cont_level)) {
+			switch (mget(ms, s, m, nbytes, cont_level, text)) {
 			case -1:
 				return -1;
 			case 0:
@@ -1019,7 +1024,7 @@ mcopy(struct magic_set *ms, union VALUET
 
 private int
 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 count = m->str_range;
@@ -1584,7 +1589,7 @@ mget(struct magic_set *ms, const unsigne
 		if (nbytes < offset)
 			return 0;
 		return file_softmagic(ms, s + offset, nbytes - offset,
-		    BINTEST);
+		    BINTEST, text);
 
 	case FILE_DEFAULT:	/* nothing to check */
 	default:

Index: src/external/bsd/file/dist/src/apprentice.c
diff -u src/external/bsd/file/dist/src/apprentice.c:1.5 src/external/bsd/file/dist/src/apprentice.c:1.6
--- src/external/bsd/file/dist/src/apprentice.c:1.5	Fri Sep 16 17:06:26 2011
+++ src/external/bsd/file/dist/src/apprentice.c	Wed Feb 22 12:53:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: apprentice.c,v 1.5 2011/09/16 21:06:26 christos Exp $	*/
+/*	$NetBSD: apprentice.c,v 1.6 2012/02/22 17:53:51 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -35,9 +35,9 @@
 
 #ifndef	lint
 #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
-__RCSID("$NetBSD: apprentice.c,v 1.5 2011/09/16 21:06:26 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.6 2012/02/22 17:53:51 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -742,8 +742,7 @@ load_1(struct magic_set *ms, int action,
 			break;
 		}
 	}
-	if (line)
-		free(line);
+	free(line);
 	(void)fclose(f);
 }
 
@@ -796,6 +795,7 @@ apprentice_load(struct magic_set *ms, st
 				file_oomem(ms,
 				    strlen(fn) + strlen(d->d_name) + 2);
 				errs++;
+				closedir(dir);
 				goto out;
 			}
 			if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
@@ -810,6 +810,7 @@ apprentice_load(struct magic_set *ms, st
 				    realloc(filearr, mlen))) == NULL) {
 					file_oomem(ms, mlen);
 					free(mfn);
+					closedir(dir);
 					errs++;
 					goto out;
 				}
@@ -2306,7 +2307,7 @@ private int
 apprentice_compile(struct magic_set *ms, struct magic **magicp,
     uint32_t *nmagicp, const char *fn)
 {
-	int fd;
+	int fd = -1;
 	char *dbname;
 	int rv = -1;
 
@@ -2337,7 +2338,8 @@ apprentice_compile(struct magic_set *ms,
 		goto out;
 	}
 
-	(void)close(fd);
+	if (fd != -1)
+		(void)close(fd);
 	rv = 0;
 out:
 	free(dbname);
Index: src/external/bsd/file/dist/src/cdf.c
diff -u src/external/bsd/file/dist/src/cdf.c:1.5 src/external/bsd/file/dist/src/cdf.c:1.6
--- src/external/bsd/file/dist/src/cdf.c:1.5	Fri Sep 16 17:06:26 2011
+++ src/external/bsd/file/dist/src/cdf.c	Wed Feb 22 12:53:51 2012
@@ -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
@@ -38,9 +38,9 @@
 
 #ifndef lint
 #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
-__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
 
@@ -63,10 +63,6 @@ __RCSID("$NetBSD: cdf.c,v 1.5 2011/09/16
 
 #include "cdf.h"
 
-#ifndef __arraycount
-#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
-#endif
-
 #ifdef CDF_DEBUG
 #define DPRINTF(a) printf a, fflush(stdout)
 #else
@@ -85,6 +81,7 @@ static union {
 #define CDF_TOLE2(x)	((uint16_t)(NEED_SWAP ? _cdf_tole2(x) : (uint16_t)(x)))
 #define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
 
+
 /*
  * 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,
     const cdf_header_t *h, cdf_secid_t id)
 {
-	assert((size_t)CDF_SEC_SIZE(h) == len);
-	return cdf_read(info, (off_t)CDF_SEC_POS(h, id),
-	    ((char *)buf) + offs, len);
+	size_t ss = CDF_SEC_SIZE(h);
+	size_t pos = CDF_SEC_POS(h, id);
+	assert(ss == len);
+	return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);
 }
 
 ssize_t
 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)
 {
-	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,
-	    ((const char *)sst->sst_tab) + CDF_SHORT_SEC_POS(h, id), len);
+	    ((const char *)sst->sst_tab) + pos, len);
 	return len;
 }
 
@@ -429,8 +435,8 @@ cdf_read_sat(const cdf_info_t *info, cdf
 			if (sec < 0)
 				goto out;
 			if (i >= sat->sat_len) {
-			    DPRINTF(("Out of bounds reading MSA %u >= %u",
-				i, sat->sat_len));
+			    DPRINTF(("Out of bounds reading MSA %" SIZE_T_FORMAT
+				"u >= %" SIZE_T_FORMAT "u", i, sat->sat_len));
 			    errno = EFTYPE;
 			    goto out2;
 			}
@@ -503,7 +509,8 @@ cdf_read_long_sector_chain(const cdf_inf
 		}
 		if (i >= scn->sst_len) {
 			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;
 			goto out;
 		}
@@ -548,7 +555,8 @@ cdf_read_short_sector_chain(const cdf_he
 		}
 		if (i >= scn->sst_len) {
 			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;
 			goto out;
 		}
@@ -656,7 +664,8 @@ cdf_read_ssat(const cdf_info_t *info, co
 		}
 		if (i >= ssat->sat_len) {
 			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;
 			goto out;
 		}
@@ -796,17 +805,18 @@ cdf_read_property_info(const cdf_stream_
 	if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
 		goto out;
 	for (i = 0; i < sh.sh_properties; i++) {
+		size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
 		q = (const uint8_t *)(const void *)
-		    ((const char *)(const void *)p +
-		    CDF_GETUINT32(p, (i << 1) + 1)) - 2 * sizeof(uint32_t);
+		    ((const char *)(const void *)p + ofs
+		    - 2 * sizeof(uint32_t));
 		if (q > e) {
 			DPRINTF(("Ran of the end %p > %p\n", q, e));
 			goto out;
 		}
 		inp[i].pi_id = CDF_GETUINT32(p, i << 1);
 		inp[i].pi_type = CDF_GETUINT32(q, 0);
-		DPRINTF(("%d) id=%x type=%x offs=%x,%d\n", i, inp[i].pi_id,
-		    inp[i].pi_type, q - p, CDF_GETUINT32(p, (i << 1) + 1)));
+		DPRINTF(("%" SIZE_T_FORMAT "u) id=%x type=%x offs=0x%tx,0x%x\n",
+		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 		if (inp[i].pi_type & CDF_VECTOR) {
 			nelements = CDF_GETUINT32(q, 1);
 			o = 2;
@@ -852,6 +862,20 @@ cdf_read_property_info(const cdf_stream_
 			(void)memcpy(&u64, &q[o4], sizeof(u64));
 			inp[i].pi_u64 = CDF_TOLE8((uint64_t)u64);
 			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_WSTRING:
 			if (nelements > 1) {
@@ -867,17 +891,22 @@ cdf_read_property_info(const cdf_stream_
 				*info = inp;
 				inp = *info + nelem;
 			}
-			DPRINTF(("nelements = %d\n", nelements));
+			DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
+			    nelements));
 			for (j = 0; j < nelements; j++, i++) {
 				uint32_t l = CDF_GETUINT32(q, o);
 				inp[i].pi_str.s_len = l;
 				inp[i].pi_str.s_buf = (const char *)
 				    (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)),
 				    inp[i].pi_str.s_buf));
-				l = 4 + (uint32_t)CDF_ROUND(l, sizeof(l));
-				o += l >> 2;
+				if (l & 1)
+					l++;
+				o += l >> 1;
+				if (q + o >= e)
+					goto out;
 				o4 = o * sizeof(uint32_t);
 			}
 			i--;
@@ -896,7 +925,7 @@ cdf_read_property_info(const cdf_stream_
 		unknown:
 			DPRINTF(("Don't know how to deal with %x\n",
 			    inp[i].pi_type));
-			goto out;
+			break;
 		}
 	}
 	return 0;
@@ -935,8 +964,9 @@ cdf_unpack_summary_info(const cdf_stream
 			return -1;
 		}
 		if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
-		    info, count, &maxcount) == -1)
+		    info, count, &maxcount) == -1) {
 			return -1;
+		}
 	}
 	return 0;
 }
@@ -1061,14 +1091,14 @@ cdf_dump_sat(const char *prefix, const c
 	size_t i, j, s = size / sizeof(cdf_secid_t);
 
 	for (i = 0; i < sat->sat_len; i++) {
-		(void)fprintf(stderr, "%s[%" SIZE_T_FORMAT "u]:\n%.6d: ",
-		    prefix, i, i * s);
+		(void)fprintf(stderr, "%s[%" SIZE_T_FORMAT "u]:\n%.6"
+		    SIZE_T_FORMAT "u: ", prefix, i, i * s);
 		for (j = 0; j < s; j++) {
 			(void)fprintf(stderr, "%5d, ",
 			    CDF_TOLE4(sat->sat_tab[s * i + j]));
 			if ((j + 1) % 10 == 0)
-				(void)fprintf(stderr, "\n%.6d: ",
-				    i * s + j + 1);
+				(void)fprintf(stderr, "\n%.6" SIZE_T_FORMAT
+				    "u: ", i * s + j + 1);
 		}
 		(void)fprintf(stderr, "\n");
 	}
@@ -1087,7 +1117,8 @@ cdf_dump(void *v, size_t len)
 		if (j == 16) {
 			j = 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");
@@ -1185,6 +1216,14 @@ cdf_dump_property_info(const cdf_propert
 			(void)fprintf(stderr, "unsigned 32 [%u]\n",
 			    info[i].pi_u32);
 			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:
 			(void)fprintf(stderr, "string %u [%.*s]\n",
 			    info[i].pi_str.s_len,
Index: src/external/bsd/file/dist/src/file.h
diff -u src/external/bsd/file/dist/src/file.h:1.5 src/external/bsd/file/dist/src/file.h:1.6
--- src/external/bsd/file/dist/src/file.h:1.5	Fri Sep 16 17:06:26 2011
+++ src/external/bsd/file/dist/src/file.h	Wed Feb 22 12:53:51 2012
@@ -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.
@@ -29,7 +29,7 @@
  */
 /*
  * 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__
@@ -88,6 +88,10 @@
 #endif
 #define public
 
+#ifndef __arraycount
+#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
 #ifndef __GNUC_PREREQ__
 #ifdef __GNUC__
 #define	__GNUC_PREREQ__(x, y)						\
@@ -403,15 +407,16 @@ protected int file_trycdf(struct magic_s
 protected int file_zmagic(struct magic_set *, int, const char *,
     const unsigned char *, size_t);
 #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 *,
     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,
     unichar **, size_t *, const char **, const char **, const char **);
 protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
 protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
-    int);
+    int, int);
 protected struct mlist *file_apprentice(struct magic_set *, const char *, int);
 protected uint64_t file_signextend(struct magic_set *, struct magic *,
     uint64_t);

Index: src/external/bsd/file/dist/src/cdf_time.c
diff -u src/external/bsd/file/dist/src/cdf_time.c:1.3 src/external/bsd/file/dist/src/cdf_time.c:1.4
--- src/external/bsd/file/dist/src/cdf_time.c:1.3	Thu May 12 21:52:13 2011
+++ src/external/bsd/file/dist/src/cdf_time.c	Wed Feb 22 12:53:51 2012
@@ -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
@@ -30,9 +30,9 @@
 
 #ifndef lint
 #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
-__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
 
@@ -127,7 +127,7 @@ cdf_timestamp_to_timespec(struct timespe
 	tm.tm_year = (int)(CDF_BASE_YEAR + (t / 365));
 
 	rdays = cdf_getdays(tm.tm_year);
-	t -= rdays;
+	t -= rdays - 1;
 	tm.tm_mday = cdf_getday(tm.tm_year, (int)t);
 	tm.tm_mon = cdf_getmonth(tm.tm_year, (int)t);
 	tm.tm_wday = 0;
Index: src/external/bsd/file/dist/src/funcs.c
diff -u src/external/bsd/file/dist/src/funcs.c:1.3 src/external/bsd/file/dist/src/funcs.c:1.4
--- src/external/bsd/file/dist/src/funcs.c:1.3	Thu May 12 21:52:13 2011
+++ src/external/bsd/file/dist/src/funcs.c	Wed Feb 22 12:53:51 2012
@@ -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.
@@ -30,9 +30,9 @@
 
 #ifndef	lint
 #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
-__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	/* lint */
 
@@ -235,7 +235,8 @@ file_buffer(struct magic_set *ms, int fd
 
 	/* try soft magic tests */
 	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)
 				(void)fprintf(stderr, "softmagic %d\n", m);
 #ifdef BUILTIN_ELF
@@ -259,10 +260,10 @@ file_buffer(struct magic_set *ms, int fd
 			goto done;
 		}
 
-	/* try text properties (and possibly text tokens) */
+	/* try text properties */
 	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)
 				(void)fprintf(stderr, "ascmagic %d\n", m);
 			goto done;
@@ -272,7 +273,8 @@ file_buffer(struct magic_set *ms, int fd
 		if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
 			if (looks_text == 0)
 				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)
 						(void)fprintf(stderr,
 						    "ascmagic/enc %d\n", m);
@@ -295,8 +297,7 @@ file_buffer(struct magic_set *ms, int fd
 		if (file_printf(ms, "%s", code_mime) == -1)
 			rv = -1;
 	}
-	if (u8buf)
-		free(u8buf);
+	free(u8buf);
 	if (rv)
 		return rv;
 
Index: src/external/bsd/file/dist/src/print.c
diff -u src/external/bsd/file/dist/src/print.c:1.3 src/external/bsd/file/dist/src/print.c:1.4
--- src/external/bsd/file/dist/src/print.c:1.3	Fri Sep 16 17:06:26 2011
+++ src/external/bsd/file/dist/src/print.c	Wed Feb 22 12:53:51 2012
@@ -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.
@@ -35,9 +35,9 @@
 
 #ifndef lint
 #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
-__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  /* lint */
 
@@ -57,8 +57,8 @@ file_mdump(struct magic *m)
 {
 	private const char optyp[] = { FILE_OPS };
 
-	(void) fprintf(stderr, "%.*s %u", (m->cont_level & 7) + 1, ">>>>>>>>",
-		       m->offset);
+	(void) fprintf(stderr, "%u: %.*s %u", m->lineno,
+	    (m->cont_level & 7) + 1, ">>>>>>>>", m->offset);
 
 	if (m->flag & INDIR) {
 		(void) fprintf(stderr, "(%s,",
@@ -93,6 +93,24 @@ file_mdump(struct magic *m)
 				(void) fputc(CHAR_IGNORE_UPPERCASE, stderr);
 			if (m->str_flags & REGEX_OFFSET_START) 
 				(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)
 			(void) fprintf(stderr, "/%u", m->str_range);

Index: src/external/bsd/file/dist/src/readcdf.c
diff -u src/external/bsd/file/dist/src/readcdf.c:1.6 src/external/bsd/file/dist/src/readcdf.c:1.7
--- src/external/bsd/file/dist/src/readcdf.c:1.6	Wed Sep 28 09:50:09 2011
+++ src/external/bsd/file/dist/src/readcdf.c	Wed Feb 22 12:53:51 2012
@@ -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
@@ -29,9 +29,9 @@
 
 #ifndef lint
 #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
-__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
 
@@ -82,6 +82,16 @@ cdf_file_property_info(struct magic_set 
                             info[i].pi_u32) == -1)
                                 return -1;
                         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_WSTRING:
                         len = info[i].pi_str.s_len;
@@ -154,9 +164,8 @@ cdf_file_property_info(struct magic_set 
         if (!NOTMIME(ms)) {
 		if (str == NULL)
 			return 0;
-		if (file_printf(ms, "application/%s", str) == -1)
-			return -1;
-
+                if (file_printf(ms, "application/%s", str) == -1)
+                        return -1;
         }
         return 1;
 }
@@ -174,30 +183,31 @@ cdf_file_summary_info(struct magic_set *
                 return -1;
 
         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;
 
                 if (file_printf(ms, ", %s Endian",
                     si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
-                        return -1;
+                        return -2;
                 switch (si.si_os) {
                 case 2:
                         if (file_printf(ms, ", Os: Windows, Version %d.%d",
                             si.si_os_version & 0xff,
                             (uint32_t)si.si_os_version >> 8) == -1)
-                                return -1;
+                                return -2;
                         break;
                 case 1:
                         if (file_printf(ms, ", Os: MacOS, Version %d.%d",
                             (uint32_t)si.si_os_version >> 8,
                             si.si_os_version & 0xff) == -1)
-                                return -1;
+                                return -2;
                         break;
                 default:
                         if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
                             si.si_os_version & 0xff,
                             (uint32_t)si.si_os_version >> 8) == -1)
-                                return -1;
+                                return -2;
                         break;
                 }
         }
@@ -205,7 +215,7 @@ cdf_file_summary_info(struct magic_set *
         m = cdf_file_property_info(ms, info, count);
         free(info);
 
-        return m;
+        return m == -1 ? -2 : m;
 }
 
 protected int
@@ -274,7 +284,7 @@ file_trycdf(struct magic_set *ms, int fd
 #ifdef CDF_DEBUG
         cdf_dump_summary_info(&h, &scn);
 #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";
 	if (i == 0) {
 		const char *str = "vnd.ms-office";
@@ -305,8 +315,10 @@ out1:
         free(sat.sat_tab);
 out0:
         if (i != 1) {
-                if (file_printf(ms, "Composite Document File V2 Document") == -1)
-                        return -1;
+		if (i == -1)
+		    if (file_printf(ms, "Composite Document File V2 Document")
+			== -1)
+			    return -1;
                 if (*expn)
                         if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
                                 return -1;

Reply via email to