summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-14 12:53:39 -0400
committerpommicket <pommicket@gmail.com>2025-09-14 12:53:39 -0400
commitee7e2dbf3d6bc4ef8d4019c666a8960976c1af75 (patch)
treec5b607087786e028f98e34de001fa9b1e0e08773 /examples
parentc8ef3a67210c980d5d1ff2c1bd7d8fffd39846b5 (diff)
Parse uint
Diffstat (limited to 'examples')
-rw-r--r--examples/conf.pom9
-rw-r--r--examples/read_conf.c21
2 files changed, 7 insertions, 23 deletions
diff --git a/examples/conf.pom b/examples/conf.pom
index ed37ed9..6b839d1 100644
--- a/examples/conf.pom
+++ b/examples/conf.pom
@@ -1,7 +1,2 @@
-[number]p
-one = 1
-two = 2x"\?
-three j= "3
-is
-the
- best"
+[number]
+best = "0x127432"
diff --git a/examples/read_conf.c b/examples/read_conf.c
index 18802e3..c4cabfc 100644
--- a/examples/read_conf.c
+++ b/examples/read_conf.c
@@ -12,21 +12,10 @@ int main(int argc, char **argv) {
free(error);
return EXIT_FAILURE;
}
- pom_conf *conf2 = pom_load_string("<inline>", "foo=bar\r\n[j.number]\n"
- "one = I\n"
- "five = V\n", &error);
- if (!conf2) {
- pom_conf_free(conf);
- pom_error_print(error);
- free(error);
- return EXIT_FAILURE;
- }
- pom_conf *copy = pom_conf_copy(conf);
- pom_conf_merge(copy,pom_conf_section(conf2,"j"));
- pom_conf *copy2 = pom_conf_copy(copy);
- pom_conf_print(copy2);
+ uint64_t value;
+ const char *s = pom_conf_get_uint(conf, "number.best", &value);
+ printf("%" PRIu64 "\n", value);
+ if (s) printf(" -> %s\n",s);
+ pom_conf_print(conf);
pom_conf_free(conf);
- pom_conf_free(copy);
- pom_conf_free(copy2);
- pom_conf_free(conf2);
}