diff options
author | pommicket <pommicket@gmail.com> | 2025-09-14 01:08:06 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-14 01:08:06 -0400 |
commit | 1ed5d20169194631b3da49982df82774fcba7cb7 (patch) | |
tree | bcb6b37ca31bcb26c9e8ad5fbba1b9137bfe85d2 /examples | |
parent | d8192f73672488234bd12319229402153e7b6c21 (diff) |
error to string, conf copy
Diffstat (limited to 'examples')
-rw-r--r-- | examples/read_conf.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/read_conf.c b/examples/read_conf.c index 6b7c18f..54a1e86 100644 --- a/examples/read_conf.c +++ b/examples/read_conf.c @@ -8,7 +8,12 @@ int main(int argc, char **argv) { pom_error *error; pom_conf *conf = pom_load_path(argc >= 2 ? argv[1] : "conf.pom", &error); if (!conf) { - pom_error_print(error); + char *string = pom_error_to_string(error); + for (char *s=string; *s; s++) + if (*s >= 'a' && *s <= 'z') + *s += 'A' - 'a'; + printf("%s\n",string); + free(string); free(error); return EXIT_FAILURE; } @@ -21,8 +26,12 @@ int main(int argc, char **argv) { free(error); return EXIT_FAILURE; } - pom_conf_merge(conf,pom_conf_section(conf2,"j")); - pom_conf_print(conf); + 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); pom_conf_free(conf); + pom_conf_free(copy); + pom_conf_free(copy2); pom_conf_free(conf2); } |