summaryrefslogtreecommitdiff
path: root/examples/read_conf.c
blob: acc3ebaaa2149809210118f84ade733b06827ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>

#include "pom.h"

int main(int argc, char **argv) {
	pom_error *error;
	pom_settings settings = {0};
	strcpy(settings.error_lang, "fr");
	pom_conf *conf = pom_load_path(&settings, argc >= 2 ? argv[1] : "conf.pom", &error);
	if (!conf) {
		pom_error_print(error);
		free(error);
		return EXIT_FAILURE;
	}
	char **list = pom_conf_get_list(conf, "things");
	for (size_t i = 0; list[i]; i++) {
		printf("%s\n",list[i]);
	}
	free(list);
	pom_conf_print(conf);
	pom_conf_free(conf);
}