/* test_config.c */ #include #include #include "config.h" #define BUFLEN 80 int main(int argc, char **argv) { Config c; const char *configfile; char *keywd, *rest; char buf[BUFLEN]; if (argc != 2) { fprintf(stderr, "usage: %s configfile\n", argv[0]); exit(1); } configfile = argv[1]; printf("Printing contents of %s\n", configfile); config_init(&c); config_open(&c, configfile); while (config_read(&c, buf, BUFLEN, &keywd, &rest) > 0) { printf("%-20s%s\n", keywd, rest); } config_close(&c); config_destroy(&c); return 0; }