X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf.c;h=c37bb98b81b7982d4409c77f4d1f962e4875f8ae;hb=9fbdf10b4915874aad2eb98087293e5c721d3eb2;hp=98c34b56b16d62eadaf222c04c618bf69c6a2a9d;hpb=50ac264bf0e983a5b009c6d11dcc4f0703edab4b;p=libucw.git diff --git a/lib/conf.c b/lib/conf.c index 98c34b56..c37bb98b 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -49,8 +49,8 @@ cfg_stralloc(byte *s) void cf_register(struct cfitem *items) { - if(items[0].type!=CT_SECTION) - die("Invalid configuration section, first item must be of type CT_SECTION"); + if(items[0].type!=CT_SECTION && items[0].type!=CT_INCOMPLETE_SECTION) + die("cf_register: Invalid section type"); items[0].var=cfsection; cfsection=items; } @@ -67,15 +67,18 @@ int cf_item_count(void) struct cfitem *cf_get_item(byte *sect, byte *name) { - struct cfitem *item; + struct cfitem *item, *section; item=cfsection; while(item && strcasecmp(item->name,sect)) item=item->var; if(!item) /* unknown section */ return NULL; + section = item; for(item++; item->type && strcasecmp(item->name,name); item++); + if (!item->type && section->type == CT_INCOMPLETE_SECTION) + return NULL; return item; /* item->type == 0 if not found */ }