[Openais] [PATCH] Use objdb

Hans Feldt Hans.Feldt at ericsson.com
Tue Apr 11 01:21:54 PDT 2006


Patrick Caulfield wrote:
> Steven Dake wrote:
> 
>>On Mon, 2006-04-10 at 20:37 +0100, Patrick Caulfield wrote:
> 
> 
>>>How about making aisparser read its config filename from an environment 
>>>variable ?
>>>
>>
>>yes this was the suggestion, although if no config environment variable
>>is present the defaults will be used.
> 
> 
> That's pretty easy :)

But from what I understand, you don't want the command line parser in 
main.c to set this env variable? You want it to be set externally to 
aisexec?

I have played around with the following command line options:

> +       fprintf(stderr, "\nUsage: aisexec [options]\n\n"
> +                       "Valid options:\n"
> +                       "  -h\tthis help\n"
> +                       "  -F\tForeground, do not daemonize (useful for debugging)\n"
> +                       "  -d\tEnable debug mode, produces a lot of debug output\n"
> +                       "  -c <config file>\n  \tconfiguration file, default %s\n",
> +                       config_file);

How about a more generic OPENAIS_CONFIG_FILE env variable set by the 
command line parser? It could be used by any config parser!

I really want the -c option on the command line and its kind of standard 
for all daemons to have this. See e.g. syslog-ng, xinetd, mountd, ... 
although it is named different things.

Regards,
Hans



> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: aisparser.c
> ===================================================================
> --- aisparser.c	(revision 978)
> +++ aisparser.c	(working copy)
> @@ -183,10 +183,15 @@
>  	char **error_string)
>  {
>  	FILE *fp;
> +	char *filename;
>  	char *error_reason = error_string_response;
>  	int res;
>  
> -	fp = fopen (OPENAIS_CONFDIR "/openais.conf", "r");
> +	filename = getenv("OPENAIS_AISPARSER_FILENAME");
> +	if (!filename)
> +		filename = OPENAIS_CONFDIR "/openais.conf";
> +
> +	fp = fopen (filename, "r");
>  	if (fp == 0) {
>  		sprintf (error_reason, "Can't read file %s/openais.conf reason = (%s)\n",
>  			 OPENAIS_CONFDIR, strerror (errno));




More information about the Openais mailing list