summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/file/LEGAL.NOTICE24
-rw-r--r--usr.bin/file/apprentice.c72
-rw-r--r--usr.bin/file/file.113
-rw-r--r--usr.bin/file/file.c6
-rw-r--r--usr.bin/file/magdir/NetBSD5
-rw-r--r--usr.bin/file/magdir/animation4
-rw-r--r--usr.bin/file/magdir/audio5
-rw-r--r--usr.bin/file/magdir/c-lang4
-rw-r--r--usr.bin/file/magdir/commands81
-rw-r--r--usr.bin/file/magdir/compress42
-rw-r--r--usr.bin/file/magdir/database8
-rw-r--r--usr.bin/file/magdir/elf7
-rw-r--r--usr.bin/file/magdir/fonts14
-rw-r--r--usr.bin/file/magdir/frame11
-rw-r--r--usr.bin/file/magdir/hp52
-rw-r--r--usr.bin/file/magdir/html15
-rw-r--r--usr.bin/file/magdir/ibm3701
-rw-r--r--usr.bin/file/magdir/iff28
-rw-r--r--usr.bin/file/magdir/images260
-rw-r--r--usr.bin/file/magdir/intel2
-rw-r--r--usr.bin/file/magdir/interleaf4
-rw-r--r--usr.bin/file/magdir/karma1
-rw-r--r--usr.bin/file/magdir/lex2
-rw-r--r--usr.bin/file/magdir/linux30
-rw-r--r--usr.bin/file/magdir/mail.news1
-rw-r--r--usr.bin/file/magdir/msdos3
-rw-r--r--usr.bin/file/magdir/pdf7
-rw-r--r--usr.bin/file/magdir/pgp10
-rw-r--r--usr.bin/file/magdir/printer6
-rw-r--r--usr.bin/file/magdir/pyramid2
-rw-r--r--usr.bin/file/magdir/rpm14
-rw-r--r--usr.bin/file/magdir/rtf4
-rw-r--r--usr.bin/file/magdir/sccs2
-rw-r--r--usr.bin/file/magdir/sgml28
-rw-r--r--usr.bin/file/magdir/softquad2
-rw-r--r--usr.bin/file/magdir/tex13
-rw-r--r--usr.bin/file/magdir/timezone1
-rw-r--r--usr.bin/file/magdir/uuencode29
-rw-r--r--usr.bin/file/magdir/varied.out1
-rw-r--r--usr.bin/file/magdir/vms6
-rw-r--r--usr.bin/file/magdir/zilog1
-rw-r--r--usr.bin/file/patchlevel.h21
42 files changed, 492 insertions, 350 deletions
diff --git a/usr.bin/file/LEGAL.NOTICE b/usr.bin/file/LEGAL.NOTICE
index 3a139b86d5f..c028f510661 100644
--- a/usr.bin/file/LEGAL.NOTICE
+++ b/usr.bin/file/LEGAL.NOTICE
@@ -1,13 +1,10 @@
-Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992.
-Written by Ian F. Darwin and others.
-$Id: LEGAL.NOTICE,v 1.1 1995/10/18 08:45:08 deraadt Exp $
+Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
+Software written by Ian F. Darwin and others; maintained by Christos Zoulas.
+$Id: LEGAL.NOTICE,v 1.2 1995/12/14 03:30:00 deraadt Exp $
-This software is not subject to and may not be made subject to any
-license of the American Telephone and Telegraph Company (AT&T Inc.),
-UNIX System Laboratories (USL Inc.), Novell Inc., Sun Microsystems
-Inc., Digital Equipment Inc., Lotus Development Inc., the Regents of
-the University of California, The X Consortium or MIT, or The Free
-Software Foundation.
+This software (or derivative software) may not be made subject to any
+license which denies anyone permission to alter it and redistribute it
+freely. Derivative software must also still fall under this license.
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.
@@ -26,12 +23,9 @@ to the following restrictions:
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.
+ Derivative works must also be marked as such, and credits must appear
+ in the documentation.
4. This notice may not be removed or altered.
-UNIX is a trademark of UNIX System Laboratories (which is probably a
-subsidiary of Novell, Inc., by the time you read this). The name "UNIX"
-may not be used by commercial undertakings without permission in
-writing from USL. Just ask BSDI (Berkeley Software Design Inc.), a
-commercial venture not officially connected with the University of
-California at Berkeley.
+
diff --git a/usr.bin/file/apprentice.c b/usr.bin/file/apprentice.c
index d164fa31f7f..3a900b33879 100644
--- a/usr.bin/file/apprentice.c
+++ b/usr.bin/file/apprentice.c
@@ -29,11 +29,12 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <errno.h>
#include "file.h"
#ifndef lint
static char *moduleid =
- "@(#)$Id: apprentice.c,v 1.1 1995/10/18 08:45:08 deraadt Exp $";
+ "@(#)$Id: apprentice.c,v 1.2 1995/12/14 03:30:01 deraadt Exp $";
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
@@ -50,39 +51,70 @@ static void eatsize __P((char **));
static int maxmagic = 0;
+static int apprentice_1 __P((char *, int));
int
apprentice(fn, check)
-char *fn; /* name of magic file */
+char *fn; /* list of magic files */
int check; /* non-zero? checking-only run. */
{
- FILE *f;
- char line[BUFSIZ+1];
- int errs = 0;
-
- f = fopen(fn, "r");
- if (f==NULL) {
- (void) fprintf(stderr, "%s: can't read magic file %s\n",
- progname, fn);
- if (check)
- return -1;
- else
- exit(1);
- }
+ char *p, *mfn;
+ int file_err, errs = -1;
maxmagic = MAXMAGIS;
- if ((magic = (struct magic *) calloc(sizeof(struct magic), maxmagic))
- == NULL) {
+ magic = (struct magic *) calloc(sizeof(struct magic), maxmagic);
+ mfn = malloc(strlen(fn)+1);
+ if (magic == NULL || mfn == NULL) {
(void) fprintf(stderr, "%s: Out of memory.\n", progname);
if (check)
return -1;
else
exit(1);
}
+ fn = strcpy(mfn, fn);
+ while (fn) {
+ p = strchr(fn, ':');
+ if (p)
+ *p++ = '\0';
+ file_err = apprentice_1(fn, check);
+ if (file_err > errs)
+ errs = file_err;
+ fn = p;
+ }
+ if (errs == -1)
+ (void) fprintf(stderr, "%s: couldn't find any magic files!\n",
+ progname);
+ if (!check && errs)
+ exit(1);
+
+ free(mfn);
+ return errs;
+}
+
+static int
+apprentice_1(fn, check)
+char *fn; /* name of magic file */
+int check; /* non-zero? checking-only run. */
+{
+ static const char hdr[] =
+ "cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
+ FILE *f;
+ char line[BUFSIZ+1];
+ int errs = 0;
+
+ f = fopen(fn, "r");
+ if (f==NULL) {
+ if (errno != ENOENT)
+ (void) fprintf(stderr,
+ "%s: can't read magic file %s (%s)\n",
+ progname, fn, strerror(errno));
+ return -1;
+ }
+
/* parse it */
if (check) /* print silly verbose header for USG compat. */
- (void) printf("cont\toffset\ttype\topcode\tmask\tvalue\tdesc\n");
+ (void) printf("%s\n", hdr);
for (lineno = 1;fgets(line, BUFSIZ, f) != NULL; lineno++) {
if (line[0]=='#') /* comment, do not parse */
@@ -91,11 +123,11 @@ int check; /* non-zero? checking-only run. */
continue;
line[strlen(line)-1] = '\0'; /* delete newline */
if (parse(line, &nmagic, check) != 0)
- ++errs;
+ errs = 1;
}
(void) fclose(f);
- return errs ? -1 : 0;
+ return errs;
}
/*
diff --git a/usr.bin/file/file.1 b/usr.bin/file/file.1
index 164af01df9a..a47f15ec374 100644
--- a/usr.bin/file/file.1
+++ b/usr.bin/file/file.1
@@ -1,5 +1,5 @@
.TH FILE 1 "Copyright but distributable"
-.\" $Id: file.1,v 1.1 1995/10/18 08:45:08 deraadt Exp $
+.\" $Id: file.1,v 1.2 1995/12/14 03:30:02 deraadt Exp $
.SH NAME
file
\- determine file type
@@ -13,7 +13,7 @@ file
namefile ]
[
.B \-m
-magicfile ]
+magicfiles ]
file ...
.SH DESCRIPTION
.I File
@@ -100,8 +100,9 @@ labelled as `ascii text' or `data'.
.B \-v
Print the version of the program and exit.
.TP 8
-.B \-m file
-Specify an alternate file of magic numbers.
+.B \-m list
+Specify an alternate list of files containing magic numbers.
+This can be a single file, or a colon-separated list of files.
.TP 8
.B \-z
Try to look inside compressed files.
@@ -129,6 +130,10 @@ option causes symlinks to be followed, as the like-named option in
.SH FILES
.I /etc/magic
\- default list of magic numbers
+.SH ENVIRONMENT
+The environment variable
+.B MAGIC
+can be used to set the default magic number files.
.SH SEE ALSO
.IR magic (5)
\- description of magic file format.
diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c
index a17274318ff..ddf4bce9f02 100644
--- a/usr.bin/file/file.c
+++ b/usr.bin/file/file.c
@@ -26,7 +26,7 @@
*/
#ifndef lint
static char *moduleid =
- "@(#)$Id: file.c,v 1.1 1995/10/18 08:45:09 deraadt Exp $";
+ "@(#)$Id: file.c,v 1.2 1995/12/14 03:30:03 deraadt Exp $";
#endif /* lint */
#include <stdio.h>
@@ -51,9 +51,9 @@ static char *moduleid =
#include "file.h"
#ifdef S_IFLNK
-# define USAGE "Usage: %s [-vczL] [-f namefile] [-m magicfile] file...\n"
+# define USAGE "Usage: %s [-vczL] [-f namefile] [-m magicfiles] file...\n"
#else
-# define USAGE "Usage: %s [-vcz] [-f namefile] [-m magicfile] file...\n"
+# define USAGE "Usage: %s [-vcz] [-f namefile] [-m magicfiles] file...\n"
#endif
#ifndef MAGIC
diff --git a/usr.bin/file/magdir/NetBSD b/usr.bin/file/magdir/NetBSD
index d0f51e78693..ea948bd77ed 100644
--- a/usr.bin/file/magdir/NetBSD
+++ b/usr.bin/file/magdir/NetBSD
@@ -1,5 +1,6 @@
+
#------------------------------------------------------------------------------
-# mirage: file(1) magic for NetBSD executables
+# netbsd: file(1) magic for NetBSD objects
#
# All new-style magic numbers are in network byte order.
#
@@ -7,6 +8,8 @@
>16 lelong >0 not stripped
0 lelong 000000314 BSDI demand paged executable
>16 lelong >0 not stripped
+>32 byte 0x6a (uses shared libs)
+
0 lelong 000000407 NetBSD little-endian object file
>16 lelong >0 not stripped
diff --git a/usr.bin/file/magdir/animation b/usr.bin/file/magdir/animation
index 02b329e367a..9d2dc8e69aa 100644
--- a/usr.bin/file/magdir/animation
+++ b/usr.bin/file/magdir/animation
@@ -16,8 +16,8 @@
>10 leshort x height=%d pixels,
>12 leshort x depth=%d,
>16 leshort x ticks/frame=%d
-# newer FLI or FLC format
-4 leshort 0xAF12 newer FLI or FLC file
+# FLC animation format
+4 leshort 0xAF12 FLC file
>6 leshort x - %d frames
>8 leshort x width=%d pixels,
>10 leshort x height=%d pixels,
diff --git a/usr.bin/file/magdir/audio b/usr.bin/file/magdir/audio
index 89d9d36cd82..96cef47525a 100644
--- a/usr.bin/file/magdir/audio
+++ b/usr.bin/file/magdir/audio
@@ -37,11 +37,6 @@
>20 lelong 4 quad,
>16 lelong >0 %d Hz
-# Bytes 0-3 of AIFF, AIFF-C, & 8SVX audio files are "FORM"
-8 string AIFF AIFF audio data
-8 string AIFC AIFF-C audio data
-8 string 8SVX IFF/8SVX audio data
-
# Creative Labs AUDIO stuff
0 string MThd Standard MIDI data
>9 byte >0 (format %d)
diff --git a/usr.bin/file/magdir/c-lang b/usr.bin/file/magdir/c-lang
index f6234484df0..1b0147595b7 100644
--- a/usr.bin/file/magdir/c-lang
+++ b/usr.bin/file/magdir/c-lang
@@ -4,8 +4,8 @@
#
# XPM icons (Greg Roelofs, newt@uchicago.edu)
-# ideally should go into "images", but entries below would tag XPM as C source
-0 string /*\ XPM X pixmap image data
+# if you uncomment "/*" for C/REXX below, also uncomment this entry
+#0 string /*\ XPM\ */ X pixmap image data
# this first will upset you if you're a PL/1 shop...
# in which case rm it; ascmagic will catch real C programs
diff --git a/usr.bin/file/magdir/commands b/usr.bin/file/magdir/commands
index b726b1b6b05..8a276070736 100644
--- a/usr.bin/file/magdir/commands
+++ b/usr.bin/file/magdir/commands
@@ -3,44 +3,45 @@
# commands: file(1) magic for various shells and interpreters
#
0 string :\ shell archive or commands for antique kernel text
-0 string #!/bin/sh Bourne Shell script text
-0 string #!\ /bin/sh Bourne Shell script text
-0 string #!/bin/csh C Shell script text
-0 string #!\ /bin/csh C Shell script text
+0 string #!/bin/sh Bourne shell script text
+0 string #!\ /bin/sh Bourne shell script text
+0 string #!/bin/csh C shell script text
+0 string #!\ /bin/csh C shell script text
# korn shell magic, sent by George Wu, gwu@clyde.att.com
-0 string #!/bin/ksh Korn Shell script text
-0 string #!\ /bin/ksh Korn Shell script text
-0 string #!/bin/tcsh Tenex C Shell script text
-0 string #!\ /bin/tcsh Tenex C Shell script text
-0 string #!/usr/local/tcsh Tenex C Shell script text
-0 string #!\ /usr/local/tcsh Tenex C Shell script text
-0 string #!/usr/local/bin/tcsh Tenex C Shell script text
-0 string #!\ /usr/local/bin/tcsh Tenex C Shell script text
+0 string #!/bin/ksh Korn shell script text
+0 string #!\ /bin/ksh Korn shell script text
+0 string #!/bin/tcsh Tenex C shell script text
+0 string #!\ /bin/tcsh Tenex C shell script text
+0 string #!/usr/local/tcsh Tenex C shell script text
+0 string #!\ /usr/local/tcsh Tenex C shell script text
+0 string #!/usr/local/bin/tcsh Tenex C shell script text
+0 string #!\ /usr/local/bin/tcsh Tenex C shell script text
#
# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
-0 string #!/usr/local/bin/zsh - Paul Falstad's zsh
-0 string #!\ /usr/local/bin/zsh - Paul Falstad's zsh
-0 string #!/usr/local/bin/ash - NeilBrown's ash
-0 string #!\ /usr/local/bin/ash - NeilBrown's ash
-0 string #!/usr/local/bin/ae - NeilBrown's ae
-0 string #!\ /usr/local/bin/ae - NeilBrown's ae
-0 string #!/bin/nawk - New Awk script text
-0 string #!\ /bin/nawk - New Awk script text
-0 string #!/usr/bin/nawk - New Awk script text
-0 string #!\ /usr/bin/nawk - New Awk script text
-0 string #!/usr/local/bin/nawk - New Awk script text
-0 string #!\ /usr/local/bin/nawk - New Awk script text
-0 string #!/bin/gawk - GNU awk script text
-0 string #!\ /bin/gawk - GNU awk script text
-0 string #!/usr/bin/gawk - GNU awk script text
-0 string #!\ /usr/bin/gawk - GNU awk script text
-0 string #!/usr/local/bin/gawk - GNU awk script text
-0 string #!\ /usr/local/bin/gawk - GNU awk script text
+0 string #!/usr/local/bin/zsh Paul Falstad's zsh
+0 string #!\ /usr/local/bin/zsh Paul Falstad's zsh
+0 string #!/usr/local/bin/ash Neil Brown's ash
+0 string #!\ /usr/local/bin/ash Neil Brown's ash
+0 string #!/usr/local/bin/ae Neil Brown's ae
+0 string #!\ /usr/local/bin/ae Neil Brown's ae
+0 string #!/bin/nawk new awk script text
+0 string #!\ /bin/nawk new awk script text
+0 string #!/usr/bin/nawk new awk script text
+0 string #!\ /usr/bin/nawk new awk script text
+0 string #!/usr/local/bin/nawk new awk script text
+0 string #!\ /usr/local/bin/nawk new awk script text
+0 string #!/bin/gawk GNU awk script text
+0 string #!\ /bin/gawk GNU awk script text
+0 string #!/usr/bin/gawk GNU awk script text
+0 string #!\ /usr/bin/gawk GNU awk script text
+0 string #!/usr/local/bin/gawk GNU awk script text
+0 string #!\ /usr/local/bin/gawk GNU awk script text
#
-0 string #!/bin/awk Awk Commands text
-0 string #!\ /bin/awk Awk Commands text
-0 string #!/usr/bin/awk Awk Commands text
-0 string #!\ /usr/bin/awk Awk Commands text
+0 string #!/bin/awk awk commands text
+0 string #!\ /bin/awk awk commands text
+0 string #!/usr/bin/awk awk commands text
+0 string #!\ /usr/bin/awk awk commands text
+0 string BEGIN awk commands text
# For Larry Wall's perl language. The ``eval'' line recognizes an
# outrageously clever hack for USG systems.
@@ -56,14 +57,14 @@
0 string eval\ "exec\ /usr/local/bin/perl perl commands text
# AT&T Bell Labs' Plan 9 shell
-0 string #!/bin/rc Plan 9 rc Shell script text
-0 string #!\ /bin/rc Plan 9 rc Shell script text
+0 string #!/bin/rc Plan 9 rc shell script text
+0 string #!\ /bin/rc Plan 9 rc shell script text
# bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de)
-0 string #!/bin/bash Bourne-Again Shell script text
-0 string #!\ /bin/bash Bourne-Again Shell script text
-0 string #!/usr/local/bin/bash Bourne-Again Shell script text
-0 string #!\ /usr/local/bin/bash Bourne-Again Shell script text
+0 string #!/bin/bash Bourne-Again shell script text
+0 string #!\ /bin/bash Bourne-Again shell script text
+0 string #!/usr/local/bin/bash Bourne-Again shell script text
+0 string #!\ /usr/local/bin/bash Bourne-Again shell script text
# generic shell magic
0 string #!\ / a
diff --git a/usr.bin/file/magdir/compress b/usr.bin/file/magdir/compress
index 702eb68cb81..2cf8d195f59 100644
--- a/usr.bin/file/magdir/compress
+++ b/usr.bin/file/magdir/compress
@@ -2,7 +2,7 @@
#------------------------------------------------------------------------------
# compress: file(1) magic for pure-compression formats (no archives)
#
-# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, whap, etc.
+# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
#
# Formats for various forms of compressed data
# Formats for "compress" proper have been moved into "compress.c",
@@ -13,14 +13,14 @@
>2 byte&0x80 >0 block compressed
>2 byte&0x1f x %d bits
-# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
+# gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver)
0 string \037\213 gzip compressed data
->2 byte <8 - reserved method,
->2 byte 8 - deflate method,
->3 byte &0x01 ascii,
+>2 byte <8 \b, reserved method,
+>2 byte 8 \b, deflated,
+>3 byte &0x01 ASCII,
>3 byte &0x02 continuation,
>3 byte &0x04 extra field,
->3 byte &0x08 original file name,
+>3 byte &0x08 original filename,
>3 byte &0x10 comment,
>3 byte &0x20 encrypted,
>4 ledate x last modified: %s,
@@ -36,23 +36,22 @@
>9 byte =0x0A os: Tops/20
>9 byte =0x0B os: Win/32
-# According to gzip.h, this is the correct byte order for packed data.
-#
+# packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
0 string \037\036 packed data
->2 belong >1 %d characters originally
->2 belong =1 %d character originally
-#
-# This magic number is byte-order-independent.
-# Are there two types of old packed data? One big endian, one little endian?
+>2 belong >1 \b, %d characters originally
+>2 belong =1 \b, %d character originally
#
-#0 beshort 017437 old packed data, big endian
-#0 leshort 017437 old packed data, little endian
+# This magic number is byte-order-independent. XXX - Does that mean this
+# is big-endian, little-endian, either, or that you can't tell?
+# this short is valid for SunOS
0 short 017437 old packed data
# XXX - why *two* entries for "compacted data", one of which is
# byte-order independent, and one of which is byte-order dependent?
#
0 short 0x1fff compacted data
+# This string is valid for SunOS (BE) and a matching "short" is listed
+# in the Ultrix (LE) magic file.
0 string \377\037 compacted data
0 short 0145405 huf output
@@ -65,19 +64,18 @@
0 leshort 0x76FE crunched data (CP/M, DOS)
# Freeze
-0 string \037\237 Frozen file 2.1
-0 string \037\236 Frozen file 1.0 (or gzip 0.5)
+0 string \037\237 frozen file 2.1
+0 string \037\236 frozen file 1.0 (or gzip 0.5)
-# lzh?
-0 string \037\240 LZH compressed data
+# SCO compress -H (LZH)
+0 string \037\240 SCO compress -H (LZH) data
# European GSM 06.10 is a provisional standard for full-rate speech
# transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse
# excitation/long term prediction) coding at 13 kbit/s.
#
-# WEAK - There's only a magic nibble (4 bits); but that nibble repeats
-# every 33 bytes. This magic is NOT suited for use, but maybe we can
-# use it someday.
+# There's only a magic nibble (4 bits); that nibble repeats every 33
+# bytes. This isn't suited for use, but maybe we can use it someday.
#
# This will cause very short GSM files to be declared as data and
# mismatches to be declared as data too!
diff --git a/usr.bin/file/magdir/database b/usr.bin/file/magdir/database
index 9b59cc7b209..692ce6b3153 100644
--- a/usr.bin/file/magdir/database
+++ b/usr.bin/file/magdir/database
@@ -4,7 +4,13 @@
#
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
#
-0 long 0x13579ace GNU gdbm or ndbm database
+#
+# GDBM magic numbers
+# Will be maintained as part of the GDBM distribution in the future.
+# <downsj@teeny.org>
+0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian
+0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian
+0 string GDBM GNU dbm 2.x database
#
0 belong 0x061561 Berkeley DB Hash file
>4 belong >0 (Version %d,
diff --git a/usr.bin/file/magdir/elf b/usr.bin/file/magdir/elf
index 6f6428315f3..f99712feba6 100644
--- a/usr.bin/file/magdir/elf
+++ b/usr.bin/file/magdir/elf
@@ -5,6 +5,9 @@
# We have to check the byte order flag to see what byte order all the
# other stuff in the header is in.
#
+# Byte order is probably big-endian for MIPS RS3000 and Amdahl.
+# MIPS RS3000 may also be for MIPS RS2000.
+#
# updated by Daniel Quinlan (quinlan@yggdrasil.com)
0 string \177ELF ELF
>4 byte 0 invalid class
@@ -19,7 +22,7 @@
>>16 leshort 4 core file,
>>16 leshort &0xff00 processor-specific,
>>18 leshort 0 no machine,
->>18 leshort 1 AT&T WE32100,
+>>18 leshort 1 AT&T WE32100 - invalid byte order,
>>18 leshort 2 SPARC - invalid byte order,
>>18 leshort 3 Intel 80386,
>>18 leshort 4 Motorola 68000 - invalid byte order,
@@ -27,6 +30,7 @@
>>18 leshort 6 Intel 80486,
>>18 leshort 7 Intel 80860,
>>18 leshort 8 MIPS RS3000,
+>>18 leshort 9 Amdahl,
>>20 lelong 0 invalid version
>>20 lelong 1 version 1
>>36 lelong 1 MathCoPro/FPU/MAU Required
@@ -46,6 +50,7 @@
>>18 beshort 6 Intel 80486 - invalid byte order,
>>18 beshort 7 Intel 80860,
>>18 beshort 8 MIPS RS3000,
+>>18 leshort 9 Amdahl,
>>20 belong 0 invalid version
>>20 belong 1 version 1
>>36 belong 1 MathCoPro/FPU/MAU Required
diff --git a/usr.bin/file/magdir/fonts b/usr.bin/file/magdir/fonts
index a23fae7a19f..dd7907f812b 100644
--- a/usr.bin/file/magdir/fonts
+++ b/usr.bin/file/magdir/fonts
@@ -8,15 +8,19 @@
# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
0 string %!PS-AdobeFont-1.0 PostScript Type 1 font text
->20 string >\0 (%s)
+>20 string >\0 (%s)
6 string %!PS-AdobeFont-1.0 PostScript Type 1 font program data
# X11 font files in SNF (Server Natural Format) format
-0 belong 00000004 X11 big-endian SNF font
-0 lelong 00000004 X11 little-endian SNF font
+0 belong 00000004 X11 SNF font data, MSB first
+0 lelong 00000004 X11 SNF font data, LSB first
+
+# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
+0 string STARTFONT\040 X11 BDF font text
# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
-# (0x7063601 is "PCF" + \001 as a lelong)
-0 lelong 0x70636601 X11 Portable Compiled Font data
+0 string \001fcp X11 Portable Compiled Font data
+>12 byte 0x02 \b, LSB first
+>12 byte 0x0a \b, MSB first
0 string D1.0\015 X11 Speedo font data
diff --git a/usr.bin/file/magdir/frame b/usr.bin/file/magdir/frame
index 37b79830d03..47e48979d54 100644
--- a/usr.bin/file/magdir/frame
+++ b/usr.bin/file/magdir/frame
@@ -20,12 +20,17 @@
>17 string 3.0 (3.0)
>17 string 2.0 (2.0)
>17 string 1.0 (1.x)
-0 string \<MakerScreenFon FrameMaker Font file
+0 string \<MakerScreenFont FrameMaker Font file
>17 string 1.01 (%s)
0 string \<MML FrameMaker MML file
-0 string \<Book FrameMaker Book file
+0 string \<BookFile FrameMaker Book file
>10 string 3.0 (3.0
>10 string 2.0 (2.0
>10 string 1.0 (1.0
>13 byte x %c)
-0 string \<Maker Intermediate Print File FrameMaker IPL file
+# XXX - this book entry should be verified, if you find one, uncomment this
+#0 string \<Book\ FrameMaker Book (ASCII) file
+#>6 string 3.0 (3.0)
+#>6 string 2.0 (2.0)
+#>6 string 1.0 (1.0)
+0 string \<Maker Intermediate Print File FrameMaker IPL file
diff --git a/usr.bin/file/magdir/hp b/usr.bin/file/magdir/hp
index 0970b4b69bb..82d11306c0a 100644
--- a/usr.bin/file/magdir/hp
+++ b/usr.bin/file/magdir/hp
@@ -45,101 +45,101 @@
0 belong 0x02100106 HPPA-RISC1.1 relocatable object
0 belong 0x02100107 HPPA-RISC1.1 executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x02100108 HPPA-RISC1.1 shared executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x0210010b HPPA-RISC1.1 demand-load executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x0210010e HPPA-RISC1.1 shared library
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x0210010d HPPA-RISC1.1 dynamic load library
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
#### 800
0 belong 0x020b0106 HP s800 relocatable object
0 belong 0x020b0107 HP s800 executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x020b0108 HP s800 shared executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x020b010b HP s800 demand-load executable
>(144) belong 0x054ef630 dynamically linked
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x020b010e HP s800 shared library
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x020b010d HP s800 dynamic load library
->96 belong >0 -not stripped
+>96 belong >0 - not stripped
0 belong 0x213c6172 archive file
->68 belong 0x020b0619 -HP s800 relocatable library
+>68 belong 0x020b0619 - HP s800 relocatable library
#### 500
0 long 0x02080106 HP s500 relocatable executable
->16 long >0 -version %ld
+>16 long >0 - version %ld
0 long 0x02080107 HP s500 executable
->16 long >0 -version %ld
+>16 long >0 - version %ld
0 long 0x02080108 HP s500 pure executable
->16 long >0 -version %ld
+>16 long >0 - version %ld
#### 200
0 belong 0x020c0108 HP s200 pure executable
->4 beshort >0 -version %ld
+>4 beshort >0 - version %ld
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped
0 belong 0x020c0107 HP s200 executable
->4 beshort >0 -version %ld
+>4 beshort >0 - version %ld
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped
0 belong 0x020c010b HP s200 demand-load executable
->4 beshort >0 -version %ld
+>4 beshort >0 - version %ld
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped
0 belong 0x020c0106 HP s200 relocatable executable
->4 beshort >0 -version %ld
->6 beshort >0 -highwater %d
+>4 beshort >0 - version %ld
+>6 beshort >0 - highwater %d
>8 belong &0x80000000 save fp regs
>8 belong &0x20000000 debuggable
>8 belong &0x10000000 PIC
0 belong 0x020a0108 HP s200 (2.x release) pure executable
->4 beshort >0 -version %ld
+>4 beshort >0 - version %ld
>36 belong >0 not stripped
0 belong 0x020a0107 HP s200 (2.x release) executable
->4 beshort >0 -version %ld
+>4 beshort >0 - version %ld
>36 belong >0 not stripped
0 belong 0x020c010e HP s200 shared library
->4 beshort >0 -version %ld
->6 beshort >0 -highwater %d
+>4 beshort >0 - version %ld
+>6 beshort >0 - highwater %d
>36 belong >0 not stripped
0 belong 0x020c010d HP s200 dynamic load library
->4 beshort >0 -version %ld
->6 beshort >0 -highwater %d
+>4 beshort >0 - version %ld
+>6 beshort >0 - highwater %d
>36 belong >0 not stripped
#### MISC
@@ -151,7 +151,7 @@
0 long 0x015821a6 HP core file
0 long 0x4da7eee8 HP-WINDOWS font
->8 byte >0 -version %ld
+>8 byte >0 - version %ld
0 string Bitmapfile HP Bitmapfile
0 string IMGfile CIS compimg HP Bitmapfile
diff --git a/usr.bin/file/magdir/html b/usr.bin/file/magdir/html
deleted file mode 100644
index 14ee1de7a0e..00000000000
--- a/usr.bin/file/magdir/html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-#------------------------------------------------------------------------------
-# html: file(1) magic for HTML (HyperText Markup Language) docs
-#
-# from Daniel Quinlan <quinlan@yggdrasil.com>
-#
-0 string \<HEAD HTML document text (old type)
-0 string \<head HTML document text (old type)
-0 string \<TITLE HTML document text (old type)
-0 string \<title HTML document text (old type)
-0 string \<html HTML document text
-0 string \<HTML HTML document text
-0 string \<! HTML document text
-0 string \<h1 Untitled HTML document text
-0 string \<H1 Untitled HTML document text
diff --git a/usr.bin/file/magdir/ibm370 b/usr.bin/file/magdir/ibm370
index 5b92a121cc7..fc245969c29 100644
--- a/usr.bin/file/magdir/ibm370
+++ b/usr.bin/file/magdir/ibm370
@@ -18,3 +18,4 @@
>12 belong >0 not stripped
>24 belong >0 - version %ld
+
diff --git a/usr.bin/file/magdir/iff b/usr.bin/file/magdir/iff
new file mode 100644
index 00000000000..68d1b79bd86
--- /dev/null
+++ b/usr.bin/file/magdir/iff
@@ -0,0 +1,28 @@
+
+#------------------------------------------------------------------------------
+# iff: file(1) magic for Interchange File Format (see also "audio" & "images")
+#
+# Daniel Quinlan (quinlan@yggdrasil.com) -- IFF was designed by Electronic
+# Arts for file interchange. It has also been used by Apple, SGI, and
+# especially Commodore-Amiga.
+#
+# IFF files begin with an 8 byte FORM header, followed by a 4 character
+# FORM type, which is followed by the first chunk in the FORM.
+
+0 string FORM IFF data
+#>4 belong x \b, FORM is %d bytes long
+# audio formats
+>8 string AIFF \b, AIFF audio
+>8 string AIFC \b, AIFF-C compressed audio
+>8 string 8SVX \b, 8SVX 8-bit sampled sound voice
+>8 string SAMP \b, SAMP sampled audio
+# image formats
+>8 string ILBMBMHD \b, ILBM interleaved image
+>>20 beshort x \b, %d x
+>>22 beshort x %d
+>8 string RGBN \b, RGBN 12-bit RGB image
+>8 string RGB8 \b, RGB8 24-bit RGB image
+>8 string DR2D \b, DR2D 2-D object
+>8 string TDDD \b, TDDD 3-D rendering
+# other formats
+>8 string FTXT \b, FTXT formatted text
diff --git a/usr.bin/file/magdir/images b/usr.bin/file/magdir/images
index cf6e7aec7d9..4ff082489b3 100644
--- a/usr.bin/file/magdir/images
+++ b/usr.bin/file/magdir/images
@@ -1,42 +1,38 @@
#------------------------------------------------------------------------------
-# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
+# images: file(1) magic for image formats (see also "iff")
#
# originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
# additions by janl@ifi.uio.no as well as others. Jan also suggested
# merging several one- and two-line files into here.
#
-# XXX - byte order for GIF and TIFF fields?
-# [GRR: TIFF allows both byte orders; GIF is little-endian]
-#
-
-# [GRR: what the hell is this doing in here?]
-0 string xbtoa btoa'd file
-
-# PBMPLUS
-0 string P1 PBM file
-0 string P2 PGM file
-0 string P3 PPM file
-0 string P4 PBM "rawbits" file
-0 string P5 PGM "rawbits" file
-0 string P6 PPM "rawbits" file
+# little magic: PCX (first byte is 0x0a)
+# no magic: Targa
+
+# PBMPLUS images
+# The next byte following the magic is always whitespace.
+0 string P1 PBM image text
+0 string P2 PGM image text
+0 string P3 PPM image text
+0 string P4 PBM "rawbits" image data
+0 string P5 PGM "rawbits" image data
+0 string P6 PPM "rawbits" image data
# NIFF (Navy Interchange File Format, a modification of TIFF) images
-# this *must* go before TIFF
-0 string IIN1 NIFF raster data
+0 string IIN1 NIFF image data
-# TIFF images
-0 string MM TIFF file, big-endian
->2 beshort >0 - version %d
-0 string II TIFF file, little-endian
->2 leshort >0 - version %d
+# Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
+# The second word of TIFF files is the TIFF version number, 42, which has
+# never changed. The TIFF specification recommends testing for it.
+0 string MM\x00\x2a TIFF image data, big-endian
+0 string II\x2a\x00 TIFF image data, little-endian
# PNG [Portable Network Graphics, or "PNG's Not GIF"] images
# (Greg Roelofs, newt@uchicago.edu)
#
# 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
#
-0 string \x89PNG PNG image,
+0 string \x89PNG PNG image data,
>4 belong !0x0d0a1a0a CORRUPTED,
>16 belong x %ld x
>20 belong x %ld,
@@ -51,14 +47,12 @@
>28 byte 1 interlaced
# GIF
-0 string GIF GIF image
->3 string 87a - version %s,
->3 string 89a - version %s,
+0 string GIF8 GIF image data
+>4 string 7a \b, version 8%s,
+>4 string 9a \b, version 8%s,
>6 leshort >0 %hd x
>8 leshort >0 %hd,
#>10 byte &0x80 color mapped,
-# GRR 950330: the following is not accurate for most GIFs:
-#>10 byte &0x40 interlaced,
>10 byte&0x07 =0x00 2 colors
>10 byte&0x07 =0x01 4 colors
>10 byte&0x07 =0x02 8 colors
@@ -68,117 +62,114 @@
>10 byte&0x07 =0x06 128 colors
>10 byte&0x07 =0x07 256 colors
-# Miscellany
-0 long 1123028772 Artisan image file
->4 long 1 rectangular 24-bit image
->4 long 2 rectangular 8-bit image with colormap
->4 long 3 rectangular 32-bit image (24-bit with matte)
-0 string \361\0\100\273 CMU window manager bitmap
-0 string #FIG FIG graphics savefile text
->6 string 2.1 Version 2.1
->6 string 2.0 Version 2.0
-0 string GKSM GKS Metafile
-8 string ILBM IFF ILBM file
-0 string ARF_BEGARF PHIGS clear text archive
+# ITC (CMU WM) raster files. It is essentially a byte-reversed Sun raster,
+# 1 plane, no encoding.
+0 string \361\0\100\273 CMU window manager raster image data
+>4 lelong >0 %d x
+>8 lelong >0 %d,
+>12 lelong >0 %d-bit
-# More miscellany from Daniel Quinlan (quinlan@yggdrasil.com)
-0 string This\ is\ a\ BitMap\ file Lisp Machine bit-array-file
-0 string !! Bennet Yee's "face" format
+# Magick Image File Format
+0 string id=ImageMagick MIFF image data
+
+# Artisan
+0 long 1123028772 Artisan image data
+>4 long 1 \b, rectangular 24-bit
+>4 long 2 \b, rectangular 8-bit with colormap
+>4 long 3 \b, rectangular 32-bit (24-bit with matte)
+
+# FIG (Facility for Interactive Generation of figures), an object-based format
+0 string #FIG FIG image text
+>5 string x \b, version %.3s
+
+# PHIGS
+0 string ARF_BEGARF PHIGS clear text archive
0 string @(#)SunPHIGS SunPHIGS
# version number follows, in the form m.n
>40 string SunBin binary
>32 string archive archive
+
+# GKS (Graphics Kernel System)
+0 string GKSM GKS Metafile
+>24 string SunGKS \b, SunGKS
+
+# CGM image files
0 string BEGMF clear text Computer Graphics Metafile
-# these should be beshort, but not sure
+# XXX - questionable magic
0 beshort&0xffe0 0x0020 binary Computer Graphics Metafile
0 beshort 0x3020 character Computer Graphics Metafile
+# MGR bitmaps (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
+0 string yz MGR bitmap, modern format, 8-bit aligned
+0 string zz MGR bitmap, old format, 1-bit deep, 16-bit aligned
+0 string xz MGR bitmap, old format, 1-bit deep, 32-bit aligned
+0 string yx MGR bitmap, modern format, squeezed
-# From: <u31b3hs@pool.informatik.rwth-aachen.de> (Michael Haardt)
-0 string yz MGR bitmap, modern format, 8 bit aligned
-0 string zz MGR bitmap, old format, 1 bit deep, 16 bit aligned
-0 string xz MGR bitmap, old format, 1 bit deep, 32 bit aligned
-0 string yx MGR bitmap, modern format, squeezed
-
-0 string %bitmap FBM pixmap
->30 long 0x31 (mono)
->30 long 0x33 (color)
+# Fuzzy Bitmap (FBM) images
+0 string %bitmap\0 FBM image data
+>30 long 0x31 \b, mono
+>30 long 0x33 \b, color
-4 string Research, Digifax-G3-File
->29 byte 1 , fine resolution
->29 byte 0 , normal resolution
+# facsimile data
+1 string PC\ Research,\ Inc group 3 fax data
+>29 byte 0 \b, normal resolution (204x98 DPI)
+>29 byte 1 \b, fine resolution (204x196 DPI)
# JPEG images
-0 beshort 0xffd8 JPEG image
->6 string JFIF - JFIF standard
-# from cameron@cs.unsw.oz.au (Cameron Simpson):
-0 string hsi1 JPEG image - HSI encoded (proprietary)
+0 beshort 0xffd8 JPEG image data
+>6 string JFIF \b, JFIF standard
+# HSI is Handmade Software's proprietary JPEG encoding scheme
+0 string hsi1 JPEG image data, HSI proprietary
# PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
-0 string BM bitmap
->14 byte 12 (OS/2 1.x format)
->14 byte 64 (OS/2 2.x format)
->14 byte 40 (Windows 3.x format)
-0 string IC icon
-0 string PI pointer
-0 string CI color icon
-0 string CP color pointer
-0 string BA bitmap array
-
-# Utah Raster Toolkit RLE images (two versions)
-#
-# From <janl@ifi.uio.no>
-# I made this with the help of the man page for rle(5). Ihey missing
-# from the magic numbers I have:
-0 beshort 0xcc52 Utah Raster Toolkit RLE
->2 beshort >0 lower left corner: %d
->4 beshort >0 lower right corner: %d
->6 beshort >0 %d x
->8 beshort >0 %d
->10 byte&0x1 =0x1 CLEARFIRST
->10 byte&0x2 =0x2 NO_BACKGROUND
->10 byte&0x4 =0x4 ALPHA
->10 byte&0x8 =0x8 COMMENT
->11 byte >0 %d colour channels
->12 byte >0 %d bits per pixel
->13 byte >0 %d colour map channels
-#
-# RLE images (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
-# Here's a magic file entry for rle images. 24-bit images tend to produce
-# foo.rle size 42x42, 3 comps each 8 bits
-# (for arbitary, prossibly different values of 42).
-# freely redistribuable under the GPL
-# [GRR: which endianness? big?]
-0 short 0xcc55 RLE image data
->6 short >0 %d x
->8 short >0 %d,
->2 short >0 x offset by %d,
->4 short >0 y offset by %d,
->11 byte =0 colour map
->11 byte >1 %d comps each
->12 byte =1 1 bit
->12 byte >1 %d bits
-
-# FBM images, culled from xli source (d. p. simpleton, m91dps@ecs.ox.ac.uk)
-0 string %bitmap fbm image data
+0 string BM PC bitmap data
+>14 leshort 12 \b, OS/2 1.x format
+>>18 leshort x \b, %d x
+>>20 leshort x %d
+>14 leshort 64 \b, OS/2 2.x format
+>>18 leshort x \b, %d x
+>>20 leshort x %d
+>14 leshort 40 \b, Windows 3.x format
+>>18 lelong x \b, %d x
+>>22 lelong x %d x
+>>28 leshort x %d
+0 string IC PC icon data
+0 string PI PC pointer image data
+0 string CI PC color icon data
+0 string CP PC color pointer image data
+# Conflicts with other entries [BABYL]
+#0 string BA PC bitmap array data
+
+# XPM icons (Greg Roelofs, newt@uchicago.edu)
+# note possible collision with C/REXX entry in c-lang; currently commented out
+0 string /*\ XPM\ */ X pixmap image text
+
+# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
+0 leshort 0xcc52 RLE image data,
+>6 leshort x %d x
+>8 leshort x %d
+>2 leshort >0 \b, lower left corner: %d
+>4 leshort >0 \b, lower right corner: %d
+>10 byte&0x1 =0x1 \b, clear first
+>10 byte&0x2 =0x2 \b, no background
+>10 byte&0x4 =0x4 \b, alpha channel
+>10 byte&0x8 =0x8 \b, comment
+>11 byte >0 \b, %d color channels
+>12 byte >0 \b, %d bits per pixel
+>13 byte >0 \b, %d color map channels
# image file format (Robert Potter, potter@cs.rochester.edu)
0 string Imagefile\ version- iff image data
# this adds the whole header (inc. version number), informative but longish
>10 string >\0 %s
-# Sun rasterfiles, from Daniel Quinlan (quinlan@yggdrasil.com)
-#
-# XXX - Does the Sun 386i use the same byte order?
-#
-0 belong 0x59a66a95 Sun raster image
->4 belong >0 %d x
+# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
+0 belong 0x59a66a95 Sun raster image data
+>4 belong >0 \b, %d x
>8 belong >0 %d,
>12 belong >0 %d-bit,
-# this is almost the same as the file length (what about compressed?)
#>16 belong >0 %d bytes long,
>20 belong 0 old format,
-# no need to complain if it is standard
#>20 belong 1 standard,
>20 belong 2 compressed,
>20 belong 3 RGB,
@@ -188,22 +179,28 @@
>24 belong 0 no colormap
>24 belong 1 RGB colormap
>24 belong 2 raw colormap
-# this doesn't impart much useful information (or does it?)
#>28 belong >0 colormap is %d bytes long
-# Daniel Quinlan (quinlan@yggdrasil.com) -- from an SGI machine
-# There may be a byte swapped version of SGI imagelib images, but
-# I haven't seen any evidence of programs that support it.
-0 beshort 000732 SGI imagelib image
+# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
+# file://sgi.com/graphics/SGIIMAGESPEC
+0 beshort 474 SGI image data
+#>2 byte 0 \b, verbatim
+>2 byte 1 \b, RLE
+#>3 byte 1 \b, normal precision
+>3 byte 2 \b, high precision
+>4 beshort x \b, %d-D
>6 beshort x \b, %d x
>8 beshort x %d
-#
-0 string IT01 FIT image file
+>10 beshort x \b, %d channel
+>10 beshort !1 \bs
+>80 string >0 \b, "%s"
+
+0 string IT01 FIT image data
>4 belong x \b, %d x
>8 belong x %d x
>12 belong x %d
#
-0 string IT02 FIT image file
+0 string IT02 FIT image data
>4 belong x \b, %d x
>8 belong x %d x
>12 belong x %d
@@ -211,12 +208,17 @@
2048 string PCD_IPI Kodak Photo CD image pack file
0 string PCD_OPA Kodak Photo CD overview pack file
-# Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
+# FITS format. Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
# FITS is the Flexible Image Transport System, the de facto standard for
# data and image transfer, storage, etc., for the astronomical community.
-# FITS format.
-0 string SIMPLE\ \ = FITS
->107 string -32 32 bits per pixel, IEEE big endian float
->107 string \ 32 32 bits per pixel, unsigned integer
->108 string 16 16 bits per pixel, unsigned integer
->109 string 8 8 bits per pixel, unsigned integer
+# (FITS floating point formats are big-endian.)
+0 string SIMPLE\ \ = FITS image data
+>109 string 8 \b, 8-bit, character or unsigned binary integer
+>108 string 16 \b, 16-bit, two's complement binary integer
+>107 string \ 32 \b, 32-bit, two's complement binary integer
+>107 string -32 \b, 32-bit, floating point, single precision
+>107 string -64 \b, 64-bit, floating point, double precision
+
+# other images
+0 string This\ is\ a\ BitMap\ file Lisp Machine bit-array-file
+0 string !! Bennet Yee's "face" format
diff --git a/usr.bin/file/magdir/intel b/usr.bin/file/magdir/intel
index ba3139dc1fe..d450e266169 100644
--- a/usr.bin/file/magdir/intel
+++ b/usr.bin/file/magdir/intel
@@ -3,7 +3,7 @@
# intel: file(1) magic for x86 Unix
#
# Various flavors of x86 UNIX executable/object (other than Xenix, which
-# is in "microsoft"). DOS is in "ms-dos"; the ambitious soul can do
+# is in "microsoft"). DOS is in "msdos"; the ambitious soul can do
# Windows as well.
#
# Windows NT belongs elsewhere, as you need x86 and MIPS and Alpha and
diff --git a/usr.bin/file/magdir/interleaf b/usr.bin/file/magdir/interleaf
index 8cf1bbd45c2..3eea3cff269 100644
--- a/usr.bin/file/magdir/interleaf
+++ b/usr.bin/file/magdir/interleaf
@@ -4,5 +4,5 @@
#
0 string =\210OPS Interleaf saved data
0 string =<!OPS Interleaf document text
->5 string ,\ Version\ (version
->>14 string >\0 %s)
+>5 string ,\ Version\ = \b, version
+>>17 string >\0 %.3s
diff --git a/usr.bin/file/magdir/karma b/usr.bin/file/magdir/karma
index 4d0aacd68d9..29d19dbdf84 100644
--- a/usr.bin/file/magdir/karma
+++ b/usr.bin/file/magdir/karma
@@ -7,3 +7,4 @@
0 string KarmaRHD Version Karma Data Structure Version
>16 long x %lu
+
diff --git a/usr.bin/file/magdir/lex b/usr.bin/file/magdir/lex
index a0e546d1a74..7b6d0f74a40 100644
--- a/usr.bin/file/magdir/lex
+++ b/usr.bin/file/magdir/lex
@@ -3,7 +3,7 @@
# lex: file(1) magic for lex
#
# derived empirically, your offsets may vary!
-53 string yyprevious c program text (from lex)
+53 string yyprevious C program text (from lex)
>3 string >\0 for %s
# C program text from GNU flex, from Daniel Quinlan <quinlan@yggdrasil.com>
21 string generated\ by\ flex C program text (from flex)
diff --git a/usr.bin/file/magdir/linux b/usr.bin/file/magdir/linux
index 92ec4b25a4b..a6e7520140d 100644
--- a/usr.bin/file/magdir/linux
+++ b/usr.bin/file/magdir/linux
@@ -13,19 +13,19 @@
# >0 leshort 0314 demand-paged executable (QMAGIC)
#
0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC)
->16 lelong 0 - stripped
+>16 lelong 0 \b, stripped
0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC)
->16 lelong 0 - stripped
+>16 lelong 0 \b, stripped
0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC)
->16 lelong 0 - stripped
+>16 lelong 0 \b, stripped
0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC)
->16 lelong 0 - stripped
+>16 lelong 0 \b, stripped
#
0 string \007\001\000 Linux/i386 object file
->20 lelong >0x1020 - DLL library
+>20 lelong >0x1020 \b, DLL library
# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
0 string *nazgul* compiled message catalog
->8 lelong >0 - version %ld
+>8 lelong >0 \b, version %ld
# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
216 lelong 0421 Linux/i386 core file
>220 string >\0 of '%s'
@@ -37,15 +37,19 @@
#
# Debian Packages, from Peter Tobias <tobias@server.et-inf.fho-emden.de>
0 string 0.9
->8 byte 0x0a Debian Binary Package -
->>3 byte >0 created by dpkg 0.9%c
+>8 byte 0x0a Debian Binary Package
+>>3 byte >0 \b, created by dpkg 0.9%c
>>4 byte >0 pl%c
# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
-0 leshort 0x0436 Linux/i386 PC Screen Font data
->2 byte 0 - 256 characters, no directory,
->2 byte 1 - 512 characters, no directory,
->2 byte 2 - 256 characters, Unicode directory,
->2 byte 3 - 512 characters, Unicode directory,
+0 leshort 0x0436 Linux/i386 PC Screen Font data,
+>2 byte 0 256 characters, no directory,
+>2 byte 1 512 characters, no directory,
+>2 byte 2 256 characters, Unicode directory,
+>2 byte 3 512 characters, Unicode directory,
>3 byte >0 8x%d
# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
4086 string SWAP-SPACE Linux/i386 swap file
+# From: Erik Troan <ewt@redhat.com>
+0 leshort 0x00070183 ECOFF (Linux/OSF) Alpha binary
+>10 leshort 0x0001 not stripped
+>10 leshort 0x0000 stripped
diff --git a/usr.bin/file/magdir/mail.news b/usr.bin/file/magdir/mail.news
index a514e0c340f..64c4e1c328c 100644
--- a/usr.bin/file/magdir/mail.news
+++ b/usr.bin/file/magdir/mail.news
@@ -15,3 +15,4 @@
0 string Xref: news text
0 string From: news or mail text
0 string Article saved news text
+0 string BABYL Emacs RMAIL text
diff --git a/usr.bin/file/magdir/msdos b/usr.bin/file/magdir/msdos
index 8f2381ce76b..db2c03edfe0 100644
--- a/usr.bin/file/magdir/msdos
+++ b/usr.bin/file/magdir/msdos
@@ -3,6 +3,9 @@
# msdos: file(1) magic for MS-DOS files
#
+# .BAT files (Daniel Quinlan, quinlan@yggdrasil.com)
+0 string @echo\ off MS-DOS batch file text
+
# .EXE formats (Greg Roelofs, newt@uchicago.edu)
#
0 string MZ MS-DOS executable (EXE)
diff --git a/usr.bin/file/magdir/pdf b/usr.bin/file/magdir/pdf
new file mode 100644
index 00000000000..3cea0de3457
--- /dev/null
+++ b/usr.bin/file/magdir/pdf
@@ -0,0 +1,7 @@
+
+#------------------------------------------------------------------------------
+# pdf: file(1) magic for Portable Document Format
+#
+
+0 string %PDF- PDF document
+>5 string x \b, version %.3s
diff --git a/usr.bin/file/magdir/pgp b/usr.bin/file/magdir/pgp
index 7df842cd347..aaff0e9b4bb 100644
--- a/usr.bin/file/magdir/pgp
+++ b/usr.bin/file/magdir/pgp
@@ -2,11 +2,11 @@
#------------------------------------------------------------------------------
# pgp: file(1) magic for Pretty Good Privacy
#
-0 beshort 0x9900 pgp key public ring
-0 beshort 0x9501 pgp key security ring
-0 beshort 0x9500 pgp key security ring
-0 string -----BEGIN\040PGP pgp armored data
->15 string PUBLIC\040KEY\040BLOCK- public key blocK
+0 beshort 0x9900 PGP key public ring
+0 beshort 0x9501 PGP key security ring
+0 beshort 0x9500 PGP key security ring
+0 string -----BEGIN\040PGP PGP armored data
+>15 string PUBLIC\040KEY\040BLOCK- public key block
>15 string MESSAGE- message
>15 string SIGNED\040MESSAGE- signed message
>15 string PGP\040SIGNATURE- signature
diff --git a/usr.bin/file/magdir/printer b/usr.bin/file/magdir/printer
index 39f78f885c8..2d12bc5e454 100644
--- a/usr.bin/file/magdir/printer
+++ b/usr.bin/file/magdir/printer
@@ -4,14 +4,14 @@
#
# PostScript, updated by Daniel Quinlan (quinlan@yggdrasil.com)
-0 string %! PostScript document
+0 string %! PostScript document text
>2 string PS-Adobe- conforming
>>11 string >\0 at level %.3s
>>>15 string EPS - type %s
>>>15 string Query - type %s
>>>15 string ExitServer - type %s
# Some PCs have the annoying habit of adding a ^D as a document separator
-0 string \004%! PostScript document
+0 string \004%! PostScript document text
>3 string PS-Adobe- conforming
>>12 string >\0 at level %.3s
>>>16 string EPS - type %s
@@ -20,6 +20,8 @@
# HP Printer Job Language
0 string \033%-12345X@PJL HP Printer Job Language data
+>15 string \ ENTER\ LANGUAGE\ =
+>31 string PostScript Postscript
# HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com)
0 string \033E\033 HP PCL printer data
diff --git a/usr.bin/file/magdir/pyramid b/usr.bin/file/magdir/pyramid
index 15641fcaad4..fe16608436b 100644
--- a/usr.bin/file/magdir/pyramid
+++ b/usr.bin/file/magdir/pyramid
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# compress: file(1) magic for Pyramids
+# pyramid: file(1) magic for Pyramids
#
# XXX - byte order?
#
diff --git a/usr.bin/file/magdir/rpm b/usr.bin/file/magdir/rpm
new file mode 100644
index 00000000000..7b89c682cf4
--- /dev/null
+++ b/usr.bin/file/magdir/rpm
@@ -0,0 +1,14 @@
+#------------------------------------------------------------------------------
+#
+# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com)
+#
+0 beshort 0xedab
+>2 beshort 0xeedb RPM
+>>4 byte x v%d
+>>6 beshort 0 bin
+>>6 beshort 1 src
+>>8 beshort 1 i386
+>>8 beshort 2 Alpha
+>>8 beshort 3 PowerPC
+>>8 beshort 4 Sparc
+>>10 string x %s
diff --git a/usr.bin/file/magdir/rtf b/usr.bin/file/magdir/rtf
index 7a3cd220e6b..8e2d4166fa5 100644
--- a/usr.bin/file/magdir/rtf
+++ b/usr.bin/file/magdir/rtf
@@ -8,5 +8,5 @@
>5 byte x version %c,
>6 string \\ansi ANSI
>6 string \\mac Apple Macintosh
->6 string \\pc IBM PC code page 437
->6 string \\pca IBM PC code page 850
+>6 string \\pc IBM PC, code page 437
+>6 string \\pca IBM PS/2, code page 850
diff --git a/usr.bin/file/magdir/sccs b/usr.bin/file/magdir/sccs
index e970662e09c..11d50b23c00 100644
--- a/usr.bin/file/magdir/sccs
+++ b/usr.bin/file/magdir/sccs
@@ -18,4 +18,4 @@
# is a checksum that could (presumably) have any leading digit,
# and we don't have regular expression matching yet.
# Hence the following official kludge:
-8 string \001s\ SCCS archive.
+8 string \001s\ SCCS archive data
diff --git a/usr.bin/file/magdir/sgml b/usr.bin/file/magdir/sgml
index 38039ae08c4..985bbeca21e 100644
--- a/usr.bin/file/magdir/sgml
+++ b/usr.bin/file/magdir/sgml
@@ -1,11 +1,21 @@
#------------------------------------------------------------------------------
-# sgml: file(1) magic for Standard(?) Generalized Mark-up Language
-#
-# $Id: sgml,v 1.1 1995/10/18 08:45:11 deraadt Exp $
-# SGML goop, mostly from rph@sq.
-0 string \<!DOCTYPE Exported SGML document
-0 string \<!doctype Exported SGML document
-0 string \<!SUBDOC Exported SGML subdocument
-0 string \<!subdoc Exported SGML subdocument
-0 string \<!-- Exported SGML document
+# sgml: file(1) magic for Standard Generalized Markup Language
+
+# HyperText Markup Language (HTML) is an SGML document type,
+# from Daniel Quinlan (quinlan@yggdrasil.com)
+0 string \<!DOCTYPE\ HTML HTML document text
+0 string \<!doctype\ html HTML document text
+0 string \<HEAD HTML document text
+0 string \<head HTML document text
+0 string \<TITLE HTML document text
+0 string \<title HTML document text
+0 string \<html HTML document text
+0 string \<HTML HTML document text
+
+# SGML, mostly from rph@sq
+0 string \<!DOCTYPE exported SGML document text
+0 string \<!doctype exported SGML document text
+0 string \<!SUBDOC exported SGML subdocument text
+0 string \<!subdoc exported SGML subdocument text
+0 string \<!-- exported SGML document text
diff --git a/usr.bin/file/magdir/softquad b/usr.bin/file/magdir/softquad
index 4b144caeef3..79ab9151015 100644
--- a/usr.bin/file/magdir/softquad
+++ b/usr.bin/file/magdir/softquad
@@ -2,7 +2,7 @@
#------------------------------------------------------------------------------
# softquad: file(1) magic for SoftQuad Publishing Software
#
-# $Id: softquad,v 1.1 1995/10/18 08:45:12 deraadt Exp $
+# $Id: softquad,v 1.2 1995/12/14 03:30:25 deraadt Exp $
# Author/Editor and RulesBuilder
#
# XXX - byte order?
diff --git a/usr.bin/file/magdir/tex b/usr.bin/file/magdir/tex
index 4728aa8d8cd..5126be8c800 100644
--- a/usr.bin/file/magdir/tex
+++ b/usr.bin/file/magdir/tex
@@ -20,6 +20,7 @@
# breaking them apart and reading the data. The following patterns
# match most *.tfm files generated by METAFONT or afm2tfm.
2 string \000\021 TeX font metric data
+>33 string >\0 (%s)
2 string \000\022 TeX font metric data
>33 string >\0 (%s)
@@ -27,9 +28,9 @@
0 string \\input\ texinfo Texinfo source text
0 string This\ is\ Info\ file GNU Info text
-# TeX document additions from Daniel Quinlan, quinlan@yggdrasil.com
-0 string \\input TeX or TeX-derivative document text
-0 string \\chapter TeX or TeX-derivative document text
-0 string \\documentstyle TeX or TeX-derivative document text
-0 string \\section TeX or TeX-derivative document text
-0 string \\setlength TeX or TeX-derivative document text
+# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
+0 string \\input TeX document text
+0 string \\section LaTeX document text
+0 string \\setlength LaTeX document text
+0 string \\documentstyle LaTeX document text
+0 string \\chapter LaTeX document text
diff --git a/usr.bin/file/magdir/timezone b/usr.bin/file/magdir/timezone
index 795c0719cba..e47a3717abd 100644
--- a/usr.bin/file/magdir/timezone
+++ b/usr.bin/file/magdir/timezone
@@ -9,3 +9,4 @@
0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0 timezone data
0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0 timezone data
0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0 timezone data
+0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0 timezone data
diff --git a/usr.bin/file/magdir/uuencode b/usr.bin/file/magdir/uuencode
index 607ce9b79d1..7e88619d5ca 100644
--- a/usr.bin/file/magdir/uuencode
+++ b/usr.bin/file/magdir/uuencode
@@ -1,7 +1,30 @@
#------------------------------------------------------------------------------
-# uuencoded: file(1) magic for ASCII-encoded files
+# uuencode: file(1) magic for ASCII-encoded files
#
-0 string begin uuencoded mail text
-# Btoa(1) is an alternative to uuencode that requires less space.
+
+# GRR: the first line of xxencoded files is identical to that in uuencoded
+# files, but the first character in most subsequent lines is 'h' instead of
+# 'M'. (xxencoding uses lowercase letters in place of most of uuencode's
+# punctuation and survives BITNET gateways better.) If regular expressions
+# were supported, this entry could possibly be split into two with
+# "begin\040\.\*\012M" or "begin\040\.\*\012h" (where \. and \* are REs).
+0 string begin\040 uuencoded or xxencoded text
+
+# btoa(1) is an alternative to uuencode that requires less space.
0 string xbtoa\ Begin btoa'd text
+
+# ship(1) is another, much cooler alternative to uuencode.
+# Greg Roelofs, newt@uchicago.edu
+0 string $\012ship ship'd binary text
+
+# bencode(8) is used to encode compressed news batches (Bnews/Cnews only?)
+# Greg Roelofs, newt@uchicago.edu
+0 string Decode\ the\ following\ with\ bdeco bencoded News text
+
+# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
+# Daniel Quinlan, quinlan@yggdrasil.com
+11 string must\ be\ converted\ with\ BinHex BinHex binary text
+>41 string x \b, version %.3s
+
+# GRR: is MIME BASE64 encoding handled somewhere?
diff --git a/usr.bin/file/magdir/varied.out b/usr.bin/file/magdir/varied.out
index b7ce6e7d32f..a5ca783b898 100644
--- a/usr.bin/file/magdir/varied.out
+++ b/usr.bin/file/magdir/varied.out
@@ -14,3 +14,4 @@
# Cray
6 beshort 0407 unicos (cray) executable
+
diff --git a/usr.bin/file/magdir/vms b/usr.bin/file/magdir/vms
index 26071dc7530..c91186f68c3 100644
--- a/usr.bin/file/magdir/vms
+++ b/usr.bin/file/magdir/vms
@@ -11,8 +11,8 @@
# 00000 b0 00 30 00 44 00 60 00 00 00 00 00 30 32 30 35 ..0.D.`.....0205
# 00010 01 01 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 ................
#
-0 string \xb0\x00\x30\x00 VMS VAX executable
->44032 string PK\003\004 (Info-ZIP SFX archive v5.12 w/decryption)
+0 string \xb0\0\x30\0 VMS VAX executable
+>44032 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption
#
# The AXP files all looked like this, except that the byte at offset 0x22
# was 06 in some of them and 07 in others:
@@ -24,4 +24,4 @@
# 00040 00 00 00 00 ff ff ff ff ff ff ff ff 02 00 00 00 ................
#
0 belong 0x03000000 VMS Alpha executable
->75264 string PK\003\004 (Info-ZIP SFX archive v5.12 w/decryption)
+>75264 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption
diff --git a/usr.bin/file/magdir/zilog b/usr.bin/file/magdir/zilog
index f3f68f4041b..d48e38d14e7 100644
--- a/usr.bin/file/magdir/zilog
+++ b/usr.bin/file/magdir/zilog
@@ -10,3 +10,4 @@
0 long 0xe809 separate object file (z8000 a.out)
0 long 0xe805 overlay object file (z8000 a.out)
+
diff --git a/usr.bin/file/patchlevel.h b/usr.bin/file/patchlevel.h
index 7fde029238a..7706ea4a04e 100644
--- a/usr.bin/file/patchlevel.h
+++ b/usr.bin/file/patchlevel.h
@@ -1,16 +1,25 @@
#define FILE_VERSION_MAJOR 3
-#define patchlevel 18
+#define patchlevel 19
/*
* Patchlevel file for Ian Darwin's MAGIC command.
- * $Id: patchlevel.h,v 1.1 1995/10/18 08:45:09 deraadt Exp $
+ * $Id: patchlevel.h,v 1.2 1995/12/14 03:30:04 deraadt Exp $
*
* $Log: patchlevel.h,v $
- * Revision 1.1 1995/10/18 08:45:09 deraadt
- * Initial revision
+ * Revision 1.2 1995/12/14 03:30:04 deraadt
+ * update from netbsd
*
- * Revision 1.4 1995/05/21 00:13:31 christos
- * Updated to file-3.18
+ * Revision 1.5 1995/10/27 23:33:21 christos
+ * Update to file-3.19.
+ * - Magic fixes
+ * - MAGIC environment variable processing
+ * - Better LEGAL.NOTICE
+ * - -m magic : separated list of magic files processing
+ *
+ * Revision 1.19 1995/10/27 23:14:46 christos
+ * Ability to parse colon separated list of magic files
+ * New LEGAL.NOTICE
+ * Various magic file changes
*
* Revision 1.18 1995/05/20 22:09:21 christos
* Passed incorrect argument to eatsize().