xref: /netbsd-src/external/bsd/file/dist/doc/magic.5 (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1.\"	$NetBSD: magic.5,v 1.23 2021/04/09 19:11:41 christos Exp $
2.\"
3.\" $File: magic.man,v 1.98 2020/05/09 18:55:23 christos Exp $
4.Dd May 9, 2020
5.Dt MAGIC 5
6.Os
7.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
8.Sh NAME
9.Nm magic
10.Nd file command's magic pattern file
11.Sh DESCRIPTION
12This manual page documents the format of magic files as
13used by the
14.Xr file 1
15command, version 5.40.
16The
17.Xr file 1
18command identifies the type of a file using,
19among other tests,
20a test for whether the file contains certain
21.Dq "magic patterns" .
22The database of these
23.Dq "magic patterns"
24is usually located in a binary file in
25.Pa /usr/share/misc/magic.mgc
26or a directory of source text magic pattern fragment files in
27.Pa /usr/share/misc/magic .
28The database specifies what patterns are to be tested for, what message or
29MIME type to print if a particular pattern is found,
30and additional information to extract from the file.
31.Pp
32The format of the source fragment files that are used to build this database
33is as follows:
34Each line of a fragment file specifies a test to be performed.
35A test compares the data starting at a particular offset
36in the file with a byte value, a string or a numeric value.
37If the test succeeds, a message is printed.
38The line consists of the following fields:
39.Bl -tag -width ".Dv message"
40.It Dv offset
41A number specifying the offset (in bytes) into the file of the data
42which is to be tested.
43This offset can be a negative number if it is:
44.Bl -bullet  -compact
45.It
46The first direct offset of the magic entry (at continuation level 0),
47in which case it is interpreted an offset from end end of the file
48going backwards.
49This works only when a file descriptor to the file is available and it
50is a regular file.
51.It
52A continuation offset relative to the end of the last up-level field
53.Dv ( \*[Am] ) .
54.El
55.It Dv type
56The type of the data to be tested.
57The possible values are:
58.Bl -tag -width ".Dv lestring16"
59.It Dv byte
60A one-byte value.
61.It Dv short
62A two-byte value in this machine's native byte order.
63.It Dv long
64A four-byte value in this machine's native byte order.
65.It Dv quad
66An eight-byte value in this machine's native byte order.
67.It Dv float
68A 32-bit single precision IEEE floating point number in this machine's native byte order.
69.It Dv double
70A 64-bit double precision IEEE floating point number in this machine's native byte order.
71.It Dv string
72A string of bytes.
73The string type specification can be optionally followed
74by /[WwcCtbT]*.
75The
76.Dq W
77flag compacts whitespace in the target, which must
78contain at least one whitespace character.
79If the magic has
80.Dv n
81consecutive blanks, the target needs at least
82.Dv n
83consecutive blanks to match.
84The
85.Dq w
86flag treats every blank in the magic as an optional blank.
87The
88.Dq c
89flag specifies case insensitive matching: lower case
90characters in the magic match both lower and upper case characters in the
91target, whereas upper case characters in the magic only match upper case
92characters in the target.
93The
94.Dq C
95flag specifies case insensitive matching: upper case
96characters in the magic match both lower and upper case characters in the
97target, whereas lower case characters in the magic only match upper case
98characters in the target.
99To do a complete case insensitive match, specify both
100.Dq c
101and
102.Dq C .
103The
104.Dq t
105flag forces the test to be done for text files, while the
106.Dq b
107flag forces the test to be done for binary files.
108The
109.Dq T
110flag causes the string to be trimmed, i.e. leading and trailing whitespace
111is deleted before the string is printed.
112.It Dv pstring
113A Pascal-style string where the first byte/short/int is interpreted as the
114unsigned length.
115The length defaults to byte and can be specified as a modifier.
116The following modifiers are supported:
117.Bl -tag -compact -width B
118.It B
119A byte length (default).
120.It H
121A 2 byte big endian length.
122.It h
123A 2 byte little endian length.
124.It L
125A 4 byte big endian length.
126.It l
127A 4 byte little endian length.
128.It J
129The length includes itself in its count.
130.El
131The string is not NUL terminated.
132.Dq J
133is used rather than the more
134valuable
135.Dq I
136because this type of length is a feature of the JPEG
137format.
138.It Dv date
139A four-byte value interpreted as a UNIX date.
140.It Dv qdate
141An eight-byte value interpreted as a UNIX date.
142.It Dv ldate
143A four-byte value interpreted as a UNIX-style date, but interpreted as
144local time rather than UTC.
145.It Dv qldate
146An eight-byte value interpreted as a UNIX-style date, but interpreted as
147local time rather than UTC.
148.It Dv qwdate
149An eight-byte value interpreted as a Windows-style date.
150.It Dv beid3
151A 32-bit ID3 length in big-endian byte order.
152.It Dv beshort
153A two-byte value in big-endian byte order.
154.It Dv belong
155A four-byte value in big-endian byte order.
156.It Dv bequad
157An eight-byte value in big-endian byte order.
158.It Dv befloat
159A 32-bit single precision IEEE floating point number in big-endian byte order.
160.It Dv bedouble
161A 64-bit double precision IEEE floating point number in big-endian byte order.
162.It Dv bedate
163A four-byte value in big-endian byte order,
164interpreted as a Unix date.
165.It Dv beqdate
166An eight-byte value in big-endian byte order,
167interpreted as a Unix date.
168.It Dv beldate
169A four-byte value in big-endian byte order,
170interpreted as a UNIX-style date, but interpreted as local time rather
171than UTC.
172.It Dv beqldate
173An eight-byte value in big-endian byte order,
174interpreted as a UNIX-style date, but interpreted as local time rather
175than UTC.
176.It Dv beqwdate
177An eight-byte value in big-endian byte order,
178interpreted as a Windows-style date.
179.It Dv bestring16
180A two-byte unicode (UCS16) string in big-endian byte order.
181.It Dv leid3
182A 32-bit ID3 length in little-endian byte order.
183.It Dv leshort
184A two-byte value in little-endian byte order.
185.It Dv lelong
186A four-byte value in little-endian byte order.
187.It Dv lequad
188An eight-byte value in little-endian byte order.
189.It Dv lefloat
190A 32-bit single precision IEEE floating point number in little-endian byte order.
191.It Dv ledouble
192A 64-bit double precision IEEE floating point number in little-endian byte order.
193.It Dv ledate
194A four-byte value in little-endian byte order,
195interpreted as a UNIX date.
196.It Dv leqdate
197An eight-byte value in little-endian byte order,
198interpreted as a UNIX date.
199.It Dv leldate
200A four-byte value in little-endian byte order,
201interpreted as a UNIX-style date, but interpreted as local time rather
202than UTC.
203.It Dv leqldate
204An eight-byte value in little-endian byte order,
205interpreted as a UNIX-style date, but interpreted as local time rather
206than UTC.
207.It Dv leqwdate
208An eight-byte value in little-endian byte order,
209interpreted as a Windows-style date.
210.It Dv lestring16
211A two-byte unicode (UCS16) string in little-endian byte order.
212.It Dv melong
213A four-byte value in middle-endian (PDP-11) byte order.
214.It Dv medate
215A four-byte value in middle-endian (PDP-11) byte order,
216interpreted as a UNIX date.
217.It Dv meldate
218A four-byte value in middle-endian (PDP-11) byte order,
219interpreted as a UNIX-style date, but interpreted as local time rather
220than UTC.
221.It Dv indirect
222Starting at the given offset, consult the magic database again.
223The offset of the
224.Dv indirect
225magic is by default absolute in the file, but one can specify
226.Dv /r
227to indicate that the offset is relative from the beginning of the entry.
228.It Dv name
229Define a
230.Dq named
231magic instance that can be called from another
232.Dv use
233magic entry, like a subroutine call.
234Named instance direct magic offsets are relative to the offset of the
235previous matched entry, but indirect offsets are relative to the beginning
236of the file as usual.
237Named magic entries always match.
238.It Dv use
239Recursively call the named magic starting from the current offset.
240If the name of the referenced begins with a
241.Dv ^
242then the endianness of the magic is switched; if the magic mentioned
243.Dv leshort
244for example,
245it is treated as
246.Dv beshort
247and vice versa.
248This is useful to avoid duplicating the rules for different endianness.
249.It Dv regex
250A regular expression match in extended POSIX regular expression syntax
251(like egrep).
252Regular expressions can take exponential time to process, and their
253performance is hard to predict, so their use is discouraged.
254When used in production environments, their performance
255should be carefully checked.
256The size of the string to search should also be limited by specifying
257.Dv /<length> ,
258to avoid performance issues scanning long files.
259The type specification can also be optionally followed by
260.Dv /[c][s][l] .
261The
262.Dq c
263flag makes the match case insensitive, while the
264.Dq s
265flag update the offset to the start offset of the match, rather than the end.
266The
267.Dq l
268modifier, changes the limit of length to mean number of lines instead of a
269byte count.
270Lines are delimited by the platforms native line delimiter.
271When a line count is specified, an implicit byte count also computed assuming
272each line is 80 characters long.
273If neither a byte or line count is specified, the search is limited automatically
274to 8KiB.
275.Dv ^
276and
277.Dv $
278match the beginning and end of individual lines, respectively,
279not beginning and end of file.
280.It Dv search
281A literal string search starting at the given offset.
282The same modifier flags can be used as for string patterns.
283The search expression must contain the range in the form
284.Dv /number,
285that is the number of positions at which the match will be
286attempted, starting from the start offset.
287This is suitable for
288searching larger binary expressions with variable offsets, using
289.Dv \e
290escapes for special characters.
291The order of modifier and number is not relevant.
292.It Dv default
293This is intended to be used with the test
294.Em x
295(which is always true) and it has no type.
296It matches when no other test at that continuation level has matched before.
297Clearing that matched tests for a continuation level, can be done using the
298.Dv clear
299test.
300.It Dv clear
301This test is always true and clears the match flag for that continuation level.
302It is intended to be used with the
303.Dv default
304test.
305.It Dv der
306Parse the file as a DER Certificate file.
307The test field is used as a der type that needs to be matched.
308The DER types are:
309.Dv eoc ,
310.Dv bool ,
311.Dv int ,
312.Dv bit_str ,
313.Dv octet_str ,
314.Dv null ,
315.Dv obj_id ,
316.Dv obj_desc ,
317.Dv ext ,
318.Dv real ,
319.Dv enum ,
320.Dv embed ,
321.Dv utf8_str ,
322.Dv rel_oid ,
323.Dv time ,
324.Dv res2 ,
325.Dv seq ,
326.Dv set ,
327.Dv num_str ,
328.Dv prt_str ,
329.Dv t61_str ,
330.Dv vid_str ,
331.Dv ia5_str ,
332.Dv utc_time ,
333.Dv gen_time ,
334.Dv gr_str ,
335.Dv vis_str ,
336.Dv gen_str ,
337.Dv univ_str ,
338.Dv char_str ,
339.Dv bmp_str ,
340.Dv date ,
341.Dv tod ,
342.Dv datetime ,
343.Dv duration ,
344.Dv oid-iri ,
345.Dv rel-oid-iri .
346These types can be followed by an optional numeric size, which indicates
347the field width in bytes.
348.It Dv guid
349A Globally Unique Identifier, parsed and printed as
350XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
351It's format is a string.
352.It Dv offset
353This is a quad value indicating the current offset of the file.
354It can be used to determine the size of the file or the magic buffer.
355For example the magic entries:
356.Bd -literal -offset indent
357-0	offset	x	this file is %lld bytes
358-0	offset	<=100	must be more than 100 \e
359    bytes and is only %lld
360.Ed
361.El
362.Pp
363For compatibility with the Single
364.Ux
365Standard, the type specifiers
366.Dv dC
367and
368.Dv d1
369are equivalent to
370.Dv byte ,
371the type specifiers
372.Dv uC
373and
374.Dv u1
375are equivalent to
376.Dv ubyte ,
377the type specifiers
378.Dv dS
379and
380.Dv d2
381are equivalent to
382.Dv short ,
383the type specifiers
384.Dv uS
385and
386.Dv u2
387are equivalent to
388.Dv ushort ,
389the type specifiers
390.Dv dI ,
391.Dv dL ,
392and
393.Dv d4
394are equivalent to
395.Dv long ,
396the type specifiers
397.Dv uI ,
398.Dv uL ,
399and
400.Dv u4
401are equivalent to
402.Dv ulong ,
403the type specifier
404.Dv d8
405is equivalent to
406.Dv quad ,
407the type specifier
408.Dv u8
409is equivalent to
410.Dv uquad ,
411and the type specifier
412.Dv s
413is equivalent to
414.Dv string .
415In addition, the type specifier
416.Dv dQ
417is equivalent to
418.Dv quad
419and the type specifier
420.Dv uQ
421is equivalent to
422.Dv uquad .
423.Pp
424Each top-level magic pattern (see below for an explanation of levels)
425is classified as text or binary according to the types used.
426Types
427.Dq regex
428and
429.Dq search
430are classified as text tests, unless non-printable characters are used
431in the pattern.
432All other tests are classified as binary.
433A top-level
434pattern is considered to be a test text when all its patterns are text
435patterns; otherwise, it is considered to be a binary pattern.
436When
437matching a file, binary patterns are tried first; if no match is
438found, and the file looks like text, then its encoding is determined
439and the text patterns are tried.
440.Pp
441The numeric types may optionally be followed by
442.Dv \*[Am]
443and a numeric value,
444to specify that the value is to be AND'ed with the
445numeric value before any comparisons are done.
446Prepending a
447.Dv u
448to the type indicates that ordered comparisons should be unsigned.
449.It Dv test
450The value to be compared with the value from the file.
451If the type is
452numeric, this value
453is specified in C form; if it is a string, it is specified as a C string
454with the usual escapes permitted (e.g. \en for new-line).
455.Pp
456Numeric values
457may be preceded by a character indicating the operation to be performed.
458It may be
459.Dv = ,
460to specify that the value from the file must equal the specified value,
461.Dv \*[Lt] ,
462to specify that the value from the file must be less than the specified
463value,
464.Dv \*[Gt] ,
465to specify that the value from the file must be greater than the specified
466value,
467.Dv \*[Am] ,
468to specify that the value from the file must have set all of the bits
469that are set in the specified value,
470.Dv ^ ,
471to specify that the value from the file must have clear any of the bits
472that are set in the specified value, or
473.Dv ~ ,
474the value specified after is negated before tested.
475.Dv x ,
476to specify that any value will match.
477If the character is omitted, it is assumed to be
478.Dv = .
479Operators
480.Dv \*[Am] ,
481.Dv ^ ,
482and
483.Dv ~
484don't work with floats and doubles.
485The operator
486.Dv !\&
487specifies that the line matches if the test does
488.Em not
489succeed.
490.Pp
491Numeric values are specified in C form; e.g.
492.Dv 13
493is decimal,
494.Dv 013
495is octal, and
496.Dv 0x13
497is hexadecimal.
498.Pp
499Numeric operations are not performed on date types, instead the numeric
500value is interpreted as an offset.
501.Pp
502For string values, the string from the
503file must match the specified string.
504The operators
505.Dv = ,
506.Dv \*[Lt]
507and
508.Dv \*[Gt]
509(but not
510.Dv \*[Am] )
511can be applied to strings.
512The length used for matching is that of the string argument
513in the magic file.
514This means that a line can match any non-empty string (usually used to
515then print the string), with
516.Em \*[Gt]\e0
517(because all non-empty strings are greater than the empty string).
518.Pp
519Dates are treated as numerical values in the respective internal
520representation.
521.Pp
522The special test
523.Em x
524always evaluates to true.
525.It Dv message
526The message to be printed if the comparison succeeds.
527If the string contains a
528.Xr printf 3
529format specification, the value from the file (with any specified masking
530performed) is printed using the message as the format string.
531If the string begins with
532.Dq \eb ,
533the message printed is the remainder of the string with no whitespace
534added before it: multiple matches are normally separated by a single
535space.
536.El
537.Pp
538An APPLE 4+4 character APPLE creator and type can be specified as:
539.Bd -literal -offset indent
540!:apple	CREATYPE
541.Ed
542.Pp
543A MIME type is given on a separate line, which must be the next
544non-blank or comment line after the magic line that identifies the
545file type, and has the following format:
546.Bd -literal -offset indent
547!:mime	MIMETYPE
548.Ed
549.Pp
550i.e. the literal string
551.Dq !:mime
552followed by the MIME type.
553.Pp
554An optional strength can be supplied on a separate line which refers to
555the current magic description using the following format:
556.Bd -literal -offset indent
557!:strength OP VALUE
558.Ed
559.Pp
560The operand
561.Dv OP
562can be:
563.Dv + ,
564.Dv - ,
565.Dv * ,
566or
567.Dv /
568and
569.Dv VALUE
570is a constant between 0 and 255.
571This constant is applied using the specified operand
572to the currently computed default magic strength.
573.Pp
574Some file formats contain additional information which is to be printed
575along with the file type or need additional tests to determine the true
576file type.
577These additional tests are introduced by one or more
578.Em \*[Gt]
579characters preceding the offset.
580The number of
581.Em \*[Gt]
582on the line indicates the level of the test; a line with no
583.Em \*[Gt]
584at the beginning is considered to be at level 0.
585Tests are arranged in a tree-like hierarchy:
586if the test on a line at level
587.Em n
588succeeds, all following tests at level
589.Em n+1
590are performed, and the messages printed if the tests succeed, until a line
591with level
592.Em n
593(or less) appears.
594For more complex files, one can use empty messages to get just the
595"if/then" effect, in the following way:
596.Bd -literal -offset indent
5970      string   MZ
598\*[Gt]0x18  leshort  \*[Lt]0x40   MS-DOS executable
599\*[Gt]0x18  leshort  \*[Gt]0x3f   extended PC executable (e.g., MS Windows)
600.Ed
601.Pp
602Offsets do not need to be constant, but can also be read from the file
603being examined.
604If the first character following the last
605.Em \*[Gt]
606is a
607.Em \&(
608then the string after the parenthesis is interpreted as an indirect offset.
609That means that the number after the parenthesis is used as an offset in
610the file.
611The value at that offset is read, and is used again as an offset
612in the file.
613Indirect offsets are of the form:
614.Em (( x [[.,][bBcCeEfFgGhHiIlmsSqQ]][+\-][ y ]) .
615The value of
616.Em x
617is used as an offset in the file.
618A byte, id3 length, short or long is read at that offset depending on the
619.Em [bBcCeEfFgGhHiIlmsSqQ]
620type specifier.
621The value is treated as signed if
622.Dq ,
623is specified or unsigned if
624.Dq .
625is specified.
626The capitalized types interpret the number as a big endian
627value, whereas the small letter versions interpret the number as a little
628endian value;
629the
630.Em m
631type interprets the number as a middle endian (PDP-11) value.
632To that number the value of
633.Em y
634is added and the result is used as an offset in the file.
635The default type if one is not specified is long.
636The following types are recognized:
637.Bl -column -offset indent "Type" "Half/Short" "Little" "Size"
638.It Sy Type	Sy Mnemonic	Sy Endian	Sy Size
639.It bcBc	Byte/Char	N/A	1
640.It efg	Double	Little	8
641.It EFG	Double	Big	8
642.It hs	Half/Short	Little	2
643.It HS	Half/Short	Big	2
644.It i	ID3	Little	4
645.It I	ID3	Big	4
646.It m	Middle	Middle	4
647.It q	Quad	Little	8
648.It Q	Quad	Big	8
649.El
650.Pp
651That way variable length structures can be examined:
652.Bd -literal -offset indent
653# MS Windows executables are also valid MS-DOS executables
6540           string  MZ
655\*[Gt]0x18       leshort \*[Lt]0x40   MZ executable (MS-DOS)
656# skip the whole block below if it is not an extended executable
657\*[Gt]0x18       leshort \*[Gt]0x3f
658\*[Gt]\*[Gt](0x3c.l)  string  PE\e0\e0  PE executable (MS-Windows)
659\*[Gt]\*[Gt](0x3c.l)  string  LX\e0\e0  LX executable (OS/2)
660.Ed
661.Pp
662This strategy of examining has a drawback: you must make sure that you
663eventually print something, or users may get empty output (such as when
664there is neither PE\e0\e0 nor LE\e0\e0 in the above example).
665.Pp
666If this indirect offset cannot be used directly, simple calculations are
667possible: appending
668.Em [+-*/%\*[Am]|^]number
669inside parentheses allows one to modify
670the value read from the file before it is used as an offset:
671.Bd -literal -offset indent
672# MS Windows executables are also valid MS-DOS executables
6730           string  MZ
674# sometimes, the value at 0x18 is less that 0x40 but there's still an
675# extended executable, simply appended to the file
676\*[Gt]0x18       leshort \*[Lt]0x40
677\*[Gt]\*[Gt](4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
678\*[Gt]\*[Gt](4.s*512) leshort !0x014c MZ executable (MS-DOS)
679.Ed
680.Pp
681Sometimes you do not know the exact offset as this depends on the length or
682position (when indirection was used before) of preceding fields.
683You can specify an offset relative to the end of the last up-level
684field using
685.Sq \*[Am]
686as a prefix to the offset:
687.Bd -literal -offset indent
6880           string  MZ
689\*[Gt]0x18       leshort \*[Gt]0x3f
690\*[Gt]\*[Gt](0x3c.l)  string  PE\e0\e0    PE executable (MS-Windows)
691# immediately following the PE signature is the CPU type
692\*[Gt]\*[Gt]\*[Gt]\*[Am]0       leshort 0x14c     for Intel 80386
693\*[Gt]\*[Gt]\*[Gt]\*[Am]0       leshort 0x184     for DEC Alpha
694.Ed
695.Pp
696Indirect and relative offsets can be combined:
697.Bd -literal -offset indent
6980             string  MZ
699\*[Gt]0x18         leshort \*[Lt]0x40
700\*[Gt]\*[Gt](4.s*512)   leshort !0x014c MZ executable (MS-DOS)
701# if it's not COFF, go back 512 bytes and add the offset taken
702# from byte 2/3, which is yet another way of finding the start
703# of the extended executable
704\*[Gt]\*[Gt]\*[Gt]\*[Am](2.s-514) string  LE      LE executable (MS Windows VxD driver)
705.Ed
706.Pp
707Or the other way around:
708.Bd -literal -offset indent
7090                 string  MZ
710\*[Gt]0x18             leshort \*[Gt]0x3f
711\*[Gt]\*[Gt](0x3c.l)        string  LE\e0\e0  LE executable (MS-Windows)
712# at offset 0x80 (-4, since relative offsets start at the end
713# of the up-level match) inside the LE header, we find the absolute
714# offset to the code area, where we look for a specific signature
715\*[Gt]\*[Gt]\*[Gt](\*[Am]0x7c.l+0x26) string  UPX     \eb, UPX compressed
716.Ed
717.Pp
718Or even both!
719.Bd -literal -offset indent
7200                string  MZ
721\*[Gt]0x18            leshort \*[Gt]0x3f
722\*[Gt]\*[Gt](0x3c.l)       string  LE\e0\e0 LE executable (MS-Windows)
723# at offset 0x58 inside the LE header, we find the relative offset
724# to a data area where we look for a specific signature
725\*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3)  string  UNACE  \eb, ACE self-extracting archive
726.Ed
727.Pp
728If you have to deal with offset/length pairs in your file, even the
729second value in a parenthesized expression can be taken from the file itself,
730using another set of parentheses.
731Note that this additional indirect offset is always relative to the
732start of the main indirect offset.
733.Bd -literal -offset indent
7340                 string       MZ
735\*[Gt]0x18             leshort      \*[Gt]0x3f
736\*[Gt]\*[Gt](0x3c.l)        string       PE\e0\e0 PE executable (MS-Windows)
737# search for the PE section called ".idata"...
738\*[Gt]\*[Gt]\*[Gt]\*[Am]0xf4          search/0x140 .idata
739# ...and go to the end of it, calculated from start+length;
740# these are located 14 and 10 bytes after the section name
741\*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP self-extracting archive
742.Ed
743.Pp
744If you have a list of known values at a particular continuation level,
745and you want to provide a switch-like default case:
746.Bd -literal -offset indent
747# clear that continuation level match
748\*[Gt]18	clear
749\*[Gt]18	lelong	1	one
750\*[Gt]18	lelong	2	two
751\*[Gt]18	default	x
752# print default match
753\*[Gt]\*[Gt]18	lelong	x	unmatched 0x%x
754.Ed
755.Sh SEE ALSO
756.Xr file 1
757\- the command that reads this file.
758.Sh BUGS
759The formats
760.Dv long ,
761.Dv belong ,
762.Dv lelong ,
763.Dv melong ,
764.Dv short ,
765.Dv beshort ,
766and
767.Dv leshort
768do not depend on the length of the C data types
769.Dv short
770and
771.Dv long
772on the platform, even though the Single
773.Ux
774Specification implies that they do.  However, as OS X Mountain Lion has
775passed the Single
776.Ux
777Specification validation suite, and supplies a version of
778.Xr file 1
779in which they do not depend on the sizes of the C data types and that is
780built for a 64-bit environment in which
781.Dv long
782is 8 bytes rather than 4 bytes, presumably the validation suite does not
783test whether, for example
784.Dv long
785refers to an item with the same size as the C data type
786.Dv long .
787There should probably be
788.Dv type
789names
790.Dv int8 ,
791.Dv uint8 ,
792.Dv int16 ,
793.Dv uint16 ,
794.Dv int32 ,
795.Dv uint32 ,
796.Dv int64 ,
797and
798.Dv uint64 ,
799and specified-byte-order variants of them,
800to make it clearer that those types have specified widths.
801.\"
802.\" From: guy@sun.uucp (Guy Harris)
803.\" Newsgroups: net.bugs.usg
804.\" Subject: /etc/magic's format isn't well documented
805.\" Message-ID: <2752@sun.uucp>
806.\" Date: 3 Sep 85 08:19:07 GMT
807.\" Organization: Sun Microsystems, Inc.
808.\" Lines: 136
809.\"
810.\" Here's a manual page for the format accepted by the "file" made by adding
811.\" the changes I posted to the S5R2 version.
812.\"
813.\" Modified for Ian Darwin's version of the file command.
814