File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / confuse / doc / listing2.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Jan 24 14:48:55 2017 UTC (7 years, 5 months ago) by misho
Branches: confuse, MAIN
CVS tags: v3_3, v2_7, HEAD
confuse 2.7

    1: #include <stdio.h>
    2: #include <confuse.h>
    3: 
    4: int main(void)
    5: {
    6:     cfg_opt_t opts[] =
    7:     {
    8:         CFG_STR("target", "World", CFGF_NONE),
    9:         CFG_END()
   10:     };
   11:     cfg_t *cfg;
   12: 
   13:     cfg = cfg_init(opts, CFGF_NONE);
   14:     if(cfg_parse(cfg, "hello.conf") == CFG_PARSE_ERROR)
   15:         return 1;
   16: 
   17:     printf("Hello, %s!\n", cfg_getstr(cfg, "target"));
   18: 
   19:     cfg_free(cfg);
   20:     return 0;
   21: }
   22: 

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