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, 4 months ago) by misho
Branches: confuse, MAIN
CVS tags: v3_3, v2_7, HEAD
confuse 2.7

#include <stdio.h>
#include <confuse.h>

int main(void)
{
    cfg_opt_t opts[] =
    {
        CFG_STR("target", "World", CFGF_NONE),
        CFG_END()
    };
    cfg_t *cfg;

    cfg = cfg_init(opts, CFGF_NONE);
    if(cfg_parse(cfg, "hello.conf") == CFG_PARSE_ERROR)
        return 1;

    printf("Hello, %s!\n", cfg_getstr(cfg, "target"));

    cfg_free(cfg);
    return 0;
}


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