diff --git a/lib/config/config.c b/lib/config/config.c index 0a1e0e650..4292f8cdd 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -682,3 +682,18 @@ int get_config_uint64(struct config_node *cn, const char *path, *result = (uint64_t) n->v->v.i; return 1; } + +int get_config_str(struct config_node *cn, const char *path, + char sep, char **result) +{ + struct config_node *n; + + n = find_config_node(cn, path, sep); + + if (!n || !n->v || n->v->type != CFG_STRING) + return 0; + + *result = n->v->v.str; + return 1; +} + diff --git a/lib/config/config.h b/lib/config/config.h index 8c4fa8672..1f07a312f 100644 --- a/lib/config/config.h +++ b/lib/config/config.h @@ -68,5 +68,8 @@ int get_config_uint32(struct config_node *cn, const char *path, int get_config_uint64(struct config_node *cn, const char *path, char sep, uint64_t *result); +int get_config_str(struct config_node *cn, const char *path, + char sep, char **result); + #endif