I would like to propose the following code changes for main.c.  These changes will 
allow a platform to use a relative server root that is based on argv[0] rather than a 
hard coded server root.  If these changes seem fair, I would like to check them in.

thanks,
Brad

--- \tempapache\httpd-2.0\server\main.c Fri Aug 31 16:52:43 2001
+++ main.c      Thu Sep 13 14:14:03 2001
@@ -230,6 +230,31 @@
     return process;
 }
 
+#ifdef USE_RELATIVE_SERVER_ROOT
+static char *get_def_server_root(apr_pool_t *pool, int argc, const char * const *argv)
+{
+    char *s = HTTPD_ROOT;
+
+    if (argc > 0) {
+
+        s = apr_pstrdup (pool, argv[0]);
+        if (s) {
+            int i, len = strlen(s);
+
+            for (i=len; i; i--) {
+                if (s[i] == '\\' || s[i] == '/') {
+                    s[i] = NULL;
+                    break;
+                }
+            }
+        }
+    }
+        
+    return s;
+}
+#endif
+
+
 static void usage(process_rec *process)
 {
     const char *bin = process->argv[0];
@@ -304,6 +329,10 @@
     pglobal = process->pool;
     pconf = process->pconf;
     ap_server_argv0 = process->short_name;
+
+#ifdef USE_RELATIVE_SERVER_ROOT
+    def_server_root = get_def_server_root(pglobal, argc, argv);
+#endif
 
 #if APR_CHARSET_EBCDIC
     if (ap_init_ebcdic(pglobal) != APR_SUCCESS) {

Reply via email to