# | Line 3 | Line 3 | |
---|---|---|
3 | "Keep this file name-space clean" means, talk to drepper@gnu.org | |
4 | before changing it! | |
5 | Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 | |
6 | < | Free Software Foundation, Inc. |
6 | > | Free Software Foundation, Inc. |
7 | This file is part of the GNU C Library. | |
8 | ||
9 | The GNU C Library is free software; you can redistribute it and/or | |
# | Line 155 | Line 155 | int optopt = '?'; | |
155 | ||
156 | /* Describe how to deal with options that follow non-option ARGV-elements. | |
157 | ||
158 | < | If the caller did not specify anything, |
159 | < | the default is REQUIRE_ORDER if the environment variable |
160 | < | POSIXLY_CORRECT is defined, PERMUTE otherwise. |
158 | > | If the caller did not specify anything, |
159 | > | the default is REQUIRE_ORDER if the environment variable |
160 | > | POSIXLY_CORRECT is defined, PERMUTE otherwise. |
161 | ||
162 | < | REQUIRE_ORDER means don't recognize them as options; |
163 | < | stop option processing when the first non-option is seen. |
164 | < | This is what Unix does. |
165 | < | This mode of operation is selected by either setting the environment |
166 | < | variable POSIXLY_CORRECT, or using `+' as the first character |
167 | < | of the list of option characters. |
162 | > | REQUIRE_ORDER means don't recognize them as options; |
163 | > | stop option processing when the first non-option is seen. |
164 | > | This is what Unix does. |
165 | > | This mode of operation is selected by either setting the environment |
166 | > | variable POSIXLY_CORRECT, or using `+' as the first character |
167 | > | of the list of option characters. |
168 | ||
169 | < | PERMUTE is the default. We permute the contents of ARGV as we scan, |
170 | < | so that eventually all the non-options are at the end. This allows options |
171 | < | to be given in any order, even with programs that were not written to |
172 | < | expect this. |
169 | > | PERMUTE is the default. We permute the contents of ARGV as we scan, |
170 | > | so that eventually all the non-options are at the end. This allows options |
171 | > | to be given in any order, even with programs that were not written to |
172 | > | expect this. |
173 | ||
174 | < | RETURN_IN_ORDER is an option available to programs that were written |
175 | < | to expect options and other ARGV-elements in any order and that care about |
176 | < | the ordering of the two. We describe each non-option ARGV-element |
177 | < | as if it were the argument of an option with character code 1. |
178 | < | Using `-' as the first character of the list of option characters |
179 | < | selects this mode of operation. |
174 | > | RETURN_IN_ORDER is an option available to programs that were written |
175 | > | to expect options and other ARGV-elements in any order and that care about |
176 | > | the ordering of the two. We describe each non-option ARGV-element |
177 | > | as if it were the argument of an option with character code 1. |
178 | > | Using `-' as the first character of the list of option characters |
179 | > | selects this mode of operation. |
180 | ||
181 | < | The special argument `--' forces an end of option-scanning regardless |
182 | < | of the value of `ordering'. In the case of RETURN_IN_ORDER, only |
183 | < | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ |
181 | > | The special argument `--' forces an end of option-scanning regardless |
182 | > | of the value of `ordering'. In the case of RETURN_IN_ORDER, only |
183 | > | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ |
184 | ||
185 | static enum | |
186 | < | { |
187 | < | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER |
188 | < | } ordering; |
186 | > | { |
187 | > | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER |
188 | > | } ordering; |
189 | ||
190 | /* Value of POSIXLY_CORRECT environment variable. */ | |
191 | static char *posixly_correct; | |
# | Line 268 | Line 268 | static int nonoption_flags_len; | |
268 | # endif | |
269 | ||
270 | # ifdef USE_NONOPTION_FLAGS | |
271 | < | # define SWAP_FLAGS(ch1, ch2) \ |
272 | < | if (nonoption_flags_len > 0) \ |
273 | < | { \ |
274 | < | char __tmp = __getopt_nonoption_flags[ch1]; \ |
275 | < | __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ |
276 | < | __getopt_nonoption_flags[ch2] = __tmp; \ |
271 | > | # define SWAP_FLAGS(ch1, ch2) \ |
272 | > | if (nonoption_flags_len > 0) \ |
273 | > | { \ |
274 | > | char __tmp = __getopt_nonoption_flags[ch1]; \ |
275 | > | __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ |
276 | > | __getopt_nonoption_flags[ch2] = __tmp; \ |
277 | } | |
278 | # else | |
279 | # define SWAP_FLAGS(ch1, ch2) | |
# | Line 533 | Line 533 | _getopt_internal (argc, argv, optstring, longopts, lon | |
533 | from the shell indicating it is not an option. The later information | |
534 | is only used when the used in the GNU libc. */ | |
535 | #if defined _LIBC && defined USE_NONOPTION_FLAGS | |
536 | < | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ |
537 | < | || (optind < nonoption_flags_len \ |
536 | > | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ |
537 | > | || (optind < nonoption_flags_len \ |
538 | && __getopt_nonoption_flags[optind] == '1')) | |
539 | #else | |
540 | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') | |
# | Line 621 | Line 621 | _getopt_internal (argc, argv, optstring, longopts, lon | |
621 | ||
622 | /* Check whether the ARGV-element is a long option. | |
623 | ||
624 | < | If long_only and the ARGV-element has the form "-f", where f is |
625 | < | a valid short option, don't consider it an abbreviated form of |
626 | < | a long option that starts with f. Otherwise there would be no |
627 | < | way to give the -f short option. |
624 | > | If long_only and the ARGV-element has the form "-f", where f is |
625 | > | a valid short option, don't consider it an abbreviated form of |
626 | > | a long option that starts with f. Otherwise there would be no |
627 | > | way to give the -f short option. |
628 | ||
629 | < | On the other hand, if there's a long option "fubar" and |
630 | < | the ARGV-element is "-fu", do consider that an abbreviation of |
631 | < | the long option, just like "--fu", and not "-f" with arg "u". |
629 | > | On the other hand, if there's a long option "fubar" and |
630 | > | the ARGV-element is "-fu", do consider that an abbreviation of |
631 | > | the long option, just like "--fu", and not "-f" with arg "u". |
632 | ||
633 | < | This distinction seems to be the most useful approach. */ |
633 | > | This distinction seems to be the most useful approach. */ |
634 | ||
635 | if (longopts != NULL | |
636 | && (argv[optind][1] == '-' | |
# | Line 726 | Line 726 | _getopt_internal (argc, argv, optstring, longopts, lon | |
726 | { | |
727 | if (print_errors) | |
728 | fprintf (stderr, | |
729 | < | _("%s: option `%s' requires an argument\n"), |
730 | < | argv[0], argv[optind - 1]); |
729 | > | _("%s: option `%s' requires an argument\n"), |
730 | > | argv[0], argv[optind - 1]); |
731 | nextchar += strlen (nextchar); | |
732 | optopt = pfound->val; | |
733 | return optstring[0] == ':' ? ':' : '?'; | |
# | Line 884 | Line 884 | _getopt_internal (argc, argv, optstring, longopts, lon | |
884 | { | |
885 | if (print_errors) | |
886 | fprintf (stderr, _("\ | |
887 | < | %s: option `-W %s' doesn't allow an argument\n"), |
887 | > | %s: option `-W %s' doesn't allow an argument\n"), |
888 | argv[0], pfound->name); | |
889 | ||
890 | nextchar += strlen (nextchar); | |
# | Line 915 | Line 915 | _getopt_internal (argc, argv, optstring, longopts, lon | |
915 | } | |
916 | return pfound->val; | |
917 | } | |
918 | < | nextchar = NULL; |
919 | < | return 'W'; /* Let the application handle it. */ |
918 | > | nextchar = NULL; |
919 | > | return 'W'; /* Let the application handle it. */ |
920 | } | |
921 | if (temp[1] == ':') | |
922 | { |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |