diff --git a/contrib/file/Magdir/adi b/contrib/file/Magdir/adi new file mode 100644 index 000000000000..12d7da59bcde --- /dev/null +++ b/contrib/file/Magdir/adi @@ -0,0 +1,12 @@ + +#------------------------------------------------------------------------------ +# adi: file(1) magic for ADi's objects +# From Gregory McGarry +# +0 leshort 0x521c COFF DSP21k +>18 lelong &02 executable, +>18 lelong ^02 +>>18 lelong &01 static object, +>>18 lelong ^01 relocatable object, +>18 lelong &010 stripped +>18 lelong ^010 not stripped diff --git a/contrib/file/Magdir/animation b/contrib/file/Magdir/animation index ea69ecc08f51..6fa689f8f841 100644 --- a/contrib/file/Magdir/animation +++ b/contrib/file/Magdir/animation @@ -159,14 +159,12 @@ 0 belong&0xFF5FFF1F 0x47400010 MPEG transport stream data >188 byte !0x47 CORRUPTED -# ATARI ST relocatable PRG -# -# from Oskar Schirmer Feb 3, 2001 -# (according to Roland Waldi, Oct 21, 1987) -# besides the magic 0x601a, the text segment size is checked to be -# not larger than 1 MB (which is a lot on ST). -0 belong&0xFFFFFFF0 0x601A0000 Atari ST M68K executable ->2 belong x (txt=%ld, ->6 belong x dat=%ld, ->10 belong x bss=%ld, ->14 belong x sym=%ld) +# DIF digital video file format +0 belong&0xffffff00 0x1f070000 DIF +>4 byte &0x01 (DVCPRO) movie file +>4 byte ^0x01 (DV) movie file +>3 byte &0x80 (PAL) +>3 byte ^0x80 (NTSC) + +# Microsoft Advanced Streaming Format (ASF) +0 belong 0x3026b275 Microsoft ASF diff --git a/contrib/file/Magdir/archive b/contrib/file/Magdir/archive index ebc8931bfe5f..7e98240698ad 100644 --- a/contrib/file/Magdir/archive +++ b/contrib/file/Magdir/archive @@ -182,6 +182,8 @@ 2 string -lh3- LHa 2.x? archive data [lh3] 2 string -lh4- LHa (2.x) archive data [lh4] 2 string -lh5- LHa (2.x) archive data [lh5] +2 string -lh6- LHa (2.x) archive data [lh6] +2 string -lh7- LHa (2.x) archive data [lh7] >20 byte x - header level %d # RAR archiver (Greg Roelofs, newt@uchicago.edu) diff --git a/contrib/file/Magdir/audio b/contrib/file/Magdir/audio index 0ee9f1fd9938..65988f1e10ec 100644 --- a/contrib/file/Magdir/audio +++ b/contrib/file/Magdir/audio @@ -120,12 +120,12 @@ >14 beshort >1 %d songs, >16 beshort >0 default song: %d - # IRCAM -0 belong 0x64a30400 IRCAM file (NeXT) +# VAX and MIPS files are little-endian; Sun and NeXT are big-endian +0 belong 0x64a30100 IRCAM file (VAX) 0 belong 0x64a30200 IRCAM file (Sun) 0 belong 0x64a30300 IRCAM file (MIPS little-endian) -0 belong 0x0001a364 IRCAM file +0 belong 0x64a30400 IRCAM file (NeXT) # NIST SPHERE 0 string NIST_1A\n\ \ \ 1024\n NIST SPHERE file @@ -138,3 +138,7 @@ # From Felix von Leitner 0 string OggS Ogg-Vorbis compressed sound file + +# SGI SoundTrack +0 string _SGI_SoundTrack SGI SoundTrack project file +0 string ID3 mp3 file with ID3 2.0 tag diff --git a/contrib/file/Magdir/database b/contrib/file/Magdir/database index 60058a61bce2..87ecac704dba 100644 --- a/contrib/file/Magdir/database +++ b/contrib/file/Magdir/database @@ -67,4 +67,8 @@ >16 belong >0 (Queue, version %d, big-endian) 12 lelong 0x00042253 Berkeley DB >16 lelong >0 (Queue, version %d, little-endian) - +# +# +# Round Robin Database Tool by Tobias Oetiker +0 string RRD RRDTool DB +>4 string x version %s diff --git a/contrib/file/Magdir/elf b/contrib/file/Magdir/elf index d228d9f52769..4b784870eda8 100644 --- a/contrib/file/Magdir/elf +++ b/contrib/file/Magdir/elf @@ -90,23 +90,6 @@ >>20 lelong 0 invalid version >>20 lelong 1 version 1 >>36 lelong 1 MathCoPro/FPU/MAU Required ->8 string >\0 (%s) ->8 string \0 ->>7 byte 0 (SYSV) ->>7 byte 1 (HP-UX) ->>7 byte 2 (NetBSD) ->>7 byte 3 (GNU/Linux) ->>7 byte 4 (GNU/Hurd) ->>7 byte 5 (86Open) ->>7 byte 6 (Solaris) ->>7 byte 7 (Monterey) ->>7 byte 8 (IRIX) ->>7 byte 9 (FreeBSD) ->>7 byte 10 (Tru64) ->>7 byte 11 (Novell Modesto) ->>7 byte 12 (OpenBSD) ->>7 byte 97 (ARM) ->>7 byte 255 (embedded) >5 byte 2 MSB # only for MIPS R3000_BE >>18 beshort 8 @@ -178,8 +161,26 @@ >>18 beshort 51 Stanford MIPS-X, >>18 beshort 52 Motorola Coldfire, >>18 beshort 53 Motorola M68HC12, +>>18 beshort 73 Cray NV1, >>18 beshort 75 Digital VAX, >>18 beshort 0x9026 Alpha (unofficial), >>20 belong 0 invalid version >>20 belong 1 version 1 >>36 belong 1 MathCoPro/FPU/MAU Required +>8 string >\0 (%s) +>8 string \0 +>>7 byte 0 (SYSV) +>>7 byte 1 (HP-UX) +>>7 byte 2 (NetBSD) +>>7 byte 3 (GNU/Linux) +>>7 byte 4 (GNU/Hurd) +>>7 byte 5 (86Open) +>>7 byte 6 (Solaris) +>>7 byte 7 (Monterey) +>>7 byte 8 (IRIX) +>>7 byte 9 (FreeBSD) +>>7 byte 10 (Tru64) +>>7 byte 11 (Novell Modesto) +>>7 byte 12 (OpenBSD) +>>7 byte 97 (ARM) +>>7 byte 255 (embedded) diff --git a/contrib/file/Magdir/filesystems b/contrib/file/Magdir/filesystems index 80b5ea3c8792..9b95a8ca56c4 100644 --- a/contrib/file/Magdir/filesystems +++ b/contrib/file/Magdir/filesystems @@ -61,7 +61,7 @@ 0x18b string OS/2 OS/2 Boot Manager -9564 lelong 0x00011954 Unix Fast File system, +9564 lelong 0x00011954 Unix Fast File system (little-endian), >8404 string x last mounted on %s, >9504 ledate x last checkd at %s, >8224 ledate x last writen at %s, @@ -76,6 +76,21 @@ >8320 lelong 0 TIME optimization >8320 lelong 1 SPACE optimization +9564 belong 0x00011954 Unix Fast File system (little-endian), +>8404 string x last mounted on %s, +>9504 bedate x last checkd at %s, +>8224 bedate x last writen at %s, +>8228 belong x number of blocks %d, +>8232 belong x number of data blocks %d, +>8236 belong x number of cylinder groups %d, +>8240 belong x number of basic blocks %d, +>8244 belong x number of fragment blocks %d, +>8248 belong x minimum percentage of free blocks %d, +>8252 belong x rotational delay %dms, +>8256 belong x disk rotational speed %drps, +>8320 belong 0 TIME optimization +>8320 belong 1 SPACE optimization + # ext2/ext3 filesystems - Andreas Dilger 0x438 leshort 0xEF53 Linux >0x44c lelong x rev %d diff --git a/contrib/file/Magdir/freebsd b/contrib/file/Magdir/freebsd index 99eab9cb904d..ee710fab5fd7 100644 --- a/contrib/file/Magdir/freebsd +++ b/contrib/file/Magdir/freebsd @@ -132,3 +132,12 @@ 0 belong 011421044151 ld.so hints file (Big Endian >4 belong >0 \b, version %d) >4 belong <=0 \b) + +# +# Files generated by FreeBSD scrshot(1)/vidcontrol(1) utilities +# +0 string SCRSHOT_ scrshot(1) screenshot, +>8 byte x version %d, +>9 byte 2 %d bytes in header, +>>10 byte x %d chars wide by +>>11 byte x %d chars high diff --git a/contrib/file/Magdir/images b/contrib/file/Magdir/images index 9347b45aa243..9cdc44c4987a 100644 --- a/contrib/file/Magdir/images +++ b/contrib/file/Magdir/images @@ -300,3 +300,21 @@ 0 string pM86 Atari ST STAD bitmap image data (vert) >5 byte 0x00 (white background) >5 byte 0xFF (black background) + +# SGI RICE image file +0 beshort 0x5249 RICE image +>2 beshort x v%d +>4 beshort x (%d x +>6 beshort x %d) +>8 beshort 0 8 bit +>8 beshort 1 10 bit +>8 beshort 2 12 bit +>8 beshort 3 13 bit +>10 beshort 0 4:2:2 +>10 beshort 1 4:2:2:4 +>10 beshort 2 4:4:4 +>10 beshort 3 4:4:4:4 +>12 beshort 1 RGB +>12 beshort 2 CCIR601 +>12 beshort 3 RP175 +>12 beshort 4 YUV diff --git a/contrib/file/Magdir/macintosh b/contrib/file/Magdir/macintosh index b6dc91c84704..1fb8241eb817 100644 --- a/contrib/file/Magdir/macintosh +++ b/contrib/file/Magdir/macintosh @@ -240,3 +240,96 @@ 0 string $FL2 SPSS System File >24 string x %s + +# Macintosh filesystem data +# From "Tom N Harris" +# The MacOS epoch begins on 1 Jan 1904 instead of 1 Jan 1970, so these +# entries depend on the data arithmetic added after v.35 +# There's also some Pascal strings in here, ditto... + +# The boot block signature, according to IM:Files, is +# "for HFS volumes, this field always contains the value 0x4C4B." +# But if this is true for MFS or HFS+ volumes, I don't know. +# Alternatively, the boot block is supposed to be zeroed if it's +# unused, so a simply >0 should suffice. + +0x400 beshort 0xD2D7 Macintosh MFS data +>0 beshort 0x4C4B (bootable) +>0x40a beshort &0x8000 (locked) +>0x402 beldate-0x7C25B080 x created: %s, +>0x406 beldate-0x7C25B080 >0 last backup: %s, +>0x414 belong x block size: %d, +>0x412 beshort x number of blocks: %d, +>0x424 pstring x volume name: %s + +0x400 beshort 0x4244 Macintosh HFS data +>0 beshort 0x4C4B (bootable) +>0x40a beshort &0x8000 (locked) +>0x40a beshort ^0x0100 (mounted) +>0x40a beshort &0x0800 (unclean) +>0x402 beldate-0x7C25B080 x created: %s, +>0x406 beldate-0x7C25B080 x last modified: %s, +>0x440 beldate-0x7C25B080 >0 last backup: %s, +>0x414 belong x block size: %d, +>0x412 beshort x number of blocks: %d, +>0x424 pstring x volume name: %s +#>0x480 beshort =0x482B Embedded HFS+ Volume: +#>>((0x482*(0x414))+(0x41c*512)) x \b +# Well, this is (theoretically) how we could do this. But it occurs to +# me that we likely don't read in a large enough chunk. I don't have any +# HFS+ volumes to see what a typical offset would be. + +0x400 beshort 0x482B Macintosh HFS Extended +>&2 beshort x version %d data +>0 beshort 0x4C4B (bootable) +>&4 belong ^0x00000100 (mounted) +>&4 belong &0x00000800 (unclean) +>&4 belong &0x00008000 (locked) +>&8 string x last mounted by: '%.4s', +# really, that should be treated as a belong and we print a string +# based on the value. TN1150 only mentions '8.10' for "MacOS 8.1" +>&16 beldate-0x7C25B080 x created: %s, +>&20 beldate-0x7C25B080 x last modified: %s, +>&24 beldate-0x7C25B080 >0 last backup: %s, +>&28 beldate-0x7C25B080 >0 last checked: %s, +>&40 belong x block size: %d, +>&44 belong x number of blocks: %d, +>&48 belong x free blocks: %d + +# I don't think this is really necessary since it doesn't do much and +# anything with a valid driver descriptor will also have a valid +# partition map +#0 beshort 0x4552 Apple Device Driver data +#>&24 beshort =1 \b, MacOS + +# Is that the partition type a cstring or a pstring? Well, IM says "strings +# shorter than 32 bytes must be terminated with NULL" so I'll treat it as a +# cstring. Of course, partitions can contain more than four entries, but +# what're you gonna do? +0x200 beshort 0x504D Apple Partition data +>&2 beshort x block size: %d +>&48 string x first type: %s, +>&12 belong x number of blocks: %d, +>(&0x2.S) beshort 0x504D +>>&48 string x second type: %s +>>&12 belong x number of blocks: %d, +>>(&0x2.S) beshort 0x504D +>>>&48 string x third type: %s +>>>&12 belong x number of blocks: %d, +>>>(&0x2.S) beshort 0x504D +>>>>&48 string x fourth type: %s +>>>>&12 belong x number of blocks: %d, +# AFAIK, only the signature is different +0x200 beshort 0x5453 Apple Old Partition data +>&2 beshort x block size: %d +>&48 string x first type: %s, +>&12 belong x number of blocks: %d, +>(&0x2.S) beshort 0x504D +>>&48 string x second type: %s +>>&12 belong x number of blocks: %d, +>>(&0x2.S) beshort 0x504D +>>>&48 string x third type: %s +>>>&12 belong x number of blocks: %d, +>>>(&0x2.S) beshort 0x504D +>>>>&48 string x fourth type: %s +>>>>&12 belong x number of blocks: %d, diff --git a/contrib/file/Magdir/magic b/contrib/file/Magdir/magic index a0d7b53a4705..3bf4e2ee7acb 100644 --- a/contrib/file/Magdir/magic +++ b/contrib/file/Magdir/magic @@ -4,4 +4,6 @@ # 0 string #\ Magic magic text file for file(1) cmd 0 lelong 0xF11E041C magic binary file for file(1) cmd ->4 lelong x (version %d) +>4 lelong x (version %d) (little endian) +0 belong 0xF11E041C magic binary file for file(1) cmd +>4 belong x (version %d) (big endian) diff --git a/contrib/file/Magdir/mail.news b/contrib/file/Magdir/mail.news index 9713d29b3f4f..ab8b293c3b33 100644 --- a/contrib/file/Magdir/mail.news +++ b/contrib/file/Magdir/mail.news @@ -22,3 +22,7 @@ # TNEF files... 0 lelong 0x223E9F78 Transport Neutral Encapsulation Format + +# From: Kevin Sullivan +0 string *mbx* MBX mail folder + diff --git a/contrib/file/Magdir/motorola b/contrib/file/Magdir/motorola index efed159746ed..1a3174cc600c 100644 --- a/contrib/file/Magdir/motorola +++ b/contrib/file/Magdir/motorola @@ -30,3 +30,21 @@ # # Motorola S-Records, from Gerd Truschinski 0 string S0 Motorola S-Record; binary data in text format + +# ATARI ST relocatable PRG +# +# from Oskar Schirmer Feb 3, 2001 +# (according to Roland Waldi, Oct 21, 1987) +# besides the magic 0x601a, the text segment size is checked to be +# not larger than 1 MB (which is a lot on ST). +# The additional 0x601b distinction I took from Doug Lee's magic. +0 belong&0xFFFFFFF0 0x601A0000 Atari ST M68K contiguous executable +>2 belong x (txt=%ld, +>6 belong x dat=%ld, +>10 belong x bss=%ld, +>14 belong x sym=%ld) +0 belong&0xFFFFFFF0 0x601B0000 Atari ST M68K non-contig executable +>2 belong x (txt=%ld, +>6 belong x dat=%ld, +>10 belong x bss=%ld, +>14 belong x sym=%ld) diff --git a/contrib/file/Magdir/msdos b/contrib/file/Magdir/msdos index b6804937d520..771a8fd07ae0 100644 --- a/contrib/file/Magdir/msdos +++ b/contrib/file/Magdir/msdos @@ -225,6 +225,8 @@ #ico files 0 string \102\101\050\000\000\000\056\000\000\000\000\000\000\000 Icon for ms-windows + +# Windows icons (Ian Springer ) 0 string \000\000\001\000 ms-windows icon resource >4 byte 1 - 1 icon >4 byte >1 - %d icons @@ -275,10 +277,6 @@ 0 string ! MKS Spell hash list (old format) 0 string ! MKS Spell hash list 0 string AH Halo(TM) bitmapped font file -0 leshort 0x601A Atari ST contiguous executable ->14 lelong >0 - not stripped -0 leshort 0x601B Atari ST non-contig executable ->14 lelong >0 - not stripped 0 lelong 0x08086b70 TurboC BGI file 0 lelong 0x08084b50 TurboC Font file diff --git a/contrib/file/Magdir/netbsd b/contrib/file/Magdir/netbsd index c48d903d9be6..7c260e40ff99 100644 --- a/contrib/file/Magdir/netbsd +++ b/contrib/file/Magdir/netbsd @@ -197,7 +197,7 @@ >10 leshort 0x0000 stripped 0 belong&0377777777 043200507 NetBSD/alpha core >12 string >\0 from '%s' ->32 belong !0 (signal %d) +>32 lelong !0 (signal %d) 0 belong&0377777777 043400413 NetBSD/mips demand paged >0 byte &0x80 diff --git a/contrib/file/Magdir/riff b/contrib/file/Magdir/riff index 8f1c3d0f4cfc..a81eb9352a2b 100644 --- a/contrib/file/Magdir/riff +++ b/contrib/file/Magdir/riff @@ -39,6 +39,15 @@ >8 string WAVE \b, WAVE audio >>20 leshort 1 \b, Microsoft PCM >>>34 leshort >0 \b, %d bit +>>20 leshort 2 \b, Microsoft ADPCM +>>20 leshort 6 \b, ITU G.711 a-law +>>20 leshort 7 \b, ITU G.711 u-law +>>20 leshort 17 \b, IMA ADPCM +>>20 leshort 20 \b, ITU G.723 ADPCM (Yamaha) +>>20 leshort 49 \b, GSM 6.10 +>>20 leshort 64 \b, ITU G.721 ADPCM +>>20 leshort 80 \b, MPEG +>>20 leshort 85 \b, MPEG Layer 3 >>22 leshort =1 \b, mono >>22 leshort =2 \b, stereo >>22 leshort >2 \b, %d channels diff --git a/contrib/file/Magdir/sharc b/contrib/file/Magdir/sharc new file mode 100644 index 000000000000..7201e8569320 --- /dev/null +++ b/contrib/file/Magdir/sharc @@ -0,0 +1,22 @@ + +#------------------------------------------------------------------------ +# file(1) magic for sharc files +# +# SHARC DSP, MIDI SysEx and RiscOS filetype definitions added by +# FutureGroove Music (dsp@futuregroove.de) + +#------------------------------------------------------------------------ +0 string Draw RiscOS Drawfile +0 string PACK RiscOS PackdDir archive + +#------------------------------------------------------------------------ +# SHARC DSP stuff (based on the FGM SHARC DSP SDK) + +0 string ! Assembler source +0 string Analog ADi asm listing file +0 string .SYSTEM SHARC architecture file +0 string .system SHARC architecture file + +0 leshort 0x521C SHARC COFF binary +>2 leshort >1 , %hd sections +>>12 lelong >0 , not stripped diff --git a/contrib/file/Magdir/sketch b/contrib/file/Magdir/sketch new file mode 100644 index 000000000000..d31d18464ffd --- /dev/null +++ b/contrib/file/Magdir/sketch @@ -0,0 +1,5 @@ + +#------------------------------------------------------------------------------ +# Sketch Drawings: http://sketch.sourceforge.net/ +# From: Edwin Mons +0 string ##Sketch Sketch document text diff --git a/contrib/file/Magdir/smalltalk b/contrib/file/Magdir/smalltalk new file mode 100644 index 000000000000..27353120c26e --- /dev/null +++ b/contrib/file/Magdir/smalltalk @@ -0,0 +1,23 @@ + +#----------------------------------------------- +# GNU Smalltalk image, starting at version 1.6.2 +# +0 string GSTIm\0\0 GNU Smalltalk +# little-endian +>7 byte&1 =0 LE image version +>>10 byte x %d. +>>9 byte x \b%d. +>>8 byte x \b%d +#>>12 lelong x , data: %ld +#>>16 lelong x , table: %ld +#>>20 lelong x , memory: %ld +# big-endian +>7 byte&1 =1 BE image version +>>8 byte x %d. +>>9 byte x \b%d. +>>10 byte x \b%d +#>>12 belong x , data: %ld +#>>16 belong x , table: %ld +#>>20 belong x , memory: %ld + + diff --git a/contrib/file/Magdir/sniffer b/contrib/file/Magdir/sniffer index 81cb3130c616..ccc305c836f0 100644 --- a/contrib/file/Magdir/sniffer +++ b/contrib/file/Magdir/sniffer @@ -74,7 +74,7 @@ >20 belong 3 (AX.25 >20 belong 4 (ProNET >20 belong 5 (CHAOS ->20 belong 6 (IEEE 802.x network +>20 belong 6 (Token Ring >20 belong 7 (ARCNET >20 belong 8 (SLIP >20 belong 9 (PPP @@ -83,6 +83,16 @@ >20 belong 12 (raw IP >20 belong 13 (BSD/OS SLIP >20 belong 14 (BSD/OS PPP +>20 belong 50 (PPP or Cisco HDLC +>20 belong 100 (RFC 1483 ATM +>20 belong 101 (raw IP +>20 belong 102 (BSD/OS SLIP +>20 belong 103 (BSD/OS PPP +>20 belong 104 (BSD/OS Cisco HDLC +>20 belong 105 (Linux Classical IP over ATM +>20 belong 108 (OpenBSD loopback +>20 belong 109 (OpenBSD IPSEC encrypted +>20 belong 113 (Linux "cooked" >16 belong x \b, capture length %d) 0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian) >4 leshort x - version %d @@ -93,7 +103,7 @@ >20 lelong 3 (AX.25 >20 lelong 4 (ProNET >20 lelong 5 (CHAOS ->20 lelong 6 (IEEE 802.x network +>20 lelong 6 (Token Ring >20 lelong 7 (ARCNET >20 lelong 8 (SLIP >20 lelong 9 (PPP @@ -102,6 +112,16 @@ >20 lelong 12 (raw IP >20 lelong 13 (BSD/OS SLIP >20 lelong 14 (BSD/OS PPP +>20 lelong 50 (PPP or Cisco HDLC +>20 lelong 100 (RFC 1483 ATM +>20 lelong 101 (raw IP +>20 lelong 102 (BSD/OS SLIP +>20 lelong 103 (BSD/OS PPP +>20 lelong 104 (BSD/OS Cisco HDLC +>20 lelong 105 (Linux Classical IP over ATM +>20 lelong 108 (OpenBSD loopback +>20 lelong 109 (OpenBSD IPSEC encrypted +>20 lelong 113 (Linux "cooked" >16 lelong x \b, capture length %d) # @@ -119,7 +139,7 @@ >20 belong 3 (AX.25 >20 belong 4 (ProNET >20 belong 5 (CHAOS ->20 belong 6 (IEEE 802.x network +>20 belong 6 (Token Ring >20 belong 7 (ARCNET >20 belong 8 (SLIP >20 belong 9 (PPP @@ -138,7 +158,7 @@ >20 lelong 3 (AX.25 >20 lelong 4 (ProNET >20 lelong 5 (CHAOS ->20 lelong 6 (IEEE 802.x network +>20 lelong 6 (Token Ring >20 lelong 7 (ARCNET >20 lelong 8 (SLIP >20 lelong 9 (PPP diff --git a/contrib/file/Magdir/sysex b/contrib/file/Magdir/sysex new file mode 100644 index 000000000000..9a3fe2ec246a --- /dev/null +++ b/contrib/file/Magdir/sysex @@ -0,0 +1,142 @@ +#------------------------------------------------------------------------ +# sysex: file(1) magic for MIDI sysex files +# +# +0 byte 0xF0 SysEx File - + +>1 byte 0x2f ELKA +>>3 byte 0x09 EK-44 + +>1 byte 0x3e Waldorf +>>3 byte 0x7f Microwave I + +>1 byte 0x40 Kawai +>>3 byte 0x22 K4 + +>1 byte 0x41 Roland +>>3 byte 0x14 D-50 +>>3 byte 0x2b U-220 +>>3 byte 0x02 TR-707 + +>1 byte 0x42 Korg +>>3 byte 0x19 M1 + +>1 byte 0x43 Yamaha +>1 byte 0x44 Casio +>1 byte 0x46 Kamiya +>1 byte 0x47 Akai +>1 byte 0x48 Victor +>1 byte 0x4b Fujitsu +>1 byte 0x4c Sony +>1 byte 0x4e Teac +>1 byte 0x50 Matsushita +>1 byte 0x51 Fostex +>1 byte 0x52 Zoom +>1 byte 0x54 Matsushita +>1 byte 0x57 Acoustic tech. lab. + +>1 belong&0xffffff00 0x00007400 Ta Horng +>1 belong&0xffffff00 0x00007500 e-Tek +>1 belong&0xffffff00 0x00007600 E-Voice +>1 belong&0xffffff00 0x00007700 Midisoft +>1 belong&0xffffff00 0x00007800 Q-Sound +>1 belong&0xffffff00 0x00007900 Westrex +>1 belong&0xffffff00 0x00007a00 Nvidia* +>1 belong&0xffffff00 0x00007b00 ESS +>1 belong&0xffffff00 0x00007c00 Mediatrix +>1 belong&0xffffff00 0x00007d00 Brooktree +>1 belong&0xffffff00 0x00007e00 Otari +>1 belong&0xffffff00 0x00007f00 Key Electronics +>1 belong&0xffffff00 0x00010000 Shure +>1 belong&0xffffff00 0x00010100 AuraSound +>1 belong&0xffffff00 0x00010200 Crystal +>1 belong&0xffffff00 0x00010300 Rockwell +>1 belong&0xffffff00 0x00010400 Silicon Graphics +>1 belong&0xffffff00 0x00010500 Midiman +>1 belong&0xffffff00 0x00010600 PreSonus +>1 belong&0xffffff00 0x00010800 Topaz +>1 belong&0xffffff00 0x00010900 Cast Lightning +>1 belong&0xffffff00 0x00010a00 Microsoft +>1 belong&0xffffff00 0x00010b00 Sonic Foundry +>1 belong&0xffffff00 0x00010c00 Line 6 +>1 belong&0xffffff00 0x00010d00 Beatnik Inc. +>1 belong&0xffffff00 0x00010e00 Van Koerving +>1 belong&0xffffff00 0x00010f00 Altech Systems +>1 belong&0xffffff00 0x00011000 S & S Research +>1 belong&0xffffff00 0x00011100 VLSI Technology +>1 belong&0xffffff00 0x00011200 Chromatic +>1 belong&0xffffff00 0x00011300 Sapphire +>1 belong&0xffffff00 0x00011400 IDRC +>1 belong&0xffffff00 0x00011500 Justonic Tuning +>1 belong&0xffffff00 0x00011600 TorComp +>1 belong&0xffffff00 0x00011700 Newtek Inc. +>1 belong&0xffffff00 0x00011800 Sound Sculpture +>1 belong&0xffffff00 0x00011900 Walker Technical +>1 belong&0xffffff00 0x00011a00 Digital Harmony +>1 belong&0xffffff00 0x00011b00 InVision +>1 belong&0xffffff00 0x00011c00 T-Square +>1 belong&0xffffff00 0x00011d00 Nemesys +>1 belong&0xffffff00 0x00011e00 DBX +>1 belong&0xffffff00 0x00011f00 Syndyne +>1 belong&0xffffff00 0x00012000 Bitheadz +>1 belong&0xffffff00 0x00012100 Cakewalk +>1 belong&0xffffff00 0x00012200 Staccato +>1 belong&0xffffff00 0x00012300 National Semicon. +>1 belong&0xffffff00 0x00012400 Boom Theory +>1 belong&0xffffff00 0x00012500 Virtual DSP Corp +>1 belong&0xffffff00 0x00012600 Antares +>1 belong&0xffffff00 0x00012700 Angel Software +>1 belong&0xffffff00 0x00012800 St Louis Music +>1 belong&0xffffff00 0x00012900 Lyrrus dba G-VOX +>1 belong&0xffffff00 0x00012a00 Ashley Audio +>1 belong&0xffffff00 0x00012b00 Vari-Lite +>1 belong&0xffffff00 0x00012c00 Summit Audio +>1 belong&0xffffff00 0x00012d00 Aureal Semicon. +>1 belong&0xffffff00 0x00012e00 SeaSound +>1 belong&0xffffff00 0x00012f00 U.S. Robotics +>1 belong&0xffffff00 0x00013000 Aurisis +>1 belong&0xffffff00 0x00013100 Nearfield Multimedia +>1 belong&0xffffff00 0x00013200 FM7 Inc. +>1 belong&0xffffff00 0x00013300 Swivel Systems +>1 belong&0xffffff00 0x00013400 Hyperactive +>1 belong&0xffffff00 0x00013500 MidiLite +>1 belong&0xffffff00 0x00013600 Radical +>1 belong&0xffffff00 0x00013700 Roger Linn +>1 belong&0xffffff00 0x00013800 Helicon +>1 belong&0xffffff00 0x00013900 Event +>1 belong&0xffffff00 0x00013a00 Sonic Network +>1 belong&0xffffff00 0x00013b00 Realtime Music +>1 belong&0xffffff00 0x00013c00 Apogee Digital + +>1 belong&0xffffff00 0x00202b00 Medeli Electronics +>1 belong&0xffffff00 0x00202c00 Charlie Lab +>1 belong&0xffffff00 0x00202d00 Blue Chip Music +>1 belong&0xffffff00 0x00202e00 BEE OH Corp +>1 belong&0xffffff00 0x00202f00 LG Semicon America +>1 belong&0xffffff00 0x00203000 TESI +>1 belong&0xffffff00 0x00203100 EMAGIC +>1 belong&0xffffff00 0x00203200 Behringer +>1 belong&0xffffff00 0x00203300 Access Music +>1 belong&0xffffff00 0x00203400 Synoptic +>1 belong&0xffffff00 0x00203500 Hanmesoft Corp +>1 belong&0xffffff00 0x00203600 Terratec +>1 belong&0xffffff00 0x00203700 Proel SpA +>1 belong&0xffffff00 0x00203800 IBK MIDI +>1 belong&0xffffff00 0x00203900 IRCAM +>1 belong&0xffffff00 0x00203a00 Propellerhead Software +>1 belong&0xffffff00 0x00203b00 Red Sound Systems +>1 belong&0xffffff00 0x00203c00 Electron ESI AB +>1 belong&0xffffff00 0x00203d00 Sintefex Audio +>1 belong&0xffffff00 0x00203e00 Music and More +>1 belong&0xffffff00 0x00203f00 Amsaro +>1 belong&0xffffff00 0x00204000 CDS Advanced Technology +>1 belong&0xffffff00 0x00204100 Touched by Sound +>1 belong&0xffffff00 0x00204200 DSP Arts +>1 belong&0xffffff00 0x00204300 Phil Rees Music +>1 belong&0xffffff00 0x00204400 Stamer Musikanlagen GmbH +>1 belong&0xffffff00 0x00204500 Soundart +>1 belong&0xffffff00 0x00204600 C-Mexx Software +>1 belong&0xffffff00 0x00204700 Klavis Tech. +>1 belong&0xffffff00 0x00204800 Noteheads AB + +0 string T707 Roland TR-707 Data diff --git a/contrib/file/Magdir/troff b/contrib/file/Magdir/troff index ec964e8e2b97..01ad88a0b445 100644 --- a/contrib/file/Magdir/troff +++ b/contrib/file/Magdir/troff @@ -9,6 +9,7 @@ 0 string '\\" troff or preprocessor input text 0 string '.\\" troff or preprocessor input text 0 string \\" troff or preprocessor input text +0 string ''' troff or preprocessor input text # ditroff intermediate output text 0 string x\ T ditroff output text diff --git a/contrib/file/Magdir/vorbis b/contrib/file/Magdir/vorbis new file mode 100644 index 000000000000..6e4efadc21ee --- /dev/null +++ b/contrib/file/Magdir/vorbis @@ -0,0 +1,65 @@ + +#------------------------------------------------------------------------------ +# vorbis: file(1) magic for Ogg/Vorbis files +# +# From Felix von Leitner +# Extended by Beni Cherniavsky +# +# Most (everything but the number of channels and bitrate) is commented +# out with `##' as it's not interesting to the average user. The most +# probable things advanced users would want to uncomment are probably +# the number of comments and the encoder version. +# +# --- Ogg Framing --- +0 string OggS Ogg data +>4 byte !0 UNKNOWN REVISION %u +##>4 byte 0 revision 0 +>4 byte 0 +##>>14 lelong x (Serial %lX) +# --- First vorbis packet - general header --- +>>28 string \x01vorbis \b, Vorbis audio, +>>>35 lelong !0 UNKNOWN VERSION %lu, +##>>>35 lelong 0 version 0, +>>>35 lelong 0 +>>>>39 ubyte 1 mono, +>>>>39 ubyte 2 stereo, +>>>>39 ubyte >2 %u channels, +>>>>40 lelong x %lu Hz +# Minimal, nominal and maximal bitrates specified when encoding +>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff \b, +# The above tests if at least one of these is specified: +>>>>>44 lelong !-1 +>>>>>>44 lelong x >%lu +>>>>>48 lelong !-1 +>>>>>>48 lelong x ~%lu +>>>>>52 lelong !-1 +>>>>>>52 lelong x <%lu +>>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff kbps +# -- Second vorbis header packet - the comments +>>>102 string \x03vorbis +# A kludge to read the vendor string. It's a counted string, not a +# zero-terminated one, so file(1) can't read it in a generic way. +# libVorbis is the only one existing currently, so I detect specifically +# it. The interesting value is the cvs date (8 digits decimal). +##>>>>113 string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I +##>>>>>137 string >00000000 %.8s +# Map to beta version numbers: +##>>>>>>137 string <20000508 (>>>>>137 string 20000508 (beta1/2) +##>>>>>>137 string >20000508 +##>>>>>>>137 string <20001031 (beta2-3) +##>>>>>>137 string 20001031 (beta3) +##>>>>>>137 string >20001031 +##>>>>>>>137 string <20010225 (beta3-4) +##>>>>>>137 string 20010225 (beta4) +##>>>>>>137 string >20010225 +##>>>>>>>137 string <20010615 (beta4-RC1) +##>>>>>>137 string 20010615 (RC1) +##>>>>>>137 string >20010615 (>RC1) +# Then come the comments, again length-counted (and number-counted). +# Some looping constructs and registers would allow reading them but now +# it's impossible. However we can print the number of comments present +# (skipping by the vendor string length): +##>>>>(109.l.113) lelong 0 \b, no comments +##>>>>(109.l+113) lelong >0 \b, %lu comments diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am index 5e03a74cc9ac..790951f8d3c6 100644 --- a/contrib/file/Makefile.am +++ b/contrib/file/Makefile.am @@ -6,9 +6,15 @@ bin_PROGRAMS = file data_DATA = magic magic.mime magic.mgc MAGIC = @datadir@/magic -CPPFLAGS = -DMAGIC='"$(MAGIC)"' -DQUICK +CPPFLAGS = -DMAGIC='"$(MAGIC)"' -man_MANS = file.1 magic.4 +if FSECT5 +man_MAGIC = magic.5 +else +man_MAGIC = magic.4 +endif +fsect = @fsect@ +man_MANS = file.1 $(man_MAGIC) file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ compress.c is_tar.c readelf.c print.c \ @@ -36,18 +42,18 @@ magic.mgc: magic file file.1: Makefile file.man @rm -f $@ sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ + -e s@__FSECTION__@${fsect}@g \ -e s@__VERSION__@${VERSION}@g \ -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@ -magic.4: Makefile magic.man +magic.${fsect}: Makefile magic.man @rm -f $@ sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ + -e s@__FSECTION__@${fsect}@g \ -e s@__VERSION__@${VERSION}@g \ -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@ -magic_FRAGMENTS = Magdir/adventure Magdir/allegro Magdir/alliant \ +magic_FRAGMENTS = Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant \ Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation \ Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix \ Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi \ @@ -69,7 +75,7 @@ magic_FRAGMENTS = Magdir/adventure Magdir/allegro Magdir/alliant \ Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project \ Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm \ Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent \ - Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/spectrum \ + Magdir/sgml Magdir/sketch Magdir/sniffer Magdir/softquad Magdir/spectrum \ Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x \ Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown \ Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx \ diff --git a/contrib/file/Makefile.in b/contrib/file/Makefile.in index 851b0d95601c..5fa1cd734513 100644 --- a/contrib/file/Makefile.in +++ b/contrib/file/Makefile.in @@ -72,9 +72,11 @@ bin_PROGRAMS = file data_DATA = magic magic.mime magic.mgc MAGIC = @datadir@/magic -CPPFLAGS = -DMAGIC='"$(MAGIC)"' -DQUICK - -man_MANS = file.1 magic.4 +CPPFLAGS = -DMAGIC='"$(MAGIC)"' +@FSECT5_TRUE@man_MAGIC = magic.5 +@FSECT5_FALSE@man_MAGIC = magic.4 +fsect = @fsect@ +man_MANS = file.1 $(man_MAGIC) file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c compress.c is_tar.c readelf.c print.c file.h names.h patchlevel.h readelf.h tar.h @@ -84,7 +86,7 @@ EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime Localstuff Head CLEANFILES = $(man_MANS) magic magic.mgc -magic_FRAGMENTS = Magdir/adventure Magdir/allegro Magdir/alliant Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi Magdir/c-lang Magdir/chi Magdir/cisco Magdir/claris Magdir/clipper Magdir/commands Magdir/compress Magdir/console Magdir/convex Magdir/database Magdir/diamond Magdir/diff Magdir/digital Magdir/dump Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav Magdir/gimp Magdir/gnu Magdir/grace Magdir/hp Magdir/ibm370 Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel Magdir/interleaf Magdir/island Magdir/ispell Magdir/java Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem Magdir/motorola Magdir/msdos Magdir/msvc Magdir/ncr Magdir/netbsd Magdir/netscape Magdir/news Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 Magdir/osf1 Magdir/palm Magdir/pbm Magdir/pdf Magdir/pdp Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/spectrum Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms Magdir/vmware Magdir/wordperfect Magdir/xdelta Magdir/xenix Magdir/zilog Magdir/zyxel +magic_FRAGMENTS = Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi Magdir/c-lang Magdir/chi Magdir/cisco Magdir/claris Magdir/clipper Magdir/commands Magdir/compress Magdir/console Magdir/convex Magdir/database Magdir/diamond Magdir/diff Magdir/digital Magdir/dump Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav Magdir/gimp Magdir/gnu Magdir/grace Magdir/hp Magdir/ibm370 Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel Magdir/interleaf Magdir/island Magdir/ispell Magdir/java Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem Magdir/motorola Magdir/msdos Magdir/msvc Magdir/ncr Magdir/netbsd Magdir/netscape Magdir/news Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 Magdir/osf1 Magdir/palm Magdir/pbm Magdir/pdf Magdir/pdp Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent Magdir/sgml Magdir/sketch Magdir/sniffer Magdir/softquad Magdir/spectrum Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms Magdir/vmware Magdir/wordperfect Magdir/xdelta Magdir/xenix Magdir/zilog Magdir/zyxel ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -107,6 +109,7 @@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ man1dir = $(mandir)/man1 man4dir = $(mandir)/man4 +man5dir = $(mandir)/man5 MANS = $(man_MANS) NROFF = nroff @@ -119,7 +122,7 @@ missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(file_SOURCES) OBJECTS = $(file_OBJECTS) @@ -283,12 +286,45 @@ uninstall-man4: echo " rm -f $(DESTDIR)$(man4dir)/$$inst"; \ rm -f $(DESTDIR)$(man4dir)/$$inst; \ done + +install-man5: + $(mkinstalldirs) $(DESTDIR)$(man5dir) + @list='$(man5_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.5*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ + done + +uninstall-man5: + @list='$(man5_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.5*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ + rm -f $(DESTDIR)$(man5dir)/$$inst; \ + done install-man: $(MANS) @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man4 + $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man4 install-man5 uninstall-man: @$(NORMAL_UNINSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man4 + $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man4 uninstall-man5 install-dataDATA: $(data_DATA) @$(NORMAL_INSTALL) @@ -415,7 +451,8 @@ install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \ - $(DESTDIR)$(mandir)/man4 $(DESTDIR)$(datadir) + $(DESTDIR)$(mandir)/man4 $(DESTDIR)$(mandir)/man5 \ + $(DESTDIR)$(datadir) mostlyclean-generic: @@ -459,12 +496,12 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile install-man1 uninstall-man1 install-man4 \ -uninstall-man4 install-man uninstall-man uninstall-dataDATA \ -install-dataDATA tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck all-recursive-am install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs \ +uninstall-man4 install-man5 uninstall-man5 install-man uninstall-man \ +uninstall-dataDATA install-dataDATA tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean @@ -486,14 +523,14 @@ magic.mgc: magic file file.1: Makefile file.man @rm -f $@ sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ + -e s@__FSECTION__@${fsect}@g \ -e s@__VERSION__@${VERSION}@g \ -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@ -magic.4: Makefile magic.man +magic.${fsect}: Makefile magic.man @rm -f $@ sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ + -e s@__FSECTION__@${fsect}@g \ -e s@__VERSION__@${VERSION}@g \ -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@ diff --git a/contrib/file/Makefile.std b/contrib/file/Makefile.std index cb376e69f938..5a91407e2f8b 100644 --- a/contrib/file/Makefile.std +++ b/contrib/file/Makefile.std @@ -1,6 +1,6 @@ # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile.std,v 1.10 2000/11/13 00:30:49 christos Exp $ +# @(#)$Id: Makefile.std,v 1.11 2001/07/22 21:04:15 christos Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -22,7 +22,7 @@ # # 4. This notice may not be removed or altered. # -VERSION = 3.33 +VERSION = 3.36 SHELL = /bin/sh #MAGIC = /etc/magic MAGIC = /usr/local/etc/magic diff --git a/contrib/file/acconfig.h b/contrib/file/acconfig.h index 32a9e7e2ea30..ef6e0cb6b0e1 100644 --- a/contrib/file/acconfig.h +++ b/contrib/file/acconfig.h @@ -1,8 +1,8 @@ /* Autoheader needs me */ -#define PACKAGE "file" +#undef PACKAGE /* Autoheader needs me */ -#define VERSION "3.35" +#undef VERSION /* Define if builtin ELF support is enabled. */ #undef BUILTIN_ELF diff --git a/contrib/file/aclocal.m4 b/contrib/file/aclocal.m4 index b00f3cb6fead..39c1ebc69250 100644 --- a/contrib/file/aclocal.m4 +++ b/contrib/file/aclocal.m4 @@ -205,3 +205,16 @@ for am_file in <<$1>>; do done<<>>dnl>>) changequote([,]))]) +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/contrib/file/apprentice.c b/contrib/file/apprentice.c index 4cc703d72c8d..360a6825b703 100644 --- a/contrib/file/apprentice.c +++ b/contrib/file/apprentice.c @@ -25,6 +25,7 @@ * 4. This notice may not be removed or altered. */ +#include "file.h" #include #include #include @@ -32,13 +33,13 @@ #include #ifdef QUICK #include +#include #include #include #endif -#include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.39 2001/04/24 14:40:24 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.42 2001/07/22 21:04:15 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -78,22 +79,49 @@ static void eatsize __P((char **)); static int apprentice_1 __P((const char *, int)); static int apprentice_file __P((struct magic **, uint32 *, const char *, int)); -#ifdef QUICK static void byteswap __P((struct magic *, uint32)); static void bs1 __P((struct magic *)); static uint16 swap2 __P((uint16)); static uint32 swap4 __P((uint32)); -static char * mkdbname __P((const char *)); +static char *mkdbname __P((const char *)); static int apprentice_map __P((struct magic **, uint32 *, const char *, int)); static int apprentice_compile __P((struct magic **, uint32 *, const char *, int)); -#endif static int maxmagic = 0; struct mlist mlist; +#ifdef COMPILE_ONLY +const char *magicfile; +char *progname; +int lineno; + +int main __P((int, char *[])); + +int +main(argc, argv) + int argc; + char *argv[]; +{ + int ret; + + if ((progname = strrchr(argv[0], '/')) != NULL) + progname++; + else + progname = argv[0]; + + if (argc != 2) { + (void)fprintf(stderr, "usage: %s file\n", progname); + exit(1); + } + magicfile = argv[1]; + + exit(apprentice(magicfile, COMPILE)); +} +#endif /* COMPILE_ONLY */ + /* * Handle one file. @@ -108,7 +136,6 @@ apprentice_1(fn, action) struct mlist *ml; int rv = -1; -#ifdef QUICK if (action == COMPILE) { rv = apprentice_file(&magic, &nmagic, fn, action); if (rv == 0) @@ -116,10 +143,10 @@ apprentice_1(fn, action) else return rv; } +#ifndef COMPILE_ONLY if ((rv = apprentice_map(&magic, &nmagic, fn, action)) != 0) (void)fprintf(stderr, "%s: Using regular magic file `%s'\n", progname, fn); -#endif if (rv != 0) rv = apprentice_file(&magic, &nmagic, fn, action); @@ -128,7 +155,8 @@ apprentice_1(fn, action) return rv; if ((ml = malloc(sizeof(*ml))) == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", progname); + (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, + strerror(errno)); if (action == CHECK) return -1; } @@ -145,6 +173,7 @@ apprentice_1(fn, action) mlist.prev = ml; return rv; +#endif /* COMPILE_ONLY */ } @@ -159,7 +188,8 @@ apprentice(fn, action) mlist.next = mlist.prev = &mlist; mfn = malloc(strlen(fn)+1); if (mfn == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", progname); + (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, + strerror(errno)); if (action == CHECK) return -1; else @@ -214,7 +244,8 @@ apprentice_file(magicp, nmagicp, fn, action) maxmagic = MAXMAGIS; *magicp = (struct magic *) calloc(sizeof(struct magic), maxmagic); if (*magicp == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", progname); + (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, + strerror(errno)); if (action == CHECK) return -1; } @@ -268,12 +299,16 @@ signextend(m, v) case DATE: case BEDATE: case LEDATE: + case LDATE: + case BELDATE: + case LELDATE: case LONG: case BELONG: case LELONG: v = (int32) v; break; case STRING: + case PSTRING: break; default: magwarn("can't happen: m->type=%d\n", @@ -302,8 +337,8 @@ parse(magicp, nmagicp, l, action) maxmagic += ALLOC_INCR; if ((m = (struct magic *) realloc(*magicp, sizeof(struct magic) * maxmagic)) == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", - progname); + (void) fprintf(stderr, "%s: Out of memory (%s).\n", + progname, strerror(errno)); if (*magicp) free(*magicp); if (action == CHECK) @@ -330,7 +365,7 @@ parse(magicp, nmagicp, l, action) } if (m->cont_level != 0 && *l == '&') { ++l; /* step over */ - m->flag |= ADD; + m->flag |= OFFADD; } /* get offset, then skip over it */ @@ -374,12 +409,46 @@ parse(magicp, nmagicp, l, action) } l++; } - s = l; - if (*l == '+' || *l == '-') l++; - if (isdigit((unsigned char)*l)) { - m->in_offset = strtoul(l, &t, 0); - if (*s == '-') m->in_offset = - m->in_offset; + if (*l == '~') { + m->in_op = OPINVERSE; + l++; } + switch (*l) { + case '&': + m->in_op |= OPAND; + l++; + break; + case '|': + m->in_op |= OPOR; + l++; + break; + case '^': + m->in_op |= OPXOR; + l++; + break; + case '+': + m->in_op |= OPADD; + l++; + break; + case '-': + m->in_op |= OPMINUS; + l++; + break; + case '*': + m->in_op |= OPMULTIPLY; + l++; + break; + case '/': + m->in_op |= OPDIVIDE; + l++; + break; + case '%': + m->in_op |= OPMODULO; + l++; + break; + } + if (isdigit((unsigned char)*l)) + m->in_offset = strtoul(l, &t, 0); else t = l; if (*t++ != ')') @@ -403,6 +472,10 @@ parse(magicp, nmagicp, l, action) #define NLESHORT 7 #define NLELONG 6 #define NLEDATE 6 +#define NPSTRING 7 +#define NLDATE 5 +#define NBELDATE 7 +#define NLELDATE 7 if (*l == 'u') { ++l; @@ -446,18 +519,80 @@ parse(magicp, nmagicp, l, action) } else if (strncmp(l, "ledate", NLEDATE)==0) { m->type = LEDATE; l += NLEDATE; + } else if (strncmp(l, "pstring", NPSTRING)==0) { + m->type = PSTRING; + l += NPSTRING; + } else if (strncmp(l, "ldate", NLDATE)==0) { + m->type = LDATE; + l += NLDATE; + } else if (strncmp(l, "beldate", NBELDATE)==0) { + m->type = BELDATE; + l += NBELDATE; + } else if (strncmp(l, "leldate", NLELDATE)==0) { + m->type = LELDATE; + l += NLELDATE; } else { magwarn("type %s invalid", l); return -1; } /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */ - if (*l == '&') { + /* New and improved: ~ & | ^ + - * / % -- exciting, isn't it? */ + if (*l == '~') { + if (STRING != m->type && PSTRING != m->type) + m->mask_op = OPINVERSE; + ++l; + } + switch (*l) { + case '&': + m->mask_op |= OPAND; ++l; m->mask = signextend(m, strtoul(l, &l, 0)); eatsize(&l); - } else if (STRING == m->type) { - m->mask = 0L; - if (*l == '/') { + break; + case '|': + m->mask_op |= OPOR; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '^': + m->mask_op |= OPXOR; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '+': + m->mask_op |= OPADD; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '-': + m->mask_op |= OPMINUS; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '*': + m->mask_op |= OPMULTIPLY; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '%': + m->mask_op |= OPMODULO; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + break; + case '/': + if (STRING != m->type && PSTRING != m->type) { + m->mask_op |= OPDIVIDE; + ++l; + m->mask = signextend(m, strtoul(l, &l, 0)); + eatsize(&l); + } else { + m->mask = 0L; while (!isspace(*++l)) { switch (*l) { case CHAR_IGNORE_LOWERCASE: @@ -477,8 +612,10 @@ parse(magicp, nmagicp, l, action) } } } - } else - m->mask = ~0L; + break; + } + /* We used to set mask to all 1's here, instead let's just not do anything + if mask = 0 (unless you have a better idea) */ EATAB; switch (*l) { @@ -496,7 +633,7 @@ parse(magicp, nmagicp, l, action) } break; case '!': - if (m->type != STRING) { + if (m->type != STRING && m->type != PSTRING) { m->reln = *l; ++l; break; @@ -558,7 +695,7 @@ getvalue(m, p) { int slen; - if (m->type == STRING) { + if (m->type == STRING || m->type == PSTRING) { *p = getstr(*p, m->value.s, sizeof(m->value.s), &slen); m->vallen = slen; } else @@ -780,7 +917,6 @@ eatsize(p) *p = l; } -#ifdef QUICK /* * handle an mmaped file. */ @@ -798,6 +934,9 @@ apprentice_map(magicp, nmagicp, fn, action) int needsbyteswap; char *dbname = mkdbname(fn); + if (dbname == NULL) + return -1; + if ((fd = open(dbname, O_RDONLY)) == -1) return -1; @@ -807,12 +946,25 @@ apprentice_map(magicp, nmagicp, fn, action) goto error; } +#ifdef QUICK if ((*magicp = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FILE, fd, (off_t)0)) == MAP_FAILED) { (void)fprintf(stderr, "%s: Cannot map `%s' (%s)\n", progname, dbname, strerror(errno)); goto error; } +#else + if ((*magicp = malloc((size_t)st.st_size)) == NULL) { + (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, + strerror(errno)); + goto error; + } + if (read(fd, *magicp, (size_t)st.st_size) != (size_t)st.st_size) { + (void) fprintf(stderr, "%s: Read failed (%s).\n", progname, + strerror(errno)); + goto error; + } +#endif (void)close(fd); fd = -1; ptr = (uint32 *) *magicp; @@ -844,9 +996,13 @@ apprentice_map(magicp, nmagicp, fn, action) error: if (fd != -1) (void)close(fd); - if (*magicp) + if (*magicp) { +#ifdef QUICK (void)munmap(*magicp, (size_t)st.st_size); - else { +#else + free(*magicp); +#endif + } else { *magicp = NULL; *nmagicp = 0; } @@ -869,6 +1025,9 @@ apprentice_compile(magicp, nmagicp, fn, action) MAGICNO, VERSIONNO }; + if (dbname == NULL) + return -1; + if ((fd = open(dbname, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) { (void)fprintf(stderr, "%s: Cannot open `%s' (%s)\n", progname, dbname, strerror(errno)); @@ -912,6 +1071,11 @@ mkdbname(fn) buf = malloc(len); else buf = realloc(buf, len); + if (buf == NULL) { + (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname, + strerror(errno)); + return NULL; + } (void)strcpy(buf, fn); (void)strcat(buf, ext); return buf; @@ -976,4 +1140,3 @@ void bs1(m) m->value.l = swap4(m->value.l); m->mask = swap4(m->mask); } -#endif diff --git a/contrib/file/compress.c b/contrib/file/compress.c index e84d62d27495..80d24e010c16 100644 --- a/contrib/file/compress.c +++ b/contrib/file/compress.c @@ -16,7 +16,7 @@ #include #endif #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.19 2001/03/20 04:22:02 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.20 2001/07/22 21:04:15 christos Exp $") #endif @@ -35,7 +35,7 @@ static struct { { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */ /* the standard pack utilities do not accept standard input */ { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */ - { "BZh", 3, { "bzip2", "-d", NULL }, 1 }, /* bzip2-ed */ + { "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */ }; static int ncompr = sizeof(compr) / sizeof(compr[0]); diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in index 116676b7af41..60dfc5647e9d 100644 --- a/contrib/file/config.h.in +++ b/contrib/file/config.h.in @@ -58,6 +58,9 @@ /* The number of bytes in a uint64_t. */ #define SIZEOF_UINT64_T 0 +/* Define if you have the mmap function. */ +#undef HAVE_MMAP + /* Define if you have the strerror function. */ #undef HAVE_STRERROR @@ -67,6 +70,9 @@ /* Define if you have the header file. */ #undef HAVE_LOCALE_H +/* Define if you have the header file. */ +#undef HAVE_SYS_MMAN_H + /* Define if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/contrib/file/configure b/contrib/file/configure index fae71eff30fe..6488d5fa3891 100755 --- a/contrib/file/configure +++ b/contrib/file/configure @@ -15,6 +15,8 @@ ac_help="$ac_help --disable-elf disable builtin ELF support" ac_help="$ac_help --disable-elf-core disable ELF core file support" +ac_help="$ac_help + --enable-fsect-man5 enable file formats in man section 5" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -556,7 +558,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:560: checking for a BSD compatible install" >&5 +echo "configure:562: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -609,7 +611,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:613: checking whether build environment is sane" >&5 +echo "configure:615: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -666,7 +668,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -695,7 +697,7 @@ fi PACKAGE=file -VERSION=3.35 +VERSION=3.36 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -712,7 +714,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:716: checking for working aclocal" >&5 +echo "configure:718: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -725,7 +727,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:729: checking for working autoconf" >&5 +echo "configure:731: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -738,7 +740,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:742: checking for working automake" >&5 +echo "configure:744: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -751,7 +753,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:755: checking for working autoheader" >&5 +echo "configure:757: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -764,7 +766,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:768: checking for working makeinfo" >&5 +echo "configure:770: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -782,7 +784,7 @@ fi echo $ac_n "checking for builtin ELF support""... $ac_c" 1>&6 -echo "configure:786: checking for builtin ELF support" >&5 +echo "configure:788: checking for builtin ELF support" >&5 # Check whether --enable-elf or --disable-elf was given. if test "${enable_elf+set}" = set; then enableval="$enable_elf" @@ -808,7 +810,7 @@ fi echo $ac_n "checking for ELF core file support""... $ac_c" 1>&6 -echo "configure:812: checking for ELF core file support" >&5 +echo "configure:814: checking for ELF core file support" >&5 # Check whether --enable-elf-core or --disable-elf-core was given. if test "${enable_elf_core+set}" = set; then enableval="$enable_elf_core" @@ -833,10 +835,41 @@ EOF fi +echo $ac_n "checking for file formats in man section 5""... $ac_c" 1>&6 +echo "configure:840: checking for file formats in man section 5" >&5 +# Check whether --enable-fsect-man5 or --disable-fsect-man5 was given. +if test "${enable_fsect_man5+set}" = set; then + enableval="$enable_fsect_man5" + if test "${enableval}" = yes; then + echo "$ac_t""yes" 1>&6 + fsect=5 +else + echo "$ac_t""no" 1>&6 + fsect=4 +fi +else + + # disable by default + echo "$ac_t""no" 1>&6 + fsect=4 + +fi + + + + +if test x$fsect = x5; then + FSECT5_TRUE= + FSECT5_FALSE='#' +else + FSECT5_TRUE='#' + FSECT5_FALSE= +fi + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:840: checking for $ac_word" >&5 +echo "configure:873: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -866,7 +899,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:870: checking for $ac_word" >&5 +echo "configure:903: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -917,7 +950,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:921: checking for $ac_word" >&5 +echo "configure:954: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -949,7 +982,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:953: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:986: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -960,12 +993,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 964 "configure" +#line 997 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -991,12 +1024,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:995: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1028: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1000: checking whether we are using GNU C" >&5 +echo "configure:1033: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1005,7 +1038,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1024,7 +1057,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1028: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1061: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1067,7 +1100,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1071: checking for a BSD compatible install" >&5 +echo "configure:1104: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1120,7 +1153,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1124: checking whether ln -s works" >&5 +echo "configure:1157: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1142,7 +1175,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1146: checking how to run the C preprocessor" >&5 +echo "configure:1179: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1157,13 +1190,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1174,13 +1207,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1184: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1191,13 +1224,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1222,12 +1255,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1226: checking for ANSI C header files" >&5 +echo "configure:1259: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1235,7 +1268,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1252,7 +1285,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1270,7 +1303,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1291,7 +1324,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1302,7 +1335,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1326,19 +1359,19 @@ EOF fi echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6 -echo "configure:1330: checking whether sys/types.h defines makedev" >&5 +echo "configure:1363: checking whether sys/types.h defines makedev" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_types_h_makedev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return makedev(0, 0); ; return 0; } EOF -if { (eval echo configure:1342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_sys_types_h_makedev=yes else @@ -1356,17 +1389,17 @@ echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6 if test $ac_cv_header_sys_types_h_makedev = no; then ac_safe=`echo "sys/mkdev.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/mkdev.h""... $ac_c" 1>&6 -echo "configure:1360: checking for sys/mkdev.h" >&5 +echo "configure:1393: checking for sys/mkdev.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1403: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1394,17 +1427,17 @@ fi if test $ac_cv_header_sys_mkdev_h = no; then ac_safe=`echo "sys/sysmacros.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/sysmacros.h""... $ac_c" 1>&6 -echo "configure:1398: checking for sys/sysmacros.h" >&5 +echo "configure:1431: checking for sys/sysmacros.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1432,12 +1465,12 @@ fi fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1436: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1469: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1453,7 +1486,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1477,17 +1510,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1481: checking for $ac_hdr" >&5 +echo "configure:1514: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1524: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1517,17 +1550,57 @@ for ac_hdr in locale.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1521: checking for $ac_hdr" >&5 +echo "configure:1554: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1531: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in sys/mman.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1594: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1555,12 +1628,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1559: checking for working const" >&5 +echo "configure:1632: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1630,12 +1703,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1634: checking for off_t" >&5 +echo "configure:1707: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1663,12 +1736,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1667: checking for size_t" >&5 +echo "configure:1740: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1696,12 +1769,12 @@ EOF fi echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:1700: checking for st_rdev in struct stat" >&5 +echo "configure:1773: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1709,7 +1782,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -1731,12 +1804,12 @@ fi echo $ac_n "checking for uint8_t""... $ac_c" 1>&6 -echo "configure:1735: checking for uint8_t" >&5 +echo "configure:1808: checking for uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1764,12 +1837,12 @@ EOF fi echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 -echo "configure:1768: checking for uint16_t" >&5 +echo "configure:1841: checking for uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1797,12 +1870,12 @@ EOF fi echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 -echo "configure:1801: checking for uint32_t" >&5 +echo "configure:1874: checking for uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1831,7 +1904,7 @@ fi echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:1835: checking for long long" >&5 +echo "configure:1908: checking for long long" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1842,13 +1915,13 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_long_long=yes else @@ -1877,12 +1950,12 @@ else long64='unsigned long'; fi echo $ac_n "checking for uint64_t""... $ac_c" 1>&6 -echo "configure:1881: checking for uint64_t" >&5 +echo "configure:1954: checking for uint64_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1913,7 +1986,7 @@ fi echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6 -echo "configure:1917: checking size of uint8_t" >&5 +echo "configure:1990: checking size of uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1921,7 +1994,7 @@ else ac_cv_sizeof_uint8_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -1937,7 +2010,7 @@ main() exit(0); } EOF -if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint8_t=`cat conftestval` else @@ -1958,7 +2031,7 @@ EOF echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6 -echo "configure:1962: checking size of uint16_t" >&5 +echo "configure:2035: checking size of uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1966,7 +2039,7 @@ else ac_cv_sizeof_uint16_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -1982,7 +2055,7 @@ main() exit(0); } EOF -if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint16_t=`cat conftestval` else @@ -2003,7 +2076,7 @@ EOF echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6 -echo "configure:2007: checking size of uint32_t" >&5 +echo "configure:2080: checking size of uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2011,7 +2084,7 @@ else ac_cv_sizeof_uint32_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -2027,7 +2100,7 @@ main() exit(0); } EOF -if { (eval echo configure:2031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint32_t=`cat conftestval` else @@ -2048,7 +2121,7 @@ EOF echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6 -echo "configure:2052: checking size of uint64_t" >&5 +echo "configure:2125: checking size of uint64_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2056,7 +2129,7 @@ else ac_cv_sizeof_uint64_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -2072,7 +2145,7 @@ main() exit(0); } EOF -if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint64_t=`cat conftestval` else @@ -2093,15 +2166,15 @@ EOF -for ac_func in strerror strtoul +for ac_func in mmap strerror strtoul do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2100: checking for $ac_func" >&5 +echo "configure:2173: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2293,6 +2366,9 @@ s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g +s%@fsect@%$fsect%g +s%@FSECT5_TRUE@%$FSECT5_TRUE%g +s%@FSECT5_FALSE@%$FSECT5_FALSE%g s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@CPP@%$CPP%g diff --git a/contrib/file/configure.in b/contrib/file/configure.in index ca437c4b16f9..4699f75e62dc 100644 --- a/contrib/file/configure.in +++ b/contrib/file/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(file.c) -AM_INIT_AUTOMAKE(file, 3.35) +AM_INIT_AUTOMAKE(file, 3.36) AM_CONFIG_HEADER(config.h) AC_MSG_CHECKING(for builtin ELF support) @@ -31,6 +31,23 @@ fi], [ AC_DEFINE(ELFCORE) ]) +AC_MSG_CHECKING(for file formats in man section 5) +AC_ARG_ENABLE(fsect-man5, +[ --enable-fsect-man5 enable file formats in man section 5], +[if test "${enableval}" = yes; then + AC_MSG_RESULT(yes) + fsect=5 +else + AC_MSG_RESULT(no) + fsect=4 +fi], [ + # disable by default + AC_MSG_RESULT(no) + fsect=4 +]) +AC_SUBST(fsect) +AM_CONDITIONAL(FSECT5, test x$fsect = x5) + dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL @@ -42,6 +59,7 @@ AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(locale.h) +AC_CHECK_HEADERS(sys/mman.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -69,6 +87,6 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0) AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0) dnl Checks for functions -AC_CHECK_FUNCS(strerror strtoul) +AC_CHECK_FUNCS(mmap strerror strtoul) AC_OUTPUT(Makefile) diff --git a/contrib/file/file.c b/contrib/file/file.c index 429e53a69bdf..236591c23cd6 100644 --- a/contrib/file/file.c +++ b/contrib/file/file.c @@ -56,14 +56,14 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.56 2001/03/11 20:29:16 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.58 2001/07/22 21:04:15 christos Exp $") #endif /* lint */ #ifdef S_IFLNK -# define USAGE "Usage: %s [-bciknvzL] [-f namefile] [-m magicfiles] file...\n" +# define USAGE "Usage: %s [-bciknsvzL] [-f namefile] [-m magicfiles] file...\n" #else -# define USAGE "Usage: %s [-bciknvz] [-f namefile] [-m magicfiles] file...\n" +# define USAGE "Usage: %s [-bciknsvz] [-f namefile] [-m magicfiles] file...\n" #endif #ifndef MAGIC @@ -89,7 +89,7 @@ int /* Misc globals */ struct magic *magic; /* array of magic entries */ -const char *magicfile; /* where magic be found */ +const char *magicfile = 0; /* where the magic is */ const char *default_magicfile = MAGIC; char *progname; /* used throughout */ @@ -115,7 +115,8 @@ main(argc, argv) { int c; int action = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0; - char *mime; + char *mime, *home, *usermagic; + struct stat sb; #ifdef LC_CTYPE setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */ @@ -126,8 +127,20 @@ main(argc, argv) else progname = argv[0]; - if (!(magicfile = getenv("MAGIC"))) - magicfile = default_magicfile; + magicfile = default_magicfile; + if ((usermagic = getenv("MAGIC")) != NULL) + magicfile = usermagic; + else + if (home = getenv("HOME")) { + if ((usermagic = malloc(strlen(home) + 8)) != NULL) { + (void)strcpy(usermagic, home); + (void)strcat(usermagic, "/.magic"); + if (stat(usermagic, &sb)<0) + free(usermagic); + else + magicfile = usermagic; + } + } while ((c = getopt(argc, argv, "bcdf:ikm:nsvzCL")) != EOF) switch (c) { @@ -155,7 +168,7 @@ main(argc, argv) break; case 'i': iflag++; - if ((mime = malloc(strlen(magicfile) + 5)) != NULL) { + if ((mime = malloc(strlen(magicfile) + 6)) != NULL) { (void)strcpy(mime, magicfile); (void)strcat(mime, ".mime"); magicfile = mime; @@ -458,8 +471,6 @@ static void usage() { (void)fprintf(stderr, USAGE, progname); -#ifdef QUICK (void)fprintf(stderr, "Usage: %s -C [-m magic]\n", progname); -#endif exit(1); } diff --git a/contrib/file/file.h b/contrib/file/file.h index 67c86d0c7291..6800e2f45e15 100644 --- a/contrib/file/file.h +++ b/contrib/file/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.35 2001/03/11 20:29:16 christos Exp $ + * @(#)$Id: file.h,v 1.37 2001/07/22 21:04:15 christos Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -59,7 +59,7 @@ struct magic { uint8 flag; #define INDIR 1 /* if '>(...)' appears, */ #define UNSIGNED 2 /* comparison is unsigned */ -#define ADD 4 /* if '>&' appears, */ +#define OFFADD 4 /* if '>&' appears, */ uint8 reln; /* relation (0=eq, '>'=gt, etc) */ uint8 vallen; /* length of string value, if any */ uint8 type; /* int, short, long or string. */ @@ -75,6 +75,21 @@ struct magic { #define LESHORT 10 #define LELONG 11 #define LEDATE 12 +#define PSTRING 13 +#define LDATE 14 +#define BELDATE 15 +#define LELDATE 16 + uint8 in_op; /* operator for indirection */ + uint8 mask_op; /* operator for mask */ +#define OPAND 1 +#define OPOR 2 +#define OPXOR 3 +#define OPADD 4 +#define OPMINUS 5 +#define OPMULTIPLY 6 +#define OPDIVIDE 7 +#define OPMODULO 8 +#define OPINVERSE 0x80 int32 offset; /* offset to magic number */ int32 in_offset; /* offset from indirection */ union VALUETYPE { @@ -123,6 +138,7 @@ extern void error __P((const char *, ...)); extern void ckfputs __P((const char *, FILE *)); struct stat; extern int fsmagic __P((const char *, struct stat *)); +extern char *fmttime __P((long, int)); extern int is_compress __P((const unsigned char *, int *)); extern int is_tar __P((unsigned char *, int)); extern void magwarn __P((const char *, ...)); @@ -162,6 +178,10 @@ extern char *sys_errlist[]; #define strtoul(a, b, c) strtol(a, b, c) #endif +#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK) +#define QUICK +#endif + #ifdef __STDC__ #define FILE_RCSID(id) \ static const char *rcsid(const char *p) { \ diff --git a/contrib/file/file.man b/contrib/file/file.man index 0ed4dd29f6df..fc18f12e4ce4 100644 --- a/contrib/file/file.man +++ b/contrib/file/file.man @@ -1,5 +1,5 @@ .TH FILE __CSECTION__ "Copyright but distributable" -.\" $Id: file.man,v 1.38 2001/03/11 20:37:08 christos Exp $ +.\" $Id: file.man,v 1.39 2001/04/27 22:48:33 christos Exp $ .SH NAME file \- determine file type @@ -10,11 +10,14 @@ file ] [ .B \-f -namefile ] +.I namefile +] [ .B \-m -magicfiles ] -file ... +.I magicfiles +] +.I file +\&... .br .B file .B -C @@ -152,13 +155,14 @@ Do not prepend filenames to output lines (brief mode). .B \-c Cause a checking printout of the parsed form of the magic file. This is usually used in conjunction with -.B \-C -Write a magic.mgc output file that contains a pre-parsed version of -file. .B \-m to debug a new magic file before installing it. .TP 8 -.B \-f namefile +.B \-C +Write a magic.mgc output file that contains a pre-parsed version of +file. +.TP 8 +.BI \-f " namefile" Read the names of the files to be examined from .I namefile (one per line) @@ -182,7 +186,7 @@ text file types, directories etc), and makes use of an alternative .B \-k Don't stop at the first match, keep going. .TP 8 -.B \-m list +.BI \-m " list" Specify an alternate list of files containing magic numbers. This can be a single file, or a colon-separated list of files. .TP 8 diff --git a/contrib/file/magic.mime b/contrib/file/magic.mime index 687e4fbc45f6..836942a85242 100644 --- a/contrib/file/magic.mime +++ b/contrib/file/magic.mime @@ -96,6 +96,10 @@ # MPEG Layer 3 sound files # Modified the 11/20/97 at 15:59:04 by Christophe Prud'homme 0 belong 0xfffb audio/x-mp3 +#MP3 with ID3 tag +0 string ID3 audio/x-mp3 +# Ogg/Vorbis +0 string OggS audio/x-ogg #------------------------------------------------------------------------------ # c-lang: file(1) magic for C programs or various scripts @@ -265,6 +269,8 @@ 2 string -lh3- application/x-lha lh3 2 string -lh4- application/x-lha lh4 2 string -lh5- application/x-lha lh5 +2 string -lh6- application/x-lha lh6 +2 string -lh7- application/x-lha lh7 # Shell archives 10 string #\ This\ is\ a\ shell\ archive application/octet-stream x-shell @@ -533,4 +539,5 @@ # 0 string #\ PaCkAgE\ DaTaStReAm application/x-svr4-package - +#PNG Image Format +0 string \x89PNG image/png diff --git a/contrib/file/patchlevel.h b/contrib/file/patchlevel.h index ef5612610a56..5b5be297c80e 100644 --- a/contrib/file/patchlevel.h +++ b/contrib/file/patchlevel.h @@ -1,11 +1,16 @@ #define FILE_VERSION_MAJOR 3 -#define patchlevel 35 +#define patchlevel 36 /* * Patchlevel file for Ian Darwin's MAGIC command. - * $Id: patchlevel.h,v 1.35 2001/04/24 14:40:25 christos Exp $ + * $Id: patchlevel.h,v 1.36 2001/07/22 21:04:15 christos Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.36 2001/07/22 21:04:15 christos + * - magic fixes + * - add new operators, pascal strings, UTC date printing, $HOME/.magic + * [from "Tom N Harris" ] + * * Revision 1.35 2001/04/24 14:40:25 christos * - rename magic file sgi to mips and fix it * - add support for building magic.mgc diff --git a/contrib/file/print.c b/contrib/file/print.c index d6ae6e61fc98..bf2c66799e56 100644 --- a/contrib/file/print.c +++ b/contrib/file/print.c @@ -41,7 +41,7 @@ #include #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.32 2001/03/11 20:29:16 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.33 2001/07/22 21:04:15 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -53,26 +53,38 @@ mdump(m) static const char *typ[] = { "invalid", "byte", "short", "invalid", "long", "string", "date", "beshort", "belong", "bedate", "leshort", "lelong", - "ledate" }; + "ledate", "pstring", "ldate", "beldate", + "leldate" }; + static const char optyp[] = { '@', '&', '|', '^', '+', '-', + '*', '/', '%' }; (void) fputc('[', stderr); (void) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7), m->offset); - if (m->flag & INDIR) - (void) fprintf(stderr, "(%s,%d),", - /* Note: in.type is unsigned */ + if (m->flag & INDIR) { + (void) fprintf(stderr, "(%s,", + /* Note: type is unsigned */ (m->in_type < SZOF(typ)) ? - typ[m->in_type] : "*bad*", - m->in_offset); - + typ[m->in_type] : "*bad*"); + if (m->in_op & OPINVERSE) + (void) fputc('~', stderr); + (void) fprintf(stderr, "%c%d),", + ((m->in_op&0x7F) < SZOF(optyp)) ? + optyp[m->in_op&0x7F] : '?', + m->in_offset); + } (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", /* Note: type is unsigned */ (m->type < SZOF(typ)) ? typ[m->type] : "*bad*"); - if (m->mask != ~((uint32)0)) { - if(STRING != m->type) - (void) fprintf(stderr, " & %.8x", m->mask); + if (m->mask_op & OPINVERSE) + (void) fputc('~', stderr); + if (m->mask) { + ((m->mask_op&0x7F) < SZOF(optyp)) ? + (void) fputc(optyp[m->mask_op&0x7F], stderr) : + (void) fputc('?', stderr); + if(STRING != m->type || PSTRING != m->type) + (void) fprintf(stderr, "%.8x", m->mask); else { - (void) fputc('/', stderr); if (m->mask & STRING_IGNORE_LOWERCASE) (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); if (m->mask & STRING_COMPACT_BLANK) @@ -97,21 +109,18 @@ mdump(m) (void) fprintf(stderr, "%d", m->value.l); break; case STRING: + case PSTRING: showstr(stderr, m->value.s, -1); break; case DATE: case LEDATE: case BEDATE: - { - time_t t = m->value.l; - char *rt, *pp = ctime(&t); - - if ((rt = strchr(pp, '\n')) != NULL) - *rt = '\0'; - (void) fprintf(stderr, "%s,", pp); - if (rt) - *rt = '\n'; - } + (void)fprintf(stderr, "%s,", fmttime(m->value.l, 1)); + break; + case LDATE: + case LELDATE: + case BELDATE: + (void)fprintf(stderr, "%s,", fmttime(m->value.l, 0)); break; default: (void) fputs("*bad*", stderr); @@ -122,7 +131,7 @@ mdump(m) } /* - * ckfputs - futs, but with error checking + * ckfputs - fputs, but with error checking * ckfprintf - fprintf, but with error checking */ void @@ -216,3 +225,26 @@ magwarn(va_alist) va_end(va); fputc('\n', stderr); } + + +char * +fmttime(v, local) + long v; + int local; +{ + char *pp, *rt; + time_t t = (time_t)v; + if (local) { + pp = ctime(&t); + } else { + struct tm *tm; + if (daylight) + t += 3600; + tm = gmtime(&t); + pp = asctime(tm); + } + + if ((rt = strchr(pp, '\n')) != NULL) + *rt = '\0'; + return pp; +} diff --git a/contrib/file/softmagic.c b/contrib/file/softmagic.c index a32e2323fa25..1085dee4d693 100644 --- a/contrib/file/softmagic.c +++ b/contrib/file/softmagic.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.44 2001/03/17 19:32:50 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.45 2001/07/22 21:04:15 christos Exp $") #endif /* lint */ static int match __P((struct magic *, uint32, unsigned char *, int)); @@ -157,7 +157,7 @@ match(magic, nmagic, s, nbytes) */ cont_level = magic[magindex].cont_level; } - if (magic[magindex].flag & ADD) { + if (magic[magindex].flag & OFFADD) { oldoff=magic[magindex].offset; magic[magindex].offset += tmpoff[cont_level-1]; @@ -195,7 +195,7 @@ match(magic, nmagic, s, nbytes) tmplen += 20)) == NULL) error("out of memory\n"); } - if (magic[magindex].flag & ADD) { + if (magic[magindex].flag & OFFADD) { magic[magindex].offset = oldoff; } } @@ -215,6 +215,7 @@ mprint(p, m) struct magic *m; { char *pp, *rt; + char *oldtz, tz[16]; uint32 v; time_t curtime; int32 t=0 ; @@ -222,8 +223,7 @@ mprint(p, m) switch (m->type) { case BYTE: - v = p->b; - v = signextend(m, v) & m->mask; + v = signextend(m, p->b); (void) printf(m->desc, (unsigned char) v); t = m->offset + sizeof(char); break; @@ -231,8 +231,7 @@ mprint(p, m) case SHORT: case BESHORT: case LESHORT: - v = p->h; - v = signextend(m, v) & m->mask; + v = signextend(m, p->h); (void) printf(m->desc, (unsigned short) v); t = m->offset + sizeof(short); break; @@ -240,13 +239,13 @@ mprint(p, m) case LONG: case BELONG: case LELONG: - v = p->l; - v = signextend(m, v) & m->mask; + v = signextend(m, p->l); (void) printf(m->desc, (uint32) v); t = m->offset + sizeof(int32); break; case STRING: + case PSTRING: if (m->reln == '=') { (void) printf(m->desc, m->value.s); t = m->offset + strlen(m->value.s); @@ -265,11 +264,14 @@ mprint(p, m) case DATE: case BEDATE: case LEDATE: - curtime = p->l; - pp = ctime(&curtime); - if ((rt = strchr(pp, '\n')) != NULL) - *rt = '\0'; - (void) printf(m->desc, pp); + (void) printf(m->desc, fmttime(p->l, 1)); + t = m->offset + sizeof(time_t); + break; + + case LDATE: + case BELDATE: + case LELDATE: + (void) printf(m->desc, fmttime(p->l, 0)); t = m->offset + sizeof(time_t); break; @@ -282,6 +284,8 @@ mprint(p, m) /* * Convert the byte order of the data we are looking at + * While we're here, let's apply the mask operation + * (unless you have a better idea) */ static int mconvert(p, m) @@ -290,35 +294,259 @@ mconvert(p, m) { switch (m->type) { case BYTE: + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->b &= m->mask; + break; + case OPOR: + p->b |= m->mask; + break; + case OPXOR: + p->b ^= m->mask; + break; + case OPADD: + p->b += m->mask; + break; + case OPMINUS: + p->b -= m->mask; + break; + case OPMULTIPLY: + p->b *= m->mask; + break; + case OPDIVIDE: + p->b /= m->mask; + break; + case OPMODULO: + p->b %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->b = ~p->b; + return 1; case SHORT: + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->h &= m->mask; + break; + case OPOR: + p->h |= m->mask; + break; + case OPXOR: + p->h ^= m->mask; + break; + case OPADD: + p->h += m->mask; + break; + case OPMINUS: + p->h -= m->mask; + break; + case OPMULTIPLY: + p->h *= m->mask; + break; + case OPDIVIDE: + p->h /= m->mask; + break; + case OPMODULO: + p->h %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->h = ~p->h; + return 1; case LONG: case DATE: + case LDATE: + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->l &= m->mask; + break; + case OPOR: + p->l |= m->mask; + break; + case OPXOR: + p->l ^= m->mask; + break; + case OPADD: + p->l += m->mask; + break; + case OPMINUS: + p->l -= m->mask; + break; + case OPMULTIPLY: + p->l *= m->mask; + break; + case OPDIVIDE: + p->l /= m->mask; + break; + case OPMODULO: + p->l %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->l = ~p->l; return 1; case STRING: { char *ptr; + int n; - /* Null terminate and eat the return */ + /* Null terminate and eat *trailing* return */ p->s[sizeof(p->s) - 1] = '\0'; - if ((ptr = strchr(p->s, '\n')) != NULL) - *ptr = '\0'; + n = strlen(p->s) - 1; + if (p->s[n] == '\n') + p->s[n] = '\0'; + return 1; + } + case PSTRING: + { + char *ptr1 = p->s, *ptr2 = ptr1 + 1; + int n = *p->s; + if (n >= sizeof(p->s)) + n = sizeof(p->s) - 1; + while (n--) + *ptr1++ = *ptr2++; + *ptr1 = '\0'; + n = strlen(p->s) - 1; + if (p->s[n] == '\n') + p->s[n] = '\0'; return 1; } case BESHORT: p->h = (short)((p->hs[0]<<8)|(p->hs[1])); + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->h &= m->mask; + break; + case OPOR: + p->h |= m->mask; + break; + case OPXOR: + p->h ^= m->mask; + break; + case OPADD: + p->h += m->mask; + break; + case OPMINUS: + p->h -= m->mask; + break; + case OPMULTIPLY: + p->h *= m->mask; + break; + case OPDIVIDE: + p->h /= m->mask; + break; + case OPMODULO: + p->h %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->h = ~p->h; return 1; case BELONG: case BEDATE: + case BELDATE: p->l = (int32) ((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3])); + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->l &= m->mask; + break; + case OPOR: + p->l |= m->mask; + break; + case OPXOR: + p->l ^= m->mask; + break; + case OPADD: + p->l += m->mask; + break; + case OPMINUS: + p->l -= m->mask; + break; + case OPMULTIPLY: + p->l *= m->mask; + break; + case OPDIVIDE: + p->l /= m->mask; + break; + case OPMODULO: + p->l %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->l = ~p->l; return 1; case LESHORT: p->h = (short)((p->hs[1]<<8)|(p->hs[0])); + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->h &= m->mask; + break; + case OPOR: + p->h |= m->mask; + break; + case OPXOR: + p->h ^= m->mask; + break; + case OPADD: + p->h += m->mask; + break; + case OPMINUS: + p->h -= m->mask; + break; + case OPMULTIPLY: + p->h *= m->mask; + break; + case OPDIVIDE: + p->h /= m->mask; + break; + case OPMODULO: + p->h %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->h = ~p->h; return 1; case LELONG: case LEDATE: + case LELDATE: p->l = (int32) ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0])); + if (m->mask) + switch (m->mask_op&0x7F) { + case OPAND: + p->l &= m->mask; + break; + case OPOR: + p->l |= m->mask; + break; + case OPXOR: + p->l ^= m->mask; + break; + case OPADD: + p->l += m->mask; + break; + case OPMINUS: + p->l -= m->mask; + break; + case OPMULTIPLY: + p->l *= m->mask; + break; + case OPDIVIDE: + p->l /= m->mask; + break; + case OPMODULO: + p->l %= m->mask; + break; + } + if (m->mask_op & OPINVERSE) + p->l = ~p->l; return 1; default: error("invalid type %d in mconvert().\n", m->type); @@ -371,31 +599,324 @@ mget(p, s, m, nbytes) switch (m->in_type) { case BYTE: - offset = p->b + m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = p->b & m->in_offset; + break; + case OPOR: + offset = p->b | m->in_offset; + break; + case OPXOR: + offset = p->b ^ m->in_offset; + break; + case OPADD: + offset = p->b + m->in_offset; + break; + case OPMINUS: + offset = p->b - m->in_offset; + break; + case OPMULTIPLY: + offset = p->b * m->in_offset; + break; + case OPDIVIDE: + offset = p->b / m->in_offset; + break; + case OPMODULO: + offset = p->b % m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case BESHORT: - offset = (short)((p->hs[0]<<8)|(p->hs[1]))+ - m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) & + m->in_offset; + break; + case OPOR: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) | + m->in_offset; + break; + case OPXOR: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) ^ + m->in_offset; + break; + case OPADD: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) + + m->in_offset; + break; + case OPMINUS: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) - + m->in_offset; + break; + case OPMULTIPLY: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) * + m->in_offset; + break; + case OPDIVIDE: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) / + m->in_offset; + break; + case OPMODULO: + offset = (short)((p->hs[0]<<8)| + (p->hs[1])) % + m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case LESHORT: - offset = (short)((p->hs[1]<<8)|(p->hs[0]))+ - m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) & + m->in_offset; + break; + case OPOR: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) | + m->in_offset; + break; + case OPXOR: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) ^ + m->in_offset; + break; + case OPADD: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) + + m->in_offset; + break; + case OPMINUS: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) - + m->in_offset; + break; + case OPMULTIPLY: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) * + m->in_offset; + break; + case OPDIVIDE: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) / + m->in_offset; + break; + case OPMODULO: + offset = (short)((p->hs[1]<<8)| + (p->hs[0])) % + m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case SHORT: - offset = p->h + m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = p->h & m->in_offset; + break; + case OPOR: + offset = p->h | m->in_offset; + break; + case OPXOR: + offset = p->h ^ m->in_offset; + break; + case OPADD: + offset = p->h + m->in_offset; + break; + case OPMINUS: + offset = p->h - m->in_offset; + break; + case OPMULTIPLY: + offset = p->h * m->in_offset; + break; + case OPDIVIDE: + offset = p->h / m->in_offset; + break; + case OPMODULO: + offset = p->h % m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case BELONG: - offset = (int32)((p->hl[0]<<24)|(p->hl[1]<<16)| - (p->hl[2]<<8)|(p->hl[3]))+ - m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) & + m->in_offset; + break; + case OPOR: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) | + m->in_offset; + break; + case OPXOR: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) ^ + m->in_offset; + break; + case OPADD: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) + + m->in_offset; + break; + case OPMINUS: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) - + m->in_offset; + break; + case OPMULTIPLY: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) * + m->in_offset; + break; + case OPDIVIDE: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) / + m->in_offset; + break; + case OPMODULO: + offset = (int32)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])) % + m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case LELONG: - offset = (int32)((p->hl[3]<<24)|(p->hl[2]<<16)| - (p->hl[1]<<8)|(p->hl[0]))+ - m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) & + m->in_offset; + break; + case OPOR: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) | + m->in_offset; + break; + case OPXOR: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) ^ + m->in_offset; + break; + case OPADD: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) + + m->in_offset; + break; + case OPMINUS: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) - + m->in_offset; + break; + case OPMULTIPLY: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) * + m->in_offset; + break; + case OPDIVIDE: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) / + m->in_offset; + break; + case OPMODULO: + offset = (int32)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])) % + m->in_offset; + break; + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; case LONG: - offset = p->l + m->in_offset; + if (m->in_offset) + switch (m->in_op&0x7F) { + case OPAND: + offset = p->l & m->in_offset; + break; + case OPOR: + offset = p->l | m->in_offset; + break; + case OPXOR: + offset = p->l ^ m->in_offset; + break; + case OPADD: + offset = p->l + m->in_offset; + break; + case OPMINUS: + offset = p->l - m->in_offset; + break; + case OPMULTIPLY: + offset = p->l * m->in_offset; + break; + case OPDIVIDE: + offset = p->l / m->in_offset; + break; + case OPMODULO: + offset = p->l % m->in_offset; + break; + /* case TOOMANYSWITCHBLOCKS: + * ugh = p->eye % m->strain; + * rub; + * case BEER: + * off = p->tab & m->in_gest; + * sleep; + */ + } + if (m->in_op & OPINVERSE) + offset = ~offset; break; } @@ -446,10 +967,15 @@ mcheck(p, m) case DATE: case BEDATE: case LEDATE: + case LDATE: + case BELDATE: + case LELDATE: v = p->l; break; - case STRING: { + case STRING: + case PSTRING: + { /* * What we want here is: * v = strncmp(m->value.s, p->s, m->vallen); @@ -499,8 +1025,8 @@ mcheck(p, m) return 0;/*NOTREACHED*/ } - if(m->type != STRING) - v = signextend(m, v) & m->mask; + if(m->type != STRING && m->type != PSTRING) + v = signextend(m, v); switch (m->reln) { case 'x':