提交 5edc9cf9 编写于 作者: J jp9000

added some more config file functions for going through each section

上级 2a9e3a71
......@@ -331,6 +331,24 @@ void config_close(config_t config)
bfree(config);
}
size_t config_num_sections(config_t config)
{
return config->sections.num;
}
const char *config_get_section(config_t config, size_t idx)
{
struct config_section *section;
if (idx >= config->sections.num)
return NULL;
section = darray_item(sizeof(struct config_section), &config->sections,
idx);
return section->name;
}
static struct config_item *config_find_item(struct darray *sections,
const char *section, const char *name)
{
......
......@@ -52,6 +52,9 @@ EXPORT int config_open_defaults(config_t config, const char *file);
EXPORT int config_save(config_t config);
EXPORT void config_close(config_t config);
EXPORT size_t config_num_sections(config_t config);
EXPORT const char *config_get_section(config_t config, size_t idx);
EXPORT void config_set_string(config_t config, const char *section,
const char *name, const char *value);
EXPORT void config_set_int(config_t config, const char *section,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册