xref: /freebsd/contrib/file/doc/magic.man (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1*ae316d1dSXin LI.\" $File: magic.man,v 1.110 2024/11/27 15:37:00 christos Exp $
2*ae316d1dSXin LI.Dd November 27, 2024
3b6cee71dSXin LI.Dt MAGIC __FSECTION__
4b6cee71dSXin LI.Os
5b6cee71dSXin LI.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
6b6cee71dSXin LI.Sh NAME
7b6cee71dSXin LI.Nm magic
8b6cee71dSXin LI.Nd file command's magic pattern file
9b6cee71dSXin LI.Sh DESCRIPTION
1040427ccaSGordon TetlowThis manual page documents the format of magic files as
11b6cee71dSXin LIused by the
12b6cee71dSXin LI.Xr file __CSECTION__
13b6cee71dSXin LIcommand, version __VERSION__.
14b6cee71dSXin LIThe
15b6cee71dSXin LI.Xr file __CSECTION__
16b6cee71dSXin LIcommand identifies the type of a file using,
17b6cee71dSXin LIamong other tests,
18b6cee71dSXin LIa test for whether the file contains certain
19b6cee71dSXin LI.Dq "magic patterns" .
2040427ccaSGordon TetlowThe database of these
2140427ccaSGordon Tetlow.Dq "magic patterns"
2240427ccaSGordon Tetlowis usually located in a binary file in
2340427ccaSGordon Tetlow.Pa __MAGIC__.mgc
2440427ccaSGordon Tetlowor a directory of source text magic pattern fragment files in
2540427ccaSGordon Tetlow.Pa __MAGIC__ .
2640427ccaSGordon TetlowThe database specifies what patterns are to be tested for, what message or
27b6cee71dSXin LIMIME type to print if a particular pattern is found,
28b6cee71dSXin LIand additional information to extract from the file.
29b6cee71dSXin LI.Pp
3040427ccaSGordon TetlowThe format of the source fragment files that are used to build this database
3140427ccaSGordon Tetlowis as follows:
3240427ccaSGordon TetlowEach line of a fragment file specifies a test to be performed.
33b6cee71dSXin LIA test compares the data starting at a particular offset
34b6cee71dSXin LIin the file with a byte value, a string or a numeric value.
35b6cee71dSXin LIIf the test succeeds, a message is printed.
36b6cee71dSXin LIThe line consists of the following fields:
37b6cee71dSXin LI.Bl -tag -width ".Dv message"
38b6cee71dSXin LI.It Dv offset
3958a0f0d0SEitan AdlerA number specifying the offset (in bytes) into the file of the data
40b6cee71dSXin LIwhich is to be tested.
4158a0f0d0SEitan AdlerThis offset can be a negative number if it is:
4258a0f0d0SEitan Adler.Bl -bullet  -compact
4358a0f0d0SEitan Adler.It
4458a0f0d0SEitan AdlerThe first direct offset of the magic entry (at continuation level 0),
4558a0f0d0SEitan Adlerin which case it is interpreted an offset from end end of the file
4658a0f0d0SEitan Adlergoing backwards.
47d38c30c0SXin LIThis works only when a file descriptor to the file is available and it
4858a0f0d0SEitan Adleris a regular file.
4958a0f0d0SEitan Adler.It
5058a0f0d0SEitan AdlerA continuation offset relative to the end of the last up-level field
5158a0f0d0SEitan Adler.Dv ( \*[Am] ) .
5258a0f0d0SEitan Adler.El
53*ae316d1dSXin LIIf the offset starts with the symbol
54*ae316d1dSXin LI.Dq + ,
55*ae316d1dSXin LIthen all offsets are interpreted as from the beginning of the file (the
56*ae316d1dSXin LIdefault).
57b6cee71dSXin LI.It Dv type
58b6cee71dSXin LIThe type of the data to be tested.
59b6cee71dSXin LIThe possible values are:
60b6cee71dSXin LI.Bl -tag -width ".Dv lestring16"
61b6cee71dSXin LI.It Dv byte
62b6cee71dSXin LIA one-byte value.
63b6cee71dSXin LI.It Dv short
64b6cee71dSXin LIA two-byte value in this machine's native byte order.
65b6cee71dSXin LI.It Dv long
66b6cee71dSXin LIA four-byte value in this machine's native byte order.
67b6cee71dSXin LI.It Dv quad
68b6cee71dSXin LIAn eight-byte value in this machine's native byte order.
69b6cee71dSXin LI.It Dv float
70b6cee71dSXin LIA 32-bit single precision IEEE floating point number in this machine's native byte order.
71b6cee71dSXin LI.It Dv double
72b6cee71dSXin LIA 64-bit double precision IEEE floating point number in this machine's native byte order.
73b6cee71dSXin LI.It Dv string
74b6cee71dSXin LIA string of bytes.
75898496eeSXin LIThe string type specification can be optionally followed by a /<width>
76898496eeSXin LIoption and optionally followed by a set of flags /[bCcftTtWw]*.
77898496eeSXin LIThe width limits the number of characters to be copied.
78898496eeSXin LIZero means all characters.
79898496eeSXin LIThe following flags are supported:
80898496eeSXin LI.Bl -tag -width B -compact -offset XXXX
81898496eeSXin LI.It b
82898496eeSXin LIForce binary file test.
83898496eeSXin LI.It C
84898496eeSXin LIUse upper case insensitive matching: upper case
85898496eeSXin LIcharacters in the magic match both lower and upper case characters in the
86898496eeSXin LItarget, whereas lower case characters in the magic only match upper case
87898496eeSXin LIcharacters in the target.
88898496eeSXin LI.It c
89898496eeSXin LIUse lower case insensitive matching: lower case
90898496eeSXin LIcharacters in the magic match both lower and upper case characters in the
91898496eeSXin LItarget, whereas upper case characters in the magic only match upper case
92898496eeSXin LIcharacters in the target.
93898496eeSXin LITo do a complete case insensitive match, specify both
94898496eeSXin LI.Dq c
95898496eeSXin LIand
96898496eeSXin LI.Dq C .
97898496eeSXin LI.It f
98898496eeSXin LIRequire that the matched string is a full word, not a partial word match.
99898496eeSXin LI.It T
100898496eeSXin LITrim the string, i.e. leading and trailing whitespace
101898496eeSXin LI.It t
102898496eeSXin LIForce text file test.
103898496eeSXin LI.It W
104898496eeSXin LICompact whitespace in the target, which must
105b6cee71dSXin LIcontain at least one whitespace character.
106b6cee71dSXin LIIf the magic has
107b6cee71dSXin LI.Dv n
108b6cee71dSXin LIconsecutive blanks, the target needs at least
109b6cee71dSXin LI.Dv n
110b6cee71dSXin LIconsecutive blanks to match.
111898496eeSXin LI.It w
112898496eeSXin LITreat every blank in the magic as an optional blank.
113b6cee71dSXin LIis deleted before the string is printed.
114898496eeSXin LI.El
115b6cee71dSXin LI.It Dv pstring
116b6cee71dSXin LIA Pascal-style string where the first byte/short/int is interpreted as the
117b6cee71dSXin LIunsigned length.
118b6cee71dSXin LIThe length defaults to byte and can be specified as a modifier.
119b6cee71dSXin LIThe following modifiers are supported:
120898496eeSXin LI.Bl -tag -width B -compact -offset XXXX
121b6cee71dSXin LI.It B
122b6cee71dSXin LIA byte length (default).
123b6cee71dSXin LI.It H
12440427ccaSGordon TetlowA 2 byte big endian length.
12548c779cdSXin LI.It h
12640427ccaSGordon TetlowA 2 byte little endian length.
12748c779cdSXin LI.It L
12848c779cdSXin LIA 4 byte big endian length.
12948c779cdSXin LI.It l
13048c779cdSXin LIA 4 byte little endian length.
131b6cee71dSXin LI.It J
132b6cee71dSXin LIThe length includes itself in its count.
133b6cee71dSXin LI.El
134b6cee71dSXin LIThe string is not NUL terminated.
135b6cee71dSXin LI.Dq J
136b6cee71dSXin LIis used rather than the more
137b6cee71dSXin LIvaluable
138b6cee71dSXin LI.Dq I
139b6cee71dSXin LIbecause this type of length is a feature of the JPEG
140b6cee71dSXin LIformat.
141b6cee71dSXin LI.It Dv date
142b6cee71dSXin LIA four-byte value interpreted as a UNIX date.
143b6cee71dSXin LI.It Dv qdate
144d38c30c0SXin LIAn eight-byte value interpreted as a UNIX date.
145b6cee71dSXin LI.It Dv ldate
146b6cee71dSXin LIA four-byte value interpreted as a UNIX-style date, but interpreted as
147b6cee71dSXin LIlocal time rather than UTC.
148b6cee71dSXin LI.It Dv qldate
149b6cee71dSXin LIAn eight-byte value interpreted as a UNIX-style date, but interpreted as
150b6cee71dSXin LIlocal time rather than UTC.
151b6cee71dSXin LI.It Dv qwdate
152b6cee71dSXin LIAn eight-byte value interpreted as a Windows-style date.
153*ae316d1dSXin LI.It Dv msdosdate
154*ae316d1dSXin LIA two-byte value interpreted as FAT/DOS-style date.
155*ae316d1dSXin LI.It Dv msdostime
156*ae316d1dSXin LIA two-byte value interpreted as FAT/DOS-style time.
157b6cee71dSXin LI.It Dv beid3
158b6cee71dSXin LIA 32-bit ID3 length in big-endian byte order.
159b6cee71dSXin LI.It Dv beshort
160b6cee71dSXin LIA two-byte value in big-endian byte order.
161b6cee71dSXin LI.It Dv belong
162b6cee71dSXin LIA four-byte value in big-endian byte order.
163b6cee71dSXin LI.It Dv bequad
164b6cee71dSXin LIAn eight-byte value in big-endian byte order.
165b6cee71dSXin LI.It Dv befloat
166b6cee71dSXin LIA 32-bit single precision IEEE floating point number in big-endian byte order.
167b6cee71dSXin LI.It Dv bedouble
168b6cee71dSXin LIA 64-bit double precision IEEE floating point number in big-endian byte order.
169b6cee71dSXin LI.It Dv bedate
170b6cee71dSXin LIA four-byte value in big-endian byte order,
171b6cee71dSXin LIinterpreted as a Unix date.
172b6cee71dSXin LI.It Dv beqdate
173b6cee71dSXin LIAn eight-byte value in big-endian byte order,
174b6cee71dSXin LIinterpreted as a Unix date.
175b6cee71dSXin LI.It Dv beldate
176b6cee71dSXin LIA four-byte value in big-endian byte order,
177b6cee71dSXin LIinterpreted as a UNIX-style date, but interpreted as local time rather
178b6cee71dSXin LIthan UTC.
179b6cee71dSXin LI.It Dv beqldate
180b6cee71dSXin LIAn eight-byte value in big-endian byte order,
181b6cee71dSXin LIinterpreted as a UNIX-style date, but interpreted as local time rather
182b6cee71dSXin LIthan UTC.
183b6cee71dSXin LI.It Dv beqwdate
184b6cee71dSXin LIAn eight-byte value in big-endian byte order,
185b6cee71dSXin LIinterpreted as a Windows-style date.
186*ae316d1dSXin LI.It Dv bemsdosdate
187*ae316d1dSXin LIA two-byte value in big-endian byte order,
188*ae316d1dSXin LIinterpreted as FAT/DOS-style date.
189*ae316d1dSXin LI.It Dv bemsdostime
190*ae316d1dSXin LIA two-byte value in big-endian byte order,
191*ae316d1dSXin LIinterpreted as FAT/DOS-style time.
192b6cee71dSXin LI.It Dv bestring16
193b6cee71dSXin LIA two-byte unicode (UCS16) string in big-endian byte order.
194b6cee71dSXin LI.It Dv leid3
195b6cee71dSXin LIA 32-bit ID3 length in little-endian byte order.
196b6cee71dSXin LI.It Dv leshort
197b6cee71dSXin LIA two-byte value in little-endian byte order.
198b6cee71dSXin LI.It Dv lelong
199b6cee71dSXin LIA four-byte value in little-endian byte order.
200b6cee71dSXin LI.It Dv lequad
201b6cee71dSXin LIAn eight-byte value in little-endian byte order.
202b6cee71dSXin LI.It Dv lefloat
203b6cee71dSXin LIA 32-bit single precision IEEE floating point number in little-endian byte order.
204b6cee71dSXin LI.It Dv ledouble
205b6cee71dSXin LIA 64-bit double precision IEEE floating point number in little-endian byte order.
206b6cee71dSXin LI.It Dv ledate
207b6cee71dSXin LIA four-byte value in little-endian byte order,
208b6cee71dSXin LIinterpreted as a UNIX date.
209b6cee71dSXin LI.It Dv leqdate
210b6cee71dSXin LIAn eight-byte value in little-endian byte order,
211b6cee71dSXin LIinterpreted as a UNIX date.
212b6cee71dSXin LI.It Dv leldate
213b6cee71dSXin LIA four-byte value in little-endian byte order,
214b6cee71dSXin LIinterpreted as a UNIX-style date, but interpreted as local time rather
215b6cee71dSXin LIthan UTC.
216b6cee71dSXin LI.It Dv leqldate
217b6cee71dSXin LIAn eight-byte value in little-endian byte order,
218b6cee71dSXin LIinterpreted as a UNIX-style date, but interpreted as local time rather
219b6cee71dSXin LIthan UTC.
220b6cee71dSXin LI.It Dv leqwdate
221b6cee71dSXin LIAn eight-byte value in little-endian byte order,
222b6cee71dSXin LIinterpreted as a Windows-style date.
223*ae316d1dSXin LI.It Dv lemsdosdate
224*ae316d1dSXin LIA two-byte value in big-endian byte order,
225*ae316d1dSXin LIinterpreted as FAT/DOS-style date.
226*ae316d1dSXin LI.It Dv lemsdostime
227*ae316d1dSXin LIA two-byte value in big-endian byte order,
228*ae316d1dSXin LIinterpreted as FAT/DOS-style time.
229b6cee71dSXin LI.It Dv lestring16
230b6cee71dSXin LIA two-byte unicode (UCS16) string in little-endian byte order.
231b6cee71dSXin LI.It Dv melong
232b6cee71dSXin LIA four-byte value in middle-endian (PDP-11) byte order.
233b6cee71dSXin LI.It Dv medate
234b6cee71dSXin LIA four-byte value in middle-endian (PDP-11) byte order,
235b6cee71dSXin LIinterpreted as a UNIX date.
236b6cee71dSXin LI.It Dv meldate
237b6cee71dSXin LIA four-byte value in middle-endian (PDP-11) byte order,
238b6cee71dSXin LIinterpreted as a UNIX-style date, but interpreted as local time rather
239b6cee71dSXin LIthan UTC.
240b6cee71dSXin LI.It Dv indirect
241b6cee71dSXin LIStarting at the given offset, consult the magic database again.
2429ce06829SXin LIThe offset of the
2434460e5b0SXin LI.Dv indirect
2444460e5b0SXin LImagic is by default absolute in the file, but one can specify
2454460e5b0SXin LI.Dv /r
2464460e5b0SXin LIto indicate that the offset is relative from the beginning of the entry.
247b6cee71dSXin LI.It Dv name
248b6cee71dSXin LIDefine a
249b6cee71dSXin LI.Dq named
250b6cee71dSXin LImagic instance that can be called from another
251b6cee71dSXin LI.Dv use
252b6cee71dSXin LImagic entry, like a subroutine call.
253b6cee71dSXin LINamed instance direct magic offsets are relative to the offset of the
254b6cee71dSXin LIprevious matched entry, but indirect offsets are relative to the beginning
255b6cee71dSXin LIof the file as usual.
256b6cee71dSXin LINamed magic entries always match.
257b6cee71dSXin LI.It Dv use
258b6cee71dSXin LIRecursively call the named magic starting from the current offset.
259b6cee71dSXin LIIf the name of the referenced begins with a
260b6cee71dSXin LI.Dv ^
261b6cee71dSXin LIthen the endianness of the magic is switched; if the magic mentioned
262b6cee71dSXin LI.Dv leshort
263b6cee71dSXin LIfor example,
264b6cee71dSXin LIit is treated as
265b6cee71dSXin LI.Dv beshort
266b6cee71dSXin LIand vice versa.
267b6cee71dSXin LIThis is useful to avoid duplicating the rules for different endianness.
268b6cee71dSXin LI.It Dv regex
269b6cee71dSXin LIA regular expression match in extended POSIX regular expression syntax
270b6cee71dSXin LI(like egrep).
271b6cee71dSXin LIRegular expressions can take exponential time to process, and their
272b6cee71dSXin LIperformance is hard to predict, so their use is discouraged.
273b6cee71dSXin LIWhen used in production environments, their performance
274b6cee71dSXin LIshould be carefully checked.
275b6cee71dSXin LIThe size of the string to search should also be limited by specifying
276b6cee71dSXin LI.Dv /<length> ,
277b6cee71dSXin LIto avoid performance issues scanning long files.
278b6cee71dSXin LIThe type specification can also be optionally followed by
279b6cee71dSXin LI.Dv /[c][s][l] .
280b6cee71dSXin LIThe
281b6cee71dSXin LI.Dq c
282b6cee71dSXin LIflag makes the match case insensitive, while the
283b6cee71dSXin LI.Dq s
284b6cee71dSXin LIflag update the offset to the start offset of the match, rather than the end.
285b6cee71dSXin LIThe
286b6cee71dSXin LI.Dq l
287b6cee71dSXin LImodifier, changes the limit of length to mean number of lines instead of a
288b6cee71dSXin LIbyte count.
289b6cee71dSXin LILines are delimited by the platforms native line delimiter.
290b6cee71dSXin LIWhen a line count is specified, an implicit byte count also computed assuming
291b6cee71dSXin LIeach line is 80 characters long.
292b6cee71dSXin LIIf neither a byte or line count is specified, the search is limited automatically
293b6cee71dSXin LIto 8KiB.
294b6cee71dSXin LI.Dv ^
295b6cee71dSXin LIand
296b6cee71dSXin LI.Dv $
297b6cee71dSXin LImatch the beginning and end of individual lines, respectively,
298b6cee71dSXin LInot beginning and end of file.
299b6cee71dSXin LI.It Dv search
300b6cee71dSXin LIA literal string search starting at the given offset.
301b6cee71dSXin LIThe same modifier flags can be used as for string patterns.
302b6cee71dSXin LIThe search expression must contain the range in the form
303b6cee71dSXin LI.Dv /number,
304b6cee71dSXin LIthat is the number of positions at which the match will be
305b6cee71dSXin LIattempted, starting from the start offset.
306b6cee71dSXin LIThis is suitable for
307b6cee71dSXin LIsearching larger binary expressions with variable offsets, using
308b6cee71dSXin LI.Dv \e
309b6cee71dSXin LIescapes for special characters.
310b6cee71dSXin LIThe order of modifier and number is not relevant.
311b6cee71dSXin LI.It Dv default
312b6cee71dSXin LIThis is intended to be used with the test
313b6cee71dSXin LI.Em x
314b6cee71dSXin LI(which is always true) and it has no type.
315b6cee71dSXin LIIt matches when no other test at that continuation level has matched before.
316b6cee71dSXin LIClearing that matched tests for a continuation level, can be done using the
317b6cee71dSXin LI.Dv clear
318b6cee71dSXin LItest.
319b6cee71dSXin LI.It Dv clear
320b6cee71dSXin LIThis test is always true and clears the match flag for that continuation level.
321b6cee71dSXin LIIt is intended to be used with the
322b6cee71dSXin LI.Dv default
323b6cee71dSXin LItest.
3242726a701SXin LI.It Dv der
3252726a701SXin LIParse the file as a DER Certificate file.
3262726a701SXin LIThe test field is used as a der type that needs to be matched.
3272726a701SXin LIThe DER types are:
3282726a701SXin LI.Dv eoc ,
3292726a701SXin LI.Dv bool ,
3302726a701SXin LI.Dv int ,
3312726a701SXin LI.Dv bit_str ,
3322726a701SXin LI.Dv octet_str ,
3332726a701SXin LI.Dv null ,
3342726a701SXin LI.Dv obj_id ,
3352726a701SXin LI.Dv obj_desc ,
3362726a701SXin LI.Dv ext ,
3372726a701SXin LI.Dv real ,
3382726a701SXin LI.Dv enum ,
3392726a701SXin LI.Dv embed ,
3402726a701SXin LI.Dv utf8_str ,
3412726a701SXin LI.Dv rel_oid ,
3422726a701SXin LI.Dv time ,
3432726a701SXin LI.Dv res2 ,
3442726a701SXin LI.Dv seq ,
3452726a701SXin LI.Dv set ,
3462726a701SXin LI.Dv num_str ,
3472726a701SXin LI.Dv prt_str ,
3482726a701SXin LI.Dv t61_str ,
3492726a701SXin LI.Dv vid_str ,
3502726a701SXin LI.Dv ia5_str ,
3512726a701SXin LI.Dv utc_time ,
3522726a701SXin LI.Dv gen_time ,
3532726a701SXin LI.Dv gr_str ,
3542726a701SXin LI.Dv vis_str ,
3552726a701SXin LI.Dv gen_str ,
3562726a701SXin LI.Dv univ_str ,
3572726a701SXin LI.Dv char_str ,
3582726a701SXin LI.Dv bmp_str ,
3592726a701SXin LI.Dv date ,
3602726a701SXin LI.Dv tod ,
3612726a701SXin LI.Dv datetime ,
3622726a701SXin LI.Dv duration ,
3632726a701SXin LI.Dv oid-iri ,
3642726a701SXin LI.Dv rel-oid-iri .
3652726a701SXin LIThese types can be followed by an optional numeric size, which indicates
3662726a701SXin LIthe field width in bytes.
3672726a701SXin LI.It Dv guid
3682726a701SXin LIA Globally Unique Identifier, parsed and printed as
3692726a701SXin LIXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
3702726a701SXin LIIt's format is a string.
3712726a701SXin LI.It Dv offset
3722726a701SXin LIThis is a quad value indicating the current offset of the file.
3732726a701SXin LIIt can be used to determine the size of the file or the magic buffer.
3742726a701SXin LIFor example the magic entries:
3752726a701SXin LI.Bd -literal -offset indent
3762726a701SXin LI-0	offset	x	this file is %lld bytes
3772726a701SXin LI-0	offset	<=100	must be more than 100 \e
3782726a701SXin LI    bytes and is only %lld
3792726a701SXin LI.Ed
380a2dfb722SXin LI.It Dv octal
381a2dfb722SXin LIA string representing an octal number.
382a2dfb722SXin LI.El
383b6cee71dSXin LI.Pp
384b6cee71dSXin LIFor compatibility with the Single
385b6cee71dSXin LI.Ux
386b6cee71dSXin LIStandard, the type specifiers
387b6cee71dSXin LI.Dv dC
388b6cee71dSXin LIand
389b6cee71dSXin LI.Dv d1
390b6cee71dSXin LIare equivalent to
391b6cee71dSXin LI.Dv byte ,
392b6cee71dSXin LIthe type specifiers
393b6cee71dSXin LI.Dv uC
394b6cee71dSXin LIand
395b6cee71dSXin LI.Dv u1
396b6cee71dSXin LIare equivalent to
397b6cee71dSXin LI.Dv ubyte ,
398b6cee71dSXin LIthe type specifiers
399b6cee71dSXin LI.Dv dS
400b6cee71dSXin LIand
401b6cee71dSXin LI.Dv d2
402b6cee71dSXin LIare equivalent to
403b6cee71dSXin LI.Dv short ,
404b6cee71dSXin LIthe type specifiers
405b6cee71dSXin LI.Dv uS
406b6cee71dSXin LIand
407b6cee71dSXin LI.Dv u2
408b6cee71dSXin LIare equivalent to
409b6cee71dSXin LI.Dv ushort ,
410b6cee71dSXin LIthe type specifiers
411b6cee71dSXin LI.Dv dI ,
412b6cee71dSXin LI.Dv dL ,
413b6cee71dSXin LIand
414b6cee71dSXin LI.Dv d4
415b6cee71dSXin LIare equivalent to
416b6cee71dSXin LI.Dv long ,
417b6cee71dSXin LIthe type specifiers
418b6cee71dSXin LI.Dv uI ,
419b6cee71dSXin LI.Dv uL ,
420b6cee71dSXin LIand
421b6cee71dSXin LI.Dv u4
422b6cee71dSXin LIare equivalent to
423b6cee71dSXin LI.Dv ulong ,
424b6cee71dSXin LIthe type specifier
425b6cee71dSXin LI.Dv d8
426b6cee71dSXin LIis equivalent to
427b6cee71dSXin LI.Dv quad ,
428b6cee71dSXin LIthe type specifier
429b6cee71dSXin LI.Dv u8
430b6cee71dSXin LIis equivalent to
431b6cee71dSXin LI.Dv uquad ,
432b6cee71dSXin LIand the type specifier
433b6cee71dSXin LI.Dv s
434b6cee71dSXin LIis equivalent to
435b6cee71dSXin LI.Dv string .
436b6cee71dSXin LIIn addition, the type specifier
437b6cee71dSXin LI.Dv dQ
438b6cee71dSXin LIis equivalent to
439b6cee71dSXin LI.Dv quad
440b6cee71dSXin LIand the type specifier
441b6cee71dSXin LI.Dv uQ
442b6cee71dSXin LIis equivalent to
443b6cee71dSXin LI.Dv uquad .
444b6cee71dSXin LI.Pp
445b6cee71dSXin LIEach top-level magic pattern (see below for an explanation of levels)
446b6cee71dSXin LIis classified as text or binary according to the types used.
447b6cee71dSXin LITypes
448b6cee71dSXin LI.Dq regex
449b6cee71dSXin LIand
450b6cee71dSXin LI.Dq search
451b6cee71dSXin LIare classified as text tests, unless non-printable characters are used
452b6cee71dSXin LIin the pattern.
453b6cee71dSXin LIAll other tests are classified as binary.
454b6cee71dSXin LIA top-level
455b6cee71dSXin LIpattern is considered to be a test text when all its patterns are text
456b6cee71dSXin LIpatterns; otherwise, it is considered to be a binary pattern.
457b6cee71dSXin LIWhen
458b6cee71dSXin LImatching a file, binary patterns are tried first; if no match is
459b6cee71dSXin LIfound, and the file looks like text, then its encoding is determined
460b6cee71dSXin LIand the text patterns are tried.
461b6cee71dSXin LI.Pp
462b6cee71dSXin LIThe numeric types may optionally be followed by
463b6cee71dSXin LI.Dv \*[Am]
464b6cee71dSXin LIand a numeric value,
465b6cee71dSXin LIto specify that the value is to be AND'ed with the
466b6cee71dSXin LInumeric value before any comparisons are done.
467b6cee71dSXin LIPrepending a
468b6cee71dSXin LI.Dv u
469b6cee71dSXin LIto the type indicates that ordered comparisons should be unsigned.
470b6cee71dSXin LI.It Dv test
471b6cee71dSXin LIThe value to be compared with the value from the file.
472b6cee71dSXin LIIf the type is
473b6cee71dSXin LInumeric, this value
474b6cee71dSXin LIis specified in C form; if it is a string, it is specified as a C string
475b6cee71dSXin LIwith the usual escapes permitted (e.g. \en for new-line).
476b6cee71dSXin LI.Pp
477b6cee71dSXin LINumeric values
478b6cee71dSXin LImay be preceded by a character indicating the operation to be performed.
479b6cee71dSXin LIIt may be
480b6cee71dSXin LI.Dv = ,
481b6cee71dSXin LIto specify that the value from the file must equal the specified value,
482b6cee71dSXin LI.Dv \*[Lt] ,
483b6cee71dSXin LIto specify that the value from the file must be less than the specified
484b6cee71dSXin LIvalue,
485b6cee71dSXin LI.Dv \*[Gt] ,
486b6cee71dSXin LIto specify that the value from the file must be greater than the specified
487b6cee71dSXin LIvalue,
488b6cee71dSXin LI.Dv \*[Am] ,
489b6cee71dSXin LIto specify that the value from the file must have set all of the bits
490b6cee71dSXin LIthat are set in the specified value,
491b6cee71dSXin LI.Dv ^ ,
492b6cee71dSXin LIto specify that the value from the file must have clear any of the bits
493b6cee71dSXin LIthat are set in the specified value, or
494b6cee71dSXin LI.Dv ~ ,
495b6cee71dSXin LIthe value specified after is negated before tested.
496b6cee71dSXin LI.Dv x ,
497b6cee71dSXin LIto specify that any value will match.
498b6cee71dSXin LIIf the character is omitted, it is assumed to be
499b6cee71dSXin LI.Dv = .
500b6cee71dSXin LIOperators
501b6cee71dSXin LI.Dv \*[Am] ,
502b6cee71dSXin LI.Dv ^ ,
503b6cee71dSXin LIand
504b6cee71dSXin LI.Dv ~
505b6cee71dSXin LIdon't work with floats and doubles.
506b6cee71dSXin LIThe operator
507b6cee71dSXin LI.Dv !\&
508b6cee71dSXin LIspecifies that the line matches if the test does
509b6cee71dSXin LI.Em not
510b6cee71dSXin LIsucceed.
511b6cee71dSXin LI.Pp
512b6cee71dSXin LINumeric values are specified in C form; e.g.
513b6cee71dSXin LI.Dv 13
514b6cee71dSXin LIis decimal,
515b6cee71dSXin LI.Dv 013
516b6cee71dSXin LIis octal, and
517b6cee71dSXin LI.Dv 0x13
518b6cee71dSXin LIis hexadecimal.
519b6cee71dSXin LI.Pp
520b6cee71dSXin LINumeric operations are not performed on date types, instead the numeric
521b6cee71dSXin LIvalue is interpreted as an offset.
522b6cee71dSXin LI.Pp
523b6cee71dSXin LIFor string values, the string from the
524b6cee71dSXin LIfile must match the specified string.
525b6cee71dSXin LIThe operators
526b6cee71dSXin LI.Dv = ,
527b6cee71dSXin LI.Dv \*[Lt]
528b6cee71dSXin LIand
529b6cee71dSXin LI.Dv \*[Gt]
530b6cee71dSXin LI(but not
531b6cee71dSXin LI.Dv \*[Am] )
532b6cee71dSXin LIcan be applied to strings.
533b6cee71dSXin LIThe length used for matching is that of the string argument
534b6cee71dSXin LIin the magic file.
535b6cee71dSXin LIThis means that a line can match any non-empty string (usually used to
536b6cee71dSXin LIthen print the string), with
537b6cee71dSXin LI.Em \*[Gt]\e0
538b6cee71dSXin LI(because all non-empty strings are greater than the empty string).
539b6cee71dSXin LI.Pp
540b6cee71dSXin LIDates are treated as numerical values in the respective internal
541b6cee71dSXin LIrepresentation.
542b6cee71dSXin LI.Pp
543b6cee71dSXin LIThe special test
544b6cee71dSXin LI.Em x
545b6cee71dSXin LIalways evaluates to true.
546b6cee71dSXin LI.It Dv message
547b6cee71dSXin LIThe message to be printed if the comparison succeeds.
548b6cee71dSXin LIIf the string contains a
549b6cee71dSXin LI.Xr printf 3
550b6cee71dSXin LIformat specification, the value from the file (with any specified masking
551b6cee71dSXin LIperformed) is printed using the message as the format string.
552b6cee71dSXin LIIf the string begins with
553b6cee71dSXin LI.Dq \eb ,
554b6cee71dSXin LIthe message printed is the remainder of the string with no whitespace
555b6cee71dSXin LIadded before it: multiple matches are normally separated by a single
556b6cee71dSXin LIspace.
557b6cee71dSXin LI.El
558b6cee71dSXin LI.Pp
559b6cee71dSXin LIAn APPLE 4+4 character APPLE creator and type can be specified as:
560b6cee71dSXin LI.Bd -literal -offset indent
561b6cee71dSXin LI!:apple	CREATYPE
562b6cee71dSXin LI.Ed
563b6cee71dSXin LI.Pp
564898496eeSXin LIA slash-separated list of commonly found filename extensions can be specified
565898496eeSXin LIas:
566898496eeSXin LI.Bd -literal -offset indent
567898496eeSXin LI!:ext	ext[/ext...]
568898496eeSXin LI.Ed
569898496eeSXin LI.Pp
570898496eeSXin LIi.e. the literal string
571898496eeSXin LI.Dq !:ext
572898496eeSXin LIfollowed by a slash-separated list of commonly found extensions; for example
573898496eeSXin LIfor JPEG images:
574898496eeSXin LI.Bd -literal -offset indent
575898496eeSXin LI!:ext jpeg/jpg/jpe/jfif
576898496eeSXin LI.Ed
577898496eeSXin LI.Pp
578b6cee71dSXin LIA MIME type is given on a separate line, which must be the next
579b6cee71dSXin LInon-blank or comment line after the magic line that identifies the
580b6cee71dSXin LIfile type, and has the following format:
581b6cee71dSXin LI.Bd -literal -offset indent
582b6cee71dSXin LI!:mime	MIMETYPE
583b6cee71dSXin LI.Ed
584b6cee71dSXin LI.Pp
585b6cee71dSXin LIi.e. the literal string
586b6cee71dSXin LI.Dq !:mime
587b6cee71dSXin LIfollowed by the MIME type.
588b6cee71dSXin LI.Pp
589b6cee71dSXin LIAn optional strength can be supplied on a separate line which refers to
590b6cee71dSXin LIthe current magic description using the following format:
591b6cee71dSXin LI.Bd -literal -offset indent
592b6cee71dSXin LI!:strength OP VALUE
593b6cee71dSXin LI.Ed
594b6cee71dSXin LI.Pp
595b6cee71dSXin LIThe operand
596b6cee71dSXin LI.Dv OP
597b6cee71dSXin LIcan be:
598b6cee71dSXin LI.Dv + ,
599b6cee71dSXin LI.Dv - ,
600b6cee71dSXin LI.Dv * ,
601b6cee71dSXin LIor
602b6cee71dSXin LI.Dv /
603b6cee71dSXin LIand
604b6cee71dSXin LI.Dv VALUE
605b6cee71dSXin LIis a constant between 0 and 255.
606b6cee71dSXin LIThis constant is applied using the specified operand
607b6cee71dSXin LIto the currently computed default magic strength.
608b6cee71dSXin LI.Pp
609b6cee71dSXin LISome file formats contain additional information which is to be printed
610b6cee71dSXin LIalong with the file type or need additional tests to determine the true
611b6cee71dSXin LIfile type.
612b6cee71dSXin LIThese additional tests are introduced by one or more
613b6cee71dSXin LI.Em \*[Gt]
614b6cee71dSXin LIcharacters preceding the offset.
615b6cee71dSXin LIThe number of
616b6cee71dSXin LI.Em \*[Gt]
617b6cee71dSXin LIon the line indicates the level of the test; a line with no
618b6cee71dSXin LI.Em \*[Gt]
619b6cee71dSXin LIat the beginning is considered to be at level 0.
620b6cee71dSXin LITests are arranged in a tree-like hierarchy:
621b6cee71dSXin LIif the test on a line at level
622b6cee71dSXin LI.Em n
623b6cee71dSXin LIsucceeds, all following tests at level
624b6cee71dSXin LI.Em n+1
625b6cee71dSXin LIare performed, and the messages printed if the tests succeed, until a line
626b6cee71dSXin LIwith level
627b6cee71dSXin LI.Em n
628b6cee71dSXin LI(or less) appears.
629b6cee71dSXin LIFor more complex files, one can use empty messages to get just the
630b6cee71dSXin LI"if/then" effect, in the following way:
631b6cee71dSXin LI.Bd -literal -offset indent
632b6cee71dSXin LI0      string    MZ
633*ae316d1dSXin LI\*[Gt]0x18  uleshort  \*[Lt]0x40   MS-DOS executable
634*ae316d1dSXin LI\*[Gt]0x18  uleshort  \*[Gt]0x3f   extended PC executable (e.g., MS Windows)
635b6cee71dSXin LI.Ed
636b6cee71dSXin LI.Pp
637b6cee71dSXin LIOffsets do not need to be constant, but can also be read from the file
638b6cee71dSXin LIbeing examined.
639b6cee71dSXin LIIf the first character following the last
640b6cee71dSXin LI.Em \*[Gt]
641b6cee71dSXin LIis a
642b6cee71dSXin LI.Em \&(
643b6cee71dSXin LIthen the string after the parenthesis is interpreted as an indirect offset.
644b6cee71dSXin LIThat means that the number after the parenthesis is used as an offset in
645b6cee71dSXin LIthe file.
646b6cee71dSXin LIThe value at that offset is read, and is used again as an offset
647b6cee71dSXin LIin the file.
648b6cee71dSXin LIIndirect offsets are of the form:
649*ae316d1dSXin LI.Em ( x [[.,][bBcCeEfFgGhHiIlmosSqQ]][+\-][ y ]) .
650b6cee71dSXin LIThe value of
651b6cee71dSXin LI.Em x
652b6cee71dSXin LIis used as an offset in the file.
653b6cee71dSXin LIA byte, id3 length, short or long is read at that offset depending on the
654*ae316d1dSXin LI.Em [bBcCeEfFgGhHiIlLmsSqQ]
655b6cee71dSXin LItype specifier.
656a5d223e6SXin LIThe value is treated as signed if
657*ae316d1dSXin LI.Dq \&,
658a5d223e6SXin LIis specified or unsigned if
659*ae316d1dSXin LI.Dq \&.
660a5d223e6SXin LIis specified.
661b6cee71dSXin LIThe capitalized types interpret the number as a big endian
662b6cee71dSXin LIvalue, whereas the small letter versions interpret the number as a little
663b6cee71dSXin LIendian value;
664b6cee71dSXin LIthe
665b6cee71dSXin LI.Em m
666b6cee71dSXin LItype interprets the number as a middle endian (PDP-11) value.
667b6cee71dSXin LITo that number the value of
668b6cee71dSXin LI.Em y
669b6cee71dSXin LIis added and the result is used as an offset in the file.
670b6cee71dSXin LIThe default type if one is not specified is long.
6712dc4dbb9SEitan AdlerThe following types are recognized:
6722dc4dbb9SEitan Adler.Bl -column -offset indent "Type" "Half/Short" "Little" "Size"
6732dc4dbb9SEitan Adler.It Sy Type	Sy Mnemonic	Sy Endian	Sy Size
674*ae316d1dSXin LI.It bcBC	Byte/Char	N/A	1
6752dc4dbb9SEitan Adler.It efg	Double	Little	8
6762dc4dbb9SEitan Adler.It EFG	Double	Big	8
6772dc4dbb9SEitan Adler.It hs	Half/Short	Little	2
6782dc4dbb9SEitan Adler.It HS	Half/Short	Big	2
6792dc4dbb9SEitan Adler.It i	ID3	Little	4
6802dc4dbb9SEitan Adler.It I	ID3	Big	4
681*ae316d1dSXin LI.It l	Long	Little	4
682*ae316d1dSXin LI.It L	Long	Big	4
6832dc4dbb9SEitan Adler.It m	Middle	Middle	4
684a2dfb722SXin LI.It o	Octal	Textual	Variable
6852dc4dbb9SEitan Adler.It q	Quad	Little	8
6862dc4dbb9SEitan Adler.It Q	Quad	Big	8
6872dc4dbb9SEitan Adler.El
688b6cee71dSXin LI.Pp
689b6cee71dSXin LIThat way variable length structures can be examined:
690b6cee71dSXin LI.Bd -literal -offset indent
691b6cee71dSXin LI# MS Windows executables are also valid MS-DOS executables
692b6cee71dSXin LI0           string   MZ
693*ae316d1dSXin LI\*[Gt]0x18       uleshort \*[Lt]0x40  MZ executable (MS-DOS)
694b6cee71dSXin LI# skip the whole block below if it is not an extended executable
695*ae316d1dSXin LI\*[Gt]0x18       uleshort \*[Gt]0x3f
696b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)  string   PE\e0\e0 PE executable (MS-Windows)
697b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)  string   LX\e0\e0 LX executable (OS/2)
698b6cee71dSXin LI.Ed
699b6cee71dSXin LI.Pp
700a5d223e6SXin LIThis strategy of examining has a drawback: you must make sure that you
701a5d223e6SXin LIeventually print something, or users may get empty output (such as when
702a5d223e6SXin LIthere is neither PE\e0\e0 nor LE\e0\e0 in the above example).
703b6cee71dSXin LI.Pp
704b6cee71dSXin LIIf this indirect offset cannot be used directly, simple calculations are
705b6cee71dSXin LIpossible: appending
706b6cee71dSXin LI.Em [+-*/%\*[Am]|^]number
707b6cee71dSXin LIinside parentheses allows one to modify
708b6cee71dSXin LIthe value read from the file before it is used as an offset:
709b6cee71dSXin LI.Bd -literal -offset indent
710b6cee71dSXin LI# MS Windows executables are also valid MS-DOS executables
711b6cee71dSXin LI0           string   MZ
712b6cee71dSXin LI# sometimes, the value at 0x18 is less that 0x40 but there's still an
713b6cee71dSXin LI# extended executable, simply appended to the file
714*ae316d1dSXin LI\*[Gt]0x18       uleshort \*[Lt]0x40
715b6cee71dSXin LI\*[Gt]\*[Gt](4.s*512) leshort  0x014c  COFF executable (MS-DOS, DJGPP)
716b6cee71dSXin LI\*[Gt]\*[Gt](4.s*512) leshort  !0x014c MZ executable (MS-DOS)
717b6cee71dSXin LI.Ed
718b6cee71dSXin LI.Pp
719b6cee71dSXin LISometimes you do not know the exact offset as this depends on the length or
720b6cee71dSXin LIposition (when indirection was used before) of preceding fields.
721b6cee71dSXin LIYou can specify an offset relative to the end of the last up-level
722b6cee71dSXin LIfield using
723b6cee71dSXin LI.Sq \*[Am]
724b6cee71dSXin LIas a prefix to the offset:
725b6cee71dSXin LI.Bd -literal -offset indent
726b6cee71dSXin LI0           string   MZ
727*ae316d1dSXin LI\*[Gt]0x18       uleshort \*[Gt]0x3f
728b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)  string   PE\e0\e0    PE executable (MS-Windows)
729b6cee71dSXin LI# immediately following the PE signature is the CPU type
730b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am]0       leshort  0x14c     for Intel 80386
731*ae316d1dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am]0       leshort  0x8664    for x86-64
732b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am]0       leshort  0x184     for DEC Alpha
733b6cee71dSXin LI.Ed
734b6cee71dSXin LI.Pp
735b6cee71dSXin LIIndirect and relative offsets can be combined:
736b6cee71dSXin LI.Bd -literal -offset indent
737b6cee71dSXin LI0             string   MZ
738*ae316d1dSXin LI\*[Gt]0x18         uleshort \*[Lt]0x40
739b6cee71dSXin LI\*[Gt]\*[Gt](4.s*512)   leshort  !0x014c MZ executable (MS-DOS)
740b6cee71dSXin LI# if it's not COFF, go back 512 bytes and add the offset taken
741b6cee71dSXin LI# from byte 2/3, which is yet another way of finding the start
742b6cee71dSXin LI# of the extended executable
743b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am](2.s-514) string   LE      LE executable (MS Windows VxD driver)
744b6cee71dSXin LI.Ed
745b6cee71dSXin LI.Pp
746b6cee71dSXin LIOr the other way around:
747b6cee71dSXin LI.Bd -literal -offset indent
748b6cee71dSXin LI0                 string   MZ
749*ae316d1dSXin LI\*[Gt]0x18             uleshort \*[Gt]0x3f
750b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)        string   LE\e0\e0  LE executable (MS-Windows)
751b6cee71dSXin LI# at offset 0x80 (-4, since relative offsets start at the end
752b6cee71dSXin LI# of the up-level match) inside the LE header, we find the absolute
753b6cee71dSXin LI# offset to the code area, where we look for a specific signature
754b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt](\*[Am]0x7c.l+0x26) string   UPX     \eb, UPX compressed
755b6cee71dSXin LI.Ed
756b6cee71dSXin LI.Pp
757b6cee71dSXin LIOr even both!
758b6cee71dSXin LI.Bd -literal -offset indent
759b6cee71dSXin LI0                string   MZ
760*ae316d1dSXin LI\*[Gt]0x18            uleshort \*[Gt]0x3f
761b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)       string   LE\e0\e0 LE executable (MS-Windows)
762b6cee71dSXin LI# at offset 0x58 inside the LE header, we find the relative offset
763b6cee71dSXin LI# to a data area where we look for a specific signature
764b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3)  string   UNACE  \eb, ACE self-extracting archive
765b6cee71dSXin LI.Ed
766b6cee71dSXin LI.Pp
767b6cee71dSXin LIIf you have to deal with offset/length pairs in your file, even the
768b6cee71dSXin LIsecond value in a parenthesized expression can be taken from the file itself,
769b6cee71dSXin LIusing another set of parentheses.
770b6cee71dSXin LINote that this additional indirect offset is always relative to the
771b6cee71dSXin LIstart of the main indirect offset.
772b6cee71dSXin LI.Bd -literal -offset indent
773b6cee71dSXin LI0                 string       MZ
774*ae316d1dSXin LI\*[Gt]0x18             uleshort     \*[Gt]0x3f
775b6cee71dSXin LI\*[Gt]\*[Gt](0x3c.l)        string       PE\e0\e0 PE executable (MS-Windows)
776b6cee71dSXin LI# search for the PE section called ".idata"...
777b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Am]0xf4          search/0x140 .idata
778b6cee71dSXin LI# ...and go to the end of it, calculated from start+length;
779b6cee71dSXin LI# these are located 14 and 10 bytes after the section name
780b6cee71dSXin LI\*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
781b6cee71dSXin LI.Ed
782b6cee71dSXin LI.Pp
78340427ccaSGordon TetlowIf you have a list of known values at a particular continuation level,
784b6cee71dSXin LIand you want to provide a switch-like default case:
785b6cee71dSXin LI.Bd -literal -offset indent
786b6cee71dSXin LI# clear that continuation level match
787*ae316d1dSXin LI\*[Gt]18	clear	x
788b6cee71dSXin LI\*[Gt]18	lelong	1	one
789b6cee71dSXin LI\*[Gt]18	lelong	2	two
790b6cee71dSXin LI\*[Gt]18	default	x
791b6cee71dSXin LI# print default match
792b6cee71dSXin LI\*[Gt]\*[Gt]18	lelong	x	unmatched 0x%x
793b6cee71dSXin LI.Ed
794b6cee71dSXin LI.Sh SEE ALSO
795b6cee71dSXin LI.Xr file __CSECTION__
796b6cee71dSXin LI\- the command that reads this file.
797b6cee71dSXin LI.Sh BUGS
798b6cee71dSXin LIThe formats
799b6cee71dSXin LI.Dv long ,
800b6cee71dSXin LI.Dv belong ,
801b6cee71dSXin LI.Dv lelong ,
802b6cee71dSXin LI.Dv melong ,
803b6cee71dSXin LI.Dv short ,
804b6cee71dSXin LI.Dv beshort ,
805b6cee71dSXin LIand
806b6cee71dSXin LI.Dv leshort
807b6cee71dSXin LIdo not depend on the length of the C data types
808b6cee71dSXin LI.Dv short
809b6cee71dSXin LIand
810b6cee71dSXin LI.Dv long
811b6cee71dSXin LIon the platform, even though the Single
812b6cee71dSXin LI.Ux
813898496eeSXin LISpecification implies that they do.
814898496eeSXin LIHowever, as OS X Mountain Lion has passed the Single
815b6cee71dSXin LI.Ux
816b6cee71dSXin LISpecification validation suite, and supplies a version of
817b6cee71dSXin LI.Xr file __CSECTION__
818b6cee71dSXin LIin which they do not depend on the sizes of the C data types and that is
819b6cee71dSXin LIbuilt for a 64-bit environment in which
820b6cee71dSXin LI.Dv long
821b6cee71dSXin LIis 8 bytes rather than 4 bytes, presumably the validation suite does not
822b6cee71dSXin LItest whether, for example
823b6cee71dSXin LI.Dv long
824b6cee71dSXin LIrefers to an item with the same size as the C data type
825b6cee71dSXin LI.Dv long .
826b6cee71dSXin LIThere should probably be
827b6cee71dSXin LI.Dv type
828b6cee71dSXin LInames
829b6cee71dSXin LI.Dv int8 ,
830b6cee71dSXin LI.Dv uint8 ,
831b6cee71dSXin LI.Dv int16 ,
832b6cee71dSXin LI.Dv uint16 ,
833b6cee71dSXin LI.Dv int32 ,
834b6cee71dSXin LI.Dv uint32 ,
835b6cee71dSXin LI.Dv int64 ,
836b6cee71dSXin LIand
837b6cee71dSXin LI.Dv uint64 ,
838b6cee71dSXin LIand specified-byte-order variants of them,
839b6cee71dSXin LIto make it clearer that those types have specified widths.
840b6cee71dSXin LI.\"
841b6cee71dSXin LI.\" From: guy@sun.uucp (Guy Harris)
842b6cee71dSXin LI.\" Newsgroups: net.bugs.usg
843b6cee71dSXin LI.\" Subject: /etc/magic's format isn't well documented
844b6cee71dSXin LI.\" Message-ID: <2752@sun.uucp>
845b6cee71dSXin LI.\" Date: 3 Sep 85 08:19:07 GMT
846b6cee71dSXin LI.\" Organization: Sun Microsystems, Inc.
847b6cee71dSXin LI.\" Lines: 136
848b6cee71dSXin LI.\"
849b6cee71dSXin LI.\" Here's a manual page for the format accepted by the "file" made by adding
850b6cee71dSXin LI.\" the changes I posted to the S5R2 version.
851b6cee71dSXin LI.\"
852b6cee71dSXin LI.\" Modified for Ian Darwin's version of the file command.
853*ae316d1dSXin LI.\"
854*ae316d1dSXin LI.\" For emacs editor
855*ae316d1dSXin LI.\" Local Variables:
856*ae316d1dSXin LI.\" eval: (add-hook 'before-save-hook 'time-stamp)
857*ae316d1dSXin LI.\" time-stamp-start: ".Dd "
858*ae316d1dSXin LI.\" time-stamp-end: "$"
859*ae316d1dSXin LI.\" time-stamp-format: "%:B %02d, %:Y"
860*ae316d1dSXin LI.\" time-stamp-time-zone: "UTC0"
861*ae316d1dSXin LI.\" system-time-locale: "C"
862*ae316d1dSXin LI.\" eval:(setq compile-command (concat "groff -Tlatin1 -m man " (buffer-file-name)) )
863*ae316d1dSXin LI.\" End:
864*ae316d1dSXin LI.\"
865