Kaydet (Commit) 2adac0a6 authored tarafından Guido van Rossum's avatar Guido van Rossum

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.
üst 8037cb11
......@@ -55,7 +55,8 @@ int getopt( int argc, char *const *argv, const char *optstring )
if (*opt_ptr == '\0') {
if (optind >= argc || argv[optind][0] != '-')
if (optind >= argc || argv[optind][0] != '-' ||
argv[optind][1] == '\0' /* lone dash */ )
return -1;
else if (strcmp(argv[optind], "--") == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment