diff --git a/src/kernel/config.c b/src/kernel/config.c index d369d0ecd..0e1f159eb 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -712,6 +712,40 @@ bool config_changed(int *cache_key) { return false; } +#define MAXKEYS 16 +void config_set_from(const dictionary *d) +{ + int s, nsec = iniparser_getnsec(d); + for (s=0;s!=nsec;++s) { + char key[128]; + const char *sec = iniparser_getsecname(d, s); + int k, nkeys = iniparser_getsecnkeys(d, sec); + const char *akeys[MAXKEYS]; + const char ** keys = akeys; + size_t slen = strlen(sec); + assert(slenMAXKEYS) { + keys = malloc(sizeof(const char *) * nkeys); + } + iniparser_getseckeys(d, sec, keys); + for (k=0;k!=nkeys;++k) { + const char *val; + size_t klen = strlen(keys[k]); + assert(klen+slen+1