summaryrefslogtreecommitdiffstats
path: root/contrib/file/magic.man
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/file/magic.man')
-rw-r--r--contrib/file/magic.man83
1 files changed, 44 insertions, 39 deletions
diff --git a/contrib/file/magic.man b/contrib/file/magic.man
index 0d957bc..6917bc0 100644
--- a/contrib/file/magic.man
+++ b/contrib/file/magic.man
@@ -40,16 +40,20 @@ A two-byte value (on most systems) in this machine's native byte order.
A four-byte value (on most systems) in this machine's native byte order.
.IP string
A string of bytes.
-The string type specification can be optionally followed by /[Bbc]*.
+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.
+If the magic has
+.I n
+consecutive blanks, the target needs at least
+.I 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.
+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 ldate
@@ -61,7 +65,7 @@ A two-byte value (on most systems) in big-endian byte order.
A four-byte value (on most systems) in big-endian byte order.
.IP bedate
A four-byte value (on most systems) in big-endian byte order,
-interpreted as a unix date.
+interpreted as a Unix date.
.IP leshort
A two-byte value (on most systems) in little-endian byte order.
.IP lelong
@@ -76,7 +80,7 @@ than UTC.
.RE
.PP
The numeric types may optionally be followed by
-.B \*[Am]
+.B &
and a numeric value,
to specify that the value is to be AND'ed with the
numeric value before any comparisons are done.
@@ -85,7 +89,8 @@ Prepending a
to the type indicates that ordered comparisons should be unsigned.
.IP test
The value to be compared with the value from the file.
-If the type is numeric, this value
+If the type is
+numeric, this value
is specified in C form; if it is a string, it is specified as a C string
with the usual escapes permitted (e.g. \en for new-line).
.IP
@@ -94,17 +99,17 @@ may be preceded by a character indicating the operation to be performed.
It may be
.BR = ,
to specify that the value from the file must equal the specified value,
-.BR \*[Lt] ,
+.BR < ,
to specify that the value from the file must be less than the specified
value,
-.BR \*[Gt] ,
+.BR > ,
to specify that the value from the file must be greater than the specified
value,
-.BR \*[Am] ,
-to specify that the value from the file must have set all of the bits
+.BR & ,
+to specify that the value from the file must have set all of the bits
that are set in the specified value,
.BR ^ ,
-to specify that the value from the file must have clear any of the bits
+to specify that the value from the file must have clear any of the bits
that are set in the specified value, or
.BR x ,
to specify that any value will match.
@@ -120,24 +125,24 @@ is octal, and
is hexadecimal.
.IP
For string values, the byte string from the
-file must match the specified byte string.
+file must match the specified byte string.
The operators
.BR = ,
-.B \*[Lt]
+.B <
and
-.B \*[Gt]
+.B >
(but not
-.BR \*[Am] )
+.BR & )
can be applied to strings.
The length used for matching is that of the string argument
in the magic file.
This means that a line can match any string, and
then presumably print that string, by doing
-.B \*[Gt]\e0
+.B >\e0
(because all strings are greater than the null string).
.IP message
-The message to be printed if the comparison succeeds.
-If the string contains a
+The message to be printed if the comparison succeeds. If the string
+contains a
.BR printf (3)
format specification, the value from the file (with any specified masking
performed) is printed using the message as the format string.
@@ -145,12 +150,12 @@ performed) is printed using the message as the format string.
Some file formats contain additional information which is to be printed
along with the file type.
A line which begins with the character
-.B \*[Gt]
+.B >
indicates additional tests and messages to be printed.
The number of
-.B \*[Gt]
+.B >
on the line indicates the level of the test; a line with no
-.B \*[Gt]
+.B >
at the beginning is considered to be at level 0.
Each line at level
.IB n \(pl1
@@ -166,7 +171,7 @@ The next line at level
.I n
terminates this.
If the first character following the last
-.B \*[Gt]
+.B >
is a
.B (
then the string after the parenthesis is interpreted as an indirect offset.
@@ -175,12 +180,12 @@ the file.
The value at that offset is read, and is used again as an offset
in the file.
Indirect offsets are of the form:
-.BI (( x [.[bslBSL]][+-][ y ]).
-The value of
+.BI (( x [.[bslBSL]][+\-][ y ]).
+The value of
.I x
-is used as an offset in the file.
-A byte, short or long is read at that offset depending on the
-.B [bslBSL]
+is used as an offset in the file. A byte, short or long is read at that offset
+depending on the
+.B [bslBSL]
type specifier.
The capitalized types interpret the number as a big endian
value, whereas the small letter versions interpret the number as a little
@@ -194,14 +199,14 @@ 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 \*[Gt]
+test beginning with
+.B >
).
Such a relative offset is specified using
-.B \*[Am]
+.B &
as a prefix to the offset.
.SH BUGS
-The formats
+The formats
.IR long ,
.IR belong ,
.IR lelong ,
@@ -213,7 +218,7 @@ The formats
and
.I ledate
are system-dependent; perhaps they should be specified as a number
-of bytes (2B, 4B, etc),
+of bytes (2B, 4B, etc),
since the files being recognized typically come from
a system on which the lengths are invariant.
.PP
@@ -226,13 +231,13 @@ indirect offsets.
.\" From: guy@sun.uucp (Guy Harris)
.\" Newsgroups: net.bugs.usg
.\" Subject: /etc/magic's format isn't well documented
-.\" Message-ID: \*[Lt]2752@sun.uucp\*[Gt]
+.\" Message-ID: <2752@sun.uucp>
.\" Date: 3 Sep 85 08:19:07 GMT
.\" Organization: Sun Microsystems, Inc.
.\" Lines: 136
-.\"
+.\"
.\" Here's a manual page for the format accepted by the "file" made by adding
.\" the changes I posted to the S5R2 version.
.\"
.\" Modified for Ian Darwin's version of the file command.
-.\" @(#)$Id: magic.man,v 1.21 2003/02/27 20:47:46 christos Exp $
+.\" @(#)$Id: magic.man,v 1.27 2003/09/12 19:43:30 christos Exp $
OpenPOWER on IntegriCloud