[svn:mod_parrot] r277 - in mod_parrot/trunk: include src

[email protected]
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Dec 16 08:58:49 2007
New Revision: 277

Modified:
   mod_parrot/trunk/include/modparrot_config.h
   mod_parrot/trunk/src/mod_parrot.c
   mod_parrot/trunk/src/modparrot_config.c

Log:
add support for ParrotOptions directive (we have no options yet, though)


Modified: mod_parrot/trunk/include/modparrot_config.h
==============================================================================
--- mod_parrot/trunk/include/modparrot_config.h	(original)
+++ mod_parrot/trunk/include/modparrot_config.h	Sun Dec 16 08:58:49 2007
@@ -98,3 +98,4 @@
 const char *modparrot_cmd_include_path(cmd_parms *, void *, const char *);
 const char *modparrot_cmd_add_type(cmd_parms *, void *, const char *, const char *);
 const char *modparrot_cmd_add_handler(cmd_parms *, void *, const char *, const char *);
+const char *modparrot_cmd_options(cmd_parms *, void *, const char *);

Modified: mod_parrot/trunk/src/mod_parrot.c
==============================================================================
--- mod_parrot/trunk/src/mod_parrot.c	(original)
+++ mod_parrot/trunk/src/mod_parrot.c	Sun Dec 16 08:58:49 2007
@@ -791,7 +791,7 @@
     cfg = ap_get_module_config(s->module_config, &parrot_module);
 
     /* if not our handler, return OK (post_config must return OK) */
-    if (!cfg->open_logs_handler) {
+    if (!cfg->post_config_handler) {
         return OK;
     }
 
@@ -1079,6 +1079,13 @@
         RSRC_CONF,
         "associate a handler string with a mod_parrot HLL"
     ),
+    AP_INIT_ITERATE(
+        "ParrotOptions",
+        modparrot_cmd_options,
+        NULL,
+        RSRC_CONF,
+        "set mod_parrot options"
+    ),
     { NULL }
 };
 

Modified: mod_parrot/trunk/src/modparrot_config.c
==============================================================================
--- mod_parrot/trunk/src/modparrot_config.c	(original)
+++ mod_parrot/trunk/src/modparrot_config.c	Sun Dec 16 08:58:49 2007
@@ -152,6 +152,16 @@
     return(l);
 }
 
+/* set an option from ParrotOptions
+ * this is not static so we can call it from a handler
+ */
+int modparrot_set_option(modparrot_srv_config *cfg, char *option, int enable)
+{
+    /* XXX add option processing here */
+
+    return 1;
+}
+
 const char *modparrot_cmd_trace(cmd_parms *cmd, void *mconfig, const char *f)
 {
     modparrot_srv_config *cfg;
@@ -400,3 +410,29 @@
     apr_table_set(cfg->handler_map, handler, hll);
     return NULL;
 }
+
+const char *modparrot_cmd_options(cmd_parms *cmd, void *mconfig, const char *option)
+{
+    modparrot_srv_config *cfg;
+    char *p, *errmsg = NULL;
+
+    cfg = GET_SERVER_CONFIG(cmd);
+    switch(option[0]) {
+        case '+':
+            p = (char *)(option+1);
+            if (!modparrot_set_option(cfg, p, 1)) {
+                errmsg = apr_psprintf(cfg->pool, "unknown option '%s'", p);
+            }
+            break;
+        case '-':
+            p = (char *)(option+1);
+            if (!modparrot_set_option(cfg, p, 0)) {
+                errmsg = apr_psprintf(cfg->pool, "unknown option '%s'", p);
+            }
+            break;
+        default:
+            errmsg = apr_psprintf(cfg->pool,
+                "missing +/- modifier for option '%s'", option);
+    }
+    return errmsg;
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.