X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf.c;h=c96d9fb304cd71e029eab9353e4abdbde4baab8f;hb=b9d261cd48ef0715f3a104a875c11c992c654206;hp=f6a5f0ee9ed5cfabbcf9ab185c9edb71334f7bfd;hpb=05945b74fb145f8eb22312cbd52fa9e5c660e5b6;p=libucw.git diff --git a/lib/conf.c b/lib/conf.c index f6a5f0ee..c96d9fb3 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -24,7 +24,7 @@ static struct cfitem *cfsection; static struct mempool *cfpool; -static byte *cfdeffile = NULL; +byte *cfdeffile = DEFAULT_CONFIG; static void CONSTRUCTOR conf_init(void) @@ -215,18 +215,6 @@ void cf_read(byte *filename) cfdeffile = NULL; } -void -cf_default_init(byte *filename) -{ - cfdeffile = filename; -} - -void cf_default_done(void) -{ - if (cfdeffile) - cf_read(cfdeffile); -} - int cf_getopt(int argc,char * const argv[], const char *shortopts,const struct option *longopts, int *longindex) @@ -267,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; }