Browse Source

Import upstream version 4.20

Christos Zoulas 13 years ago
parent
commit
6a25f8b348

+ 84 - 0
ChangeLog

@@ -1,3 +1,87 @@
+
+2007-02-08 17:30 Christos Zoulas <christos@zoulas.com>
+
+	* fix integer underflow in file_printf which can lead to
+	  to exploitable heap overflow (Jean-Sebastien Guay-Lero)
+
+2007-02-05 11:35 Christos Zoulas <christos@zoulas.com>
+
+	* make socket/pipe reading more robust
+
+2007-01-25 16:01 Christos Zoulas <christos@zoulas.com>
+
+	* Centralize all the tests in file_buffer.
+
+	* Add exclude flag.
+
+2007-01-18 05:29 Anon Ymous <do@not.spam.me>
+	
+	* Move the "type" detection code from parse() into its own table
+	  driven routine.  This avoids maintaining multiple lists in
+	  file.h.
+
+	* Add an optional conditional field (ust before the type field).
+	  This code is wrapped in "#ifdef ENABLE_CONDITIONALS" as it is
+	  likely to go away.
+	
+2007-01-16 23:24 Anon Ymous <do@not.spam.me>
+
+	* Fix an initialization bug in check_mem().
+
+2007-01-16 14:58 Anon Ymous <do@not.spam.me>
+
+	* Add a "default" type to print a message if nothing previously
+	  matched at that level or since the last default at that
+	  level.  This is useful for setting up switch-like statements.
+	  It can also be used to do if/else constructions without a
+	  redundant second test.
+
+	* Fix the "x" special case test so that one can test for that
+	  string with "=x".
+
+	* Allow "search" to search the entire buffer if the "/N"
+	  search count is missing.
+
+	* Make "regex" work!  It now starts its search at the
+	  specified offset and takes an (optional) "/N" line count to
+	  specify the search range; otherwise it searches to the end
+	  of the file.  The match is now grabbed correctly for format
+	  strings and the offset set to the end of the match.
+
+	* Add a "/s" flag to "regex" and "search" to set the offset to
+	  the start of the match.  By default the offset is set to the
+	  end of the match, as it is with other tests.  This is mostly
+	  useful for "regex".
+
+	* Make "search", "string" and "pstring" use the same
+	  file_strncmp() routine so that they support the same flags;
+	  "bestring16" and "lestring16" call the same routine, but
+	  with flags = 0.  Also add a "/C" flag (in analogy to "/c")
+	  to ignore the case on uppercase (lowercase) characters in
+	  the test string.
+
+	* Strict adherence to C style string escapes.  A warnings are
+	  printed when compiling.  Note: previously "\a" was
+	  incorrectly translated to 'a' instead of an <alert> (i.e.,
+	  BELL, typically 0x07).
+
+	* Make this compile with "-Wall -Wextra" and all the warning
+	  flags used with WARNS=4 in the NetBSD source.  Also make it
+	  pass lint.
+
+	* Many "cleanups" and hopefully not too many new bugs!
+
+2007-01-16 14:56 Anon Ymous <do@not.spam.me>
+
+	* make several more files compile with gcc warnings
+	  on and also make them pass lint.
+
+2007-01-16 14:54 Anon Ymous <do@not.spam.me>
+
+	* fix a puts()/putc() usage goof in file.c
+
+	* make file.c compile with gcc warnings and pass lint
+
 2006-12-11 16:49 Christos Zoulas <christos@zoulas.com>
 
 	* fix byteswapping issue

+ 1 - 1
LEGAL.NOTICE

@@ -1,4 +1,4 @@
-$Id: LEGAL.NOTICE,v 1.15 2006/05/03 18:48:33 christos Exp $
+$File: LEGAL.NOTICE,v 1.15 2006/05/03 18:48:33 christos Exp $
 Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
 Software written by Ian F. Darwin and others;
 maintained 1994- Christos Zoulas.

+ 1 - 11
MAINT

@@ -1,20 +1,10 @@
-$Id: MAINT,v 1.7 2006/06/01 18:19:41 ian Exp $
+$File: MAINT,v 1.9 2007/01/19 21:15:27 christos Exp $
 
 Maintenance notes:
 
 I am continuing to maintain the file command. I welcome your help,
 but to make my life easier I'd like to request the following:
 
-- Don't change the version numbers!
-
-If your changes are extensive, I will have to work hard to 
-integrate them into my version.  If you check it into SCCS locally,
-the version numbers will likely be kept. IF you check it into RCS
-or CVS locally, please use -k to keep the version numbers, and
-please use branch deltas (1.21.1, 1.21.2, ...).  If you don't do
-this, I will likely be unable to use your changes; life's just too
-short.
-
 - Do not distribute changed versions.
 
 People trying to be helpful occasionally put up their hacked versions

+ 1 - 1
Makefile.in

@@ -38,7 +38,7 @@ host_triplet = @host@
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(top_srcdir)/configure ChangeLog config.guess config.sub \
-	depcomp install-sh ltcf-c.sh ltmain.sh missing mkinstalldirs
+	depcomp install-sh ltmain.sh missing mkinstalldirs
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \

+ 1 - 1
README

@@ -1,5 +1,5 @@
 ** README for file(1) Command **
-@(#) $Id: README,v 1.34 2006/05/03 18:48:33 christos Exp $
+@(#) $File: README,v 1.34 2006/05/03 18:48:33 christos Exp $
 
 This is Release 4.x of Ian Darwin's (copyright but distributable)
 file(1) command. This version is the standard "file" command for Linux,

+ 6 - 0
config.h.in

@@ -66,6 +66,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strndup' function. */
+#undef HAVE_STRNDUP
+
 /* Define to 1 if you have the `strtoul' function. */
 #undef HAVE_STRTOUL
 
@@ -82,6 +85,9 @@
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 

+ 5 - 3
configure

@@ -1808,7 +1808,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=file
- VERSION=4.19
+ VERSION=4.20
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20823,7 +20823,8 @@ done
 
 
 
-for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h
+
+for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -22612,7 +22613,8 @@ _ACEOF
 
 
 
-for ac_func in mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf
+
+for ac_func in mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5

+ 3 - 3
configure.in

@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT
 AC_CONFIG_SRCDIR([src/file.c])
-AM_INIT_AUTOMAKE(file, 4.19)
+AM_INIT_AUTOMAKE(file, 4.20)
 AM_CONFIG_HEADER([config.h])
 AM_MAINTAINER_MODE
 
@@ -81,7 +81,7 @@ AC_HEADER_SYS_WAIT
 AC_HEADER_STDINT
 AC_CHECK_HEADERS(fcntl.h locale.h stdint.h inttypes.h unistd.h getopt.h)
 AC_CHECK_HEADERS(utime.h wchar.h wctype.h)
-AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h)
+AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -119,7 +119,7 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
 
 dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf)
+AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf)
 
 dnl Checks for libraries
 AC_CHECK_LIB(z,gzopen)

+ 315 - 255
doc/file.man

@@ -1,78 +1,73 @@
-.TH FILE __CSECTION__ "Copyright but distributable"
-.\" $Id: file.man,v 1.59 2006/11/17 16:11:10 christos Exp $
-.SH NAME
-file
-\- determine file type
-.SH SYNOPSIS
-.B file
-[
-.B \-bchikLnNprsvz
-]
-[
-.B \-f
-.I namefile
-]
-[
-.B \-F
-.I separator
-]
-[
-.B \-m 
-.I magicfiles
-]
-.I file
-\&...
-.br
-.B file
-.B -C
-[
-.B \-m 
-magicfile ]
-.SH DESCRIPTION
+.\" $File: file.man,v 1.65 2007/01/25 21:05:46 christos Exp $
+.Dd January 8, 2007
+.Dt FILE __CSECTION__
+.Os
+.Sh NAME
+.Nm file
+.Nd determine file type
+.Sh SYNOPSIS
+.Nm
+.Op Fl bchikLnNprsvz
+.Op Fl f Ar namefile
+.Op Fl F Ar separator
+.Op Fl m Ar magicfiles
+.Ar file
+.Nm
+.Fl C
+.Op Fl m Ar magicfile
+.Sh DESCRIPTION
 This manual page documents version __VERSION__ of the
-.B file
+.Nm
 command.
-.PP
-.B File
+.Pp
+.Nm
 tests each argument in an attempt to classify it.
 There are three sets of tests, performed in this order:
 filesystem tests, magic number tests, and language tests.
 The
-.I first
+.Em first
 test that succeeds causes the file type to be printed.
-.PP
+.Pp
 The type printed will usually contain one of the words
-.B text
+.Em text
 (the file contains only
 printing characters and a few common control
 characters and is probably safe to read on an
-.SM ASCII
+.Dv ASCII
 terminal),
-.B executable
+.Em executable
 (the file contains the result of compiling a program
-in a form understandable to some \s-1UNIX\s0 kernel or another),
+in a form understandable to some 
+.Dv UNIX
+kernel or another),
 or
-.B data
-meaning anything else (data is usually `binary' or non-printable).
+.Em data
+meaning anything else (data is usually 
+.Sq binary
+or non-printable).
 Exceptions are well-known file formats (core files, tar archives)
 that are known to contain binary data.
 When modifying the file
-.I __MAGIC__
-or the program itself, 
-.B "preserve these keywords" .
+.Pa __MAGIC__
+or the program itself, make sure to
+.Em "preserve these keywords" .
 People depend on knowing that all the readable files in a directory
-have the word ``text'' printed.
-Don't do as Berkeley did and change ``shell commands text''
-to ``shell script''.
+have the word 
+.Dq text
+printed.
+Don't do as Berkeley did and change 
+.Dq shell commands text
+to 
+.Dq shell script .
 Note that the file
-.I __MAGIC__
+.Pa __MAGIC__
 is built mechanically from a large number of small files in
 the subdirectory
-.I Magdir
+.Pa Magdir
 in the source distribution of this program.
-.PP
+.Pp
 The filesystem tests are based on examining the return from a
-.BR stat (2)
+.Xr stat 2
 system call.
 The program checks to see if the file is empty,
 or if it's some sort of special file.
@@ -81,36 +76,42 @@ Any known file types appropriate to the system you are running on
 implement them)
 are intuited if they are defined in
 the system header file
-.IR <sys/stat.h>  .
-.PP
+.In sys/stat.h .
+.Pp
 The magic number tests are used to check for files with data in
 particular fixed formats.
 The canonical example of this is a binary executable (compiled program)
-.I a.out
+.Dv a.out
 file, whose format is defined in 
-.I a.out.h
+.In elf.h ,
+.In a.out.h
 and possibly
-.I exec.h
+.In exec.h
 in the standard include directory.
-These files have a `magic number' stored in a particular place
-near the beginning of the file that tells the \s-1UNIX\s0 operating system
+These files have a 
+.Sq "magic number"
+stored in a particular place
+near the beginning of the file that tells the 
+.Dv UNIX operating system
 that the file is a binary executable, and which of several types thereof.
-The concept of `magic number' has been applied by extension to data files.
+The concept of a
+.Sq "magic number"
+has been applied by extension to data files.
 Any file with some invariant identifier at a small fixed
 offset into the file can usually be described in this way.
 The information identifying these files is read from the compiled
 magic file
-.I __MAGIC__.mgc ,
+.Pa __MAGIC__.mgc ,
 or 
-.I __MAGIC__
+.Pa __MAGIC__
 if the compile file does not exist. In addition
-.B file
+.Nm
 will look in
-.I $HOME/.magic.mgc ,
+.Pa $HOME/.magic.mgc ,
 or
-.I $HOME/.magic
+.Pa $HOME/.magic
 for magic entries.
-.PP
+.Pp
 If a file does not match any of the entries in the magic file,
 it is examined to see if it seems to be a text file.
 ASCII, ISO-8859-x, non-ISO 8-bit extended-ASCII character sets
@@ -121,208 +122,241 @@ ranges and sequences of bytes that constitute printable text
 in each set.
 If a file passes any of these tests, its character set is reported.
 ASCII, ISO-8859-x, UTF-8, and extended-ASCII files are identified
-as ``text'' because they will be mostly readable on nearly any terminal;
-UTF-16 and EBCDIC are only ``character data'' because, while
+as 
+.Dq text
+because they will be mostly readable on nearly any terminal;
+UTF-16 and EBCDIC are only 
+.Dq character data
+because, while
 they contain text, it is text that will require translation
 before it can be read.
 In addition,
-.B file
+.Nm
 will attempt to determine other characteristics of text-type files.
 If the lines of a file are terminated by CR, CRLF, or NEL, instead
 of the Unix-standard LF, this will be reported.
 Files that contain embedded escape sequences or overstriking
 will also be identified.
-.PP
+.Pp
 Once
-.B file
+.Nm
 has determined the character set used in a text-type file,
 it will
 attempt to determine in what language the file is written.
 The language tests look for particular strings (cf
-.IR names.h )
+.In names.h
 that can appear anywhere in the first few blocks of a file.
 For example, the keyword
-.B .br
+.Em .br
 indicates that the file is most likely a
-.BR troff (1)
+.Xr troff 1
 input file, just as the keyword 
-.B struct
+.Em struct
 indicates a C program.
 These tests are less reliable than the previous
 two groups, so they are performed last.
 The language test routines also test for some miscellany
 (such as 
-.BR tar (1)
+.Xr tar 1
 archives).
-.PP
+.Pp
 Any file that cannot be identified as having been written
 in any of the character sets listed above is simply said to be ``data''.
-.SH OPTIONS
-.TP 8
-.B "\-b, \-\-brief"
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl b , -brief
 Do not prepend filenames to output lines (brief mode).
-.TP 8
-.B "\-c, \-\-checking\-printout"
+.It Fl c , -checking-printout
 Cause a checking printout of the parsed form of the magic file.
-This is usually used in conjunction with 
-.B \-m
-to debug a new magic file before installing it.
-.TP 8
-.B "\-C, \-\-compile"
-Write a magic.mgc output file that contains a pre-parsed version of
-file.
-.TP 8
-.BI "\-f, \-\-files\-from" " namefile"
+This is usually used in conjunction with the
+.Fl m
+flag to debug a new magic file before installing it.
+.It Fl C , -compile
+Write a
+.Pa magic.mgc
+output file that contains a pre-parsed version of the magic file.
+.It Fl e , -exclude Ar testname
+Exclude the test named in
+.Ar testname
+from the list of tests made to determine the file type. Valid test names
+are:
+.Bl -tag -width
+.It apptype
+Check for
+.Dv EMX
+application type (only on EMX).
+.It ascii
+Check for various types of ascii files.
+.It compress
+Don't look for, or inside compressed files.
+.It elf
+Don't print elf details.
+.It fortran
+Don't look for fortran sequences inside ascii files.
+.It soft
+Don't consult magic files.
+.It tar
+Don't examine tar files.
+.It token
+Don't look for known tokens inside ascii files.
+.It troff
+Don't look for troff sequences inside ascii files.
+.El
+.It Fl f , -files-from Ar namefile
 Read the names of the files to be examined from 
-.I namefile
+.Ar namefile
 (one per line) 
 before the argument list.
 Either 
-.I namefile
+.Ar namefile
 or at least one filename argument must be present;
-to test the standard input, use ``\-'' as a filename argument.
-.TP 8
-.BI "\-F, \-\-separator" " separator"
+to test the standard input, use 
+.Sq -
+as a filename argument.
+.It Fl F , -separator Ar separator
 Use the specified string as the separator between the filename and the
-file result returned. Defaults to ``:''.
-.TP 8
-.B "\-h, \-\-no-dereference"
+file result returned. Defaults to 
+.Sq \&: .
+.It Fl h , -no-dereference
 option causes symlinks not to be followed
 (on systems that support symbolic links). This is the default if the
 environment variable
-.I POSIXLY_CORRECT
+.Dv POSIXLY_CORRECT
 is not defined.
-.TP 8
-.B "\-i, \-\-mime"
+.It Fl i , -mime
 Causes the file command to output mime type strings rather than the more
 traditional human readable ones. Thus it may say
-``text/plain; charset=us-ascii''
+.Dq text/plain; charset=us-ascii
 rather
-than ``ASCII text''.
+than
+.Dq ASCII text .
 In order for this option to work, file changes the way
 it handles files recognized by the command itself (such as many of the
 text file types, directories etc), and makes use of an alternative
-``magic'' file.
-(See ``FILES'' section, below).
-.TP 8
-.B "\-k, \-\-keep\-going"
+.Dq magic
+file.
+(See
+.Dq FILES
+section, below).
+.It Fl k , -keep-going
 Don't stop at the first match, keep going.
-.TP 8
-.B "\-L, \-\-dereference"
+.It Fl L , -dereference
 option causes symlinks to be followed, as the like-named option in
-.BR ls (1)
+.Xr ls 1
 (on systems that support symbolic links).
 This is the default if the environment variable
-.I POSIXLY_CORRECT
+.Dv POSIXLY_CORRECT
 is defined.
-.TP 8
-.BI "\-m, \-\-magic\-file" " list"
+.It Fl m , -magic-file Ar list
 Specify an alternate list of files containing magic numbers.
 This can be a single file, or a colon-separated list of files.
 If a compiled magic file is found alongside, it will be used instead.
-With the \-i or \-\-mime option, the program adds ".mime" to each file name.
-.TP 8
-.B "\-n, \-\-no\-buffer"
+With the 
+.Fl i or 
+.Fl "mime"
+option, the program adds
+.Dq .mime
+to each file name.
+.It Fl n , -no-buffer
 Force stdout to be flushed after checking each file.
 This is only useful if checking a list of files.
 It is intended to be used by programs that want filetype output from a pipe.
-.TP 8
-.B "\-N, \-\-no\-pad"
+.It Fl N , -no-pad
 Don't pad filenames so that they align in the output.
-.TP 8
-.B "\-p, \-\-preserve\-date"
+.It Fl p , -preserve-date
 On systems that support
-.BR utime (2)
+.Xr utime 2
 or
-.BR utimes(2),
+.Xr utimes 2 ,
 attempt to preserve the access time of files analyzed, to pretend that
-.BR file (2)
+.Nm
 never read them.
-.TP 8
-.B "\-r, \-\-raw"
+.It Fl r , -raw
 Don't translate unprintable characters to \eooo.
 Normally
-.B file
+.Nm
 translates unprintable characters to their octal representation.
-.TP 8
-.B "\-s, \-\-special\-files"
+.It Fl s , -special-files
 Normally,
-.B file
+.Nm
 only attempts to read and determine the type of argument files which
-.BR stat (2)
+.Xr stat 2
 reports are ordinary files.
 This prevents problems, because reading special files may have peculiar
 consequences.
 Specifying the
-.BR \-s
+.Fl s
 option causes
-.B file
+.Nm
 to also read argument files which are block or character special files.
 This is useful for determining the filesystem types of the data in raw
 disk partitions, which are block special files.
 This option also causes
-.B file
+.Nm
 to disregard the file size as reported by
-.BR stat (2)
+.Xr stat 2
 since on some systems it reports a zero size for raw disk partitions.
-.TP 8
-.B "\-v, \-\-version"
+.It Fl v , -version
 Print the version of the program and exit.
-.TP 8
-.B "\-z, \-\-uncompress"
+.It Fl z , -uncompress
 Try to look inside compressed files.
-.B "\-0, \-\-print0"
-Output a null character ('\0') after the end of the filename. Nice to
-.BR cut (1)
+.It Fl 0 , -print0
+Output a null character
+.Sq \e0
+after the end of the filename. Nice to
+.Xr cut 1
 the output. This does not affect the separator which is still printed.
-.TP 8
-.B "\-\-help"
+.It Fl -help
 Print a help message and exit.
-.SH FILES
-.TP
-.I __MAGIC__.mgc
+.El
+.Sh FILES
+.Bl -tag -width __MAGIC__.mime.mgc -compact
+.It Pa __MAGIC__.mgc
 Default compiled list of magic numbers
-.TP
-.I __MAGIC__
+.It Pa __MAGIC__
 Default list of magic numbers
-.TP
-.I __MAGIC__.mime.mgc
+.It Pa __MAGIC__.mime.mgc
 Default compiled list of magic numbers, used to output mime types when
-the -i option is specified.
-.TP
-.I __MAGIC__.mime
-Default list of magic numbers, used to output mime types when the -i option
-is specified.
-
-.SH ENVIRONMENT
+the 
+.Fl i
+option is specified.
+.It Pa __MAGIC__.mime
+Default list of magic numbers, used to output mime types when the 
+.Fl i
+option is specified.
+.El
+.Sh ENVIRONMENT
 The environment variable
-.B MAGIC
+.Dv MAGIC
 can be used to set the default magic number file name.
 If that variable is set, then
-.B file
+.Nm
 will not attempt to open
-.B $HOME/.magic .
-.B file
-adds ".mime" and/or ".mgc" to the value of this variable as appropriate.
+.Pa $HOME/.magic .
+.Nm
+adds
+.Dq .mime
+and/or
+.Dq .mgc
+to the value of this variable as appropriate.
 The environment variable
-.B POSIXLY_CORRECT
+.Dv POSIXLY_CORRECT
 controls (on systems that support symbolic links), if
-.B file
+.Nm
 will attempt to follow symlinks or not. If set, then
-.B file
+.Nm
 follows symlink, otherwise it does not. This is also controlled
 by the
-.B L
+.Fl L
 and
-.B h
+.Fl h
 options.
-.SH SEE ALSO
-.BR magic (__FSECTION__)
-\- description of magic file format.
-.br
-.BR strings (1), " od" (1), " hexdump(1)"
-\- tools for examining non-textfiles.
-.SH STANDARDS CONFORMANCE
+.Sh SEE ALSO
+.Xr magic __FSECTION__ ,
+.Xr strings 1 ,
+.Xr od 1 ,
+.Xr hexdump 1
+.Sh STANDARDS CONFORMANCE
 This program is believed to exceed the System V Interface Definition
 of FILE(CMD), as near as one can determine from the vague language
 contained therein. 
@@ -330,66 +364,74 @@ Its behavior is mostly compatible with the System V program of the same name.
 This version knows more magic, however, so it will produce
 different (albeit more accurate) output in many cases. 
 .\" URL: http://www.opengroup.org/onlinepubs/009695399/utilities/file.html
-.PP
+.Pp
 The one significant difference 
 between this version and System V
 is that this version treats any white space
 as a delimiter, so that spaces in pattern strings must be escaped.
 For example,
-.br
+.Bd -literal -offset indent 
 >10	string	language impress\ 	(imPRESS data)
-.br
+.Ed
+.Pp
 in an existing magic file would have to be changed to
-.br
+.Bd -literal -offset indent 
 >10	string	language\e impress	(imPRESS data)
-.br
+.Ed
+.Pp
 In addition, in this version, if a pattern string contains a backslash,
 it must be escaped.
 For example
-.br
+.Bd -literal -offset indent 
 0	string		\ebegindata	Andrew Toolkit document
-.br
+.Ed
+.Pp
 in an existing magic file would have to be changed to
-.br
+.Bd -literal -offset indent 
 0	string		\e\ebegindata	Andrew Toolkit document
-.br
-.PP
+.Ed
+.Pp
 SunOS releases 3.2 and later from Sun Microsystems include a
-.BR file (1)
+.Nm 
 command derived from the System V one, but with some extensions.
 My version differs from Sun's only in minor ways.
-It includes the extension of the `&' operator, used as,
+It includes the extension of the 
+.Sq &
+operator, used as,
 for example,
-.br
+.Bd -literal -offset indent 
 >16	long&0x7fffffff	>0		not stripped
-.SH MAGIC DIRECTORY
+.Ed
+.Sh MAGIC DIRECTORY
 The magic file entries have been collected from various sources,
 mainly USENET, and contributed by various authors.
 Christos Zoulas (address below) will collect additional
 or corrected magic file entries.
 A consolidation of magic file entries 
 will be distributed periodically.
-.PP
+.Pp
 The order of entries in the magic file is significant.
 Depending on what system you are using, the order that
 they are put together may be incorrect.
 If your old
-.B file
+.Nm
 command uses a magic file,
 keep the old magic file around for comparison purposes
 (rename it to 
-.IR __MAGIC__.orig ).
-.SH EXAMPLES
-.nf
+.Pa __MAGIC__.orig ).
+.Sh EXAMPLES
+.Bd -literal -offset indent 
 $ file file.c file /dev/{wd0a,hda}
 file.c:   C program text
 file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
           dynamically linked (uses shared libs), stripped
 /dev/wd0a: block special (0/0)
 /dev/hda: block special (3/0)
+
 $ file -s /dev/wd0{b,d}
 /dev/wd0b: data
 /dev/wd0d: x86 boot sector
+
 $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 /dev/hda:   x86 boot sector
 /dev/hda1:  Linux/i386 ext2 filesystem
@@ -406,129 +448,147 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
 $ file -i file.c file /dev/{wd0a,hda}
 file.c:      text/x-c
 file:        application/x-executable, dynamically linked (uses shared libs),
-not stripped
+	     not stripped
 /dev/hda:    application/x-not-regular-file
 /dev/wd0a:   application/x-not-regular-file
 
-.fi
-.SH HISTORY
+.Ed
+.Sh HISTORY
 There has been a 
-.B file
-command in every \s-1UNIX\s0 since at least Research Version 4
+.Nm 
+command in every 
+.Dv UNIX 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.
-.PP
+.Pp
 This program, based on the System V version,
 was written by Ian Darwin <ian@darwinsys.com>
 without looking at anybody else's source code.
-.PP
+.Pp
 John Gilmore revised the code extensively, making it better than
 the first version.
 Geoff Collyer found several inadequacies
 and provided some magic file entries.
 Contributions by the `&' operator by Rob McMahon, cudcv@warwick.ac.uk, 1989.
-.PP
+.Pp
 Guy Harris, guy@netapp.com, made many changes from 1993 to the present.
-.PP
+.Pp
 Primary development and maintenance from 1990 to the present by
 Christos Zoulas (christos@astron.com).
-.PP
+.Pp
 Altered by Chris Lowth, chris@lowth.com, 2000:
-Handle the ``-i'' option to output mime type strings and using an alternative
+Handle the 
+.Fl i
+option to output mime type strings and using an alternative
 magic file and internal logic.
-.PP
+.Pp
 Altered by Eric Fischer (enf@pobox.com), July, 2000,
 to identify character codes and attempt to identify the languages
 of non-ASCII files.
-.PP
+.Pp
 The list of contributors to the "Magdir" directory (source for the
-.I __MAGIC__
+.Pa __MAGIC__
 file) is too long to include here.
 You know who you are; thank you.
-.SH LEGAL NOTICE
+.Sh LEGAL NOTICE
 Copyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.
 Covered by the standard Berkeley Software Distribution copyright; see the file
 LEGAL.NOTICE in the source distribution.
-.PP
+.Pp
 The files
-.I tar.h
+.Dv tar.h
 and
-.I is_tar.c
+.Dv is_tar.c
 were written by John Gilmore from his public-domain
-.B tar
+.Xr tar 1
 program, and are not covered by the above license.
-.SH BUGS
+.Sh BUGS
 There must be a better way to automate the construction of the Magic
 file from all the glop in Magdir.
 What is it?
-Better yet, the magic file should be compiled into binary (say,
-.BR ndbm (3)
-or, better yet, fixed-length
-.SM ASCII
-strings for use in heterogenous network environments) for faster startup.
-Then the program would run as fast as the Version 7 program of the same name,
-with the flexibility of the System V version.
-.PP
-.B File
+.\" Compilation support has been done
+.\" Better yet, the magic file should be compiled into binary (say,
+.\" .Xr ndbm 3
+.\" or, better yet, fixed-length
+.\" .Dv ASCII
+.\" strings for use in heterogenous network environments) for faster startup.
+.\" Then the program would run as fast as the Version 7 program of the same
+.\" name, with the flexibility of the System V version.
+.Pp
+.Nm
 uses several algorithms that favor speed over accuracy,
 thus it can be misled about the contents of
 text
 files.
-.PP
-The support for
-text
-files (primarily for programming languages)
+.Pp
+The support for text files (primarily for programming languages)
 is simplistic, inefficient and requires recompilation to update.
-.PP
-There should be an ``else'' clause to follow a series of continuation lines.
-.PP
-The magic file and keywords should have regular expression support.
+.\" Else support has been done
+.\" There should be an
+.\" .Dv else
+.\" clause to follow a series of continuation lines.
+.\" .Pp
+.\" Regular expression support has been done
+.\" The magic file and keywords should have regular expression support.
 Their use of
-.SM "ASCII TAB"
+.Dv ASCII TAB
 as a field delimiter is ugly and makes
 it hard to edit the files, but is entrenched.
-.PP
+.Pp
 It might be advisable to allow upper-case letters in keywords
 for e.g.,
-.BR troff (1)
+.Xr troff 1
 commands vs man page macros.
 Regular expression support would make this easy.
-.PP
-The program doesn't grok \s-2FORTRAN\s0.
-It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which 
+.Pp
+The program doesn't grok 
+.Dv FORTRAN .
+It should be able to figure
+.Dv FORTRAN
+by seeing some keywords which 
 appear indented at the start of line.
 Regular expression support would make this easy.
-.PP
+.Pp
 The list of keywords in 
-.I ascmagic
+.Dv ascmagic
 probably belongs in the Magic file.
-This could be done by using some keyword like `*' for the offset value.
-.PP
-Another optimization would be to sort
-the magic file so that we can just run down all the
-tests for the first byte, first word, first long, etc, once we
-have fetched it.
+This could be done by using some keyword like 
+.Sq *
+for the offset value.
+.Pp
+.\" Sorting has been done.
+.\" Another optimization would be to sort
+.\" the magic file so that we can just run down all the
+.\" tests for the first byte, first word, first long, etc, once we
+.\" have fetched it.
 Complain about conflicts in the magic file entries.
 Make a rule that the magic entries sort based on file offset rather
 than position within the magic file?
-.PP
+.Pp
 The program should provide a way to give an estimate 
-of ``how good'' a guess is.
-We end up removing guesses (e.g. ``From '' as first 5 chars of file) because
-they are not as good as other guesses (e.g. ``Newsgroups:'' versus
-``Return-Path:'').
+of 
+.Dq how good
+a guess is.
+We end up removing guesses (e.g. 
+.Dq From\ 
+as first 5 chars of file) because
+they are not as good as other guesses (e.g. 
+.Dq Newsgroups:
+versus
+.Dq Return-Path:
+).
 Still, if the others don't pan out, it should be possible to use the
 first guess.  
-.PP
+.Pp
 This program is slower than some vendors' file commands.
 The new support for multiple character codes makes it even slower.
-.PP
+.Pp
 This manual page, and particularly this section, is too long.
-.SH AVAILABILITY
+.Sh AVAILABILITY
 You can obtain the original author's latest version by anonymous FTP
 on
-.B ftp.astron.com
+.Dv ftp.astron.com
 in the directory
-.I /pub/file/file-X.YZ.tar.gz
+.Dv /pub/file/file-X.YZ.tar.gz

+ 20 - 0
doc/libmagic.man

@@ -104,6 +104,26 @@ Don't translate unprintable characters to a \eooo octal representation.
 .It Dv MAGIC_ERROR
 Treat operating system errors while trying to open files and follow symlinks
 as real errors, instead of printing them in the magic buffer.
+.It Dv MAGIC_NO_CHECK_APPTYPE
+Check for
+.Dv EMX
+application type (only on EMX).
+.It Dv MAGIC_NO_CHECK_ASCII
+Check for various types of ascii files.
+.It Dv MAGIC_NO_CHECK_COMPRESS
+Don't look for, or inside compressed files.
+.It Dv MAGIC_NO_CHECK_ELF
+Don't print elf details.
+.It Dv MAGIC_NO_CHECK_FORTRAN
+Don't look for fortran sequences inside ascii files.
+.It Dv MAGIC_NO_CHECK_SOFT
+Don't consult magic files.
+.It Dv MAGIC_NO_CHECK_TAR
+Don't examine tar files.
+.It Dv MAGIC_NO_CHECK_TOKENS
+Don't look for known tokens inside ascii files.
+.It Dv MAGIC_NO_CHECK_TROFF
+Don't look for troff sequences inside ascii files.
 .El
 .Pp
 The

+ 231 - 207
doc/magic.man

@@ -1,413 +1,437 @@
-.TH MAGIC __FSECTION__ "Public Domain"
+.\" $File: magic.man,v 1.36 2007/01/10 22:56:49 christos Exp $
+.Dd January 10, 2007
+.Dt MAGIC __FSECTION__
+.Os
 .\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
-.SH NAME
-magic \- file command's magic number file
-.SH DESCRIPTION
+.Sh NAME
+.Nm magic
+.Nd file command's magic number file
+.Sh DESCRIPTION
 This manual page documents the format of the magic file as
 used by the
-.BR file (__CSECTION__)
+.Xr file __CSECTION__
 command, version __VERSION__.
 The
-.BR file
+.Xr file __CSECTION__
 command identifies the type of a file using,
 among other tests,
 a test for whether the file begins with a certain
-.IR "magic number" .
+.Dq "magic number" .
 The file
-.I __MAGIC__
+.Pa __MAGIC__
 specifies what magic numbers are to be tested for,
 what message to print if a particular magic number is found,
 and additional information to extract from the file.
-.PP
+.Pp
 Each line of the file specifies a test to be performed.
 A test compares the data starting at a particular offset
 in the file with a 1-byte, 2-byte, or 4-byte numeric value or
 a string.
 If the test succeeds, a message is printed.
 The line consists of the following fields:
-.IP offset \w'message'u+2n
+.Bl -tag -width ".Dv message"
+.It Dv offset
 A number specifying the offset, in bytes, into the file of the data
 which is to be tested.
-.IP type
+.It Dv type
 The type of the data to be tested.
 The possible values are:
-.RS
-.IP byte \w'message'u+2n
+.Bl -tag -width ".Dv lestring16"
+.It Dv byte
 A one-byte value.
-.IP short
+.It Dv short
 A two-byte value (on most systems) in this machine's native byte order.
-.IP long
+.It Dv long
 A four-byte value (on most systems) in this machine's native byte order.
-.IP quad
+.It Dv quad
 An eight-byte value (on most systems) in this machine's native byte order.
-.IP string
+.It Dv string
 A string of bytes.
 The string type specification can be optionally followed
 by /[Bbc]*.
-The ``B'' flag compacts whitespace in the target, which must
+The 
+.Dq B
+flag compacts whitespace in the target, which must
 contain at least one whitespace character.
 If the magic has
-.I n
+.Dv n
 consecutive blanks, the target needs at least
-.I n
+.Dv n
 consecutive blanks to match.
-The ``b'' flag treats every blank in the target as an optional blank.
-Finally the ``c'' flag, specifies case insensitive matching: lowercase
+The 
+.Dq b
+flag treats every blank in the target as an optional blank.
+Finally the
+.Dq c
+flag, specifies case insensitive matching: lowercase
 characters in the magic match both lower and upper case characters in the
 targer, whereas upper case characters in the magic, only much uppercase
 characters in the target.
-.IP pstring
+.It Dv pstring
 A pascal style string where the first byte is interpreted as the an
 unsigned length. The string is not NUL terminated.
-.IP date
+.It Dv date
 A four-byte value interpreted as a UNIX date.
-.IP qdate
+.It Dv qdate
 A eight-byte value interpreted as a UNIX date.
-.IP ldate
+.It Dv ldate
 A four-byte value interpreted as a UNIX-style date, but interpreted as
 local time rather than UTC.
-.IP qldate
+.It Dv qldate
 An eight-byte value interpreted as a UNIX-style date, but interpreted as
 local time rather than UTC.
-.IP beshort
+.It Dv beshort
 A two-byte value (on most systems) in big-endian byte order.
-.IP belong
+.It Dv belong
 A four-byte value (on most systems) in big-endian byte order.
-.IP bequad
+.It Dv bequad
 An eight-byte value (on most systems) in big-endian byte order.
-.IP bedate
+.It Dv bedate
 A four-byte value (on most systems) in big-endian byte order,
 interpreted as a Unix date.
-.IP beqdate
+.It Dv beqdate
 An eight-byte value (on most systems) in big-endian byte order,
 interpreted as a Unix date.
-.IP beldate
+.It Dv beldate
 A four-byte value (on most systems) in big-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
-.IP beqldate
+.It Dv beqldate
 An eight-byte value (on most systems) in big-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
-.IP bestring16
+.It Dv bestring16
 A two-byte unicode (UCS16) string in big-endian byte order.
-.IP leshort
+.It Dv leshort
 A two-byte value (on most systems) in little-endian byte order.
-.IP lelong
+.It Dv lelong
 A four-byte value (on most systems) in little-endian byte order.
-.IP lequad
+.It Dv lequad
 An eight-byte value (on most systems) in little-endian byte order.
-.IP ledate
+.It Dv ledate
 A four-byte value (on most systems) in little-endian byte order,
 interpreted as a UNIX date.
-.IP leqdate
+.It Dv leqdate
 An eight-byte value (on most systems) in little-endian byte order,
 interpreted as a UNIX date.
-.IP leldate
+.It Dv leldate
 A four-byte value (on most systems) in little-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
-.IP leqldate
+.It Dv leqldate
 An eight-byte value (on most systems) in little-endian byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
-.IP lestring16
+.It Dv lestring16
 A two-byte unicode (UCS16) string in little-endian byte order.
-.IP melong
+.It Dv melong
 A four-byte value (on most systems) in middle-endian (PDP-11) byte order.
-.IP medate
+.It Dv medate
 A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
 interpreted as a UNIX date.
-.IP meldate
+.It Dv meldate
 A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
 interpreted as a UNIX-style date, but interpreted as local time rather
 than UTC.
-.IP regex
+.It Dv regex
 A regular expression match in extended POSIX regular expression syntax
 (much like egrep).
-The type specification can be optionally followed by
-.B /c
-for case-insensitive matches.
-The regular expression is always
-tested against the first
-.B N
+The type specification can be optionally followed by /[cse]*.
+The 
+.Dq c
+flag makes the match case insensitive, while the
+.Dq s
+or
+.Dq e
+flags update the offset to the starting or ending offsets of the
+match (only one should be used).
+By default, regex does not update the offset.
+The regular expression is always tested against the first
+.Dv N
 lines, where
-.B N
+.Dv N
 is the given offset, thus it
 is only useful for (single-byte encoded) text.
-.B ^
+.Dv ^
 and
-.B $
+.Dv $
 will match the beginning and end of individual lines, respectively,
 not beginning and end of file.
-.IP search
+.It Dv search
 A literal string search starting at the given offset. It must be followed by
-.B /<number>
+.Dv /<number>
 which specifies how many matches shall be attempted (the range).
 This is suitable for searching larger binary expressions with variable
 offsets, using
-.B \e
+.Dv \e
 escapes for special characters.
-.RE
-.PP
+.It Dv default 
+This is intended to be used with the text
+.Dv x
+(which is always true) and a message that is to be used if there are
+no other matches.
+.El
+.El
+.Pp
 The numeric types may optionally be followed by
-.B &
+.Dv &
 and a numeric value,
 to specify that the value is to be AND'ed with the
 numeric value before any comparisons are done.
 Prepending a
-.B u
+.Dv u
 to the type indicates that ordered comparisons should be unsigned.
-.IP test
+.Bl -tag -width ".Dv message"
+.It Dv test
 The value to be compared with the value from the file.
 If the type is
 numeric, this value
 is specified in C form; if it is a string, it is specified as a C string
 with the usual escapes permitted (e.g. \en for new-line).
-.IP
+.Pp
 Numeric values
 may be preceded by a character indicating the operation to be performed.
 It may be
-.BR = ,
+.Dv = ,
 to specify that the value from the file must equal the specified value,
-.BR < ,
+.Dv < ,
 to specify that the value from the file must be less than the specified
 value,
-.BR > ,
+.Dv > ,
 to specify that the value from the file must be greater than the specified
 value,
-.BR & ,
+.Dv & ,
 to specify that the value from the file must have set all of the bits
 that are set in the specified value,
-.BR ^ ,
+.Dv ^ ,
 to specify that the value from the file must have clear any of the bits
 that are set in the specified value, or
-.BR ~ ,
+.Dv ~ ,
 the value specified after is negated before tested.
-.BR x ,
+.Dv x ,
 to specify that any value will match.
 If the character is omitted, it is assumed to be
-.BR = .
+.Dv = .
 For all tests except
-.B string
+.Em string
 and
-.B regex,
+.Em regex,
 operation
-.BR !
+.Dv !
 specifies that the line matches if the test does
-.B not
+.Em not
 succeed.
-.IP
+.Pp
 Numeric values are specified in C form; e.g.
-.B 13
+.Dv 13
 is decimal,
-.B 013
+.Dv 013
 is octal, and
-.B 0x13
+.Dv 0x13
 is hexadecimal.
-.IP
+.Pp
 For string values, the byte string from the
 file must match the specified byte string.
 The operators
-.BR = ,
-.B <
+.Dv = ,
+.Dv <
 and
-.B >
+.Dv >
 (but not
-.BR & )
+.Dv & )
 can be applied to strings.
 The length used for matching is that of the string argument
 in the magic file.
 This means that a line can match any string, and
 then presumably print that string, by doing
-.B >\e0
+.Em >\e0
 (because all strings are greater than the null string).
-.IP message
+.Pp
+The special test
+.Em x
+always evaluates to true.
+.Dv message
 The message to be printed if the comparison succeeds.  If the string
 contains a
-.BR printf (3)
+.Xr printf 3
 format specification, the value from the file (with any specified masking
 performed) is printed using the message as the format string.
-.PP
+If the string begins with ``\\b'', the message printed is the
+remainder of the string with no whitespace added before it: multiple
+matches are normally separated by a single space.
+.El
+.Pp
 Some file formats contain additional information which is to be printed
 along with the file type or need additional tests to determine the true
 file type.
 These additional tests are introduced by one or more
-.B >
+.Em >
 characters preceding the offset.
 The number of
-.B >
+.Em >
 on the line indicates the level of the test; a line with no
-.B >
+.Em >
 at the beginning is considered to be at level 0.
 Tests are arranged in a tree-like hierarchy:
 If a the test on a line at level
-.IB n
+.Em n
 succeeds, all following tests at level
-.IB n+1
+.Em n+1
 are performed, and the messages printed if the tests succeed, untile a line
 with level
-.IB n
+.Em n
 (or less) appears.
 For more complex files, one can use empty messages to get just the
 "if/then" effect, in the following way:
-.sp
-.nf
-    0      string   MZ
-    >0x18  leshort  <0x40   MS-DOS executable
-    >0x18  leshort  >0x3f   extended PC executable (e.g., MS Windows)
-.fi
-.PP
+.Bd -literal -offset indent 
+0      string   MZ
+>0x18  leshort  <0x40   MS-DOS executable
+>0x18  leshort  >0x3f   extended PC executable (e.g., MS Windows)
+.Ed
+.Pp
 Offsets do not need to be constant, but can also be read from the file
 being examined.
 If the first character following the last
-.B >
+.Em >
 is a
-.B (
+.Em (
 then the string after the parenthesis is interpreted as an indirect offset.
 That means that the number after the parenthesis is used as an offset in
 the file.
 The value at that offset is read, and is used again as an offset
 in the file.
 Indirect offsets are of the form:
-.BI (( x [.[bslBSL]][+\-][ y ]).
+.Em (( x [.[bslBSL]][+\-][ y ]).
 The value of
-.I x
+.Em x
 is used as an offset in the file. A byte, short or long is read at that offset
 depending on the
-.B [bslBSLm]
+.Em [bslBSLm]
 type specifier.
 The capitalized types interpret the number as a big endian
 value, whereas the small letter versions interpret the number as a little
 endian value;
 the
-.B m
+.Em m
 type interprets the number as a middle endian (PDP-11) value.
 To that number the value of
-.I y
+.Em y
 is added and the result is used as an offset in the file.
 The default type if one is not specified is long.
-.PP
+.Pp
 That way variable length structures can be examined:
-.sp
-.nf
-    # MS Windows executables are also valid MS-DOS executables
-    0           string  MZ
-    >0x18       leshort <0x40   MZ executable (MS-DOS)
-    # skip the whole block below if it is not an extended executable
-    >0x18       leshort >0x3f
-    >>(0x3c.l)  string  PE\e0\e0  PE executable (MS-Windows)
-    >>(0x3c.l)  string  LX\e0\e0  LX executable (OS/2)
-.fi
-.PP
+.Bd -literal -offset indent 
+# MS Windows executables are also valid MS-DOS executables
+0           string  MZ
+>0x18       leshort <0x40   MZ executable (MS-DOS)
+# skip the whole block below if it is not an extended executable
+>0x18       leshort >0x3f
+>>(0x3c.l)  string  PE\e0\e0  PE executable (MS-Windows)
+>>(0x3c.l)  string  LX\e0\e0  LX executable (OS/2)
+.Ed
+.Pp
 This strategy of examining has one drawback: You must make sure that
 you eventually print something, or users may get empty output (like, when
 there is neither PE\e0\e0 nor LE\e0\e0 in the above example)
-.PP
+.Pp
 If this indirect offset cannot be used as-is, there are simple calculations
 possible: appending
-.BI [+-*/%&|^]<number>
+.Em [+-*/%&|^]<number>
 inside parentheses allows one to modify
 the value read from the file before it is used as an offset:
-.sp
-.nf
-    # MS Windows executables are also valid MS-DOS executables
-    0           string  MZ
-    # sometimes, the value at 0x18 is less that 0x40 but there's still an
-    # extended executable, simply appended to the file
-    >0x18       leshort <0x40
-    >>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
-    >>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
-.fi
-.PP
+.Bd -literal -offset indent 
+# MS Windows executables are also valid MS-DOS executables
+0           string  MZ
+# sometimes, the value at 0x18 is less that 0x40 but there's still an
+# extended executable, simply appended to the file
+>0x18       leshort <0x40
+>>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
+>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
+.Ed
+.Pp
 Sometimes you do not know the exact offset as this depends on the length or
 position (when indirection was used before) of preceding fields. You can
 specify an offset relative to the end of the last up-level field using
-.BI &
+.Sq &
 as a prefix to the offset:
-.sp
-.nf
-    0           string  MZ
-    >0x18       leshort >0x3f
-    >>(0x3c.l)  string  PE\e0\e0    PE executable (MS-Windows)
-    # immediately following the PE signature is the CPU type
-    >>>&0       leshort 0x14c     for Intel 80386
-    >>>&0       leshort 0x184     for DEC Alpha
-.fi
-.PP
+.Bd -literal -offset indent 
+0           string  MZ
+>0x18       leshort >0x3f
+>>(0x3c.l)  string  PE\e0\e0    PE executable (MS-Windows)
+# immediately following the PE signature is the CPU type
+>>>&0       leshort 0x14c     for Intel 80386
+>>>&0       leshort 0x184     for DEC Alpha
+.Ed
+.Pp
 Indirect and relative offsets can be combined:
-.sp
-.nf
-    0             string  MZ
-    >0x18         leshort <0x40
-    >>(4.s*512)   leshort !0x014c MZ executable (MS-DOS)
-    # if it's not COFF, go back 512 bytes and add the offset taken
-    # from byte 2/3, which is yet another way of finding the start
-    # of the extended executable
-    >>>&(2.s-514) string  LE      LE executable (MS Windows VxD driver)
-.fi
-.PP
+.Bd -literal -offset indent 
+0             string  MZ
+>0x18         leshort <0x40
+>>(4.s*512)   leshort !0x014c MZ executable (MS-DOS)
+# if it's not COFF, go back 512 bytes and add the offset taken
+# from byte 2/3, which is yet another way of finding the start
+# of the extended executable
+>>>&(2.s-514) string  LE      LE executable (MS Windows VxD driver)
+.Ed
+.Pp
 Or the other way around:
-.sp
-.nf
-    0                 string  MZ
-    >0x18             leshort >0x3f
-    >>(0x3c.l)        string  LE\e0\e0  LE executable (MS-Windows)
-    # at offset 0x80 (-4, since relative offsets start at the end
-    # of the up-level match) inside the LE header, we find the absolute
-    # offset to the code area, where we look for a specific signature
-    >>>(&0x7c.l+0x26) string  UPX     \eb, UPX compressed
-.fi
-.PP
+.Bd -literal -offset indent 
+0                 string  MZ
+>0x18             leshort >0x3f
+>>(0x3c.l)        string  LE\e0\e0  LE executable (MS-Windows)
+# at offset 0x80 (-4, since relative offsets start at the end
+# of the up-level match) inside the LE header, we find the absolute
+# offset to the code area, where we look for a specific signature
+>>>(&0x7c.l+0x26) string  UPX     \eb, UPX compressed
+.Ed
+.Pp
 Or even both!
-.sp
-.nf
-    0                string  MZ
-    >0x18            leshort >0x3f
-    >>(0x3c.l)       string  LE\e0\e0 LE executable (MS-Windows)
-    # at offset 0x58 inside the LE header, we find the relative offset
-    # to a data area where we look for a specific signature
-    >>>&(&0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
-.fi
-.PP
+.Bd -literal -offset indent 
+0                string  MZ
+>0x18            leshort >0x3f
+>>(0x3c.l)       string  LE\e0\e0 LE executable (MS-Windows)
+# at offset 0x58 inside the LE header, we find the relative offset
+# to a data area where we look for a specific signature
+>>>&(&0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
+.Ed
+.Pp
 Finally, if you have to deal with offset/length pairs in your file, even the
 second value in a parenthesized expression can be taken from the file itself,
 using another set of parentheses. Note that this additional indirect offset
 is always relative to the start of the main indirect offset.
-.sp
-.nf
-    0                 string       MZ
-    >0x18             leshort      >0x3f
-    >>(0x3c.l)        string       PE\e0\e0 PE executable (MS-Windows)
-    # search for the PE section called ".idata"...
-    >>>&0xf4          search/0x140 .idata
-    # ...and go to the end of it, calculated from start+length;
-    # these are located 14 and 10 bytes after the section name
-    >>>>(&0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
-.fi
-.SH BUGS
+.Bd -literal -offset indent 
+0                 string       MZ
+>0x18             leshort      >0x3f
+>>(0x3c.l)        string       PE\e0\e0 PE executable (MS-Windows)
+# search for the PE section called ".idata"...
+>>>&0xf4          search/0x140 .idata
+# ...and go to the end of it, calculated from start+length;
+# these are located 14 and 10 bytes after the section name
+>>>>(&0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
+.Ed
+.Sh BUGS
 The formats
-.IR long ,
-.IR belong ,
-.IR lelong ,
-.IR melong ,
-.IR short ,
-.IR beshort ,
-.IR leshort ,
-.IR date ,
-.IR bedate ,
-.IR medate ,
-.IR ledate ,
-.IR beldate ,
-.IR leldate ,
+.Dv long ,
+.Dv belong ,
+.Dv lelong ,
+.Dv melong ,
+.Dv short ,
+.Dv beshort ,
+.Dv leshort ,
+.Dv date ,
+.Dv bedate ,
+.Dv medate ,
+.Dv ledate ,
+.Dv beldate ,
+.Dv leldate ,
 and
-.I meldate
+.Dv meldate
 are system-dependent; perhaps they should be specified as a number
 of bytes (2B, 4B, etc),
 since the files being recognized typically come from
 a system on which the lengths are invariant.
-.SH SEE ALSO
-.BR file (__CSECTION__)
+.Sh SEE ALSO
+.Xr file __CSECTION__
 \- the command that reads this file.
 .\"
 .\" From: guy@sun.uucp (Guy Harris)
@@ -422,4 +446,4 @@ a system on which the lengths are invariant.
 .\" the changes I posted to the S5R2 version.
 .\"
 .\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.33 2006/10/31 19:37:16 christos Exp $
+.\" @(#)$Id: magic.man,v 1.37 2007/01/12 17:38:27 christos Exp $

+ 0 - 805
ltcf-c.sh

@@ -1,805 +0,0 @@
-#### This script is meant to be sourced by ltconfig.
-
-# ltcf-c.sh - Create a C compiler specific configuration
-#
-# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='main(){return(0);}'
-
-## Linker Characteristics
-case $host_os in
-cygwin* | mingw*)
-  # FIXME: the MSVC++ port hasn't been tested in a loooong time
-  # When not using gcc, we currently assume that we are using
-  # Microsoft Visual C++.
-  if test "$with_gcc" != yes; then
-    with_gnu_ld=no
-  fi
-  ;;
-
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
-  # If archive_cmds runs LD, not CC, wlarc should be empty
-  wlarc='${wl}'
-
-  # See if GNU ld supports shared libraries.
-  case $host_os in
-  aix3* | aix4* | aix5*)
-    # On AIX, the GNU linker is very broken
-    ld_shlibs=no
-    cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
-    ;;
-
-  amigaos*)
-    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-
-    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
-    # that the semantics of dynamic libraries on AmigaOS, at least up
-    # to version 4, is to share data among multiple programs linked
-    # with the same dynamic library.  Since this doesn't match the
-    # behavior of shared libraries on other platforms, we can use
-    # them.
-    ld_shlibs=no
-    ;;
-
-  beos*)
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      allow_undefined_flag=unsupported
-      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
-      # support --undefined.  This deserves some investigation.  FIXME
-      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;
-
-  cygwin* | mingw*)
-    # hardcode_libdir_flag_spec is actually meaningless, as there is
-    # no search path for DLLs.
-    hardcode_libdir_flag_spec='-L$libdir'
-    allow_undefined_flag=unsupported
-    always_export_symbols=yes
-
-    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
-      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
-      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
-      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
-      else $CC -o impgen impgen.c ; fi)~
-      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
-
-    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
-
-    # cygwin and mingw dlls have different entry points and sets of symbols
-    # to exclude.
-    # FIXME: what about values for MSVC?
-    dll_entry=__cygwin_dll_entry@12
-    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
-    case $host_os in
-    mingw*)
-      # mingw values
-      dll_entry=_DllMainCRTStartup@12
-      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
-      ;;
-    esac
-
-    # mingw and cygwin differ, and it's simplest to just exclude the union
-    # of the two symbol sets.
-    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
-
-    # recent cygwin and mingw systems supply a stub DllMain which the user
-    # can override, but on older systems we have to supply one (in ltdll.c)
-    if test "x$lt_cv_need_dllmain" = "xyes"; then
-      ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
-      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
-	test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
-    else
-      ltdll_obj=
-      ltdll_cmds=
-    fi
-
-    # Extract the symbol export list from an `--export-all' def file,
-    # then regenerate the def file from the symbol export list, so that
-    # the compiled dll only exports the symbol export list.
-    # Be careful not to strip the DATA tag left be newer dlltools.
-    export_symbols_cmds="$ltdll_cmds"'
-      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
-      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
-
-    # If the export-symbols file already is a .def file (1st line
-    # is EXPORTS), use it as is.
-    # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
-        cp $export_symbols $output_objdir/$soname-def;
-      else
-        echo EXPORTS > $output_objdir/$soname-def;
-        _lt_hint=1;
-        cat $export_symbols | while read symbol; do
-         set dummy \$symbol;
-         case \[$]# in
-           2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
-           *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
-         esac;
-         _lt_hint=`expr 1 + \$_lt_hint`;
-        done;
-      fi~
-      '"$ltdll_cmds"'
-      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
-      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
-      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
-    ;;
-
-  netbsd*)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-      wlarc=
-    else
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    fi
-    ;;
-
-  solaris* | sysv5*)
-    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
-      ld_shlibs=no
-      cat <<EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
-    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;
-
-  sunos4*)
-    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-    wlarc=
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  *)
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;
-  esac
-
-  if test "$ld_shlibs" = yes; then
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
-    case $host_os in
-    cygwin* | mingw*)
-      # dlltool doesn't understand --whole-archive et. al.
-      whole_archive_flag_spec=
-      ;;
-    *)
-      # ancient GNU ld didn't support --whole-archive et. al.
-      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
-	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-	whole_archive_flag_spec=
-      fi
-      ;;
-    esac
-  fi
-else
-  # PORTME fill in a description of your system's linker (not GNU ld)
-  case $host_os in
-  aix3*)
-    allow_undefined_flag=unsupported
-    always_export_symbols=yes
-    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-    # Note: this linker hardcodes the directories in LIBPATH if there
-    # are no directories specified by -L.
-    hardcode_minus_L=yes
-    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
-      # Neither direct hardcoding nor static linking is supported with a
-      # broken collect2.
-      hardcode_direct=unsupported
-    fi
-    ;;
-
-  aix4* | aix5*)
-    hardcode_direct=yes
-    hardcode_libdir_separator=':'
-    link_all_deplibs=yes
-    # When large executables or shared objects are built, AIX ld can
-    # have problems creating the table of contents.  If linking a library
-    # or program results in "error TOC overflow" add -mminimal-toc to
-    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-    if test "$with_gcc" = yes; then
-      case $host_os in aix4.[012]|aix4.[012].*)
-      # We only want to do this on AIX 4.2 and lower, the check
-      # below for broken collect2 doesn't work under 4.3+
-        collect2name=`${CC} -print-prog-name=collect2`
-        if test -f "$collect2name" && \
-	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-        then
-	  # We have reworked collect2
-	  hardcode_direct=yes
-        else
-	  # We have old collect2
-	  hardcode_direct=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  hardcode_minus_L=yes
-	  hardcode_libdir_flag_spec='-L$libdir'
-	  hardcode_libdir_separator=
-        fi
-      esac
-      shared_flag='-shared'
-    else
-      # not using gcc
-      if test "$host_cpu" = ia64; then
-        shared_flag='${wl}-G'
-      else
-        shared_flag='${wl}-bM:SRE'
-      fi
-    fi
-
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      # Test if we are trying to use run time linking, or normal AIX style linking.
-      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
-      aix_use_runtimelinking=no
-      for ld_flag in $LDFLAGS; do
-        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
-          aix_use_runtimelinking=yes
-          break
-        fi
-      done
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
-    # -bexpall does not export symbols beginning with underscore (_)
-    always_export_symbols=yes
-    if test "$aix_use_runtimelinking" = yes; then
-      # Warning - without using the other run time loading flags (-brtl), -berok will
-      #           link without error, but may produce a broken library.
-      allow_undefined_flag=' ${wl}-berok'
-      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
-      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
-    else
-      if test "$host_cpu" = ia64; then
-        hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
-        allow_undefined_flag="-z nodefs"
-        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
-      else
-        allow_undefined_flag=' ${wl}-berok'
-        # -bexpall does not export symbols beginning with underscore (_)
-        always_export_symbols=yes
-        # Exported symbols can be pulled into shared objects from archives
-        whole_archive_flag_spec=' '
-        build_libtool_need_lc=yes
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
-        # This is similar to how AIX traditionally builds it's shared libraries.
-        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-      fi
-    fi
-    ;;
-
-  amigaos*)
-    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-    # see comment about different semantics on the GNU ld section
-    ld_shlibs=no
-    ;;
-
-  cygwin* | mingw*)
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    # hardcode_libdir_flag_spec is actually meaningless, as there is
-    # no search path for DLLs.
-    hardcode_libdir_flag_spec=' '
-    allow_undefined_flag=unsupported
-    # Tell ltmain to make .lib files, not .a files.
-    libext=lib
-    # FIXME: Setting linknames here is a bad hack.
-    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-    # The linker will automatically build a .lib file if we build a DLL.
-    old_archive_from_new_cmds='true'
-    # FIXME: Should let the user specify the lib program.
-    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
-    fix_srcfile_path='`cygpath -w "$srcfile"`'
-    ;;
-
-  darwin* | rhapsody*)
-    case "$host_os" in
-    rhapsody* | darwin1.[012])
-      allow_undefined_flag='-undefined suppress'
-      ;;
-    *) # Darwin 1.3 on
-      allow_undefined_flag='-flat_namespace -undefined suppress'
-      ;;
-    esac
-    archive_cmds='$CC $(if test .$module = .yes; then echo -bundle; else echo -dynamiclib; fi) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname $verstring'
-    # We need to add '_' to the symbols in $export_symbols first
-    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    whole_archive_flag_spec='-all_load $convenience'
-    ;;
-
-  freebsd1*)
-    ld_shlibs=no
-    ;;
-
-  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-  # support.  Future versions do this automatically, but an explicit c++rt0.o
-  # does not break anything, and helps significantly (at the cost of a little
-  # extra space).
-  freebsd2.2*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-  freebsd2*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_direct=yes
-    hardcode_minus_L=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-  freebsd*)
-    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  hpux9* | hpux10* | hpux11*)
-    case $host_os in
-    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
-    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
-    esac
-    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-    hardcode_libdir_separator=:
-    hardcode_direct=yes
-    hardcode_minus_L=yes # Not in the search PATH, but as the default
-			 # location of the library.
-    export_dynamic_flag_spec='${wl}-E'
-    ;;
-
-  irix5* | irix6*)
-    if test "$with_gcc" = yes; then
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-    else
-      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-    fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    link_all_deplibs=yes
-    ;;
-
-  netbsd*)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-    else
-      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-    fi
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  newsos6)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    hardcode_direct=yes
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    hardcode_shlibpath_var=no
-    ;;
-
-  openbsd*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  os2*)
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-    allow_undefined_flag=unsupported
-    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-    ;;
-
-  osf3*)
-    if test "$with_gcc" = yes; then
-      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-    else
-      allow_undefined_flag=' -expect_unresolved \*'
-      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-    fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    ;;
-
-  osf4* | osf5*)	# as osf3* with the addition of -msym flag
-    if test "$with_gcc" = yes; then
-      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    else
-      allow_undefined_flag=' -expect_unresolved \*'
-      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
-
-      # cc supports -rpath directly
-      hardcode_libdir_flag_spec='-rpath $libdir'
-    fi
-    hardcode_libdir_separator=:
-    ;;
-
-  sco3.2v5*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_shlibpath_var=no
-    runpath_var=LD_RUN_PATH
-    hardcode_runpath_var=yes
-    ;;
-
-  solaris*)
-    no_undefined_flag=' -z defs'
-    # $CC -shared without GNU ld will not create a library from C++
-    # object files and a static libstdc++, better avoid it by now
-    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_shlibpath_var=no
-    case $host_os in
-    solaris2.[0-5] | solaris2.[0-5].*) ;;
-    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
-      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
-    esac
-    link_all_deplibs=yes
-    ;;
-
-  sunos4*)
-    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_direct=yes
-    hardcode_minus_L=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  sysv4)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    runpath_var='LD_RUN_PATH'
-    hardcode_shlibpath_var=no
-    hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-    ;;
-
-  sysv4.3*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_shlibpath_var=no
-    export_dynamic_flag_spec='-Bexport'
-    ;;
-
-  sysv5*)
-    no_undefined_flag=' -z text'
-    # $CC -shared without GNU ld will not create a library from C++
-    # object files and a static libstdc++, better avoid it by now
-    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-    hardcode_libdir_flag_spec=
-    hardcode_shlibpath_var=no
-    runpath_var='LD_RUN_PATH'
-    ;;
-
-  uts4*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_shlibpath_var=no
-    ;;
-
-  dgux*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_shlibpath_var=no
-    ;;
-
-  sysv4*MP*)
-    if test -d /usr/nec; then
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var=no
-      runpath_var=LD_RUN_PATH
-      hardcode_runpath_var=yes
-      ld_shlibs=yes
-    fi
-    ;;
-
-  sysv4.2uw2*)
-    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_direct=yes
-    hardcode_minus_L=no
-    hardcode_shlibpath_var=no
-    hardcode_runpath_var=yes
-    runpath_var=LD_RUN_PATH
-    ;;
-
-  sysv5uw7* | unixware7*)
-    no_undefined_flag='${wl}-z ${wl}text'
-    if test "$GCC" = yes; then
-      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-    else
-      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-    fi
-    runpath_var='LD_RUN_PATH'
-    hardcode_shlibpath_var=no
-    ;;
-
-  *)
-    ld_shlibs=no
-    ;;
-  esac
-fi
-
-## Compiler Characteristics: PIC flags, static flags, etc
-if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
-  :
-else
-  ac_cv_prog_cc_pic=
-  ac_cv_prog_cc_shlib=
-  ac_cv_prog_cc_wl=
-  ac_cv_prog_cc_static=
-  ac_cv_prog_cc_no_builtin=
-  ac_cv_prog_cc_can_build_shared=$can_build_shared
-
-  if test "$with_gcc" = yes; then
-    ac_cv_prog_cc_wl='-Wl,'
-    ac_cv_prog_cc_static='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-        # AIX 5 now supports IA64 processor
-        lt_cv_prog_cc_static='-Bstatic'
-      else
-        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
-      ;;
-    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    cygwin* | mingw* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      ac_cv_prog_cc_pic='-DDLL_EXPORT'
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      ac_cv_prog_cc_pic='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      ac_cv_prog_cc_pic=
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	 ac_cv_prog_cc_pic=-Kconform_pic
-      fi
-      ;;
-    *)
-      ac_cv_prog_cc_pic='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for PIC flags for the system compiler.
-    case $host_os in
-    aix*)
-     # All AIX code is PIC.
-      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
-      ac_cv_prog_cc_wl='-Wl,'
-      ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
-      ac_cv_prog_cc_pic='+Z'
-      ;;
-
-    irix5* | irix6*)
-      ac_cv_prog_cc_wl='-Wl,'
-      ac_cv_prog_cc_static='-non_shared'
-      # PIC (with -KPIC) is the default.
-      ;;
-
-    cygwin* | mingw* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      ac_cv_prog_cc_pic='-DDLL_EXPORT'
-      ;;
-
-    newsos6)
-      ac_cv_prog_cc_pic='-KPIC'
-      ac_cv_prog_cc_static='-Bstatic'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      # All OSF/1 code is PIC.
-      ac_cv_prog_cc_wl='-Wl,'
-      ac_cv_prog_cc_static='-non_shared'
-      ;;
-
-    sco3.2v5*)
-      ac_cv_prog_cc_pic='-Kpic'
-      ac_cv_prog_cc_static='-dn'
-      ac_cv_prog_cc_shlib='-belf'
-      ;;
-
-    solaris*)
-      ac_cv_prog_cc_pic='-KPIC'
-      ac_cv_prog_cc_static='-Bstatic'
-      ac_cv_prog_cc_wl='-Wl,'
-      ;;
-
-    sunos4*)
-      ac_cv_prog_cc_pic='-PIC'
-      ac_cv_prog_cc_static='-Bstatic'
-      ac_cv_prog_cc_wl='-Qoption ld '
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-      ac_cv_prog_cc_pic='-KPIC'
-      ac_cv_prog_cc_static='-Bstatic'
-      ac_cv_prog_cc_wl='-Wl,'
-      ;;
-
-    uts4*)
-      ac_cv_prog_cc_pic='-pic'
-      ac_cv_prog_cc_static='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	ac_cv_prog_cc_pic='-Kconform_pic'
-	ac_cv_prog_cc_static='-Bstatic'
-      fi
-      ;;
-
-    *)
-      ac_cv_prog_cc_can_build_shared=no
-      ;;
-    esac
-  fi
-  case "$host_os" in
-      # Platforms which do not suport PIC and -DPIC is meaningless
-      # on them:
-      *djgpp*)
-        ac_cv_prog_cc_pic=
-        ;;
-      *)
-        ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
-        ;;
-  esac
-fi
-
-need_lc=yes
-if test "$enable_shared" = yes && test "$with_gcc" = yes; then
-  case $archive_cmds in
-  *'~'*)
-    # FIXME: we may have to deal with multi-command sequences.
-    ;;
-  '$CC '*)
-    # Test whether the compiler implicitly links with -lc since on some
-    # systems, -lgcc has to come before -lc. If gcc already passes -lc
-    # to ld, don't add -lc before -lgcc.
-    echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
-    if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
-      echo $ac_n "(cached) $ac_c" 1>&6
-      need_lc=$ac_cv_archive_cmds_needs_lc
-    else
-      $rm conftest*
-      echo "static int dummy;" > conftest.$ac_ext
-      if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
-	# Append any warnings to the config.log.
-	cat conftest.err 1>&5
-	soname=conftest
-	lib=conftest
-	libobjs=conftest.$ac_objext
-	deplibs=
-	wl=$ac_cv_prog_cc_wl
-	compiler_flags=-v
-	linker_flags=-v
-	verstring=
-	output_objdir=.
-	libname=conftest
-	save_allow_undefined_flag=$allow_undefined_flag
-	allow_undefined_flag=
-	if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
-	  need_lc=no
-	fi
-	allow_undefined_flag=$save_allow_undefined_flag
-      else
-	cat conftest.err 1>&5
-      fi
-    fi
-    $rm conftest*
-    echo "$ac_t$need_lc" 1>&6
-    ;;
-  esac
-fi
-ac_cv_archive_cmds_needs_lc=$need_lc

+ 1 - 1
magic/Localstuff

@@ -2,6 +2,6 @@
 #------------------------------------------------------------------------------
 # Localstuff:  file(1) magic for locally observed files
 #
-# $Id: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
+# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
 # Add any locally observed files here.  Remember:
 # text if readable, executable if runnable binary, data if unreadable.

+ 3 - 3
magic/Magdir/animation

@@ -320,11 +320,11 @@
 #>3     byte&0x03       3              \b, NR: CCIT J.17
 
 # MPA, M1A
-# modified by Joerg Jenderek
+# updated by Joerg Jenderek
 # GRR the original test are too common for many DOS files, so test 32 <= kbits <= 448
 0	beshort&0xFFFE		0xFFFE	
->2	byte&0xF0	>0x0F		
->>2	byte&0xF0	<0xE1		MPEG ADTS, layer I, v1
+>2	ubyte&0xF0	>0x0F		
+>>2	ubyte&0xF0	<0xE1		MPEG ADTS, layer I, v1
 # rate
 >>>2      byte&0xF0       0x10           \b,  32 kBits
 >>>2      byte&0xF0       0x20           \b,  64 kBits

+ 1 - 1
magic/Magdir/archive

@@ -478,7 +478,7 @@
 0	string		HPAK		HPACK archive data
 
 # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
-0	string		\351,\001JAM\		JAM archive,
+0	string		\351,\001JAM\ 		JAM archive,
 >7	string		>\0			version %.4s
 >0x26	byte		=0x27			-
 >>0x2b	string          >\0			label %.11s,

+ 11 - 4
magic/Magdir/audio

@@ -500,13 +500,13 @@
 # Since I saw only eqf files with version v1.1 I think that it's OK
 >23	string	x	\b%.4s
 # .preset
-0	string	\[Equalizer\ preset\]	XMMS equalizer preset
+0	string	[Equalizer\ preset]	XMMS equalizer preset
 # .m3u
-0	string	\#EXTM3U	M3U playlist
+0	string	#EXTM3U			M3U playlist
 # .pls
-0	string	\[playlist\]	PLS playlist
+0	string	[playlist]		PLS playlist
 # licq.conf
-1	string	\[licq\]	LICQ configuration file
+1	string	[licq]			LICQ configuration file
 
 # Atari ST audio files by Dirk Jagdmann <doj@cubic.org>
 0	string		ICE!		SNDH Atari ST music
@@ -545,3 +545,10 @@
 >>27    byte            113     \b, Alpha 1.13
 >>27    byte            114     \b, Beta 1.14
 >>27    byte            115     \b, Alpha 1.15
+
+# IMY
+# from http://filext.com/detaillist.php?extdetail=IMY
+# http://cellphones.about.com/od/cellularfaqs/f/rf_imelody.htm
+# http://download.ncl.ie/doc/api/ie/ncl/media/music/IMelody.html
+# http://www.wx800.com/msg/download/irda/iMelody.pdf
+0	string	BEGIN:IMELODY	iMelody Ringtone Format

+ 2 - 2
magic/Magdir/c-lang

@@ -20,5 +20,5 @@
 # The inverted index functionality was added some time betwen
 # versions 11 and 15, so look for -q if version is above 14:
 >7	string		>14
->>10	regex		.+\ -q\		with inverted index
->10	regex		.+\ -c\		text (non-compressed)
+>>10	regex		.+\ -q\ 	with inverted index
+>10	regex		.+\ -c\ 	text (non-compressed)

+ 1 - 1
magic/Magdir/commands

@@ -53,4 +53,4 @@
 
 0	string		Zend\x00		PHP script Zend Optimizer data
 
-0	string		\$!			DCL command file
+0	string		$!			DCL command file

+ 3 - 0
magic/Magdir/console

@@ -165,3 +165,6 @@
 # From: Serge van den Boom <svdb@stack.nl>
 0	string		\x01ZZZZZ\x01	3DO "Opera" file system
 
+# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+0	string		GBS		Nintendo Gameboy Music/Audio Data
+12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module

+ 0 - 4
magic/Magdir/database

@@ -210,7 +210,3 @@
 16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
 18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
-
-# SQLite (Ty Sarna)
-0	string	**\ This\ file\ contains\ an\ SQLite	SQLite Database
->&1	regex	[^\ ]+					Version %s

+ 2 - 1
magic/Magdir/editors

@@ -13,4 +13,5 @@
 0	string	VimCrypt~	Vim encrypted file data
 # Vi IMproved Swap file
 # by Sven Wegener <swegener@gentoo.org>
-0	string	b0VIM\		Vim swap file, version %s
+0	string	b0VIM\ 		Vim swap file
+>&0	string	>\0		\b, version %s

+ 2 - 1
magic/Magdir/elf

@@ -167,8 +167,9 @@
 >>>36	belong&0xffff00	&0x000400	HaL R1 Extensions Required,
 >>>36	belong&0xffff00	&0x000800	Sun UltraSPARC3 Extensions Required,
 >>18	beshort		20		PowerPC or cisco 4500,
->>18	beshort		21		cisco 7500,
+>>18	beshort		21		64-bit PowerPC or cisco 7500,
 >>18	beshort		22		IBM S/390,
+>>18	beshort		23		Cell SPU,
 >>18	beshort		24		cisco SVIP,
 >>18	beshort		25		cisco 7200,
 >>18	beshort		36		NEC V800 or cisco 12000,

+ 290 - 79
magic/Magdir/filesystems

@@ -5,22 +5,25 @@
 0	string	\366\366\366\366	PC formatted floppy with no filesystem
 # Sun disk labels
 # From /usr/include/sun/dklabel.h:
-0774	beshort		0xdabe		Sun disk label
->0	string		x		'%s
->>31  	string		>\0		\b%s
->>>63  	string		>\0		\b%s
->>>>95 	string		>\0		\b%s
->0	string		x		\b'
->0734	short		>0		%d rpm,
->0736	short		>0		%d phys cys,
->0740	short		>0		%d alts/cyl,
->0746	short		>0		%d interleave,
->0750	short		>0		%d data cyls,
->0752	short		>0		%d alt cyls,
->0754	short		>0		%d heads/partition,
->0756	short		>0		%d sectors/track,
->0764	long		>0		start cyl %ld,
->0770	long		x		%ld blocks
+0774	beshort		0xdabe		
+# modified by Joerg Jenderek, because original test
+# succeeds for Cabinet archive dao360.dl_ with negative blocks
+>0770	long		>0		Sun disk label
+>>0	string		x		'%s
+>>>31	string		>\0		\b%s
+>>>>63	string		>\0		\b%s
+>>>>>95	string		>\0		\b%s
+>>0	string		x		\b'
+>>0734	short		>0		%d rpm,
+>>0736	short		>0		%d phys cys,
+>>0740	short		>0		%d alts/cyl,
+>>0746	short		>0		%d interleave,
+>>0750	short		>0		%d data cyls,
+>>0752	short		>0		%d alt cyls,
+>>0754	short		>0		%d heads/partition,
+>>0756	short		>0		%d sectors/track,
+>>0764	long		>0		start cyl %ld,
+>>0770	long		x		%ld blocks
 # Is there a boot block written 1 sector in?
 >512    belong&077777777	0600407	\b, boot block present
 # Joerg Jenderek: Smart Boot Manager backup file is 41 byte header + first sectors of disc
@@ -100,75 +103,140 @@
 >>96	string	read\ error\ while\ reading\ drive	\b, FREE-DOS Beta 0.9 MBR
 >271	string	Operating\ system\ loading 		
 >>296	string	error\r					\b, SYSLINUX MBR (2.10)
+# http://www.acronis.de/
+>362	string	MBR\ Error\ \0\r			
+>>376	string	ress\ any\ key\ to\ 			
+>>>392	string	boot\ from\ floppy...\0			\b, Acronis MBR
+# added by Joerg Jenderek
+# http://www.visopsys.org/
+# http://partitionlogic.org.uk/
+>309	string	No\ bootable\ partition\ found\r