X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf.c;h=c96d9fb304cd71e029eab9353e4abdbde4baab8f;hb=995458e48d482bd5fa349882fba5cb4d6350076d;hp=223ff666f77e222a1dc85f7482939338db506208;hpb=08d04bc5ad1096069facbea143c8172243ba2eba;p=libucw.git diff --git a/lib/conf.c b/lib/conf.c index 223ff666..c96d9fb3 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -24,6 +24,8 @@ static struct cfitem *cfsection; static struct mempool *cfpool; +byte *cfdeffile = DEFAULT_CONFIG; + static void CONSTRUCTOR conf_init(void) { @@ -210,6 +212,7 @@ void cf_read(byte *filename) { if(!cf_subread(filename,0)) die("Reading config file %s failed",filename); + cfdeffile = NULL; } int cf_getopt(int argc,char * const argv[], @@ -243,6 +246,8 @@ int cf_getopt(int argc,char * const argv[], name=c; } + if (cfdeffile) + cf_read(cfdeffile); msg=cf_set_item(sect,name,value); } if(msg) @@ -250,6 +255,10 @@ int cf_getopt(int argc,char * const argv[], }else if(res=='C'){ cf_read(optarg); + }else if(res==-1){ + if(cfdeffile) + cf_read(cfdeffile); + return res; }else{ /* unhandled option */ return res; }