httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r546651 - /httpd/httpd/trunk/server/core.c
Date Tue, 12 Jun 2007 22:24:43 GMT
Author: pquerna
Date: Tue Jun 12 15:24:42 2007
New Revision: 546651

URL: http://svn.apache.org/viewvc?view=rev&rev=546651
Log:
Add the 'Define' command to the core.  This does exactly the same thing as adding a -D FOO
to your command line.

Modified:
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?view=diff&rev=546651&r1=546650&r2=546651
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Tue Jun 12 15:24:42 2007
@@ -1093,6 +1093,26 @@
     return NULL;
 }
 
+
+static const char *set_define(cmd_parms *cmd, void *dummy,
+                                   const char *optarg)
+{
+    char **newv;
+    void *sconf = cmd->server->module_config;
+    core_server_config *conf = ap_get_module_config(sconf, &core_module);
+
+    const char *err = ap_check_cmd_context(cmd,
+                                           GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    newv = (char **)apr_array_push(ap_server_config_defines);
+    *newv = apr_pstrdup(cmd->pool, optarg);
+
+    return NULL;
+}
+
 #ifdef GPROF
 static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg)
 {
@@ -3189,6 +3209,8 @@
   "The name of the default charset to add to any Content-Type without one or 'Off' to disable"),
 AP_INIT_TAKE1("AcceptPathInfo", set_accept_path_info, NULL, OR_FILEINFO,
   "Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler
preference"),
+AP_INIT_TAKE1("Define", set_define, NULL, RSRC_CONF,
+              "Define the existance of a variable.  Same as passing -D to the command line."),
 
 /* Old resource config file commands */
 



Mime
View raw message