johannes Thu Mar 22 21:35:56 2007 UTC Modified files: (Branch: PHP_4_4) /php-src/sapi/cli getopt.c Log: - MFH: Fix handling of not existing long CLI options http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/getopt.c?r1=1.3.4.3.6.3&r2=1.3.4.3.6.4&diff_format=u Index: php-src/sapi/cli/getopt.c diff -u php-src/sapi/cli/getopt.c:1.3.4.3.6.3 php-src/sapi/cli/getopt.c:1.3.4.3.6.4 --- php-src/sapi/cli/getopt.c:1.3.4.3.6.3 Wed Mar 21 23:20:30 2007 +++ php-src/sapi/cli/getopt.c Thu Mar 22 21:35:56 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: getopt.c,v 1.3.4.3.6.3 2007/03/21 23:20:30 helly Exp $ */ +/* $Id: getopt.c,v 1.3.4.3.6.4 2007/03/22 21:35:56 johannes Exp $ */ #include <stdio.h> #include <string.h> @@ -79,11 +79,16 @@ } if ((argv[*optind][0] == '-') && (argv[*optind][1] == '-')) { /* '--' indicates end of args if not followed by a known long option name */ + if (argv[*optind][2] == '\0') { + (*optind)++; + return(EOF); + } + while (1) { opts_idx++; if (opts[opts_idx].opt_char == '-') { (*optind)++; - return(EOF); + return(php_opt_error(argc, argv, *optind-1, optchr, OPTERRARG, show_err)); } else if (opts[opts_idx].opt_name && !strcmp(&argv[*optind][2], opts[opts_idx].opt_name)) { break; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php