Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/file file 3.40



details:   https://anonhg.NetBSD.org/src/rev/244debf78113
branches:  trunk
changeset: 543366:244debf78113
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Feb 23 23:08:21 2003 +0000

description:
file 3.40

diffstat:

 dist/file/Header             |     5 +
 dist/file/LEGAL.NOTICE       |    36 +
 dist/file/Localstuff         |     7 +
 dist/file/MAINT              |    35 +
 dist/file/README             |    99 +++
 dist/file/apprentice.c       |  1119 ++++++++++++++++++++++++++++++++++++++++++
 dist/file/ascmagic.c         |   668 +++++++++++++++++++++++++
 dist/file/compress.c         |   335 ++++++++++++
 dist/file/file.1             |   464 +++++++++++++++++
 dist/file/file.c             |   576 +++++++++++++++++++++
 dist/file/file.h             |   199 +++++++
 dist/file/fsmagic.c          |   252 +++++++++
 dist/file/is_tar.c           |   103 +++
 dist/file/magdir/acorn       |    32 +
 dist/file/magdir/adi         |    12 +
 dist/file/magdir/adventure   |    63 ++
 dist/file/magdir/allegro     |     7 +
 dist/file/magdir/alliant     |    17 +
 dist/file/magdir/alpha       |    30 +
 dist/file/magdir/amanda      |    10 +
 dist/file/magdir/amigaos     |    39 +
 dist/file/magdir/animation   |   196 +++++++
 dist/file/magdir/apl         |     6 +
 dist/file/magdir/apple       |   122 ++++
 dist/file/magdir/applix      |    12 +
 dist/file/magdir/archive     |   258 +++++++++
 dist/file/magdir/asterix     |    17 +
 dist/file/magdir/att3b       |    40 +
 dist/file/magdir/audio       |   246 +++++++++
 dist/file/magdir/blender     |    17 +
 dist/file/magdir/blit        |    19 +
 dist/file/magdir/bsdi        |    41 +
 dist/file/magdir/c-lang      |    13 +
 dist/file/magdir/cddb        |    11 +
 dist/file/magdir/chi         |     7 +
 dist/file/magdir/cisco       |    10 +
 dist/file/magdir/citrus      |     6 +
 dist/file/magdir/claris      |    46 +
 dist/file/magdir/clipper     |    64 ++
 dist/file/magdir/commands    |    62 ++
 dist/file/magdir/compress    |   171 ++++++
 dist/file/magdir/console     |   122 ++++
 dist/file/magdir/convex      |    69 ++
 dist/file/magdir/ctags       |     5 +
 dist/file/magdir/cvs         |     6 +
 dist/file/magdir/database    |    80 +++
 dist/file/magdir/diamond     |    11 +
 dist/file/magdir/diff        |    13 +
 dist/file/magdir/digital     |    41 +
 dist/file/magdir/dolby       |    57 ++
 dist/file/magdir/dump        |    81 +++
 dist/file/magdir/dyadic      |    12 +
 dist/file/magdir/editors     |    13 +
 dist/file/magdir/elf         |   206 +++++++
 dist/file/magdir/encore      |    21 +
 dist/file/magdir/epoc        |    10 +
 dist/file/magdir/filesystems |   276 ++++++++++
 dist/file/magdir/flash       |    13 +
 dist/file/magdir/fonts       |    51 +
 dist/file/magdir/frame       |    38 +
 dist/file/magdir/freebsd     |   143 +++++
 dist/file/magdir/fsav        |    27 +
 dist/file/magdir/gimp        |    36 +
 dist/file/magdir/gnu         |    12 +
 dist/file/magdir/grace       |    20 +
 dist/file/magdir/gringotts   |    47 +
 dist/file/magdir/hitachi-sh  |    18 +
 dist/file/magdir/hp          |   395 ++++++++++++++
 dist/file/magdir/human68k    |    25 +
 dist/file/magdir/ibm370      |    47 +
 dist/file/magdir/ibm6000     |    17 +
 dist/file/magdir/iff         |    28 +
 dist/file/magdir/images      |   361 +++++++++++++
 dist/file/magdir/intel       |    35 +
 dist/file/magdir/interleaf   |     8 +
 dist/file/magdir/island      |     9 +
 dist/file/magdir/ispell      |    62 ++
 dist/file/magdir/java        |    11 +
 dist/file/magdir/jpeg        |    61 ++
 dist/file/magdir/karma       |     8 +
 dist/file/magdir/lecter      |     4 +
 dist/file/magdir/lex         |    11 +
 dist/file/magdir/lif         |     7 +
 dist/file/magdir/linux       |   167 ++++++
 dist/file/magdir/lisp        |    32 +
 dist/file/magdir/mach        |    43 +
 dist/file/magdir/macintosh   |   335 ++++++++++++
 dist/file/magdir/magic       |     9 +
 dist/file/magdir/mail.news   |    28 +
 dist/file/magdir/maple       |    57 ++
 dist/file/magdir/mathematica |    59 ++
 dist/file/magdir/mcrypt      |    36 +
 dist/file/magdir/mime        |     7 +
 dist/file/magdir/mips        |   177 ++++++
 dist/file/magdir/mirage      |     7 +
 dist/file/magdir/mkid        |    10 +
 dist/file/magdir/mlssa       |     7 +
 dist/file/magdir/mmdf        |     5 +
 dist/file/magdir/modem       |    33 +
 dist/file/magdir/motorola    |    50 +
 dist/file/magdir/msdos       |   311 +++++++++++
 dist/file/magdir/msvc        |    44 +
 dist/file/magdir/natinst     |    23 +
 dist/file/magdir/ncr         |    48 +
 dist/file/magdir/netbsd      |   246 +++++++++
 dist/file/magdir/netscape    |    21 +
 dist/file/magdir/news        |    12 +
 dist/file/magdir/nitpicker   |    12 +
 dist/file/magdir/octave      |     4 +
 dist/file/magdir/olf         |    97 +++
 dist/file/magdir/os2         |    47 +
 dist/file/magdir/os9         |    84 +++
 dist/file/magdir/osf1        |     7 +
 dist/file/magdir/palm        |    15 +
 dist/file/magdir/parix       |    12 +
 dist/file/magdir/pbm         |     7 +
 dist/file/magdir/pdf         |     7 +
 dist/file/magdir/pdp         |    35 +
 dist/file/magdir/perl        |    18 +
 dist/file/magdir/pgp         |    13 +
 dist/file/magdir/pkgadd      |     5 +
 dist/file/magdir/plus5       |    17 +
 dist/file/magdir/printer     |    92 +++
 dist/file/magdir/project     |     9 +
 dist/file/magdir/psdbms      |     7 +
 dist/file/magdir/pulsar      |    12 +
 dist/file/magdir/pyramid     |    11 +
 dist/file/magdir/python      |    14 +
 dist/file/magdir/riff        |   104 +++
 dist/file/magdir/rpm         |    17 +
 dist/file/magdir/rtf         |    12 +
 dist/file/magdir/sc          |     5 +
 dist/file/magdir/sccs        |    21 +
 dist/file/magdir/sendmail    |    19 +
 dist/file/magdir/sequent     |    34 +
 dist/file/magdir/sgml        |    27 +
 dist/file/magdir/sharc       |    22 +
 dist/file/magdir/sketch      |     5 +
 dist/file/magdir/smalltalk   |    24 +
 dist/file/magdir/sniffer     |   205 +++++++
 dist/file/magdir/softquad    |    29 +
 dist/file/magdir/spectrum    |    28 +
 dist/file/magdir/sun         |   107 ++++
 dist/file/magdir/sysex       |   142 +++++
 dist/file/magdir/teapot      |     4 +
 dist/file/magdir/terminfo    |     9 +
 dist/file/magdir/tex         |   103 +++
 dist/file/magdir/tgif        |     6 +
 dist/file/magdir/ti-8x       |    36 +
 dist/file/magdir/timezone    |    14 +
 dist/file/magdir/troff       |    28 +
 dist/file/magdir/tuxedo      |     7 +
 dist/file/magdir/typeset     |     7 +
 dist/file/magdir/unknown     |    36 +
 dist/file/magdir/uuencode    |    30 +
 dist/file/magdir/varied.out  |    32 +
 dist/file/magdir/vax         |    34 +
 dist/file/magdir/vicar       |    16 +
 dist/file/magdir/visx        |    31 +
 dist/file/magdir/vms         |    27 +
 dist/file/magdir/vmware      |    12 +
 dist/file/magdir/vorbis      |    79 ++
 dist/file/magdir/vxl         |    13 +
 dist/file/magdir/wordperfect |    91 +++
 dist/file/magdir/xdelta      |    10 +
 dist/file/magdir/xenix       |    72 ++
 dist/file/magdir/zilog       |    11 +
 dist/file/magdir/zyxel       |    16 +
 dist/file/magic.5            |   224 ++++++++
 dist/file/magic.mime         |   547 ++++++++++++++++++++
 dist/file/names.h            |   161 ++++++
 dist/file/patchlevel.h       |   243 +++++++++
 dist/file/print.c            |   232 ++++++++
 dist/file/readelf.c          |   667 +++++++++++++++++++++++++
 dist/file/readelf.h          |   213 +++++++
 dist/file/softmagic.c        |  1115 +++++++++++++++++++++++++++++++++++++++++
 dist/file/tar.h              |   179 ++++++
 177 files changed, 15387 insertions(+), 0 deletions(-)

diffs (truncated from 16095 to 300 lines):

diff -r 908618a67c3c -r 244debf78113 dist/file/Header
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/Header  Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,5 @@
+# Magic
+# Magic data for file(1) command.
+# Machine-generated from src/cmd/file/magdir/*; edit there only!
+# Format is described in magic(files), where:
+# files is 5 on V7 and BSD, 4 on SV, and ?? in the SVID.
diff -r 908618a67c3c -r 244debf78113 dist/file/LEGAL.NOTICE
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/LEGAL.NOTICE    Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,36 @@
+$NetBSD: LEGAL.NOTICE,v 1.1.1.1 2003/02/23 23:08:21 pooka Exp $
+
+Id: LEGAL.NOTICE,v 1.11 1999/01/14 16:30:12 christos Exp 
+Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
+Software written by Ian F. Darwin and others;
+maintained 1994-1999 Christos Zoulas.
+
+This software is not subject to any export provision of the United States
+Department of Commerce, and may be exported to any country or planet.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice immediately at the beginning of the file, without modification,
+   this list of conditions, and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+   This product includes software developed by Ian F. Darwin and others.
+4. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+ 
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff -r 908618a67c3c -r 244debf78113 dist/file/Localstuff
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/Localstuff      Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,7 @@
+
+#------------------------------------------------------------------------------
+# Localstuff:  file(1) magic for locally observed files
+#
+# $Id: Localstuff,v 1.1.1.1 2003/02/23 23:08:29 pooka Exp $
+# Add any locally observed files here.  Remember:
+# text if readable, executable if runnable binary, data if unreadable.
diff -r 908618a67c3c -r 244debf78113 dist/file/MAINT
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/MAINT   Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,35 @@
+$NetBSD: MAINT,v 1.1.1.1 2003/02/23 23:08:21 pooka Exp $
+
+Id: MAINT,v 1.4 2000/04/11 02:43:51 christos Exp 
+
+Maintenance notes:
+
+I am continuing to maintain the file command. I welcome your help,
+but to make my life easier I'd like to request the following:
+
+- Don't change the version numbers!
+
+If your changes are extensive, I will have to work hard to 
+integrate them into my version.  If you check it into SCCS locally,
+the version numbers will likely be kept. IF you check it into RCS
+or CVS locally, please use -k to keep the version numbers, and
+please use branch deltas (1.21.1, 1.21.2, ...).  If you don't do
+this, I will likely be unable to use your changes; life's just too
+short.
+
+- Do not distribute changed versions.
+
+People trying to be helpful occasionally put up their hacked versions
+of the file command for FTP, then the "archie" server finds and publishes
+the hacked version, and people all over the world get copies of it.
+Within a day or two I am getting email from around the world
+asking me why "my" file command won't compile!!! Needless to say this
+detracts from the limited time I have available to work on the actual
+software.  Therefore I ask you again to please NOT distribute
+your changed version.
+
+
+Thank you for your assistance and cooperation.
+
+Christos Zoulas
+christos%astron.com@localhost
diff -r 908618a67c3c -r 244debf78113 dist/file/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/README  Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,99 @@
+$NetBSD: README,v 1.1.1.1 2003/02/23 23:08:22 pooka Exp $
+
+** README for file(1) Command **
+@(#) Id: README,v 1.28 2003/02/08 18:35:36 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,
+*BSD, and other systems. (See "patchlevel.h" for the exact release number).
+
+UNIX is a trademark of UNIX System Laboratories.
+
+The prime contributor to Release 3.8 was Guy Harris, who put in megachanges
+including byte-order independence.
+
+The prime contributor to Release 3.0 was Christos Zoulas, who put
+in hundreds of lines of source code changes, including his own
+ANSIfication of the code (I liked my own ANSIfication better, but
+his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB
+to include the code...), his HP-like "indirection" (a feature of
+the HP file command, I think), and his mods that finally got the
+uncompress (-z) mode finished and working.
+
+This release has compiled in numerous environments; see PORTING
+for a list and problems.
+
+This fine freeware file(1) follows the USG (System V) model of the file
+command, rather than the Research (V7) version or the V7-derived 4.[23]
+Berkeley one. That is, the file /etc/magic contains much of the ritual
+information that is the source of this program's power. My version
+knows a little more magic (including tar archives) than System V; the
+/etc/magic parsing seems to be compatible with the (poorly documented)
+System V /etc/magic format (with one exception; see the man page).
+
+In addition, the /etc/magic file is built from a subdirectory
+for easier(?) maintenance.  I will act as a clearinghouse for
+magic numbers assigned to all sorts of data files that
+are in reasonable circulation. Send your magic numbers,
+in magic(4) format please, to the maintainer, Christos Zoulas.
+
+LEGAL.NOTICE - read this first.
+README - read this second (you are currently reading this file).
+PORTING - read this only if the program won't compile.
+Makefile - read this next, adapt it as needed (particularly
+       the location of the old existing file command and
+       the man page layouts), type "make" to compile, 
+       "make try" to try it out against your old version.
+       Expect some diffs, particularly since your original
+       file(1) may not grok the embedded-space ("\ ") in
+       the current magic file, or may even not use the
+       magic file.
+apprentice.c - parses /etc/magic to learn magic
+ascmagic.c - third & last set of tests, based on hardwired assumptions.
+core - not included in distribution due to mailer limitations.
+debug.c - includes -c printout routine
+file.1 - man page for the command
+magic.4 - man page for the magic file, courtesy Guy Harris.
+       Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
+file.c - main program
+file.h - header file
+fsmagic.c - first set of tests the program runs, based on filesystem info
+is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
+magdir - directory of /etc/magic pieces
+       magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION
+names.h - header file for ascmagic.c
+softmagic.c - 2nd set of tests, based on /etc/magic
+readelf.[ch] - Stand-alone elf parsing code.
+compress.c - on-the-fly decompression.
+print.c - print results, errors, warnings.
+
+If your gzip sometimes fails to decompress things complaining about a short
+file, apply this patch [which is going to be in the next version of gzip]:
+*** -   Tue Oct 29 02:06:35 1996
+--- util.c      Sun Jul 21 21:51:38 1996
+*** 106,111 ****
+--- 108,114 ----
+  
+      if (insize == 0) {
+        if (eof_ok) return EOF;
++       flush_window();
+        read_error();
+      }
+      bytes_in += (ulg)insize;
+
+E-mail: christos%astron.com@localhost
+
+Phone: Do not even think of telephoning me about this program. Send cash first!
+
+Parts of this software were developed at SoftQuad Inc., 56 Aberfoyle
+Cres, # 810, Toronto, Ontario CANADA M8X 2W4.  Phone: 416-239-4801 or
+800-387-2777. Email: mail%sq.com@localhost.  Call for information on SGML editing
+and browsing, Unix text processing, and customised products on Unix,
+DOS and Mac.
+
+From: Kees Zeelenberg
+
+An MS-Windows (Win32) port of File-3.40 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.
diff -r 908618a67c3c -r 244debf78113 dist/file/apprentice.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/file/apprentice.c    Sun Feb 23 23:08:21 2003 +0000
@@ -0,0 +1,1119 @@
+/*     $NetBSD: apprentice.c,v 1.1.1.1 2003/02/23 23:08:23 pooka Exp $ */
+
+/*
+ * apprentice - make one pass through /etc/magic, learning its secrets.
+ *
+ * Copyright (c) Ian F. Darwin, 1987.
+ * Written by Ian F. Darwin.
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or of the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. The author is not responsible for the consequences of use of this
+ *    software, no matter how awful, even if they arise from flaws in it.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Since few users ever read sources,
+ *    credits must appear in the documentation.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.  Since few users
+ *    ever read sources, credits must appear in the documentation.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#include "file.h"
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#ifdef QUICK
+#include <sys/mman.h>
+#endif
+
+#ifndef        lint
+#if 0
+FILE_RCSID("@(#)Id: apprentice.c,v 1.49 2002/07/03 19:00:41 christos Exp ")
+#else
+__RCSID("$NetBSD: apprentice.c,v 1.1.1.1 2003/02/23 23:08:23 pooka Exp $");
+#endif
+#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=';';
+#else
+  char PATHSEP=':';
+#endif
+
+
+static int getvalue(struct magic *, char **);
+static int hextoint(int);
+static char *getstr(char *, char *, int, int *);
+static int parse(struct magic **, uint32_t *, char *, int);
+static void eatsize(char **);
+static int apprentice_1(const char *, int);
+static int apprentice_file(struct magic **, uint32_t *, const char *, int);
+static void byteswap(struct magic *, uint32_t);
+static void bs1(struct magic *);
+static uint16_t swap2(uint16_t);
+static uint32_t swap4(uint32_t);
+static char *mkdbname(const char *);
+static int apprentice_map(struct magic **, uint32_t *, const char *, int);
+static int apprentice_compile(struct magic **, uint32_t *, const char *, int);
+
+static int maxmagic = 0;



Home | Main Index | Thread Index | Old Index