Tim Peters discovered a bug in the Python-supplied getopt():
it doesn't recognize a lone dash as a non-flag argument. Now it does.
This commit is contained in:
parent
8037cb11f5
commit
2adac0a637
|
@ -55,7 +55,8 @@ int getopt( int argc, char *const *argv, const char *optstring )
|
||||||
|
|
||||||
if (*opt_ptr == '\0') {
|
if (*opt_ptr == '\0') {
|
||||||
|
|
||||||
if (optind >= argc || argv[optind][0] != '-')
|
if (optind >= argc || argv[optind][0] != '-' ||
|
||||||
|
argv[optind][1] == '\0' /* lone dash */ )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
else if (strcmp(argv[optind], "--") == 0) {
|
else if (strcmp(argv[optind], "--") == 0) {
|
||||||
|
|
Loading…
Reference in New Issue