File:  [ELWIX - Embedded LightWeight unIX -] / libaitcfg / example / test_boot.c
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Apr 4 13:11:48 2012 UTC (12 years, 1 month ago) by misho
Branches: MAIN
CVS tags: cfg5_2, cfg5_1, HEAD, CFG5_1, CFG5_0
Release version 5.0

    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: 
   10: 	if (cfgLoadConfig(argv[1], &cfg)) {
   11: 		printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
   12: 		return 1;
   13: 	}
   14: 
   15: 	cfgWriteConfig(stdout, &cfg, 0);
   16: 
   17: 	printf("\n++++++++++++++++++ update IP with 192.168.234.11 ...\n\n");
   18: 	cfg_setAttribute(&cfg, NULL, "IP2", "192.168.2.1");
   19: 	cfg_setAttribute(&cfg, NULL, "IP", "192.168.234.11");
   20: 	cfg_setAttribute(&cfg, NULL, "OPT", "\"\"");
   21: 	cfg_setAttribute(&cfg, NULL, "OZZ", NULL);
   22: 	cfg_unsetAttribute(&cfg, NULL, "OPT");
   23: 	cfg_unsetAttribute(&cfg, NULL, "OPT2");
   24: 
   25: 	cfgWriteConfig(stdout, &cfg, 0);
   26: 
   27: 	printf("\n............ with whitespaces \n\n");
   28: 	cfgWriteConfig(stdout, &cfg, 1);
   29: 	cfgUnloadConfig(&cfg);
   30: 	return 0;
   31: }

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