2 .\" Japanese Version Copyright (c) 2001-2003 Yuichi SATO
3 .\" all rights reserved.
4 .\" Translated Tue 11 Jan 1994
5 .\" by NetBSD jman proj. <jman@spa.is.uec.ac.jp>
6 .\" Updated Sun Jan 14 04:46:37 JST 2001
7 .\" by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
8 .\" Updated & Modified Sun Mar 2 15:11:49 JST 2003
9 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
11 .\"WORD: parse ²òÀϤ¹¤ë
12 .\"WORD: interpret ²ò¼á¤¹¤ë
14 .TH GETOPT 1 "May 31, 1997" Linux ""
17 .\"O getopt \- parse command options (enhanced)
18 getopt \- ¥³¥Þ¥ó¥É¤Î°ú¤¿ô¤ò²òÀϤ¹¤ë (³ÈÄ¥ÈÇ)
21 .BR getopt " optstring parameters"
23 .BR getopt " [options] [" \-\- "] optstring parameters"
25 .BR getopt " [options] " \-o | \-\-options " optstring [options] [" \-\- "] parameters"
29 .\"O is used to break up
31 .\"O options in command lines for easy parsing by
32 .\"O shell procedures, and to check for legal options.
36 .\"O routines to do this.
38 ¤Ï¡¢¥·¥§¥ë¼ê³¤¤Ç´Êñ¤Ë²òÀϤǤ¤ë¤è¤¦¤Ë¡¢
39 ¥³¥Þ¥ó¥É¥é¥¤¥ó¤Î¥ª¥×¥·¥ç¥ó¤òʬ²ò
42 ¤Þ¤¿¡¢Àµ¤·¤¤¥ª¥×¥·¥ç¥ó¤Ç¤¢¤ë¤«¤òÄ´¤Ù¤ë¤¿¤á¤Ë¤â»È¤ï¤ì¤ë¡£
50 .\"O is called with can be divided into two parts: options
51 .\"O which modify the way getopt will parse
54 .\"O .I \-o|\-\-options optstring
57 .\"O and the parameters which are to be
63 ¤ò¸Æ¤Ó½Ð¤¹¤È¤¤Ë»È¤ï¤ì¤¿¥Ñ¥é¥á¡¼¥¿¤Ï¡¢
64 2 ¤Ä¤ÎÉôʬ¤Ëʬ¤±¤ë¤³¤È¤¬¤Ç¤¤ë:
65 getopt ¤Î²òÀÏÆ°ºî¤òÊѹ¹¤¹¤ë¥ª¥×¥·¥ç¥ó
70 .IR "\-o|\-\-options optstring" )
71 ¤È¡¢²òÀϤµ¤ì¤ë¥Ñ¥é¥á¡¼¥¿
76 .\"O The second part will start at the first non\-option parameter
77 .\"O that is not an option argument, or after the first occurrence of
82 .\"O .RB ` \-\-options '
83 .\"O option is found in the first part, the first
84 .\"O parameter of the second part is used as the short options string.
86 ºÇ½é¤Î¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿
87 (¥ª¥×¥·¥ç¥ó°ú¤¿ô¤Ç¤Ï¤Ê¤¤¤â¤Î) ¤Î¸å¤«¡¢
95 ¥ª¥×¥·¥ç¥ó¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¡¢
96 Âè 2 Éôʬ¤ÎºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿¤Ï
97 û¤¤·Á¼°¤Î¥ª¥×¥·¥ç¥óʸ»úÎó¤È¤·¤Æ»È¤ï¤ì¤ë¡£
99 .\"O If the environment variable
100 .\"O .B GETOPT_COMPATIBLE
101 .\"O is set, or if its first parameter
102 .\"O is not an option (does not start with a
104 .\"O this is the first format in the
107 .\"O will generate output that is compatible with that of other versions of
112 ¤Þ¤¿¤ÏºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿¤¬¥ª¥×¥·¥ç¥ó¤Ç¤Ê¤«¤Ã¤¿¾ì¹ç
114 ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¡£
117 ¥»¥¯¥·¥ç¥ó¤ÎºÇ½é¤Î·Á¼°¤Ç¤¢¤ë)¡¢
121 ¤È¸ß´¹À¤Î¤¢¤ë½ÐÎϤòÀ¸À®¤¹¤ë¡£
122 .\"O It will still do parameter shuffling and recognize optional
123 .\"O arguments (see section
124 .\"O .B COMPATIBILITY
125 .\"O for more information).
126 ¤³¤Î¾ì¹ç¤Ç¤â¡¢¥Ñ¥é¥á¡¼¥¿¤ÎʤÙÂؤ¨¤ò¹Ô¤¤¡¢¥ª¥×¥·¥ç¥ó°ú¤¿ô¤òǧ¼±¤¹¤ë
129 ¥»¥¯¥·¥ç¥ó¤ò»²¾È¤¹¤ë¤³¤È)¡£
131 .\"O Traditional implementations of
133 .\"O are unable to cope with whitespace and other (shell\-specific) special characters
134 .\"O in arguments and non\-option parameters.
137 ¤Î¼ÂÁõ¤Ç¤Ï¡¢°ú¤¿ô¤ä¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ç
138 ¶õÇò¤È¾¤Î (¥·¥§¥ëÆÃͤÎ) Æüìʸ»ú¤òÁȤ߹ç¤ï¤»¤Æ»È¤¦¤³¤È¤¬¤Ç¤¤Ê¤¤¡£
139 .\"O To solve this problem, this
140 .\"O implementation can generate
141 .\"O quoted output which must once again be interpreted by the shell (usually
145 ¤³¤ÎÌäÂê¤ò²ò·è¤¹¤ë¤¿¤á¡¢
146 ¤³¤Î¼ÂÁõ¤Ç¤Ï¥¯¥©¡¼¥È¤·¤¿½ÐÎϤòÀ¸À®¤¹¤ë¡£
147 ¤³¤Î½ÐÎϤϡ¢¥·¥§¥ë (Ä̾ï¤Ï
149 ¥³¥Þ¥ó¥É¤¬»È¤ï¤ì¤ë) ¤Ë¤è¤Ã¤ÆºÆ¤Ó²òÀϤµ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
150 .\"O This has the effect of preserving those characters, but
153 .\"O in a way that is no longer compatible with other versions (the second
154 .\"O or third format in the
156 ¤³¤ì¤Ë¤Ï¥¯¥©¡¼¥È¤¹¤Ù¤Ê¸»úÎó¤òÊݸ¤ë¤È¤¤¤¦¸ú²Ì¤¬¤¢¤ë¤¬¡¢
158 ¤ò¾¤Î¥Ð¡¼¥¸¥ç¥ó¤È¤Ï¸ß´¹À¤Î¤Ê¤¤ÊýË¡
160 ¥»¥¯¥·¥ç¥ó¤Î 2, 3 ÈÖÌܤηÁ¼°) ¤Ç¸Æ¤Ó½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
161 .\"O To determine whether this enhanced version of
163 .\"O is installed, a special test option
168 ¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¤Ë¤Ï¡¢ÆÃÊ̤ʥƥ¹¥È¥ª¥×¥·¥ç¥ó
173 .IP "\-a, \-\-alternative"
174 .\"O Allow long options to start with a single
176 Ť¤¥ª¥×¥·¥ç¥ó¤ò 1 ¸Ä¤Î
178 ¤Ç»Ï¤á¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡£
180 .\"O Output a small usage guide and exit succesfully. No other output is generated.
181 ¤Á¤ç¤Ã¤È¤·¤¿»ÈÍÑ¥¬¥¤¥É¤òɽ¼¨¤·¡¢Àµ¾ï½ªÎ»¤¹¤ë¡£
182 ¤½¤ì°Ê¾å¤Ï²¿¤â½ÐÎϤµ¤ì¤Ê¤¤¡£
183 .IP "\-l, \-\-longoptions longopts"
184 .\"O The long (multi\-character) options to be recognized.
185 .\"O More than one option name
186 .\"O may be specified at once, by separating the names with commas. This option
187 .\"O may be given more than once, the
190 ǧ¼±¤µ¤»¤ëŤ¤ (Ê£¿ôʸ»ú¤Î) ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¡£
191 2 ¤Ä°Ê¾å¤Î¥ª¥×¥·¥ç¥ó̾¤ò¥³¥ó¥Þ¤Ç¶èÀڤäưìÅ٤˻ØÄê¤Ç¤¤ë¡£
192 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï 2 ²ó°Ê¾å»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
195 .\"O Each long option name
198 .\"O may be followed by one colon to indicate it has a required argument,and by two colons to indicate it has an optional argument.
200 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ëŤ¤¥ª¥×¥·¥ç¥ó̾¤Î¸å¤Ë¡¢1 ¸Ä¤Î¥³¥í¥ó¤ò³¤±¤ë¤³¤È¤¬¤Ç¤¤ë¡£
201 ¤³¤ì¤Ï¡¢¤½¤Î¥ª¥×¥·¥ç¥ó¤Ë°ú¤¿ô¤¬É¬¿Ü¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
202 ¤Þ¤¿¡¢Ä¹¤¤¥ª¥×¥·¥ç¥ó̾¤Î¸å¤Ë 2 ¸Ä¤Î¥³¥í¥ó¤ò³¤±¤ë¤³¤È¤â¤Ç¤¤ë¡£
203 ¤³¤ì¤Ï¡¢¤½¤Î¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤ë¾ì¹ç¤â¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
204 .IP "\-n, \-\-name progname"
205 .\"O The name that will be used by the
207 .\"O routines when it reports errors. Note that errors of
209 .\"O are still reported as coming from getopt.
210 ¥¨¥é¡¼¤¬Êó¹ð¤µ¤ì¤¿¾ì¹ç¤Ë
212 ¥ë¡¼¥Á¥ó¤¬»È¤¦¥×¥í¥°¥é¥à̾¡£
213 ¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤Æ¤â¡¢
215 ¤Î¥¨¥é¡¼¤Ï getopt ¤«¤éȯÀ¸¤·¤¿¤â¤Î¤È¤·¤Æɽ¼¨¤µ¤ì¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
216 .IP "\-o, \-\-options shortopts"
217 .\"O The short (one\-character) options to be recognized. If this options is not
218 .\"O found, the first parameter of
220 .\"O that does not start with
223 .\"O (and is not an option argument) is used as the short options string.
224 ǧ¼±¤µ¤»¤ëû¤¤ (1 ʸ»ú¤Î) ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¡£
225 ¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
229 ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤¤ºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿ (¤«¤Ä¡¢¥ª¥×¥·¥ç¥ó¤Î°ú¤¿ô¤Ç¤Ê¤¤¤â¤Î) ¤¬
230 û¤¤¥ª¥×¥·¥ç¥ó¤Îʸ»úÎó¤È¤·¤Æ»È¤ï¤ì¤ë¡£
231 .\"O Each short option character
234 .\"O may be followed by one colon to indicate it has a required argument,
235 .\"O and by two colons to indicate it has an optional argument.
237 ¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ëû¤¤¥ª¥×¥·¥ç¥óʸ»ú¤Î¸å¤Ë¡¢1 ¸Ä¤Î¥³¥í¥ó¤ò³¤±¤ë¤³¤È¤¬¤Ç¤¤ë¡£
238 ¤³¤ì¤Ï¡¢¤½¤Î¥ª¥×¥·¥ç¥ó¤Ë°ú¤¿ô¤¬É¬¿Ü¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
239 ¤Þ¤¿¡¢Ä¹¤¤¥ª¥×¥·¥ç¥ó̾¤Î¸å¤Ë 2 ¸Ä¤Î¥³¥í¥ó¤ò³¤±¤ë¤³¤È¤â¤Ç¤¤ë¡£
240 ¤³¤ì¤Ï¡¢¤½¤Î¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤ë¾ì¹ç¤â¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
241 .\"O The first character of shortopts may be
245 .\"O to influence the way
246 .\"O options are parsed and output is generated (see section
247 .\"O .B SCANNING MODES
249 ¥ª¥×¥·¥ç¥ó¤Î²òÀÏË¡¤È½ÐÎϤÎÀ¸À®Ë¡¤òÊѹ¹¤¹¤ë¤¿¤á¤Ë¡¢
250 shortopts ¤ÎºÇ½é¤Îʸ»ú¤ò
256 .B ¡Ö¥¹¥¥ã¥ó¥â¡¼¥É¡×
257 ¥»¥¯¥·¥ç¥ó¤ò»²¾È¤¹¤ë¤³¤È)¡£
259 .\"O Disable error reporting by getopt(3).
260 getopt(3) ¤Ë¤è¤ë¥¨¥é¡¼É½¼¨¤ò¤µ¤»¤Ê¤¤¡£
261 .IP "\-Q, \-\-quiet\-output"
262 .\"O Do not generate normal output. Errors are still reported by
264 .\"O unless you also use
266 Ä̾ï¤Î½ÐÎϤòÀ¸À®¤µ¤»¤Ê¤¤¡£
270 ¤Ë¤è¤Ã¤Æ¥¨¥é¡¼¤¬É½¼¨¤µ¤ì¤ë¡£
271 .IP "\-s, \-\-shell shell"
272 .\"O Set quoting conventions to those of shell. If no \-s argument is found,
275 .\"O conventions are used. Valid arguments are currently
281 »ØÄꤷ¤¿¥·¥§¥ë¤Î¥¯¥©¡¼¥ÈÊýË¡¤ËÀßÄꤹ¤ë¡£
282 \-s ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
284 ¤Ç¤Î¥¯¥©¡¼¥ÈÊýË¡¤¬»È¤ï¤ì¤ë¡£
285 »ØÄê²Äǽ¤Ê°ú¤¿ô¤Ï¡¢¸½ºß¤Î¤È¤³¤í
291 .IP "\-u, \-\-unquoted"
292 .\"O Do not quote the output. Note that whitespace and special (shell\-dependent)
293 .\"O characters can cause havoc in this mode (like they do with other
295 .\"O implementations).
296 ½ÐÎϤò¥¯¥©¡¼¥È¤·¤Ê¤¤¡£
297 ¶õÇò¤È (¥·¥§¥ë°Í¸¤Î) Æüìʸ»ú¤Ï¡¢(¾¤Î
299 ¤Î¼ÂÁõ¤ÈƱ¤¸¤è¤¦¤Ë) ¤³¤Î¥â¡¼¥É¤Ç¤ÏÂ纮Íð¤ò°ú¤µ¯¤³¤¹¡£
303 .\"O is this enhanced version or an old version. This generates no output,
304 .\"O and sets the error status to 4. Other implementations of
306 .\"O and this version if the environment variable
307 .\"O .B GETOPT_COMPATIBLE
311 .\"O and error status 0.
313 ¤¬³ÈÄ¥¥Ð¡¼¥¸¥ç¥ó¤«¸Å¤¤¥Ð¡¼¥¸¥ç¥ó¤«¤ò¥Æ¥¹¥È¤¹¤ë¡£
314 ²¿¤â½ÐÎϤ·¤Ê¤¤¤¬¡¢¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹¤ò 4 ¤ËÀßÄꤹ¤ë¡£
317 ¤Î¼ÂÁõ¤Î¾ì¹ç¤ä¡¢¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç´Ä¶ÊÑ¿ô
319 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
321 ¤òÊÖ¤·¡¢¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹¤ò 0 ¤ËÀßÄꤹ¤ë¡£
322 .IP "\-V, \-\-version"
323 .\"O Output version information and exit succesfully. No other output is generated.
324 ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤ò½ÐÎϤ·¡¢Àµ¾ï½ªÎ»¤¹¤ë¡£
325 ¤½¤ì°Ê¾å¤Ï²¿¤â½ÐÎϤµ¤ì¤Ê¤¤¡£
328 .\"O This section specifies the format of the second part of the parameters of
336 ¤Î¥Ñ¥é¥á¡¼¥¿¤ÎÂè 2 Éôʬ
340 ¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤ë¡£
341 .\"O The next section
343 .\"O describes the output that is
344 .\"O generated. These parameters were typically the parameters a shell function
345 .\"O was called with.
348 ¤Ç¤ÏÀ¸À®¤µ¤ì¤ë½ÐÎϤˤĤ¤¤ÆÀâÌÀ¤·¤Æ¤¤¤ë¡£
349 ¤³¤ì¤é¤Î¥Ñ¥é¥á¡¼¥¿¤Ï¡¢°ìÈ̤ˡ¢¥·¥§¥ë´Ø¿ô¤¬¸Æ¤Ð¤ì¤¿¤È¤¤Î¥Ñ¥é¥á¡¼¥¿¤Ç¤¢¤ë¡£
350 .\"O Care must be taken that each parameter the shell function was
351 .\"O called with corresponds to exactly one parameter in the parameter list of
355 .\"O All parsing is done by the GNU
358 ¥·¥§¥ë´Ø¿ô¤¬¸Æ¤Ð¤ì¤¿¤È¤¤Î³Æ¥Ñ¥é¥á¡¼¥¿¤¬
360 ¤Î¥Ñ¥é¥á¡¼¥¿¥ê¥¹¥È¤Ë¤¢¤ë 1 ¤Ä¤Î¥Ñ¥é¥á¡¼¥¿¤Ë
361 ¸·Ì©¤ËÂбþ¤·¤Æ¤¤¤ëÅÀ¤ËÃí°Õ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
363 ¥»¥¯¥·¥ç¥ó¤ò»²¾È¤¹¤ë¤³¤È)¡£
368 .\"O The parameters are parsed from left to right. Each parameter is classified as a
369 .\"O short option, a long option, an argument to an option,
370 .\"O or a non\-option parameter.
371 ¥Ñ¥é¥á¡¼¥¿¤Ïº¸¤«¤é±¦¤Ø²òÀϤµ¤ì¤ë¡£
372 ³Æ¥Ñ¥é¥á¡¼¥¿¤Ï¡¢Ã»¤¤¥ª¥×¥·¥ç¥ó¡¦Ä¹¤¤¥ª¥×¥·¥ç¥ó¡¦¥ª¥×¥·¥ç¥ó¤Ø¤Î°ú¤¿ô¡¦
373 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤ËʬÎव¤ì¤ë¡£
375 .\"O A simple short option is a
377 .\"O followed by a short option character. If
378 .\"O the option has a required argument, it may be written directly after the option
379 .\"O character or as the next parameter (ie. separated by whitespace on the
380 .\"O command line). If the
381 .\"O option has an optional argument, it must be written directly after the
382 .\"O option character if present.
383 ´Êñ¤Êû¤¤¥ª¥×¥·¥ç¥ó¤Ï¡¢
385 ¤Î¸å¤Ëû¤¤¥ª¥×¥·¥ç¥óʸ»ú¤¬Â³¤¯¤â¤Î¤Ç¤¢¤ë¡£
386 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤òɬ¿Ü¤È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
387 °ú¤¿ô¤Ï¥ª¥×¥·¥ç¥óʸ»ú¤Îľ¸å¤Ë½ñ¤¯¤³¤È¤¬¤Ç¤¤ë¡£
388 (¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç¶õÇò¤Ç¶èÀÚ¤é¤ì¤¿) ¼¡¤Î¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ½ñ¤¯¤³¤È¤â¤Ç¤¤ë¡£
389 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤ë¤³¤È¤â¼è¤é¤Ê¤¤¤³¤È¤â¤Ç¤¤ë¾ì¹ç¡¢
390 °ú¤¿ô¤¬Â¸ºß¤¹¤ë¤Ê¤é¤Ð¡¢¥ª¥×¥·¥ç¥óʸ»ú¤Îľ¸å¤Ë½ñ¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
392 .\"O It is possible to specify several short options after one
394 .\"O as long as all (except possibly the last) do not have required or optional
396 (ºÇ¸å¤Î¥ª¥×¥·¥ç¥ó¤ò½ü¤¯) Á´¤Æ¤Î¥ª¥×¥·¥ç¥ó¤¬
397 ɬ¿Ü¤Î°ú¤¿ô¤â¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¤Î°ú¤¿ô¤âɬÍפȤ·¤Ê¤¤¸Â¤ê¡¢
400 ¤Î¸å¤ËÊ£¿ô¤Îû¤¤¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
402 .\"O A long option normally begins with
404 .\"O followed by the long option name.
405 Ť¤¥ª¥×¥·¥ç¥ó¤Ï¡¢Ä̾ï
407 ¤Î¸å¤ËŤ¤¥ª¥×¥·¥ç¥ó̾¤¬Â³¤¯¡£
408 .\"O If the option has a required argument, it may be written directly after
409 .\"O the long option name, separated by
411 .\"O or as the next argument (ie. separated by whitespace on the command line).
412 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤òɬ¿Ü¤È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
414 ¤Ç¶èÀڤäÆŤ¤¥ª¥×¥·¥ç¥ó̾¤Îľ¸å¤Ë½ñ¤¯¤³¤È¤¬¤Ç¤¤ë¡£
415 ¤Þ¤¿¡¢(¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç¶õÇò¤Ç¶èÀڤäÆ) ¼¡¤Î°ú¤¿ô¤È¤·¤Æ½ñ¤¯¤³¤È¤â¤Ç¤¤ë¡£
416 .\"O If the option has an optional argument, it must
417 .\"O be written directly after the long option name, separated by
419 .\"O if present (if you add the
421 .\"O but nothing behind it, it is interpreted
422 .\"O as if no argument was present; this is a slight bug, see the
424 .\"O Long options may be abbreviated, as long as the abbreviation is not
426 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤ë¤³¤È¤â¼è¤é¤Ê¤¤¤³¤È¤â¤Ç¤¤ë¾ì¹ç¡¢
427 °ú¤¿ô¤¬Â¸ºß¤¹¤ë¤Ê¤é¤Ð¡¢
429 ¤Ç¶èÀڤäÆŤ¤¥ª¥×¥·¥ç¥ó̾¤Îľ¸å¤Ë½ñ¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
431 ¤ò¥ª¥×¥·¥ç¥ó¤Î¸å¤Ë½ñ¤¤¤¿¤Ë¤â´Ø¤é¤º¡¢¤½¤Î¸å¤Ë²¿¤â»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
432 °ú¤¿ô¤¬Â¸ºß¤·¤Ê¤¤¤â¤Î¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
433 ¤³¤ì¤Ï¤Á¤ç¤Ã¤È¤·¤¿¥Ð¥°¤Ç¤¢¤ë¡£
435 ¥»¥¯¥·¥ç¥ó¤ò»²¾È¤¹¤ë¤³¤È)¡£
436 Ť¤¥ª¥×¥·¥ç¥ó¤Ï¡¢¾Êά·Á¤¬Û£Ëæ¤Ç¤Ê¤¤ (¾¤Î¥ª¥×¥·¥ç¥ó¤È¶èÊ̤¬¤Ä¤¯) ¸Â¤ê¡¢
437 û¤¯¾Êά¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
439 .\"O Each parameter not starting with a
441 .\"O and not a required argument of
442 .\"O a previous option, is a non\-option parameter. Each parameter after
445 .\"O parameter is always interpreted as a non\-option parameter.
447 ¤Ç»Ï¤Þ¤é¤º¡¢¤«¤ÄÁ°¤Î¥ª¥×¥·¥ç¥ó¤¬É¬¿Ü¤È¤·¤Æ¤¤¤ë°ú¤¿ô¤Ç¤â¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ï¡¢
448 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ç¤¢¤ë¡£
450 ¥Ñ¥é¥á¡¼¥¿¤Î¸å¤Ë¤¢¤ë¥Ñ¥é¥á¡¼¥¿¤Ï¡¢
451 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
452 .\"O If the environment variable
453 .\"O .B POSIXLY_CORRECT
454 .\"O is set, or if the short
455 .\"O option string started with a
457 .\"O all remaining parameters are interpreted
458 .\"O as non\-option parameters as soon as the first non\-option parameter is
462 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
463 ¤Þ¤¿¤Ïû¤¤¥ª¥×¥·¥ç¥óʸ»úÎó¤¬
466 ºÇ½é¤Î¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤¬¸«¤Ä¤«¤Ã¤¿»þÅÀ¤Ç¡¢
467 »Ä¤ê¤ÎÁ´¤Æ¤Î¥Ñ¥é¥á¡¼¥¿¤Ï¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
470 .\"O Output is generated for each element described in the previous section.
472 .\"O in the same order as the elements are specified in the input, except
473 .\"O for non\-option parameters. Output can be done in
475 .\"O .RI ( unquoted )
476 .\"O mode, or in such way that whitespace and other special characters within
477 .\"O arguments and non\-option parameters are preserved (see
479 ½ÐÎϤÏÁ°¤Î¥»¥¯¥·¥ç¥ó¤ÇÀâÌÀ¤·¤¿³ÆÍ×ÁǤËÂФ·¤ÆÀ¸À®¤µ¤ì¤ë¡£
480 ½ÐÎϤÏÍ×ÁǤ¬ÆþÎϤǻØÄꤵ¤ì¤¿½çÈÖ¤ÇÀ¸À®¤µ¤ì¤ë¡£
481 ¤¿¤À¤·¡¢¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤ÏÎã³°¤Ç¤¢¤ë¡£
484 .RI ( ¥¯¥©¡¼¥È¤µ¤ì¤Ê¤¤ )
485 ¥â¡¼¥É¤ÇÀ¸À®¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
486 ¤Þ¤¿¡¢°ú¤¿ô¤È¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ë´Þ¤Þ¤ì¤ë¶õÇò¤È¾¤ÎÆüìʸ»ú¤ò
487 Êݸ¤ë¥â¡¼¥É¤Ç½ÐÎϤ¹¤ë¤³¤È¤â¤Ç¤¤ë
489 ¥»¥¯¥·¥ç¥ó¤ò»²¾È¤¹¤ë¤³¤È)¡£
490 .\"O When the output is processed in the shell script, it will seem to be
491 .\"O composed of distinct elements that can be processed one by one (by using the
492 .\"O shift command in most shell languages). This is imperfect in unquoted mode,
493 .\"O as elements can be split at unexpected places if they contain whitespace
494 .\"O or special characters.
495 ½ÐÎϤ¬¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤Ç½èÍý¤µ¤ì¤ë¾ì¹ç¡¢
496 ¤½¤Î½ÐÎϤÏÊÌ¡¹¤ÎÍ×ÁǤ«¤é¹½À®¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¤ß¤¨¤ë¡£
497 ¤³¤ÎÍ×ÁÇ¤Ï (ÂçÉôʬ¤Î¥·¥§¥ë¸À¸ì¤Ç¤Ï shift ¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ)
498 1 ¤Ä 1 ¤Ä½èÍý¤Ç¤¤ë¡£
499 ¤³¤ÎÆ°ºî¤Ï¥¯¥©¡¼¥È¤µ¤ì¤Ê¤¤¥â¡¼¥É¤Ç¤ÏÉÔ´°Á´¤Ç¤¢¤ë¡£
500 ¤Ê¤¼¤Ê¤é¡¢Í×ÁǤ˶õÇò¤äÆüìʸ»ú¤¬¤¢¤Ã¤¿¾ì¹ç¡¢
501 Í×ÁǤ¬´üÂÔ¤·¤Æ¤¤¤Ê¤¤²Õ½ê¤Çʬ³ä¤µ¤ì¤Æ¤·¤Þ¤¦¤«¤é¤Ç¤¢¤ë¡£
502 .\"O If there are problems parsing the parameters, for example because a
503 .\"O required argument is not found or an option is not recognized, an error
504 .\"O will be reported on stderr, there will be no output for the offending
505 .\"O element, and a non\-zero error status is returned.
506 ɬ¿Ü¤È¤µ¤ì¤ë°ú¤¿ô¤¬¸«¤Ä¤«¤é¤Ê¤¤¡¢¤Þ¤¿¤Ï¥ª¥×¥·¥ç¥ó¤¬Ç§¼±¤µ¤ì¤Ê¤¤¡¢
507 ¤È¤¤¤Ã¤¿¸¶°ø¤Ç¥Ñ¥é¥á¡¼¥¿²òÀϤËÌäÂ꤬¤¢¤ë¾ì¹ç¡¢
508 ɸ½à¥¨¥é¡¼¤Ë¥¨¥é¡¼¤¬É½¼¨¤µ¤ì¤ë¡£
509 ¤³¤Î¤È¤¡¢ÉÔÀµ¤ÊÍ×ÁǤËÂФ·¤Æ¤Ï²¿¤â½ÐÎϤµ¤ì¤º¡¢
510 0 ¤Ç¤Ê¤¤¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹¤¬ÊÖ¤µ¤ì¤ë¡£
512 .\"O For a short option, a single
514 .\"O and the option character are generated
515 .\"O as one parameter. If the option has an argument, the next
516 .\"O parameter will be the argument. If the option takes an optional argument,
517 .\"O but none was found, the next parameter will be generated but be empty in
519 .\"O but no second parameter will be generated in unquoted (compatible) mode.
520 .\"O Note that many other
522 .\"O implemetations do not support optional arguments.
523 û¤¤¥ª¥×¥·¥ç¥ó¤ËÂФ·¤Æ¡¢½ÐÎϤȤ·¤Æ 1 ¸Ä¤Î
525 ¤È¥ª¥×¥·¥ç¥óʸ»ú¤¬À¸À®¤µ¤ì¤ë¡£
526 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤ë¾ì¹ç¡¢¼¡¤Î¥Ñ¥é¥á¡¼¥¿¤¬°ú¤¿ô¤Ë¤Ê¤ë¡£
527 ¥ª¥×¥·¥ç¥ó¤¬°ú¤¿ô¤ò¼è¤Ã¤Æ¤â¼è¤é¤Ê¤¯¤Æ¤â¤è¤¤¾ì¹ç¤Ë¡¢
528 °ú¤¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤È¡¢
529 ¥¯¥©¡¼¥È¥â¡¼¥É¤Ç¤Ï¼¡¤Î¥Ñ¥é¥á¡¼¥¿¤¬À¸À®¤µ¤ì¤ë¤¬¶õ¤Î¥Ñ¥é¥á¡¼¥¿¤Ë¤Ê¤ë¡£
530 ¤³¤Î¾ì¹ç¡¢¥¯¥©¡¼¥È¤·¤Ê¤¤ (¸ß´¹) ¥â¡¼¥É¤Ç¤Ï
531 2 ÈÖÌܤΥѥé¥á¡¼¥¿¤ÏÀ¸À®¤µ¤ì¤Ê¤¤¡£
534 ¤Î¼ÂÁõ¤Ç¤Ï¡¢¼è¤Ã¤Æ¤â¼è¤é¤Ê¤¯¤Æ¤â¤è¤¤°ú¤¿ô¤Ï
535 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
537 .\"O If several short options were specified after a single
539 .\"O each will be present in the output as a separate parameter.
540 Ê£¿ô¤Îû¤¤¥ª¥×¥·¥ç¥ó¤¬ 1 ¸Ä¤Î
542 ¤Î¸å¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
543 ³Æ¥ª¥×¥·¥ç¥ó¤Ï¶èÀÚ¤é¤ì¤¿¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ½ÐÎϤËɽ¼¨¤µ¤ì¤ë¡£
545 .\"O For a long option,
547 .\"O and the full option name are generated as one
548 .\"O parameter. This is done regardless whether the option was abbreviated or
549 .\"O specified with a single
551 .\"O in the input. Arguments are handled as with short options.
552 Ť¤¥ª¥×¥·¥ç¥ó¤ËÂФ·¤Æ¡¢
554 ¤È´°Á´¤Ê¥ª¥×¥·¥ç¥ó̾¤¬ 1 ¤Ä¤Î¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÀ¸À®¤µ¤ì¤ë¡£
555 ¡ÖÆþÎϤǥª¥×¥·¥ç¥ó¤¬Î¬½ñ¤¤µ¤ì¤Æ¤¤¤ë¡£
556 ¤Þ¤¿¤Ï¡¢¥ª¥×¥·¥ç¥ó¤¬ 1 ¸Ä¤Î
558 ¤ò»È¤Ã¤Æ»ØÄꤵ¤ì¤Æ¤¤¤ë¡£¡×¤È¤¤¤¦¤³¤È¤Ë´Ø¤é¤º¡¢¤³¤ÎÆ°ºî¤ò¤¹¤ë¡£
559 °ú¤¿ô¤Ïû¤¤¥ª¥×¥·¥ç¥ó¤È¤·¤Æ°·¤ï¤ì¤ë¡£
561 .\"O Normally, no non\-option parameters output is generated until all options
562 .\"O and their arguments have been generated. Then
564 .\"O is generated as a
565 .\"O single parameter, and after it the non\-option parameters in the order
566 .\"O they were found, each as a separate parameter.
567 Ä̾Á´¤Æ¤Î¥ª¥×¥·¥ç¥ó¤È¤½¤Î°ú¤¿ô¤¬½ÐÎϤËÀ¸À®¤µ¤ì¤ë¤Þ¤Ç¡¢
568 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ï½ÐÎϤµ¤ì¤Ê¤¤¡£
569 ¤½¤·¤Æ¡¢1 ¸Ä¤Î¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ
572 ¤½¤Î¸å¤Ë¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ï¡¢
573 ¸«¤Ä¤«¤Ã¤¿½çÈÖ¤ÇÊÌ¡¹¤Î¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÀ¸À®¤µ¤ì¤ë¡£
574 .\"O Only if the first character of the short options string was a
576 .\"O non\-option parameter output is generated at the place they are found in the
577 .\"O input (this is not supported if the first format of the
579 .\"O is used; in that case all preceding occurrences of
584 û¤¤¥ª¥×¥·¥ç¥óʸ»úÎó¤ÎºÇ½é¤Îʸ»ú¤¬
587 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤ÏÆþÎϤǸ«¤Ä¤«¤Ã¤¿°ÌÃ֤ǽÐÎϤµ¤ì¤ë
590 ¥»¥¯¥·¥ç¥ó¤ÎºÇ½é¤Î·Á¼°¤¬»È¤ï¤ì¤¿¾ì¹ç¤Ë¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤¡£
595 ¤¬Á°¤ËÉÕ¤¯Á´¤Æ¤Î¥Ñ¥é¥á¡¼¥¿¤¬Ìµ»ë¤µ¤ì¤ë)¡£
598 .\"O In compatible mode, whitespace or 'special' characters in arguments or
599 .\"O non\-option parameters are not handled correctly. As the output is
600 .\"O fed to the shell script, the script does not know how it is supposed to break
601 .\"O the output into separate parameters. To circumvent this
602 .\"O problem, this implementation offers quoting. The idea is that output
603 .\"O is generated with quotes around each parameter. When this output is once
604 .\"O again fed to the shell (usually by a shell
606 .\"O command), it is split correctly into separate parameters.
607 ¸ß´¹¥â¡¼¥É¤Ç¤Ï¡¢°ú¤¿ô¤ä¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤Ë¤¢¤ë
608 ¶õÇò¤ä¡ÖÆüì¡×ʸ»ú¤ÏÀµ¤·¤¯°·¤ï¤ì¤Ê¤¤¡£
609 ¤³¤Î½ÐÎϤϥ·¥§¥ë¥¹¥¯¥ê¥×¥È¤ËÍ¿¤¨¤é¤ì¤ë¤Î¤Ç¡¢
610 ¥¹¥¯¥ê¥×¥È¤Ï¡¢½ÐÎϤò¤É¤Î¤è¤¦¤Ë¤·¤Æ¸Ä¡¹¤Î¥Ñ¥é¥á¡¼¥¿¤Ë
611 ʬ³ä¤¹¤Ù¤¤Ê¤Î¤«¤òÃΤé¤Ê¤¤¡£
612 ¤³¤ÎÌäÂê¤ò²óÈò¤¹¤ë¤¿¤á¡¢¤³¤Î¼ÂÁõ¤Ç¤Ï¥¯¥©¡¼¥Èµ¡Ç½¤òÄ󶡤¹¤ë¡£
613 ¤³¤ì¤Ï¡¢³Æ¥Ñ¥é¥á¡¼¥¿¤ò¥¯¥©¡¼¥È¤·¤Æ½ÐÎϤòÀ¸À®¤¹¤ë¡¢¤È¤¤¤¦¼êË¡¤ò¼è¤ë¡£
614 ¤³¤Î½ÐÎϤ¬¤â¤¦°ìÅÙ¥·¥§¥ë (Ä̾ï¤Ï¥·¥§¥ë¤Î
616 ¥³¥Þ¥ó¥É) ¤ËÍ¿¤¨¤é¤ì¤¿¾ì¹ç¡¢
617 ½ÐÎϤϸġ¹¤Î¥Ñ¥é¥á¡¼¥¿¤ËÀµ¤·¤¯Ê¬³ä¤µ¤ì¤ë¡£
619 .\"O Quoting is not enabled if the environment variable
620 .\"O .B GETOPT_COMPATIBLE
621 .\"O is set, if the first form of the
623 .\"O is used, or if the option
630 ¥»¥¯¥·¥ç¥ó¤ÎºÇ½é¤Î·Á¼°¤¬»È¤ï¤ì¤¿¾ì¹ç¡¦
632 ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢¥¯¥©¡¼¥È¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
634 .\"O Different shells use different quoting conventions. You can use the
636 .\"O option to select the shell you are using. The following shells are
637 .\"O currently supported:
643 .\"O Actually, only two `flavors' are distinguished: sh\-like quoting conventions
644 .\"O and csh\-like quoting conventions. Chances are that if you use another shell
645 .\"O script language, one of these flavors can still be used.
646 ¥¯¥©¡¼¥È¤Îµ¬Â§¤Ï¥·¥§¥ë¤´¤È¤Ë°Û¤Ê¤ë¡£
647 »ÈÍѤ·¤Æ¤¤¤ë¥·¥§¥ë¤òÁªÂò¤¹¤ë¤¿¤á¤Ë
649 ¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤³¤È¤¬¤Ç¤¤ë¡£
650 °Ê²¼¤Î¥·¥§¥ë¤ÇÀµ¤·¤¯µ¡Ç½¤¹¤ë:
655 ¼ÂºÝ¤Ë¤Ï¡¢2 ¤Ä¤Î¡ÖÊý¼°¡×¤ËʬÎव¤ì¤ë:
656 sh ¼°¤Î¥¯¥©¡¼¥Èµ¬Â§¤È csh ¼°¤Î¥¯¥©¡¼¥Èµ¬Â§¤Ç¤¢¤ë¡£
657 ¾¤Î¥·¥§¥ë¥¹¥¯¥ê¥×¥È¸À¸ì¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ç¤â¡¢
658 ¤³¤ì¤é¤ÎÊý¼°¤Î¤É¤Á¤é¤«¤¬»È¤¨¤ë²ÄǽÀ¤¬¤¢¤ë¡£
660 .\"O .SH "SCANNING MODES"
662 .\"O The first character of the short options string may be a
666 .\"O to indicate a special scanning mode. If the first calling form
669 .\"O is used they are ignored; the environment variable
670 .\"O .B POSIXLY_CORRECT
671 .\"O is still examined, though.
672 Æüì¤Ê¥¹¥¥ã¥ó¥â¡¼¥É¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¤¿¤á¤Ë¡¢
673 û¤¤¥ª¥×¥·¥ç¥ó¤ÎºÇ½é¤Îʸ»ú¤ò
679 ¥»¥¯¥·¥ç¥ó¤ÎºÇ½é¤Î¸Æ¤Ó½Ð¤··Á¼°¤¬»È¤ï¤ì¤¿¾ì¹ç¡¢¤³¤ì¤Ï̵»ë¤µ¤ì¤ë¡£
682 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ÏÄ´¤Ù¤é¤ì¤ë¡£
684 .\"O If the first character is
686 .\"O or if the environment variable
687 .\"O .B POSIXLY_CORRECT
688 .\"O is set, parsing stops as soon as the first non\-option parameter
689 .\"O (ie. a parameter that does not start with a
692 .\"O is not an option argument. The remaining parameters are all interpreted as
693 .\"O non\-option parameters.
696 ¤Î¾ì¹ç¡¢¤Þ¤¿¤Ï´Ä¶ÊÑ¿ô
698 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤ºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿
701 ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤¤¥Ñ¥é¥á¡¼¥¿) ¤¬
702 ¥ª¥×¥·¥ç¥ó°ú¤¿ô¤Ç¤Ê¤¤¤Èʬ¤«¤Ã¤¿»þÅÀ¤Ç²òÀϤϥ¹¥È¥Ã¥×¤¹¤ë¡£
703 ¤½¤ì°Ê¹ß¤ÎÁ´¤Æ¤Î¥Ñ¥é¥á¡¼¥¿¤Ï¡¢¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
705 .\"O If the first character is a
707 .\"O non\-option parameters are outputed at the place where they are found; in normal
708 .\"O operation, they are all collected at the end of output after a
710 .\"O parameter has been generated. Note that this
712 .\"O parameter is still generated, but it will always be the last parameter in
716 ¤Î¾ì¹ç¡¢¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤°ú¤¿ô¤Ï¸«¤Ä¤«¤Ã¤¿²Õ½ê¤Ç½ÐÎϤµ¤ì¤ë¡£
719 ¥Ñ¥é¥á¡¼¥¿¤¬À¸À®¤µ¤ì¤¿¸å¤Ç¡¢ºÇ¸å¤Ë¤Þ¤È¤á¤Æ½ÐÎϤµ¤ì¤ë¡£
722 ¥Ñ¥é¥á¡¼¥¿¤ÏÀ¸À®¤µ¤ì¤ë¤¬¡¢
723 Ä̾盧¤Î¥â¡¼¥É¤Ç¤ÏºÇ¸å¤Î¥Ñ¥é¥á¡¼¥¿¤Ë¤Ê¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
724 .\"O .SH COMPATIBILITY
728 .\"O is written to be as compatible as possible to
729 .\"O other versions. Usually you can just replace them with this version
730 .\"O without any modifications, and with some advantages.
733 ¤Ï¡¢½ÐÍè¤ë¤À¤±Â¾¤Î¥Ð¡¼¥¸¥ç¥ó¤È¸ß´¹À¤¬¤¢¤ë¤è¤¦¤Ë½ñ¤«¤ì¤¿¡£
734 Ä̾ï¤Ï¾¤Î¥Ð¡¼¥¸¥ç¥ó¤ò½¤Àµ¤¹¤ë¤³¤È¤Ê¤¯¡¢
735 ¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤ËÃÖ¤´¹¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¡£
736 ¹¹¤Ë¡¢¤¤¤¯¤Ä¤«¤ÎÍøÅÀ¤¬¤¢¤ë¡£
738 .\"O If the first character of the first parameter of getopt is not a
740 .\"O getopt goes into compatibility mode. It will interpret its first parameter as
741 .\"O the string of short options, and all other arguments will be parsed. It
742 .\"O will still do parameter shuffling (ie. all non\-option parameters are outputed
743 .\"O at the end), unless the environment variable
744 .\"O .B POSIXLY_CORRECT
746 getopt ¤ÎºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿¤ÎºÇ½é¤Îʸ»ú¤¬
748 ¤Ç¤Ê¤¤¾ì¹ç¡¢getopt ¤Ï¸ß´¹¥â¡¼¥É¤Ë¤Ê¤ë¡£
749 ºÇ½é¤Î¥Ñ¥é¥á¡¼¥¿¤Ïû¤¤¥ª¥×¥·¥ç¥ó¤Îʸ»úÎó¤È¤·¤Æ²ò¼á¤µ¤ì¡¢
750 ¾¤ÎÁ´¤Æ¤Î°ú¤¿ô¤¬²òÀϤµ¤ì¤ë¡£
751 ¤³¤Î¾ì¹ç¤Ç¤â¡¢´Ä¶ÊÑ¿ô
753 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¸Â¤ê¡¢¥Ñ¥é¥á¡¼¥¿¤ÎʤÙÂؤ¨¤ò¹Ô¤¦
754 (¤Ä¤Þ¤ê¡¢¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤Á´¤Æ¤Î¥Ñ¥é¥á¡¼¥¿¤¬ºÇ¸å¤Ë½ÐÎϤµ¤ì¤ë)¡£
756 .\"O The environment variable
757 .\"O .B GETOPT_COMPATIBLE
760 .\"O into compatibility mode. Setting both this environment variable and
761 .\"O .B POSIXLY_CORRECT
762 .\"O offers 100% compatibility for `difficult' programs. Usually, though,
763 .\"O neither is needed.
768 ¤ò¶¯À©Åª¤Ë¸ß´¹¥â¡¼¥É¤Ë¤¹¤ë¡£
771 ¤ÎξÊý¤òÀßÄꤹ¤ë¤È¡¢¡ÖÆñ¤·¤¤¡×¥×¥í¥°¥é¥à¤Î¤¿¤á¤Ë 100% ¤Î¸ß´¹À¤òÄ󶡤¹¤ë¡£
772 ¤·¤«¤·¡¢Ä̾ï¤Ï¤É¤Á¤é¤âÀßÄꤹ¤ëɬÍפ¬¤Ê¤¤¡£
774 .\"O In compatibility mode, leading
778 .\"O characters in the short options string are ignored.
779 ¸ß´¹¥â¡¼¥É¤Ç¤Ï¡¢Ã»¤¤¥ª¥×¥·¥ç¥óʸ»úÎó¤ÎºÇ½é¤ËÉÕ¤¯
784 .\"O .SH RETURN CODES
787 .\"O returns error code
789 .\"O for succesful parsing,
795 .\"O if it does not understand its own parameters,
797 .\"O if an internal error occurs like out\-of\-memory, and
799 .\"O if it is called with
807 ¤¬¥¨¥é¡¼¤òÊÖ¤·¤¿¾ì¹ç¤Ï
810 ¥Ñ¥é¥á¡¼¥¿¤¬Íý²ò¤Ç¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï
813 ¥á¥â¥ê¤¬Â¤ê¤Ê¤¤ (out\-of\-memory) ¤È¤¤¤Ã¤¿ÆâÉô¥¨¥é¡¼¤Î¾ì¹ç¤Ï
817 ¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤Æ¸Æ¤Ó½Ð¤µ¤ì¤¿¾ì¹ç¤Ï
822 .\"O Example scripts for (ba)sh and (t)csh are provided with the
824 .\"O distribution, and are optionally installed in
825 .\"O .B /usr/local/lib/getopt
827 .\"O .BR /usr/lib/getopt .
828 (ba)sh ¤È (t)csh ¤Ç¤Î»ÈÍÑÎã¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¢
830 ¥Ç¥£¥¹¥È¥ê¥Ó¥å¡¼¥·¥ç¥ó¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£
831 ¤³¤ì¤é¤Ï¥ª¥×¥·¥ç¥ó¤È¤·¤Æ
832 .B /usr/local/lib/getopt
835 ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¡£
839 .\"O This environment variable is examined by the
844 ¥ë¡¼¥Á¥ó¤ÇÄ´¤Ù¤é¤ì¤ë¡£
845 .\"O If it is set, parsing stops as soon as a parameter
846 .\"O is found that is not an option or an option argument. All remaining
847 .\"O parameters are also interpreted as non\-option parameters, regardless
848 .\"O whether they start with a
850 ¤³¤ì¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥Ñ¥é¥á¡¼¥¿¤¬¥ª¥×¥·¥ç¥ó¤Þ¤¿¤Ï
851 ¥ª¥×¥·¥ç¥ó°ú¤¿ô¤Ç¤Ê¤¤¤Èʬ¤«¤Ã¤¿»þÅÀ¤Ç²òÀϤÏÄä»ß¤¹¤ë¡£
852 ¤½¤ì°Ê¹ß¤ÎÁ´¤Æ¤Î¥Ñ¥é¥á¡¼¥¿¤Ï¡¢
854 ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ë´Ø·¸¤Ê¤¯¡¢
855 ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¥Ñ¥é¥á¡¼¥¿¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
856 .IP GETOPT_COMPATIBLE
859 .\"O to use the first calling format as specified in the
864 ¥»¥¯¥·¥ç¥ó¤ÎºÇ½é¤Î¸Æ¤Ó½Ð¤··Á¼°¤ò»È¤ï¤»¤ë¡£
868 .\"O can parse long options with optional arguments that are given an empty optional
869 .\"O argument (but can not do this for short options). This
871 .\"O treats optional arguments that are empty as if they were not present.
873 ¤Ï¡¢°ú¤¿ô¤ò¼è¤Ã¤Æ¤â¼è¤é¤Ê¤¯¤Æ¤â¤è¤¤Ä¹¤¤¥ª¥×¥·¥ç¥ó¤ò²òÀϤǤ¤ë
874 (¤¿¤À¤·¡¢Ã»¤¤¥ª¥×¥·¥ç¥ó¤Î¾ì¹ç¤Ï²òÀϤǤ¤Ê¤¤)¡£
877 ¤Ï¡¢¥ª¥×¥·¥ç¥ó°ú¤¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤½¤ì¤¬Â¸ºß¤·¤Ê¤¤¤â¤Î¤È¤·¤Æ°·¤¦¡£
879 .\"O The syntax if you do not want any short option variables at all is
880 .\"O not very intuitive (you have to set them explicitely to the empty
882 û¤¤¥ª¥×¥·¥ç¥óÊÑ¿ô¤òÁ´¤¯»È¤¤¤¿¤¯¤Ê¤¤¾ì¹ç¡¢
883 ½ñ¼°¤ÏÁ´¤¯Ä¾´¶Åª¤Ç¤Ê¤¤¤â¤Î¤Ë¤Ê¤ë
884 (ÌÀ¼¨Åª¤Ë¶õ¤Îʸ»úÎó¤ËÀßÄꤹ¤ëɬÍפ¬¤¢¤ë)¡£
888 Frodo Looijaard <frodol@dds.nl>