]> granicus.if.org Git - file/commitdiff
Not all files in directory sample/dbase are identified
authorChristos Zoulas <christos@zoulas.com>
Sat, 9 Mar 2013 22:36:00 +0000 (22:36 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 9 Mar 2013 22:36:00 +0000 (22:36 +0000)
alright (see output file dbase-5.13-old.txt and dbase-mime-5.13-old.txt)

HELP.CA1 is misidentified as "DBase 3 index file" and HELP.CA3 is
misidentified as "DBase 3 data file" because the magic line for DBase 3
inside msdos magic are too weak. In reality these files are the split files
of HELP.zip , a zip file with 12 extra Bytes of Turbo C.
For the example z-machine.bin i got beside the right message
"Infocom (Z-machine 3, Release 9 / Serial 123456)" also a wrong
identification as "DBase 3 data file (no records)".
Also all Android files (all *.xml except sybase-ianywhere-cdx.trid.xml) are
misidentified as "DBase 3 data file".
The two files umlaut-test-v2.dbf and umlaut-test-v4.dbf are not recognized
as DBase , because the magic lines test only for version 3 of dbase. And so
other versions are not found.
The first programs to create DBase files run under DOS, but nowadays such
xBase files can be created by Libre Office for example running under Linux.
So i removed test lines in msdos ( see file-5.13-msdos-xBase.diff ) and add
right test lines in database magic.
Using information from
http://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
http://www.clicketyclick.dk/databases/xbase/format/dbf.html
http://home.f1.htw-berlin.de/scheibl/db/intern/dBase.htm
i inspect at offset zero 4 byte sequence VVYYMMDD ,where month (MM) must be
in the range from 1 to 12, days (DD) in the range from 1 to 31. The lowest
DBase version (VV) is two.  By these tests Infocom game Z-machine and  the
Androids *.xml files are skipped.
Then i tried to test some reserved fields , which should be 0 . But this
does not work for offset 30 , where i found 0x3901 for T4.DBF or 0x710 for
T5.DBF andT6.DBF. So i use byte at offset 27, which was 0 for all inspected
Dbase files. This is reserved for multi-user dBASE. So i do not know if my
test is reliable for such exotic cases. After this test HELP.CA3 is
skipped.
Further long zero found at offset 24 is the result for .DBF files whereas
for.MDX files this is a low positive number , because it expresses
production flag, tag numbers(<=0x30), tag length(<=0x20), reserved byte
(NULL) . After some additional tests i display version info (VV byte) for
MDX and DBF files by subroutine xbase-type
For my examples VV is in the set (2,3,4,0x30,0x83). So i do not know if all
exotic xBase variants are described right, especially by information in
http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
Then i use the subroutine xbase-date to test and print the
creation-date and update-date (YY-DD-MM). The date information is only
stored as byte. Values below 100 should be 19YY, but i found samples were
correct interpretation is 20YY (for example umlaut-LibreOffice3.6.3.dbf)
not corresponding with information. Values equal or greater hundred should
be interpreted as 1900+VV, but at the moment they are displayed ugly as
1yy. So may be somebody can fix this problem. I also display number and
sizes
of records or tags and the name of the first item.

No xBase memo file (*.dbt *.DBT *.FPT) is identified correctly ( see output
dbt-5.13-old.txt ). This files have few characteristic sequences ( 0 or 3
at offset 16) . So i test values of some reserved bytes for the existence
of 0 or low values. For my inspected examples this works, but there may be
exist samples which contain garbage values at that points. Furthermore i
has to use some "if -else-if" constructs to match all memo file variants,
for which type and additional information is displayed by subroutine
xbase-memo-print.
After these test all memo files are identified correctly ( see output
dbt-5.13-new.txt ) except test-FoxPro_Enc.FPT, because it is an encrypted
file.

The dbase memo file adressen.dbt is is not misidentified as
"DBase 3 data file (no records)", but also characterised wrong as
"VMS Alpha executable". According to comments in vms magic files
real VMS files should look like examples vms-test6.bin or vms-test7.bin.
So i put the additional the following magic test line inside vms file.
>8 ubelong 0xec020000
After applying file-5.13-vms_dbt.diff only  vms-test*.bin are identified
correct as "VMS Alpha executable". Because i have no knowledge about VMS
an expert has to check my diff file for correctness.

The  Xbase index files t3-CHAR.NDX is misidentified as "X11 SNF font data,
LSB first". According to information found at
http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
the same 4 byte version info at offset zero should also occur at offset 104
So i add  additional test line
>104 lelong 00000004 X11 SNF font data, LSB first
to fonts magic.
Because i found no Server Natural Font (.SNF) and had no tool bdftosnf,
i could not verify these fixes made by my patch
file-5.13-fonts-X11-SNF_NDX.diff

The 2 dbase memo files T5.DBT and T6.DBT are misidentified
(see output file pcx-5.13-old.txt ) as " PCX ver. 2.5 image data" without
geometry information because these files with 0xa000000 at offset 0 match
these magic line:
0 beshort 0x0a00 PCX ver. 2.5 image data
So i patch images magic files.
According to http://de.wikipedia.org/wiki/PCX and
http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
i test for bytes 0x0a,version byte (0,2,3,4,5),compression byte flag(0,1)
and bit depth by line
0 ubelong&0xffF8fe00 0x0a000000
For real PCX files bit depth at offset 3 is greater 0. So sample DBT files
are excluded by additional test line
>3 ubyte >0
By further inspection i saw that signed values are used ,especially for
dpi, planes, coordinates, which should be always positive and not negative.
Converting 65432x10-xab.png (right identified as
PNG image data, 65432 x 10) by xnview to 65432x10-xab.pcx
gives wrong "PCX ver. 3.0 image data bounding box [0, 0] - [-105, 9], 3
planes each of 8-bit colour, 72 x 72 dpi, uncompressed"
So i replaced signed pattern by unsigned for such values.
Furthermore 60x20-v4-graytext.pcx is identified OK as "PCX for Windows
image data", but no geometry information is displayed, because original
magic does this only for PCX files with version "ver. 3.0 image data"
After applying file-5.13-images_pcx.diff test files for PCX  are identified
all right (see output file pcx-5.13-new.txt )

Unfortunately SYLLABI2.CDX and SYLLABUS.CDX are identified wrong as
"Applesoft BASIC program data" because magic test in apple magic file was
to general:
0       belong&0xff00ff 0x80000 Applesoft BASIC program data
If i understood the magic fragment right first line number is  stored
at offset 2 as leshort. For both files this value is zero, where
for real Applesoft BASIC that value should be positive in my opinion.
So with my patch file file-5.13-apple-basic.diff sent to mailing list
at 3.February 2013 these 2 examples are not misidentified any more.
But an expert for Applesoft BASIC should double check my diff file.
In reality these files are indices of the dBase databases with same main
name and extension dbf.

The FoxPro memo file NG.FPT is misidentifies as "MPEG sequence, v4"
because this file start with byte sequence "000001b0 00000100 00000000"
and in animation the 2 following test lines are too general:
0        belong&0xFFFFFF00  0x00000100
>3       byte               0xB0           MPEG sequence, v4
For me it seems that non zero byte at offset 4 describes the variant like
for example "simple @ L1". If this is a true NG.FPT could be differed from
MGEP by the following additional  line
>>4      byte               !0             MPEG sequence, v4
Because i have no knowledge for MEG files i add this line only as comment
line (file-5.13-animation-NG_FPT.diff). So an expert has to revise this
things.

The dBASE memo file biblio.dbt is misidentified as "Dyalog APL"
because "0 byte 0xaa" is a too weak magic pattern.
 Also Dyalog-test3.bin is characterised as "Dyalog APL workspace type 0
subtype 0 32-bit classic big-endian Dyalog APL workspace version 0 .0\012-
Dyalog APL". Three "Dyalog APL" entries does not make sense in my opinion.
Also the version format "0 .0" should appear as "n.m". Unfortunately i do
not have knowledge about  Dyalog APL. So an expert has to revise the
dyadic magic file and fix this very erroneous file.

After changing database magic by file-5.13-database-xBase.diff
and applying the other patches i got finally a much more correcter
classification (see output  dbase-5.13-new.txt and
dbase-mime-5.13-new.txt ).
There are still some files that are not identified. So to do is DBASE index
file *.NDX, DBASE Compound Index file *.CDX, dBASE IV Printer Driver *.PRF.
Maybe i will do it in the future

All diffs, output and sample files are stored under
http://mitglied.multimania.de/jenderek/file/

magic/Magdir/animation
magic/Magdir/apple
magic/Magdir/database
magic/Magdir/fonts
magic/Magdir/images
magic/Magdir/msdos
magic/Magdir/vms

index 72a48fc30fc510eb12578f41ba13c1e685ec1976..a21179e3537d2f330cabb14a8c76824f76725d2a 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.46 2012/08/26 10:43:05 christos Exp $
+# $File: animation,v 1.47 2013/02/06 14:18:52 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
 >>4      byte               77             \b, main
 >>4      byte               88             \b, extended
 >>6      byte               x              \b @ L %u
+# GRR too general as it catches also FoxPro Memo example NG.FPT
 >3       byte               0xB0           MPEG sequence, v4
+# TODO: maybe this extra line exclude FoxPro Memo example NG.FPT starting with 000001b0 00000100 00000000
+#>>4      byte               !0             MPEG sequence, v4
 !:mime  video/mpeg4-generic
 >>5      belong             0x000001B5
 >>>9     byte               &0x80
index 634b4bbebd1e56c89e9371079dbd9b9446053c23..cbf42375934a31d06186f2d5d211d5b1dda2266f 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.25 2012/04/06 21:18:09 christos Exp $
+# $File: apple,v 1.26 2012/12/27 15:43:23 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0      search/1/t      FiLeStArTfIlEsTaRt      binscii (apple ][) text
 # This is incredibly sloppy, but will be true if the program was
 # written at its usual memory location of 2048 and its first line
 # number is less than 256.  Yuck.
+# update by Joerg Jenderek at Feb 2013
 
-0       belong&0xff00ff 0x80000 Applesoft BASIC program data
+# GRR: this test is still too general as it catches also Gujin BOOT144.SYS (0xfa080000)
+#0       belong&0xff00ff 0x80000 Applesoft BASIC program data
+0      belong&0x00ff00ff       0x00080000      
+# assuming that line number must be positive
+>2     leshort                 >0              Applesoft BASIC program data, first line number %d
 #>2     leshort         x       \b, first line number %d
 
 # ORCA/EZ assembler:
index dec4cac015fa241d31e972e93fa179c788476f7a..a44ecb79d9225edafdb83ceaa55c326a71399335 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: database,v 1.31 2013/01/16 13:53:10 christos Exp $
+# $File: database,v 1.32 2013/02/06 14:18:52 christos Exp $
 # database:  file(1) magic for various databases
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
 #>>>0x04         byte          8       incrementing secondary index .XGn file 
 
 ## XBase database files
-#0      byte       0x02        
-#>8     leshort          >0
-#>>12   leshort    0   FoxBase 
-#!:mime        application/x-dbf
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
+# updated by Joerg Jenderek at Feb 2013
+# http://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
+# http://www.clicketyclick.dk/databases/xbase/format/dbf.html
+# http://home.f1.htw-berlin.de/scheibl/db/intern/dBase.htm
+# inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
+0      ubelong&0x0000FFFF              <0x00000C20     
+# skip Infocom game Z-machine
+>2             ubyte                   >0              
+# skip Androids *.xml
+>>3            ubyte                   >0              
+>>>3           ubyte                   <32             
+# 1 < version VV
+>>>>0          ubyte                   >1              
+# skip HELP.CA3 by test for reserved byte ( NULL )
+>>>>>27                ubyte                   0               
+# reserved bytes not always 0 ; also found 0x3901 (T4.DBF) ,0x7101 (T5.DBF,T6.DBF)
+#>>>>>30               ubeshort                x               30NULL?%x
+# possible production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL) 
+>>>>>>24       ubelong&0xffFFFFff      >0x01302000     
+# .DBF or .MDX
+>>>>>>24       ubelong&0xffFFFFff      <0x01302001     
+# for Xbase Database file (*.DBF) reserved (NULL) for multi-user
+>>>>>>>24      ubelong&0xffFFFFff      =0              
+# test for 2 reserved NULL bytes,transaction and encryption byte flag
+>>>>>>>>12     ubelong&0xFFFFfEfE      0               
+# test for MDX flag
+>>>>>>>>>28    ubyte                   x               
+>>>>>>>>>28    ubyte&0xf8              0               
+# header size >= 32
+>>>>>>>>>>8    uleshort                >31             
+# skip PIC15736.PCX by test for language driver name or field name
+>>>>>>>>>>>32  ubyte                   >0              
+!:mime application/x-dbf
+#!:mime        application/x-dbf; charset=unknown-8bit ??
+#!:mime        application/x-dbase
+>>>>>>>>>>>>0  use                     xbase-type
+# database file
+>>>>>>>>>>>>0  ubyte                   x               \b DBF
+>>>>>>>>>>>>4  lelong                  0               \b, no records
+>>>>>>>>>>>>4  lelong                  >0              \b, %ld record
+# plural s appended
+>>>>>>>>>>>>>4 lelong                  >1              \bs
+# http://www.clicketyclick.dk/databases/xbase/format/dbf_check.html#CHECK_DBF
+# 1 <= record size <= 4000 (dBase 3,4) or 32 * KB (=0x8000)
+>>>>>>>>>>>>10 uleshort                x               * %d
+# file size = records * record size + header size
+>>>>>>>>>>>>1  ubyte                   x               \b, update-date
+>>>>>>>>>>>>1  use                     xbase-date
+# http://msdn.microsoft.com/de-de/library/cc483186(v=vs.71).aspx
+#>>>>>>>>>>>>29        ubyte                   =0              \b, codepage ID=0x%x
+# 2~cp850 , 3~cp1252 , 0x1b~?? ; what code page is 0x1b ?
+>>>>>>>>>>>>29 ubyte                   >0              \b, codepage ID=0x%x
+#>>>>>>>>>>>>28        ubyte&0x01              0               \b, no index file
+>>>>>>>>>>>>28 ubyte&0x01              1               \b, with index file .MDX
+>>>>>>>>>>>>28 ubyte&0x02              2               \b, with memo .FPT
+>>>>>>>>>>>>28 ubyte&0x04              4               \b, DataBaseContainer
+# 1st record offset + 1 = header size
+>>>>>>>>>>>>8  uleshort                >0              
+>>>>>>>>>>>>(8.s+1)    ubyte           >0              
+>>>>>>>>>>>>>8         uleshort        >0              \b, at offset %d
+>>>>>>>>>>>>>(8.s+1)   ubyte           >0              
+>>>>>>>>>>>>>>&-1      string          >\0             1st record "%s"
+# for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL) 
+>>>>>>>24      ubelong&0x0133f7ff      >0              
+# test for reserved NULL byte
+>>>>>>>>47     ubyte                   x               
+# test for valid TAG key format (0x10 or 0)
+>>>>>>>>>559   ubyte&0xeF              0               
+# test MM <= 12
+>>>>>>>>>45    ubeshort                <0x0C20         
+>>>>>>>>>>45   ubyte                   >0              
+>>>>>>>>>>>46  ubyte                   <32             
+>>>>>>>>>>>>46 ubyte                   >0              
+#!:mime        application/x-mdx
+>>>>>>>>>>>>>0 use                     xbase-type
+>>>>>>>>>>>>>0 ubyte                   x               \b MDX
+>>>>>>>>>>>>>1 ubyte                   x               \b, creation-date
+>>>>>>>>>>>>>1 use                     xbase-date
+>>>>>>>>>>>>>44        ubyte                   x               \b, update-date
+>>>>>>>>>>>>>44        use                     xbase-date
+# No.of tags in use (1,2,5,12)
+>>>>>>>>>>>>>28        uleshort                x               \b, %d
+# No. of entries in tag (0x30)
+>>>>>>>>>>>>>25        ubyte                   x               \b/%d tags
+#  Length of tag
+>>>>>>>>>>>>>26        ubyte                   x               * %d
+# 1st tag name_
+>>>>>>>>>>>>>548       string          x               \b, 1st tag "%.11s"
+# 2nd tag name
+#>>>>>>>>>>>>(26.b+548)        string          x               \b, 2nd tag "%.11s"
 #
-#0      byte       0x03        
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   FoxBase+, FoxPro, dBaseIII+, dBaseIV, no memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x04        
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   dBASE IV no memo file 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x05        
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   dBASE V no memo file 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x30
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   Visual FoxPro 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x43
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   FlagShip with memo var size 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x7b
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   dBASEIV with memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x83        
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   FoxBase+, dBaseIII+ with memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x8b
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   dBaseIV with memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0x8e        
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   dBaseIV with SQL Table 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0xb3
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   FlagShip with .dbt memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0      byte       0xf5
-#!:mime        application/x-dbf
-#>8     leshort          >0
-#>>12   leshort    0   FoxPro with memo 
-#>>>0x04       lelong          0               (no records)
-#>>>0x04       lelong          >0              (%ld records)
-#
-#0     leshort         0x0006          DBase 3 index file
+#              Print the xBase names of different version variants 
+0      name                            xbase-type
+>0     ubyte           <2              
+# 1 < version
+>0     ubyte           >1              
+>>0    ubyte           0x02            FoxBase
+# FoxBase+/dBaseIII+, no memo
+>>0    ubyte           0x03            FoxBase+/dBase III
+# dBASE IV no memo file
+>>0    ubyte           0x04            dBase IV
+# dBASE V no memo file
+>>0    ubyte           0x05            dBase V
+>>0    ubyte           0x30            Visual FoxPro
+>>0    ubyte           0x31            Visual FoxPro, autoincrement
+# Visual FoxPro, with field type Varchar or Varbinary
+>>0    ubyte           0x32            Visual FoxPro, with field type Varchar
+# dBASE IV SQL, no memo;dbv memo var size (Flagship)
+>>0    ubyte           0x43            dBase IV, with SQL table
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0x62            dBase IV, with SQL table
+# dBASE IV, with memo!!
+>>0    ubyte           0x7b            dBase IV, with memo
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0x82            dBase IV, with SQL system
+# FoxBase+/dBaseIII+ with memo .DBT!
+>>0    ubyte           0x83            FoxBase+/dBase III, with memo .DBT
+# VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
+>>0    ubyte           0x87            VISUAL OBJECTS, with memo file
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0x8A            FoxBase+/dBase III, with memo .DBT
+# dBASE IV with memo!
+>>0    ubyte           0x8B            dBase IV, with memo .DBT
+# dBase IV with SQL Table,no memo?
+>>0    ubyte           0x8E            dBase IV, with SQL table
+# .dbv and .dbt memo (Flagship)?
+>>0    ubyte           0xB3            Flagship
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0xCA            dBase IV with memo .DBT
+# dBASE IV with SQL table, with memo .DBT
+>>0    ubyte           0xCB            dBase IV with SQL table, with memo .DBT
+# HiPer-Six format;Clipper SIX, with SMT memo file             
+>>0    ubyte           0xE5            Clipper SIX with memo
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0xF4            dBase IV, with SQL table, with memo
+>>0    ubyte           0xF5            FoxPro with memo
+# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+#>>0   ubyte           0xFA            FoxPro 2.x, with memo
+# unkown version (should not happen)
+>>0    default         x               xBase
+>>>0   ubyte           x               (0x%x)
+# flags in version byte
+# DBT flag (with dBASE III memo .DBT)!!
+# >>0  ubyte&0x80      >0              DBT_FLAG=%x
+# memo flag ??
+# >>0  ubyte&0x08      >0              MEMO_FLAG=%x
+# SQL flag ??
+# >>0  ubyte&0x70      >0              SQL_FLAG=%x
+#              test and print the date of xBase .DBF .MDX
+0      name                            xbase-date
+# inspect YYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
+>0     ubelong         x               
+>1     ubyte           <13             
+>>1    ubyte           >0              
+>>>2   ubyte           >0              
+>>>>2  ubyte           <32             
+>>>>>0 ubyte           x               
+# YY is interpreted as 20YY or 19YY
+>>>>>>0        ubyte           <100            \b %.2d
+# YY is interpreted 1900+YY; TODO: display yy or 20yy instead 1YY
+>>>>>>0        ubyte           >99             \b %d
+>>>>>1 ubyte           x               \b-%d
+>>>>>2 ubyte           x               \b-%d
+
+#      dBase memo files .DBT or .FPT
+# http://msdn.microsoft.com/en-us/library/8599s21w(v=vs.80).aspx
+16             ubyte           <4              
+>16            ubyte           !2              
+>>16           ubyte           !1              
+# next free block index is positive
+>>>0           ulelong         >0              
+# skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
+>>>>17         ubelong&0xFFfdFE00      0x00000000      
+# skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
+>>>>>20                ubelong&0xFF01209B      0x00000000      
+# dBASE III
+>>>>>>16       ubyte           3               
+# dBASE III DBT
+>>>>>>>0       use             xbase-memo-print
+# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage
+>>>>>>16       ubyte           0               
+# dBASE IV DBT with DBF name or DBF garbage
+>>>>>>>8       ubelong         >0x40000000     
+# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block
+>>>>>>>>0      ulelong         <0x01010002     
+>>>>>>>>>0     use             xbase-memo-print
+>>>>>>>8       ubelong         0               
+# skip MM*DD*.bin by test for for reserved NULL byte
+>>>>>>>>508    ubelong         0               
+>>>>>>>>>0     use             xbase-memo-print
+# garbage PCX , ZIP , JAR , XPI 
+>>>>>>>8       default         x               
+
+#              Print the information of dBase DBT or FoxPro FPT memo files 
+0      name                            xbase-memo-print
+>0     ubyte                   x               
+# test version
+# memo file
+>>16   ubyte                   3               dBase III DBT
+>>16   ubyte                   0               
+>>>512 ubelong                 <0x00000003     FoxPro FPT
+# Size of blocks for FoxPro
+>>>>6  ubeshort                x               \b, blocks size %lu
+# Number of next available block for appending data for FoxPro
+>>>>0  ubelong                 =0              \b, next free block index %lu
+>>>>0  ubelong                 !0              \b, next free block index %lu
+>>>512 default                 x               dBase IV DBT
+# DBF file name without extention 
+>>>>8  string                  >\0             \b of %-.8s.DBF
+# size of blocks  ; not reliable 0x2020204C
+#>>>>4 ulelong                 =0              \b, blocks size %lu
+>>>>4  ulelong                 !0              \b, blocks size %lu
+# Block length found 0 , 512
+#>>>>20        uleshort                =0              \b, block length %u
+>>>>20 uleshort                !0              \b, block length %u
+# Number of next available block for appending data
+>>>>0  ulelong                 =0              \b, next free block index %lu
+>>>>0  ulelong                 !0              \b, next free block index %lu
+>>512  ubelong                 x               
+>>>512 ubelong                 =0xFFFF0800     
+>>>>520        string                  >\0             \b, 1st used item "%s"
+# FoxPro
+>>>512 ubelong                 <3              
+# FoxPro memo
+>>>>512        ubelong                 =1              
+>>>>520        string                  >\0             \b, 1st used item "%s"
+>>>512 default                 x               
+# may be deleted memo field
+>>>>512        string                  >\0             \b, 1st item "%s"
+
+# TODO: 
+# DBASE index file *.NDX
+# DBASE Compound Index file *.CDX
+# dBASE IV Printer Driver *.PRF
+## End of XBase database stuff
 
 # MS Access database
 4      string  Standard\ Jet\ DB       Microsoft Access Database
index f0639e421bd8e9b97d901a02b08428b71579800a..da783ed468874e9d6ee7028e081e7d0650c4e9f2 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.24 2012/08/26 10:32:10 christos Exp $
+# $File: fonts,v 1.25 2013/02/06 14:18:52 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0      search/1        FONT            ASCII vfont text
 0      string          %!PS-Adobe-3.0\ Resource-Font   PostScript Type 1 font text
 
 # X11 font files in SNF (Server Natural Format) format
+# updated by Joerg Jenderek at Feb 2013
+# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
 0      belong          00000004                X11 SNF font data, MSB first
-0      lelong          00000004                X11 SNF font data, LSB first
+#>104  belong          00000004                X11 SNF font data, MSB first
+!:mime application/x-font-sfn
+# GRR: line below too general as it catches also Xbase index file t3-CHAR.NDX
+0      lelong          00000004                
+>104   lelong          00000004                X11 SNF font data, LSB first
+!:mime application/x-font-sfn
 
 # X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
 0      search/1        STARTFONT\              X11 BDF font text
index befc0ee130b4cbdd6f52e3cfd013481b45b98d18..d3e5ef8c5dd9194001ee059e2bcd11413a0bd6f6 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.79 2012/12/18 17:28:44 christos Exp $
+# $File: images,v 1.80 2013/02/06 14:18:52 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
 
 # PCX image files
 # From: Dan Fandrich <dan@coneharvesters.com>
-0      beshort         0x0a00  PCX ver. 2.5 image data
-0      beshort         0x0a02  PCX ver. 2.8 image data, with palette
-0      beshort         0x0a03  PCX ver. 2.8 image data, without palette
-0      beshort         0x0a04  PCX for Windows image data
-0      beshort         0x0a05  PCX ver. 3.0 image data
->4     leshort         x      bounding box [%hd,
->6     leshort         x      %hd] -
->8     leshort         x      [%hd,
->10    leshort         x      %hd],
->65    byte            >1      %d planes each of
->3     byte            x       %hhd-bit
->68    byte            0       image,
->68    byte            1       colour,
->68    byte            2       grayscale,
->68    byte            >2      image,
->68    byte            <0      image,
->12    leshort         >0      %hd x
->>14   leshort         x      %hd dpi,
->2     byte            0       uncompressed
->2     byte            1       RLE compressed
+# updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
+# http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
+# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
+# test for bytes 0x0a,version byte (0,2,3,4,5),compression byte flag(0,1), bit depth (>0) of PCX or T5.DBT,T6.DBT
+0      ubelong&0xffF8fe00      0x0a000000      
+# for PCX bit depth > 0 
+>3     ubyte           >0      
+# test for valid versions
+>>1    ubyte           <6      
+>>>1   ubyte           !1      PCX
+!:mime image/x-pcx
+#!:mime        image/pcx
+>>>>1  ubyte           0       ver. 2.5 image data
+>>>>1  ubyte           2       ver. 2.8 image data, with palette
+>>>>1  ubyte           3       ver. 2.8 image data, without palette
+>>>>1  ubyte           4       for Windows image data
+>>>>1  ubyte           5       ver. 3.0 image data
+>>>>4  uleshort        x       bounding box [%hd,
+>>>>6  uleshort        x       %d] -
+>>>>8  uleshort        x       [%d,
+>>>>10 uleshort        x       %d],
+>>>>65 ubyte           >1      %d planes each of
+>>>>3  ubyte           x       %d-bit
+>>>>68 byte            1       colour,
+>>>>68 byte            2       grayscale,
+# this should not happen
+>>>>68 default         x       image,
+>>>>12 leshort         >0      %d x
+>>>>>14        uleshort        x       %d dpi,
+>>>>2  byte            0       uncompressed
+>>>>2  byte            1       RLE compressed
 
 # Adobe Photoshop
 # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
index b49ea0eec3a8592f775833c440607a6a828365f1..8f3e532529c7d8c0952cc4803428bf8cd60a0d87 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.83 2012/11/13 14:55:44 christos Exp $
+# $File: msdos,v 1.84 2013/02/05 13:55:22 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
 0      lelong          0x08086b70      TurboC BGI file
 0      lelong          0x08084b50      TurboC Font file
 
-# WARNING: below line conflicts with Infocom game data Z-machine 3
-0      byte            0x03
->0x02  byte            <0x13           DBase 3 data file
->>0x04 lelong          0               (no records)
->>0x04 lelong          >0              (%ld records)
-0      byte            0x83
->0x02  byte            <0x13           DBase 3 data file with memo(s)
->>0x04 lelong          0               (no records)
->>0x04 lelong          >0              (%ld records)
-0      leshort         0x0006          DBase 3 index file
+# tests for DBase files moved, updated and merged to database
+
 0      string          PMCC            Windows 3.x .GRP file
 1      string          RDC-meg         MegaDots 
 >8     byte            >0x2F           version %c
index f255fb3084f67c24e6e251701ac1559cb28ab70f..7b9ceef6c120f2cf25b4184f1f744f7a13375942 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File$
+# $File: vms,v 1.6 2009/09/19 16:28:13 christos Exp $
 # vms:  file(1) magic for VMS executables (experimental)
 #
 # VMS .exe formats, both VAX and AXP (Greg Roelofs, newt@uchicago.edu)
@@ -24,5 +24,7 @@
 #   00030  00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00  ................
 #   00040  00 00 00 00 ff ff ff ff  ff ff ff ff 02 00 00 00  ................
 #
-0      belong  0x03000000      VMS Alpha executable
->75264 string  PK\003\004      \b, Info-ZIP SFX archive v5.12 w/decryption
+# GRR this test is still too general as it catches example adressen.dbt
+0      belong  0x03000000      
+>8     ubelong 0xec020000      VMS Alpha executable
+>>75264        string  PK\003\004      \b, Info-ZIP SFX archive v5.12 w/decryption