Virgin import of Christos Zoulas's FILE 3.37.

This commit is contained in:
David E. O'Brien 2001-10-08 22:50:54 +00:00
parent 2e67ec0205
commit 649d615c25
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/file/dist/; revision=84685
25 changed files with 481 additions and 98 deletions

View File

@ -4,7 +4,7 @@
#
# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG
# (the others should be seperate, anyway)
# (the others should be separate, anyway)
#
0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary
0 belong 0x000003e7 AmigaOS object/library data

View File

@ -0,0 +1,6 @@
#------------------------------------------------------------------------------
# citrus locale declaration
#
0 string RuneCT Citrus locale declaration for LC_CTYPE

View File

@ -2,7 +2,7 @@
#------------------------------------------------------------------------------
# commands: file(1) magic for various shells and interpreters
#
0 string :\ shell archive or script for antique kernel text
0 string : shell archive or script for antique kernel text
0 string/b #!\ /bin/sh Bourne shell script text executable
0 string/b #!\ /bin/csh C shell script text executable
# korn shell magic, sent by George Wu, gwu@clyde.att.com

View File

@ -85,6 +85,7 @@
>>18 leshort 51 Stanford MIPS-X,
>>18 leshort 52 Motorola Coldfire,
>>18 leshort 53 Motorola M68HC12,
>>18 leshort 62 AMD x86-64,
>>18 leshort 75 Digital VAX,
>>18 leshort 0x9026 Alpha (unofficial),
>>20 lelong 0 invalid version

View File

@ -63,31 +63,33 @@
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,
#>9504 ledate x last checked at %s,
>8224 ledate x last written at %s,
>8401 byte x clean flag %d,
>8228 lelong x number of blocks %d,
>8232 lelong x number of data blocks %d,
>8236 lelong x number of cylinder groups %d,
>8240 lelong x number of basic blocks %d,
>8244 lelong x number of fragment blocks %d,
>8248 lelong x minimum percentage of free blocks %d,
>8252 lelong x rotational delay %dms,
>8256 lelong x disk rotational speed %drps,
>8240 lelong x block size %d,
>8244 lelong x fragment size %d,
>8252 lelong x minimum percentage of free blocks %d,
>8256 lelong x rotational delay %dms,
>8260 lelong x disk rotational speed %drps,
>8320 lelong 0 TIME optimization
>8320 lelong 1 SPACE optimization
9564 belong 0x00011954 Unix Fast File system (little-endian),
9564 belong 0x00011954 Unix Fast File system (big-endian),
>8404 string x last mounted on %s,
>9504 bedate x last checkd at %s,
>8224 bedate x last writen at %s,
#>9504 bedate x last checked at %s,
>8224 bedate x last written at %s,
>8401 byte x clean flag %d,
>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,
>8240 belong x block size %d,
>8244 belong x fragment size %d,
>8252 belong x minimum percentage of free blocks %d,
>8256 belong x rotational delay %dms,
>8260 belong x disk rotational speed %drps,
>8320 belong 0 TIME optimization
>8320 belong 1 SPACE optimization
@ -104,3 +106,13 @@
#>0x460 lelong &0x0000002 (filetype)
#>0x464 lelong &0x0000001 (sparse_super)
>0x464 lelong &0x0000002 (large files)
# SGI disk labels - Nathan Scott <nathans@debian.org>
0 belong 0x0BE5A941 SGI disk label (volume header)
# SGI XFS filesystem - Nathan Scott <nathans@debian.org>
0 belong 0x58465342 SGI XFS filesystem data
>0x4 belong x (blksz=3D%d,
>0x68 beshort x inosz=3D%d,
>0x64 beshort ^0x2004 v1 dirs)
>0x64 beshort &0x2004 v2 dirs)

View File

@ -231,6 +231,10 @@
>12 belong x %d
#
2048 string PCD_IPI Kodak Photo CD image pack file
>0xe02 byte&0x03 0x00 , landscape mode
>0xe02 byte&0x03 0x01 , portrait mode
>0xe02 byte&0x03 0x02 , landscape mode
>0xe02 byte&0x03 0x03 , portrait mode
0 string PCD_OPA Kodak Photo CD overview pack file
# FITS format. Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
@ -266,7 +270,7 @@
# As described in /usr/X11R6/include/X11/XWDFile.h
# used by the xwd program.
# Bradford Castalia, idaeim, 1/01
4 belong 7 XWD X-Widows Dump image data
4 belong 7 XWD X-Windows Dump image data
>100 string >\0 \b, "%s"
>16 belong x \b, %dx
>20 belong x \b%dx
@ -283,8 +287,6 @@
0 string PDS_ PDS image data
0 string LBLSIZE= PDS (VICAR) image data
0 string GSTIm GNU SmallTalk image file
# pM8x: ATARI STAD compressed bitmap format
#
# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
@ -301,20 +303,33 @@
>5 byte 0x00 (white background)
>5 byte 0xFF (black background)
# XXX:
# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
# magic.
# SGI RICE image file <mpruett@sgi.com>
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
#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
#------------------------------------------------------------------------------
#
# Marco Schmidt (marcoschmidt@users.sourceforge.net) -- an image file format
# for the EPOC operating system, which is used with PDAs like those from Psion
#
# see http://huizen.dds.nl/~frodol/psiconv/html/Index.html for a description
# of various EPOC file formats
0 string \x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47 EPOC MBM image file

View File

@ -0,0 +1,23 @@
#-----------------------------------------------------------------------------
# natinst: file(1) magic for National Instruments Code Files
#
# From <egamez@fcfm.buap.mx> Enrique Gámez-Flores
# version 1
# Many formats still missing, we use, for the moment LabVIEW
# We guess VXI format file. VISA, LabWindowsCVI, BridgeVIEW, etc, are missing
#
0 string RSRC National Instruments,
# Check if it's a LabVIEW File
>8 string LV LabVIEW File,
# Check wich kind of file is
>>10 string SB Code Resource File, data
>>10 string IN Virtual Instrument Program, data
>>10 string AR VI Library, data
# This is for Menu Libraries
>8 string LMNULBVW Portable File Names, data
# This is for General Resources
>8 string rsc Resources File, data
# This is for VXI Package
0 string VMAP National Instruments, VXI File, data

View File

@ -1,8 +1,9 @@
#-----------------------------------------------
# GNU Smalltalk image, starting at version 1.6.2
# From: catull_us@yahoo.com
#
0 string GSTIm\0\0 GNU Smalltalk
0 string GSTIm\0\0 GNU SmallTalk
# little-endian
>7 byte&1 =0 LE image version
>>10 byte x %d.

View File

@ -84,15 +84,18 @@
>20 belong 13 (BSD/OS SLIP
>20 belong 14 (BSD/OS PPP
>20 belong 50 (PPP or Cisco HDLC
>20 belong 51 (PPP-over-Ethernet
>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 105 (802.11
>20 belong 106 (Linux Classical IP over ATM
>20 belong 108 (OpenBSD loopback
>20 belong 109 (OpenBSD IPSEC encrypted
>20 belong 113 (Linux "cooked"
>20 belong 114 (LocalTalk
>16 belong x \b, capture length %d)
0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian)
>4 leshort x - version %d
@ -113,15 +116,18 @@
>20 lelong 13 (BSD/OS SLIP
>20 lelong 14 (BSD/OS PPP
>20 lelong 50 (PPP or Cisco HDLC
>20 lelong 51 (PPP-over-Ethernet
>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 105 (802.11
>20 lelong 106 (Linux Classical IP over ATM
>20 lelong 108 (OpenBSD loopback
>20 lelong 109 (OpenBSD IPSEC encrypted
>20 lelong 113 (Linux "cooked"
>20 lelong 114 (LocalTalk
>16 lelong x \b, capture length %d)
#
@ -189,3 +195,11 @@
# RADCOM WAN/LAN Analyzer capture files.
#
0 string \x42\xd2\x00\x34\x12\x66\x22\x88 RADCOM WAN/LAN Analyzer capture file
#
# NetStumbler log files. Not really packets, per se, but about as
# close as you can get. These are log files from NetStumbler, a
# Windows program, that scans for 802.11b networks.
#
0 string NetS NetStumbler log file
>8 lelong x \b, %d stations found

View File

@ -86,7 +86,7 @@ EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime Localstuff Head
CLEANFILES = $(man_MANS) magic magic.mgc
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
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/natinst 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
@ -122,7 +122,7 @@ missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
SOURCES = $(file_SOURCES)
OBJECTS = $(file_OBJECTS)

View File

@ -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.11 2001/07/22 21:04:15 christos Exp $
# @(#)$Id: Makefile.std,v 1.12 2001/09/03 14:44:21 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.36
VERSION = 3.37
SHELL = /bin/sh
#MAGIC = /etc/magic
MAGIC = /usr/local/etc/magic

View File

@ -1,5 +1,5 @@
** README for file(1) Command **
@(#) $Id: README,v 1.24 2001/03/12 05:05:57 christos Exp $
@(#) $Id: README,v 1.25 2001/07/23 21:30:22 christos Exp $
This is Release 3.x of Ian Darwin's (copyright but distributable)
file(1) command. This version is the standard "file" command for Linux,
@ -90,11 +90,9 @@ Cres, # 810, Toronto, Ontario CANADA M8X 2W4. Phone: 416-239-4801 or
and browsing, Unix text processing, and customised products on Unix,
DOS and Mac.
From Kees Zeelenberg
From: Kees Zeelenberg
File 3.33 is available from Simtelnet and its mirrors:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/file333b.zip
Documentation and sources are available from the same folder.
File determines the file type of a given file. It is an implementation
of the Unix file(1) command. It knows the 'magic number' of some 4000
files.
An MS-Windows (Win32) port of File-3.36 is available from
http://gnuwin32.sourceforge.net/
File is an implementation of the Unix File(1) command.
It knows the 'magic number' of several thousands of file types.

View File

@ -13,6 +13,12 @@
/* Define if the `long long' type works. */
#undef HAVE_LONG_LONG
/* Define if we have "tm_isdst" in "struct tm". */
#undef HAVE_TM_ISDST
/* Define if we have a global "int" variable "daylight". */
#undef HAVE_DAYLIGHT
/* Define to `unsigned char' if standard headers don't define. */
#undef uint8_t

View File

@ -21,6 +21,51 @@ dnl From: eggert@twinsun.com (Paul Eggert)
dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
dnl Newsgroups: gnu.utils.bug
dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
[AC_REQUIRE([AC_STRUCT_TM])dnl
AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
if test "$ac_cv_struct_tm_zone" = yes; then
AC_DEFINE(HAVE_TM_ZONE)
fi
AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
[AC_TRY_LINK(
changequote(<<, >>)dnl
<<#include <time.h>
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif>>,
changequote([, ])dnl
[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
if test $ac_cv_var_tzname = yes; then
AC_DEFINE(HAVE_TZNAME)
fi
AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
if test "$ac_cv_struct_tm_isdst" = yes; then
AC_DEFINE(HAVE_TM_ISDST)
fi
AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
[AC_TRY_LINK(
changequote(<<, >>)dnl
<<#include <time.h>
#ifndef daylight /* In case IRIX #defines this, too */
extern int daylight;
#endif>>,
changequote([, ])dnl
[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
if test $ac_cv_var_daylight = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
])
dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
AC_DEFUN(AC_CHECK_TYPE2,
[AC_REQUIRE([AC_HEADER_STDC])dnl

View File

@ -33,6 +33,51 @@ dnl From: eggert@twinsun.com (Paul Eggert)
dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
dnl Newsgroups: gnu.utils.bug
dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
[AC_REQUIRE([AC_STRUCT_TM])dnl
AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
if test "$ac_cv_struct_tm_zone" = yes; then
AC_DEFINE(HAVE_TM_ZONE)
fi
AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
[AC_TRY_LINK(
changequote(<<, >>)dnl
<<#include <time.h>
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif>>,
changequote([, ])dnl
[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
if test $ac_cv_var_tzname = yes; then
AC_DEFINE(HAVE_TZNAME)
fi
AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
if test "$ac_cv_struct_tm_isdst" = yes; then
AC_DEFINE(HAVE_TM_ISDST)
fi
AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
[AC_TRY_LINK(
changequote(<<, >>)dnl
<<#include <time.h>
#ifndef daylight /* In case IRIX #defines this, too */
extern int daylight;
#endif>>,
changequote([, ])dnl
[atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
if test $ac_cv_var_daylight = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
])
dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
AC_DEFUN(AC_CHECK_TYPE2,
[AC_REQUIRE([AC_HEADER_STDC])dnl

View File

@ -28,6 +28,9 @@
#include "file.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <ctype.h>
#include <errno.h>
@ -39,7 +42,7 @@
#endif
#ifndef lint
FILE_RCSID("@(#)$Id: apprentice.c,v 1.42 2001/07/22 21:04:15 christos Exp $")
FILE_RCSID("@(#)$Id: apprentice.c,v 1.44 2001/08/01 14:03:19 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
@ -330,7 +333,7 @@ parse(magicp, nmagicp, l, action)
{
int i = 0;
struct magic *m;
char *t, *s;
char *t;
#define ALLOC_INCR 200
if (*nmagicp + 1 >= maxmagic){

View File

@ -46,7 +46,7 @@
#include "names.h"
#ifndef lint
FILE_RCSID("@(#)$Id: ascmagic.c,v 1.29 2000/08/05 19:00:11 christos Exp $")
FILE_RCSID("@(#)$Id: ascmagic.c,v 1.30 2001/07/26 13:15:49 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
@ -105,9 +105,12 @@ ascmagic(buf, nbytes)
return 1;
}
/* Undo the NUL-termination kindly provided by process() */
/*
* Undo the NUL-termination kindly provided by process()
* but leave at least one byte to look at
*/
while (nbytes > 0 && buf[nbytes - 1] == '\0')
while (nbytes > 1 && buf[nbytes - 1] == '\0')
nbytes--;
/*

View File

@ -9,6 +9,13 @@
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
#undef MAJOR_IN_MKDEV
@ -24,6 +31,9 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define if builtin ELF support is enabled. */
#undef BUILTIN_ELF
@ -33,6 +43,12 @@
/* Define if the `long long' type works. */
#undef HAVE_LONG_LONG
/* Define if we have "tm_isdst" in "struct tm". */
#undef HAVE_TM_ISDST
/* Define if we have a global "int" variable "daylight". */
#undef HAVE_DAYLIGHT
/* Define to `unsigned char' if standard headers don't define. */
#undef uint8_t

226
contrib/file/configure vendored
View File

@ -697,7 +697,7 @@ fi
PACKAGE=file
VERSION=3.36
VERSION=3.37
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; }
@ -1802,14 +1802,186 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
echo "configure:1807: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1812 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
if { (eval echo configure:1820: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_tm=sys/time.h
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_tm" 1>&6
if test $ac_cv_struct_tm = sys/time.h; then
cat >> confdefs.h <<\EOF
#define TM_IN_SYS_TIME 1
EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
echo "configure:1841: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1846 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
if { (eval echo configure:1854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_tm_zone=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
if test "$ac_cv_struct_tm_zone" = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_TM_ZONE 1
EOF
fi
echo $ac_n "checking for tzname""... $ac_c" 1>&6
echo "configure:1874: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1879 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif
int main() {
atoi(*tzname);
; return 0; }
EOF
if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_var_tzname=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_var_tzname" 1>&6
if test $ac_cv_var_tzname = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_TZNAME 1
EOF
fi
echo $ac_n "checking for tm_isdst in struct tm""... $ac_c" 1>&6
echo "configure:1910: checking for tm_isdst in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_isdst'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1915 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
int main() {
struct tm tm; tm.tm_isdst;
; return 0; }
EOF
if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_isdst=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_tm_isdst=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_tm_isdst" 1>&6
if test "$ac_cv_struct_tm_isdst" = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_TM_ISDST 1
EOF
fi
echo $ac_n "checking for daylight""... $ac_c" 1>&6
echo "configure:1943: checking for daylight" >&5
if eval "test \"`echo '$''{'ac_cv_var_daylight'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1948 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef daylight /* In case IRIX #defines this, too */
extern int daylight;
#endif
int main() {
atoi(daylight);
; return 0; }
EOF
if { (eval echo configure:1958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_daylight=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_var_daylight=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_var_daylight" 1>&6
if test $ac_cv_var_daylight = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_DAYLIGHT 1
EOF
fi
echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
echo "configure:1808: checking for uint8_t" >&5
echo "configure:1980: 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 1813 "configure"
#line 1985 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1837,12 +2009,12 @@ EOF
fi
echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
echo "configure:1841: checking for uint16_t" >&5
echo "configure:2013: 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 1846 "configure"
#line 2018 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1870,12 +2042,12 @@ EOF
fi
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
echo "configure:1874: checking for uint32_t" >&5
echo "configure:2046: 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 1879 "configure"
#line 2051 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1904,7 +2076,7 @@ fi
echo $ac_n "checking for long long""... $ac_c" 1>&6
echo "configure:1908: checking for long long" >&5
echo "configure:2080: 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
@ -1915,13 +2087,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 1919 "configure"
#line 2091 "configure"
#include "confdefs.h"
int main() {
long long foo = 0;
exit(sizeof(long long) < sizeof(long)); }
EOF
if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2097: \"$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
@ -1950,12 +2122,12 @@ else
long64='unsigned long';
fi
echo $ac_n "checking for uint64_t""... $ac_c" 1>&6
echo "configure:1954: checking for uint64_t" >&5
echo "configure:2126: 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 1959 "configure"
#line 2131 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1986,7 +2158,7 @@ fi
echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6
echo "configure:1990: checking size of uint8_t" >&5
echo "configure:2162: 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
@ -1994,7 +2166,7 @@ else
ac_cv_sizeof_uint8_t=0
else
cat > conftest.$ac_ext <<EOF
#line 1998 "configure"
#line 2170 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2010,7 +2182,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2186: \"$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
@ -2031,7 +2203,7 @@ EOF
echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6
echo "configure:2035: checking size of uint16_t" >&5
echo "configure:2207: 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
@ -2039,7 +2211,7 @@ else
ac_cv_sizeof_uint16_t=0
else
cat > conftest.$ac_ext <<EOF
#line 2043 "configure"
#line 2215 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2055,7 +2227,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2231: \"$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
@ -2076,7 +2248,7 @@ EOF
echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6
echo "configure:2080: checking size of uint32_t" >&5
echo "configure:2252: 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
@ -2084,7 +2256,7 @@ else
ac_cv_sizeof_uint32_t=0
else
cat > conftest.$ac_ext <<EOF
#line 2088 "configure"
#line 2260 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2100,7 +2272,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2276: \"$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
@ -2121,7 +2293,7 @@ EOF
echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6
echo "configure:2125: checking size of uint64_t" >&5
echo "configure:2297: 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
@ -2129,7 +2301,7 @@ else
ac_cv_sizeof_uint64_t=0
else
cat > conftest.$ac_ext <<EOF
#line 2133 "configure"
#line 2305 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef STDC_HEADERS
@ -2145,7 +2317,7 @@ main()
exit(0);
}
EOF
if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2321: \"$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
@ -2169,12 +2341,12 @@ EOF
for ac_func in mmap strerror strtoul
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2173: checking for $ac_func" >&5
echo "configure:2345: 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 2178 "configure"
#line 2350 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2197,7 +2369,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2373: \"$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.36)
AM_INIT_AUTOMAKE(file, 3.37)
AM_CONFIG_HEADER(config.h)
AC_MSG_CHECKING(for builtin ELF support)
@ -66,6 +66,7 @@ AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
AC_STRUCT_TIMEZONE_DAYLIGHT
dnl FIXME: only found in standard headers!
AC_CHECK_TYPE(uint8_t, unsigned char)

View File

@ -56,7 +56,7 @@
#include "patchlevel.h"
#ifndef lint
FILE_RCSID("@(#)$Id: file.c,v 1.58 2001/07/22 21:04:15 christos Exp $")
FILE_RCSID("@(#)$Id: file.c,v 1.59 2001/07/23 00:02:32 christos Exp $")
#endif /* lint */
@ -131,7 +131,7 @@ main(argc, argv)
if ((usermagic = getenv("MAGIC")) != NULL)
magicfile = usermagic;
else
if (home = getenv("HOME")) {
if ((home = getenv("HOME")) != NULL) {
if ((usermagic = malloc(strlen(home) + 8)) != NULL) {
(void)strcpy(usermagic, home);
(void)strcat(usermagic, "/.magic");

View File

@ -45,7 +45,10 @@ flag, specifies case insensitive matching: lowercase characters in the magic
match both lower and upper case characters in the targer, whereas upper case
characters in the magic, only much uppercase characters in the target.
.IP date
A four-byte value interpreted as a unix date.
A four-byte value interpreted as a UNIX date.
.IP ldate
A four-byte value interpreted as a UNIX-style date, but interpreted as
local time rather than UTC.
.IP beshort
A two-byte value (on most systems) in big-endian byte order.
.IP belong
@ -59,7 +62,11 @@ A two-byte value (on most systems) in little-endian byte order.
A four-byte value (on most systems) in little-endian byte order.
.IP ledate
A four-byte value (on most systems) in little-endian byte order,
interpreted as a unix date.
interpreted as a UNIX date.
.IP leldate
A four-byte value (on most systems) in little-endian byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.RE
.PP
The numeric types may optionally be followed by
@ -212,4 +219,4 @@ indirect offsets.
.\" the changes I posted to the S5R2 version.
.\"
.\" Modified for Ian Darwin's version of the file command.
.\" @(#)$Id: magic.man,v 1.16 1999/11/28 20:02:29 christos Exp $
.\" @(#)$Id: magic.man,v 1.17 2001/08/07 15:38:42 christos Exp $

View File

@ -1,11 +1,16 @@
#define FILE_VERSION_MAJOR 3
#define patchlevel 36
#define patchlevel 37
/*
* Patchlevel file for Ian Darwin's MAGIC command.
* $Id: patchlevel.h,v 1.36 2001/07/22 21:04:15 christos Exp $
* $Id: patchlevel.h,v 1.37 2001/09/03 14:44:22 christos Exp $
*
* $Log: patchlevel.h,v $
* Revision 1.37 2001/09/03 14:44:22 christos
* daylight/tm_isdst detection
* magic fixes
* don't eat the whole file if it has only nulls
*
* Revision 1.36 2001/07/22 21:04:15 christos
* - magic fixes
* - add new operators, pascal strings, UTC date printing, $HOME/.magic

View File

@ -41,7 +41,7 @@
#include <time.h>
#ifndef lint
FILE_RCSID("@(#)$Id: print.c,v 1.33 2001/07/22 21:04:15 christos Exp $")
FILE_RCSID("@(#)$Id: print.c,v 1.34 2001/08/07 16:01:26 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
@ -234,10 +234,24 @@ fmttime(v, local)
{
char *pp, *rt;
time_t t = (time_t)v;
struct tm *tm;
if (local) {
pp = ctime(&t);
} else {
struct tm *tm;
#ifndef HAVE_DAYLIGHT
static int daylight = 0;
#ifdef HAVE_TM_ISDST
static time_t now = (time_t)0;
if (now == (time_t)0) {
struct tm *tm1;
(void)time(&now);
tm1 = localtime(&now);
daylight = tm1->tm_isdst;
}
#endif /* HAVE_TM_ISDST */
#endif /* HAVE_DAYLIGHT */
if (daylight)
t += 3600;
tm = gmtime(&t);

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$Id: softmagic.c,v 1.45 2001/07/22 21:04:15 christos Exp $")
FILE_RCSID("@(#)$Id: softmagic.c,v 1.46 2001/07/23 00:02:32 christos Exp $")
#endif /* lint */
static int match __P((struct magic *, uint32, unsigned char *, int));
@ -214,10 +214,7 @@ mprint(p, m)
union VALUETYPE *p;
struct magic *m;
{
char *pp, *rt;
char *oldtz, tz[16];
uint32 v;
time_t curtime;
int32 t=0 ;
@ -390,7 +387,6 @@ mconvert(p, m)
return 1;
case STRING:
{
char *ptr;
int n;
/* Null terminate and eat *trailing* return */