version 1.2, 1996/06/26 05:32:59 |
version 1.3, 1997/02/09 23:58:28 |
|
|
.\" @(#)$OpenBSD$ |
.\" $OpenBSD$ |
|
.\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems. |
.TH MAGIC 5 "Public Domain" |
.TH MAGIC 5 "Public Domain" |
.\" install as magic.5 on USG, magic.5 on V7 or Berkeley systems. |
|
.SH NAME |
.SH NAME |
magic \- file command's magic number file |
magic \- file command's magic number file |
.SH DESCRIPTION |
.SH DESCRIPTION |
The |
This manual page documents the format of the magic file as |
.IR file (1) |
used by the |
|
.BR file (1) |
|
command, version 3.22. The |
|
.B file |
command identifies the type of a file using, |
command identifies the type of a file using, |
among other tests, |
among other tests, |
a test for whether the file begins with a certain |
a test for whether the file begins with a certain |
.IR "magic number" . |
.IR "magic number" . |
The file |
The file |
.B /etc/magic |
.I /etc/magic |
specifies what magic numbers are to be tested for, |
specifies what magic numbers are to be tested for, |
what message to print if a particular magic number is found, |
what message to print if a particular magic number is found, |
and additional information to extract from the file. |
and additional information to extract from the file. |
|
|
.IP message |
.IP message |
The message to be printed if the comparison succeeds. If the string |
The message to be printed if the comparison succeeds. If the string |
contains a |
contains a |
.IR printf (3S) |
.BR printf (3S) |
format specification, the value from the file (with any specified masking |
format specification, the value from the file (with any specified masking |
performed) is printed using the message as the format string. |
performed) is printed using the message as the format string. |
.PP |
.PP |
|
|
.I y |
.I y |
is added and the result is used as an offset in the file. The default type |
is added and the result is used as an offset in the file. The default type |
if one is not specified is long. |
if one is not specified is long. |
|
.PP |
|
Sometimes you do not know the exact offset as this depends on the length of |
|
preceding fields. You can specify an offset relative to the end of the |
|
last uplevel field (of course this may only be done for sublevel tests, i.e. |
|
test beginning with |
|
.B > |
|
). Such a relative offset is specified using |
|
.B & |
|
as a prefix to the offset. |
.SH BUGS |
.SH BUGS |
The formats |
The formats |
.IR long , |
.IR long , |
|
|
There is (currently) no support for specified-endian data to be used in |
There is (currently) no support for specified-endian data to be used in |
indirect offsets. |
indirect offsets. |
.SH SEE ALSO |
.SH SEE ALSO |
.IR file (1) |
.BR file (1) |
\- the command that reads this file. |
\- the command that reads this file. |
.\" |
.\" |
.\" From: guy@sun.uucp (Guy Harris) |
.\" From: guy@sun.uucp (Guy Harris) |