From 2adac0a6377ce9779f2db7ba05f3769e30a7a5a6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 13 Sep 1999 13:45:32 +0000 Subject: [PATCH] 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. --- Python/getopt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/getopt.c b/Python/getopt.c index 5175e0a3ded..c5a3f626818 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) {