]> granicus.if.org Git - file/commitdiff
- pt_note elf additions from NetBSD
authorChristos Zoulas <christos@zoulas.com>
Thu, 16 May 2002 18:45:56 +0000 (18:45 +0000)
committerChristos Zoulas <christos@zoulas.com>
Thu, 16 May 2002 18:45:56 +0000 (18:45 +0000)
- EMX os specific changes (Alexander Mai)
- stdint.h detection, acconfig.h fixes (Maciej W. Rozycki, Franz Korntner)
- regex file additions (Kim Cromie)
- getopt_long support and misc cleanups (Michael Piefel)
- many magic fixes and additions

39 files changed:
Makefile.in
README
acinclude.m4
aclocal.m4
config.h.in
configure
configure.in
doc/file.man
doc/magic.man
magic/Magdir/adventure
magic/Magdir/animation
magic/Magdir/audio
magic/Magdir/commands
magic/Magdir/compress
magic/Magdir/dolby
magic/Magdir/elf
magic/Magdir/filesystems
magic/Magdir/gringotts [new file with mode: 0644]
magic/Magdir/lisp
magic/Magdir/nitpicker [new file with mode: 0644]
magic/Magdir/perl [new file with mode: 0644]
magic/Magdir/pulsar [new file with mode: 0644]
magic/Magdir/sendmail
magic/Magdir/tex
magic/Magdir/varied.out
magic/Magdir/vorbis
magic/Magdir/vxl [new file with mode: 0644]
magic/magic.mime
src/Makefile.std
src/acconfig.h
src/apprentice.c
src/compress.c
src/file.c
src/file.h
src/is_tar.c
src/patchlevel.h
src/print.c
src/readelf.h
src/softmagic.c

index 3a266cdff95d884e9d6aebbf9b6224a0152650da..9ee0358d19c0b8417628dd4456f48fc0a4ad8942 100644 (file)
@@ -86,7 +86,159 @@ EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime     Localstuff Head
 
 CLEANFILES = $(man_MANS) magic magic.mgc magic.mime.mgc
 
-magic_FRAGMENTS = Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant     Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation     Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix     Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi     Magdir/c-lang Magdir/chi Magdir/cisco Magdir/claris Magdir/clipper     Magdir/commands Magdir/compress Magdir/console Magdir/convex     Magdir/database Magdir/diamond Magdir/diff Magdir/digital     Magdir/dump Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems     Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav     Magdir/gimp Magdir/gnu Magdir/grace Magdir/hp Magdir/ibm370     Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel     Magdir/interleaf Magdir/island Magdir/ispell Magdir/java     Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif     Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic     Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt     Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem     Magdir/motorola Magdir/msdos Magdir/msvc Magdir/ncr Magdir/netbsd     Magdir/netscape Magdir/news Magdir/octave Magdir/olf Magdir/os2     Magdir/os9 Magdir/osf1 Magdir/palm Magdir/pbm Magdir/pdf Magdir/pdp     Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project     Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm     Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent     Magdir/sgml Magdir/sketch Magdir/sniffer Magdir/softquad Magdir/spectrum     Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x     Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown     Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx     Magdir/vms Magdir/vmware Magdir/wordperfect Magdir/xdelta Magdir/xenix     Magdir/zilog Magdir/zyxel
+magic_FRAGMENTS = \
+Magdir/acorn \
+Magdir/adi \
+Magdir/adventure \
+Magdir/allegro \
+Magdir/alliant \
+Magdir/alpha \
+Magdir/amanda \
+Magdir/amigaos \
+Magdir/animation \
+Magdir/apl \
+Magdir/apple \
+Magdir/applix \
+Magdir/archive \
+Magdir/asterix \
+Magdir/att3b \
+Magdir/audio \
+Magdir/blender \
+Magdir/blit \
+Magdir/bsdi \
+Magdir/c-lang \
+Magdir/chi \
+Magdir/cisco \
+Magdir/citrus \
+Magdir/claris \
+Magdir/clipper \
+Magdir/commands \
+Magdir/compress \
+Magdir/console \
+Magdir/convex \
+Magdir/ctags \
+Magdir/cvs \
+Magdir/database \
+Magdir/diamond \
+Magdir/diff \
+Magdir/digital \
+Magdir/dolby \
+Magdir/dump \
+Magdir/dyadic \
+Magdir/editors \
+Magdir/elf \
+Magdir/encore \
+Magdir/epoc \
+Magdir/filesystems \
+Magdir/flash \
+Magdir/fonts \
+Magdir/frame \
+Magdir/freebsd \
+Magdir/fsav \
+Magdir/gimp \
+Magdir/gnu \
+Magdir/grace \
+Magdir/gringotts \
+Magdir/hitachi-sh \
+Magdir/hp \
+Magdir/ibm370 \
+Magdir/ibm6000 \
+Magdir/iff \
+Magdir/images \
+Magdir/intel \
+Magdir/interleaf \
+Magdir/island \
+Magdir/ispell \
+Magdir/java \
+Magdir/jpeg \
+Magdir/karma \
+Magdir/lecter \
+Magdir/lex \
+Magdir/lif \
+Magdir/linux \
+Magdir/lisp \
+Magdir/mach \
+Magdir/macintosh \
+Magdir/magic \
+Magdir/mail.news \
+Magdir/maple \
+Magdir/mathematica \
+Magdir/mcrypt \
+Magdir/mime \
+Magdir/mips \
+Magdir/mirage \
+Magdir/mkid \
+Magdir/mmdf \
+Magdir/modem \
+Magdir/motorola \
+Magdir/msdos \
+Magdir/msvc \
+Magdir/natinst \
+Magdir/ncr \
+Magdir/netbsd \
+Magdir/netscape \
+Magdir/news \
+Magdir/nitpicker \
+Magdir/octave \
+Magdir/olf \
+Magdir/os2 \
+Magdir/os9 \
+Magdir/osf1 \
+Magdir/palm \
+Magdir/parix \
+Magdir/pbm \
+Magdir/pdf \
+Magdir/pdp \
+Magdir/perl \
+Magdir/pgp \
+Magdir/pkgadd \
+Magdir/plus5 \
+Magdir/printer \
+Magdir/project \
+Magdir/psdbms \
+Magdir/pulsar \
+Magdir/pyramid \
+Magdir/python \
+Magdir/riff \
+Magdir/rpm \
+Magdir/rtf \
+Magdir/sc \
+Magdir/sccs \
+Magdir/sendmail \
+Magdir/sequent \
+Magdir/sgml \
+Magdir/sharc \
+Magdir/sketch \
+Magdir/smalltalk \
+Magdir/sniffer \
+Magdir/softquad \
+Magdir/spectrum \
+Magdir/sun \
+Magdir/sysex \
+Magdir/teapot \
+Magdir/terminfo \
+Magdir/tex \
+Magdir/tgif \
+Magdir/ti-8x \
+Magdir/timezone \
+Magdir/troff \
+Magdir/tuxedo \
+Magdir/typeset \
+Magdir/unknown \
+Magdir/uuencode \
+Magdir/varied.out \
+Magdir/vax \
+Magdir/vicar \
+Magdir/visx \
+Magdir/vms \
+Magdir/vmware \
+Magdir/vorbis \
+Magdir/vxl \
+Magdir/wordperfect \
+Magdir/xdelta \
+Magdir/xenix \
+Magdir/zilog \
+Magdir/zyxel
 
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -416,7 +568,7 @@ distdir: $(DISTFILES)
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$/$$file $(distdir)/$$file; \
+           cp -pr $$d/$$file $(distdir)/$$file; \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff --git a/README b/README
index d8e941b8995ff65982e3a45b7aa4970559c2bfc8..1a0ff8ded11e7d7ef16904b50ceeb2b0e3872210 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 ** README for file(1) Command **
-@(#) $Id: README,v 1.25 2001/07/23 21:30:22 christos Exp $
+@(#) $Id: README,v 1.26 2002/05/16 18:45:56 christos Exp $
 
 This is Release 3.x of Ian Darwin's (copyright but distributable)
 file(1) command. This version is the standard "file" command for Linux,
@@ -8,7 +8,7 @@ file(1) command. This version is the standard "file" command for Linux,
 UNIX is a trademark of UNIX System Laboratories.
 
 The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
-including byte-order independance.
+including byte-order independence.
 
 The prime contributor to Release 3.0 was Christos Zoulas, who put
 in hundreds of lines of source code changes, including his own
@@ -43,7 +43,7 @@ Makefile - read this next, adapt it as needed (particularly
        the man page layouts), type "make" to compile, 
        "make try" to try it out against your old version.
        Expect some diffs, particularly since your original
-       file(1) may not grok the imbedded-space ("\ ") in
+       file(1) may not grok the embedded-space ("\ ") in
        the current magic file, or may even not use the
        magic file.
 apprentice.c - parses /etc/magic to learn magic
@@ -61,9 +61,8 @@ magdir - directory of /etc/magic pieces
        magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION
 names.h - header file for ascmagic.c
 softmagic.c - 2nd set of tests, based on /etc/magic
-readelf.[ch] - Standalone elf parsing code.
+readelf.[ch] - Stand-alone elf parsing code.
 compress.c - on-the-fly decompression.
-internat.c - recognize international `text' files.
 print.c - print results, errors, warnings.
 
 If your gzip sometimes fails to decompress things complaining about a short
index 0b1b0a531406bc0638daafbfdf0b7240dec61751..79ecb0e11db8e1cfc8d7e2b6a60dcb1e17fa29ba 100644 (file)
@@ -1,5 +1,5 @@
 dnl cloned from autoconf 2.13 acspecific.m4
-AC_DEFUN(AC_C_LONG_LONG,
+AC_DEFUN([AC_C_LONG_LONG],
 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
 [if test "$GCC" = yes; then
   ac_cv_c_long_long=yes
@@ -14,23 +14,16 @@ if test $ac_cv_c_long_long = yes; then
 fi
 ])
 
-dnl from autoconf 2.13 acgeneral.m4, with patch:
-dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
-dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
-dnl From: eggert@twinsun.com (Paul Eggert)
-dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
-dnl Newsgroups: gnu.utils.bug
-
 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
 
-AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
+AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
 [AC_REQUIRE([AC_STRUCT_TM])dnl
 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
 if test "$ac_cv_struct_tm_zone" = yes; then
-  AC_DEFINE(HAVE_TM_ZONE)
+  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
 fi
 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
 [AC_TRY_LINK(
@@ -42,7 +35,7 @@ extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
 changequote([, ])dnl
 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
   if test $ac_cv_var_tzname = yes; then
-    AC_DEFINE(HAVE_TZNAME)
+    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
   fi
 
 AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
@@ -66,15 +59,27 @@ changequote([, ])dnl
   fi
 ])
 
-dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
-AC_DEFUN(AC_CHECK_TYPE2,
+dnl from autoconf 2.13 acgeneral.m4, with patch:
+dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
+dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
+dnl From: eggert@twinsun.com (Paul Eggert)
+dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
+dnl Newsgroups: gnu.utils.bug
+dnl
+dnl now include <stdint.h> if available
+
+dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE2_STDC],
 [AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL(ac_cv_type_$1,
 [AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -88,14 +93,12 @@ fi
 ])
 
 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
-dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
-AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
+dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
+AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
+[dnl The name to #define.
+define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
 dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
+define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
 AC_MSG_CHECKING(size of $1)
 AC_CACHE_VAL(AC_CV_NAME,
 [AC_TRY_RUN([$3
@@ -114,9 +117,14 @@ undefine([AC_CV_NAME])dnl
 ])
 
 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
-AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
-[AC_CHECK_SIZEOF_INCLUDES($1, $2,
-[#include <sys/types.h>
+AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_CHECK_SIZEOF_INCLUDES($1, $2,
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
@@ -124,6 +132,31 @@ AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
 ])
 
 
+dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE_STDC],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_EGREP_CPP(dnl
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+AC_MSG_RESULT($ac_cv_type_$1)
+if test $ac_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])
+
+dnl AC_HEADER_STDINT
+AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
+
 #serial 19
 
 dnl By default, many hosts won't let programs access large files;
@@ -135,7 +168,7 @@ dnl Written by Paul Eggert <eggert@twinsun.com>.
 
 dnl Internal subroutine of AC_SYS_LARGEFILE.
 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
-AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
+AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
   [[#include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
        We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -150,7 +183,7 @@ AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
 dnl Internal subroutine of AC_SYS_LARGEFILE.
 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
 DES, FUNCTION-BODY)
-AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
+AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
   [AC_CACHE_CHECK([for $1 value needed for large files], $3,
      [$3=no
       AC_TRY_COMPILE([$5],
@@ -165,7 +198,7 @@ AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
      AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
    fi])
 
-AC_DEFUN(AC_SYS_LARGEFILE,
+AC_DEFUN([AC_SYS_LARGEFILE],
   [AC_REQUIRE([AC_PROG_CC])
    AC_ARG_ENABLE(largefile,
      [  --disable-largefile     omit support for large files])
@@ -200,7 +233,7 @@ AC_DEFUN(AC_SYS_LARGEFILE,
    fi
   ])
 
-AC_DEFUN(AC_FUNC_FSEEKO,
+AC_DEFUN([AC_FUNC_FSEEKO],
   [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
      ac_cv_sys_largefile_source,
      [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
index 82ed39fb7ee5eae0abd862eaa76b58520c162ca0..c8873bca89ed130b173ed56488187944039da53e 100644 (file)
@@ -11,7 +11,7 @@ dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 dnl PARTICULAR PURPOSE.
 
 dnl cloned from autoconf 2.13 acspecific.m4
-AC_DEFUN(AC_C_LONG_LONG,
+AC_DEFUN([AC_C_LONG_LONG],
 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
 [if test "$GCC" = yes; then
   ac_cv_c_long_long=yes
@@ -26,23 +26,16 @@ if test $ac_cv_c_long_long = yes; then
 fi
 ])
 
-dnl from autoconf 2.13 acgeneral.m4, with patch:
-dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
-dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
-dnl From: eggert@twinsun.com (Paul Eggert)
-dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
-dnl Newsgroups: gnu.utils.bug
-
 dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
 
-AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
+AC_DEFUN([AC_STRUCT_TIMEZONE_DAYLIGHT],
 [AC_REQUIRE([AC_STRUCT_TM])dnl
 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
 if test "$ac_cv_struct_tm_zone" = yes; then
-  AC_DEFINE(HAVE_TM_ZONE)
+  AC_DEFINE(HAVE_TM_ZONE,1,[HAVE_TM_ZONE])
 fi
 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
 [AC_TRY_LINK(
@@ -54,7 +47,7 @@ extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
 changequote([, ])dnl
 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
   if test $ac_cv_var_tzname = yes; then
-    AC_DEFINE(HAVE_TZNAME)
+    AC_DEFINE(HAVE_TZNAME,1,[HAVE_TZNAME])
   fi
 
 AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
@@ -78,15 +71,27 @@ changequote([, ])dnl
   fi
 ])
 
-dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
-AC_DEFUN(AC_CHECK_TYPE2,
+dnl from autoconf 2.13 acgeneral.m4, with patch:
+dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
+dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
+dnl From: eggert@twinsun.com (Paul Eggert)
+dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
+dnl Newsgroups: gnu.utils.bug
+dnl
+dnl now include <stdint.h> if available
+
+dnl AC_CHECK_TYPE2_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE2_STDC],
 [AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL(ac_cv_type_$1,
 [AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -100,14 +105,12 @@ fi
 ])
 
 dnl from autoconf 2.13 acgeneral.m4, with additional third argument
-dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
-AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
+dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE [, INCLUDES]])
+AC_DEFUN([AC_CHECK_SIZEOF_INCLUDES],
+[dnl The name to #define.
+define([AC_TYPE_NAME], translit(sizeof_$1, [[[a-z *]]], [[[A-Z_P]]]))dnl
 dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
+define([AC_CV_NAME], translit(ac_cv_sizeof_$1, [[[ *]]], [[[_p]]]))dnl
 AC_MSG_CHECKING(size of $1)
 AC_CACHE_VAL(AC_CV_NAME,
 [AC_TRY_RUN([$3
@@ -126,9 +129,14 @@ undefine([AC_CV_NAME])dnl
 ])
 
 dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
-AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
-[AC_CHECK_SIZEOF_INCLUDES($1, $2,
-[#include <sys/types.h>
+AC_DEFUN([AC_CHECK_SIZEOF_STDC_HEADERS],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_CHECK_SIZEOF_INCLUDES($1, $2,
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
@@ -136,6 +144,31 @@ AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
 ])
 
 
+dnl AC_CHECK_TYPE_STDC(TYPE, DEFAULT)
+AC_DEFUN([AC_CHECK_TYPE_STDC],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([AC_HEADER_STDINT])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_EGREP_CPP(dnl
+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
+[#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+AC_MSG_RESULT($ac_cv_type_$1)
+if test $ac_cv_type_$1 = no; then
+  AC_DEFINE($1, $2)
+fi
+])
+
+dnl AC_HEADER_STDINT
+AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
+
 #serial 19
 
 dnl By default, many hosts won't let programs access large files;
@@ -147,7 +180,7 @@ dnl Written by Paul Eggert <eggert@twinsun.com>.
 
 dnl Internal subroutine of AC_SYS_LARGEFILE.
 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
-AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
+AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES],
   [[#include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
        We can't simply "#define LARGE_OFF_T 9223372036854775807",
@@ -162,7 +195,7 @@ AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
 dnl Internal subroutine of AC_SYS_LARGEFILE.
 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLU=
 DES, FUNCTION-BODY)
-AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
+AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
   [AC_CACHE_CHECK([for $1 value needed for large files], $3,
      [$3=no
       AC_TRY_COMPILE([$5],
@@ -177,7 +210,7 @@ AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
      AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
    fi])
 
-AC_DEFUN(AC_SYS_LARGEFILE,
+AC_DEFUN([AC_SYS_LARGEFILE],
   [AC_REQUIRE([AC_PROG_CC])
    AC_ARG_ENABLE(largefile,
      [  --disable-largefile     omit support for large files])
@@ -212,7 +245,7 @@ AC_DEFUN(AC_SYS_LARGEFILE,
    fi
   ])
 
-AC_DEFUN(AC_FUNC_FSEEKO,
+AC_DEFUN([AC_FUNC_FSEEKO],
   [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
      ac_cv_sys_largefile_source,
      [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
index 8765ba6fc8eab9904da48bbb722b660d458311b8..aa058242a0be5ffe0dc193773cee8dc0efe75092 100644 (file)
@@ -9,13 +9,6 @@
 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
 #undef HAVE_SYS_WAIT_H
 
-/* Define if your struct tm has tm_zone.  */
-#undef HAVE_TM_ZONE
-
-/* Define if you don't have tm_zone but do have the external array
-   tzname.  */
-#undef HAVE_TZNAME
-
 /* Define if major, minor, and makedev are declared in <mkdev.h>.  */
 #undef MAJOR_IN_MKDEV
 
 /* Define if you have the <fcntl.h> header file.  */
 #undef HAVE_FCNTL_H
 
+/* Define if you have the <getopt.h> header file.  */
+#undef HAVE_GETOPT_H
+
 /* Define if you have the <locale.h> header file.  */
 #undef HAVE_LOCALE_H
 
+/* Define if you have the <stdint.h> header file.  */
+#undef HAVE_STDINT_H
+
 /* Define if you have the <sys/mman.h> header file.  */
 #undef HAVE_SYS_MMAN_H
 
 /* Version number of package */
 #undef VERSION
 
+/* HAVE_TM_ZONE */
+#undef HAVE_TM_ZONE
+
+/* HAVE_TZNAME */
+#undef HAVE_TZNAME
+
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
index 8aadd21c249639ad4af3fb09f3ceb7485e8285de..9a9d14e79c49050d4a6ee10a1ae0ea7d1b6e24b6 100755 (executable)
--- a/configure
+++ b/configure
@@ -1508,7 +1508,7 @@ EOF
 
 fi
 
-for ac_hdr in fcntl.h locale.h
+for ac_hdr in stdint.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1548,7 +1548,7 @@ else
 fi
 done
 
-for ac_hdr in sys/mman.h sys/stat.h sys/types.h
+for ac_hdr in fcntl.h locale.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1588,7 +1588,7 @@ else
 fi
 done
 
-for ac_hdr in unistd.h
+for ac_hdr in sys/mman.h sys/stat.h sys/types.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1628,7 +1628,7 @@ else
 fi
 done
 
-for ac_hdr in locale.h
+for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1668,14 +1668,94 @@ else
 fi
 done
 
+for ac_hdr in getopt.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1676: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1681 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in locale.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1716: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1721 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1674: checking for working const" >&5
+echo "configure:1754: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1679 "configure"
+#line 1759 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1724,7 +1804,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1745,12 +1825,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1749: checking for off_t" >&5
+echo "configure:1829: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1754 "configure"
+#line 1834 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1778,12 +1858,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1782: checking for size_t" >&5
+echo "configure:1862: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1787 "configure"
+#line 1867 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1811,12 +1891,12 @@ EOF
 fi
 
 echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:1815: checking for st_rdev in struct stat" >&5
+echo "configure:1895: checking for st_rdev in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1820 "configure"
+#line 1900 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1824,7 +1904,7 @@ int main() {
 struct stat s; s.st_rdev;
 ; return 0; }
 EOF
-if { (eval echo configure:1828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_rdev=yes
 else
@@ -1845,12 +1925,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1849: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:1929: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1854 "configure"
+#line 1934 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -1858,7 +1938,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:1862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -1879,12 +1959,12 @@ EOF
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:1883: checking for tm_zone in struct tm" >&5
+echo "configure:1963: checking for tm_zone in struct tm" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1888 "configure"
+#line 1968 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -1892,7 +1972,7 @@ int main() {
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -1912,12 +1992,12 @@ EOF
 
 fi
 echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:1916: checking for tzname" >&5
+echo "configure:1996: checking for tzname" >&5
 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1921 "configure"
+#line 2001 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -1927,7 +2007,7 @@ int main() {
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -1948,12 +2028,12 @@ EOF
   fi
 
 echo $ac_n "checking for tm_isdst in struct tm""... $ac_c" 1>&6
-echo "configure:1952: checking for tm_isdst in struct tm" >&5
+echo "configure:2032: checking for tm_isdst in struct tm" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm_isdst'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1957 "configure"
+#line 2037 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -1961,7 +2041,7 @@ int main() {
 struct tm tm; tm.tm_isdst;
 ; return 0; }
 EOF
-if { (eval echo configure:1965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_isdst=yes
 else
@@ -1981,12 +2061,12 @@ EOF
 
 fi
 echo $ac_n "checking for daylight""... $ac_c" 1>&6
-echo "configure:1985: checking for daylight" >&5
+echo "configure:2065: checking for daylight" >&5
 if eval "test \"`echo '$''{'ac_cv_var_daylight'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1990 "configure"
+#line 2070 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef daylight /* In case IRIX #defines this, too  */
@@ -1996,7 +2076,7 @@ int main() {
 atoi(daylight);
 ; return 0; }
 EOF
-if { (eval echo configure:2000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var_daylight=yes
 else
@@ -2027,7 +2107,7 @@ fi
 
      echo $ac_n "checking for special C compiler options needed for large files=
 ""... $ac_c" 1>&6
-echo "configure:2031: checking for special C compiler options needed for large files=
+echo "configure:2111: checking for special C compiler options needed for large files=
 " >&5
 if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2037,7 +2117,7 @@ else
          # IRIX 6.2 and later do not support large files by default,
          # so use the C compiler's -n32 option if that helps.
          cat > conftest.$ac_ext <<EOF
-#line 2041 "configure"
+#line 2121 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
@@ -2053,7 +2133,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -2062,7 +2142,7 @@ else
   ac_save_CC="$CC"
             CC="$CC -n32"
             cat > conftest.$ac_ext <<EOF
-#line 2066 "configure"
+#line 2146 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
@@ -2078,7 +2158,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sys_largefile_CC=' -n32'
 else
@@ -2098,13 +2178,13 @@ echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6
      fi
 
      echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6
-echo "configure:2102: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo "configure:2182: checking for _FILE_OFFSET_BITS value needed for large files" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_sys_file_offset_bits=no
       cat > conftest.$ac_ext <<EOF
-#line 2108 "configure"
+#line 2188 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
@@ -2120,14 +2200,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 2131 "configure"
+#line 2211 "configure"
 #include "confdefs.h"
 #define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
@@ -2145,7 +2225,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sys_file_offset_bits=64
 else
@@ -2165,13 +2245,13 @@ EOF
 
    fi
      echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6
-echo "configure:2169: checking for _LARGE_FILES value needed for large files" >&5
+echo "configure:2249: checking for _LARGE_FILES value needed for large files" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_sys_large_files=no
       cat > conftest.$ac_ext <<EOF
-#line 2175 "configure"
+#line 2255 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
     /* Check that off_t can represent 2**63 - 1 correctly.
@@ -2187,14 +2267,14 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 2198 "configure"
+#line 2278 "configure"
 #include "confdefs.h"
 #define _LARGE_FILES 1
 #include <sys/types.h>
@@ -2212,7 +2292,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sys_large_files=1
 else
@@ -2235,13 +2315,16 @@ EOF
   
 
 echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
-echo "configure:2239: checking for uint8_t" >&5
+echo "configure:2319: checking for uint8_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2244 "configure"
+#line 2324 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2268,13 +2351,16 @@ EOF
 fi
 
 echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
-echo "configure:2272: checking for uint16_t" >&5
+echo "configure:2355: checking for uint16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2277 "configure"
+#line 2360 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2301,13 +2387,16 @@ EOF
 fi
 
 echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
-echo "configure:2305: checking for uint32_t" >&5
+echo "configure:2391: checking for uint32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2310 "configure"
+#line 2396 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2333,9 +2422,8 @@ EOF
 
 fi
 
-
 echo $ac_n "checking for long long""... $ac_c" 1>&6
-echo "configure:2339: checking for long long" >&5
+echo "configure:2427: checking for long long" >&5
 if eval "test \"`echo '$''{'ac_cv_c_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2346,13 +2434,13 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2350 "configure"
+#line 2438 "configure"
 #include "confdefs.h"
 int main() {
 long long foo = 0;
 exit(sizeof(long long) < sizeof(long)); }
 EOF
-if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_long_long=yes
 else
@@ -2381,13 +2469,16 @@ else
   long64='unsigned long';
 fi
 echo $ac_n "checking for uint64_t""... $ac_c" 1>&6
-echo "configure:2385: checking for uint64_t" >&5
+echo "configure:2473: checking for uint64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
+#line 2478 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
@@ -2417,7 +2508,7 @@ fi
 
 
 echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6
-echo "configure:2421: checking size of uint8_t" >&5
+echo "configure:2512: checking size of uint8_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint8_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2425,8 +2516,11 @@ else
   ac_cv_sizeof_uint8_t=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2429 "configure"
+#line 2520 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
@@ -2441,7 +2535,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint8_t=`cat conftestval`
 else
@@ -2462,7 +2556,7 @@ EOF
 
 
 echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6
-echo "configure:2466: checking size of uint16_t" >&5
+echo "configure:2560: checking size of uint16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2470,8 +2564,11 @@ else
   ac_cv_sizeof_uint16_t=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2474 "configure"
+#line 2568 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
@@ -2486,7 +2583,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint16_t=`cat conftestval`
 else
@@ -2507,7 +2604,7 @@ EOF
 
 
 echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6
-echo "configure:2511: checking size of uint32_t" >&5
+echo "configure:2608: checking size of uint32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2515,8 +2612,11 @@ else
   ac_cv_sizeof_uint32_t=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2519 "configure"
+#line 2616 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
@@ -2531,7 +2631,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint32_t=`cat conftestval`
 else
@@ -2552,7 +2652,7 @@ EOF
 
 
 echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6
-echo "configure:2556: checking size of uint64_t" >&5
+echo "configure:2656: checking size of uint64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2560,8 +2660,11 @@ else
   ac_cv_sizeof_uint64_t=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2564 "configure"
+#line 2664 "configure"
 #include "confdefs.h"
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 #ifdef STDC_HEADERS
 #include <stdlib.h>
@@ -2576,7 +2679,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint64_t=`cat conftestval`
 else
@@ -2600,12 +2703,12 @@ EOF
 for ac_func in mmap strerror strtoul mkstemp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2604: checking for $ac_func" >&5
+echo "configure:2707: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2609 "configure"
+#line 2712 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2628,7 +2731,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2654,7 +2757,7 @@ done
 
 
 echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6
-echo "configure:2658: checking for gzopen in -lz" >&5
+echo "configure:2761: checking for gzopen in -lz" >&5
 ac_lib_var=`echo z'_'gzopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2662,7 +2765,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lz  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2666 "configure"
+#line 2769 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2673,7 +2776,7 @@ int main() {
 gzopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
index 31f4018b9ed8017148e8df7dfb29d0c8c20f423e..d8e24dc6f592f4c9d9aae98bc0ad8a6ee9ba10dc 100644 (file)
@@ -57,9 +57,11 @@ dnl Checks for headers
 AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
+AC_HEADER_STDINT
 AC_CHECK_HEADERS(fcntl.h locale.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h)
 AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_HEADERS(getopt.h)
 AC_CHECK_HEADERS(locale.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -70,11 +72,9 @@ AC_STRUCT_ST_RDEV
 AC_STRUCT_TIMEZONE_DAYLIGHT
 AC_SYS_LARGEFILE
 
-dnl FIXME: only found in standard headers!
-AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(uint16_t, unsigned short)
-AC_CHECK_TYPE(uint32_t, unsigned int)
-
+AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
+AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
+AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
 AC_C_LONG_LONG
 if test $ac_cv_c_long_long = yes; then
   long64='unsigned long long';
@@ -82,7 +82,7 @@ else
   long64='unsigned long';
 fi
 dnl This needs a patch to autoconf 2.13 acgeneral.m4
-AC_CHECK_TYPE2(uint64_t, $long64)
+AC_CHECK_TYPE2_STDC(uint64_t, $long64)
 
 AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
index 7f6d623cde402b463b46c6d3e18bfeb35e6f1aa4..de2885aabe759abd20d76897f69313baf9627043 100644 (file)
@@ -1,5 +1,5 @@
 .TH FILE __CSECTION__ "Copyright but distributable"
-.\" $Id: file.man,v 1.40 2002/05/16 15:26:54 christos Exp $
+.\" $Id: file.man,v 1.41 2002/05/16 18:45:56 christos Exp $
 .SH NAME
 file
 \- determine file type
@@ -304,12 +304,15 @@ keep the old magic file around for comparison purposes
 .IR __MAGIC__.orig ).
 .SH EXAMPLES
 .nf
-$ file file.c file /dev/hda
+$ file file.c file /dev/{wd0a,hda}
 file.c:   C program text
-file:     ELF 32-bit LSB executable, Intel 80386, version 1,
-          dynamically linked, not stripped
-/dev/hda: block special
-
+file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
+          dynamically linked (uses shared libs), stripped
+/dev/wd0a: block special (0/0)
+/dev/hda: block special (3/0)
+$ file -s /dev/wd0{b,d}
+/dev/wd0b: data
+/dev/wd0d: x86 boot sector
 $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda:   x86 boot sector
 /dev/hda1:  Linux/i386 ext2 filesystem
@@ -323,18 +326,19 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda9:  empty
 /dev/hda10: empty
 
-$ file -i file.c file /dev/hda
+$ file -i file.c file /dev/{wd0a,hda}
 file.c:      text/x-c
 file:        application/x-executable, dynamically linked (uses shared libs),
 not stripped
 /dev/hda:    application/x-not-regular-file
+/dev/wd0a:   application/x-not-regular-file
 
 .fi
 .SH HISTORY
 There has been a 
 .B file
-command in every \s-1UNIX\s0 since at least Research Version 6
-(man page dated January 16, 1975).
+command in every \s-1UNIX\s0 since at least Research Version 4
+(man page dated November, 1973).
 The System V version introduced one significant major change:
 the external list of magic number types.
 This slowed the program down slightly but made it a lot more flexible.
index 5f6d062545b0615a60104fcbb141b4cb8e93048b..34c79931bf24c0d541d0e515c2cf1adc4224ac22 100644 (file)
@@ -7,7 +7,7 @@ This manual page documents the format of the magic file as
 used by the
 .BR file (__CSECTION__)
 command, version __VERSION__. The
-.B file
+.BR file
 command identifies the type of a file using,
 among other tests,
 a test for whether the file begins with a certain
@@ -130,7 +130,7 @@ then presumably print that string, by doing
 .IP message
 The message to be printed if the comparison succeeds.  If the string
 contains a
-.BR printf (3S)
+.BR printf (3)
 format specification, the value from the file (with any specified masking
 performed) is printed using the message as the format string.
 .PP
@@ -219,4 +219,4 @@ indirect offsets.
 .\" the changes I posted to the S5R2 version.
 .\"
 .\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.17 2001/08/07 15:38:42 christos Exp $
+.\" @(#)$Id: magic.man,v 1.18 2002/05/16 18:45:56 christos Exp $
index 38a5e33a3a2a99b331a6a2ad37d72401b7f2466e..864712f6da1ab25ac2ee2cfb8c03efe3b8314ad1 100644 (file)
@@ -4,11 +4,12 @@
 #
 # from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
 # Edited by Dave Chapeskie <dchapes@ddm.on.ca> Jun 28, 1998
+# Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
 #
 # ALAN
 # I assume there are other, lower versions, but these are the only ones I
 # saw in the archive.
-0      beshort 0x0206  ALAN text adventure code data
+0      beshort 0x0206  ALAN game data
 >2     byte    <10     version 2.6%d
 
 # Conflicts with too much other stuff!
 #>18   string  >\0     Serial %.6s)
 
 # TADS (Text Adventure Development System)
-0      string  TADS    TADS game data
->13    string  >\0     (ver. %.6s,
->22    string  >\0     date %s)
+#  All files are machine-independent (games compile to byte-code) and are tagged
+#  with a version string of the form "V2.<digit>.<digit>\0" (but TADS 3 is
+#  on the way).
+#  Game files start with "TADS2 bin\n\r\032\0" then the compiler version.
+0      string  TADS2\ bin      TADS
+>9     belong  !0x0A0D1A00     game data, CORRUPTED
+>9     belong   0x0A0D1A00
+>>13   string  >\0             %s game data
+#  Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version.
+0      string  TADS2\ rsc      TADS
+>9     belong  !0x0A0D1A00     resource data, CORRUPTED
+>9     belong   0x0A0D1A00
+>>13   string  >\0             %s resource data
+#  Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian
+#  2-byte length N, the N-char name of the game file *without* a NUL (darn!),
+# "TADS2 save\n\r\032\0" and the interpreter version. 
+0      string  TADS2\ save/g   TADS
+>12    belong  !0x0A0D1A00     saved game data, CORRUPTED
+>12    belong   0x0A0D1A00
+>>(16.s+32) string >\0         %s saved game data
+#  Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter
+#  version.
+0      string  TADS2\ save     TADS
+>10    belong  !0x0A0D1A00     saved game data, CORRUPTED
+>10    belong   0x0A0D1A00
+>>14   string  >\0             %s saved game data
index 6fa689f8f841160d2b0bcdbc2c9c1cc8d492cf01..56f25cf3b776e820ea9e883099667c43e45e9f7f 100644 (file)
 # MPEG Audio (*.mpx)
 # from dreesen@math.fu-berlin.de
 
-# XXX
-# This conflicts with the FF FE signature for UTF-16-encoded Unicode
-# text, which will be identified as an MP3 file.  I don't have any MP3s
-# so I don't know how to (or even if it's possible to) change this to
-# tell the two apart.    enf@pobox.com
+# MPEG 1.0 Layer 3
+0       beshort&0xfffe  =0xfffa         \bMP3
+>2      byte&0xf0       =0x10           \b,  32 kBits
+>2      byte&0xf0       =0x20           \b,  40 kBits
+>2      byte&0xf0       =0x30           \b,  48 kBits
+>2      byte&0xf0       =0x40           \b,  56 kBits
+>2      byte&0xf0       =0x50           \b,  64 kBits
+>2      byte&0xf0       =0x60           \b,  80 kBits
+>2      byte&0xf0       =0x70           \b,  96 kBits
+>2      byte&0xf0       =0x80           \b, 112 kBits
+>2      byte&0xf0       =0x90           \b, 128 kBits
+>2      byte&0xf0       =0xA0           \b, 160 kBits
+>2      byte&0xf0       =0xB0           \b, 192 kBits
+>2      byte&0xf0       =0xC0           \b, 224 kBits
+>2      byte&0xf0       =0xD0           \b, 256 kBits
+>2      byte&0xf0       =0xE0           \b, 320 kBits
+# freq
+>2      byte&0x0C       =0x00           \b, 44.1 kHz
+>2      byte&0x0C       =0x04           \b, 48 kHz
+>2      byte&0x0C       =0x08           \b, 32 kHz
+# misc
+>3      byte&0xC0       =0x00           \b, Stereo
+>3      byte&0xC0       =0x40           \b, JStereo
+>3      byte&0xC0       =0x80           \b, Dual-Ch
+>3      byte&0xC0       =0xC0           \b, Mono
+#>1     byte&0x01       =0x00           \b, Error Protection
+#>2     byte&0x02       =0x02           \b, Padding
+#>2     byte&0x01       =0x01           \b, Private
+#>3     byte&0x08       =0x08           \b, Copyright
+#>3     byte&0x04       =0x04           \b, Original
+#>3     byte&0x03       1               \b, Emphasis 5
+#>3     byte&0x03       3               \b, Emphasis c
 
-0       beshort         &0xfff0         MP
-# MPEG 1.0
->1      byte&0x08       =0x08           \b
-# Layer 3
->>1     byte            &0x02           \b3
->>>2    byte&0xf0       =0x10           \b,  32 kBits
->>>2    byte&0xf0       =0x20           \b,  40 kBits
->>>2    byte&0xf0       =0x30           \b,  48 kBits
->>>2    byte&0xf0       =0x40           \b,  56 kBits
->>>2    byte&0xf0       =0x50           \b,  64 kBits
->>>2    byte&0xf0       =0x60           \b,  80 kBits
->>>2    byte&0xf0       =0x70           \b,  96 kBits
->>>2    byte&0xf0       =0x80           \b, 112 kBits
->>>2    byte&0xf0       =0x90           \b, 128 kBits
->>>2    byte&0xf0       =0xA0           \b, 160 kBits
->>>2    byte&0xf0       =0xB0           \b, 192 kBits
->>>2    byte&0xf0       =0xC0           \b, 224 kBits
->>>2    byte&0xf0       =0xD0           \b, 256 kBits
->>>2    byte&0xf0       =0xE0           \b, 320 kBits
-# Layer 2
->>1     byte            &0x04           \b2
->>>2    byte&0xf0       =0x10           \b,  32 kBits
->>>2    byte&0xf0       =0x20           \b,  48 kBits
->>>2    byte&0xf0       =0x30           \b,  56 kBits
->>>2    byte&0xf0       =0x40           \b,  64 kBits
->>>2    byte&0xf0       =0x50           \b,  80 kBits
->>>2    byte&0xf0       =0x60           \b,  96 kBits
->>>2    byte&0xf0       =0x70           \b, 112 kBits
->>>2    byte&0xf0       =0x80           \b, 128 kBits
->>>2    byte&0xf0       =0x90           \b, 160 kBits
->>>2    byte&0xf0       =0xA0           \b, 192 kBits
->>>2    byte&0xf0       =0xB0           \b, 224 kBits
->>>2    byte&0xf0       =0xC0           \b, 256 kBits
->>>2    byte&0xf0       =0xD0           \b, 320 kBits
->>>2    byte&0xf0       =0xE0           \b, 384 kBits
+# MPEG 1.0 Layer 2
+0       beshort&0xfffe  =0xfffc         \bMP2
+>2      byte&0xf0       =0x10           \b,  32 kBits
+>2      byte&0xf0       =0x20           \b,  48 kBits
+>2      byte&0xf0       =0x30           \b,  56 kBits
+>2      byte&0xf0       =0x40           \b,  64 kBits
+>2      byte&0xf0       =0x50           \b,  80 kBits
+>2      byte&0xf0       =0x60           \b,  96 kBits
+>2      byte&0xf0       =0x70           \b, 112 kBits
+>2      byte&0xf0       =0x80           \b, 128 kBits
+>2      byte&0xf0       =0x90           \b, 160 kBits
+>2      byte&0xf0       =0xA0           \b, 192 kBits
+>2      byte&0xf0       =0xB0           \b, 224 kBits
+>2      byte&0xf0       =0xC0           \b, 256 kBits
+>2      byte&0xf0       =0xD0           \b, 320 kBits
+>2      byte&0xf0       =0xE0           \b, 384 kBits
 # freq
->>2     byte&0x0C       =0x00           \b, 44.1 kHz
->>2     byte&0x0C       =0x04           \b, 48 kHz
->>2     byte&0x0C       =0x08           \b, 32 kHz
+>2      byte&0x0C       =0x00           \b, 44.1 kHz
+>2      byte&0x0C       =0x04           \b, 48 kHz
+>2      byte&0x0C       =0x08           \b, 32 kHz
+# misc
+>3      byte&0xC0       =0x00           \b, Stereo
+>3      byte&0xC0       =0x40           \b, JStereo
+>3      byte&0xC0       =0x80           \b, Dual-Ch
+>3      byte&0xC0       =0xC0           \b, Mono
+#>1     byte&0x01       =0x00           \b, Error Protection
+#>2     byte&0x02       =0x02           \b, Padding
+#>2     byte&0x01       =0x01           \b, Private
+#>3     byte&0x08       =0x08           \b, Copyright
+#>3     byte&0x04       =0x04           \b, Original
+#>3     byte&0x03       1               \b, Emphasis 5
+#>3     byte&0x03       3               \b, Emphasis c
+
 # MPEG 2.0
->1      byte&0x08       =0x00           \b
+0       beshort&0xfff8  =0xfff0         MP
 # Layer 3
->>1     byte            &0x02           \b3
+>     byte            &0x02           \b3
 # Layer 2
->>1     byte            &0x04           \b2
->>2     byte&0xf0       =0x10           \b,   8 kBits
->>2     byte&0xf0       =0x20           \b,  16 kBits
->>2     byte&0xf0       =0x30           \b,  24 kBits
->>2     byte&0xf0       =0x40           \b,  32 kBits
->>2     byte&0xf0       =0x50           \b,  40 kBits
->>2     byte&0xf0       =0x60           \b,  48 kBits
->>2     byte&0xf0       =0x70           \b,  56 kBits
->>2     byte&0xf0       =0x80           \b,  64 kBits
->>2     byte&0xf0       =0x90           \b,  80 kBits
->>2     byte&0xf0       =0xA0           \b,  96 kBits
->>2     byte&0xf0       =0xB0           \b, 112 kBits
->>2     byte&0xf0       =0xC0           \b, 128 kBits
->>2     byte&0xf0       =0xD0           \b, 144 kBits
->>2     byte&0xf0       =0xE0           \b, 160 kBits
+>     byte            &0x04           \b2
+>     byte&0xf0       =0x10           \b,   8 kBits
+>     byte&0xf0       =0x20           \b,  16 kBits
+>     byte&0xf0       =0x30           \b,  24 kBits
+>     byte&0xf0       =0x40           \b,  32 kBits
+>     byte&0xf0       =0x50           \b,  40 kBits
+>     byte&0xf0       =0x60           \b,  48 kBits
+>     byte&0xf0       =0x70           \b,  56 kBits
+>     byte&0xf0       =0x80           \b,  64 kBits
+>     byte&0xf0       =0x90           \b,  80 kBits
+>     byte&0xf0       =0xA0           \b,  96 kBits
+>     byte&0xf0       =0xB0           \b, 112 kBits
+>     byte&0xf0       =0xC0           \b, 128 kBits
+>     byte&0xf0       =0xD0           \b, 144 kBits
+>     byte&0xf0       =0xE0           \b, 160 kBits
 # freq
->>2     byte&0x0C       =0x00           \b, 22.05 kHz
->>2     byte&0x0C       =0x04           \b, 24 kHz
->>2     byte&0x0C       =0x08           \b, 16 kHz
+>     byte&0x0C       =0x00           \b, 22.05 kHz
+>     byte&0x0C       =0x04           \b, 24 kHz
+>     byte&0x0C       =0x08           \b, 16 kHz
 # misc
 >3      byte&0xC0       =0x00           \b, Stereo
 >3      byte&0xC0       =0x40           \b, JStereo
 
 # Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
 0      belong                  0x3026b275      Microsoft ASF
+
+# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
+0      string                  \x8aMNG         MNG video data,
+>4     belong                  !0x0d0a1a0a     CORRUPTED,
+>4     belong                  0x0d0a1a0a
index b47dd4373c69e1297be6b4a8066f0b3a5c77217d..9494098612ca9855fabb8aa6b2b8c73e2e587946 100644 (file)
 # Audio Visual Research <mpruett@sgi.com>
 0      string          2BIT                    Audio Visual Research file
 
-# From Felix von Leitner <leitner@fefe.de>
-0      string          OggS    Ogg-Vorbis compressed sound file
-
 # SGI SoundTrack <mpruett@sgi.com>
 0      string          _SGI_SoundTrack         SGI SoundTrack project file
 # ID3 version 2 tags <waschk@informatik.uni-rostock.de>
index 3fe253a5111591379eb1923f80cebff4e55fe304..a9dd089bf8e09f82ffbc3343a5c6abd205d8997d 100644 (file)
 0      string/b        #!\ /usr/bin/awk        awk script text executable
 0      string          BEGIN                   awk script text
 
-# For Larry Wall's perl language.  The ``eval'' line recognizes an
-# outrageously clever hack for USG systems.
-#                              Keith Waclena <keith@cerberus.uchicago.edu>
-0      string/b        #!\ /bin/perl                   perl script text executable
-0      string          eval\ "exec\ /bin/perl          perl script text
-0      string/b        #!\ /usr/bin/perl               perl script text executable
-0      string          eval\ "exec\ /usr/bin/perl      perl script text
-0      string/b        #!\ /usr/local/bin/perl         perl script text
-0      string          eval\ "exec\ /usr/local/bin/perl        perl script text executable
-
 # AT&T Bell Labs' Plan 9 shell
 0      string/b        #!\ /bin/rc     Plan 9 rc shell script text executable
 
 >2     string          >\0                     %s script text executable
 0      string          #!\                     script text executable
 >3     string          >\0                     for %s
+
+# PHP scripts
+# Ulf Harnhammar <ulfh@update.uu.se>
+0      string/c        =<?php                  PHP script text
+0      string          =<?\n                   PHP script text
+0      string          =<?\r                   PHP script text
+0      string/b        #!\ /usr/local/bin/php  PHP script text executable
+0      string/b        #!\ /usr/bin/php        PHP script text executable
+
+0      string          Zend\x00                PHP script Zend Optimizer data
index f4fe4a47d5e0f447b09e47f39afbbca2b392ffe8..3da7f5fafa960c9675a9c59f2445cd89c1d517ec 100644 (file)
 >2     byte&0x1f       x               %d bits
 
 # gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver)
+#   Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
+#      * Original filename is only at offset 10 if "extra field" absent
+#      * Produce shorter output - notably, only report compression methods
+#        other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
->2      byte            <8              \b, reserved method,
->2      byte            8               \b, deflated,
->3     byte            &0x01           ASCII,
->3     byte            &0x02           continuation,
->3     byte            &0x04           extra field,
->3     byte            &0x08           original filename,
->>10    string          x               `%s',
->3     byte            &0x10           comment,
->3     byte            &0x20           encrypted,
->4     ledate          x               last modified: %s,
->8     byte            2               max compression,
->8     byte            4               max speed,
->9     byte            =0x00           os: MS-DOS
->9     byte            =0x01           os: Amiga
->9     byte            =0x02           os: VMS
->9     byte            =0x03           os: Unix
->9     byte            =0x05           os: Atari
->9     byte            =0x06           os: OS/2
->9     byte            =0x07           os: MacOS
->9     byte            =0x0A           os: Tops/20
->9     byte            =0x0B           os: Win/32
+>2     byte            <8              \b, reserved method
+>2     byte            >8              \b, unknown method
+>3     byte            &0x01           \b, ASCII
+>3     byte            &0x02           \b, continuation
+>3     byte            &0x04           \b, extra field
+>3     byte&0xC        =0x08
+>>10   string          x               \b, was "%s"
+>9     byte            =0x00           \b, from MS-DOS
+>9     byte            =0x01           \b, from Amiga
+>9     byte            =0x02           \b, from VMS
+>9     byte            =0x03           \b, from Unix
+>9     byte            =0x05           \b, from Atari
+>9     byte            =0x06           \b, from OS/2
+>9     byte            =0x07           \b, from MacOS
+>9     byte            =0x0A           \b, from Tops/20
+>9     byte            =0x0B           \b, from Win/32
+>3     byte            &0x10           \b, comment
+>3     byte            &0x20           \b, encrypted
+### >4 ledate          x               last modified: %s,
+>8     byte            2               \b, max compression
+>8     byte            4               \b, max speed
 
 # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
 0      string          \037\036        packed data
 >>17   byte            =0x0A           os: Tops/20
 >>17   byte            =0x0B           os: WinNT
 >>17   byte            =0x0E           os: Win32
+
+# 4.3BSD-Quasijarus Strong Compression
+# http://minnie.tuhs.org/Quasijarus/compress.html
+0      string          \037\241        Quasijarus strong compressed data
index 238fc2b6d0348bb6279e2eb11a29c96f601b3bc0..230f738a209d62f58cb06cb7a60a33322ed371a6 100644 (file)
@@ -1,14 +1,23 @@
-# AC-3 aka A/52 aka Dolby Digital <ashitaka@gmx.at>
+# ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
+# from http://www.atsc.org/standards/a_52a.pdf
 # corrections, additions, etc. are always welcome!
 #
 # syncword
-0       beshort         0x0b77  AC-3 aka A/52 aka Dolby Digital stream,
+0       beshort         0x0b77  ATSC A/52 aka AC-3 aka Dolby Digital stream,
 # fscod
 >4      byte&0xc0       0x00    48 kHz,
 >4      byte&0xc0       0x40    44.1 kHz,
 >4      byte&0xc0       0x80    32 kHz,
 # is this one used for 96 kHz?
 >4      byte&0xc0       0xc0    reserved frequency,
+#
+>5     byte&7 = 0              \b, complete main (CM)
+>5     byte&7 = 1              \b, music and effects (ME)
+>5     byte&7 = 2              \b, visually impaired (VI)
+>5     byte&7 = 3              \b, hearing impaired (HI)
+>5     byte&7 = 4              \b, dialogue (D)
+>5     byte&7 = 5              \b, commentary (C)
+>5     byte&7 = 6              \b, emergency (E)
 # acmod
 >6      byte&0xe0       0x00    1+1 front,
 >6      byte&0xe0       0x20    1 front/0 rear,
 # lfeon (these may be incorrect)
 >7      byte&0x40       0x00    LFE off,
 >7      byte&0x40       0x40    LFE on,
+#
+>4     byte&0x3e = 0x00        \b, 32 kbit/s
+>4     byte&0x3e = 0x02        \b, 40 kbit/s
+>4     byte&0x3e = 0x04        \b, 48 kbit/s
+>4     byte&0x3e = 0x06        \b, 56 kbit/s
+>4     byte&0x3e = 0x08        \b, 64 kbit/s
+>4     byte&0x3e = 0x0a        \b, 80 kbit/s
+>4     byte&0x3e = 0x0c        \b, 96 kbit/s
+>4     byte&0x3e = 0x0e        \b, 112 kbit/s
+>4     byte&0x3e = 0x10        \b, 128 kbit/s
+>4     byte&0x3e = 0x12        \b, 160 kbit/s
+>4     byte&0x3e = 0x14        \b, 192 kbit/s
+>4     byte&0x3e = 0x16        \b, 224 kbit/s
+>4     byte&0x3e = 0x18        \b, 256 kbit/s
+>4     byte&0x3e = 0x1a        \b, 320 kbit/s
+>4     byte&0x3e = 0x1c        \b, 384 kbit/s
+>4     byte&0x3e = 0x1e        \b, 448 kbit/s
+>4     byte&0x3e = 0x20        \b, 512 kbit/s
+>4     byte&0x3e = 0x22        \b, 576 kbit/s
+>4     byte&0x3e = 0x24        \b, 640 kbit/s
 # dsurmod (these may be incorrect)
 >6      beshort&0x0180  0x0000  Dolby Surround not indicated
 >6      beshort&0x0180  0x0080  not Dolby Surround encoded
index b53ec74e3bcf99137afd0d365dbe73352f430d77..a6c04ee5668da6cdab4181c94c651a6538d03046 100644 (file)
@@ -5,38 +5,45 @@
 # We have to check the byte order flag to see what byte order all the
 # other stuff in the header is in.
 #
-# MIPS R3000 may also be for MIPS R2000.
 # What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
 #
 # updated by Daniel Quinlan (quinlan@yggdrasil.com)
 0      string          \177ELF         ELF
 >4     byte            0               invalid class
 >4     byte            1               32-bit
-# only for MIPS
+# only for MIPS - in the future, the ABI field of e_flags should be used.
 >>18   beshort         8
 >>18   beshort         10
 >>>36   belong          &0x20           N32
 >4     byte            2               64-bit
 >5     byte            0               invalid byte order
 >5     byte            1               LSB
-# only for MIPS R3000_BE
+# The official e_machine number for MIPS is now #8, regardless of endianness.
+# The second number (#10) will be deprecated later. For now, we still
+# say something if #10 is encountered, but only gory details for #8.
 >>18    leshort                8
 # only for 32-bit
 >>>4   byte            1
->>>>36  lelong&0xf0000000       0x00000000      mips-1
->>>>36  lelong&0xf0000000       0x10000000      mips-2
->>>>36  lelong&0xf0000000       0x20000000      mips-3
->>>>36  lelong&0xf0000000       0x30000000      mips-4
->>>>36  lelong&0xf0000000       0x40000000      mips-5
->>>>36  lelong&0xf0000000       0x50000000      mips-6
+>>>>36  lelong&0xf0000000      0x00000000      MIPS-I
+>>>>36  lelong&0xf0000000      0x10000000      MIPS-II
+>>>>36  lelong&0xf0000000      0x20000000      MIPS-III
+>>>>36  lelong&0xf0000000      0x30000000      MIPS-IV
+>>>>36  lelong&0xf0000000      0x40000000      MIPS-V
+>>>>36  lelong&0xf0000000      0x60000000      MIPS32
+>>>>36  lelong&0xf0000000      0x70000000      MIPS64
+>>>>36  lelong&0xf0000000      0x80000000      MIPS32 rel2
+>>>>36  lelong&0xf0000000      0x90000000      MIPS64 rel2
 # only for 64-bit
 >>>4   byte            2
->>>>48  lelong&0xf0000000       0x00000000      mips-1
->>>>48  lelong&0xf0000000       0x10000000      mips-2
->>>>48  lelong&0xf0000000       0x20000000      mips-3
->>>>48  lelong&0xf0000000       0x30000000      mips-4
->>>>48  lelong&0xf0000000       0x40000000      mips-5
->>>>48  lelong&0xf0000000       0x50000000      mips-6
+>>>>48  lelong&0xf0000000      0x00000000      MIPS-I
+>>>>48  lelong&0xf0000000      0x10000000      MIPS-II
+>>>>48  lelong&0xf0000000      0x20000000      MIPS-III
+>>>>48  lelong&0xf0000000      0x30000000      MIPS-IV
+>>>>48  lelong&0xf0000000      0x40000000      MIPS-V
+>>>>48  lelong&0xf0000000      0x60000000      MIPS32
+>>>>48  lelong&0xf0000000      0x70000000      MIPS64 
+>>>>48  lelong&0xf0000000      0x80000000      MIPS32 rel2
+>>>>48  lelong&0xf0000000      0x90000000      MIPS64 rel2
 >>16   leshort         0               no file type,
 >>16   leshort         1               relocatable,
 >>16   leshort         2               executable,
 >>18   leshort         5               Motorola 88000 - invalid byte order,
 >>18   leshort         6               Intel 80486,
 >>18   leshort         7               Intel 80860,
-# "officially" big endian, but binutils bfd only emits magic #8 for MIPS.
->>18   leshort         8               MIPS R3000_LE [bfd bug],
+>>18   leshort         8               MIPS,
 >>18   leshort         9               Amdahl - invalid byte order,
->>18   leshort         10              MIPS R3000_LE,
+>>18   leshort         10              MIPS (deprecated),
 >>18   leshort         11              RS6000 - invalid byte order,
 >>18   leshort         15              PA-RISC - invalid byte order,
 >>>50  leshort         0x0214          2.0
 >>20   lelong          1               version 1
 >>36   lelong          1               MathCoPro/FPU/MAU Required
 >5     byte            2               MSB
-# only for MIPS R3000_BE
+# only for MIPS - see comment in little-endian section above.
 >>18    beshort                8
 # only for 32-bit
 >>>4   byte            1
->>>>36  belong&0xf0000000       0x00000000      mips-1
->>>>36  belong&0xf0000000       0x10000000      mips-2
->>>>36  belong&0xf0000000       0x20000000      mips-3
->>>>36  belong&0xf0000000       0x30000000      mips-4
->>>>36  belong&0xf0000000       0x40000000      mips-5
->>>>36  belong&0xf0000000       0x50000000      mips-6
+>>>>36  belong&0xf0000000      0x00000000      MIPS-I
+>>>>36  belong&0xf0000000      0x10000000      MIPS-II
+>>>>36  belong&0xf0000000      0x20000000      MIPS-III
+>>>>36  belong&0xf0000000      0x30000000      MIPS-IV
+>>>>36  belong&0xf0000000      0x40000000      MIPS-V
+>>>>36  belong&0xf0000000      0x60000000      MIPS32
+>>>>36  belong&0xf0000000      0x70000000      MIPS64
+>>>>36  belong&0xf0000000      0x80000000      MIPS32 rel2
+>>>>36  belong&0xf0000000      0x90000000      MIPS64 rel2
 # only for 64-bit
 >>>4   byte            2
->>>>48  belong&0xf0000000       0x00000000      mips-1
->>>>48  belong&0xf0000000       0x10000000      mips-2
->>>>48  belong&0xf0000000       0x20000000      mips-3
->>>>48  belong&0xf0000000       0x30000000      mips-4
->>>>48  belong&0xf0000000       0x40000000      mips-5
->>>>48  belong&0xf0000000       0x50000000      mips-6
+>>>>48 belong&0xf0000000       0x00000000      MIPS-I
+>>>>48 belong&0xf0000000       0x10000000      MIPS-II
+>>>>48 belong&0xf0000000       0x20000000      MIPS-III
+>>>>48 belong&0xf0000000       0x30000000      MIPS-IV
+>>>>48 belong&0xf0000000       0x40000000      MIPS-V
+>>>>48 belong&0xf0000000       0x60000000      MIPS32
+>>>>48 belong&0xf0000000       0x70000000      MIPS64 
+>>>>48 belong&0xf0000000       0x80000000      MIPS32 rel2
+>>>>48 belong&0xf0000000       0x90000000      MIPS64 rel2
 >>16   beshort         0               no file type,
 >>16   beshort         1               relocatable,
 >>16   beshort         2               executable,
 >>18   beshort         5               Motorola 88000,
 >>18   beshort         6               Intel 80486 - invalid byte order,
 >>18   beshort         7               Intel 80860,
->>18   beshort         8               MIPS R3000_BE,
+>>18   beshort         8               MIPS,
 >>18   beshort         9               Amdahl,
->>18   beshort         10              MIPS R3000_LE - invalid byte order,
+>>18   beshort         10              MIPS (deprecated),
 >>18   beshort         11              RS6000,
 >>18   beshort         15              PA-RISC
 >>>50  beshort         0x0214          2.0
index 20600c6f3a28c6a2909c358a5ee19e6282e8fa90..71ea57dc47dcae25a7d93b170609063720fbab71 100644 (file)
 >512    belong&077777777       0600407 \b, boot block present
 0x1FE  leshort 0xAA55                  x86 boot sector
 >2     string  OSBS                    \b, OS/BS MBR
+# J\xf6rg Jenderek <joerg@pcialias.localnet>
 >0x8C  string  Invalid\ partition\ table       \b, MS-DOS MBR
+>0x9D  string  Invalid\ partition\ table       \b, DR-DOS MBR, version 7.01 to 7.03
+>0x10F string  Ung\201ltige\ Partitionstabelle \b, MS-DOS MBR, german version 4.10.1998, 4.10.2222
+>0x8B  string  Ung\201ltige\ Partitionstabelle \b, MS-DOS MBR, german version 5.00 to 4.00.950
+>0x145 string  Default:\ F                     \b, FREE-DOS MBR
 >0     string  \0\0\0\0                \b, extended partition table
 >0     leshort 0x3CEB                  \b, system
 >>3    string  >\0                     %s
 >>>>32 lelong          x               %d sectors
 >0x200 lelong  0x82564557              \b, BSD disklabel
 
+# Solaris 7 FAT12 floppies J\xf6rg Jenderek <joerg@pcialias.localnet>
+>0     leshort 0x7AEB                  \b, system
+>>3    string  >\0                     %s
+>>0x36 string  FAT                     \b, %s
+>>>0x39        string  12                      (%s bit)
+
 # Minix filesystems - Juan Cespedes <cespedes@debian.org>
 0x410  leshort         0x137f          Minix filesystem
 0x410  leshort         0x138f          Minix filesystem, 30 char names
diff --git a/magic/Magdir/gringotts b/magic/Magdir/gringotts
new file mode 100644 (file)
index 0000000..2d135f8
--- /dev/null
@@ -0,0 +1,25 @@
+
+#------------------------------------------------------------------------------
+# gringotts:  file(1) magic for Gringotts
+# http://devel.pluto.linux.it/projects/Gringotts/
+# author: Germano Rizzo <mano@pluto.linux.it>
+#GRG2????Y
+0      string  GRG             Gringotts data file
+>3     string          1               v.1, SERPENT crypt, SHA-256 hash, ZLib lvl.9
+>3     string          2               v.2,
+>>8    byte&0x70       0x00            RIJNDAEL-128 crypt,
+>>8    byte&0x70       0x10            SERPENT crypt,
+>>8    byte&0x70       0x20            TWOFISH crypt, 
+>>8    byte&0x70       0x30            CAST-256 crypt,
+>>8    byte&0x70       0x40            SAFER+ crypt,
+>>8    byte&0x70       0x50            LOKI97 crypt,
+>>8    byte&0x70       0x60            3DES crypt,
+>>8    byte&0x70       0x70            RIJNDAEL-256 crypt,
+>>8    byte&0x08       0x00            SHA1 hash,
+>>8    byte&0x08       0x08            RIPEMD-160 hash,
+>>8    byte&0x04       0x00            ZLib
+>>8    byte&0x04       0x04            BZip2
+>>8    byte&0x03       0x00            lvl.0
+>>8    byte&0x03       0x01            lvl.3
+>>8    byte&0x03       0x02            lvl.6
+>>8    byte&0x03       0x03            lvl.9
index 4e6c926be9aa34bcb5cd4cc85951057441acb082..11f33cd20182b3028985db33f7d3555f59b77afb 100644 (file)
@@ -3,17 +3,24 @@
 # lisp:  file(1) magic for lisp programs
 #
 # various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
+
+# This is a guess, but a good one.
 0      string  ;;                      Lisp/Scheme program text
+
 # Emacs 18 - this is always correct, but not very magical.
-0      string  \012(                   byte-compiled Emacs-Lisp program data
+0      string  \012(                   Emacs v18 byte-compiled Lisp data
 # Emacs 19+ - ver. recognition added by Ian Springer
-0      string  ;ELC                    byte-compiled Emacs-Lisp program data,
->4     byte    >0                      version %d
-#
+# Also applies to XEmacs 19+ .elc files; could tell them apart if we had regexp
+# support or similar - Chris Chittleborough <cchittleborough@yahoo.com.au>
+0      string  ;ELC                    
+>4     byte    >19                     
+>4     byte    <32                     Emacs/XEmacs v%d byte-compiled Lisp data
+
 # Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr>
 0      string  (SYSTEM::VERSION\040'   CLISP byte-compiled Lisp program text
 0      long    0x70768BD2              CLISP memory image data
 0      long    0xD28B7670              CLISP memory image data, other endian
+
 # Files produced by GNU gettext
 0      long    0xDE120495              GNU-format message catalog data
 0      long    0x950412DE              GNU-format message catalog data
diff --git a/magic/Magdir/nitpicker b/magic/Magdir/nitpicker
new file mode 100644 (file)
index 0000000..c40daec
--- /dev/null
@@ -0,0 +1,12 @@
+#------------------------------------------------------------------------------
+# nitpicker:  file(1) magic for Flowfiles.
+# From: Christian Jachmann <C.Jachmann@gmx.net> http://www.nitpicker.de
+0      string  NPFF    NItpicker Flow File 
+>4     byte    x       V%d.
+>5     byte    x       %d
+>6     bedate  x       started: %s
+>10    bedate  x       stopped: %s
+>14    belong  x       Bytes: %u
+>18    belong  x       Bytes1: %u
+>22    belong  x       Flows: %u
+>26    belong  x       Pkts: %u
diff --git a/magic/Magdir/perl b/magic/Magdir/perl
new file mode 100644 (file)
index 0000000..bfbec4c
--- /dev/null
@@ -0,0 +1,17 @@
+
+#------------------------------------------------------------------------------
+# perl:  file(1) magic for Larry Wall's perl language.
+#
+# The ``eval'' line recognizes an outrageously clever hack for USG systems.
+# Keith Waclena <keith@cerberus.uchicago.edu>
+# Send additions to <perl5-porters@perl.org>
+0      string/b        #!\ /bin/perl                   perl script text executable
+0      string          eval\ "exec\ /bin/perl          perl script text
+0      string/b        #!\ /usr/bin/perl               perl script text executable
+0      string          eval\ "exec\ /usr/bin/perl      perl script text
+0      string/b        #!\ /usr/local/bin/perl         perl script text
+0      string          eval\ "exec\ /usr/local/bin/perl        perl script text executable
+
+# a couple more, by me
+0      regex           package         Perl5 module source text (via regex)
+0      string          package         Perl5 module source text
diff --git a/magic/Magdir/pulsar b/magic/Magdir/pulsar
new file mode 100644 (file)
index 0000000..cb9cac6
--- /dev/null
@@ -0,0 +1,10 @@
+#------------------------------------------------------------------------------
+# pulsar:  file(1) magic for Pulsar POP3 daemon binary files
+#
+# http://pulsar.sourceforge.net
+# mailto:rok.papez@lugos.si
+#
+
+0      belong  0x1ee7f11e      Pulsar POP3 daemon mailbox cache file.
+>4     ubelong x               Version: %d.
+>8     ubelong x               \b%d
index 503ef8967ad5f13f3b0fcb0ac0e9c0b8293587c9..7880ab510e628cff16cc97018bf585da5727ce39 100644 (file)
@@ -8,3 +8,12 @@
 >16    string  >\0       - version %s
 0      short   0x271c    Sendmail frozen configuration
 >16    string  >\0       - version %s
+
+#------------------------------------------------------------------------------
+# sendmail:  file(1) magic for sendmail m4(1) files
+#
+# From Hendrik Scholz <hendrik@scholz.net>
+# i.e. files in /usr/share/sendmail/cf/
+#
+0   string  divert(-1)\n    sendmail m4 text file
+
index 79d5bbaaf73b2063852c100f3863388f198ab461..be84ecc4ca0061c56c667f1287be661761237bc3 100644 (file)
 0      string          \\documentclass LaTeX 2e document text
 0      string          \\relax         LaTeX auxiliary file
 0      string          \\contentsline  LaTeX  table of contents
+0      string          %\ -*-latex-*-  LaTeX document text
+
+# Tex document, from Hendrik Scholz <hendrik@scholz.net>
+0   string      \\ifx       TeX document text
 
 # Index and glossary files
 0      string          \\indexentry    LaTeX raw index file
 0      string          \\glossaryentry LaTeX raw glossary
 0      string          \\begin{theglossary}    LaTeX sorted glossary
 0      string          This\ is\ makeindex     Makeindex log file
+
 # End of TeX
+
+#------------------------------------------------------------------------------
+# file(1) magic for BibTex text files
+# From Hendrik Scholz <hendrik@scholz.net>
+
+0   string @article{          BibTex text file
+0   string @book{             BibTex text file
+0   string @inbook{           BibTex text file
+0   string @incollection{     BibTex text file
+0   string @inproceedings{    BibTex text file
+0   string @manual{           BibTex text file
+0   string @misc{             BibTex text file
+0   string @preamble{         BibTex text file
+0   string @phdthesis{        BibTex text file
+0   string @techreport{       BibTex text file
+0   string @unpublished{      BibTex text file
+
+0   string @Article{          BibTex text file
+0   string @Book{             BibTex text file
+0   string @Inbook{           BibTex text file
+0   string @Incollection{     BibTex text file
+0   string @Inproceedings{    BibTex text file
+0   string @Manual{           BibTex text file
+0   string @Misc{             BibTex text file
+0   string @Preamble{         BibTex text file
+0   string @Phdthesis{        BibTex text file
+0   string @Techreport{       BibTex text file
+0   string @Unpublished{      BibTex text file
+
+0   string @ARTICLE{          BibTex text file
+0   string @BOOK{             BibTex text file
+0   string @INBOOK{           BibTex text file
+0   string @INCOLLECTION{     BibTex text file
+0   string @INPROCEEDINGS{    BibTex text file
+0   string @MANUAL{           BibTex text file
+0   string @MISC{             BibTex text file
+0   string @PREAMBLE{         BibTex text file
+0   string @PHDTHESIS{        BibTex text file
+0   string @TECHREPORT{       BibTex text file
+0   string @UNPUBLISHED{      BibTex text file
+
+73  string %%%\ \ BibTeX-file{ BibTex text file (with full header)
+
+73  string %%%\ \ @BibTeX-style-file{   BibTeX style text file (with full header)
+
+0   string %\ BibTeX\ standard\ bibliography\      BibTeX standard bibliography style text file
+
+0   string %\ BibTeX\ `     BibTeX custom bibliography style text file
+
+0   string  @c\ @mapfile{   TeX font aliases text file
+
index 03ca5103d5d37994bb41f625207875fde4df0c1d..76322dd5487af4de00ecd5988819d4868b068521 100644 (file)
@@ -26,3 +26,7 @@
 # gnu gmon magic From: Eugen Dedu <dedu@ese-metz.fr>
 0      string          gmon            GNU prof performance data
 >4     long            x               - version %ld
+# From: Dave Pearson <davep@davep.org>
+# Harbour <URL:http://www.harbour-project.org/> HRB files.
+0     string \xc0HRB   Harbour HRB file
+>4    short  x         version %d
index 6e4efadc21ee5a0f8708a19bd268997687895359..5e40842853254acc50340407053fb477ad47766a 100644 (file)
@@ -4,6 +4,7 @@
 #
 # From Felix von Leitner <leitner@fefe.de>
 # Extended by Beni Cherniavsky <cben@crosswinds.net>
+# Further extended by Greg Wooledge <greg@wooledge.org>
 #
 # Most (everything but the number of channels and bitrate) is commented
 # out with `##' as it's not interesting to the average user.  The most
 >>>>48         string          <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff       \b,
 # The above tests if at least one of these is specified:
 >>>>>44                lelong          !-1
->>>>>>44       lelong          x               >%lu
+# Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields
+# instead of -1.
+>>>>>>44       lelong          !-1000
+>>>>>>>44      lelong          x               >%lu
 >>>>>48                lelong          !-1
 >>>>>>48       lelong          x               ~%lu
 >>>>>52                lelong          !-1
->>>>>>52       lelong          x               <%lu
+>>>>>>52       lelong          !-1000
+>>>>>>>52      lelong          x               <%lu
 >>>>>48                string          <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff       kbps
 # -- Second vorbis header packet - the comments
->>>102         string          \x03vorbis
 # A kludge to read the vendor string.  It's a counted string, not a
 # zero-terminated one, so file(1) can't read it in a generic way.
 # libVorbis is the only one existing currently, so I detect specifically
 # it.  The interesting value is the cvs date (8 digits decimal).
-##>>>>113              string/c        Xiphophorus\ libVorbis\ I       \b, created by: Xiphophorus libVorbis I
-##>>>>>137     string          >00000000       %.8s
+# Post-RC1 Ogg files have the second header packet (and thus the version)
+# in a different place, so we must use an indirect offset.
+>>>(84.b+85)           string          \x03vorbis
+>>>>(84.b+96)          string/c        Xiphophorus\ libVorbis\ I       \b, created by: Xiphophorus libVorbis I
+>>>>>(84.b+120)                string          >00000000       %.8s
 # Map to beta version numbers:
-##>>>>>>137    string          <20000508       (<beta1 - prepublic)
+>>>>>>(84.b+120)       string          <20000508       (<beta1 - prepublic)
+>>>>>>(84.b+120)       string          20000508        (beta1/2)
+>>>>>>(84.b+120)       string          >20000508
+>>>>>>>(84.b+120)      string          <20001031       (beta2-3)
+>>>>>>(84.b+120)       string          20001031        (beta3)
+>>>>>>(84.b+120)       string          >20001031
+>>>>>>>(84.b+120)      string          <20010225       (beta3-4)
+>>>>>>(84.b+120)       string          20010225        (beta4)
+>>>>>>(84.b+120)       string          >20010225
+>>>>>>>(84.b+120)      string          <20010615       (beta4-RC1)
+>>>>>>(84.b+120)       string          20010615        (RC1)
+>>>>>>(84.b+120)       string          20010813        (RC2)
+>>>>>>(84.b+120)       string          20010816        (RC2 - Garf tuned v1)
+>>>>>>(84.b+120)       string          20011014        (RC2 - Garf tuned v2)
+>>>>>>(84.b+120)       string          20011217        (pre-RC3 CVS)
+>>>>>>(84.b+120)       string          20011231        (RC3)
 # The string has not changed from beta1 to 2 - they are indistinguishable.
-##>>>>>>137    string          20000508        (beta1/2)
-##>>>>>>137    string          >20000508
-##>>>>>>>137   string          <20001031       (beta2-3)
-##>>>>>>137    string          20001031        (beta3)
-##>>>>>>137    string          >20001031
-##>>>>>>>137   string          <20010225       (beta3-4)
-##>>>>>>137    string          20010225        (beta4)
-##>>>>>>137    string          >20010225
-##>>>>>>>137   string          <20010615       (beta4-RC1)
-##>>>>>>137    string          20010615        (RC1)
-##>>>>>>137    string          >20010615       (>RC1)
 # Then come the comments, again length-counted (and number-counted).
 # Some looping constructs and registers would allow reading them but now
 # it's impossible.  However we can print the number of comments present
diff --git a/magic/Magdir/vxl b/magic/Magdir/vxl
new file mode 100644 (file)
index 0000000..d3f5561
--- /dev/null
@@ -0,0 +1,13 @@
+
+#------------------------------------------------------------------------------
+# VXL: file(1) magic for VXL binary IO data files
+#
+# from Ian Scott <scottim@sf.net>
+#
+# VXL is a collection of C++ libraries for Computer Vision.
+# See the vsl chapter in the VXL Book for more info
+# http://www.isbe.man.ac.uk/public_vxl_doc/books/vxl/book.html
+# http:/vxl.sf.net
+
+2      lelong  0x472b2c4e      VXL data file,
+>0     leshort >0              schema version no %d
index 836942a852428552b2884bfc782c94695b4a94b5..f42497068fa94649875410c2f8287f482120a179 100644 (file)
 0      belong          0x2e7261fd      application/x-realaudio
 
 # MPEG Layer 3 sound files
-# Modified the 11/20/97 at 15:59:04 by Christophe Prud'homme <christophe.prudhomme@asci.fr>
-0       belong          0xfffb          audio/x-mp3
+0       beshort                &0xffe0         audio/mpeg
 #MP3 with ID3 tag
-0      string          ID3             audio/x-mp3
+0      string          ID3             audio/mpeg
 # Ogg/Vorbis
 0      string          OggS            audio/x-ogg
 
 
 #PNG Image Format
 0      string          \x89PNG                 image/png
+
+# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
+0      string          \x8aMNG                 video/x-mng
index 47846d9ca3d76b376470ea38bcacdb9ee7b9fab8..9a091af7aed183917a21ff8dbe8ac42f644dbe0f 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for file(1) cmd. 
 # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
-# @(#)$Id: Makefile.std,v 1.12 2001/09/03 14:44:21 christos Exp $
+# @(#)$Id: Makefile.std,v 1.13 2002/05/16 18:45:56 christos Exp $
 #
 # This software is not subject to any license of the American Telephone
 # and Telegraph Company or of the Regents of the University of California.
@@ -71,10 +71,10 @@ LOCALOBJS = # localsrc/getopt.o localsrc/strtol.o \
 LOCALINC = # localinc/*.h localinc/sys/*.h
 
 SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
-       compress.c is_tar.c readelf.c internat.c \
+       compress.c is_tar.c readelf.c \
        print.c $(LOCALSRCS) $(LOCALINC)
 OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \
-       compress.o is_tar.o readelf.o internat.o \
+       compress.o is_tar.o readelf.o \
        print.o $(LOCALOBJS)
 HDRS = file.h names.h patchlevel.h readelf.h tar.h
 
index 3423ecab0fc96e2d10fcc5433fe0be85f88c217c..7818191085992501f7878cc6b65e8a7b0460b3a1 100644 (file)
 /* Define if the `long long' type works.  */
 #undef HAVE_LONG_LONG
 
+/* Define if we have "tm_zone" in "struct tm".  */
+#undef HAVE_TM_ZONE
+
+/* Define if we have a global "char * []" "tzname" variable.  */
+#undef HAVE_TZNAME
+
 /* Define if we have "tm_isdst" in "struct tm".  */
 #undef HAVE_TM_ISDST
 
index 5c5ffc75e952c51e57b70ea5e33cf225be4f2d39..5465c73bff1cb8e84d24214b02f046ba903220fc 100644 (file)
@@ -42,7 +42,7 @@
 #endif
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.45 2001/10/20 16:19:44 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.46 2002/05/16 18:45:56 christos Exp $")
 #endif /* lint */
 
 #define        EATAB {while (isascii((unsigned char) *l) && \
@@ -313,6 +313,8 @@ signextend(m, v)
                case STRING:
                case PSTRING:
                        break;
+               case REGEX:
+                       break;
                default:
                        magwarn("can't happen: m->type=%d\n",
                                m->type);
@@ -479,6 +481,7 @@ parse(magicp, nmagicp, l, action)
 #define NLDATE         5
 #define NBELDATE       7
 #define NLELDATE       7
+#define NREGEX         5
 
        if (*l == 'u') {
                ++l;
@@ -534,6 +537,9 @@ parse(magicp, nmagicp, l, action)
        } else if (strncmp(l, "leldate", NLELDATE)==0) {
                m->type = LELDATE;
                l += NLELDATE;
+       } else if (strncmp(l, "regex", NREGEX)==0) {
+               m->type = REGEX;
+               l += sizeof("regex");
        } else {
                magwarn("type %s invalid", l);
                return -1;
@@ -698,7 +704,7 @@ getvalue(m, p)
 {
        int slen;
 
-       if (m->type == STRING || m->type == PSTRING) {
+       if (m->type == STRING || m->type == PSTRING || m->type == REGEX) {
                *p = getstr(*p, m->value.s, sizeof(m->value.s), &slen);
                m->vallen = slen;
        } else
@@ -921,7 +927,7 @@ eatsize(p)
 }
 
 /*
- * handle an mmaped file.
+ * handle a compiled file.
  */
 static int
 apprentice_map(magicp, nmagicp, fn, action)
index 19f6e2b7f19903c5a88c9f29598736d3db729584..82034863b99995c49d85b3f7a20e9f4d9efdd3b4 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 #ifndef lint
-FILE_RCSID("@(#)$Id: compress.c,v 1.21 2001/10/20 17:44:52 christos Exp $")
+FILE_RCSID("@(#)$Id: compress.c,v 1.22 2002/05/16 18:45:56 christos Exp $")
 #endif
 
 
@@ -57,7 +57,8 @@ static int uncompressgzipped __P((const unsigned char *, unsigned char **,
 #endif
 
 int
-zmagic(buf, nbytes)
+zmagic(fname, buf, nbytes)
+       const char *fname;
        unsigned char *buf;
        int nbytes;
 {
@@ -70,10 +71,10 @@ zmagic(buf, nbytes)
                        continue;
                if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 &&
                    (newsize = uncompressbuf(i, buf, &newbuf, nbytes)) != 0) {
-                       tryit(newbuf, newsize, 1);
+                       tryit(fname, newbuf, newsize, 1);
                        free(newbuf);
                        printf(" (");
-                       tryit(buf, nbytes, 0);
+                       tryit(fname, buf, nbytes, 0);
                        printf(")");
                        return 1;
                }
index 33bd4b0b2ba394425ba968a4518273000252d478..10dc8fe5458bbafcfe3b9bee30b097279c0cb49b 100644 (file)
@@ -24,6 +24,8 @@
  *
  * 4. This notice may not be removed or altered.
  */
+#include "file.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <locale.h>
 #endif
 
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>    /* for long options (is this portable?)*/
+#endif
+
 #include <netinet/in.h>                /* for byte swapping */
 
-#include "file.h"
 #include "patchlevel.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: file.c,v 1.61 2001/12/18 20:56:38 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.62 2002/05/16 18:45:56 christos Exp $")
 #endif /* lint */
 
 
@@ -66,6 +71,11 @@ FILE_RCSID("@(#)$Id: file.c,v 1.61 2001/12/18 20:56:38 christos Exp $")
 # define USAGE  "Usage: %s [-bciknsvz] [-f namefile] [-m magicfiles] file...\n"
 #endif
 
+#ifdef __EMX__
+static char *apptypeName = NULL;
+int os2_apptype (const char *fn, char *buf, int nb);
+#endif /* __EMX__ */
+
 #ifndef MAGIC
 # define MAGIC "/etc/magic"
 #endif
@@ -98,6 +108,9 @@ int lineno;          /* line number in the magic file        */
 
 static void    unwrap          __P((char *fn));
 static void    usage           __P((void));
+#ifdef HAVE_GETOPT_H
+static void    help            __P((void));
+#endif
 #if 0
 static int     byteconv4       __P((int, int, int));
 static short   byteconv2       __P((int, int, int));
@@ -117,11 +130,40 @@ main(argc, argv)
        int action = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0;
        char *mime, *home, *usermagic;
        struct stat sb;
+#define OPTSTRING      "bcdf:ikm:nsvzCL"
+#ifdef HAVE_GETOPT_H
+       int longindex;
+       static struct option long_options[] =
+       {
+               {"version", 0, 0, 'v'},
+               {"help", 0, 0, 0},
+               {"brief", 0, 0, 'b'},
+               {"checking-printout", 0, 0, 'c'},
+               {"debug", 0, 0, 'd'},
+               {"files-from", 1, 0, 'f'},
+               {"mime", 0, 0, 'i'},
+               {"keep-going", 0, 0, 'k'},
+#ifdef S_IFLNK
+               {"dereference", 0, 0, 'L'},
+#endif
+               {"magic-file", 1, 0, 'm'},
+               {"uncompress", 0, 0, 'z'},
+               {"no-buffer", 0, 0, 'n'},
+               {"special-files", 0, 0, 's'},
+               {"compile", 0, 0, 'C'},
+               {0, 0, 0, 0},
+       };
+#endif
 
 #ifdef LC_CTYPE
        setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */
 #endif
 
+#ifdef __EMX__
+       /* sh-like wildcard expansion! Shouldn't hurt at least ... */
+       _wildcard(&argc, &argv);
+#endif
+
        if ((progname = strrchr(argv[0], '/')) != NULL)
                progname++;
        else
@@ -142,8 +184,19 @@ main(argc, argv)
                        }
                }
 
-       while ((c = getopt(argc, argv, "bcdf:ikm:nsvzCL")) != -1)
+#ifndef HAVE_GETOPT_H
+       while ((c = getopt(argc, argv, OPTSTRING)) != -1)
+#else
+       while ((c = getopt_long(argc, argv, OPTSTRING, long_options,
+           &longindex)) != -1)
+#endif
                switch (c) {
+#ifdef HAVE_GETOPT_H
+               case 0 :
+                       if (longindex == 1)
+                               help();
+                       break;
+#endif
                case 'b':
                        ++bflag;
                        break;
@@ -400,7 +453,7 @@ process(inname, wid)
                ckfputs(iflag ? "application/x-empty" : "empty", stdout);
        else {
                buf[nbytes++] = '\0';   /* null-terminate it */
-               match = tryit(buf, nbytes, zflag);
+               match = tryit(inname, buf, nbytes, zflag);
        }
 
 #ifdef BUILTIN_ELF
@@ -446,12 +499,27 @@ process(inname, wid)
 
 
 int
-tryit(buf, nb, zflag)
-       unsigned char *buf;
-       int nb, zflag;
+tryit(fn, buf, nb, zfl)
+       const char *fn;         /* file name*/
+       unsigned char *buf;     /* buffer */
+       int nb, zfl;
 {
+
+       /*
+        * The main work is done here!
+        * We have the file name and/or the data buffer to be identified. 
+        */
+
+#ifdef __EMX__
+       /*
+        * Ok, here's the right place to add a call to some os-specific
+        * routine, e.g.
+        */
+       if (os2_apptype(fn, buf, nb) == 1)
+              return 'o';
+#endif
        /* try compression stuff */
-       if (zflag && zmagic(buf, nb))
+       if (zfl && zmagic(fn, buf, nb))
                return 'z';
 
        /* try tests in /etc/magic (or surrogate magic file) */
@@ -472,5 +540,37 @@ usage()
 {
        (void)fprintf(stderr, USAGE, progname);
        (void)fprintf(stderr, "Usage: %s -C [-m magic]\n", progname);
+#ifdef HAVE_GETOPT_H
+       (void)fputs("Try `file --help' for more information.\n", stderr);
+#endif
        exit(1);
 }
+
+#ifdef HAVE_GETOPT_H
+static void
+help()
+{
+       puts(
+"Usage: file [OPTION]... [FILE]...
+Determine file type of FILEs.
+
+  -m, --magic-file LIST      use LIST as a colon-separated list of magic
+                               number files
+  -z, --uncompress           try to look inside compressed files
+  -b, --brief                do not prepend filenames to output lines
+  -c, --checking-printout    print the parsed form of the magic file, use in
+                               conjunction with -m to debug a new magic file
+                               before installing it
+  -f, --files-from FILE      read the filenames to be examined from FILE
+  -i, --mime                 output mime type strings
+  -k, --keep-going           don't stop at the first match
+  -L, --dereference          causes symlinks to be followed
+  -n, --no-buffer            do not buffer output
+  -s, --special-files        treat special (block/char devices) files as
+                             ordinary ones
+      --help                 display this help and exit
+      --version              output version information and exit"
+);
+       exit(0);
+}
+#endif
index e0f588ae805fcfab65fc39248d13f02d9463eed3..1c67331537c0f720d2c359a047b19e9331971c0a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.38 2001/10/20 17:44:53 christos Exp $
+ * @(#)$Id: file.h,v 1.39 2002/05/16 18:45:56 christos Exp $
  *
  * Copyright (c) Ian F. Darwin, 1987.
  * Written by Ian F. Darwin.
@@ -79,6 +79,7 @@ struct magic {
 #define                                LDATE   14
 #define                                BELDATE 15
 #define                                LELDATE 16
+#define                                REGEX   17
        uint8 in_op;            /* operator for indirection */
        uint8 mask_op;          /* operator for mask */
 #define                                OPAND   1
@@ -97,6 +98,7 @@ struct magic {
                unsigned short h;
                uint32 l;
                char s[MAXstring];
+               char *buf;
                unsigned char hs[2];    /* 2 bytes of a fixed-endian "short" */
                unsigned char hl[4];    /* 4 bytes of a fixed-endian "long" */
        } value;                /* either number or string */
@@ -146,8 +148,8 @@ extern void  mdump          __P((struct magic *));
 extern void  process           __P((const char *, int));
 extern void  showstr           __P((FILE *, const char *, int));
 extern int   softmagic         __P((unsigned char *, int));
-extern int   tryit             __P((unsigned char *, int, int));
-extern int   zmagic            __P((unsigned char *, int));
+extern int   tryit             __P((const char *, unsigned char *, int, int));
+extern int   zmagic            __P((const char *, unsigned char *, int));
 extern void  ckfprintf         __P((FILE *, const char *, ...));
 extern uint32 signextend       __P((struct magic *, unsigned int32));
 extern void tryelf             __P((int, unsigned char *, int));
index 6c5b61ce779286f2846dd5754c4fb5d562f0a47e..d6651fb37fe95f418e46d71e36eb81392a3a7cc5 100644 (file)
@@ -5,12 +5,15 @@
  * Public Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
  *
  * @(#)list.c 1.18 9/23/86 Public Domain - gnu
- * $Id: is_tar.c,v 1.13 2000/08/05 17:36:48 christos Exp $
+ * $Id: is_tar.c,v 1.14 2002/05/16 18:45:56 christos Exp $
  *
  * Comments changed and some code/comments reformatted
  * for file command by Ian Darwin.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <string.h>
 #include <ctype.h>
 #include <sys/types.h>
@@ -18,7 +21,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$Id: is_tar.c,v 1.13 2000/08/05 17:36:48 christos Exp $")
+FILE_RCSID("@(#)$Id: is_tar.c,v 1.14 2002/05/16 18:45:56 christos Exp $")
 #endif
 
 #define        isodigit(c)     ( ((c) >= '0') && ((c) <= '7') )
index f1e24644c5d3d70f53893cff1567fd4087620ac6..d38ad4a50808dd83cea4427ccb526a2d2b2d5502 100644 (file)
@@ -1,11 +1,19 @@
 #define        FILE_VERSION_MAJOR      3
-#define        patchlevel              37
+#define        patchlevel              38
 
 /*
  * Patchlevel file for Ian Darwin's MAGIC command.
- * $Id: patchlevel.h,v 1.37 2001/09/03 14:44:22 christos Exp $
+ * $Id: patchlevel.h,v 1.38 2002/05/16 18:45:56 christos Exp $
  *
  * $Log: patchlevel.h,v $
+ * Revision 1.38  2002/05/16 18:45:56  christos
+ * - pt_note elf additions from NetBSD
+ * - EMX os specific changes (Alexander Mai)
+ * - stdint.h detection, acconfig.h fixes (Maciej W. Rozycki, Franz Korntner)
+ * - regex file additions (Kim Cromie)
+ * - getopt_long support and misc cleanups (Michael Piefel)
+ * - many magic fixes and additions
+ *
  * Revision 1.37  2001/09/03 14:44:22  christos
  * daylight/tm_isdst detection
  * magic fixes
index b6803994448e5a3a034e17d8738c02114a878f08..3c0c99a7c3b93d30ce41ea1e9892a40f4500c249 100644 (file)
@@ -41,7 +41,7 @@
 #include <time.h>
 
 #ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.34 2001/08/07 16:01:26 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.35 2002/05/16 18:45:56 christos Exp $")
 #endif  /* lint */
 
 #define SZOF(a)        (sizeof(a) / sizeof(a[0]))
@@ -54,7 +54,7 @@ mdump(m)
                                     "long", "string", "date", "beshort",
                                     "belong", "bedate", "leshort", "lelong",
                                     "ledate", "pstring", "ldate", "beldate",
-                                    "leldate" };
+                                    "leldate", "regex" };
        static const char optyp[] = { '@', '&', '|', '^', '+', '-', 
                                      '*', '/', '%' };
        (void) fputc('[', stderr);
@@ -110,6 +110,7 @@ mdump(m)
                        break;
                case STRING:
                case PSTRING:
+               case REGEX:
                        showstr(stderr, m->value.s, -1);
                        break;
                case DATE:
index 21d64362de7f12f88e9718a0efe3f02a86dc8057..c0d3ba297d4204af7d10a4d8412df8269cf7b588 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * readelf.h 
- * @(#)$Id: readelf.h,v 1.8 2002/05/16 15:01:41 christos Exp $
+ * @(#)$Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp $
  *
  * Provide elf data structures for non-elf machines, allowing file
  * non-elf hosts to determine if an elf binary is stripped.
@@ -9,6 +9,10 @@
 #ifndef __fake_elf_h__
 #define __fake_elf_h__
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
 typedef uint32_t       Elf32_Addr;
 typedef uint32_t       Elf32_Off;
 typedef uint16_t       Elf32_Half;
index 904360e2d1586bd007731c2f22c28877ed6fb933..dd3d9835feeae697348f428905592b290d49ae0e 100644 (file)
 #include <stdlib.h>
 #include <time.h>
 #include <sys/types.h>
+#include <regex.h>
 
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.47 2002/05/16 15:01:41 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.48 2002/05/16 18:45:56 christos Exp $")
 #endif /* lint */
 
 static int match       __P((struct magic *, uint32, unsigned char *, int));
@@ -271,6 +272,10 @@ mprint(p, m)
                (void) printf(m->desc, fmttime(p->l, 0));
                t = m->offset + sizeof(time_t);
                break;
+       case REGEX:
+               (void) printf(m->desc, p->s);
+               t = m->offset + strlen(p->s);
+               break;
 
        default:
                error("invalid m->type (%d) in mprint().\n", m->type);
@@ -544,6 +549,8 @@ mconvert(p, m)
                if (m->mask_op & OPINVERSE)
                        p->l = ~p->l;
                return 1;
+       case REGEX:
+               return 1;
        default:
                error("invalid type %d in mconvert().\n", m->type);
                return 0;
@@ -572,7 +579,18 @@ mget(p, s, m, nbytes)
 {
        int32 offset = m->offset;
 
-       if (offset + sizeof(union VALUETYPE) <= nbytes)
+       if (m->type == REGEX) {
+             /*
+              * offset is interpreted as last line to search,
+              * (starting at 1), not as bytes-from start-of-file
+              */
+             char *last = NULL;
+             p->buf = s;
+             for (; offset && (s = strchr(s, '\n')) != NULL; offset--, s++)
+                   last = s;
+             if (last != NULL)
+               *last = '\0';
+       } else if (offset + sizeof(union VALUETYPE) <= nbytes)
                memcpy(p, s + offset, sizeof(union VALUETYPE));
        else {
                /*
@@ -585,14 +603,12 @@ mget(p, s, m, nbytes)
                        memcpy(p, s + offset, have);
        }
 
-
        if (debug) {
                mdebug(offset, (char *) p, sizeof(union VALUETYPE));
                mdump(m);
        }
 
        if (m->flag & INDIR) {
-
                switch (m->in_type) {
                case BYTE:
                        if (m->in_offset)
@@ -971,7 +987,7 @@ mcheck(p, m)
 
        case STRING:
        case PSTRING:
-               {
+       {
                /*
                 * What we want here is:
                 * v = strncmp(m->value.s, p->s, m->vallen);
@@ -1016,6 +1032,21 @@ mcheck(p, m)
                }
                break;
        }
+       case REGEX:
+       {
+               int rc;
+               regex_t rx;
+               char errmsg[512];
+
+               rc = regcomp(&rx, m->value.s, REG_EXTENDED|REG_NOSUB);
+               if (rc) {
+                       regerror(rc, &rx, errmsg, sizeof(errmsg));
+                       error("regex error %d, (%s)\n", rc, errmsg);
+               } else {
+                       rc = regexec(&rx, p->buf, 0, 0, 0);
+                       return !rc;
+               }
+       }
        default:
                error("invalid type %d in mcheck().\n", m->type);
                return 0;/*NOTREACHED*/