diff options
| author | Joakim Verona | 2011-07-15 04:39:29 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-15 04:39:29 +0200 |
| commit | 4f616a2e7ed1db28da98df90266e9751a8ae9ee1 (patch) | |
| tree | 74a9dcbe13e945e712ae04a4a94c2202ca720591 /lib/getopt.c | |
| parent | ff2be00005c3aeda6e11d7ed264ce86f02b60958 (diff) | |
| parent | ec2bc542a4d0127425625e8cb458684bd825675a (diff) | |
| download | emacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.tar.gz emacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.zip | |
merge from upstream
Diffstat (limited to 'lib/getopt.c')
| -rw-r--r-- | lib/getopt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/getopt.c b/lib/getopt.c index 2af8352ee9c..7c9f7040612 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -829,7 +829,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 829 | return '?'; | 829 | return '?'; |
| 830 | } | 830 | } |
| 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ | 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ |
| 832 | if (temp[0] == 'W' && temp[1] == ';' && longopts) | 832 | if (temp[0] == 'W' && temp[1] == ';') |
| 833 | { | 833 | { |
| 834 | char *nameend; | 834 | char *nameend; |
| 835 | const struct option *p; | 835 | const struct option *p; |
| @@ -839,6 +839,9 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 839 | int indfound = 0; | 839 | int indfound = 0; |
| 840 | int option_index; | 840 | int option_index; |
| 841 | 841 | ||
| 842 | if (longopts == NULL) | ||
| 843 | goto no_longs; | ||
| 844 | |||
| 842 | /* This is an option that requires an argument. */ | 845 | /* This is an option that requires an argument. */ |
| 843 | if (*d->__nextchar != '\0') | 846 | if (*d->__nextchar != '\0') |
| 844 | { | 847 | { |
| @@ -1046,8 +1049,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 1046 | } | 1049 | } |
| 1047 | return pfound->val; | 1050 | return pfound->val; |
| 1048 | } | 1051 | } |
| 1049 | d->__nextchar = NULL; | 1052 | |
| 1050 | return 'W'; /* Let the application handle it. */ | 1053 | no_longs: |
| 1054 | d->__nextchar = NULL; | ||
| 1055 | return 'W'; /* Let the application handle it. */ | ||
| 1051 | } | 1056 | } |
| 1052 | if (temp[1] == ':') | 1057 | if (temp[1] == ':') |
| 1053 | { | 1058 | { |