blob: 18802e372908c1196a9d33ccbf8cbfb44f37fe2e (
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
25
26
27
28
29
30
31
32
|
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#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("<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);
pom_conf_free(conf);
pom_conf_free(copy);
pom_conf_free(copy2);
pom_conf_free(conf2);
}
|