Resolve conflicts
This commit is contained in:
parent
950e36ed1f
commit
5d9fa0390d
@ -1,5 +1,5 @@
|
||||
$NetBSD: MAINT,v 1.4 1998/09/20 15:27:15 christos Exp $
|
||||
Id: MAINT,v 1.3 1997/11/05 16:03:18 christos Exp
|
||||
$NetBSD: MAINT,v 1.5 2000/05/14 22:53:37 christos Exp $
|
||||
Id: MAINT,v 1.4 2000/04/11 02:43:51 christos Exp
|
||||
|
||||
Maintenance notes:
|
||||
|
||||
@ -30,5 +30,5 @@ your changed version.
|
||||
|
||||
Thank you for your assistance and cooperation.
|
||||
|
||||
Mark Moraes Christos Zoulas
|
||||
moraes@deshaw.com christos@astron.com
|
||||
Christos Zoulas
|
||||
christos@astron.com
|
||||
|
@ -1,10 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.23 2000/01/23 18:00:38 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.24 2000/05/14 22:53:37 christos Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
MFILESDIR= /usr/share/misc
|
||||
MFILES= magic
|
||||
MAGIC= ${MFILESDIR}/${MFILES}
|
||||
MFILES= magic magic.mime
|
||||
MAGIC= ${MFILESDIR}/magic
|
||||
.if ${MKSHARE} != "no"
|
||||
FILESDIR= ${MFILESDIR}
|
||||
FILES= ${MFILES}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apprentice.c,v 1.18 1999/12/31 13:07:59 tron Exp $ */
|
||||
/* $NetBSD: apprentice.c,v 1.19 2000/05/14 22:53:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
@ -37,9 +37,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: apprentice.c,v 1.28 1998/09/12 13:17:52 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: apprentice.c,v 1.32 2000/04/23 04:32:19 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: apprentice.c,v 1.18 1999/12/31 13:07:59 tron Exp $");
|
||||
__RCSID("$NetBSD: apprentice.c,v 1.19 2000/05/14 22:53:37 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -49,6 +49,13 @@ __RCSID("$NetBSD: apprentice.c,v 1.18 1999/12/31 13:07:59 tron Exp $");
|
||||
tolower((unsigned char) (l)) : (l))
|
||||
|
||||
|
||||
#ifdef __EMX__
|
||||
char PATHSEP=';';
|
||||
#else
|
||||
char PATHSEP=':';
|
||||
#endif
|
||||
|
||||
|
||||
static int getvalue __P((struct magic *, char **));
|
||||
static int hextoint __P((int));
|
||||
static char *getstr __P((char *, char *, int, int *));
|
||||
@ -80,7 +87,7 @@ int check; /* non-zero? checking-only run. */
|
||||
fn = strcpy(mfn, fn);
|
||||
|
||||
while (fn) {
|
||||
p = strchr(fn, ':');
|
||||
p = strchr(fn, PATHSEP);
|
||||
if (p)
|
||||
*p++ = '\0';
|
||||
file_err = apprentice_1(fn, check);
|
||||
@ -195,6 +202,8 @@ int *ndx, check;
|
||||
sizeof(struct magic) *
|
||||
maxmagic * 2)) == NULL) {
|
||||
(void) fprintf(stderr, "%s: Out of memory.\n", progname);
|
||||
if (magic)
|
||||
free(magic);
|
||||
if (check)
|
||||
return -1;
|
||||
else
|
||||
@ -344,6 +353,28 @@ int *ndx, check;
|
||||
++l;
|
||||
m->mask = signextend(m, strtoul(l, &l, 0));
|
||||
eatsize(&l);
|
||||
} else if (STRING == m->type) {
|
||||
m->mask = 0L;
|
||||
if (*l == '/') {
|
||||
while (!isspace(*++l)) {
|
||||
switch (*l) {
|
||||
case CHAR_IGNORE_LOWERCASE:
|
||||
m->mask |= STRING_IGNORE_LOWERCASE;
|
||||
break;
|
||||
case CHAR_COMPACT_BLANK:
|
||||
m->mask |= STRING_COMPACT_BLANK;
|
||||
break;
|
||||
case CHAR_COMPACT_OPTIONAL_BLANK:
|
||||
m->mask |=
|
||||
STRING_COMPACT_OPTIONAL_BLANK;
|
||||
break;
|
||||
default:
|
||||
magwarn("string extension %c invalid",
|
||||
*l);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
m->mask = ~0L;
|
||||
EATAB;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ascmagic.c,v 1.13 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: ascmagic.c,v 1.14 2000/05/14 22:53:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* ASCII magic -- file types that we know based on keywords
|
||||
@ -42,9 +42,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: ascmagic.c,v 1.23 1998/06/27 13:23:39 christos Exp ");
|
||||
FILE_RCSID("@(#)Id: ascmagic.c,v 1.27 2000/04/23 04:28:19 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: ascmagic.c,v 1.13 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: ascmagic.c,v 1.14 2000/05/14 22:53:37 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -68,10 +68,11 @@ int nbytes; /* size actually read */
|
||||
*/
|
||||
switch (is_tar(buf, nbytes)) {
|
||||
case 1:
|
||||
ckfputs("tar archive", stdout);
|
||||
ckfputs(iflag ? "application/x-tar" : "tar archive", stdout);
|
||||
return 1;
|
||||
case 2:
|
||||
ckfputs("POSIX tar archive", stdout);
|
||||
ckfputs(iflag ? "application/x-tar, POSIX"
|
||||
: "POSIX tar archive", stdout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -87,20 +88,21 @@ int nbytes; /* size actually read */
|
||||
++tp; /* skip leading whitespace */
|
||||
if ((isascii(*tp) && (isalnum(*tp) || *tp=='\\') &&
|
||||
isascii(tp[1]) && (isalnum(tp[1]) || tp[1] == '"'))) {
|
||||
ckfputs("troff or preprocessor input text", stdout);
|
||||
ckfputs(iflag ? "text/troff"
|
||||
: "troff or preprocessor input text", stdout);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if ((*buf == 'c' || *buf == 'C') &&
|
||||
isascii(buf[1]) && isspace(buf[1])) {
|
||||
ckfputs("fortran program text", stdout);
|
||||
ckfputs(iflag ? "text/fortran" : "fortran program text", stdout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Make sure we are dealing with ascii text before looking for tokens */
|
||||
for (i = 0; i < nbytes; i++) {
|
||||
if (!isascii(buf[i]))
|
||||
if (!isascii(buf[i]) && !isalpha(buf[i]))
|
||||
return 0; /* not all ASCII */
|
||||
}
|
||||
|
||||
@ -113,7 +115,7 @@ int nbytes; /* size actually read */
|
||||
s = NULL; /* make strtok() keep on tokin' */
|
||||
for (p = names; p < names + NNAMES; p++) {
|
||||
if (STREQ(p->name, token)) {
|
||||
ckfputs(types[p->type], stdout);
|
||||
ckfputs(iflag ? types[p->type].mime : types[p->type].human, stdout);
|
||||
if (has_escapes)
|
||||
ckfputs(" (with escape sequences)",
|
||||
stdout);
|
||||
@ -123,11 +125,9 @@ int nbytes; /* size actually read */
|
||||
}
|
||||
|
||||
/* all else fails, but it is ASCII... */
|
||||
ckfputs("ASCII text", stdout);
|
||||
ckfputs(iflag ? "text/plain, ASCII" : "ASCII text", stdout);
|
||||
if (has_escapes) {
|
||||
ckfputs(" (with escape sequences)", stdout);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compress.c,v 1.7 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: compress.c,v 1.8 2000/05/14 22:53:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* compress routines:
|
||||
@ -8,9 +8,6 @@
|
||||
* using method, return sizeof new
|
||||
*/
|
||||
#include "file.h"
|
||||
#ifdef __CYGWIN__
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -23,9 +20,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: compress.c,v 1.14 1999/10/31 22:23:03 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: compress.c,v 1.15 1999/11/28 20:02:29 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: compress.c,v 1.7 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: compress.c,v 1.8 2000/05/14 22:53:37 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -42,6 +39,7 @@ static struct {
|
||||
{ "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */
|
||||
/* the standard pack utilities do not accept standard input */
|
||||
{ "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */
|
||||
{ "BZh", 3, { "bzip2", "-d", NULL }, 1 }, /* bzip2-ed */
|
||||
};
|
||||
|
||||
static int ncompr = sizeof(compr) / sizeof(compr[0]);
|
||||
|
@ -25,12 +25,6 @@
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Autoheader needs me */
|
||||
#define PACKAGE "file"
|
||||
|
||||
/* Autoheader needs me */
|
||||
#define VERSION "3.28"
|
||||
|
||||
/* Define if builtin ELF support is enabled. */
|
||||
#define BUILTIN_ELF 1
|
||||
|
||||
@ -71,5 +65,15 @@
|
||||
/* Define if you have the strtoul function. */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "file"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "3.31"
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
.\" $NetBSD: file.1,v 1.15 1999/11/01 17:39:26 christos Exp $
|
||||
.\" $NetBSD: file.1,v 1.16 2000/05/14 22:53:37 christos Exp $
|
||||
.\"
|
||||
.TH FILE __CSECTION__ "Copyright but distributable"
|
||||
.\" Id: file.man,v 1.33 1999/02/14 17:16:07 christos Exp
|
||||
.\" Id: file.man,v 1.35 2000/05/14 17:58:36 christos Exp
|
||||
.SH NAME
|
||||
file
|
||||
\- determine file type
|
||||
.SH SYNOPSIS
|
||||
.B file
|
||||
[
|
||||
.B \-bcnsvzL
|
||||
.B \-bciknsvzL
|
||||
]
|
||||
[
|
||||
.B \-f
|
||||
@ -21,6 +21,7 @@ file ...
|
||||
This manual page documents version 3.26 of the
|
||||
.B file
|
||||
command.
|
||||
.PP
|
||||
.B File
|
||||
tests each argument in an attempt to classify it.
|
||||
There are three sets of tests, performed in this order:
|
||||
@ -126,6 +127,17 @@ Either
|
||||
or at least one filename argument must be present;
|
||||
to test the standard input, use ``-'' as a filename argument.
|
||||
.TP 8
|
||||
.B \-i
|
||||
Causes the file command to output mime type strings rather than the more
|
||||
traditional human readable ones. Thus it may say "text/plain, ASCII" rather
|
||||
than "ASCII text". In order for this option to work, file changes the way
|
||||
it handles files recognised by the command it's self (such as many of the
|
||||
text file types, directories etc), and makes use of an alternative "magic" file.
|
||||
(See "FILES" section, below).
|
||||
.TP 8
|
||||
.B \-k
|
||||
Don't stop at the first match, keep going.
|
||||
.TP 8
|
||||
.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.
|
||||
@ -169,6 +181,11 @@ since on some systems it reports a zero size for raw disk partitions.
|
||||
.SH FILES
|
||||
.I /usr/share/misc/magic
|
||||
\- default list of magic numbers
|
||||
.PP
|
||||
.I __MAGIC__.mime
|
||||
\- default list of magic numbers, used to output mime types when the -i option
|
||||
is specified.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
The environment variable
|
||||
.B MAGIC
|
||||
@ -254,6 +271,12 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
|
||||
/dev/hda8: Linux/i386 swap file
|
||||
/dev/hda9: empty
|
||||
/dev/hda10: empty
|
||||
|
||||
$ file -i file.c file /dev/hda
|
||||
file.c: text/x-c
|
||||
file: application/x-executable, dynamically linked (uses shared libs), not stripped
|
||||
/dev/hda: application/x-not-regular-file
|
||||
|
||||
.fi
|
||||
.SH HISTORY
|
||||
There has been a
|
||||
@ -301,6 +324,10 @@ the process running
|
||||
.PP
|
||||
Changes by Ian Darwin and various authors including
|
||||
Christos Zoulas (christos@astron.com), 1990-1999.
|
||||
.PP
|
||||
Altered by Chris Lowth, chris@lowth.com, 2000:
|
||||
Handle the "-i" option to output mime type strings and using an alternative
|
||||
magic file and internal logic.
|
||||
.SH LEGAL NOTICE
|
||||
Copyright (c) Ian F. Darwin, Toronto, Canada,
|
||||
1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file.c,v 1.15 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: file.c,v 1.16 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* file - find type of a file or files - main program.
|
||||
@ -27,9 +27,6 @@
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
#include "file.h"
|
||||
#ifdef __CYGWIN__
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -51,6 +48,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for read() */
|
||||
#endif
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h> /* for byte swapping */
|
||||
|
||||
@ -58,17 +58,17 @@
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: file.c,v 1.42 1998/09/12 13:17:52 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: file.c,v 1.51 2000/05/14 17:58:36 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: file.c,v 1.15 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: file.c,v 1.16 2000/05/14 22:53:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
|
||||
#ifdef S_IFLNK
|
||||
# define USAGE "Usage: %s [-bcnvzL] [-f namefile] [-m magicfiles] file...\n"
|
||||
# define USAGE "Usage: %s [-bciknvzL] [-f namefile] [-m magicfiles] file...\n"
|
||||
#else
|
||||
# define USAGE "Usage: %s [-bcnvz] [-f namefile] [-m magicfiles] file...\n"
|
||||
# define USAGE "Usage: %s [-bciknvz] [-f namefile] [-m magicfiles] file...\n"
|
||||
#endif
|
||||
|
||||
#ifndef MAGIC
|
||||
@ -85,13 +85,17 @@ int /* Global command-line options */
|
||||
bflag = 0, /* brief output format */
|
||||
zflag = 0, /* follow (uncompress) compressed files */
|
||||
sflag = 0, /* read block special files */
|
||||
nobuffer = 0; /* Do not buffer stdout */
|
||||
iflag = 0,
|
||||
nobuffer = 0, /* Do not buffer stdout */
|
||||
kflag = 0; /* Keep going after the first match */
|
||||
|
||||
int /* Misc globals */
|
||||
nmagic = 0; /* number of valid magic[]s */
|
||||
|
||||
struct magic *magic; /* array of magic entries */
|
||||
|
||||
const char *magicfile; /* where magic be found */
|
||||
const char *default_magicfile = MAGIC;
|
||||
|
||||
char *progname; /* used throughout */
|
||||
int lineno; /* line number in the magic file */
|
||||
@ -115,6 +119,11 @@ main(argc, argv)
|
||||
{
|
||||
int c;
|
||||
int check = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0;
|
||||
char *mime;
|
||||
|
||||
#ifdef LC_CTYPE
|
||||
setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */
|
||||
#endif
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) != NULL)
|
||||
progname++;
|
||||
@ -122,25 +131,16 @@ main(argc, argv)
|
||||
progname = argv[0];
|
||||
|
||||
if (!(magicfile = getenv("MAGIC")))
|
||||
magicfile = MAGIC;
|
||||
magicfile = default_magicfile;
|
||||
|
||||
while ((c = getopt(argc, argv, "bcdnf:m:svzL")) != EOF)
|
||||
while ((c = getopt(argc, argv, "bcdf:ikm:nsvzL")) != EOF)
|
||||
switch (c) {
|
||||
case 'v':
|
||||
(void) fprintf(stdout, "%s-%d.%d\n", progname,
|
||||
FILE_VERSION_MAJOR, patchlevel);
|
||||
(void) fprintf(stdout, "magic file from %s\n",
|
||||
magicfile);
|
||||
return 1;
|
||||
case 'b':
|
||||
++bflag;
|
||||
break;
|
||||
case 'c':
|
||||
++check;
|
||||
break;
|
||||
case 'n':
|
||||
++nobuffer;
|
||||
break;
|
||||
case 'd':
|
||||
++debug;
|
||||
break;
|
||||
@ -154,20 +154,40 @@ main(argc, argv)
|
||||
unwrap(optarg);
|
||||
++didsomefiles;
|
||||
break;
|
||||
case 'i':
|
||||
iflag++;
|
||||
if ((mime = malloc(strlen(magicfile) + 5)) != NULL) {
|
||||
(void)strcpy(mime, magicfile);
|
||||
(void)strcat(mime, ".mime");
|
||||
magicfile = mime;
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
kflag = 1;
|
||||
break;
|
||||
case 'm':
|
||||
magicfile = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
++nobuffer;
|
||||
break;
|
||||
case 's':
|
||||
sflag++;
|
||||
break;
|
||||
case 'v':
|
||||
(void) fprintf(stdout, "%s-%d.%d\n", progname,
|
||||
FILE_VERSION_MAJOR, patchlevel);
|
||||
(void) fprintf(stdout, "magic file from %s\n",
|
||||
magicfile);
|
||||
return 1;
|
||||
case 'z':
|
||||
zflag++;
|
||||
break;
|
||||
#ifdef S_IFLNK
|
||||
case 'L':
|
||||
++lflag;
|
||||
break;
|
||||
#endif
|
||||
case 'm':
|
||||
magicfile = optarg;
|
||||
break;
|
||||
case 'z':
|
||||
zflag++;
|
||||
break;
|
||||
case 's':
|
||||
sflag++;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
errflg++;
|
||||
@ -369,7 +389,7 @@ int wid;
|
||||
}
|
||||
|
||||
if (nbytes == 0)
|
||||
ckfputs("empty", stdout);
|
||||
ckfputs(iflag ? "application/x-empty" : "empty", stdout);
|
||||
else {
|
||||
buf[nbytes++] = '\0'; /* null-terminate it */
|
||||
match = tryit(buf, nbytes, zflag);
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: file.h,v 1.18 2000/01/21 17:08:35 mycroft Exp $ */
|
||||
/* $NetBSD: file.h,v 1.19 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* file.h - definitions for file(1) program
|
||||
* @(#)Id: file.h,v 1.29 1999/02/14 17:16:06 christos Exp
|
||||
* @(#)Id: file.h,v 1.31 2000/04/11 02:32:35 christos Exp
|
||||
*
|
||||
* Copyright (c) Ian F. Darwin, 1987.
|
||||
* Written by Ian F. Darwin.
|
||||
@ -85,6 +85,15 @@ struct magic {
|
||||
char desc[MAXDESC]; /* description */
|
||||
};
|
||||
|
||||
#define BIT(A) (1 << (A))
|
||||
#define STRING_IGNORE_LOWERCASE BIT(0)
|
||||
#define STRING_COMPACT_BLANK BIT(1)
|
||||
#define STRING_COMPACT_OPTIONAL_BLANK BIT(2)
|
||||
#define CHAR_IGNORE_LOWERCASE 'c'
|
||||
#define CHAR_COMPACT_BLANK 'B'
|
||||
#define CHAR_COMPACT_OPTIONAL_BLANK 'b'
|
||||
|
||||
|
||||
#include <stdio.h> /* Include that here, to make sure __P gets defined */
|
||||
#include <errno.h>
|
||||
|
||||
@ -117,7 +126,6 @@ extern uint32 signextend __P((struct magic *, unsigned int32));
|
||||
extern int internatmagic __P((unsigned char *, int));
|
||||
extern void tryelf __P((int, unsigned char *, int));
|
||||
|
||||
|
||||
extern char *progname; /* the program name */
|
||||
extern const char *magicfile; /* name of the magic file */
|
||||
extern int lineno; /* current line number in magic file */
|
||||
@ -130,6 +138,7 @@ extern int debug; /* enable debugging? */
|
||||
extern int zflag; /* process compressed files? */
|
||||
extern int lflag; /* follow symbolic links? */
|
||||
extern int sflag; /* read/analyze block special files? */
|
||||
extern int iflag; /* Output types as mime-types */
|
||||
|
||||
extern int optind; /* From getopt(3) */
|
||||
extern char *optarg;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/pkg/bin/perl
|
||||
#
|
||||
# $NetBSD: file2netbsd,v 1.3 1999/11/01 17:39:26 christos Exp $
|
||||
# $NetBSD: file2netbsd,v 1.4 2000/05/14 22:53:38 christos Exp $
|
||||
#
|
||||
# Perl script to convert a standard distribution directory for file into
|
||||
# a NetBSD source tree.
|
||||
@ -18,14 +18,14 @@
|
||||
# Written by Christos Zoulas July 17, 1997 for file-3.26
|
||||
#
|
||||
|
||||
$version = "3.28";
|
||||
$version = "3.31";
|
||||
|
||||
# definitions ...
|
||||
|
||||
@subdirs = ("usr.bin/file", "usr.bin/file/magdir");
|
||||
|
||||
|
||||
@filef = ("LEGAL.NOTICE", "MAINT",
|
||||
@filef = ("LEGAL.NOTICE", "MAINT", "magic.mime",
|
||||
"README", "apprentice.c", "ascmagic.c",
|
||||
"compress.c", "file.c", "file.h", "fsmagic.c",
|
||||
"internat.c", "is_tar.c", "names.h", "patchlevel.h",
|
||||
@ -198,29 +198,6 @@ while ($line = <DATA>) {
|
||||
if ($first) {
|
||||
die "Data file must start with a %% file!";
|
||||
}
|
||||
if ($cmd[2] eq "amd") {
|
||||
&dumpsrcs (@amdf, @amdef);
|
||||
} elsif ($cmd[2] eq "amq") {
|
||||
&dumpsrcs (@amqf, @amqef);
|
||||
} elsif ($cmd[2] eq "pawd") {
|
||||
&dumpsrcs (@pawdf, @pawdef);
|
||||
} elsif ($cmd[2] eq "hlfsd") {
|
||||
&dumpsrcs (@hlfsdf, @hlfsdef);
|
||||
} elsif ($cmd[2] eq "fixmount") {
|
||||
&dumpsrcs (@fixmountf, @fixmountef);
|
||||
} elsif ($cmd[2] eq "fsinfo") {
|
||||
&dumpsrcs (@fsinfof, @fsinfoef);
|
||||
} elsif ($cmd[2] eq "libamu") {
|
||||
&dumpsrcs (@libamuf, @libamuef);
|
||||
} elsif ($cmd[2] eq "mk-amd-map") {
|
||||
&dumpsrcs (@mkamdmapf, @mkamdmapef);
|
||||
} elsif ($cmd[2] eq "wire-test") {
|
||||
&dumpsrcs (@wiretestf, @wiretestef);
|
||||
} elsif ($cmd[2] eq "doc") {
|
||||
&dumpsrcs (@docf, @docef);
|
||||
} else {
|
||||
die "Unknown SRCS command";
|
||||
}
|
||||
} elsif ($cmd[1] eq "NetBSD") {
|
||||
if ($first) {
|
||||
die "Data section must start with a %% file!";
|
||||
@ -259,8 +236,8 @@ __END__
|
||||
.include <bsd.own.mk>
|
||||
|
||||
MFILESDIR= /usr/share/misc
|
||||
MFILES= magic
|
||||
MAGIC= ${MFILESDIR}/${MFILES}
|
||||
MFILES= magic magic.mime
|
||||
MAGIC= ${MFILESDIR}/magic
|
||||
.if ${MKSHARE} != "no"
|
||||
FILESDIR= ${MFILESDIR}
|
||||
FILES= ${MFILES}
|
||||
@ -318,12 +295,6 @@ magic:
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Autoheader needs me */
|
||||
#define PACKAGE "file"
|
||||
|
||||
/* Autoheader needs me */
|
||||
#define VERSION "3.28"
|
||||
|
||||
/* Define if builtin ELF support is enabled. */
|
||||
#define BUILTIN_ELF 1
|
||||
|
||||
@ -364,5 +335,15 @@ magic:
|
||||
/* Define if you have the strtoul function. */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "file"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "3.31"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fsmagic.c,v 1.13 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: fsmagic.c,v 1.14 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* fsmagic - magic based on filesystem info - directory, special files, etc.
|
||||
@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
#include "file.h"
|
||||
#ifdef __CYGWIN__
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -61,9 +58,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: fsmagic.c,v 1.27 1998/06/27 13:23:39 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: fsmagic.c,v 1.31 2000/04/11 02:32:35 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: fsmagic.c,v 1.13 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: fsmagic.c,v 1.14 2000/05/14 22:53:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -93,15 +90,23 @@ struct stat *sb;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (iflag) {
|
||||
if ((sb->st_mode & S_IFMT) != S_IFREG) {
|
||||
ckfputs("application/x-not-regular-file", stdout);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef S_ISUID
|
||||
if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout);
|
||||
if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout);
|
||||
#endif
|
||||
#ifdef S_ISGID
|
||||
if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout);
|
||||
if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout);
|
||||
#endif
|
||||
#ifdef S_ISVTX
|
||||
if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout);
|
||||
if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (sb->st_mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
@ -246,7 +251,7 @@ struct stat *sb;
|
||||
* when we read the file.)
|
||||
*/
|
||||
if (!sflag && sb->st_size == 0) {
|
||||
ckfputs("empty", stdout);
|
||||
ckfputs(iflag ? "application/x-empty" : "empty", stdout);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#
|
||||
0 string FiLeStArTfIlEsTaRt binscii (apple ][) text
|
||||
0 string \x0aGL Binary II (apple ][) data
|
||||
0 string \x76\xff Squeezed (apple ][) data
|
||||
0 string NuFile NuFile archive (apple ][) data
|
||||
0 string N\xf5F\xe9l\xe5 NuFile archive (apple ][) data
|
||||
0 belong 0x00051600 AppleSingle encoded Macintosh file
|
||||
|
@ -228,3 +228,9 @@
|
||||
2 string -pm2- PMarc archive data [pm2]
|
||||
2 string -pms- PMarc SFX archive (CP/M, DOS)
|
||||
5 string -pc1- PopCom compressed executable (CP/M)
|
||||
|
||||
# From rafael@icp.inpg.fr (Rafael Laboissiere)
|
||||
# The Project Revision Control System (see
|
||||
# http://www.XCF.Berkeley.EDU/~jmacd/prcs.html) generates a packaged project
|
||||
# file which is recognized by the following entry:
|
||||
0 leshort 0xeb81 PRCS packaged project
|
||||
|
@ -2,98 +2,54 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# 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/sh Bourne shell script text
|
||||
0 string #!/bin/csh C shell script text
|
||||
0 string #!\ /bin/csh C shell script text
|
||||
0 string #!\ /bin/csh C shell script 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
|
||||
0 string #!/bin/ksh Korn 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 #!\ /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 #!\ /usr/local/bin/tcsh Tenex C shell script text
|
||||
0 string/b #!\ /bin/ksh Korn shell script text executable
|
||||
0 string/b #!\ /bin/tcsh Tenex C shell script text executable
|
||||
0 string/b #!\ /usr/local/tcsh Tenex C shell script text executable
|
||||
0 string/b #!\ /usr/local/bin/tcsh Tenex C shell script text executable
|
||||
|
||||
#
|
||||
# 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/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/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 #!\ /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 #!\ /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/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 #!\ /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 #!\ /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/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/gawk GNU awk script text
|
||||
0 string/b #!\ /usr/local/bin/zsh Paul Falstad's zsh script text executable
|
||||
0 string/b #!\ /usr/local/bin/ash Neil Brown's ash script text executable
|
||||
0 string/b #!\ /usr/local/bin/ae Neil Brown's ae script text executable
|
||||
0 string/b #!\ /bin/nawk new awk script text executable
|
||||
0 string/b #!\ /usr/bin/nawk new awk script text executable
|
||||
0 string/b #!\ /usr/local/bin/nawk new awk script text executable
|
||||
0 string/b #!\ /bin/gawk GNU awk script text executable
|
||||
0 string/b #!\ /usr/bin/gawk GNU awk script text executable
|
||||
0 string/b #!\ /usr/local/bin/gawk GNU awk script text executable
|
||||
#
|
||||
0 string #!/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 #!\ /usr/bin/awk awk commands text
|
||||
0 string BEGIN awk commands text
|
||||
0 string/b #!\ /bin/awk awk script text executable
|
||||
0 string/b #!\ /usr/bin/awk awk script text executable
|
||||
0 string BEGIN awk script text
|
||||
|
||||
# For Larry Wall's perl language. The ``eval'' line recognizes an
|
||||
# outrageously clever hack for USG systems.
|
||||
# Keith Waclena <keith@cerberus.uchicago.edu>
|
||||
0 string #!/bin/perl perl commands text
|
||||
0 string #!\ /bin/perl perl commands text
|
||||
0 string #!\ /bin/perl perl commands text
|
||||
0 string eval\ "exec\ /bin/perl perl commands text
|
||||
0 string #!/usr/bin/perl perl commands text
|
||||
0 string #!\ /usr/bin/perl perl commands text
|
||||
0 string #!\ /usr/bin/perl perl commands text
|
||||
0 string eval\ "exec\ /usr/bin/perl perl commands text
|
||||
0 string #!/usr/local/bin/perl perl commands text
|
||||
0 string #!\ /usr/local/bin/perl perl commands text
|
||||
0 string #!\ /usr/local/bin/perl perl commands text
|
||||
0 string eval\ "exec\ /usr/local/bin/perl perl commands text
|
||||
0 string/b #!\ /bin/perl perl script text executable
|
||||
0 string eval\ "exec\ /bin/perl perl script text
|
||||
0 string/b #!\ /usr/bin/perl perl script text executable
|
||||
0 string eval\ "exec\ /usr/bin/perl perl script text
|
||||
0 string/b #!\ /usr/local/bin/perl perl script text
|
||||
0 string eval\ "exec\ /usr/local/bin/perl perl script text executable
|
||||
|
||||
# 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/b #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
|
||||
# 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 #!\ /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 #!\ /usr/local/bin/bash Bourne-Again shell script text
|
||||
0 string/b #!\ /bin/bash Bourne-Again shell script text executable
|
||||
0 string/b #!\ /usr/local/bin/bash Bourne-Again shell script text executable
|
||||
|
||||
# generic shell magic
|
||||
0 string #!\ / a
|
||||
>3 string >\0 %s script text
|
||||
>3 string >\0 %s script text executable
|
||||
0 string #!\ / a
|
||||
>3 string >\0 %s script text
|
||||
>3 string >\0 %s script text executable
|
||||
0 string #!/ a
|
||||
>2 string >\0 %s script text
|
||||
0 string #!\ commands text
|
||||
>2 string >\0 %s script text executable
|
||||
0 string #!\ script text executable
|
||||
>3 string >\0 for %s
|
||||
|
@ -21,6 +21,7 @@
|
||||
>3 byte &0x02 continuation,
|
||||
>3 byte &0x04 extra field,
|
||||
>3 byte &0x08 original filename,
|
||||
>>10 string x `%s',
|
||||
>3 byte &0x10 comment,
|
||||
>3 byte &0x20 encrypted,
|
||||
>4 ledate x last modified: %s,
|
||||
|
@ -46,3 +46,6 @@
|
||||
7 belong 0x00564944 DOS code page font data (from Linux?)
|
||||
4098 string DOSFONT DOSFONT2 encrypted font data
|
||||
|
||||
# downloadable fonts for browser (prints type) anthon@mnt.org
|
||||
0 string PFR1 PFR1 font
|
||||
>102 string >0 \b: %s
|
||||
|
@ -150,6 +150,19 @@
|
||||
# Conflicts with other entries [BABYL]
|
||||
#0 string BA PC bitmap array data
|
||||
|
||||
# JPEG images
|
||||
# SunOS 5.5.1 had
|
||||
#
|
||||
# 0 string \377\330\377\340 JPEG file
|
||||
# 0 string \377\330\377\356 JPG file
|
||||
#
|
||||
# both of which turn into "JPEG image data" here.
|
||||
#
|
||||
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
|
||||
|
||||
# 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
|
||||
@ -243,3 +256,6 @@
|
||||
|
||||
# Visio drawings
|
||||
03000 string Visio\ (TM)\ Drawing %s
|
||||
|
||||
# Tgif files
|
||||
0 string \%TGIF\ x Tgif file version %s
|
||||
|
@ -52,3 +52,11 @@
|
||||
>2 beshort 0x0E 8-bit, capitalization, 256 flags
|
||||
>2 beshort 0x0F 7-bit, capitalization, 256 flags
|
||||
>4 beshort >0 and %d string characters
|
||||
# ispell 4.0 hash files kromJx <kromJx@crosswinds.net>
|
||||
# Ispell 4.0
|
||||
0 string ISPL ispell
|
||||
>4 long x hash file version %d,
|
||||
>8 long x lexletters %d,
|
||||
>12 long x lexsize %d,
|
||||
>16 long x hashsize %d,
|
||||
>20 long x stblsize %d
|
||||
|
@ -35,9 +35,6 @@
|
||||
>28 long !0 not stripped
|
||||
0 string \01\03\040\20 Minix-386 executable
|
||||
>28 long !0 not stripped
|
||||
# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
|
||||
0 string *nazgul* Linux compiled message catalog
|
||||
>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'
|
||||
|
@ -16,3 +16,6 @@
|
||||
# Files produced by GNU gettext
|
||||
0 long 0xDE120495 GNU-format message catalog data
|
||||
0 long 0x950412DE GNU-format message catalog data
|
||||
|
||||
#.com and .bin for MIT scheme
|
||||
0 string \372\372\372\372 MIT scheme (library?)
|
||||
|
@ -184,3 +184,85 @@
|
||||
|
||||
# Microsoft CAB distribution format Dale Worley <root@dworley.ny.mediaone.net>
|
||||
0 string MSCF\000\000\000\000 Microsoft CAB file
|
||||
|
||||
# DeIsL1.isu what this is I don't know
|
||||
0 string \161\250\000\000\001\002 DeIsL1.isu whatever that is
|
||||
|
||||
# Winamp .avs
|
||||
#0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player
|
||||
0 string Nullsoft\ AVS\ Preset\ Winamp plug in
|
||||
|
||||
# Hyper terminal:
|
||||
0 string HyperTerminal\ hyperterm
|
||||
>15 string 1.0\ --\ HyperTerminal\ data\ file MS-windows Hyperterminal
|
||||
|
||||
# Windows Metafont .WMF
|
||||
0 string \327\315\306\232\000\000\000\000\000\000 ms-windows metafont .wmf
|
||||
|
||||
#tz3 files whatever that is (MS Works files)
|
||||
0 string \003\001\001\004\070\001\000\000 tz3 ms-works file
|
||||
0 string \003\002\001\004\070\001\000\000 tz3 ms-works file
|
||||
0 string \003\003\001\004\070\001\000\000 tz3 ms-works file
|
||||
|
||||
# PGP sig files .sig
|
||||
#0 string \211\000\077\003\005\000\063\237\127 065 to \027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\077\003\005\000\063\237\127\065\027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\077\003\005\000\063\237\127\066\027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\077\003\005\000\063\237\127\067\027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\077\003\005\000\063\237\127\070\027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\077\003\005\000\063\237\127\071\027\266\151\064\005\045\101\233\021\002 PGP sig
|
||||
0 string \211\000\225\003\005\000\062\122\207\304\100\345\042 PGP sig
|
||||
|
||||
# windows zips files .dmf
|
||||
0 string MDIF\032\000\010\000\000\000\372\046\100\175\001\000\001\036\001\000 Ms-windows special zipped file
|
||||
|
||||
|
||||
# Windows help file FTG FTS
|
||||
0 string \164\146\115\122\012\000\000\000\001\000\000\000 ms-windows help cache
|
||||
|
||||
# grp old windows 3.1 group files
|
||||
0 string \120\115\103\103 Ms-windows 3.1 group files
|
||||
|
||||
|
||||
# lnk files windows symlinks
|
||||
0 string \114\000\000\000\001\024\002\000\000\000\000\000\300\000\000\000\000\000\000\106 ms-Windows shortcut
|
||||
|
||||
#ico files
|
||||
0 string \000\000\001\000\001\000\040\040\020\000\000\000\000\000\350\002\000\000 Icon for ms-windows
|
||||
0 string \000\000\001\000\004\000\040\040\020\000\000\000\000\000\350\002 Icon for ms-windows
|
||||
0 string \102\101\050\000\000\000\056\000\000\000\000\000\000\000 Icon for ms-windows
|
||||
0 string \000\000\001\000\002\000\040\040\010\000\000\000\000\000\350\002 Icon for ms-windows
|
||||
0 string \000\000\001\000\006\000\020\020\020\000\000\000\000\000\050\001 Icon for ms-windows
|
||||
0 string \000\000\001\000\002\000\020\020\020\000\000\000\000\000\050\001 Icon for ms-windows
|
||||
|
||||
|
||||
# True Type fonts currently misidentified as raw G3 data
|
||||
|
||||
0 string \000\001\000\000\000 MS-Windows true type font .ttf
|
||||
|
||||
|
||||
# .chr files
|
||||
0 string PK\010\010BGI Borland font
|
||||
>4 string >\0 %s
|
||||
# then there is a copyright notice
|
||||
|
||||
|
||||
# .bgi files
|
||||
0 string pk\010\010BGI Borland device
|
||||
>4 string >\0 %s
|
||||
# then there is a copyright notice
|
||||
|
||||
|
||||
# recycled/info the windows trash bin index
|
||||
9 string \000\000\000\030\001\000\000\000 ms-windows recycled bin info
|
||||
|
||||
|
||||
##### put in Either Magic/font or Magic/news
|
||||
# Acroread or something files wrongly identified as G3 .pfm
|
||||
# these have the form \000 \001 any? \002 \000 \000
|
||||
# or \000 \001 any? \022 \000 \000
|
||||
0 string \000\001 pfm?
|
||||
>3 string \022\000\000Copyright\ yes
|
||||
>3 string \002\000\000Copyright\ yes
|
||||
#>3 string >\0 oops, not a font file. Cancel that.
|
||||
#it clashes with ttf files so put it lower down.
|
||||
|
@ -84,3 +84,5 @@
|
||||
# Now magic for IMAGEN font files...
|
||||
0 string Rast RST-format raster font data
|
||||
>45 string >0 face %
|
||||
# From Jukka Ukkonen
|
||||
0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data
|
||||
|
@ -3,26 +3,18 @@
|
||||
# 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
|
||||
# adapted to string extenstions by Anthon van der Neut <anthon@mnt.org)
|
||||
0 string/cB \<!doctype\ html HTML document text
|
||||
0 string/c \<head HTML document text
|
||||
0 string/c \<title HTML document text
|
||||
0 string/c \<html HTML document text
|
||||
|
||||
# Extensible markup language (XML), a subset of SGML
|
||||
# from Marc Prud'hommeaux (marc@apocalypse.org)
|
||||
0 string \<?xml XML document text
|
||||
0 string \<?XML XML document text
|
||||
0 string \<?Xml XML document text
|
||||
0 string/c \<?xml XML 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
|
||||
|
||||
|
||||
0 string/c \<!doctype exported SGML document text
|
||||
0 string/c \<!subdoc exported SGML subdocument text
|
||||
0 string \<!-- exported SGML document text
|
||||
|
@ -2,9 +2,11 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sniffer: file(1) magic for packet capture files
|
||||
#
|
||||
# From: guy@netapp.com (Guy Harris)
|
||||
# From: guy@alum.mit.edu (Guy Harris)
|
||||
#
|
||||
# Microsoft Network Monitor capture files.
|
||||
|
||||
#
|
||||
# Microsoft Network Monitor 1.x capture files.
|
||||
#
|
||||
0 string RTSS NetMon capture file
|
||||
>4 byte x - version %d
|
||||
@ -14,6 +16,17 @@
|
||||
>6 leshort 2 (Token Ring)
|
||||
>6 leshort 3 (FDDI)
|
||||
|
||||
#
|
||||
# Microsoft Network Monitor 2.x capture files.
|
||||
#
|
||||
0 string GMBU NetMon capture file
|
||||
>4 byte x - version %d
|
||||
>5 byte x \b.%d
|
||||
>6 leshort 0 (Unknown)
|
||||
>6 leshort 1 (Ethernet)
|
||||
>6 leshort 2 (Token Ring)
|
||||
>6 leshort 3 (FDDI)
|
||||
|
||||
#
|
||||
# Network General Sniffer capture files.
|
||||
# Sorry, make that "Network Associates Sniffer capture files."
|
||||
@ -32,13 +45,20 @@
|
||||
>32 byte 7 (Internetwork Analyzer)
|
||||
>32 byte 9 (FDDI)
|
||||
>32 byte 10 (ATM)
|
||||
|
||||
#
|
||||
# Cinco Networks NetXRay capture files.
|
||||
# Sorry, make that "Network General Sniffer Basic capture files."
|
||||
# Sorry, make that "Network Associates Sniffer Basic capture files."
|
||||
# Sorry, make that "Network Associates Sniffer Basic, and Windows
|
||||
# Sniffer Pro", capture files."
|
||||
#
|
||||
0 string XCP\0 NetXRay capture file
|
||||
>4 string >\0 - version %s
|
||||
>44 leshort 0 (Ethernet)
|
||||
>44 leshort 1 (Token Ring)
|
||||
>44 leshort 2 (FDDI)
|
||||
|
||||
#
|
||||
# "libpcap" capture files.
|
||||
# (We call them "tcpdump capture file(s)" for now, as "tcpdump" is
|
||||
@ -83,3 +103,24 @@
|
||||
>20 lelong 13 (BSD/OS SLIP
|
||||
>20 lelong 14 (BSD/OS PPP
|
||||
>16 lelong x \b, capture length %d)
|
||||
|
||||
#
|
||||
# AIX "iptrace" capture files.
|
||||
#
|
||||
0 string iptrace\ 2.0 "iptrace" capture file
|
||||
|
||||
#
|
||||
# Novell LANalyzer capture files.
|
||||
#
|
||||
0 leshort 0x1001 LANalyzer capture file
|
||||
0 leshort 0x1007 LANalyzer capture file
|
||||
|
||||
#
|
||||
# HP-UX "nettl" capture files.
|
||||
#
|
||||
0 string \x54\x52\x00\x64\x00 "nettl" capture file
|
||||
|
||||
#
|
||||
# RADCOM WAN/LAN Analyzer capture files.
|
||||
#
|
||||
0 string \x42\xd2\x00\x34\x12\x66\x22\x88 RADCOM WAN/LAN Analyzer capture file
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: magic.5,v 1.13 1998/09/20 15:27:16 christos Exp $
|
||||
.\" $NetBSD: magic.5,v 1.14 2000/05/14 22:53:38 christos Exp $
|
||||
.\"
|
||||
.TH MAGIC 5 "Public Domain"
|
||||
.\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
|
||||
@ -38,7 +38,14 @@ A two-byte value (on most systems) in this machine's native byte order.
|
||||
.IP long
|
||||
A four-byte value (on most systems) in this machine's native byte order.
|
||||
.IP string
|
||||
A string of bytes.
|
||||
A string of bytes. The string type specification can be optionally followed
|
||||
by /[Bbc]*. The ``B'' flag compacts whitespace in the target, which must
|
||||
contain at least one whitespace character. If the magic has "n" consecutive
|
||||
blanks, the target needs at least "n" consecutive blanks to match. The ``b''
|
||||
flag treats every blank in the target as an optional blank. Finally the ``c''
|
||||
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.
|
||||
.IP beshort
|
||||
@ -207,4 +214,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.15 1998/08/13 17:32:24 christos Exp
|
||||
.\" @(#)Id: magic.man,v 1.16 1999/11/28 20:02:29 christos Exp
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: names.h,v 1.9 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: names.h,v 1.10 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Names.h - names and types used by ascmagic in file(1).
|
||||
@ -12,9 +12,14 @@
|
||||
*
|
||||
* See LEGAL.NOTICE
|
||||
*
|
||||
* Id: names.h,v 1.16 1999/01/13 15:44:08 christos Exp
|
||||
* Id: names.h,v 1.17 2000/04/11 02:32:35 christos Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
modified by Chris Lowth - 9 April 2000
|
||||
to add mime type strings to the types table.
|
||||
*/
|
||||
|
||||
/* these types are used to index the table 'types': keep em in sync! */
|
||||
#define L_C 0 /* first and foremost on UNIX */
|
||||
#define L_CC 1 /* Bjarne's postincrement */
|
||||
@ -30,22 +35,26 @@
|
||||
#define L_HTML 11 /* HTML */
|
||||
#define L_BCPL 12 /* BCPL */
|
||||
|
||||
static const char *types[] = {
|
||||
"C program text",
|
||||
"C++ program text",
|
||||
"FORTRAN program text",
|
||||
"make commands text" ,
|
||||
"PL/1 program text",
|
||||
"assembler program text",
|
||||
"English text",
|
||||
"Pascal program text",
|
||||
"mail text",
|
||||
"news text",
|
||||
"Java program text",
|
||||
"HTML document text",
|
||||
"BCPL program text",
|
||||
"can't happen error on names.h/types",
|
||||
0};
|
||||
static const struct {
|
||||
char *human;
|
||||
char *mime;
|
||||
} types[] = {
|
||||
{ "C program text", "text/x-c", },
|
||||
{ "C++ program text", "text/x-c++" },
|
||||
{ "FORTRAN program text", "text/x-fortran" },
|
||||
{ "make commands text", "text/x-makefile" },
|
||||
{ "PL/1 program text", "text/x-pl1" },
|
||||
{ "assembler program text", "text/x-asm" },
|
||||
{ "English text", "text/plain, English" },
|
||||
{ "Pascal program text", "text/x-pascal" },
|
||||
{ "mail text", "text/x-mail" },
|
||||
{ "news text", "text/x-news" },
|
||||
{ "Java program text", "text/x-java" },
|
||||
{ "HTML document text", "text/html", },
|
||||
{ "BCPL program text", "text/x-bcpl" },
|
||||
{ "can't happen error on names.h/types", "error/x-error" },
|
||||
{ 0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* XXX - how should we distinguish Java from C++?
|
||||
|
@ -1,13 +1,32 @@
|
||||
/* $NetBSD: patchlevel.h,v 1.10 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: patchlevel.h,v 1.11 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
#define FILE_VERSION_MAJOR 3
|
||||
#define patchlevel 28
|
||||
#define patchlevel 31
|
||||
|
||||
/*
|
||||
* Patchlevel file for Ian Darwin's MAGIC command.
|
||||
* Id: patchlevel.h,v 1.28 1999/10/31 22:11:48 christos Exp
|
||||
* Id: patchlevel.h,v 1.31 2000/05/14 17:58:36 christos Exp
|
||||
*
|
||||
* Log: patchlevel.h,v
|
||||
* Revision 1.31 2000/05/14 17:58:36 christos
|
||||
* - new magic for claris files
|
||||
* - new magic for mathematica and maple files
|
||||
* - new magic for msvc files
|
||||
* - new -k flag to keep going matching all possible entries
|
||||
* - add the word executable on #! magic files, and fix the usage of
|
||||
* the word script
|
||||
* - lots of other magic fixes
|
||||
* - fix typo test -> text
|
||||
*
|
||||
* Revision 1.30 2000/04/11 02:41:17 christos
|
||||
* - add support for mime output (-i)
|
||||
* - make sure we free memory in case realloc fails
|
||||
* - magic fixes
|
||||
*
|
||||
* Revision 1.29 1999/11/28 20:02:29 christos
|
||||
* new string/[Bcb] magic from anton, and adjustments to the magic files to
|
||||
* use it.
|
||||
*
|
||||
* Revision 1.28 1999/10/31 22:11:48 christos
|
||||
* - add "char" type for compatibility with HP/UX
|
||||
* - recognize HP/UX syntax &=n etc.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.16 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: print.c,v 1.17 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* print.c - debugging printout routines
|
||||
@ -45,9 +45,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: print.c,v 1.29 1999/10/31 22:23:04 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: print.c,v 1.30 1999/11/28 20:02:29 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: print.c,v 1.16 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.17 2000/05/14 22:53:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -75,8 +75,20 @@ struct magic *m;
|
||||
(void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "",
|
||||
/* Note: type is unsigned */
|
||||
(m->type < SZOF(typ)) ? typ[m->type] : "*bad*");
|
||||
if (m->mask != ~((uint32)0))
|
||||
(void) fprintf(stderr, " & %.8x", m->mask);
|
||||
if (m->mask != ~((uint32)0)) {
|
||||
if(STRING != m->type)
|
||||
(void) fprintf(stderr, " & %.8x", m->mask);
|
||||
else {
|
||||
(void) fputc('/', stderr);
|
||||
if (m->mask & STRING_IGNORE_LOWERCASE)
|
||||
(void) fputc(CHAR_IGNORE_LOWERCASE, stderr);
|
||||
if (m->mask & STRING_COMPACT_BLANK)
|
||||
(void) fputc(CHAR_COMPACT_BLANK, stderr);
|
||||
if (m->mask & STRING_COMPACT_OPTIONAL_BLANK)
|
||||
(void) fputc(CHAR_COMPACT_OPTIONAL_BLANK,
|
||||
stderr);
|
||||
}
|
||||
}
|
||||
|
||||
(void) fprintf(stderr, ",%c", m->reln);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: readelf.c,v 1.5 1999/11/01 17:39:26 christos Exp $ */
|
||||
/* $NetBSD: readelf.c,v 1.6 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
#include "file.h"
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: readelf.c,v 1.11 1999/10/31 22:23:04 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: readelf.c,v 1.12 2000/04/11 02:32:35 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: readelf.c,v 1.5 1999/11/01 17:39:26 christos Exp $");
|
||||
__RCSID("$NetBSD: readelf.c,v 1.6 2000/05/14 22:53:38 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -257,7 +257,7 @@ dophn_core(class, swap, fd, off, num, size)
|
||||
error("lseek failed (%s).\n", strerror(errno));
|
||||
bufsize = read(fd, nbuf, BUFSIZ);
|
||||
if (bufsize == -1)
|
||||
error("read failed (%s).\n", strerror(errno));
|
||||
error(": " "read failed (%s).\n", strerror(errno));
|
||||
offset = 0;
|
||||
for (;;) {
|
||||
if (offset >= bufsize)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: softmagic.c,v 1.17 1999/11/01 17:39:27 christos Exp $ */
|
||||
/* $NetBSD: softmagic.c,v 1.18 2000/05/14 22:53:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* softmagic - interpret variable magic from MAGIC
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
@ -38,9 +39,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
FILE_RCSID("@(#)Id: softmagic.c,v 1.38 1998/09/12 13:21:01 christos Exp ")
|
||||
FILE_RCSID("@(#)Id: softmagic.c,v 1.41 2000/05/14 17:58:36 christos Exp ")
|
||||
#else
|
||||
__RCSID("$NetBSD: softmagic.c,v 1.17 1999/11/01 17:39:27 christos Exp $");
|
||||
__RCSID("$NetBSD: softmagic.c,v 1.18 2000/05/14 22:53:38 christos Exp $");
|
||||
#endif
|
||||
#endif /* lint */
|
||||
|
||||
@ -108,6 +109,9 @@ int nbytes;
|
||||
static int32 *tmpoff = NULL;
|
||||
static size_t tmplen = 0;
|
||||
int32 oldoff = 0;
|
||||
int returnval = 0; /* if a match is found it is set to 1*/
|
||||
extern int kflag;
|
||||
int firstline = 1; /* a flag to print X\n X\n- X */
|
||||
|
||||
if (tmpoff == NULL)
|
||||
if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)
|
||||
@ -127,6 +131,11 @@ int nbytes;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! firstline) { /* we found another match */
|
||||
/* put a newline and '-' to do some simple formatting*/
|
||||
printf("\n- ");
|
||||
}
|
||||
|
||||
tmpoff[cont_level] = mprint(&p, &magic[magindex]);
|
||||
/*
|
||||
* If we printed something, we'll need to print
|
||||
@ -190,9 +199,13 @@ int nbytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1; /* all through */
|
||||
firstline = 0;
|
||||
returnval = 1;
|
||||
if (!kflag) {
|
||||
return 1; /* don't keep searching */
|
||||
}
|
||||
}
|
||||
return 0; /* no match at all */
|
||||
return returnval; /* This is hit if -k is set or there is no match */
|
||||
}
|
||||
|
||||
static int32
|
||||
@ -435,30 +448,58 @@ struct magic *m;
|
||||
v = p->l;
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
l = 0;
|
||||
/* What we want here is:
|
||||
case STRING: {
|
||||
/*
|
||||
* What we want here is:
|
||||
* v = strncmp(m->value.s, p->s, m->vallen);
|
||||
* but ignoring any nulls. bcmp doesn't give -/+/0
|
||||
* and isn't universally available anyway.
|
||||
*/
|
||||
register unsigned char *a = (unsigned char*)m->value.s;
|
||||
register unsigned char *b = (unsigned char*)p->s;
|
||||
register int len = m->vallen;
|
||||
l = 0;
|
||||
v = 0;
|
||||
{
|
||||
register unsigned char *a = (unsigned char*)m->value.s;
|
||||
register unsigned char *b = (unsigned char*)p->s;
|
||||
register int len = m->vallen;
|
||||
|
||||
if (0L == m->mask) { /* normal string: do it fast */
|
||||
while (--len >= 0)
|
||||
if ((v = *b++ - *a++) != '\0')
|
||||
break;
|
||||
break;
|
||||
} else { /* combine the others */
|
||||
while (--len >= 0) {
|
||||
if ((m->mask & STRING_IGNORE_LOWERCASE) &&
|
||||
islower(*a)) {
|
||||
if ((v = tolower(*b++) - *a++) != '\0')
|
||||
break;
|
||||
} else if ((m->mask & STRING_COMPACT_BLANK) &&
|
||||
isspace(*a)) {
|
||||
a++;
|
||||
if (isspace(*b++)) {
|
||||
while (isspace(*b))
|
||||
b++;
|
||||
} else {
|
||||
v = 1;
|
||||
break;
|
||||
}
|
||||
} else if (isspace(*a) &&
|
||||
(m->mask & STRING_COMPACT_OPTIONAL_BLANK)) {
|
||||
a++;
|
||||
while (isspace(*b))
|
||||
b++;
|
||||
} else {
|
||||
if ((v = *b++ - *a++) != '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
error("invalid type %d in mcheck().\n", m->type);
|
||||
return 0;/*NOTREACHED*/
|
||||
}
|
||||
|
||||
v = signextend(m, v) & m->mask;
|
||||
if(m->type != STRING)
|
||||
v = signextend(m, v) & m->mask;
|
||||
|
||||
switch (m->reln) {
|
||||
case 'x':
|
||||
|
Loading…
Reference in New Issue
Block a user