Virgin import of Christos Zoulas's FILE 3.35.

This commit is contained in:
David E. O'Brien 2001-04-25 07:41:21 +00:00
parent adef7cde57
commit 61295bbb39
17 changed files with 428 additions and 141 deletions

View File

@ -12,9 +12,15 @@
# magic for Newton PDA package formats
# from Ruda Moura <ruda@helllabs.org>
0 string package Newton package,
>7 byte 48 NOS 1.x,
>7 byte 49 NOS 2.x,
0 string package0 Newton package, NOS 1.x,
>12 belong &0x80000000 AutoRemove,
>12 belong &0x40000000 CopyProtect,
>12 belong &0x10000000 NoCompression,
>12 belong &0x04000000 Relocation,
>12 belong &0x02000000 UseFasterCompression,
>16 belong x version %d
0 string package1 Newton package, NOS 2.x,
>12 belong &0x80000000 AutoRemove,
>12 belong &0x40000000 CopyProtect,
>12 belong &0x10000000 NoCompression,
@ -54,10 +60,10 @@
# categories" and "left to right, top to bottom," respectively; the D and R
# mean that the cursor should move either down or right when you press Return.
30 string \x01D AppleWorks database data
30 string \x02D AppleWorks database data
30 string \x01R AppleWorks database data
30 string \x02R AppleWorks database data
#30 string \x01D AppleWorks database data
#30 string \x02D AppleWorks database data
#30 string \x01R AppleWorks database data
#30 string \x02R AppleWorks database data
# AppleWorks spreadsheet:
#
@ -65,10 +71,10 @@
# row- or column-order recalculation; the A or M means automatic or manual
# recalculation.
131 string RA AppleWorks spreadsheet data
131 string RM AppleWorks spreadsheet data
131 string CA AppleWorks spreadsheet data
131 string CM AppleWorks spreadsheet data
#131 string RA AppleWorks spreadsheet data
#131 string RM AppleWorks spreadsheet data
#131 string CA AppleWorks spreadsheet data
#131 string CM AppleWorks spreadsheet data
# Applesoft BASIC:
#

View File

@ -243,9 +243,8 @@
# GTKtalog catalogs
# by David Necas (Yeti) <yeti@physics.muni.cz>
0 lelong <20
>4 string gtktalog\ GTKtalog catalog data,
>>13 string 3 version 3
>>>14 beshort 0x677a (gzipped)
>>>14 beshort !0x677a (not gzipped)
>>13 string >3 version %s
4 string gtktalog\ GTKtalog catalog data,
>13 string 3 version 3
>>14 beshort 0x677a (gzipped)
>>14 beshort !0x677a (not gzipped)
>13 string >3 version %s

View File

@ -71,7 +71,7 @@
>>18 leshort 37 Fujitsu FR20,
>>18 leshort 38 TRW RH-32,
>>18 leshort 39 Motorola RCE,
>>18 leshort 40 Advanced RISC Machines ARM,
>>18 leshort 40 ARM,
>>18 leshort 41 Alpha,
>>18 leshort 42 Hitachi SH,
>>18 leshort 43 SPARC V9 - invalid byte order,
@ -103,6 +103,8 @@
>>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
@ -162,7 +164,7 @@
>>18 beshort 37 Fujitsu FR20,
>>18 beshort 38 TRW RH-32,
>>18 beshort 39 Motorola RCE,
>>18 beshort 40 Advanced RISC Machines ARM,
>>18 beshort 40 ARM,
>>18 beshort 41 Alpha,
>>18 beshort 42 Hitachi SH,
>>18 beshort 43 SPARC V9,

View File

@ -126,5 +126,9 @@
# /var/run/ld.so.hints
# What are you laughing about?
0 lelong 011421044151 ld.so hints file
>4 lelong >0 (version %d)
0 lelong 011421044151 ld.so hints file (Little Endian
>4 lelong >0 \b, version %d)
>4 belong <=0 \b)
0 belong 011421044151 ld.so hints file (Big Endian
>4 belong >0 \b, version %d)
>4 belong <=0 \b)

View File

@ -10,6 +10,7 @@
#
0 beshort 0xffd8 JPEG image data
>6 string JFIF \b, JFIF standard
>6 string Exif \b, EXIF standard
# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF. Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
@ -21,8 +22,6 @@
>13 byte 0 \b, aspect ratio
>13 byte 1 \b, resolution (DPI)
>13 byte 2 \b, resolution (DPCM)
>14 beshort x \b, %d x
>16 beshort x \b %d
#>4 beshort x \b, segment length %d
# Next, show thumbnail info, if it exists:
>18 byte !0 \b, thumbnail %dx
@ -55,6 +54,8 @@
# I've commented-out quantisation table reporting. I doubt anyone cares yet.
#>(4.S+5) byte 0xDB \b, quantisation table
#>>(4.S+6) beshort x \b length=%d
>14 beshort x \b, %d x
>16 beshort x \b %d
# HSI is Handmade Software's proprietary JPEG encoding scheme
0 string hsi1 JPEG image data, HSI proprietary

177
contrib/file/Magdir/mips Normal file
View File

@ -0,0 +1,177 @@
#------------------------------------------------------------------------------
# mips: file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.)
# Dec Ultrix (MIPS)
# all of SGI's *current* machines and OSes run in big-endian mode on the
# MIPS machines, as far as I know.
#
# XXX - what is the blank "-" line?
#
# kbd file definitions
0 string kbd!map kbd map file
>8 byte >0 Ver %d:
>10 short >0 with %d table(s)
0 belong 0407 old SGI 68020 executable
0 belong 0410 old SGI 68020 pure executable
0 beshort 0x8765 disk quotas file
0 beshort 0x0506 IRIS Showcase file
>2 byte 0x49 -
>3 byte x - version %ld
0 beshort 0x0226 IRIS Showcase template
>2 byte 0x63 -
>3 byte x - version %ld
0 belong 0x5343464d IRIS Showcase file
>4 byte x - version %ld
0 belong 0x5443464d IRIS Showcase template
>4 byte x - version %ld
0 belong 0xdeadbabe IRIX Parallel Arena
>8 belong >0 - version %ld
#
0 beshort 0x0160 MIPSEB ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>22 byte x - version %ld
>23 byte x .%ld
#
0 beshort 0x0162 MIPSEL-BE ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %d
>22 byte x .%ld
#
0 beshort 0x6001 MIPSEB-LE ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %d
>22 byte x .%ld
#
0 beshort 0x6201 MIPSEL ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %ld
>22 byte x .%ld
#
# MIPS 2 additions
#
0 beshort 0x0163 MIPSEB MIPS-II ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>22 byte x - version %ld
>23 byte x .%ld
#
0 beshort 0x0166 MIPSEL-BE MIPS-II ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>22 byte x - version %ld
>23 byte x .%ld
#
0 beshort 0x6301 MIPSEB-LE MIPS-II ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %ld
>22 byte x .%ld
#
0 beshort 0x6601 MIPSEL MIPS-II ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %ld
>22 byte x .%ld
#
# MIPS 3 additions
#
0 beshort 0x0140 MIPSEB MIPS-III ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>22 byte x - version %ld
>23 byte x .%ld
#
0 beshort 0x0142 MIPSEL-BE MIPS-III ECOFF executable
>20 beshort 0407 (impure)
>20 beshort 0410 (swapped)
>20 beshort 0413 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>22 byte x - version %ld
>23 byte x .%ld
#
0 beshort 0x4001 MIPSEB-LE MIPS-III ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %ld
>22 byte x .%ld
#
0 beshort 0x4201 MIPSEL MIPS-III ECOFF executable
>20 beshort 03401 (impure)
>20 beshort 04001 (swapped)
>20 beshort 05401 (paged)
>8 belong >0 not stripped
>8 belong 0 stripped
>23 byte x - version %ld
>22 byte x .%ld
#
0 beshort 0x180 MIPSEB Ucode
0 beshort 0x182 MIPSEL-BE Ucode
# 32bit core file
0 belong 0xdeadadb0 IRIX core dump
>4 belong 1 of
>16 string >\0 '%s'
# 64bit core file
0 belong 0xdeadad40 IRIX 64-bit core dump
>4 belong 1 of
>16 string >\0 '%s'
# N32bit core file
0 belong 0xbabec0bb IRIX N32 core dump
>4 belong 1 of
>16 string >\0 '%s'
# New style crash dump file
0 string \x43\x72\x73\x68\x44\x75\x6d\x70 IRIX vmcore dump of
>36 string >\0 '%s'
# Trusted IRIX info
0 string SGIAUDIT SGI Audit file
>8 byte x - version %d
>9 byte x .%ld
#
0 string WNGZWZSC Wingz compiled script
0 string WNGZWZSS Wingz spreadsheet
0 string WNGZWZHP Wingz help file
#
0 string \#Inventor V IRIS Inventor 1.0 file
0 string \#Inventor V2 Open Inventor 2.0 file
# GLF is OpenGL stream encoding
0 string glfHeadMagic(); GLF_TEXT
4 belong 0x7d000000 GLF_BINARY_LSB_FIRST
4 belong 0x0000007d GLF_BINARY_MSB_FIRST
# GLS is OpenGL stream encoding; GLS is the successor of GLF
0 string glsBeginGLS( GLS_TEXT
4 belong 0x10000000 GLS_BINARY_LSB_FIRST
4 belong 0x00000010 GLS_BINARY_MSB_FIRST

View File

@ -239,6 +239,8 @@
>>20 lelong !0 executable
>>20 lelong =0 object file
>16 lelong >0 not stripped
0 belong&0377777777 043600507 NetBSD/arm32 core
# NetBSD/arm26 has always used ELF objects, but it shares a core file
# format with NetBSD/arm32.
0 belong&0377777777 043600507 NetBSD/arm core
>12 string >\0 from '%s'
>32 lelong !0 (signal %d)

View File

@ -2,7 +2,6 @@
#------------------------------------------------------------------------------
# softquad: file(1) magic for SoftQuad Publishing Software
#
# $Id: softquad,v 1.9 1995/01/21 21:09:00 christos Exp $
# Author/Editor and RulesBuilder
#
# XXX - byte order?

View File

@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
bin_PROGRAMS = file
data_DATA = magic magic.mime
data_DATA = magic magic.mime magic.mgc
MAGIC = @datadir@/magic
CPPFLAGS = -DMAGIC='"$(MAGIC)"' -DQUICK
@ -17,7 +17,7 @@ file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime \
Localstuff Header $(magic_FRAGMENTS) file.man magic.man
CLEANFILES = $(man_MANS) magic
CLEANFILES = $(man_MANS) magic magic.mgc
magic: Header Localstuff $(magic_FRAGMENTS)
cat $(srcdir)/Header $(srcdir)/Localstuff > $@
@ -30,6 +30,9 @@ magic: Header Localstuff $(magic_FRAGMENTS)
cat $$f; \
done >> $@
magic.mgc: magic file
./file -C -m magic
file.1: Makefile file.man
@rm -f $@
sed -e s@__CSECTION__@1@g \
@ -59,14 +62,14 @@ magic_FRAGMENTS = Magdir/adventure Magdir/allegro Magdir/alliant \
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/mirage Magdir/mkid Magdir/mmdf Magdir/modem \
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/sgi Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/spectrum \
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 \

View File

@ -69,7 +69,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
bin_PROGRAMS = file
data_DATA = magic magic.mime
data_DATA = magic magic.mime magic.mgc
MAGIC = @datadir@/magic
CPPFLAGS = -DMAGIC='"$(MAGIC)"' -DQUICK
@ -82,9 +82,9 @@ file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c compress.c
EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime Localstuff Header $(magic_FRAGMENTS) file.man magic.man
CLEANFILES = $(man_MANS) magic
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/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/sgi 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/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
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -480,6 +480,9 @@ magic: Header Localstuff $(magic_FRAGMENTS)
cat $$f; \
done >> $@
magic.mgc: magic file
./file -C -m magic
file.1: Makefile file.man
@rm -f $@
sed -e s@__CSECTION__@1@g \

View File

@ -2,7 +2,7 @@
#define PACKAGE "file"
/* Autoheader needs me */
#define VERSION "3.33"
#define VERSION "3.35"
/* Define if builtin ELF support is enabled. */
#undef BUILTIN_ELF

View File

@ -38,14 +38,30 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$Id: apprentice.c,v 1.34 2001/03/11 20:29:16 christos Exp $")
FILE_RCSID("@(#)$Id: apprentice.c,v 1.39 2001/04/24 14:40:24 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
isspace((unsigned char) *l)) ++l;}
#define LOWCASE(l) (isupper((unsigned char) (l)) ? \
tolower((unsigned char) (l)) : (l))
/*
* Work around a bug in headers on Digital Unix.
* At least confirmed for: OSF1 V4.0 878
*/
#if defined(__osf__) && defined(__DECC)
#ifdef MAP_FAILED
#undef MAP_FAILED
#endif
#endif
#ifndef MAP_FAILED
#define MAP_FAILED (void *) -1
#endif
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
#ifdef __EMX__
char PATHSEP=';';
@ -798,6 +814,7 @@ apprentice_map(magicp, nmagicp, fn, action)
goto error;
}
(void)close(fd);
fd = -1;
ptr = (uint32 *) *magicp;
if (*ptr != MAGICNO) {
if (swap4(*ptr) != MAGICNO) {
@ -815,7 +832,7 @@ apprentice_map(magicp, nmagicp, fn, action)
if (version != VERSIONNO) {
(void)fprintf(stderr,
"%s: version mismatch (%d != %d) in `%s'\n",
progname, version, VERSION, dbname);
progname, version, VERSIONNO, dbname);
goto error;
}
*nmagicp = (st.st_size / sizeof(struct magic)) - 1;

View File

@ -16,7 +16,7 @@
#include <sys/wait.h>
#endif
#ifndef lint
FILE_RCSID("@(#)$Id: compress.c,v 1.17 2000/08/05 17:36:47 christos Exp $")
FILE_RCSID("@(#)$Id: compress.c,v 1.19 2001/03/20 04:22:02 christos Exp $")
#endif
@ -26,8 +26,10 @@ static struct {
const char *const argv[3];
int silent;
} compr[] = {
{ "\037\235", 2, { "uncompress", "-c", NULL }, 0 }, /* compressed */
{ "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */
/* Uncompress can get stuck; so use gzip first if we have it
* Idea from Damien Clark, thanks! */
{ "\037\235", 2, { "uncompress", "-c", NULL }, 1 }, /* compressed */
{ "\037\213", 2, { "gzip", "-cdq", NULL }, 1 }, /* gzipped */
{ "\037\236", 2, { "gzip", "-cdq", NULL }, 1 }, /* frozen */
{ "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */
@ -40,6 +42,8 @@ static int ncompr = sizeof(compr) / sizeof(compr[0]);
static int uncompress __P((int, const unsigned char *, unsigned char **, int));
static int swrite __P((int, const void *, size_t));
static int sread __P((int, void *, size_t));
int
zmagic(buf, nbytes)
@ -70,6 +74,60 @@ zmagic(buf, nbytes)
return 1;
}
/*
* `safe' write for sockets and pipes.
*/
static int
swrite(fd, buf, n)
int fd;
const void *buf;
size_t n;
{
int rv;
size_t rn = n;
do
switch (rv = write(fd, buf, n)) {
case -1:
if (errno == EINTR)
continue;
return -1;
default:
n -= rv;
buf = ((char *)buf) + rv;
break;
}
while (n > 0);
return rn;
}
/*
* `safe' read for sockets and pipes.
*/
static int
sread(fd, buf, n)
int fd;
void *buf;
size_t n;
{
int rv;
size_t rn = n;
do
switch (rv = read(fd, buf, n)) {
case -1:
if (errno == EINTR)
continue;
return -1;
default:
n -= rv;
buf = ((char *)buf) + rv;
break;
}
while (n > 0);
return rn;
}
static int
uncompress(method, old, newch, n)
@ -109,15 +167,24 @@ uncompress(method, old, newch, n)
default: /* parent */
(void) close(fdin[0]);
(void) close(fdout[1]);
if (write(fdin[1], old, n) != n)
return 0;
(void) close(fdin[1]);
if ((*newch = (unsigned char *) malloc(n)) == NULL)
return 0;
if ((n = read(fdout[0], *newch, n)) <= 0) {
free(*newch);
return 0;
if (swrite(fdin[1], old, n) != n) {
n = 0;
goto err;
}
(void) close(fdin[1]);
fdin[1] = -1;
if ((*newch = (unsigned char *) malloc(n)) == NULL) {
n = 0;
goto err;
}
if ((n = sread(fdout[0], *newch, n)) <= 0) {
free(*newch);
n = 0;
goto err;
}
err:
if (fdin[1] != -1)
(void) close(fdin[1]);
(void) close(fdout[0]);
(void) wait(NULL);
return n;

177
contrib/file/configure vendored
View File

@ -693,10 +693,9 @@ else
fi
PACKAGE=file
VERSION=3.33
VERSION=3.35
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; }
@ -713,7 +712,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
echo "configure:717: checking for working aclocal" >&5
echo "configure:716: 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.
@ -726,7 +725,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
echo "configure:730: checking for working autoconf" >&5
echo "configure:729: 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.
@ -739,7 +738,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
echo "configure:743: checking for working automake" >&5
echo "configure:742: 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.
@ -752,7 +751,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
echo "configure:756: checking for working autoheader" >&5
echo "configure:755: 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.
@ -765,7 +764,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
echo "configure:769: checking for working makeinfo" >&5
echo "configure:768: 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.
@ -783,7 +782,7 @@ fi
echo $ac_n "checking for builtin ELF support""... $ac_c" 1>&6
echo "configure:787: checking for builtin ELF support" >&5
echo "configure:786: 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"
@ -809,7 +808,7 @@ fi
echo $ac_n "checking for ELF core file support""... $ac_c" 1>&6
echo "configure:813: checking for ELF core file support" >&5
echo "configure:812: 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"
@ -837,7 +836,7 @@ 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:841: checking for $ac_word" >&5
echo "configure:840: 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
@ -867,7 +866,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:871: checking for $ac_word" >&5
echo "configure:870: 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
@ -918,7 +917,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:922: checking for $ac_word" >&5
echo "configure:921: 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
@ -950,7 +949,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:954: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:953: 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.
@ -961,12 +960,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 965 "configure"
#line 964 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:969: \"$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
@ -992,12 +991,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:996: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:995: 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:1001: checking whether we are using GNU C" >&5
echo "configure:1000: 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
@ -1006,7 +1005,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1010: \"$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:1009: \"$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
@ -1025,7 +1024,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:1029: checking whether ${CC-cc} accepts -g" >&5
echo "configure:1028: 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
@ -1068,7 +1067,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:1072: checking for a BSD compatible install" >&5
echo "configure:1071: 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
@ -1121,7 +1120,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:1125: checking whether ln -s works" >&5
echo "configure:1124: 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
@ -1143,7 +1142,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1147: checking how to run the C preprocessor" >&5
echo "configure:1146: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1158,13 +1157,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1162 "configure"
#line 1161 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1167: \"$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
:
@ -1175,13 +1174,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1179 "configure"
#line 1178 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1184: \"$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
:
@ -1192,13 +1191,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1196 "configure"
#line 1195 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1201: \"$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
:
@ -1223,12 +1222,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1227: checking for ANSI C header files" >&5
echo "configure:1226: 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 <<EOF
#line 1232 "configure"
#line 1231 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1236,7 +1235,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1239: \"$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*
@ -1253,7 +1252,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
#line 1257 "configure"
#line 1256 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1271,7 +1270,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
#line 1275 "configure"
#line 1274 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1292,7 +1291,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1296 "configure"
#line 1295 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1303,7 +1302,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1327,19 +1326,19 @@ EOF
fi
echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6
echo "configure:1331: checking whether sys/types.h defines makedev" >&5
echo "configure:1330: 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 <<EOF
#line 1336 "configure"
#line 1335 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
return makedev(0, 0);
; return 0; }
EOF
if { (eval echo configure:1343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1342: \"$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
@ -1357,17 +1356,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:1361: checking for sys/mkdev.h" >&5
echo "configure:1360: 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
#line 1366 "configure"
#line 1365 "configure"
#include "confdefs.h"
#include <sys/mkdev.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1370: \"$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*
@ -1395,17 +1394,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:1399: checking for sys/sysmacros.h" >&5
echo "configure:1398: 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
#line 1404 "configure"
#line 1403 "configure"
#include "confdefs.h"
#include <sys/sysmacros.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1408: \"$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*
@ -1433,12 +1432,12 @@ fi
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
echo "configure:1437: checking for sys/wait.h that is POSIX.1 compatible" >&5
echo "configure:1436: 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 <<EOF
#line 1442 "configure"
#line 1441 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@ -1454,7 +1453,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
if { (eval echo configure:1458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@ -1478,17 +1477,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:1482: checking for $ac_hdr" >&5
echo "configure:1481: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1487 "configure"
#line 1486 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1491: \"$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*
@ -1518,17 +1517,17 @@ 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:1522: checking for $ac_hdr" >&5
echo "configure:1521: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1527 "configure"
#line 1526 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1531: \"$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*
@ -1556,12 +1555,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1560: checking for working const" >&5
echo "configure:1559: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1565 "configure"
#line 1564 "configure"
#include "confdefs.h"
int main() {
@ -1610,7 +1609,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -1631,12 +1630,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
echo "configure:1635: checking for off_t" >&5
echo "configure:1634: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1640 "configure"
#line 1639 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1664,12 +1663,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:1668: checking for size_t" >&5
echo "configure:1667: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1673 "configure"
#line 1672 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1697,12 +1696,12 @@ EOF
fi
echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
echo "configure:1701: checking for st_rdev in struct stat" >&5
echo "configure:1700: checking for st_rdev in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1706 "configure"
#line 1705 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -1710,7 +1709,7 @@ int main() {
struct stat s; s.st_rdev;
; return 0; }
EOF
if { (eval echo configure:1714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_rdev=yes
else
@ -1732,12 +1731,12 @@ fi
echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
echo "configure:1736: checking for uint8_t" >&5
echo "configure:1735: checking for uint8_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1741 "configure"
#line 1740 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1765,12 +1764,12 @@ EOF
fi
echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
echo "configure:1769: checking for uint16_t" >&5
echo "configure:1768: checking for uint16_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1774 "configure"
#line 1773 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1798,12 +1797,12 @@ EOF
fi
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
echo "configure:1802: checking for uint32_t" >&5
echo "configure:1801: checking for uint32_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1807 "configure"
#line 1806 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1832,7 +1831,7 @@ fi
echo $ac_n "checking for long long""... $ac_c" 1>&6
echo "configure:1836: checking for long long" >&5
echo "configure:1835: 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
@ -1843,13 +1842,13 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1847 "configure"
#line 1846 "configure"
#include "confdefs.h"
int main() {
long long foo = 0;
exit(sizeof(long long) < sizeof(long)); }
EOF
if { (eval echo configure:1853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1852: \"$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
@ -1878,12 +1877,12 @@ else
long64='unsigned long';
fi
echo $ac_n "checking for uint64_t""... $ac_c" 1>&6
echo "configure:1882: checking for uint64_t" >&5
echo "configure:1881: checking for uint64_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1887 "configure"
#line 1886 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1914,7 +1913,7 @@ fi
echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6
echo "configure:1918: checking size of uint8_t" >&5
echo "configure:1917: 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
@ -1922,7 +1921,7 @@ else
ac_cv_sizeof_uint8_t=0
else
cat > conftest.$ac_ext <<EOF
#line 1926 "configure"
#line 1925 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -1938,7 +1937,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1941: \"$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
@ -1959,7 +1958,7 @@ EOF
echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6
echo "configure:1963: checking size of uint16_t" >&5
echo "configure:1962: 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
@ -1967,7 +1966,7 @@ else
ac_cv_sizeof_uint16_t=0
else
cat > conftest.$ac_ext <<EOF
#line 1971 "configure"
#line 1970 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -1983,7 +1982,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:1987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1986: \"$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
@ -2004,7 +2003,7 @@ EOF
echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6
echo "configure:2008: checking size of uint32_t" >&5
echo "configure:2007: 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
@ -2012,7 +2011,7 @@ else
ac_cv_sizeof_uint32_t=0
else
cat > conftest.$ac_ext <<EOF
#line 2016 "configure"
#line 2015 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2028,7 +2027,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2031: \"$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
@ -2049,7 +2048,7 @@ EOF
echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6
echo "configure:2053: checking size of uint64_t" >&5
echo "configure:2052: 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
@ -2057,7 +2056,7 @@ else
ac_cv_sizeof_uint64_t=0
else
cat > conftest.$ac_ext <<EOF
#line 2061 "configure"
#line 2060 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2073,7 +2072,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2076: \"$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
@ -2097,12 +2096,12 @@ EOF
for ac_func in strerror strtoul
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2101: checking for $ac_func" >&5
echo "configure:2100: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2106 "configure"
#line 2105 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2125,7 +2124,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2128: \"$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

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(file.c)
AM_INIT_AUTOMAKE(file, 3.33)
AM_INIT_AUTOMAKE(file, 3.35)
AM_CONFIG_HEADER(config.h)
AC_MSG_CHECKING(for builtin ELF support)

View File

@ -1,11 +1,19 @@
#define FILE_VERSION_MAJOR 3
#define patchlevel 34
#define patchlevel 35
/*
* Patchlevel file for Ian Darwin's MAGIC command.
* $Id: patchlevel.h,v 1.34 2001/03/12 05:05:57 christos Exp $
* $Id: patchlevel.h,v 1.35 2001/04/24 14:40:25 christos Exp $
*
* $Log: patchlevel.h,v $
* 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
* - portability fixes for mmap()
* - try gzip before uncompress, because uncompress sometimes hangs
* - be more conservative about pipe reads and writes
* - many magic fixes
*
* Revision 1.34 2001/03/12 05:05:57 christos
* - new compiled magic format
* - lots of magic additions

View File

@ -1,5 +1,5 @@
/*
* softmagic - interpret variable magic from /etc/magic
* softmagic - interpret variable magic from MAGIC
*
* Copyright (c) Ian F. Darwin, 1987.
* Written by Ian F. Darwin.
@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$Id: softmagic.c,v 1.43 2001/03/11 20:29:16 christos Exp $")
FILE_RCSID("@(#)$Id: softmagic.c,v 1.44 2001/03/17 19:32:50 christos Exp $")
#endif /* lint */
static int match __P((struct magic *, uint32, unsigned char *, int));
@ -46,6 +46,8 @@ static int32 mprint __P((union VALUETYPE *, struct magic *));
static void mdebug __P((int32, char *, int));
static int mconvert __P((union VALUETYPE *, struct magic *));
extern int kflag;
/*
* softmagic - lookup one file in database
* (already read from /etc/magic by apprentice.c).
@ -108,9 +110,7 @@ match(magic, nmagic, s, nbytes)
static size_t tmplen = 0;
int32 oldoff = 0;
int returnval = 0; /* if a match is found it is set to 1*/
extern int kflag;
int firstline = 1; /* a flag to print X\n X\n- X */
struct mlist *ml;
if (tmpoff == NULL)
if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)