From: Guido van Rossum Date: Mon, 13 Sep 1999 13:45:32 +0000 (+0000) Subject: Tim Peters discovered a bug in the Python-supplied getopt(): X-Git-Tag: v1.6a1~928 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2adac0a6377ce9779f2db7ba05f3769e30a7a5a6;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Python/getopt.c b/Python/getopt.c index 5175e0a3dedf..c5a3f6268186 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) {