mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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
1 changed files with 2 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue