File:  [ELWIX - Embedded LightWeight unIX -] / libaitcfg / contrib / Attic / test.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Thu Aug 28 13:17:41 2008 UTC (15 years, 9 months ago) by misho
Branches: misho
CVS tags: start, cfg3_1, cfg3_0, CFG3_0
AITNET library for configs

#include <stdio.h>
#include <sys/types.h>
#include <aitcfg.h>

int main()
{
	sl_config lst;
	char szStr[256];

	/*
	printf("LoadConfig=%d\n", LoadConfig("test.conf", &lst));
	printf("errno=%d error=%s\n", cfg_GetErrno(), cfg_GetError());
	printf("Find Attribute at position=%d\n", FindAttribute(&lst, NULL, "testattr"));
	printf("GetAttribute value=%s\n", GetAttribute(&lst, "", "testattr"));
	printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
	printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
	printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
	printf("SetAttribute=%d\n", SetAttribute(&lst, NULL, "att", "0001122222222222"));
	printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "att", "0001122222222222"));
	printf("SetAttribute=%d\n", SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
	printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));
	printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", "a"));
	printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", ""));
	printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, NULL, "att"));
	printf("UnsetAttribute=%d\n", UnsetAttribute(&lst, "global", "attr2"));
	printf("GetAttribute value=%s\n", GetAttribute(&lst, "global", "attr2"));

	printf("SetAttribute=%d\n", SetAttribute(&lst, "section", "attr3", NULL));
	printf("LoadValue=%d :: ", LoadAttribute(&lst, "section", "attr3", szStr, 255, "iH"));
	printf("Str=%s\n", szStr);
	*/
	InitConfig(&lst);
	printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, NULL, "att", "0001122222222222"));
	printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, "global", "att", "0001122222222222"));
	printf("SetAttribute=%d\n", cfg_SetAttribute(&lst, "global", "attr2", "1111111122222222222"));
	printf("GetAttribute value=%s\n", cfg_GetAttribute(&lst, "global", "attr2"));
	printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", "a"));
	printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", ""));
	printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, NULL, "att"));
	printf("UnsetAttribute=%d\n", cfg_UnsetAttribute(&lst, "global", "attr2"));

	printf("CreateConfig=%d\n", CreateConfig("test4e.cfg", &lst));
	printf("errno=%d error=%s\n", cfg_GetErrno(), cfg_GetError());
	UnloadConfig(&lst);
	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>