File:  [ELWIX - Embedded LightWeight unIX -] / libaitcfg / example / test_av2.c
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Aug 1 00:39:10 2012 UTC (10 years, 2 months ago) by misho
Branches: MAIN
CVS tags: cfg5_5, cfg5_4, HEAD, CFG5_4, CFG5_3
version 5.3

#include <stdio.h>
#include <aitcfg.h>


int
main(int argc, char **argv)
{
	cfg_root_t cfg;
	FILE *f;

	if (cfgInitConfig(&cfg)) {
		printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
		return 1;
	}

	f = fopen("test_lines.txt", "r");
	if (!f) {
		cfgUnloadConfig(&cfg);
		return 2;
	} else {
		if (argc > 1)
			cfgReadLines(f, argv[1], "\r\n", &cfg);
		else
			cfgReadLines(f, ":", "\r\n", &cfg);
		fclose(f);
	}

	cfgWriteConfig(stdout, &cfg, 0);
	cfgUnloadConfig(&cfg);
	return 0;
}

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