From: Zeev Suraski Date: Mon, 27 Dec 1999 21:21:26 +0000 (+0000) Subject: @- Fixed -c support in the standalone CGI binary (Zeev) X-Git-Tag: PRE_ISSET_TYPE~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b640c27a08ab24c20cb5942a396aacd73e7f8cb9;p=php @- Fixed -c support in the standalone CGI binary (Zeev) Fixed -c support in the standalone CGI binary (Zeev) --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 99ba4858b7..264549e5ca 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -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");