From 81c1cecf40b0733446fb0d945505155d87bf74c6 Mon Sep 17 00:00:00 2001 From: pommicket Date: Fri, 12 Sep 2025 13:10:53 -0400 Subject: Getting items --- examples/read_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'examples/read_conf.c') diff --git a/examples/read_conf.c b/examples/read_conf.c index ed33e21..966f0a2 100644 --- a/examples/read_conf.c +++ b/examples/read_conf.c @@ -1,5 +1,6 @@ #include #include +#include #include "pom.h" @@ -11,6 +12,13 @@ int main(int argc, char **argv) { free(error); return EXIT_FAILURE; } + printf("number.one: %s\n", pom_conf_get(conf, "number.one")); + printf("number.tow: %s\n", pom_conf_get_or_default(conf, "number.tow", "(none)")); + printf("has thing? %d\n", pom_conf_has(conf, "thing")); + const char *file; uint64_t line; + if (pom_conf_location(conf, "thing", &file, &line)) { + printf("\tthing location: %s:%" PRIu64 "\n", file,line); + } const pom_item *item; pom_item_iter *iter = NULL; while ((item = pom_conf_next_item(conf, &iter))) { -- cgit v1.2.3