static struct cfitem *cfsection;
static struct mempool *cfpool;
-static byte *cfdeffile = NULL;
+byte *cfdeffile = DEFAULT_CONFIG;
static void CONSTRUCTOR
conf_init(void)
struct cfitem *sect, *item;
int count = 0;
for (sect = cfsection; sect; sect = sect->var)
- for (item = sect+1; sect->type; sect++)
+ for (item = sect+1; item->type; item++)
count++;
return count;
}
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)
}else if(res=='C'){
cf_read(optarg);
- }else{ /* unhandled option */
+ }else{
+ /* unhandled option or end of options */
+ if(cfdeffile)
+ cf_read(cfdeffile);
return res;
}
}while(1);
}
-