Question


No, I am NOT asking where to find httpd.conf


I have been given code for a module that I need to tinker with and since I can't find any good documentation on the subject I am asking you.

const char* receiver_set_config_path(cmd_parms* cmd, void* cfg, const char* arg)
{
    receiver_config_path = arg;
    return NULL;
}

In this code there is a cfg passed in. I want to determine the name of this specific cfg file being passed in so I can log the name. How would I go about doing this? This function is setup in my receiver_directives[].

static const command_rec        receiver_directives[] =
{
    AP_INIT_TAKE1("ReceiverPath", receiver_set_config_path, NULL, RSRC_CONF, "The path the receiver will put files"),
    { NULL }
};

Your help is greatly appreciated!

Was it helpful?

Solution

What about doing so:

const char* receiver_set_config_path(cmd_parms* cmd, void* cfg, const char* arg)
{
#ifdef DEBUG
  fprintf(stderr, "DEBUG %s, %d: %s(..., arg='%s')\n", __FILE__, __LINE__, __FUNCTION__, arg);
#endif   
  receiver_config_path = arg;
  return NULL;
}

Compile using the additional option -DDEBUG and you'll be getting something printed to stderr like this:

DEBUG mymodule.c, 42: receiver_set_config_path(..., arg='mypath')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top