summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-09-13 13:45:32 (GMT)
committerGuido van Rossum <guido@python.org>1999-09-13 13:45:32 (GMT)
commit2adac0a6377ce9779f2db7ba05f3769e30a7a5a6 (patch)
treed95444473e0ae6f5bd4817393f13bbeb1334eada /Python
parent8037cb11f5d9dc9eee5a64e5aa0b4f06fbabcaad (diff)
downloadcpython-2adac0a6377ce9779f2db7ba05f3769e30a7a5a6.zip
cpython-2adac0a6377ce9779f2db7ba05f3769e30a7a5a6.tar.gz
cpython-2adac0a6377ce9779f2db7ba05f3769e30a7a5a6.tar.bz2
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')
-rw-r--r--Python/getopt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/getopt.c b/Python/getopt.c
index 5175e0a..c5a3f62 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) {