Hi,
I got my 1st module working and now I need to add support for a configuration
directive that sets a string that my module needs in various places, i.e., if
my directive is "SetMyVar", and httpd.conf has:
SetMyVar "foo123"
then, in my module, I need to able to access the string, "foo123", that got set
via the "SetMyVar" directive. This directive would only be used at the server
level.
I think that I know how to do the code to set the variable into my module, but
the question that I have is how do I *access* it after it is set?
Here's the code I have to handle the directive:
/*
* Stuff for Directive handling
*/
// Struct for Directives
typedef struct txt_cfg {
const char * MyVar;
} txt_cfg;
// Function to get GxInterceptorURL
static const char * txt_set_MyVar(cmd_parms* cmd, void* cfg, const char* val) {
printf("In set_MyVar: Setting MyVar to [%s]\n", val);
((txt_cfg*) cfg)->MyVar = val;
} // end txt_set_MyVar()
//
static const command_rec txt_cmds[] = {
AP_INIT_TAKE1("SetMyVar", txt_set_MyVar, NULL, OR_ALL,
"This is MyVar"),
{ NULL }
};
.
.
.
module AP_MODULE_DECLARE_DATA my_module =
{
STANDARD20_MODULE_STUFF,
NULL, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server configs */
txt_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};
Can anyone tell me how, in my module code, I can access that "MyVar" string?
Thanks,
Jim