From: Robert Spalek Date: Fri, 9 Feb 2001 10:48:55 +0000 (+0000) Subject: added cf_item_count() X-Git-Tag: holmes-import~1558 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=08d04bc5ad1096069facbea143c8172243ba2eba;p=libucw.git added cf_item_count() --- diff --git a/lib/conf.c b/lib/conf.c index b899b55e..223ff666 100644 --- a/lib/conf.c +++ b/lib/conf.c @@ -53,6 +53,16 @@ void cf_register(struct cfitem *items) cfsection=items; } +int cf_item_count(void) +{ + struct cfitem *sect, *item; + int count = 0; + for (sect = cfsection; sect; sect = sect->var) + for (item = sect+1; sect->type; sect++) + count++; + return count; +} + struct cfitem *cf_get_item(byte *sect, byte *name) { struct cfitem *item; diff --git a/lib/conf.h b/lib/conf.h index bc3c35de..b01cba3b 100644 --- a/lib/conf.h +++ b/lib/conf.h @@ -39,6 +39,7 @@ void cf_register(struct cfitem *items); * Direct setting of configuration items and parsing the configuration file. */ +int cf_item_count(void); struct cfitem *cf_get_item(byte *sect, byte *name); byte *cf_set_item(byte *sect, byte *name, byte *value); void cf_read(byte *filename);