summaryrefslogtreecommitdiff
path: root/examples/read_conf.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-12 13:10:53 -0400
committerpommicket <pommicket@gmail.com>2025-09-12 13:10:53 -0400
commit81c1cecf40b0733446fb0d945505155d87bf74c6 (patch)
tree2649bf5e70359c24e8c906438efe48304fa1be9c /examples/read_conf.c
parent9865b70c855500ea3cae76fb8c9986bdf6f249ca (diff)
Getting items
Diffstat (limited to 'examples/read_conf.c')
-rw-r--r--examples/read_conf.c8
1 files changed, 8 insertions, 0 deletions
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 <stdlib.h>
#include <string.h>
+#include <inttypes.h>
#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))) {