]> granicus.if.org Git - php/commitdiff
fix long options
authorAntony Dovgal <tony2001@php.net>
Mon, 23 Apr 2007 11:04:54 +0000 (11:04 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 23 Apr 2007 11:04:54 +0000 (11:04 +0000)
sapi/cgi/getopt.c
sapi/cli/getopt.c

index 0dd8a45f5bdcc0cb9b32c2eb90280e92450d0763..4821a9c84dbadc11d994365a866d208735e97330 100644 (file)
@@ -145,7 +145,8 @@ int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **opta
                }
                return opts[opts_idx].opt_char;
        } else {
-               if (arg_start >= 2) {
+               /* multiple options specified as one (exclude long opts) */
+               if (arg_start >= 2 && !((argv[*optind][0] == '-') && (argv[*optind][1] == '-'))) {
                        if (!argv[*optind][optchr+1])
                        {
                                dash = 0;
index 0dd8a45f5bdcc0cb9b32c2eb90280e92450d0763..4821a9c84dbadc11d994365a866d208735e97330 100644 (file)
@@ -145,7 +145,8 @@ int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **opta
                }
                return opts[opts_idx].opt_char;
        } else {
-               if (arg_start >= 2) {
+               /* multiple options specified as one (exclude long opts) */
+               if (arg_start >= 2 && !((argv[*optind][0] == '-') && (argv[*optind][1] == '-'))) {
                        if (!argv[*optind][optchr+1])
                        {
                                dash = 0;