diff options
Diffstat (limited to 'examples/read_conf.c')
-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); } |