Annotation of libaitcfg/example/test_av2.c, revision 1.5
1.2 misho 1: #include <stdio.h>
2: #include <aitcfg.h>
3:
4:
5: int
6: main(int argc, char **argv)
7: {
1.5 ! misho 8: cfg_root_t *cfg;
1.2 misho 9: FILE *f;
1.3 misho 10: ait_val_t *v;
1.2 misho 11:
1.5 ! misho 12: if (!(cfg = cfgInitConfig())) {
1.2 misho 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) {
1.5 ! misho 19: cfgUnloadConfig(cfg);
1.2 misho 20: return 2;
21: } else {
22: if (argc > 1)
1.5 ! misho 23: cfgReadLines(f, argv[1], "\r\n", cfg);
1.2 misho 24: else
1.5 ! misho 25: cfgReadLines(f, ":", "\r\n", cfg);
1.3 misho 26:
27: printf("WriteLines::\n");
28: if (argc > 1)
1.5 ! misho 29: v = cfgWriteLines(f, argv[1], "\r\n", NULL, cfg);
1.3 misho 30: else
1.5 ! misho 31: v = cfgWriteLines(stdout, ":", "\r\n", NULL, cfg);
1.3 misho 32:
1.2 misho 33: fclose(f);
1.3 misho 34:
35: printf("\nait_val_t::\n");
36: if (!AIT_ISEMPTY(v))
37: printf("V=%s\n", AIT_GET_STR(v));
1.4 misho 38: ait_freeVar(&v);
1.2 misho 39: }
40:
1.3 misho 41: printf("WriteConfig::\n");
1.5 ! misho 42: cfgWriteConfig(stdout, cfg, 0);
! 43: cfgUnloadConfig(cfg);
1.2 misho 44: return 0;
45: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>