+
+2004-07-24 16:33 Christos Zoulas <christos@zoulas.com>
+
+ * magic.mime update Danny Milosavljevic <danny.milo@gmx.net>
+
+ * FreeBSD version update Oliver Eikemeier <eikemeier@fillmore-labs.com>
+
+ * utime/utimes detection Ian Lance Taylor <ian@wasabisystems.com>
+
+ * errors reading elf magic Jakub Bogusz <qboosh@pld-linux.org>
+
+2004-04-12 10:55 Christos Zoulas <christos@zoulas.com>
+
+ * make sure that magic formats match magic types during compilation
+
+ * fix broken sgi magic file
+
2004-04-06 20:36 Christos Zoulas <christos@zoulas.com>
* detect present of mbstate_t Petter Reinholdtsen <pere@hungry.com>
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
+/* Define to 1 if you have the `mbrtowc' function. */
+#undef HAVE_MBRTOWC
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
+/* Define to 1 if you have the `wcwidth' function. */
+#undef HAVE_WCWIDTH
+
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
#undef MAJOR_IN_MKDEV
# Define the identity of the package.
PACKAGE=file
- VERSION=4.09
+ VERSION=4.10
cat >>confdefs.h <<_ACEOF
-for ac_func in mmap strerror strtoul mkstemp getopt_long utimes utime
+
+
+for ac_func in mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/file.c)
-AM_INIT_AUTOMAKE(file, 4.09)
+AM_INIT_AUTOMAKE(file, 4.10)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
dnl Checks for functions
-AC_CHECK_FUNCS(mmap strerror strtoul mkstemp getopt_long utimes utime)
+AC_CHECK_FUNCS(mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth)
dnl Checks for libraries
AC_CHECK_LIB(z,gzopen)
# Infocom
# (Note: to avoid false matches Z-machine version 1 and 2 are not
# recognized since only the oldest Zork I and II used them. Similarly
-# there are 4 Infocom games that use verion 4 that are not recognized.)
+# there are 4 Infocom games that use version 4 that are not recognized.)
#0 byte 3 Infocom game data (Z-machine 3,
#>2 beshort <0x7fff Release %3d,
#>26 beshort >0 Size %d*2
#
# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
-# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG
-# (the others should be separate, anyway)
#
+0 belong 0x000003fa AmigaOS shared library
0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary
0 belong 0x000003e7 AmigaOS object/library data
#
0 belong 0x80001001 AmigaOS outline tag
0 string ##\ version catalog translation
-0 string FORM IFF data
->8 string CTLG \b, CTLG message catalog
->8 string PREF \b, PREF preferences
-
-0 string Rar! RAR archive data,
->44 byte x v%0x,
->35 byte 0 os: MS-DOS
->35 byte 1 os: OS/2
->35 byte 2 os: Win32
->35 byte 3 os: Unix
-
-0 belong 0x000003fa AmigaOS shared library
-
# Amiga disk types
#
0 string RDSK Rigid Disk Block
# Beagle Bros. Apple Mechanic fonts
0 belong&0xFF00FFFF 0x6400D000 Apple Mechanic font
+
+# Apple Universal Disk Image Format (UDIF) - dmg files.
+# From Johan Gade.
+# These entries are disabled for now until we fix the following issues.
+#
+# Note there might be some problems with the "VAX COFF executable"
+# entry. Note this entry should be placed before the mac filesystem section,
+# particularly the "Apple Partition data" entry.
+#
+# The intended meaning of these tests is, that the file is only of the
+# specified type if both of the lines are correct - i.e. if the first
+# line matches and the second doesn't then it is not of that type.
+#
+#0 long 0x7801730d
+#>4 long 0x62626060 UDIF read-only zlib-compressed image (UDZO)
+#
+# Note that this entry is recognized correctly by the "Apple Partition
+# data" entry - however since this entry is more specific - this
+# information seems to be more useful.
+#0 long 0x45520200
+#>0x410 string disk\ image UDIF read/write image (UDRW)
>20 byte x - header level %d
# RAR archiver (Greg Roelofs, newt@uchicago.edu)
-0 string Rar! RAR archive data
+0 string Rar! RAR archive data,
+>44 byte x v%0x,
+>35 byte 0 os: MS-DOS
+>35 byte 1 os: OS/2
+>35 byte 2 os: Win32
+>35 byte 3 os: Unix
# SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
0 string SQSH squished archive data (Acorn RISCOS)
>5 leshort &0x8000 \b, solid
# Date in MS-DOS format (whatever that is)
#>18 lelong x Created on
+
+# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
+# <doj@cubic.org>
+0x1A string sfArk sfArk compressed Soundfont
+>0x15 string 2
+>>0x1 string >\0 Version %s
+>>0x2A string >\0 : %s
+
>12 belong 5 32-bit linear PCM,
>12 belong 6 32-bit IEEE floating point,
>12 belong 7 64-bit IEEE floating point,
+>12 belong 8 Fragmented sample data,
+>12 belong 10 DSP program,
+>12 belong 11 8-bit fixed point,
+>12 belong 12 16-bit fixed point,
+>12 belong 13 24-bit fixed point,
+>12 belong 14 32-bit fixed point,
+>12 belong 18 16-bit linear with emphasis,
+>12 belong 19 16-bit linear compressed,
+>12 belong 20 16-bit linear with emphasis and compression,
+>12 belong 21 Music kit DSP commands,
>12 belong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
->12 belong 24 compressed (8-bit G.722 ADPCM)
->12 belong 25 compressed (3-bit G.723 ADPCM),
->12 belong 26 compressed (5-bit G.723 ADPCM),
->12 belong 27 8-bit A-law,
+>12 belong 24 compressed (8-bit CCITT G.722 ADPCM)
+>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM),
+>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM),
+>12 belong 27 8-bit A-law (CCITT G.711),
>20 belong 1 mono,
>20 belong 2 stereo,
>20 belong 4 quad,
>12 lelong 5 32-bit linear PCM,
>12 lelong 6 32-bit IEEE floating point,
>12 lelong 7 64-bit IEEE floating point,
+>12 belong 8 Fragmented sample data,
+>12 belong 10 DSP program,
+>12 belong 11 8-bit fixed point,
+>12 belong 12 16-bit fixed point,
+>12 belong 13 24-bit fixed point,
+>12 belong 14 32-bit fixed point,
+>12 belong 18 16-bit linear with emphasis,
+>12 belong 19 16-bit linear compressed,
+>12 belong 20 16-bit linear with emphasis and compression,
+>12 belong 21 Music kit DSP commands,
>12 lelong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding),
+>12 belong 24 compressed (8-bit CCITT G.722 ADPCM)
+>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM),
+>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM),
+>12 belong 27 8-bit A-law (CCITT G.711),
>20 lelong 1 mono,
>20 lelong 2 stereo,
>20 lelong 4 quad,
# a t r i s t sp ^ S cr nl d i v sp #
# .mth Thesaurus
-# statrts with \0 but no magic header
+# starts with \0 but no magic header
# .chy Hyphenation file
# I am not sure: 000 210 034 000 000
#----------------------------------------------------------------------------
-# communcation
+# communication
# TTCN is the Tree and Tabular Combined Notation described in ISO 9646-3.
# It is used for conformance testing of communication protocols.
0 string ***\ 'diff' output text
0 string Only\ in\ 'diff' output text
0 string Common\ subdirectories:\ 'diff' output text
-
-# xdelta is like diff(1) for binary files (works for text, too).
-# Available from: ftp://ftp.xcf.berkeley.edu/pub/xdelta/
-0 string %XDZ xdelta diff file
->4 string >% version %.3s
# This entry is only semi-helpful, as Gnumeric compresses its files, so
# they will ordinarily reported as "compressed", but at least -z helps
39 string =<gmr:Workbook Gnumeric spreadsheet
-
-#------------------------------------------------------------------------------
-# gcc: file(1) magic for GCC special files
-#
-0 string gpch GCC precompiled header
-
-# The version field is annoying. It's 3 characters, not zero-terminated.
->5 byte x (version %c
->6 byte x \b%c
->7 byte x \b%c)
-
-# 67 = 'C', 111 = 'o', 43 = '+', 79 = 'O'
->4 byte 67 for C
->4 byte 111 for Objective C
->4 byte 43 for C++
->4 byte 79 for Objective C++
-
-
>8 string TDDD \b, TDDD 3-D rendering
# other formats
>8 string FTXT \b, FTXT formatted text
+>8 string CTLG \b, CTLG message catalog
+>8 string PREF \b, PREF preferences
# From: Jason Bacon <bacon@smithers.neuro.mcw.edu>
0 beshort 0x3020 character Computer Graphics Metafile
+
+
+# From: Tom Hilinski <tom.hilinski@comcast.net>
+# http://www.unidata.ucar.edu/packages/netcdf/
+0 string CDF\001 netcdf file
#
0 beshort 0xffd8 JPEG image data
>6 string JFIF \b, JFIF standard
->6 string Exif \b, EXIF standard
# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF. Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
# impossible to specify in magic(4) format.
# First, a little JFIF version info:
->11 byte x \b %d.
->12 byte x \b%02d
+>>11 byte x \b %d.
+>>12 byte x \b%02d
# Next, the resolution or aspect ratio of the image:
-#>13 byte 0 \b, aspect ratio
-#>13 byte 1 \b, resolution (DPI)
-#>13 byte 2 \b, resolution (DPCM)
-#>4 beshort x \b, segment length %d
+#>>13 byte 0 \b, aspect ratio
+#>>13 byte 1 \b, resolution (DPI)
+#>>13 byte 2 \b, resolution (DPCM)
+#>>4 beshort x \b, segment length %d
# Next, show thumbnail info, if it exists:
->18 byte !0 \b, thumbnail %dx
->>19 byte x \b%d
+>>18 byte !0 \b, thumbnail %dx
+>>>19 byte x \b%d
+
+# EXIF moved down here to avoid reporting a bogus version number,
+# and EXIF version number printing added.
+# - Patrik R=E5dman <patrik+file-magic@iki.fi>
+>6 string Exif \b, EXIF standard
+# Look for EXIF IFD offset in IFD 0, and then look for EXIF version tag in EXIF IFD.
+# All possible combinations of entries have to be enumerated, since no looping
+# is possible. And both endians are possible...
+# The combinations included below are from real-world JPEGs.
+# Little-endian
+>>12 string II
+# IFD 0 Entry #5:
+>>>70 leshort 0x8769
+# EXIF IFD Entry #1:
+>>>>(78.l+14) leshort 0x9000
+>>>>>(78.l+23) byte x %c
+>>>>>(78.l+24) byte x \b.%c
+>>>>>(78.l+25) byte !0x30 \b%c
+# IFD 0 Entry #9:
+>>>118 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(126.l+38) leshort 0x9000
+>>>>>(126.l+47) byte x %c
+>>>>>(126.l+48) byte x \b.%c
+>>>>>(126.l+49) byte !0x30 \b%c
+# IFD 0 Entry #10
+>>>130 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(138.l+38) leshort 0x9000
+>>>>>(138.l+47) byte x %c
+>>>>>(138.l+48) byte x \b.%c
+>>>>>(138.l+49) byte !0x30 \b%c
+# EXIF IFD Entry #4:
+>>>>(138.l+50) leshort 0x9000
+>>>>>(138.l+59) byte x %c
+>>>>>(138.l+60) byte x \b.%c
+>>>>>(138.l+61) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(138.l+62) leshort 0x9000
+>>>>>(138.l+71) byte x %c
+>>>>>(138.l+72) byte x \b.%c
+>>>>>(138.l+73) byte !0x30 \b%c
+# IFD 0 Entry #11
+>>>142 leshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(150.l+38) leshort 0x9000
+>>>>>(150.l+47) byte x %c
+>>>>>(150.l+48) byte x \b.%c
+>>>>>(150.l+49) byte !0x30 \b%c
+# EXIF IFD Entry #4:
+>>>>(150.l+50) leshort 0x9000
+>>>>>(150.l+59) byte x %c
+>>>>>(150.l+60) byte x \b.%c
+>>>>>(150.l+61) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(150.l+62) leshort 0x9000
+>>>>>(150.l+71) byte x %c
+>>>>>(150.l+72) byte x \b.%c
+>>>>>(150.l+73) byte !0x30 \b%c
+# Big-endian
+>>12 string MM
+# IFD 0 Entry #9:
+>>>118 beshort 0x8769
+# EXIF IFD Entry #1:
+>>>>(126.L+14) beshort 0x9000
+>>>>>(126.L+23) byte x %c
+>>>>>(126.L+24) byte x \b.%c
+>>>>>(126.L+25) byte !0x30 \b%c
+# EXIF IFD Entry #3:
+>>>>(126.L+38) beshort 0x9000
+>>>>>(126.L+47) byte x %c
+>>>>>(126.L+48) byte x \b.%c
+>>>>>(126.L+49) byte !0x30 \b%c
+# IFD 0 Entry #10
+>>>130 beshort 0x8769
+# EXIF IFD Entry #3:
+>>>>(138.L+38) beshort 0x9000
+>>>>>(138.L+47) byte x %c
+>>>>>(138.L+48) byte x \b.%c
+>>>>>(138.L+49) byte !0x30 \b%c
+# EXIF IFD Entry #5:
+>>>>(138.L+62) beshort 0x9000
+>>>>>(138.L+71) byte x %c
+>>>>>(138.L+72) byte x \b.%c
+>>>>>(138.L+73) byte !0x30 \b%c
+# IFD 0 Entry #11
+>>>142 beshort 0x8769
+# EXIF IFD Entry #4:
+>>>>(150.L+50) beshort 0x9000
+>>>>>(150.L+59) byte x %c
+>>>>>(150.L+60) byte x \b.%c
+>>>>>(150.L+61) byte !0x30 \b%c
# Here things get sticky. We can do ONE MORE marker segment with
# indirect addressing, and that's all. It would be great if we could
# do pointer arithemetic like in an assembler language. Christos?
# named accumulators, it would be even more effective...
# At least we can show a comment if no other segments got inserted before:
>(4.S+5) byte 0xFE
->>(4.S+8) string >\0 \b, "%s"
+>>(4.S+8) string >\0 \b, comment: "%s"
#>(4.S+5) byte 0xFE \b, comment
#>>(4.S+6) beshort x \b length=%d
#>>(4.S+8) string >\0 \b, "%s"
--- /dev/null
+
+#------------------------------------------------------------------------------
+# matroska: file(1) magic for Matroska files
+#
+# See http://www.matroska.org/
+#
+
+# EBML id:
+0 belong 0x1a45dfa3
+# DocType id:
+>5 beshort 0x4282
+# DocType contents:
+>>8 string matroska Matroska data
+
0 string \333\245-\0\0\0 Microsoft Office Document
#
2080 string Microsoft\ Excel\ 5.0\ Worksheet %s
+2080 string Foglio\ di\ lavoro\ Microsoft\ Exce %s
#
# Pawel Wiecek <coven@i17linuxb.ists.pwr.wroc.pl> (for polish Excel)
2114 string Biff5 Microsoft Excel 5.0 Worksheet
+# Italian MS-Excel
+2121 string Biff5 Microsoft Excel 5.0 Worksheet
+0 string \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet
#
0 belong 0x00001a00 Lotus 1-2-3
>4 belong 0x00100400 wk3 document data
# From: Dirk Jagdmann <doj@cubic.org>
0 lelong 0x00035f3f Windows 3.x help file
+# Christophe Monniez
+0 string Client\ UrlCache\ MMF Microsoft Internet Explorer Cache File
+>20 string >\0 Version %s
+0 string \xCF\xAD\x12\xFE Microsoft Outlook Express DBX File
+>4 byte =0xC5 Message database
+>4 byte =0xC6 Folder database
+>4 byte =0xC7 Accounts informations
+>4 byte =0x30 Offline database
#
# Now magic for IMAGEN font files...
0 string Rast RST-format raster font data
->45 string >0 face %
+>45 string >0 face %s
# From Jukka Ukkonen
0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data
# Performance Co-Pilot file types
0 string PmNs PCP compiled namespace (V.0)
0 string PmN PCP compiled namespace
->3 lelong x (V.%1.1s)
+>3 string >\0 (V.%1.1s)
3 lelong 0x84500526 PCP archive
>7 byte x (V.%d)
>20 lelong -2 temporal index
>20 lelong -1 metadata
>20 lelong 0 log volume #0
>20 lelong >0 log volume #%ld
->24 lelong x host: %s
+>24 string >\0 host: %s
0 string PCPFolio PCP
>9 string Version: Archive Folio
->18 lelong x (V.%s)
+>18 string >\0 (V.%s)
0 string #pmchart PCP pmchart view
>9 string Version
->17 lelong x (V%-3.3s)
+>17 string >\0 (V%-3.3s)
0 string pmview PCP pmview config
>7 string Version
->15 lelong x (V%-3.3s)
+>15 string >\0 (V%-3.3s)
0 string #pmlogger PCP pmlogger config
>10 string Version
->18 lelong x (V%1.1s)
+>18 string >\0 (V%1.1s)
0 string PcPh PCP Help
>4 string 1 Index
>4 string 2 Text
->5 lelong x (V.%1.1s)
+>5 string >\0 (V.%1.1s)
0 string #pmieconf-rules PCP pmieconf rules
->16 lelong x (V.%1.1s)
+>16 string >\0 (V.%1.1s)
3 string pmieconf-pmie PCP pmie config
->17 lelong x (V.%1.1s)
+>17 string >\0 (V.%1.1s)
# SpeedShop data files
0 lelong 0x13130303 SpeedShop data file
# Alias|Wavefront Maya files
0 string //Maya ASCII Alias|Wavefront Maya Ascii File,
->13 lelong x version %s
+>13 string >\0 version %s
8 string MAYAFOR4 Alias|Wavefront Maya Binary File,
->32 lelong x version %s scene
+>32 string >\0 version %s scene
8 string MayaFOR4 Alias|Wavefront Maya Binary File,
->32 lelong x version %s scene
+>32 string >\0 version %s scene
8 string CIMG Alias|Wavefront Maya Image File
8 string DEEP Alias|Wavefront Maya Image File
--- /dev/null
+
+#------------------------------------------------------------------------------
+# spec: file(1) magic for SPEC raw results (*.raw, *.rsf)
+#
+# Cloyce D. Spradling <cloyce@headgear.org>
+
+0 string spec SPEC
+>4 string .cpu CPU
+>>8 string <: \b%.4s
+>>12 string . raw result text
+
+17 string version=SPECjbb SPECjbb
+>32 string <: \b%.4s
+>>37 string <: v%.4s raw result text
+
+0 string BEGIN\040SPECWEB SPECweb
+>13 string <: \b%.2s
+>>15 string _SSL \b_SSL
+>>>20 string <: v%.4s raw result text
+>>16 string <: v%.4s raw result text
##>4 byte 0 revision 0
>4 byte 0
##>>14 lelong x (Serial %lX)
-# non-Vorbis content: FLAC (Free Loss-lessy Audio Codec,
-# http://flac.sourceforge.net)
+# non-Vorbis content: FLAC (Free Lossless Audio Codec, http://flac.sourceforge.net)
>>28 string fLaC \b, FLAC audio
+# non-Vorbis content: Theora
+>>28 string \x80theora \b, Theora video
+# non-Vorbis content: Speex
+>>28 string Speex\ \ \ \b, Speex audio
+# non-Vorbis content: OGM
+>>28 string \x01video\0\0\0 \b, OGM video
+>>>37 string/c div3 (DivX 3)
+>>>37 string/c divx (DivX 4)
+>>>37 string/c dx50 (DivX 5)
+>>>37 string/c xvid (XviD)
# --- First vorbis packet - general header ---
>>28 string \x01vorbis \b, Vorbis audio,
>>>35 lelong !0 UNKNOWN VERSION %lu,
>>>>(84.b+96) string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
>>>>>(84.b+120) string >00000000
# Map to beta version numbers:
->>>>>>(84.b+120) string <20000508 (<beta1 - prepublic)
->>>>>>(84.b+120) string 20000508 (beta1/2)
+>>>>>>(84.b+120) string <20000508 (<beta1, prepublic)
+>>>>>>(84.b+120) string 20000508 (1.0 beta 1 or beta 2)
>>>>>>(84.b+120) string >20000508
>>>>>>>(84.b+120) string <20001031 (beta2-3)
->>>>>>(84.b+120) string 20001031 (beta3)
+>>>>>>(84.b+120) string 20001031 (1.0 beta 3)
>>>>>>(84.b+120) string >20001031
>>>>>>>(84.b+120) string <20010225 (beta3-4)
->>>>>>(84.b+120) string 20010225 (beta4)
+>>>>>>(84.b+120) string 20010225 (1.0 beta 4)
>>>>>>(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 20010615 (1.0 RC1)
+>>>>>>(84.b+120) string 20010813 (1.0 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)
+>>>>>>(84.b+120) string 20011217 (1.0 RC3)
+>>>>>>(84.b+120) string 20011231 (1.0 RC3)
# Some pre-1.0 CVS snapshots still had "Xiphphorus"...
>>>>>>(84.b+120) string >20011231 (pre-1.0 CVS)
# For the 1.0 release, Xiphophorus is replaced by Xiph.Org
>>>>>(84.b+117) string >00000000
>>>>>>(84.b+117) string <20020717 (pre-1.0 CVS)
>>>>>>(84.b+117) string 20020717 (1.0)
->>>>>>(84.b+117) string >20020717 (post-1.0 CVS)
+>>>>>>(84.b+117) string 20030909 (1.0.1)
+>>>>>>(84.b+117) string 20040629 (1.1.0 RC1)
$(top_builddir)/src/file -C -m magic
magic.mime.mgc: magic.mime
- $(top_builddir)/src/file -C -m magic.mime
+ $(top_builddir)/src/file -C -m $(srcdir)/magic.mime
magic_FRAGMENTS = \
Magdir/acorn \
Magdir/citrus \
Magdir/claris \
Magdir/clipper \
+Magdir/spec \
Magdir/commands \
Magdir/communications \
Magdir/compress \
Magdir/mail.news \
Magdir/maple \
Magdir/mathematica \
+Magdir/matroska \
Magdir/mcrypt \
Magdir/mime \
Magdir/mips \
Magdir/citrus \
Magdir/claris \
Magdir/clipper \
+Magdir/spec \
Magdir/commands \
Magdir/communications \
Magdir/compress \
Magdir/mail.news \
Magdir/maple \
Magdir/mathematica \
+Magdir/matroska \
Magdir/mcrypt \
Magdir/mime \
Magdir/mips \
$(top_builddir)/src/file -C -m magic
magic.mime.mgc: magic.mime
- $(top_builddir)/src/file -C -m magic.mime
+ $(top_builddir)/src/file -C -m $(srcdir)/magic.mime
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Localstuff: file(1) magic for locally observed files
# Add any locally observed files here.
+# Real Audio (Magic .ra\0375)
+0 belong 0x2e7261fd audio/x-pn-realaudio
+0 string .RMF application/vnd.rn-realmedia
+
+#video/x-pn-realvideo
+#video/vnd.rn-realvideo
+#application/vnd.rn-realmedia
+# sigh, there are many mimes for that but the above are the most common.
+
+# Taken from magic, converted to magic.mime
+# mime types according to http://www.geocities.com/nevilo/mod.htm:
+# audio/it .it
+# audio/x-zipped-it .itz
+# audio/xm fasttracker modules
+# audio/x-s3m screamtracker modules
+# audio/s3m screamtracker modules
+# audio/x-zipped-mod mdz
+# audio/mod mod
+# audio/x-mod All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z)
+
+# Taken from loader code from mikmod version 2.14
+# by Steve McIntyre (stevem@chiark.greenend.org.uk)
+# <doj@cubic.org> added title printing on 2003-06-24
+0 string MAS_UTrack_V00
+>14 string >/0 audio/x-mod
+#audio/x-tracker-module
+
+#0 string UN05 MikMod UNI format module sound data
+
+0 string Extended\ Module: audio/x-mod
+#audio/x-tracker-module
+##>17 string >\0 Title: "%s"
+
+21 string/c !SCREAM! audio/x-mod
+#audio/x-screamtracker-module
+21 string BMOD2STM audio/x-mod
+#audio/x-screamtracker-module
+1080 string M.K. audio/x-mod
+#audio/x-protracker-module
+#>0 string >\0 Title: "%s"
+1080 string M!K! audio/x-mod
+#audio/x-protracker-module
+#>0 string >\0 Title: "%s"
+1080 string FLT4 audio/x-mod
+#audio/x-startracker-module
+#>0 string >\0 Title: "%s"
+1080 string FLT8 audio/x-mod
+#audio/x-startracker-module
+#>0 string >\0 Title: "%s"
+1080 string 4CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string 6CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string 8CHN audio/x-mod
+#audio/x-fasttracker-module
+#>0 string >\0 Title: "%s"
+1080 string CD81 audio/x-mod
+#audio/x-oktalyzer-tracker-module
+#>0 string >\0 Title: "%s"
+1080 string OKTA audio/x-mod
+#audio/x-oktalyzer-tracker-module
+#>0 string >\0 Title: "%s"
+# Not good enough.
+#1082 string CH
+#>1080 string >/0 %.2s-channel Fasttracker "oktalyzer" module sound data
+1080 string 16CN audio/x-mod
+#audio/x-taketracker-module
+#>0 string >\0 Title: "%s"
+1080 string 32CN audio/x-mod
+#audio/x-taketracker-module
+#>0 string >\0 Title: "%s"
+
+# Impuse tracker module (it)
+0 string IMPM audio/x-mod
+#>4 string >\0 "%s"
+#>40 leshort !0 compatible w/ITv%x
+#>42 leshort !0 created w/ITv%x
+
#------------------------------------------------------------------------------
# end local stuff
#------------------------------------------------------------------------------
+# xml based formats!
+
+# svg
+
+0 string \<?xml
+# text/xml
+>38 string \<\!DOCTYPE\040svg image/svg+xml
+
+
+# xml
+0 string \<?xml text/xml
+
+
#------------------------------------------------------------------------------
# Java
# IFF/8SVX audio data
8 string 8SVX audio/x-aiff
+
+
# Creative Labs AUDIO stuff
# Standard MIDI data
0 string MThd audio/unknown
#MP3 with ID3 tag
0 string ID3 audio/mpeg
# Ogg/Vorbis
-0 string OggS audio/ogg
+0 string OggS application/ogg
#------------------------------------------------------------------------------
# c-lang: file(1) magic for C programs or various scripts
#0 string CP color pointer
#0 string BA bitmap array
+# CDROM Filesystems
+32769 string CD001 application/x-iso9660
+
+# Newer StuffIt archives (grant@netbsd.org)
+0 string StuffIt application/x-stuffit
+#>162 string >0 : %s
+
+# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
+# Daniel Quinlan, quinlan@yggdrasil.com
+11 string must\ be\ converted\ with\ BinHex\ 4 application/mac-binhex40
+##>41 string x \b, version %.3s
+
#------------------------------------------------------------------------------
# lisp: file(1) magic for lisp programs
# From: stephane.loeuillet@tiscali.f
# http://www.djvuzone.org/
0 string AT&TFORM image/x.djvu
+
+# Danny Milosavljevic <danny.milo@gmx.net>
+# this are adrift (adventure game standard) game files, extension .taf
+# depending on version magic continues with 0x93453E6139FA (V 4.0)
+# 0x9445376139FA (V 3.90)
+# 0x9445366139FA (V 3.80)
+# this is from source (http://www.adrift.org.uk/) and I have some taf
+# files, and checked them.
+#0 belong 0x3C423FC9
+#>4 belong 0x6A87C2CF application/x-adrift
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.75 2004/03/22 18:48:56 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.78 2004/07/24 20:38:56 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
const char *);
private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
const char *);
+private int check_format(struct magic *);
private size_t maxmagic = 0;
private size_t magicsize = sizeof(struct magic);
#ifdef COMPILE_ONLY
-const char *magicfile;
-char *progname;
-int lineno;
int main(int, char *[]);
main(int argc, char *argv[])
{
int ret;
+ struct magic_set *ms;
+ char *progname;
if ((progname = strrchr(argv[0], '/')) != NULL)
progname++;
progname = argv[0];
if (argc != 2) {
- (void)fprintf(stderr, "usage: %s file\n", progname);
- exit(1);
+ (void)fprintf(stderr, "Usage: %s file\n", progname);
+ return 1;
}
- magicfile = argv[1];
- exit(file_apprentice(magicfile, COMPILE, MAGIC_CHECK) == -1 ? 1 : 0);
+ if ((ms = magic_open(MAGIC_CHECK)) == NULL) {
+ (void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
+ return 1;
+ }
+ ret = magic_compile(ms, argv[1]) == -1 ? 1 : 0;
+ if (ret == 1)
+ (void)fprintf(stderr, "%s: %s\n", progname, magic_error(ms));
+ magic_close(ms);
+ return ret;
}
#endif /* COMPILE_ONLY */
break;
case 1:
p--;
+ /*FALLTHROUGH*/
case 0:
free(p);
break;
while ((m->desc[i++] = *l++) != '\0' && i < MAXDESC)
/* NULLBODY */;
+ if (ms->flags & MAGIC_CHECK) {
+ if (!check_format(m))
+ return -1;
+ }
#ifndef COMPILE_ONLY
if (action == FILE_CHECK) {
file_mdump(m);
return 0;
}
+/*
+ * Check that the optional printf format in description matches
+ * the type of the magic.
+ */
+private int
+check_format(struct magic *m)
+{
+ static const char *formats[] = { FILE_FORMAT_STRING };
+ static const char *names[] = { FILE_FORMAT_NAME };
+ char *ptr;
+
+ for (ptr = m->desc; *ptr; ptr++)
+ if (*ptr == '%')
+ break;
+ if (*ptr == '\0') {
+ /* No format string; ok */
+ return 1;
+ }
+ if (m->type >= sizeof(formats)/sizeof(formats[0])) {
+ file_magwarn("Internal error inconsistency between m->type"
+ " and format strings");
+ return 0;
+ }
+ if (formats[m->type] == NULL) {
+ file_magwarn("No format string for `%s' with description `%s'",
+ m->desc, names[m->type]);
+ return 0;
+ }
+ for (; *ptr; ptr++) {
+ if (*ptr == 'l' || *ptr == 'h') {
+ /* XXX: we should really fix this one day */
+ continue;
+ }
+ if (islower((unsigned char)*ptr) || *ptr == 'X')
+ break;
+ }
+ if (*ptr == '\0') {
+ /* Missing format string; bad */
+ file_magwarn("Invalid format `%s' for type `%s'",
+ m->desc, names[m->type]);
+ return 0;
+ }
+ if (strchr(formats[m->type], *ptr) == NULL) {
+ file_magwarn("Printf format `%c' is not valid for type `%s'"
+ " in description `%s'",
+ *ptr, names[m->type], m->desc);
+ return 0;
+ }
+ return 1;
+}
+
/*
* Read a numeric value from a pointer, into the value union of a magic
* pointer, according to the magic type. Update the string pointer to point
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
-#undef HAVE_LIBZ
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: compress.c,v 1.36 2004/03/22 19:11:54 christos Exp $")
+FILE_RCSID("@(#)$Id: compress.c,v 1.37 2004/07/24 21:00:56 christos Exp $")
#endif
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.92 2004/03/22 21:34:39 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.93 2004/04/07 14:23:55 christos Exp $")
#endif /* lint */
size_t
file_mbswidth(const char *s)
{
-#ifdef HAVE_WCHAR_H
+#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
size_t bytesconsumed, old_n, n, width = 0;
mbstate_t state;
wchar_t nextchar;
*/
/*
* file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.60 2004/03/22 19:12:15 christos Exp $
+ * @(#)$Id: file.h,v 1.61 2004/05/12 14:53:01 christos Exp $
*/
#ifndef __file_h__
#define FILE_BELDATE 15
#define FILE_LELDATE 16
#define FILE_REGEX 17
+
+#define FILE_FORMAT_NAME \
+/* 0 */ "invalid 0", \
+/* 1 */ "byte", \
+/* 2 */ "short", \
+/* 3 */ "invalid 3", \
+/* 4 */ "long", \
+/* 5 */ "string", \
+/* 6 */ "date", \
+/* 7 */ "beshort", \
+/* 8 */ "belong", \
+/* 9 */ "bedate" \
+/* 10 */ "leshort", \
+/* 11 */ "lelong", \
+/* 12 */ "ledate", \
+/* 13 */ "pstring", \
+/* 14 */ "ldate", \
+/* 15 */ "beldate", \
+/* 16 */ "leldate", \
+/* 17 */ "regex",
+
+#define FILE_FMT_NUM "cduxXi"
+#define FILE_FMT_STR "s"
+
+#define FILE_FORMAT_STRING \
+/* 0 */ NULL, \
+/* 1 */ FILE_FMT_NUM, \
+/* 2 */ FILE_FMT_NUM, \
+/* 3 */ NULL, \
+/* 4 */ FILE_FMT_NUM, \
+/* 5 */ FILE_FMT_STR, \
+/* 6 */ FILE_FMT_STR, \
+/* 7 */ FILE_FMT_NUM, \
+/* 8 */ FILE_FMT_NUM, \
+/* 9 */ FILE_FMT_STR, \
+/* 10 */ FILE_FMT_NUM, \
+/* 11 */ FILE_FMT_NUM, \
+/* 12 */ FILE_FMT_STR, \
+/* 13 */ FILE_FMT_STR, \
+/* 14 */ FILE_FMT_STR, \
+/* 15 */ FILE_FMT_STR, \
+/* 16 */ FILE_FMT_STR, \
+/* 17 */ FILE_FMT_STR,
+
/* Word 3 */
uint8_t in_op; /* operator for indirection */
uint8_t mask_op; /* operator for mask */
#include <ctype.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: funcs.c,v 1.11 2003/11/11 20:01:46 christos Exp $")
+FILE_RCSID("@(#)$Id: funcs.c,v 1.12 2004/06/04 14:40:20 christos Exp $")
#endif /* lint */
/*
* Like printf, only we print to a buffer and advance it.
file_error(ms, errno, "error reading");
}
+#ifndef COMPILE_ONLY
protected int
file_buffer(struct magic_set *ms, const void *buf, size_t nb)
{
}
return m;
}
+#endif
protected int
file_reset(struct magic_set *ms)
#include <sys/mman.h>
#endif
-#if defined(HAVE_UTIME)
+#if defined(HAVE_UTIMES)
+# include <sys/time.h>
+#elif defined(HAVE_UTIME)
# if defined(HAVE_SYS_UTIME_H)
# include <sys/utime.h>
# elif defined(HAVE_UTIME_H)
# include <utime.h>
# endif
-#elif defined(HAVE_UTIMES)
-# include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: magic.c,v 1.20 2004/03/23 15:33:43 christos Exp $")
+FILE_RCSID("@(#)$Id: magic.c,v 1.22 2004/07/24 19:55:17 christos Exp $")
#endif /* lint */
#ifdef __EMX__
}
}
+#ifndef COMPILE_ONLY
/*
* find type of named file
*/
}
return file_getbuffer(ms);
}
+#endif
public const char *
magic_error(struct magic_set *ms)
#define FILE_VERSION_MAJOR 4
-#define patchlevel 9
+#define patchlevel 10
/*
* Patchlevel file for Ian Darwin's MAGIC command.
- * $Id: patchlevel.h,v 1.52 2004/04/07 00:32:25 christos Exp $
+ * $Id: patchlevel.h,v 1.53 2004/07/24 20:40:46 christos Exp $
*
* $Log: patchlevel.h,v $
+ * Revision 1.53 2004/07/24 20:40:46 christos
+ * welcome to 4.10
+ *
* Revision 1.52 2004/04/07 00:32:25 christos
* welcome to 4.09
*
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: readelf.c,v 1.39 2004/03/22 20:28:40 christos Exp $")
+FILE_RCSID("@(#)$Id: readelf.c,v 1.42 2004/07/24 20:57:22 christos Exp $")
#endif
#ifdef ELFCORE
getu32(swap, ph32.p_align) : 4) \
: (off_t) (ph64.p_align ? \
getu64(swap, ph64.p_align) : 4)))
+#define ph_filesz (size_t)((class == ELFCLASS32 \
+ ? getu32(swap, ph32.p_filesz) \
+ : getu64(swap, ph64.p_filesz)))
+#define ph_memsz (size_t)((class == ELFCLASS32 \
+ ? getu32(swap, ph32.p_memsz) \
+ : getu64(swap, ph64.p_memsz)))
#define nh_size (class == ELFCLASS32 \
? sizeof nh32 \
: sizeof nh64)
file_badseek(ms);
return -1;
}
- bufsize = read(fd, nbuf, BUFSIZ);
+ bufsize = read(fd, nbuf, sizeof(nbuf));
if (bufsize == -1) {
file_badread(ms);
return -1;
noff = offset;
doff = ELF_ALIGN(offset + namesz);
- if (offset + namesz >= size) {
+ if (offset + namesz > size) {
/*
* We're past the end of the buffer.
*/
}
offset = ELF_ALIGN(doff + descsz);
- if (offset + descsz >= size) {
+ if (offset + descsz > size) {
return offset;
}
* otherwise 1>xx
*/
if (desc / 100000 < 5) {
- if (file_printf(ms, " %d.%d", desc / 100000,
- desc / 10000 % 10) == -1)
- return size;
- if (desc / 1000 % 10 > 0)
- if (file_printf(ms, ".%d", desc / 1000 % 10)
- == -1)
+ if (desc / 10000 % 10 == 9) {
+ if (file_printf(ms, " %d.%d", desc / 100000,
+ 9 + desc / 1000 % 10) == -1)
+ return size;
+ } else {
+ if (file_printf(ms, " %d.%d", desc / 100000,
+ desc / 10000 % 10) == -1)
return size;
+ if (desc / 1000 % 10 > 0)
+ if (file_printf(ms, ".%d", desc / 1000 % 10)
+ == -1)
+ return size;
+ }
+ if (desc / 10000 % 10 > 5) {
+ desc %= 1000;
+ if (desc >= 100) {
+ if (file_printf(ms, "-STABLE (rev %d)",
+ desc % 100) == -1)
+ return size;
+ } else if (desc != 0) {
+ if (file_printf(ms, ".%d", desc) == -1)
+ return size;
+ }
+ }
} else {
if (file_printf(ms, " %d.%d", desc / 100000,
desc / 1000 % 100) == -1)
return size;
desc %= 1000;
- if (desc > 100) {
+ if (desc >= 100) {
if (file_printf(ms, "-CURRENT (rev %d)",
desc % 100) == -1)
return size;
if (offset == 0)
break;
}
- if (lseek(fd, savedoffset + offset, SEEK_SET)
- == (off_t)-1) {
+ if (lseek(fd, savedoffset, SEEK_SET) == (off_t)-1) {
file_badseek(ms);
return -1;
}
#ifndef lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.65 2004/03/09 18:49:58 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.66 2004/07/24 20:38:56 christos Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
if (m->flag & INDIR) {
switch (m->in_type) {
case FILE_BYTE:
- if (m->in_offset)
+ if (m->in_offset) {
switch (m->in_op&0x7F) {
case FILE_OPAND:
offset = p->b & m->in_offset;
offset = p->b % m->in_offset;
break;
}
+ } else
+ offset = p->b;
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_BESHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = (short)((p->hs[0]<<8)|
(p->hs[1])) &
m->in_offset;
break;
}
+ } else
+ offset = (short)((p->hs[0]<<8)|
+ (p->hs[1]));
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_LESHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = (short)((p->hs[1]<<8)|
(p->hs[0])) &
m->in_offset;
break;
}
+ } else
+ offset = (short)((p->hs[1]<<8)|
+ (p->hs[0]));
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_SHORT:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = p->h & m->in_offset;
break;
offset = p->h % m->in_offset;
break;
}
+ }
+ else
+ offset = p->h;
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_BELONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = (int32_t)((p->hl[0]<<24)|
(p->hl[1]<<16)|
m->in_offset;
break;
}
+ } else
+ offset = (int32_t)((p->hl[0]<<24)|
+ (p->hl[1]<<16)|
+ (p->hl[2]<<8)|
+ (p->hl[3]));
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_LELONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = (int32_t)((p->hl[3]<<24)|
(p->hl[2]<<16)|
m->in_offset;
break;
}
+ } else
+ offset = (int32_t)((p->hl[3]<<24)|
+ (p->hl[2]<<16)|
+ (p->hl[1]<<8)|
+ (p->hl[0]));
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;
case FILE_LONG:
- if (m->in_offset)
- switch (m->in_op&0x7F) {
+ if (m->in_offset) {
+ switch (m->in_op & 0x7F) {
case FILE_OPAND:
offset = p->l & m->in_offset;
break;
* sleep;
*/
}
+ } else
+ offset = p->l;
if (m->in_op & FILE_OPINVERSE)
offset = ~offset;
break;