summaryrefslogtreecommitdiff
path: root/sapi/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cgi')
-rw-r--r--sapi/cgi/cgi_main.c17
-rw-r--r--sapi/cgi/getopt.c6
-rw-r--r--sapi/cgi/php_getopt.h6
3 files changed, 21 insertions, 8 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index eb51a9ef95..1d2b5ce653 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -78,8 +78,8 @@ PHPAPI extern char *php_ini_path;
#define PHP_MODE_HIGHLIGHT 2
#define PHP_MODE_INDENT 3
-PHPAPI extern char *ap_php_optarg;
-PHPAPI extern int ap_php_optind;
+extern char *ap_php_optarg;
+extern int ap_php_optind;
static int sapi_cgibin_ub_write(const char *str, uint str_length)
@@ -165,6 +165,16 @@ static void sapi_cgi_log_message(char *message)
}
}
+static int sapi_cgi_activate(SLS_D)
+{
+ fflush(stdout);
+ if(request_info.php_argv0) {
+ free(request_info.php_argv0);
+ request_info.php_argv0 = NULL;
+ }
+ return SUCCESS;
+}
+
static sapi_module_struct sapi_module = {
"CGI", /* name */
@@ -172,6 +182,9 @@ static sapi_module_struct sapi_module = {
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
+ NULL, /* activate */
+ sapi_cgi_activate, /* deactivate */
+
sapi_cgibin_ub_write, /* unbuffered write */
sapi_cgibin_flush, /* flush */
diff --git a/sapi/cgi/getopt.c b/sapi/cgi/getopt.c
index e34356a6b0..4d9187ba8e 100644
--- a/sapi/cgi/getopt.c
+++ b/sapi/cgi/getopt.c
@@ -10,8 +10,8 @@
#define OPTERRARG (3)
-PHPAPI char *ap_php_optarg;
-PHPAPI int ap_php_optind = 1;
+char *ap_php_optarg;
+int ap_php_optind = 1;
static int ap_php_opterr = 1;
static int ap_php_optopt;
@@ -42,7 +42,7 @@ ap_php_optiserr(int argc, char * const *argv, int oint, const char *optstr,
return('?');
}
-PHPAPI int ap_php_getopt(int argc, char* const *argv, const char *optstr)
+int ap_php_getopt(int argc, char* const *argv, const char *optstr)
{
static int optchr = 0;
static int dash = 0; /* have already seen the - */
diff --git a/sapi/cgi/php_getopt.h b/sapi/cgi/php_getopt.h
index 5f3af64b64..3b1356d6cd 100644
--- a/sapi/cgi/php_getopt.h
+++ b/sapi/cgi/php_getopt.h
@@ -1,9 +1,9 @@
/* Borrowed from Apache NT Port */
#include "php.h"
-PHPAPI extern char *ap_php_optarg;
-PHPAPI extern int ap_php_optind;
+extern char *ap_php_optarg;
+extern int ap_php_optind;
extern int ap_php_opterr;
extern int ap_php_optopt;
-PHPAPI int ap_php_getopt(int argc, char* const *argv, const char *optstr);
+int ap_php_getopt(int argc, char* const *argv, const char *optstr);