diff options
Diffstat (limited to 'gl/getopt_int.h')
-rw-r--r-- | gl/getopt_int.h | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/gl/getopt_int.h b/gl/getopt_int.h index 169def5..980b750 100644 --- a/gl/getopt_int.h +++ b/gl/getopt_int.h | |||
@@ -30,6 +30,40 @@ extern int _getopt_internal (int ___argc, char **___argv, | |||
30 | /* Reentrant versions which can handle parsing multiple argument | 30 | /* Reentrant versions which can handle parsing multiple argument |
31 | vectors at the same time. */ | 31 | vectors at the same time. */ |
32 | 32 | ||
33 | /* Describe how to deal with options that follow non-option ARGV-elements. | ||
34 | |||
35 | If the caller did not specify anything, | ||
36 | the default is REQUIRE_ORDER if the environment variable | ||
37 | POSIXLY_CORRECT is defined, PERMUTE otherwise. | ||
38 | |||
39 | REQUIRE_ORDER means don't recognize them as options; | ||
40 | stop option processing when the first non-option is seen. | ||
41 | This is what Unix does. | ||
42 | This mode of operation is selected by either setting the environment | ||
43 | variable POSIXLY_CORRECT, or using `+' as the first character | ||
44 | of the list of option characters, or by calling getopt. | ||
45 | |||
46 | PERMUTE is the default. We permute the contents of ARGV as we | ||
47 | scan, so that eventually all the non-options are at the end. | ||
48 | This allows options to be given in any order, even with programs | ||
49 | that were not written to expect this. | ||
50 | |||
51 | RETURN_IN_ORDER is an option available to programs that were | ||
52 | written to expect options and other ARGV-elements in any order | ||
53 | and that care about the ordering of the two. We describe each | ||
54 | non-option ARGV-element as if it were the argument of an option | ||
55 | with character code 1. Using `-' as the first character of the | ||
56 | list of option characters selects this mode of operation. | ||
57 | |||
58 | The special argument `--' forces an end of option-scanning regardless | ||
59 | of the value of `ordering'. In the case of RETURN_IN_ORDER, only | ||
60 | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ | ||
61 | |||
62 | enum __ord | ||
63 | { | ||
64 | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER | ||
65 | }; | ||
66 | |||
33 | /* Data type for reentrant functions. */ | 67 | /* Data type for reentrant functions. */ |
34 | struct _getopt_data | 68 | struct _getopt_data |
35 | { | 69 | { |
@@ -54,39 +88,8 @@ struct _getopt_data | |||
54 | by advancing to the next ARGV-element. */ | 88 | by advancing to the next ARGV-element. */ |
55 | char *__nextchar; | 89 | char *__nextchar; |
56 | 90 | ||
57 | /* Describe how to deal with options that follow non-option ARGV-elements. | 91 | /* See __ord above. */ |
58 | 92 | enum __ord __ordering; | |
59 | If the caller did not specify anything, | ||
60 | the default is REQUIRE_ORDER if the environment variable | ||
61 | POSIXLY_CORRECT is defined, PERMUTE otherwise. | ||
62 | |||
63 | REQUIRE_ORDER means don't recognize them as options; | ||
64 | stop option processing when the first non-option is seen. | ||
65 | This is what Unix does. | ||
66 | This mode of operation is selected by either setting the environment | ||
67 | variable POSIXLY_CORRECT, or using `+' as the first character | ||
68 | of the list of option characters, or by calling getopt. | ||
69 | |||
70 | PERMUTE is the default. We permute the contents of ARGV as we | ||
71 | scan, so that eventually all the non-options are at the end. | ||
72 | This allows options to be given in any order, even with programs | ||
73 | that were not written to expect this. | ||
74 | |||
75 | RETURN_IN_ORDER is an option available to programs that were | ||
76 | written to expect options and other ARGV-elements in any order | ||
77 | and that care about the ordering of the two. We describe each | ||
78 | non-option ARGV-element as if it were the argument of an option | ||
79 | with character code 1. Using `-' as the first character of the | ||
80 | list of option characters selects this mode of operation. | ||
81 | |||
82 | The special argument `--' forces an end of option-scanning regardless | ||
83 | of the value of `ordering'. In the case of RETURN_IN_ORDER, only | ||
84 | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ | ||
85 | |||
86 | enum | ||
87 | { | ||
88 | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER | ||
89 | } __ordering; | ||
90 | 93 | ||
91 | /* If the POSIXLY_CORRECT environment variable is set | 94 | /* If the POSIXLY_CORRECT environment variable is set |
92 | or getopt was called. */ | 95 | or getopt was called. */ |