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 (11 years, 9 months ago) by misho
Branches: MAIN
CVS tags: cfg5_5, cfg5_4, HEAD, CFG5_4, CFG5_3
version 5.3

    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: 
   11: 	if (cfgInitConfig(&cfg)) {
   12: 		printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
   13: 		return 1;
   14: 	}
   15: 
   16: 	f = fopen("test_lines.txt", "r");
   17: 	if (!f) {
   18: 		cfgUnloadConfig(&cfg);
   19: 		return 2;
   20: 	} else {
   21: 		if (argc > 1)
   22: 			cfgReadLines(f, argv[1], "\r\n", &cfg);
   23: 		else
   24: 			cfgReadLines(f, ":", "\r\n", &cfg);
   25: 		fclose(f);
   26: 	}
   27: 
   28: 	cfgWriteConfig(stdout, &cfg, 0);
   29: 	cfgUnloadConfig(&cfg);
   30: 	return 0;
   31: }

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