]> granicus.if.org Git - php/commitdiff
@- Fixed -c support in the standalone CGI binary (Zeev)
authorZeev Suraski <zeev@php.net>
Mon, 27 Dec 1999 21:21:26 +0000 (21:21 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 27 Dec 1999 21:21:26 +0000 (21:21 +0000)
Fixed -c support in the standalone CGI binary (Zeev)

sapi/cgi/cgi_main.c

index 99ba4858b7baead85c0caa4bf0d7faf32661c2ea..264549e5ca928e4f679aab47a6f4db4f7929ea60 100644 (file)
@@ -214,6 +214,8 @@ int main(int argc, char *argv[])
        int behavior=PHP_MODE_STANDARD;
        int no_headers=0;
        int free_path_translated=0;
+       int orig_optind=optind;
+       char *orig_optarg=optarg;
 #if SUPPORT_INTERACTIVE
        int interactive=0;
 #endif
@@ -280,6 +282,19 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
 #endif                                                 /* FORCE_CGI_REDIRECT */
        }
 
+       if (!cgi) {
+               while ((c=getopt(argc, argv, "c:d:qvisnaeh?vf:"))!=-1) {
+                       switch (c) {
+                               case 'c':
+                                       php_ini_path = strdup(optarg);          /* intentional leak */
+                                       break;
+                       }
+               }
+               optind = orig_optind;
+               optarg = orig_optarg;
+       }
+                       
+                       
        if (php_module_startup(&sapi_module)==FAILURE) {
                return FAILURE;
        }
@@ -351,9 +366,6 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
                                case 'n':
                                        behavior=PHP_MODE_INDENT;
                                        break;
-                               case 'c':
-                                       php_ini_path = strdup(optarg);          /* intentional leak */
-                                       break;
                                case 'a':
 #if SUPPORT_INTERACTIVE
                                        printf("Interactive mode enabled\n\n");