This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
libcfu/examples/conf_example2.c
Matthew Brush f660e3460a Initial commit
All of the files from the tarball downloaded from SourceForge are
being checked in so there's a record of the changes made compared
to it (since I can't find the libcfu source repository). The
generated files will be removed in the following commit.
2013-03-04 01:40:58 -08:00

49 lines
791 B
C

/* Creation date: 2005-07-25 22:00:49
* Authors: Don
* Change log:
*/
#include "cfuconf.h"
#include <stdlib.h>
#ifdef CFU_DEBUG
#ifdef NDEBUG
#undef NDEBUG
#endif
#else
#ifndef NDEBUG
#define NDEBUG 1
#endif
#endif
#include <assert.h>
int main(int argc, char **argv) {
cfuconf_t *conf = NULL;
char *error = NULL;
char *buffer = "SetVar Test1 Val1\n"
"SetVar Test2 Val2\n"
"<test_container c1>\n"
" SetVar Test3 Val3\n"
" SetVar Test4 Val4\n"
"</test_container>\n";
argc = argc;
argv = argv;
if (cfuconf_parse_buffer(buffer, &conf, &error) < 0) {
fprintf(stderr, "Error loading conf buffer: %s\n", error);
free(error);
exit(-1);
}
fprintf(stderr, "\n\nvals:\n\n");
cfuconf_pretty_print_conf(conf, stderr, 0);
cfuconf_destroy(conf);
return 0;
}