version 1.5, 1999/03/30 01:21:22 |
version 1.6, 1999/06/05 01:21:24 |
|
|
.B \-f |
.B \-f |
namefile ] |
namefile ] |
[ |
[ |
.B \-m |
.B \-m |
magicfiles ] |
magicfiles ] |
file ... |
file ... |
.SH DESCRIPTION |
.SH DESCRIPTION |
|
|
that are known to contain binary data. |
that are known to contain binary data. |
When modifying the file |
When modifying the file |
.I /etc/magic |
.I /etc/magic |
or the program itself, |
or the program itself, |
.B "preserve these keywords" . |
.B "preserve these keywords" . |
People depend on knowing that all the readable files in a directory |
People depend on knowing that all the readable files in a directory |
have the word ``text'' printed. |
have the word ``text'' printed. |
|
|
particular fixed formats. |
particular fixed formats. |
The canonical example of this is a binary executable (compiled program) |
The canonical example of this is a binary executable (compiled program) |
.I a.out |
.I a.out |
file, whose format is defined in |
file, whose format is defined in |
.I a.out.h |
.I a.out.h |
and possibly |
and possibly |
.I exec.h |
.I exec.h |
|
|
.I /etc/magic. |
.I /etc/magic. |
.PP |
.PP |
If an argument appears to be an |
If an argument appears to be an |
.SM ASCII |
.SM ASCII |
file, |
file, |
.B file |
.B file |
attempts to guess its language. |
attempts to guess its language. |
|
|
.B .br |
.B .br |
indicates that the file is most likely a |
indicates that the file is most likely a |
.BR troff (1) |
.BR troff (1) |
input file, just as the keyword |
input file, just as the keyword |
.B struct |
.B struct |
indicates a C program. |
indicates a C program. |
These tests are less reliable than the previous |
These tests are less reliable than the previous |
two groups, so they are performed last. |
two groups, so they are performed last. |
The language test routines also test for some miscellany |
The language test routines also test for some miscellany |
(such as |
(such as |
.BR tar (1) |
.BR tar (1) |
archives) and determine whether an unknown file should be |
archives) and determine whether an unknown file should be |
labelled as `ascii text' or `data'. |
labelled as `ascii text' or `data'. |
.SH OPTIONS |
.SH OPTIONS |
.TP 8 |
.TP 8 |
.B \-v |
.B \-v |
|
|
.TP 8 |
.TP 8 |
.B \-c |
.B \-c |
Cause a checking printout of the parsed form of the magic file. |
Cause a checking printout of the parsed form of the magic file. |
This is usually used in conjunction with |
This is usually used in conjunction with |
.B \-m |
.B \-m |
to debug a new magic file before installing it. |
to debug a new magic file before installing it. |
.TP 8 |
.TP 8 |
.B \-f namefile |
.B \-f namefile |
Read the names of the files to be examined from |
Read the names of the files to be examined from |
.I namefile |
.I namefile |
(one per line) |
(one per line) |
before the argument list. |
before the argument list. |
Either |
Either |
.I namefile |
.I namefile |
or at least one filename argument must be present; |
or at least one filename argument must be present; |
to test the standard input, use ``-'' as a filename argument. |
to test the standard input, use ``-'' as a filename argument. |
|
|
.SH STANDARDS CONFORMANCE |
.SH STANDARDS CONFORMANCE |
This program is believed to exceed the System V Interface Definition |
This program is believed to exceed the System V Interface Definition |
of FILE(CMD), as near as one can determine from the vague language |
of FILE(CMD), as near as one can determine from the vague language |
contained therein. |
contained therein. |
Its behaviour is mostly compatible with the System V program of the same name. |
Its behaviour is mostly compatible with the System V program of the same name. |
This version knows more magic, however, so it will produce |
This version knows more magic, however, so it will produce |
different (albeit more accurate) output in many cases. |
different (albeit more accurate) output in many cases. |
.PP |
.PP |
The one significant difference |
The one significant difference |
between this version and System V |
between this version and System V |
is that this version treats any white space |
is that this version treats any white space |
as a delimiter, so that spaces in pattern strings must be escaped. |
as a delimiter, so that spaces in pattern strings must be escaped. |
|
|
mainly USENET, and contributed by various authors. |
mainly USENET, and contributed by various authors. |
Christos Zoulas (address below) will collect additional |
Christos Zoulas (address below) will collect additional |
or corrected magic file entries. |
or corrected magic file entries. |
A consolidation of magic file entries |
A consolidation of magic file entries |
will be distributed periodically. |
will be distributed periodically. |
.PP |
.PP |
The order of entries in the magic file is significant. |
The order of entries in the magic file is significant. |
|
|
.B file |
.B file |
command uses a magic file, |
command uses a magic file, |
keep the old magic file around for comparison purposes |
keep the old magic file around for comparison purposes |
(rename it to |
(rename it to |
.IR /etc/magic.orig ). |
.IR /etc/magic.orig ). |
.SH HISTORY |
.SH HISTORY |
There has been a |
There has been a |
.B file |
.B file |
command in every \s-1UNIX\s0 since at least Research Version 6 |
command in every \s-1UNIX\s0 since at least Research Version 6 |
(man page dated January, 1975). |
(man page dated January, 1975). |
|
|
Regular expression support would make this easy. |
Regular expression support would make this easy. |
.PP |
.PP |
The program doesn't grok \s-2FORTRAN\s0. |
The program doesn't grok \s-2FORTRAN\s0. |
It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which |
It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which |
appear indented at the start of line. |
appear indented at the start of line. |
Regular expression support would make this easy. |
Regular expression support would make this easy. |
.PP |
.PP |
The list of keywords in |
The list of keywords in |
.I ascmagic |
.I ascmagic |
probably belongs in the Magic file. |
probably belongs in the Magic file. |
This could be done by using some keyword like `*' for the offset value. |
This could be done by using some keyword like `*' for the offset value. |
|
|
Make a rule that the magic entries sort based on file offset rather |
Make a rule that the magic entries sort based on file offset rather |
than position within the magic file? |
than position within the magic file? |
.PP |
.PP |
The program should provide a way to give an estimate |
The program should provide a way to give an estimate |
of ``how good'' a guess is. |
of ``how good'' a guess is. |
We end up removing guesses (e.g. ``From '' as first 5 chars of file) because |
We end up removing guesses (e.g. ``From '' as first 5 chars of file) because |
they are not as good as other guesses (e.g. ``Newsgroups:'' versus |
they are not as good as other guesses (e.g. ``Newsgroups:'' versus |
"Return-Path:"). Still, if the others don't pan out, it should be |
"Return-Path:"). Still, if the others don't pan out, it should be |
possible to use the first guess. |
possible to use the first guess. |
.PP |
.PP |
This program is slower than some vendors' file commands. |
This program is slower than some vendors' file commands. |
.PP |
.PP |