helly Sun Apr 22 15:24:19 2007 UTC
Modified files:
/php-src/sapi/cgi getopt.c
/php-src/sapi/cli getopt.c
Log:
- Merge getopt fixes from re2c
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/getopt.c?r1=1.12&r2=1.13&diff_format=u
Index: php-src/sapi/cgi/getopt.c
diff -u php-src/sapi/cgi/getopt.c:1.12 php-src/sapi/cgi/getopt.c:1.13
--- php-src/sapi/cgi/getopt.c:1.12 Sun Apr 15 22:54:26 2007
+++ php-src/sapi/cgi/getopt.c Sun Apr 22 15:24:19 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: getopt.c,v 1.12 2007/04/15 22:54:26 sniper Exp $ */
+/* $Id: getopt.c,v 1.13 2007/04/22 15:24:19 helly Exp $ */
#include <stdio.h>
#include <string.h>
@@ -107,6 +107,7 @@
(*optind)++;
return (php_opt_error(argc, argv, *optind-1, optchr,
OPTERRCOLON, show_err));
}
+ arg_start = 1 + optchr;
}
if (opts_idx < 0) {
while (1) {
@@ -120,6 +121,7 @@
(*optind)++;
} else {
optchr++;
+ arg_start++;
}
return(php_opt_error(argc, argv, errind,
errchr, OPTERRNF, show_err));
} else if (argv[*optind][optchr] ==
opts[opts_idx].opt_char) {
@@ -143,7 +145,7 @@
}
return opts[opts_idx].opt_char;
} else {
- if (arg_start == 2) {
+ if (arg_start >= 2) {
if (!argv[*optind][optchr+1])
{
dash = 0;
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/getopt.c?r1=1.12&r2=1.13&diff_format=u
Index: php-src/sapi/cli/getopt.c
diff -u php-src/sapi/cli/getopt.c:1.12 php-src/sapi/cli/getopt.c:1.13
--- php-src/sapi/cli/getopt.c:1.12 Thu Mar 22 21:34:58 2007
+++ php-src/sapi/cli/getopt.c Sun Apr 22 15:24:19 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: getopt.c,v 1.12 2007/03/22 21:34:58 johannes Exp $ */
+/* $Id: getopt.c,v 1.13 2007/04/22 15:24:19 helly Exp $ */
#include <stdio.h>
#include <string.h>
@@ -107,6 +107,7 @@
(*optind)++;
return (php_opt_error(argc, argv, *optind-1, optchr,
OPTERRCOLON, show_err));
}
+ arg_start = 1 + optchr;
}
if (opts_idx < 0) {
while (1) {
@@ -120,6 +121,7 @@
(*optind)++;
} else {
optchr++;
+ arg_start++;
}
return(php_opt_error(argc, argv, errind,
errchr, OPTERRNF, show_err));
} else if (argv[*optind][optchr] ==
opts[opts_idx].opt_char) {
@@ -143,7 +145,7 @@
}
return opts[opts_idx].opt_char;
} else {
- if (arg_start == 2) {
+ if (arg_start >= 2) {
if (!argv[*optind][optchr+1])
{
dash = 0;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php