From: Ben Hyde Date: Wed, 13 Oct 1999 20:27:55 +0000 (+0000) Subject: Remove all but one WIN32 from http_main. Other minor changes. X-Git-Tag: 1.3.10~265 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec15673a2a9c2674fc69926982e3e30b8f1ea46a;p=apache Remove all but one WIN32 from http_main. Other minor changes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83987 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_main.h b/include/http_main.h index 1a4acad3be..9b5e0b1bd5 100644 --- a/include/http_main.h +++ b/include/http_main.h @@ -62,8 +62,7 @@ extern "C" { #endif -extern MODULE_VAR_EXPORT char *ap_server_argv0; - +extern MODULE_VAR_EXPORT const char *ap_server_argv0; extern API_VAR_EXPORT const char *ap_server_root; /* for -C, -c and -D switches */ diff --git a/server/main.c b/server/main.c index d74559d64e..8376eeb9c8 100644 --- a/server/main.c +++ b/server/main.c @@ -62,7 +62,7 @@ #include "util_uri.h" #include "ap_mpm.h" -char *ap_server_argv0; +const char *ap_server_argv0; API_VAR_EXPORT const char *ap_server_root; @@ -201,8 +201,6 @@ static void destroy_and_exit_process(process_rec *process, int process_exit_valu exit(process_exit_value); } -#define PATHSEPARATOR '/' /* Belongs in some apr os include file */ - static process_rec *create_process(int argc, const char **argv) { process_rec *process; @@ -217,11 +215,7 @@ static process_rec *create_process(int argc, const char **argv) ap_create_context(&process->pconf, process->pool); process->argc = argc; process->argv = argv; - { - char *s = strrchr(argv[0], PATHSEPARATOR); - - process->short_name = s ? ++s : argv[0]; - } + process->short_name = ap_filename_of_pathname(argv[0]); return process; } @@ -285,19 +279,12 @@ API_EXPORT_NONSTD(int) main(int argc, char *argv[]) server_rec *server_conf; ap_context_t *pglobal = process->pool; ap_context_t *pconf = process->pconf; - ap_context_t *plog; /* Pool for error-logging files */ - ap_context_t *ptemp; /* Pool for temporary config stuff */ - ap_context_t *pcommands; /* Pool for -C and -c switches */ - -#ifndef WIN32 - if ((ap_server_argv0 = strrchr(argv[0], '/')) != NULL) -#else - if ((ap_server_argv0 = strrchr(argv[0], '\\')) != NULL) -#endif - ++ap_server_argv0; - else - ap_server_argv0 = argv[0]; + ap_context_t *plog; /* Pool of log streams, reset _after_ each read of conf */ + ap_context_t *ptemp; /* Pool for temporary config stuff, reset often */ + ap_context_t *pcommands; /* Pool for -C and -c switches */ + ap_server_argv0 = process->short_name; + ap_util_uri_init(); g_pHookPool=pglobal; @@ -352,18 +339,18 @@ API_EXPORT_NONSTD(int) main(int argc, char *argv[]) ap_create_context(&plog, pglobal); ap_create_context(&ptemp, pconf); - /* for legacy reasons, we read the configuration twice before - we actually serve any requests */ + /* Note that we preflight the config file once + before reading it _again_ in the main loop. + This allows things, log files configuration + for example, to settle down. */ ap_server_root = def_server_root; ap_run_pre_config(pconf, plog, ptemp); server_conf = ap_read_config(process, ptemp, confname); - if (configtestonly) { fprintf(stderr, "Syntax OK\n"); destroy_and_exit_process(process, 0); } - ap_clear_pool(plog); ap_run_open_logs(pconf, plog, ptemp, server_conf); ap_post_config_hook(pconf, plog, ptemp, server_conf);