/[public]/getopt/tags/VERSION_1_1_6/getopt.1
ViewVC logotype

Diff of /getopt/tags/VERSION_1_1_6/getopt.1

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 263 Revision 324
1.TH GETOPT 1 "May 31, 1997" Linux "" 1.TH GETOPT 1 "May 31, 1997" Linux ""
2.SH NAME 2.SH NAME
3getopt \- parse command options (enhanced) 3getopt \- parse command options (enhanced)
4.SH SYNOPSIS 4.SH SYNOPSIS
5.B getopt
5.BR getopt " optstring parameters" 6.I optstring parameters
6 7.br
7.BR getopt " [options] [" \-\- "] optstring parameters" 8.B getopt
8 9.RI [ options ]
9.BR getopt " [options] " \-o | \-\-options " optstring [options] [" \-\- "] parameters" 10.RB [ \-\- ]
11.I optstring parameters
12.br
13.B getopt
14.RI [ options ]
15.BR \-o | \-\-options
16.I optstring
17.RI [ options ]
18.RB [ \-\- ]
19.I parameters
10.SH DESCRIPTION 20.SH DESCRIPTION
11.B getopt 21.B getopt
12is used to break up 22is used to break up
13.RI ( parse ) 23.RI ( parse )
14options in command lines for easy parsing by 24options in command lines for easy parsing by
15shell procedures, and to check for legal options. 25shell procedures, and to check for legal options.
16It uses the 26It uses the
17.SM GNU 27.SM GNU
18.BR getopt (3) 28.BR getopt (3)
19routines to do this. 29routines to do this.
20 30
21The parameters 31The parameters
22.B getopt 32.B getopt
23is called with can be divided into two parts: options 33is called with can be divided into two parts: options
24which modify the way getopt will parse 34which modify the way getopt will parse
25.RI ( options 35.RI ( options
26and 36and
27.I \-o|\-\-options optstring 37.BR \-o | \-\-options
38.I optstring
28in the 39in the
29.BR SYNOPSIS), 40.BR SYNOPSIS ),
30and the parameters which are to be 41and the parameters which are to be
31parsed 42parsed
32.RI ( parameters 43.RI ( parameters
33in the 44in the
34.BR SYNOPSIS). 45.BR SYNOPSIS ).
35The second part will start at the first non\-option parameter 46The second part will start at the first non\-option parameter
36that is not an option argument, or after the first occurrence of 47that is not an option argument, or after the first occurrence of
37.RB ` \-\- '. 48.RB ` \-\- '.
38If no 49If no
39.RB ` \-o ' 50.RB ` \-o '
40or 51or
41.RB ` \-\-options ' 52.RB ` \-\-options '
42option is found in the first part, the first 53option is found in the first part, the first
43parameter of the second part is used as the short options string. 54parameter of the second part is used as the short options string.
44 55
45If the environment variable 56If the environment variable
46.B GETOPT_COMPATIBLE 57.B GETOPT_COMPATIBLE
47is set, or if its first parameter 58is set, or if its first parameter
48is not an option (does not start with a 59is not an option (does not start with a
49.RB ` \- ', 60.RB ` \- ',
50this is the first format in the 61this is the first format in the
51.BR SYNOPSIS), 62.BR SYNOPSIS ),
52.B getopt 63.B getopt
53will generate output that is compatible with that of other versions of 64will generate output that is compatible with that of other versions of
54.BR getopt (1). 65.BR getopt (1).
55It will still do parameter shuffling and recognize optional 66It will still do parameter shuffling and recognize optional
56arguments (see section 67arguments (see section
57.B COMPATIBILITY 68.B COMPATIBILITY
58for more information). 69for more information).
59 70
60Traditional implementations of 71Traditional implementations of
61.BR getopt (1) 72.BR getopt (1)
62are unable to cope with whitespace and other (shell\-specific) special characters 73are unable to cope with whitespace and other (shell\-specific) special characters
63in arguments and non\-option parameters. To solve this problem, this 74in arguments and non\-option parameters. To solve this problem, this
64implementation can generate 75implementation can generate
65quoted output which must once again be interpreted by the shell (usually 76quoted output which must once again be interpreted by the shell (usually
66by using the 77by using the
67.B eval 78.B eval
68command). This has the effect of preserving those characters, but 79command). This has the effect of preserving those characters, but
69you must call 80you must call
70.B getopt 81.B getopt
71in a way that is no longer compatible with other versions (the second 82in a way that is no longer compatible with other versions (the second
72or third format in the 83or third format in the
73.BR SYNOPSIS). 84.BR SYNOPSIS ).
74To determine whether this enhanced version of 85To determine whether this enhanced version of
75.BR getopt (1) 86.BR getopt (1)
76is installed, a special test option 87is installed, a special test option
77.RB ( \-T ) 88.RB ( \-T )
78can be used. 89can be used.
79.SH OPTIONS 90.SH OPTIONS
91.TP
80.IP "\-a, \-\-alternative" 92.BR \-a , " \-\-alternative"
81Allow long options to start with a single 93Allow long options to start with a single
82.RB ` \- '. 94.RB ` \- '.
95.TP
83.IP "\-h, \-\-help" 96.BR \-h , " \-\-help"
84Output a small usage guide and exit succesfully. No other output is generated. 97Output a small usage guide and exit successfully. No other output is generated.
98.TP
85.IP "\-l, \-\-longoptions longopts" 99.BR \-l , " \-\-longoptions \fIlongopts\fP"
86The long (multi\-character) options to be recognized. 100The long (multi\-character) options to be recognized.
87More than one option name 101More than one option name
88may be specified at once, by separating the names with commas. This option 102may be specified at once, by separating the names with commas. This option
89may be given more than once, the 103may be given more than once, the
90.I longopts 104.I longopts
91are cumulative. 105are cumulative.
92Each long option name 106Each long option name
93in 107in
94.I longopts 108.I longopts
95may be followed by one colon to indicate it has a required argument,and by two colons to indicate it has an optional argument. 109may be followed by one colon to indicate it has a required argument, and by two colons to indicate it has an optional argument.
110.TP
96.IP "\-n, \-\-name progname" 111.BR \-n , " \-\-name \fIprogname\fP"
97The name that will be used by the 112The name that will be used by the
98.BR getopt (3) 113.BR getopt (3)
99routines when it reports errors. Note that errors of 114routines when it reports errors. Note that errors of
100.BR getopt (1) 115.BR getopt (1)
101are still reported as coming from getopt. 116are still reported as coming from getopt.
117.TP
102.IP "\-o, \-\-options shortopts" 118.BR \-o , " \-\-options \fIshortopts\fP"
103The short (one\-character) options to be recognized. If this option is not 119The short (one\-character) options to be recognized. If this option is not
104found, the first parameter of 120found, the first parameter of
105.B getopt 121.B getopt
106that does not start with 122that does not start with
107a 123a
108.RB ` \- ' 124.RB ` \- '
109(and is not an option argument) is used as the short options string. 125(and is not an option argument) is used as the short options string.
110Each short option character 126Each short option character
111in 127in
112.I shortopts 128.I shortopts
113may be followed by one colon to indicate it has a required argument, 129may be followed by one colon to indicate it has a required argument,
114and by two colons to indicate it has an optional argument. 130and by two colons to indicate it has an optional argument.
115The first character of shortopts may be 131The first character of shortopts may be
116.RB ` + ' 132.RB ` + '
117or 133or
118.RB ` \- ' 134.RB ` \- '
119to influence the way 135to influence the way
120options are parsed and output is generated (see section 136options are parsed and output is generated (see section
121.B SCANNING MODES 137.B SCANNING MODES
122for details). 138for details).
139.TP
123.IP "\-q, \-\-quiet" 140.BR \-q , " \-\-quiet"
124Disable error reporting by getopt(3). 141Disable error reporting by getopt(3).
142.TP
125.IP "\-Q, \-\-quiet\-output" 143.BR \-Q , " \-\-quiet\-output"
126Do not generate normal output. Errors are still reported by 144Do not generate normal output. Errors are still reported by
127.BR getopt (3), 145.BR getopt (3),
128unless you also use 146unless you also use
129.IR \-q . 147.IR \-q .
130.IP "\-s, \-\-shell shell" 148.TP
149.BR \-s , " \-\-shell \fIshell\fP"
131Set quoting conventions to those of shell. If no \-s argument is found, 150Set quoting conventions to those of shell. If no \-s argument is found,
132the 151the
133.SM BASH 152.SM BASH
134conventions are used. Valid arguments are currently 153conventions are used. Valid arguments are currently
135.RB ` sh ' 154.RB ` sh '
136.RB ` bash ', 155.RB ` bash ',
137.RB ` csh ', 156.RB ` csh ',
138and 157and
139.RB ` tcsh '. 158.RB ` tcsh '.
159.TP
140.IP "\-u, \-\-unquoted" 160.BR \-u , " \-\-unquoted"
141Do not quote the output. Note that whitespace and special (shell\-dependent) 161Do not quote the output. Note that whitespace and special (shell\-dependent)
142characters can cause havoc in this mode (like they do with other 162characters can cause havoc in this mode (like they do with other
143.BR getopt (1) 163.BR getopt (1)
144implementations). 164implementations).
145.IP "\-T \-\-test" 165.TP
166.BR \-T , " \-\-test"
146Test if your 167Test if your
147.BR getopt (1) 168.BR getopt (1)
148is this enhanced version or an old version. This generates no output, 169is this enhanced version or an old version. This generates no output,
149and sets the error status to 4. Other implementations of 170and sets the error status to 4. Other implementations of
150.BR getopt (1), 171.BR getopt (1),
151and this version if the environment variable 172and this version if the environment variable
152.B GETOPT_COMPATIBLE 173.B GETOPT_COMPATIBLE
153is set, 174is set,
154will return 175will return
155.RB ` \-\- ' 176.RB ` \-\- '
156and error status 0. 177and error status 0.
178.TP
157.IP "\-V, \-\-version" 179.BR \-V , " \-\-version"
158Output version information and exit succesfully. No other output is generated. 180Output version information and exit successfully. No other output is generated.
159.SH PARSING 181.SH PARSING
160This section specifies the format of the second part of the parameters of 182This section specifies the format of the second part of the parameters of
161.B getopt 183.B getopt
162(the 184(the
163.I parameters 185.I parameters
164in the 186in the
165.BR SYNOPSIS ). 187.BR SYNOPSIS ).
166The next section 188The next section
167.RB ( OUTPUT ) 189.RB ( OUTPUT )
168describes the output that is 190describes the output that is
169generated. These parameters were typically the parameters a shell function 191generated. These parameters were typically the parameters a shell function
170was called with. 192was called with.
171Care must be taken that each parameter the shell function was 193Care must be taken that each parameter the shell function was
172called with corresponds to exactly one parameter in the parameter list of 194called with corresponds to exactly one parameter in the parameter list of
173.B getopt 195.B getopt
174(see the 196(see the
175.BR EXAMPLES ). 197.BR EXAMPLES ).
176All parsing is done by the GNU 198All parsing is done by the GNU
177.BR getopt (3) 199.BR getopt (3)
178routines. 200routines.
179 201
180The parameters are parsed from left to right. Each parameter is classified as a 202The parameters are parsed from left to right. Each parameter is classified as a
181short option, a long option, an argument to an option, 203short option, a long option, an argument to an option,
182or a non\-option parameter. 204or a non\-option parameter.
183 205
184A simple short option is a 206A simple short option is a
185.RB ` \- ' 207.RB ` \- '
186followed by a short option character. If 208followed by a short option character. If
187the option has a required argument, it may be written directly after the option 209the option has a required argument, it may be written directly after the option
188character or as the next parameter (ie. separated by whitespace on the 210character or as the next parameter (ie. separated by whitespace on the
189command line). If the 211command line). If the
190option has an optional argument, it must be written directly after the 212option has an optional argument, it must be written directly after the
191option character if present. 213option character if present.
192 214
193It is possible to specify several short options after one 215It is possible to specify several short options after one
194.RB ` \- ', 216.RB ` \- ',
195as long as all (except possibly the last) do not have required or optional 217as long as all (except possibly the last) do not have required or optional
196arguments. 218arguments.
197 219
198A long option normally begins with 220A long option normally begins with
199.RB ` \-\- ' 221.RB ` \-\- '
200followed by the long option name. 222followed by the long option name.
201If the option has a required argument, it may be written directly after 223If the option has a required argument, it may be written directly after
202the long option name, separated by 224the long option name, separated by
203.RB ` = ', 225.RB ` = ',
204or as the next argument (ie. separated by whitespace on the command line). 226or as the next argument (ie. separated by whitespace on the command line).
205If the option has an optional argument, it must 227If the option has an optional argument, it must
206be written directly after the long option name, separated by 228be written directly after the long option name, separated by
207.RB ` = ', 229.RB ` = ',
208if present (if you add the 230if present (if you add the
209.RB ` = ' 231.RB ` = '
210but nothing behind it, it is interpreted 232but nothing behind it, it is interpreted
211as if no argument was present; this is a slight bug, see the 233as if no argument was present; this is a slight bug, see the
212.BR BUGS ). 234.BR BUGS ).
213Long options may be abbreviated, as long as the abbreviation is not 235Long options may be abbreviated, as long as the abbreviation is not
214ambiguous. 236ambiguous.
215 237
216Each parameter not starting with a 238Each parameter not starting with a
217.RB ` \- ', 239.RB ` \- ',
218and not a required argument of 240and not a required argument of
219a previous option, is a non\-option parameter. Each parameter after 241a previous option, is a non\-option parameter. Each parameter after
220a 242a
221.RB ` \-\- ' 243.RB ` \-\- '
222parameter is always interpreted as a non\-option parameter. 244parameter is always interpreted as a non\-option parameter.
223If the environment variable 245If the environment variable
224.B POSIXLY_CORRECT 246.B POSIXLY_CORRECT
225is set, or if the short 247is set, or if the short
226option string started with a 248option string started with a
227.RB ` + ', 249.RB ` + ',
228all remaining parameters are interpreted 250all remaining parameters are interpreted
229as non\-option parameters as soon as the first non\-option parameter is 251as non\-option parameters as soon as the first non\-option parameter is
230found. 252found.
231.SH OUTPUT 253.SH OUTPUT
232Output is generated for each element described in the previous section. 254Output is generated for each element described in the previous section.
233Output is done 255Output is done
234in the same order as the elements are specified in the input, except 256in the same order as the elements are specified in the input, except
235for non\-option parameters. Output can be done in 257for non\-option parameters. Output can be done in
236.I compatible 258.I compatible
237.RI ( unquoted ) 259.RI ( unquoted )
238mode, or in such way that whitespace and other special characters within 260mode, or in such way that whitespace and other special characters within
239arguments and non\-option parameters are preserved (see 261arguments and non\-option parameters are preserved (see
240.BR QUOTING ). 262.BR QUOTING ).
241When the output is processed in the shell script, it will seem to be 263When the output is processed in the shell script, it will seem to be
242composed of distinct elements that can be processed one by one (by using the 264composed of distinct elements that can be processed one by one (by using the
243shift command in most shell languages). This is imperfect in unquoted mode, 265shift command in most shell languages). This is imperfect in unquoted mode,
244as elements can be split at unexpected places if they contain whitespace 266as elements can be split at unexpected places if they contain whitespace
247If there are problems parsing the parameters, for example because a 269If there are problems parsing the parameters, for example because a
248required argument is not found or an option is not recognized, an error 270required argument is not found or an option is not recognized, an error
249will be reported on stderr, there will be no output for the offending 271will be reported on stderr, there will be no output for the offending
250element, and a non\-zero error status is returned. 272element, and a non\-zero error status is returned.
251 273
252For a short option, a single 274For a short option, a single
253.RB ` \- ' 275.RB ` \- '
254and the option character are generated 276and the option character are generated
255as one parameter. If the option has an argument, the next 277as one parameter. If the option has an argument, the next
256parameter will be the argument. If the option takes an optional argument, 278parameter will be the argument. If the option takes an optional argument,
257but none was found, the next parameter will be generated but be empty in 279but none was found, the next parameter will be generated but be empty in
258quoting mode, 280quoting mode,
259but no second parameter will be generated in unquoted (compatible) mode. 281but no second parameter will be generated in unquoted (compatible) mode.
260Note that many other 282Note that many other
261.BR getopt (1) 283.BR getopt (1)
262implemetations do not support optional arguments. 284implementations do not support optional arguments.
263 285
264If several short options were specified after a single 286If several short options were specified after a single
265.RB ` \- ', 287.RB ` \- ',
266each will be present in the output as a separate parameter. 288each will be present in the output as a separate parameter.
267 289
268For a long option, 290For a long option,
269.RB ` \-\- ' 291.RB ` \-\- '
270and the full option name are generated as one 292and the full option name are generated as one
271parameter. This is done regardless whether the option was abbreviated or 293parameter. This is done regardless whether the option was abbreviated or
272specified with a single 294specified with a single
273.RB ` \- ' 295.RB ` \- '
274in the input. Arguments are handled as with short options. 296in the input. Arguments are handled as with short options.
275 297
276Normally, no non\-option parameters output is generated until all options 298Normally, no non\-option parameters output is generated until all options
277and their arguments have been generated. Then 299and their arguments have been generated. Then
278.RB ` \-\- ' 300.RB ` \-\- '
279is generated as a 301is generated as a
280single parameter, and after it the non\-option parameters in the order 302single parameter, and after it the non\-option parameters in the order
281they were found, each as a separate parameter. 303they were found, each as a separate parameter.
282Only if the first character of the short options string was a 304Only if the first character of the short options string was a
283.RB ` \- ', 305.RB ` \- ',
284non\-option parameter output is generated at the place they are found in the 306non\-option parameter output is generated at the place they are found in the
285input (this is not supported if the first format of the 307input (this is not supported if the first format of the
286.B SYNOPSIS 308.B SYNOPSIS
287is used; in that case all preceding occurrences of 309is used; in that case all preceding occurrences of
288.RB ` \- ' 310.RB ` \- '
289and 311and
290.RB ` + ' 312.RB ` + '
291are ignored). 313are ignored).
292.SH QUOTING 314.SH QUOTING
293In compatible mode, whitespace or 'special' characters in arguments or 315In compatible mode, whitespace or 'special' characters in arguments or
294non\-option parameters are not handled correctly. As the output is 316non\-option parameters are not handled correctly. As the output is
295fed to the shell script, the script does not know how it is supposed to break 317fed to the shell script, the script does not know how it is supposed to break
296the output into separate parameters. To circumvent this 318the output into separate parameters. To circumvent this
297problem, this implementation offers quoting. The idea is that output 319problem, this implementation offers quoting. The idea is that output
298is generated with quotes around each parameter. When this output is once 320is generated with quotes around each parameter. When this output is once
299again fed to the shell (usually by a shell 321again fed to the shell (usually by a shell
300.B eval 322.B eval
301command), it is split correctly into separate parameters. 323command), it is split correctly into separate parameters.
302 324
303Quoting is not enabled if the environment variable 325Quoting is not enabled if the environment variable
304.B GETOPT_COMPATIBLE 326.B GETOPT_COMPATIBLE
305is set, if the first form of the 327is set, if the first form of the
306.B SYNOPSIS 328.B SYNOPSIS
307is used, or if the option 329is used, or if the option
308.RB ` \-u ' 330.RB ` \-u '
309is found. 331is found.
310 332
311Different shells use different quoting conventions. You can use the 333Different shells use different quoting conventions. You can use the
312.RB ` \-s ' 334.RB ` \-s '
313option to select the shell you are using. The following shells are 335option to select the shell you are using. The following shells are
314currently supported: 336currently supported:
315.RB ` sh ', 337.RB ` sh ',
316.RB ` bash ', 338.RB ` bash ',
317.RB ` csh ' 339.RB ` csh '
318and 340and
319.RB ` tcsh '. 341.RB ` tcsh '.
320Actually, only two `flavors' are distinguished: sh\-like quoting conventions 342Actually, only two `flavors' are distinguished: sh\-like quoting conventions
321and csh\-like quoting conventions. Chances are that if you use another shell 343and csh\-like quoting conventions. Chances are that if you use another shell
322script language, one of these flavors can still be used. 344script language, one of these flavors can still be used.
323 345
324.SH "SCANNING MODES" 346.SH "SCANNING MODES"
325The first character of the short options string may be a 347The first character of the short options string may be a
326.RB ` \- ' 348.RB ` \- '
327or a 349or a
328.RB ` + ' 350.RB ` + '
329to indicate a special scanning mode. If the first calling form 351to indicate a special scanning mode. If the first calling form
330in the 352in the
331.B SYNOPSIS 353.B SYNOPSIS
332is used they are ignored; the environment variable 354is used they are ignored; the environment variable
333.B POSIXLY_CORRECT 355.B POSIXLY_CORRECT
334is still examined, though. 356is still examined, though.
335 357
336If the first character is 358If the first character is
337.RB ` + ', 359.RB ` + ',
338or if the environment variable 360or if the environment variable
339.B POSIXLY_CORRECT 361.B POSIXLY_CORRECT
340is set, parsing stops as soon as the first non\-option parameter 362is set, parsing stops as soon as the first non\-option parameter
341(ie. a parameter that does not start with a 363(ie. a parameter that does not start with a
342.RB ` \- ') 364.RB ` \- ')
343is found that 365is found that
344is not an option argument. The remaining parameters are all interpreted as 366is not an option argument. The remaining parameters are all interpreted as
345non\-option parameters. 367non\-option parameters.
346 368
347If the first character is a 369If the first character is a
348.RB ` \- ', 370.RB ` \- ',
349non\-option parameters are outputed at the place where they are found; in normal 371non\-option parameters are outputted at the place where they are found; in normal
350operation, they are all collected at the end of output after a 372operation, they are all collected at the end of output after a
351.RB ` \-\- ' 373.RB ` \-\- '
352parameter has been generated. Note that this 374parameter has been generated. Note that this
353.RB ` \-\- ' 375.RB ` \-\- '
354parameter is still generated, but it will always be the last parameter in 376parameter is still generated, but it will always be the last parameter in
355this mode. 377this mode.
356.SH COMPATIBILITY 378.SH COMPATIBILITY
357This version of 379This version of
358.BR getopt (1) 380.BR getopt (1)
359is written to be as compatible as possible to 381is written to be as compatible as possible to
360other versions. Usually you can just replace them with this version 382other versions. Usually you can just replace them with this version
361without any modifications, and with some advantages. 383without any modifications, and with some advantages.
362 384
363If the first character of the first parameter of getopt is not a 385If the first character of the first parameter of getopt is not a
364.RB ` \- ', 386.RB ` \- ',
365getopt goes into compatibility mode. It will interpret its first parameter as 387getopt goes into compatibility mode. It will interpret its first parameter as
366the string of short options, and all other arguments will be parsed. It 388the string of short options, and all other arguments will be parsed. It
367will still do parameter shuffling (ie. all non\-option parameters are outputed 389will still do parameter shuffling (ie. all non\-option parameters are outputted
368at the end), unless the environment variable 390at the end), unless the environment variable
369.B POSIXLY_CORRECT 391.B POSIXLY_CORRECT
370is set. 392is set.
371 393
372The environment variable 394The environment variable
373.B GETOPT_COMPATIBLE 395.B GETOPT_COMPATIBLE
374forces 396forces
375.B getopt 397.B getopt
376into compatibility mode. Setting both this environment variable and 398into compatibility mode. Setting both this environment variable and
377.B POSIXLY_CORRECT 399.B POSIXLY_CORRECT
378offers 100% compatibility for `difficult' programs. Usually, though, 400offers 100% compatibility for `difficult' programs. Usually, though,
379neither is needed. 401neither is needed.
380 402
381In compatibility mode, leading 403In compatibility mode, leading
382.RB ` \- ' 404.RB ` \- '
383and 405and
384.RB ` + ' 406.RB ` + '
385characters in the short options string are ignored. 407characters in the short options string are ignored.
386.SH RETURN CODES 408.SH RETURN CODES
387.B getopt 409.B getopt
388returns error code 410returns error code
389.B 0 411.B 0
390for succesful parsing, 412for successful parsing,
391.B 1 413.B 1
392if 414if
393.BR getopt (3) 415.BR getopt (3)
394returns errors, 416returns errors,
395.B 2 417.B 2
396if it does not understand its own parameters, 418if it does not understand its own parameters,
397.B 3 419.B 3
398if an internal error occurs like out\-of\-memory, and 420if an internal error occurs like out\-of\-memory, and
399.B 4 421.B 4
400if it is called with 422if it is called with
401.BR \-T . 423.BR \-T .
402.SH EXAMPLES 424.SH EXAMPLES
403Example scripts for (ba)sh and (t)csh are provided with the 425Example scripts for (ba)sh and (t)csh are provided with the
404.BR getopt (1) 426.BR getopt (1)
405distribution, and are optionally installed in 427distribution, and are optionally installed in
406.B /usr/local/lib/getopt 428.B /usr/local/share/getopt
407or 429or
408.BR /usr/lib/getopt . 430.BR /usr/share/getopt .
431
409.SH ENVIRONMENT 432.SH ENVIRONMENT
410.IP POSIXLY_CORRECT 433.IP POSIXLY_CORRECT
411This environment variable is examined by the 434This environment variable is examined by the
412.BR getopt (3) 435.BR getopt (3)
413routines. 436routines.
414If it is set, parsing stops as soon as a parameter 437If it is set, parsing stops as soon as a parameter
415is found that is not an option or an option argument. All remaining 438is found that is not an option or an option argument. All remaining
416parameters are also interpreted as non\-option parameters, regardless 439parameters are also interpreted as non\-option parameters, regardless
417whether they start with a 440whether they start with a
418.RB ` \- '. 441.RB ` \- '.
419.IP GETOPT_COMPATIBLE 442.IP GETOPT_COMPATIBLE
420Forces 443Forces
421.B getopt 444.B getopt
422to use the first calling format as specified in the 445to use the first calling format as specified in the
423.BR SYNOPSIS . 446.BR SYNOPSIS .
424.SH BUGS 447.SH BUGS
425.BR getopt (3) 448.BR getopt (3)
426can parse long options with optional arguments that are given an empty optional 449can parse long options with optional arguments that are given an empty optional
427argument (but can not do this for short options). This 450argument (but can not do this for short options). This
428.BR getopt (1) 451.BR getopt (1)
429treats optional arguments that are empty as if they were not present. 452treats optional arguments that are empty as if they were not present.
430 453
431The syntax if you do not want any short option variables at all is 454The syntax if you do not want any short option variables at all is
432not very intuitive (you have to set them explicitely to the empty 455not very intuitive (you have to set them explicitly to the empty
433string). 456string).
434 457
435.SH AUTHOR 458.SH AUTHOR
436Frodo Looijaard <frodo@frodo.looijaard.name> 459Frodo Looijaard <frodo@frodo.looijaard.name>
437.SH "SEE ALSO" 460.SH "SEE ALSO"

Legend:
Removed from v.263  
changed lines
  Added in v.324

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26