From: William A. Rowe Jr Date: Sat, 13 Apr 2002 19:35:18 +0000 (+0000) Subject: Correct const'ness of argv in all support apps, and use the new X-Git-Tag: 2.0.36~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01ba81a1f45e95f53ee8bb0f7158b8bf5b484736;p=thirdparty%2Fapache%2Fhttpd.git Correct const'ness of argv in all support apps, and use the new apr_app_initialize over apr_initialize for win32, and other platforms that may wish to tweak 'apr-ized' application support (e.g. Netware?) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94633 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/main.c b/server/main.c index 010aa52d451..811af820299 100644 --- a/server/main.c +++ b/server/main.c @@ -404,7 +404,7 @@ int main(int argc, const char * const argv[]) AP_MONCONTROL(0); /* turn of profiling of startup */ - apr_initialize(); + apr_app_initialize(&argc, &argv, NULL); process = create_process(argc, argv); pglobal = process->pool; diff --git a/support/ab.c b/support/ab.c index 76ce0630e7e..c7010a52e46 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1302,14 +1302,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", AP_SERVER_BASEREVISION " <$Revision: 1.93 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_SERVER_BASEREVISION " <$Revision: 1.94 $> apache-2.0"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_SERVER_BASEREVISION, "$Revision: 1.93 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_SERVER_BASEREVISION, "$Revision: 1.94 $"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
\n"); printf("

\n

\n"); @@ -1467,7 +1467,7 @@ static int open_postfile(const char *pfile) /* ------------------------------------------------------- */ /* sort out command-line args and call test */ -int main(int argc, const char *const argv[]) +int main(int argc, const char * const argv[]) { int r, l; char tmp[1024]; @@ -1485,7 +1485,7 @@ int main(int argc, const char *const argv[]) proxyhost[0] = '\0'; hdrs[0] = '\0'; - apr_initialize(); + apr_app_initialize(&argc, &argv, NULL); atexit(apr_terminate); apr_pool_create(&cntxt, NULL); diff --git a/support/htdbm.c b/support/htdbm.c index 1a16b1d8ef3..89a46167504 100644 --- a/support/htdbm.c +++ b/support/htdbm.c @@ -172,8 +172,6 @@ static apr_status_t htdbm_init(apr_pool_t **pool, htdbm_t **hdbm) apr_status_t rv; #endif - apr_initialize(); - atexit(apr_terminate); apr_pool_create( pool, NULL); apr_signal(SIGINT, (void (*)(int)) htdbm_interrupted); @@ -412,7 +410,7 @@ static void htdbm_usage(void) } -int main(int argc, const char *argv[]) +int main(int argc, const char * const argv[]) { apr_pool_t *pool; apr_status_t rv; @@ -431,6 +429,9 @@ int main(int argc, const char *argv[]) int i; int args_left = 2; + apr_app_initialize(&argc, &argv, NULL); + atexit(apr_terminate); + if ((rv = htdbm_init(&pool, &h)) != APR_SUCCESS) { fprintf(stderr, "Unable to initialize htdbm terminating!\n"); apr_strerror(rv, errbuf, sizeof(errbuf)); diff --git a/support/htdigest.c b/support/htdigest.c index eff88e45e19..c65a243a3bd 100644 --- a/support/htdigest.c +++ b/support/htdigest.c @@ -147,7 +147,7 @@ static void putline(apr_file_t *f, char *l) } -static void add_password(char *user, char *realm, apr_file_t *f) +static void add_password(const char *user, const char *realm, apr_file_t *f) { char *pw; apr_md5_ctx_t context; @@ -214,7 +214,7 @@ static void terminate(void) apr_terminate(); } -int main(int argc, char *argv[]) +int main(int argc, const char * const argv[]) { apr_file_t *f; apr_status_t rv; @@ -228,12 +228,7 @@ int main(int argc, char *argv[]) char command[MAX_STRING_LEN]; int found; - rv = apr_initialize(); - if (rv) { - fprintf(stderr, "apr_initialize(): %s (%d)\n", - apr_strerror(rv, line, sizeof(line)), rv); - exit(1); - } + apr_app_initialize(&argc, &argv, NULL); atexit(terminate); apr_pool_create(&cntxt, NULL); diff --git a/support/htpasswd.c b/support/htpasswd.c index d42ecf9ac9e..93f8400e482 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -376,7 +376,6 @@ static void copy_file(FILE *target, FILE *source) void nwTerminate() { pressanykey(); - apr_terminate(); } #endif @@ -384,7 +383,7 @@ void nwTerminate() * Let's do it. We end up doing a lot of file opening and closing, * but what do we care? This application isn't run constantly. */ -int main(int argc, char *argv[]) +int main(int argc, const char * const argv[]) { FILE *ftemp = NULL; FILE *fpw = NULL; @@ -393,7 +392,7 @@ int main(int argc, char *argv[]) char record[MAX_STRING_LEN]; char line[MAX_STRING_LEN]; char pwfilename[MAX_STRING_LEN]; - char *arg; + const char *arg; int found = 0; int alg = ALG_CRYPT; int newfile = 0; @@ -407,11 +406,10 @@ int main(int argc, char *argv[]) apr_xlate_t *to_ascii; #endif - apr_initialize(); + apr_app_initialize(&argc, &argv, NULL); + atexit(apr_terminate); #ifdef NETWARE atexit(nwTerminate); -#else - atexit(apr_terminate); #endif apr_pool_create(&pool, NULL); diff --git a/support/rotatelogs.c b/support/rotatelogs.c index 834a522976c..559406caa36 100644 --- a/support/rotatelogs.c +++ b/support/rotatelogs.c @@ -91,7 +91,7 @@ #define MAX_PATH 1024 #endif -int main (int argc, char *argv[]) +int main (int argc, const char * const argv[]) { char buf[BUFSIZE], buf2[MAX_PATH], errbuf[ERRMSGSZ]; int tLogEnd = 0, tRotation, utc_offset = 0; @@ -99,11 +99,11 @@ int main (int argc, char *argv[]) apr_size_t nRead, nWrite; int use_strftime = 0; int now; - char *szLogRoot; + const char *szLogRoot; apr_file_t *f_stdin, *nLogFD = NULL, *nLogFDprev = NULL; apr_pool_t *pool; - apr_initialize(); + apr_app_initialize(&argc, &argv, NULL); atexit(apr_terminate); apr_pool_create(&pool, NULL);