]> granicus.if.org Git - apache/commitdiff
More command handler updates.
authorBen Laurie <ben@apache.org>
Sat, 17 Jun 2000 16:53:50 +0000 (16:53 +0000)
committerBen Laurie <ben@apache.org>
Sat, 17 Jun 2000 16:53:50 +0000 (16:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85600 13f79535-47bb-0310-9956-ffa450edef68

include/http_config.h
modules/loggers/mod_log_config.c
modules/metadata/mod_env.c

index 276e7f75366a675bd2a5b2c2e0db2e202a430244..b32a8dfbf1568314ac766fd41cafe738c0ded4e8 100644 (file)
@@ -131,6 +131,8 @@ typedef union {
     { directive, { .take2=func }, mconfig, where, TAKE2, help }
 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
     { directive, { .take2=func }, mconfig, where, TAKE12, help }
+# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
+    { directive, { .take3=func }, mconfig, where, TAKE23, help }
 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
     { directive, { .flag=func }, mconfig, where, FLAG, help }
 
index 2b2409de55661d49f17c687ea8e49d83018b7041..46b6ddbbf17bed333e30c15dc66fa257dfe028bf 100644 (file)
@@ -219,7 +219,7 @@ static ap_fileperms_t xfer_perms = APR_OS_DEFAULT;
  */
 
 typedef struct {
-    char *default_format_string;
+    const char *default_format_string;
     ap_array_header_t *default_format;
     ap_array_header_t *config_logs;
     ap_array_header_t *server_config_logs;
@@ -236,8 +236,8 @@ typedef struct {
  */
 
 typedef struct {
-    char *fname;
-    char *format_string;
+    const char *fname;
+    const char *format_string;
     ap_array_header_t *format;
     ap_file_t *log_fd;
     char *condition_var;
@@ -917,8 +917,8 @@ static void *merge_config_log_state(ap_pool_t *p, void *basev, void *addv)
 /*
  * Set the default logfile format, or define a nickname for a format string.
  */
-static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt,
-                              char *name)
+static const char *log_format(cmd_parms *cmd, void *dummy, const char *fmt,
+                              const char *name)
 {
     const char *err_string = NULL;
     multi_log_state *mls = ap_get_module_config(cmd->server->module_config,
@@ -943,8 +943,8 @@ static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt,
 }
 
 
-static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn,
-                                  char *fmt, char *envclause)
+static const char *add_custom_log(cmd_parms *cmd, void *dummy, const char *fn,
+                                  const char *fmt, const char *envclause)
 {
     const char *err_string = NULL;
     multi_log_state *mls = ap_get_module_config(cmd->server->module_config,
@@ -977,27 +977,28 @@ static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn,
     return err_string;
 }
 
-static const char *set_transfer_log(cmd_parms *cmd, void *dummy, char *fn)
+static const char *set_transfer_log(cmd_parms *cmd, void *dummy,
+                                   const char *fn)
 {
     return add_custom_log(cmd, dummy, fn, NULL, NULL);
 }
 
-static const char *set_cookie_log(cmd_parms *cmd, void *dummy, char *fn)
+static const char *set_cookie_log(cmd_parms *cmd, void *dummy, const char *fn)
 {
     return add_custom_log(cmd, dummy, fn, "%{Cookie}n \"%r\" %t", NULL);
 }
 
 static const command_rec config_log_cmds[] =
 {
-    {"CustomLog", add_custom_log, NULL, RSRC_CONF, TAKE23,
+AP_INIT_TAKE23("CustomLog", add_custom_log, NULL, RSRC_CONF,
      "a file name, a custom log format string or format name, "
-     "and an optional \"env=\" clause (see docs)"},
-    {"TransferLog", set_transfer_log, NULL, RSRC_CONF, TAKE1,
-     "the filename of the access log"},
-    {"LogFormat", log_format, NULL, RSRC_CONF, TAKE12,
-     "a log format string (see docs) and an optional format name"},
-    {"CookieLog", set_cookie_log, NULL, RSRC_CONF, TAKE1,
-     "the filename of the cookie log"},
+     "and an optional \"env=\" clause (see docs)"),
+AP_INIT_TAKE1("TransferLog", set_transfer_log, NULL, RSRC_CONF,
+     "the filename of the access log"),
+AP_INIT_TAKE12("LogFormat", log_format, NULL, RSRC_CONF,
+     "a log format string (see docs) and an optional format name"),
+AP_INIT_TAKE1("CookieLog", set_cookie_log, NULL, RSRC_CONF,
+     "the filename of the cookie log"),
     {NULL}
 };
 
index da52b08635c3fc7fa6c21d35d16cbdffe3b90cf7..0fd7ff68a37d28c7d6b21e1f25e41cadd7bd3c42 100644 (file)
 
 typedef struct {
     ap_table_t *vars;
-    char *unsetenv;
+    const char *unsetenv;
     int vars_present;
 } env_dir_config_rec;
 
@@ -172,10 +172,10 @@ static void *merge_env_dir_configs(ap_pool_t *p, void *basev, void *addv)
     return new;
 }
 
-static const char *add_env_module_vars_passed(cmd_parms *cmd,
-                                             env_dir_config_rec *sconf,
+static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
                                               const char *arg)
 {
+    env_dir_config_rec *sconf=sconf_;
     ap_table_t *vars = sconf->vars;
     char *env_var;
     char *name_ptr;
@@ -191,10 +191,10 @@ static const char *add_env_module_vars_passed(cmd_parms *cmd,
     return NULL;
 }
 
-static const char *add_env_module_vars_set(cmd_parms *cmd,
-                                          env_dir_config_rec *sconf,
+static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
                                            const char *arg)
 {
+    env_dir_config_rec *sconf=sconf_;
     ap_table_t *vars = sconf->vars;
     char *name, *value;
 
@@ -216,10 +216,11 @@ static const char *add_env_module_vars_set(cmd_parms *cmd,
     return NULL;
 }
 
-static const char *add_env_module_vars_unset(cmd_parms *cmd,
-                                            env_dir_config_rec *sconf,
-                                             char *arg)
+static const char *add_env_module_vars_unset(cmd_parms *cmd, void *sconf_,
+                                             const char *arg)
 {
+    env_dir_config_rec *sconf=sconf_;
+
     sconf->unsetenv = sconf->unsetenv ?
         ap_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL) :
          arg;
@@ -228,12 +229,12 @@ static const char *add_env_module_vars_unset(cmd_parms *cmd,
 
 static const command_rec env_module_cmds[] =
 {
-    {"PassEnv", add_env_module_vars_passed, NULL,
-     OR_FILEINFO, RAW_ARGS, "a list of environment variables to pass to CGI."},
-    {"SetEnv", add_env_module_vars_set, NULL,
-     OR_FILEINFO, RAW_ARGS, "an environment variable name and a value to pass to CGI."},
-    {"UnsetEnv", add_env_module_vars_unset, NULL,
-     OR_FILEINFO, RAW_ARGS, "a list of variables to remove from the CGI environment."},
+AP_INIT_RAW_ARGS("PassEnv", add_env_module_vars_passed, NULL,
+     OR_FILEINFO, "a list of environment variables to pass to CGI."),
+AP_INIT_RAW_ARGS("SetEnv", add_env_module_vars_set, NULL,
+     OR_FILEINFO, "an environment variable name and a value to pass to CGI."),
+AP_INIT_RAW_ARGS("UnsetEnv", add_env_module_vars_unset, NULL,
+     OR_FILEINFO, "a list of variables to remove from the CGI environment."),
     {NULL},
 };