Config iteration

This commit is contained in:
Imbus 2025-11-14 20:15:27 +01:00
parent ac6abd7c10
commit 77fd1763e0
3 changed files with 66 additions and 4 deletions

View file

@ -57,6 +57,13 @@ Config *config_load(const char *filename) {
return cfg;
}
ConfigEntry *config_get_next(ConfigEntry *entry, int *index) {
if (!entry)
return NULL;
return (0 == (*index)++) ? entry : entry->next;
}
/* Get value for a key */
const char *config_get(Config *cfg, const char *key) {
for (ConfigEntry *e = cfg->head; e; e = e->next) {