File:
[ELWIX - Embedded LightWeight unIX -] /
libaitcfg /
example /
test_boot.c
Revision
1.3:
download - view:
text,
annotated -
select for diffs -
revision graph
Wed Jul 25 15:24:20 2012 UTC (12 years, 2 months ago) by
misho
Branches:
MAIN
CVS tags:
cfg9_5,
cfg9_4,
cfg9_3,
cfg9_2,
cfg9_1,
cfg8_2,
cfg8_1,
cfg8_0,
cfg7_9,
cfg7_8,
cfg7_7,
cfg7_6,
cfg7_5,
cfg7_4,
cfg7_3,
cfg7_2,
cfg7_1,
cfg7_0,
cfg6_1,
cfg5_5,
cfg5_4,
cfg5_3,
HEAD,
CFG9_4,
CFG9_3,
CFG9_2,
CFG9_1,
CFG9_0,
CFG8_1,
CFG8_0,
CFG7_9,
CFG7_8,
CFG7_7,
CFG7_6,
CFG7_5,
CFG7_4,
CFG7_3,
CFG7_2,
CFG7_1,
CFG7_0,
CFG6_1,
CFG6_0,
CFG5_4,
CFG5_3,
CFG5_2
version 5.2
#include <stdio.h>
#include <aitcfg.h>
int
main(int argc, char **argv)
{
cfg_root_t cfg;
if (cfgLoadConfig(argv[1], &cfg)) {
printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
return 1;
}
cfgWriteConfig(stdout, &cfg, 0);
printf("\n++++++++++++++++++ update IP with 192.168.234.11 ...\n\n");
cfg_setAttribute(&cfg, NULL, "IP2", "192.168.2.1");
cfg_setAttribute(&cfg, NULL, "IP", "192.168.234.11");
cfg_setAttribute(&cfg, NULL, "OPT", "\"\"");
cfg_setAttribute(&cfg, NULL, "OZZ", NULL);
cfg_unsetAttribute(&cfg, NULL, "OPT");
cfg_unsetAttribute(&cfg, NULL, "OPT2");
cfgWriteConfig(stdout, &cfg, 0);
printf("\n............ with whitespaces \n\n");
cfgWriteConfig(stdout, &cfg, 1);
cfgClearConfig(&cfg);
printf("\n============ reuse with whitespaces \n\n");
cfg_setAttribute(&cfg, NULL, "ALIAS0", "1.1.1.1");
cfg_setAttribute(&cfg, NULL, "ALIAS1", "2.2.2.2");
cfgWriteConfig(stdout, &cfg, 1);
cfgUnloadConfig(&cfg);
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>