OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / file / draft / man4 / magic.4
1 .TH MAGIC 4 "Public Domain"
2 .\"
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>
9 .\"
10 .\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
11 .\"O .SH NAME
12 .SH Ì¾Á°
13 .\"O magic \- file command's magic number file
14 magic \- file ¥³¥Þ¥ó¥ÉÍѤΥޥ¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¥Õ¥¡¥¤¥ë
15 .\"O .SH DESCRIPTION
16 .SH ÀâÌÀ
17 .\"O This manual page documents the format of the magic file as
18 .\"O used by the
19 .\"O .BR file (1)
20 .\"O command, version 4.12.
21 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï¡¢
22 .BR file (1)
23 ¥³¥Þ¥ó¥É (¥Ð¡¼¥¸¥ç¥ó 4.12) ¤¬»ÈÍѤ¹¤ë magic ¥Õ¥¡¥¤¥ë¤Î½ñ¼°¤òÀâÌÀ¤¹¤ë¡£
24 .\"O The
25 .\"O .BR file
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 ¥Õ¥¡¥¤¥ë¤Î¼ïÎà¤òÄ´¤Ù¤ëÊýË¡¤Ï¿§¡¹¤¢¤ë¤¬¡¢
31 .B file
32 ¥³¥Þ¥ó¥É¤Ï¥Õ¥¡¥¤¥ë¤¬ÆÃÄê¤Î
33 \fI¡Ö¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼ (magic number)¡×\fR
34 ¤Ç»Ï¤Þ¤ë¤«¤É¤¦¤«¤Ë¤è¤Ã¤Æ¥Õ¥¡¥¤¥ë¤Î¼ïÎà¤ò¼±Ê̤¹¤ë¡£
35 .\"O The file
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.
40 ¥Õ¥¡¥¤¥ë
41 .I /usr/share/file/magic
42 ¤Ç»ØÄꤹ¤ë¤³¤È¤Ï¡¢Ä´¤Ù¤ë¤Ù¤­¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¡¢
43 ÆÃÄê¤Î¥Þ¥¸¥Ã¥¯¥Ê¥ó¥Ð¡¼¤¬¸«¤Ä¤«¤Ã¤¿»þ¤Ëɽ¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸¡¢
44 ¥Õ¥¡¥¤¥ë¤«¤é¼è¤ê½Ð¤»¤ë¤½¤Î¾¤Î¾ðÊó¤Ç¤¢¤ë¡£
45 .PP
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
50 .\"O a string.
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 Ä´¤Ù¤ë¥Ç¡¼¥¿¤Î¥Õ¥¡¥¤¥ëÆâ¤Ç¤Î°ÌÃÖ¤ò»ØÄꤹ¤ë¥ª¥Õ¥»¥Ã¥ÈÃͤǡ¢Ã±°Ì¤Ï¥Ð¥¤¥È¤Ç¤¢¤ë¡£
61 .IP type
62 .\"O The type of the data to be tested.
63 .\"O The possible values are:
64 Ä´¤Ù¤ë¥Ç¡¼¥¿¤Î·¿¡£»ØÄê¤Ç¤­¤ëÃͤϰʲ¼¤ÎÄ̤ê¤Ç¤¢¤ë:
65 .RS
66 .IP byte \w'message'u+2n
67 .\"O A one-byte value.
68 1 ¥Ð¥¤¥ÈÃÍ¡£
69 .IP short
70 .\"O A two-byte value (on most systems) in this machine's native byte order.
71 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Þ¥·¥ó¤Î¥Í¥¤¥Æ¥£¥Ö¤Î¥Ð¥¤¥È½ç¤Ç¤¢¤ë¡£
72 .IP long
73 .\"O A four-byte value (on most systems) in this machine's native byte order.
74 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Þ¥·¥ó¤Î¥Í¥¤¥Æ¥£¥Ö¤Î¥Ð¥¤¥È½ç¤Ç¤¢¤ë¡£
75 .IP string
76 .\"O A string of bytes.
77 ʸ»úÎó¤òɽ¤¹¥Ð¥¤¥ÈÎó¡£
78 .\"O The string type specification can be optionally followed
79 .\"O by /[Bbc]*.
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 ¸Ä¤Î¶õÇò¤ò´Þ¤ó¤Ç¤¤¤ëɬÍפ¬¤¢¤ë¡£
85 .\"O If the magic has
86 .\"O .I n
87 .\"O consecutive blanks, the target needs at least
88 .\"O .I n
89 .\"O consecutive blanks to match.
90 magic ¥Õ¥¡¥¤¥ë¤Ë
91 .I n
92 ¸Ä¤ÎϢ³¤·¤¿¶õÇò¤¬¤¢¤ë¾ì¹ç¡¢
93 Âоݥե¡¥¤¥ë¤Ë¤Ï¡¢¤³¤ì¤Ë¥Þ¥Ã¥Á¤¹¤ë
94 .I n
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 Âоݥե¡¥¤¥ëÃæ¤ÎÂçʸ»ú¤Ë¤Î¤ß¥Þ¥Ã¥Á¤¹¤ë¡£
108 .IP date
109 .\"O A four-byte value interpreted as a UNIX date.
110 UNIX »þ¹ï¤È²ò¼á¤µ¤ì¤ë 4 ¥Ð¥¤¥ÈÃÍ¡£
111 .IP ldate
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 ¤Ç¤Ï¤Ê¤¯¥í¡¼¥«¥ë¥¿¥¤¥à¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
116 .IP beshort
117 .\"O A two-byte value (on most systems) in big-endian byte order.
118 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
119 .IP belong
120 .\"O A four-byte value (on most systems) in big-endian byte order.
121 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
122 .IP bedate
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 »þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
127 .IP leshort
128 .\"O A two-byte value (on most systems) in little-endian byte order.
129 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 2 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
130 .IP lelong
131 .\"O A four-byte value (on most systems) in little-endian byte order.
132 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
133 .IP ledate
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 »þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
138 .IP leldate
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
141 .\"O than UTC.
142 (¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï) 4 ¥Ð¥¤¥ÈÃÍ¡£¥Ð¥¤¥È½ç¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
143 UNIX ·Á¼°¤Î»þ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
144 ¤¿¤À¤· UTC ¤Ç¤Ï¤Ê¤¯¥í¡¼¥«¥ë¥¿¥¤¥à¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
145 .RE
146 .PP
147 .\"O The numeric types may optionally be followed by
148 .\"O .B &
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.
152 .\"O Prepending a
153 .\"O .B u
154 .\"O to the type indicates that ordered comparisons should be unsigned.
155 ¿ôÃÍ·¿¤ÎÃͤθå¤Ë¤Ï
156 .B &
157 ¤È¿ôÃͤò½ñ¤¯¤³¤È¤¬¤Ç¤­¤ë¡£¤³¤Î¾ì¹ç¡¢Èæ³Ó¤ò¹Ô¤¦Á°¤Ë
158 .B &
159 ¤Î¸å¤ËÃÖ¤¤¤¿¿ôÃͤȤΠAND ±é»»¤¬¹Ô¤ï¤ì¤ë¡£·¿¤ÎÁ°¤Ë
160 .B u
161 ¤òÃÖ¤¯¤³¤È¤Ç¡¢½ç½øÉÕ¤­¤ÎÈæ³Ó¤òÉä¹æ̵¤·¤Ç¹Ô¤¦¤³¤È¤¬»ØÄê¤Ç¤­¤ë¡£
162 .IP test
163 .\"O The value to be compared with the value from the file.
164 .\"O If the type is
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 ¤Ï²þ¹Ôʸ»ú)¡£
171 .IP
172 .\"O Numeric values
173 .\"O may be preceded by a character indicating the operation to be performed.
174 ¿ôÃÍ
175 ¤ÎÁ°¤Ë¤Ï¡¢¼Â¹Ô¤¹¤ëÆ°ºî¤ò»ØÄꤹ¤ëʸ»ú¤òÃÖ¤¯¤³¤È¤¬¤Ç¤­¤ë¡£
176 .\"O It may be
177 .\"O .BR = ,
178 .\"O to specify that the value from the file must equal the specified value,
179 .BR =
180 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿ÃͤÈÅù¤·¤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
181 .\"O .BR < ,
182 .\"O to specify that the value from the file must be less than the specified
183 .\"O value,
184 .BR <
185 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿Ãͤè¤ê¾®¤µ¤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
186 .\"O .BR > ,
187 .\"O to specify that the value from the file must be greater than the specified
188 .\"O value,
189 .BR >
190 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤϻØÄꤷ¤¿Ãͤè¤êÂ礭¤¯¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
191 .\"O .BR & ,
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,
194 .BR &
195 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢»ØÄꤷ¤¿ÃͤÇΩ¤Ã¤Æ¤¤¤ëÁ´¤Æ¤Î¥Ó¥Ã¥È¤¬¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤǤâ
196 Ω¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
197 .\"O .BR ^ ,
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
200 .BR ^
201 ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢»ØÄꤷ¤¿ÃͤÇΩ¤Ã¤Æ¤¤¤ë¤É¤Î¥Ó¥Ã¥È¤â¡¢
202 ¥Õ¥¡¥¤¥ëÆâ¤ÎÃͤÇΩ¤Ã¤Æ¤¤¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
203 .\"O .BR x ,
204 .\"O to specify that any value will match.
205 .BR x
206 ¤Ï¤É¤ó¤ÊÃͤˤâ¥Þ¥Ã¥Á¤¹¤ë¡£Ê¸»ú¤¬¾Êά¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
207 .\"O If the character is omitted, it is assumed to be
208 .\"O .BR = .
209 .BR =
210 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¤ß¤Ê¤µ¤ì¤ë¡£
211 .IP
212 .\"O Numeric values are specified in C form; e.g.
213 .\"O .B 13
214 .\"O is decimal,
215 .\"O .B 013
216 .\"O is octal, and
217 .\"O .B 0x13
218 .\"O is hexadecimal.
219 ¿ôÃͤϠC ¸À¸ì¤Î½ñ¼°¤Ç»ØÄꤹ¤ë¡£Î㤨¤Ð¡¢
220 .B 13
221 ¤Ï 10 ¿Ê¿ô¡¢
222 .B 013
223 ¤Ï 8 ¿Ê¿ô¡¢
224 .B 0x13
225 ¤Ï 16 ¿Ê¿ô¤Ç¤¢¤ë¡£
226 .IP
227 .\"O For string values, the byte string from the
228 .\"O file must match the specified byte string. 
229 ʸ»úÎó¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ëÃæ¤Ë´Þ¤Þ¤ì¤ë¥Ð¥¤¥Èʸ»úÎó¤Ï¡¢»ØÄꤵ¤ì¤¿
230 ¥Ð¥¤¥Èʸ»úÎó¤Ë¥Þ¥Ã¥Á¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
231 .\"O The operators
232 .\"O .BR = ,
233 .\"O .B <
234 .\"O and
235 .\"O .B >
236 .\"O (but not
237 .\"O .BR & )
238 .\"O can be applied to strings.
239 ±é»»»Ò
240 .BR = ,
241 .BR < ,
242 .B >
243 ¤Ïʸ»úÎó¤Ë¤âŬÍѤǤ­¤ë (¤¿¤À¤·
244 .B &
245 ¤ÏŬÍѤǤ­¤Ê¤¤)¡£
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
250 .\"O .B >\e0
251 .\"O (because all strings are greater than the null string).
252 ¥Þ¥Ã¥Á¥ó¥°¤ò¹Ô¤¦Ä¹¤µ¤Ï¡¢magic ¥Õ¥¡¥¤¥ë¤Îʸ»úÎó°ú¿ô¤ÎŤµ¤Ç¤¢¤ë¡£
253 ¤Ä¤Þ¤ê¡¢
254 .B >\e0
255 ¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤ê¡¢¤¢¤ë¹Ô¤ò¤É¤ó¤Êʸ»úÎó¤Ë¤â¥Þ¥Ã¥Á¤µ¤»¡¢¤½¤·¤Æ¿ʬ
256 ¤½¤Îʸ»úÎó¤òɽ¼¨¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤ë¤À¤í¤¦¡£
257 .IP message
258 .\"O The message to be printed if the comparison succeeds.  If the string
259 .\"O contains a
260 .\"O .BR printf (3)
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 Èæ³Ó¤¬À®¸ù¤·¤¿¤È¤­¤Ë½ÐÎϤµ¤ì¤ë¥á¥Ã¥»¡¼¥¸¡£
264 ʸ»úÎó¤Ë
265 .BR printf (3)
266 ¤Î½ñ¼°»ØÄ꤬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¤³¤Î¥á¥Ã¥»¡¼¥¸¤ò½ñ¼°»ØÄêʸ»úÎó¤È¤·¤Æ»È¤Ã¤Æ
267 ¥Õ¥¡¥¤¥ëÆâ¤ÎÃÍ (»ØÄꤵ¤ì¤¿Á´¤Æ¤Î¥Þ¥¹¥¯½èÍý¤Ï¼Â¹Ô¤µ¤ì¤ë) ¤¬½ÐÎϤµ¤ì¤ë¡£
268 .PP
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
273 .\"O .B >
274 .\"O indicates additional tests and messages to be printed.
275 ʸ»ú
276 .B >
277 ¤Ç»Ï¤Þ¤ë¹Ô¤Ï¡¢ÄɲäǹԤ¦¥Æ¥¹¥È¤Èɽ¼¨¥á¥Ã¥»¡¼¥¸¤ò¼¨¤¹¡£
278 .\"O The number of
279 .\"O .B >
280 .\"O on the line indicates the level of the test; a line with no
281 .\"O .B >
282 .\"O at the beginning is considered to be at level 0.
283 1 ¹Ô¤Ë´Þ¤Þ¤ì¤ë
284 .B >
285 ¤Î¿ô¤Ï¥Æ¥¹¥È¤Î¥ì¥Ù¥ë¤òɽ¤¹¡£
286 ÀèƬ¤Ë
287 .B >
288 ¤¬¤Ê¤¤¹Ô¤Ï¥ì¥Ù¥ë 0 ¤Ë¤Ê¤ë¡£
289 .\"O Each line at level
290 .\"O .IB n \(pl1
291 .\"O is under the control of the line at level
292 .\"O .IB n
293 .\"O most closely preceding it in the magic file.
294 ¥ì¥Ù¥ë
295 .IB n \(pl1
296 ¤Î³Æ¹Ô¤Ï¡¢magic ¥Õ¥¡¥¤¥ëÃæ¤Ç¼«Ê¬¤è¤êÁ°¤Ë¤¢¤ë¥ì¥Ù¥ë
297 .IB n
298 ¤Î¹Ô¤Î¤¦¤Á¡¢ºÇ¤â¶á¤¤°ÌÃ֤Τâ¤Î¤ÎÀ©¸æ¤Ë½¾¤¦¡£
299 .\"O If the test on a line at level
300 .\"O .I n
301 .\"O succeeds, the tests specified in all the subsequent lines at level
302 .\"O .IB n \(pl1
303 .\"O are performed, and the messages printed if the tests succeed.
304 ¥ì¥Ù¥ë
305 .I n
306 ¤Î¹Ô¤Î¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¯Á´¤Æ¤Î¥ì¥Ù¥ë
307 .IB n \(pl1
308 ¤Î¹Ô¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¤¬¼Â¹Ô¤µ¤ì¡¢
309 ¤½¤Î¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤È¥á¥Ã¥»¡¼¥¸¤¬½ÐÎϤµ¤ì¤ë¡£
310 .\"O The next line at level
311 .\"O .I n
312 .\"O terminates this.
313 ¼¡¤Ë
314 .I n
315 ¤¬¤¢¤Ã¤¿¾ì½ê¤Ç¤³¤ÎÆ°ºî¤Ï½ªÎ»¤¹¤ë¡£
316 .\"O If the first character following the last
317 .\"O .B >
318 .\"O is a
319 .\"O .B (
320 .\"O then the string after the parenthesis is interpreted as an indirect offset.
321 ľÁ°¤Î
322 .B >
323 ¤Îľ¸å¤Îʸ»ú¤¬
324 .B (
325 ¤Ê¤é¤Ð¡¢³ç¸Ì¤Î¸å¤Îʸ»úÎó¤Ï´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤȲò¼á¤µ¤ì¤ë¡£
326 .\"O That means that the number after the parenthesis is used as an offset in
327 .\"O the file.
328 ¤Ä¤Þ¤ê¡¢³ç¸Ì¤Î¸å¤Î¿ô»ú¤Ï¥Õ¥¡¥¤¥ëÆâ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤È¤·¤Æ»È¤ï¤ì¤ë¡£
329 .\"O The value at that offset is read, and is used again as an offset
330 .\"O in the file.
331 ¤³¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃ֤ˤ¢¤ëÃͤ¬Æɤ߹þ¤Þ¤ì¡¢
332 Æɤ߹þ¤Þ¤ì¤¿Ãͤ¬¥Õ¥¡¥¤¥ëÃæ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤È¤·¤Æ»È¤ï¤ì¤ë¡£
333 .\"O Indirect offsets are of the form:
334 .\"O .BI (( x [.[bslBSL]][+\-][ y ]).
335 ´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤνñ¼°¤Ï°Ê²¼¤Ç¤¢¤ë:
336 .BI (( x [.[bslBSL]][+\-][ y ]).
337 .\"O The value of 
338 .\"O .I x
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 
341 .\"O .B [bslBSL] 
342 .\"O type specifier.
343 .I x
344 ¤ÎÃͤϥե¡¥¤¥ëÆâ¤Ç¤Î¥ª¥Õ¥»¥Ã¥ÈÃͤȤ·¤Æ»È¤ï¤ì¤ë¡£
345 ¤½¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃ֤ˤ¢¤ë byte ·¿¡¢short ·¿¡¢long ·¿¤ÎÃͤ¬Æɤ߹þ¤Þ¤ì¤ë¤¬¡¢
346 ¤É¤Î·¿¤Ë¤Ê¤ë¤«¤Ï·¿»ØÄê»Ò
347 .B [bslBSL] 
348 ¤Ë¤è¤Ã¤Æ·è¤Þ¤ë¡£
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
351 .\"O endian value.
352 Âçʸ»ú¤Ç¼¨¤µ¤ì¤ë·¿¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤ÎÃͤȲò¼á¤µ¤ì¡¢
353 ¾®Ê¸»ú¤Ç¼¨¤µ¤ì¤ë·¿¤Ï¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤ÎÃͤȲò¼á¤µ¤ì¤ë¡£
354 .\"O To that number the value of
355 .\"O .I y
356 .\"O is added and the result is used as an offset in the file.
357 ¤³¤Î¿ô¤Þ¤Ç
358 .I y
359 ¤ÎÃͤ˲䨤é¤ì¡¢¤½¤Î·ë²Ì¤¬¥Õ¥¡¥¤¥ëÃæ¤Î¥ª¥Õ¥»¥Ã¥ÈÃͤȤ·¤Æ»È¤ï¤ì¤ë¡£
360 .\"O The default type if one is not specified is long.
361 ²¿¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¤Î·¿¤Ï long ¤Ç¤¢¤ë¡£
362 .PP
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 
370 .\"O .B >
371 .\"O ).
372 ¤³¤Î¾ì¹ç¤Ï¡¢Ä¾Á°¤Î¾å°Ì¥ì¥Ù¥ë¤Î
373 ¥Õ¥£¡¼¥ë¥É¤Î½ª¤ï¤ê¤«¤é¤ÎÁêÂаÌÃ֤ǥª¥Õ¥»¥Ã¥È¤ò»ØÄê¤Ç¤­¤ë
374 (ÅöÁ³¤Ê¤¬¤é¤³¤ÎÊýË¡¤Ï¥µ¥Ö¥ì¥Ù¥ë¤Î¥Æ¥¹¥È¡¢¤Ä¤Þ¤ê
375 .B >
376 ¤Ç»Ï¤Þ¤ë¥Æ¥¹¥È¤Ç¤·¤«»È¤¨¤Ê¤¤)¡£
377 .\"O Such a relative offset is specified using
378 .\"O .B &
379 .\"O as a prefix to the offset.
380 ¤³¤Î¤è¤¦¤ÊÁêÂÐ¥ª¥Õ¥»¥Ã¥ÈÃͤϡ¢¥ª¥Õ¥»¥Ã¥ÈÃͤÎÁ°¤Ë
381 .B &
382 ¤òÃÖ¤¯¤³¤È¤Ç»ØÄꤹ¤ë¡£
383 .\"O .SH BUGS
384 .SH ¥Ð¥°
385 .\"O The formats 
386 .\"O .IR long ,
387 .\"O .IR belong ,
388 .\"O .IR lelong ,
389 .\"O .IR short ,
390 .\"O .IR beshort ,
391 .\"O .IR leshort ,
392 .\"O .IR date ,
393 .\"O .IR bedate ,
394 .\"O and
395 .\"O .I ledate
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.
400 .IR long ,
401 .IR belong ,
402 .IR lelong ,
403 .IR short ,
404 .IR beshort ,
405 .IR leshort ,
406 .IR date ,
407 .IR bedate ,
408 .I ledate
409 ¤Î½ñ¼°¤Ï¥·¥¹¥Æ¥à°Í¸¤Ç¤¢¤ë¡£¼±Ê̤µ¤»¤ë¥Õ¥¡¥¤¥ë¤Ï¡¢
410 ¤³¤ÎŤµ¤¬°ã¤¦¥·¥¹¥Æ¥à¤«¤é»ý¤Ã¤Æ¤¯¤ë¤³¤È¤¬Â¿¤¤¤¿¤á¡¢
411 ¥Ð¥¤¥ÈÎó¤È¤·¤Æ»ØÄꤹ¤Ù¤­¤À¤í¤¦ (2B, 4B Åù)¡£
412 .PP
413 .\"O There is (currently) no support for specified-endian data to be used in
414 .\"O indirect offsets.
415 (¸½»þÅÀ¤Ç¤Ï) ´ÖÀÜ¥ª¥Õ¥»¥Ã¥ÈÃͤǥ¨¥ó¥Ç¥£¥¢¥ó¤ò»ØÄꤷ¤Æ
416 ¥Ç¡¼¥¿¤ò°·¤¦¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
417 .\"O .SH SEE ALSO
418 .SH ´ØÏ¢¹àÌÜ
419 .BR file (1)
420 .\"O \- the command that reads this file.
421 \- ¤³¤Î¥Õ¥¡¥¤¥ë¤òÆɤॳ¥Þ¥ó¥É¡£
422 .\"
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.
429 .\" Lines: 136
430 .\" 
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.
433 .\"
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 $