Annotation of libaitcfg/contrib/test.c, revision 1.1.1.1
1.1 misho 1: #include <stdio.h>
2: #include <sys/types.h>
3: #include <aitcfg.h>
4:
5: int main()
6: {
7: sl_config lst;
8: char szStr[256];
9:
10: /*
11: printf("LoadConfig=%d\n", LoadConfig("test.conf", &lst));
12: printf("errno=%d error=%s\n", cfg_GetErrno(), cfg_GetError());
13: printf("Find Attribute at position=%d\n", FindAttribute(&lst, NULL, "testattr"));
14: printf("GetAttribute value=%s\n", GetAttribute(&lst, "", "testattr"));
15: printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
16: printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
17: printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
18: printf("SetAttribute=%d\n", SetAttribute(&lst, NULL, "att", "0001122222222222"));
19: printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "att", "0001122222222222"));
20: printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
21: printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
22: printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", "a"));
23: printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", ""));
24: printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, NULL, "att"));
25: printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", "attr2"));
26: printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
27:
28: printf("SetAttribute=%d\n", SetAttribute(&lst, "section", "attr3", NULL));
29: printf("LoadValue=%d :: ", LoadAttribute(&lst, "section", "attr3", szStr, 255, "iH"));
30: printf("Str=%s\n", szStr);
31: */
32: InitConfig(&lst);
33: printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, NULL, "att", "0001122222222222"));
34: printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, "global", "att", "0001122222222222"));
35: printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
36: printf("GetAttribute value=%s\n", cfg_GetAttribute(&lst, "global", "attr2"));
37: printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", "a"));
38: printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", ""));
39: printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, NULL, "att"));
40: printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", "attr2"));
41:
42: printf("CreateConfig=%d\n", CreateConfig("test4e.cfg", &lst));
43: printf("errno=%d error=%s\n", cfg_GetErrno(), cfg_GetError());
44: UnloadConfig(&lst);
45: return 0;
46: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>