#include #include #include #include "pom.h" 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); free(error); return EXIT_FAILURE; } pom_conf *conf2 = pom_load_string("", "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_item_iter *iter = NULL; const pom_item *item; pom_conf_merge(conf,pom_conf_section(conf2,"j")); while ((item = pom_conf_next_item(conf, &iter))) { printf("Key: %s, Value: %s\n", item->key, item->value); const char *file; uint64_t line; pom_conf_location(conf,item->key,&file,&line); printf(" Defined at %s:%" PRIu64 "\n",file,line); } pom_conf_free(conf); pom_conf_free(conf2); }