File:
[ELWIX - Embedded LightWeight unIX -] /
libaitcfg /
example /
test_av2.c
Revision
1.5:
download - view:
text,
annotated -
select for diffs -
revision graph
Wed May 18 15:18:10 2016 UTC (8 years, 3 months ago) by
misho
Branches:
MAIN
CVS tags:
cfg9_5,
cfg9_4,
cfg9_3,
cfg9_2,
cfg9_1,
cfg8_2,
cfg8_1,
cfg8_0,
cfg7_9,
cfg7_8,
HEAD,
CFG9_4,
CFG9_3,
CFG9_2,
CFG9_1,
CFG9_0,
CFG8_1,
CFG8_0,
CFG7_9,
CFG7_8,
CFG7_7
7.7
1: #include <stdio.h>
2: #include <aitcfg.h>
3:
4:
5: int
6: main(int argc, char **argv)
7: {
8: cfg_root_t *cfg;
9: FILE *f;
10: ait_val_t *v;
11:
12: if (!(cfg = cfgInitConfig())) {
13: printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
14: return 1;
15: }
16:
17: f = fopen("test_lines.txt", "r");
18: if (!f) {
19: cfgUnloadConfig(cfg);
20: return 2;
21: } else {
22: if (argc > 1)
23: cfgReadLines(f, argv[1], "\r\n", cfg);
24: else
25: cfgReadLines(f, ":", "\r\n", cfg);
26:
27: printf("WriteLines::\n");
28: if (argc > 1)
29: v = cfgWriteLines(f, argv[1], "\r\n", NULL, cfg);
30: else
31: v = cfgWriteLines(stdout, ":", "\r\n", NULL, cfg);
32:
33: fclose(f);
34:
35: printf("\nait_val_t::\n");
36: if (!AIT_ISEMPTY(v))
37: printf("V=%s\n", AIT_GET_STR(v));
38: ait_freeVar(&v);
39: }
40:
41: printf("WriteConfig::\n");
42: cfgWriteConfig(stdout, cfg, 0);
43: cfgUnloadConfig(cfg);
44: return 0;
45: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>