1 .TH MAGIC 4 "Public Domain"
3 .\" Translated Wed Jan 12 23:14:34 JST 2000
4 .\" by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
5 .\" Updated & Modified Sun Jan 14 22:02:13 JST 2001
6 .\" by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
7 .\" Updated & Modified Sun May 25 17:08:32 JST 2003
8 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
10 .\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
13 .\"O magic \- file command's magic number file
14 magic \- file ¥³¥Þ¥ó¥ÉÍѤΥޥ¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¥Õ¥¡¥¤¥ë
17 .\"O This manual page documents the format of the magic file as
20 .\"O command, version 4.12.
21 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï¡¢
23 ¥³¥Þ¥ó¥É (¥Ð¡¼¥¸¥ç¥ó 4.12) ¤¬»ÈÍѤ¹¤ë magic ¥Õ¥¡¥¤¥ë¤Î½ñ¼°¤òÀâÌÀ¤¹¤ë¡£
26 .\"O command identifies the type of a file using,
27 .\"O among other tests,
28 .\"O a test for whether the file begins with a certain
29 .\"O .IR "magic number" .
30 ¥Õ¥¡¥¤¥ë¤Î¼ïÎà¤òÄ´¤Ù¤ëÊýË¡¤Ï¿§¡¹¤¢¤ë¤¬¡¢
32 ¥³¥Þ¥ó¥É¤Ï¥Õ¥¡¥¤¥ë¤¬ÆÃÄê¤Î
33 \fI¡Ö¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼ (magic number)¡×\fR
34 ¤Ç»Ï¤Þ¤ë¤«¤É¤¦¤«¤Ë¤è¤Ã¤Æ¥Õ¥¡¥¤¥ë¤Î¼ïÎà¤ò¼±Ê̤¹¤ë¡£
36 .\"O .I /usr/share/file/magic
37 .\"O specifies what magic numbers are to be tested for,
38 .\"O what message to print if a particular magic number is found,
39 .\"O and additional information to extract from the file.
41 .I /usr/share/file/magic
42 ¤Ç»ØÄꤹ¤ë¤³¤È¤Ï¡¢Ä´¤Ù¤ë¤Ù¤¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¡¢
43 ÆÃÄê¤Î¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¤¬¸«¤Ä¤«¤Ã¤¿»þ¤Ëɽ¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸¡¢
44 ¥Õ¥¡¥¤¥ë¤«¤é¼è¤ê½Ð¤»¤ë¤½¤Î¾¤Î¾ðÊó¤Ç¤¢¤ë¡£
46 .\"O Each line of the file specifies a test to be performed.
47 magic ¥Õ¥¡¥¤¥ë¤Î³Æ¹Ô¤Ç¤Ï¼Â¹Ô¤¹¤ë¥Æ¥¹¥È¤ò»ØÄꤹ¤ë¡£
48 .\"O A test compares the data starting at a particular offset
49 .\"O in the file with a 1-byte, 2-byte, or 4-byte numeric value or
51 .\"O If the test succeeds, a message is printed.
52 ¥Æ¥¹¥È¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ëÀèƬ¤«¤é¸«¤ÆÆÃÄê¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃ֤ˤ¢¤ë¥Ç¡¼¥¿¤È¡¢
53 1 ¥Ð¥¤¥È¤Þ¤¿¤Ï 2 ¥Ð¥¤¥È¡¢4 ¥Ð¥¤¥È¤Î¿ôÃͤäʸ»úÎó¤È¤ÎÈæ³Ó¤¬¹Ô¤ï¤ì¤ë¡£
54 ¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤È»ØÄꤷ¤¿¥á¥Ã¥»¡¼¥¸¤¬½ÐÎϤµ¤ì¤ë¡£
55 .\"O The line consists of the following fields:
56 ¹Ô¤Ë¤Ï°Ê²¼¤Î¹àÌܤ¬´Þ¤Þ¤ì¤ë:
57 .IP offset \w'message'u+2n
58 .\"O A number specifying the offset, in bytes, into the file of the data
59 .\"O which is to be tested.
60 Ä´¤Ù¤ë¥Ç¡¼¥¿¤Î¥Õ¥¡¥¤¥ëÆâ¤Ç¤Î°ÌÃÖ¤ò»ØÄꤹ¤ë¥ª¥Õ¥»¥Ã¥ÈÃͤǡ¢Ã±°Ì¤Ï¥Ð¥¤¥È¤Ç¤¢¤ë¡£
62 .\"O The type of the data to be tested.
63 .\"O The possible values are:
64 Ä´¤Ù¤ë¥Ç¡¼¥¿¤Î·¿¡£»ØÄê¤Ç¤¤ëÃͤϰʲ¼¤ÎÄ̤ê¤Ç¤¢¤ë:
66 .IP byte \w'message'u+2n
67 .\"O A one-byte value.
70 .\"O A two-byte value (on most systems) in this machine's native byte order.
71 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Þ¥·¥ó¤Î¥Í¥¤¥Æ¥£¥Ö¤Î¥Ð¥¤¥È½ç¤Ç¤¢¤ë¡£
73 .\"O A four-byte value (on most systems) in this machine's native byte order.
74 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Þ¥·¥ó¤Î¥Í¥¤¥Æ¥£¥Ö¤Î¥Ð¥¤¥È½ç¤Ç¤¢¤ë¡£
76 .\"O A string of bytes.
77 ʸ»úÎó¤òɽ¤¹¥Ð¥¤¥ÈÎó¡£
78 .\"O The string type specification can be optionally followed
80 string ·¿¤Î»ØÄê¤Ç¤Ï¡¢¥ª¥×¥·¥ç¥ó¤È¤·¤Æ /[Bbc]* ¤ò¸å¤í¤Ë³¤±¤ë¤³¤È¤¬¤Ç¤¤ë¡£
81 .\"O The ``B'' flag compacts whitespace in the target, which must
82 .\"O contain at least one whitespace character.
83 ``B'' ¥Õ¥é¥°¤Ï¡¢Âоݥե¡¥¤¥ëÃæ¤ÎÊ£¿ô¸Ä¤Î¶õÇò¤ò 1 ¸Ä¤Î¶õÇò¤ËÀÚ¤êµÍ¤á¤Æ°·¤¦¡£
84 ¤³¤Î¾ì¹ç¡¢Âоݥե¡¥¤¥ë¤Ï¾¯¤Ê¤¯¤È¤â 1 ¸Ä¤Î¶õÇò¤ò´Þ¤ó¤Ç¤¤¤ëɬÍפ¬¤¢¤ë¡£
87 .\"O consecutive blanks, the target needs at least
89 .\"O consecutive blanks to match.
92 ¸Ä¤ÎϢ³¤·¤¿¶õÇò¤¬¤¢¤ë¾ì¹ç¡¢
93 Âоݥե¡¥¤¥ë¤Ë¤Ï¡¢¤³¤ì¤Ë¥Þ¥Ã¥Á¤¹¤ë
95 ¸Ä¤ÎϢ³¤·¤¿¶õÇò¤¬É¬ÍפȤʤ롣
96 .\"O The ``b'' flag treats every blank in the target as an optional blank.
97 ``b''¥Õ¥é¥°¤Ï¡¢Âоݥե¡¥¤¥ëÃæ¤Î¶õÇò¤ò
98 ¸ºß¤·¤Æ¤â¤·¤Ê¤¯¤Æ¤â¤è¤¤¶õÇò¤È¤·¤Æ°·¤¦¡£
99 .\"O Finally the ``c'' flag, specifies case insensitive matching: lowercase
100 .\"O characters in the magic match both lower and upper case characters in the
101 .\"O targer, whereas upper case characters in the magic, only much uppercase
102 .\"O characters in the target.
103 ¤µ¤é¤Ë¡¢``c'' ¥Õ¥é¥°¤Ï¡¢Âçʸ»ú¡¦¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤¥Þ¥Ã¥Á¤ò¹Ô¤¦¤³¤È¤ò»ØÄꤹ¤ë:
104 magic ¥Õ¥¡¥¤¥ëÃæ¤Î¾®Ê¸»ú¤Ï¡¢
105 Âоݥե¡¥¤¥ëÃæ¤ÎÂçʸ»ú¡¦¾®Ê¸»ú¤ÎξÊý¤Ë¥Þ¥Ã¥Á¤¹¤ë¡£
106 ¤·¤«¤·¡¢magic ¥Õ¥¡¥¤¥ëÃæ¤ÎÂçʸ»ú¤Ï¡¢
107 Âоݥե¡¥¤¥ëÃæ¤ÎÂçʸ»ú¤Ë¤Î¤ß¥Þ¥Ã¥Á¤¹¤ë¡£
109 .\"O A four-byte value interpreted as a UNIX date.
110 UNIX »þ¹ï¤È²ò¼á¤µ¤ì¤ë 4 ¥Ð¥¤¥ÈÃÍ¡£
112 .\"O A four-byte value interpreted as a UNIX-style date, but interpreted as
113 .\"O local time rather than UTC.
114 UNIX ·Á¼°¤Î»þ¹ï¤È²ò¼á¤µ¤ì¤ë 4 ¥Ð¥¤¥ÈÃÍ¡£
115 ¤¿¤À¤· UTC ¤Ç¤Ï¤Ê¤¯¥í¡¼¥«¥ë¥¿¥¤¥à¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
117 .\"O A two-byte value (on most systems) in big-endian byte order.
118 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
120 .\"O A four-byte value (on most systems) in big-endian byte order.
121 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
123 .\"O A four-byte value (on most systems) in big-endian byte order,
124 .\"O interpreted as a Unix date.
125 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
126 UNIX »þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
128 .\"O A two-byte value (on most systems) in little-endian byte order.
129 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
131 .\"O A four-byte value (on most systems) in little-endian byte order.
132 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
134 .\"O A four-byte value (on most systems) in little-endian byte order,
135 .\"O interpreted as a UNIX date.
136 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
137 UNIX »þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
139 .\"O A four-byte value (on most systems) in little-endian byte order,
140 .\"O interpreted as a UNIX-style date, but interpreted as local time rather
142 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
143 UNIX ·Á¼°¤Î»þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
144 ¤¿¤À¤· UTC ¤Ç¤Ï¤Ê¤¯¥í¡¼¥«¥ë¥¿¥¤¥à¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
147 .\"O The numeric types may optionally be followed by
149 .\"O and a numeric value,
150 .\"O to specify that the value is to be AND'ed with the
151 .\"O numeric value before any comparisons are done.
154 .\"O to the type indicates that ordered comparisons should be unsigned.
157 ¤È¿ôÃͤò½ñ¤¯¤³¤È¤¬¤Ç¤¤ë¡£¤³¤Î¾ì¹ç¡¢Èæ³Ó¤ò¹Ô¤¦Á°¤Ë
159 ¤Î¸å¤ËÃÖ¤¤¤¿¿ôÃͤȤΠAND ±é»»¤¬¹Ô¤ï¤ì¤ë¡£·¿¤ÎÁ°¤Ë
161 ¤òÃÖ¤¯¤³¤È¤Ç¡¢½ç½øÉÕ¤¤ÎÈæ³Ó¤òÉä¹æ̵¤·¤Ç¹Ô¤¦¤³¤È¤¬»ØÄê¤Ç¤¤ë¡£
163 .\"O The value to be compared with the value from the file.
165 .\"O numeric, this value
166 .\"O is specified in C form; if it is a string, it is specified as a C string
167 .\"O with the usual escapes permitted (e.g. \en for new-line).
168 ¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤÈÈæ³Ó¤¹¤ëÃÍ¡£
169 ¤³¤ì¤Ï C ¸À¸ì¤Îʸ»úÎó¤È¤·¤Æ»ØÄꤷ¡¢¥¨¥¹¥±¡¼¥×ʸ»ú¤âÉáÄ̤˻Ȥ¨¤ë
170 (Îã: \en ¤Ï²þ¹Ôʸ»ú)¡£
173 .\"O may be preceded by a character indicating the operation to be performed.
175 ¤ÎÁ°¤Ë¤Ï¡¢¼Â¹Ô¤¹¤ëÆ°ºî¤ò»ØÄꤹ¤ëʸ»ú¤òÃÖ¤¯¤³¤È¤¬¤Ç¤¤ë¡£
178 .\"O to specify that the value from the file must equal the specified value,
180 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿ÃͤÈÅù¤·¤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
182 .\"O to specify that the value from the file must be less than the specified
185 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿Ãͤè¤ê¾®¤µ¤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
187 .\"O to specify that the value from the file must be greater than the specified
190 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿Ãͤè¤êÂ礤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
192 .\"O to specify that the value from the file must have set all of the bits
193 .\"O that are set in the specified value,
195 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢»ØÄꤷ¤¿ÃͤÇΩ¤Ã¤Æ¤¤¤ëÁ´¤Æ¤Î¥Ó¥Ã¥È¤¬¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤǤâ
196 Ω¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
198 .\"O to specify that the value from the file must have clear any of the bits
199 .\"O that are set in the specified value, or
201 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢»ØÄꤷ¤¿ÃͤÇΩ¤Ã¤Æ¤¤¤ë¤É¤Î¥Ó¥Ã¥È¤â¡¢
202 ¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤÇΩ¤Ã¤Æ¤¤¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
204 .\"O to specify that any value will match.
206 ¤Ï¤É¤ó¤ÊÃͤˤâ¥Þ¥Ã¥Á¤¹¤ë¡£Ê¸»ú¤¬¾Êά¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
207 .\"O If the character is omitted, it is assumed to be
210 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¤ß¤Ê¤µ¤ì¤ë¡£
212 .\"O Numeric values are specified in C form; e.g.
219 ¿ôÃÍ¤Ï C ¸À¸ì¤Î½ñ¼°¤Ç»ØÄꤹ¤ë¡£Î㤨¤Ð¡¢
227 .\"O For string values, the byte string from the
228 .\"O file must match the specified byte string.
229 ʸ»úÎó¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ëÃæ¤Ë´Þ¤Þ¤ì¤ë¥Ð¥¤¥Èʸ»úÎó¤Ï¡¢»ØÄꤵ¤ì¤¿
230 ¥Ð¥¤¥Èʸ»úÎó¤Ë¥Þ¥Ã¥Á¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
238 .\"O can be applied to strings.
243 ¤Ïʸ»úÎó¤Ë¤âŬÍѤǤ¤ë (¤¿¤À¤·
246 .\"O The length used for matching is that of the string argument
247 .\"O in the magic file.
248 .\"O This means that a line can match any string, and
249 .\"O then presumably print that string, by doing
251 .\"O (because all strings are greater than the null string).
252 ¥Þ¥Ã¥Á¥ó¥°¤ò¹Ô¤¦Ä¹¤µ¤Ï¡¢magic ¥Õ¥¡¥¤¥ë¤Îʸ»úÎó°ú¿ô¤ÎŤµ¤Ç¤¢¤ë¡£
255 ¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤ê¡¢¤¢¤ë¹Ô¤ò¤É¤ó¤Êʸ»úÎó¤Ë¤â¥Þ¥Ã¥Á¤µ¤»¡¢¤½¤·¤Æ¿ʬ
256 ¤½¤Îʸ»úÎó¤òɽ¼¨¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤ë¤À¤í¤¦¡£
258 .\"O The message to be printed if the comparison succeeds. If the string
261 .\"O format specification, the value from the file (with any specified masking
262 .\"O performed) is printed using the message as the format string.
263 Èæ³Ó¤¬À®¸ù¤·¤¿¤È¤¤Ë½ÐÎϤµ¤ì¤ë¥á¥Ã¥»¡¼¥¸¡£
266 ¤Î½ñ¼°»ØÄ꤬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¤³¤Î¥á¥Ã¥»¡¼¥¸¤ò½ñ¼°»ØÄêʸ»úÎó¤È¤·¤Æ»È¤Ã¤Æ
267 ¥Õ¥¡¥¤¥ëÆâ¤ÎÃÍ (»ØÄꤵ¤ì¤¿Á´¤Æ¤Î¥Þ¥¹¥¯½èÍý¤Ï¼Â¹Ô¤µ¤ì¤ë) ¤¬½ÐÎϤµ¤ì¤ë¡£
269 .\"O Some file formats contain additional information which is to be printed
270 .\"O along with the file type.
271 °ìÉô¤Î¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î¼ïÎà¤È¤È¤â¤ËÄɲþðÊó¤¬É½¼¨¤µ¤ì¤ë¡£
272 .\"O A line which begins with the character
274 .\"O indicates additional tests and messages to be printed.
277 ¤Ç»Ï¤Þ¤ë¹Ô¤Ï¡¢ÄɲäǹԤ¦¥Æ¥¹¥È¤Èɽ¼¨¥á¥Ã¥»¡¼¥¸¤ò¼¨¤¹¡£
280 .\"O on the line indicates the level of the test; a line with no
282 .\"O at the beginning is considered to be at level 0.
285 ¤Î¿ô¤Ï¥Æ¥¹¥È¤Î¥ì¥Ù¥ë¤òɽ¤¹¡£
288 ¤¬¤Ê¤¤¹Ô¤Ï¥ì¥Ù¥ë 0 ¤Ë¤Ê¤ë¡£
289 .\"O Each line at level
291 .\"O is under the control of the line at level
293 .\"O most closely preceding it in the magic file.
296 ¤Î³Æ¹Ô¤Ï¡¢magic ¥Õ¥¡¥¤¥ëÃæ¤Ç¼«Ê¬¤è¤êÁ°¤Ë¤¢¤ë¥ì¥Ù¥ë
298 ¤Î¹Ô¤Î¤¦¤Á¡¢ºÇ¤â¶á¤¤°ÌÃ֤Τâ¤Î¤ÎÀ©¸æ¤Ë½¾¤¦¡£
299 .\"O If the test on a line at level
301 .\"O succeeds, the tests specified in all the subsequent lines at level
303 .\"O are performed, and the messages printed if the tests succeed.
306 ¤Î¹Ô¤Î¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¯Á´¤Æ¤Î¥ì¥Ù¥ë
308 ¤Î¹Ô¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¤¬¼Â¹Ô¤µ¤ì¡¢
309 ¤½¤Î¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤È¥á¥Ã¥»¡¼¥¸¤¬½ÐÎϤµ¤ì¤ë¡£
310 .\"O The next line at level
312 .\"O terminates this.
315 ¤¬¤¢¤Ã¤¿¾ì½ê¤Ç¤³¤ÎÆ°ºî¤Ï½ªÎ»¤¹¤ë¡£
316 .\"O If the first character following the last
320 .\"O then the string after the parenthesis is interpreted as an indirect offset.
325 ¤Ê¤é¤Ð¡¢³ç¸Ì¤Î¸å¤Îʸ»úÎó¤Ï´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤȲò¼á¤µ¤ì¤ë¡£
326 .\"O That means that the number after the parenthesis is used as an offset in
328 ¤Ä¤Þ¤ê¡¢³ç¸Ì¤Î¸å¤Î¿ô»ú¤Ï¥Õ¥¡¥¤¥ëÆâ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤È¤·¤Æ»È¤ï¤ì¤ë¡£
329 .\"O The value at that offset is read, and is used again as an offset
331 ¤³¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃ֤ˤ¢¤ëÃͤ¬Æɤ߹þ¤Þ¤ì¡¢
332 Æɤ߹þ¤Þ¤ì¤¿Ãͤ¬¥Õ¥¡¥¤¥ëÃæ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤È¤·¤Æ»È¤ï¤ì¤ë¡£
333 .\"O Indirect offsets are of the form:
334 .\"O .BI (( x [.[bslBSL]][+\-][ y ]).
335 ´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤνñ¼°¤Ï°Ê²¼¤Ç¤¢¤ë:
336 .BI (( x [.[bslBSL]][+\-][ y ]).
339 .\"O is used as an offset in the file. A byte, short or long is read at that offset
340 .\"O depending on the
344 ¤ÎÃͤϥե¡¥¤¥ëÆâ¤Ç¤Î¥ª¥Õ¥»¥Ã¥ÈÃͤȤ·¤Æ»È¤ï¤ì¤ë¡£
345 ¤½¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃ֤ˤ¢¤ë byte ·¿¡¢short ·¿¡¢long ·¿¤ÎÃͤ¬Æɤ߹þ¤Þ¤ì¤ë¤¬¡¢
346 ¤É¤Î·¿¤Ë¤Ê¤ë¤«¤Ï·¿»ØÄê»Ò
349 .\"O The capitalized types interpret the number as a big endian
350 .\"O value, whereas the small letter versions interpret the number as a little
352 Âçʸ»ú¤Ç¼¨¤µ¤ì¤ë·¿¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤ÎÃͤȲò¼á¤µ¤ì¡¢
353 ¾®Ê¸»ú¤Ç¼¨¤µ¤ì¤ë·¿¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤ÎÃͤȲò¼á¤µ¤ì¤ë¡£
354 .\"O To that number the value of
356 .\"O is added and the result is used as an offset in the file.
359 ¤ÎÃͤ˲䨤é¤ì¡¢¤½¤Î·ë²Ì¤¬¥Õ¥¡¥¤¥ëÃæ¤Î¥ª¥Õ¥»¥Ã¥ÈÃͤȤ·¤Æ»È¤ï¤ì¤ë¡£
360 .\"O The default type if one is not specified is long.
361 ²¿¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¤Î·¿¤Ï long ¤Ç¤¢¤ë¡£
363 .\"O Sometimes you do not know the exact offset as this depends on the length of
364 .\"O preceding fields.
365 Á°¤Î¥Õ¥£¡¼¥ë¥É¤ÎŤµ¤Ë¤è¤Ã¤Æ¥ª¥Õ¥»¥Ã¥ÈÃͤ¬ÊѤï¤ë¤¿¤á¡¢
366 Àµ³Î¤Ê¥ª¥Õ¥»¥Ã¥ÈÃͤ¬¤ï¤«¤é¤Ê¤¤¾ì¹ç¤â¤¢¤ë¡£
367 .\"O You can specify an offset relative to the end of the
368 .\"O last uplevel field (of course this may only be done for sublevel tests, i.e.
369 .\"O test beginning with
372 ¤³¤Î¾ì¹ç¤Ï¡¢Ä¾Á°¤Î¾å°Ì¥ì¥Ù¥ë¤Î
373 ¥Õ¥£¡¼¥ë¥É¤Î½ª¤ï¤ê¤«¤é¤ÎÁêÂаÌÃ֤ǥª¥Õ¥»¥Ã¥È¤ò»ØÄê¤Ç¤¤ë
374 (ÅöÁ³¤Ê¤¬¤é¤³¤ÎÊýË¡¤Ï¥µ¥Ö¥ì¥Ù¥ë¤Î¥Æ¥¹¥È¡¢¤Ä¤Þ¤ê
376 ¤Ç»Ï¤Þ¤ë¥Æ¥¹¥È¤Ç¤·¤«»È¤¨¤Ê¤¤)¡£
377 .\"O Such a relative offset is specified using
379 .\"O as a prefix to the offset.
380 ¤³¤Î¤è¤¦¤ÊÁêÂÐ¥ª¥Õ¥»¥Ã¥ÈÃͤϡ¢¥ª¥Õ¥»¥Ã¥ÈÃͤÎÁ°¤Ë
382 ¤òÃÖ¤¯¤³¤È¤Ç»ØÄꤹ¤ë¡£
396 .\"O are system-dependent; perhaps they should be specified as a number
397 .\"O of bytes (2B, 4B, etc),
398 .\"O since the files being recognized typically come from
399 .\"O a system on which the lengths are invariant.
409 ¤Î½ñ¼°¤Ï¥·¥¹¥Æ¥à°Í¸¤Ç¤¢¤ë¡£¼±Ê̤µ¤»¤ë¥Õ¥¡¥¤¥ë¤Ï¡¢
410 ¤³¤ÎŤµ¤¬°ã¤¦¥·¥¹¥Æ¥à¤«¤é»ý¤Ã¤Æ¤¯¤ë¤³¤È¤¬Â¿¤¤¤¿¤á¡¢
411 ¥Ð¥¤¥ÈÎó¤È¤·¤Æ»ØÄꤹ¤Ù¤¤À¤í¤¦ (2B, 4B Åù)¡£
413 .\"O There is (currently) no support for specified-endian data to be used in
414 .\"O indirect offsets.
415 (¸½»þÅÀ¤Ç¤Ï) ´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤǥ¨¥ó¥Ç¥£¥¢¥ó¤ò»ØÄꤷ¤Æ
416 ¥Ç¡¼¥¿¤ò°·¤¦¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£
420 .\"O \- the command that reads this file.
421 \- ¤³¤Î¥Õ¥¡¥¤¥ë¤òÆɤॳ¥Þ¥ó¥É¡£
423 .\" From: guy@sun.uucp (Guy Harris)
424 .\" Newsgroups: net.bugs.usg
425 .\" Subject: /etc/magic's format isn't well documented
426 .\" Message-ID: <2752@sun.uucp>
427 .\" Date: 3 Sep 85 08:19:07 GMT
428 .\" Organization: Sun Microsystems, Inc.
431 .\" Here's a manual page for the format accepted by the "file" made by adding
432 .\" the changes I posted to the S5R2 version.
434 .\" Modified for Ian Darwin's version of the file command.
435 .\" @(#)$Id: magic.man,v 1.27 2003/09/12 19:43:30 christos Exp $