mirror of
https://github.com/python/cpython.git
synced 2025-01-19 23:15:20 +08:00
Fix a bug in this code that made it do the wrong thing when an option
was a single '-'. Thanks to Andrew Kuchling.
This commit is contained in:
parent
b55e07f4eb
commit
b4102bf5f8
@ -62,7 +62,10 @@ char optstring[];
|
||||
opt_ptr = &argv[optind++][1];
|
||||
}
|
||||
|
||||
if ((ptr = strchr(optstring, option = *opt_ptr++)) == NULL) {
|
||||
if ( (option = *opt_ptr++) == '\0')
|
||||
return -1;
|
||||
|
||||
if ((ptr = strchr(optstring, option)) == NULL) {
|
||||
if (opterr)
|
||||
fprintf(stderr, "Unknown option: -%c\n", option);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user