From 08d04bc5ad1096069facbea143c8172243ba2eba Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Fri, 9 Feb 2001 10:48:55 +0000 Subject: [PATCH] added cf_item_count() --- lib/conf.c | 10 ++++++++++ lib/conf.h | 1 + 2 files changed, 11 insertions(+) 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); -- 2.39.2