diff options
author | Guido van Rossum <guido@python.org> | 1999-09-13 13:45:32 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-09-13 13:45:32 +0000 |
commit | 1826b00cf34be130f5073444afb2513462298134 (patch) | |
tree | 111254f3df2d1f93e0bfc003e0af2f19377d63cc /Python/getopt.c | |
parent | 52e9a432f124be40d5582f9f9c27dc53f1a1711e (diff) | |
download | cpython-1826b00cf34be130f5073444afb2513462298134.tar.gz |
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.
Diffstat (limited to 'Python/getopt.c')
-rw-r--r-- | Python/getopt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/getopt.c b/Python/getopt.c index 5175e0a3de..c5a3f62681 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -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) { |