Main Page | Data Structures | Directories | File List | Data Fields | Globals

cfg-sample.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <cupl.h>
00004 
00005 int main(int argc, char **argv) {
00006     cfg_data *cfg;
00007 
00008     if (argc < 2) {
00009         fprintf(stderr, "Usage: %s config\n", argv[0]);
00010         return 0;
00011     }
00012 
00013     /* Init parser and get a cfg data pointer. */
00014     if ((cfg = cupl_init_cfg(argv[1])) == NULL) {
00015         fprintf(stderr, "Error in init_config_parser!\n");
00016         return -1;
00017     }
00018 
00019     /* Print info about the library. */
00020     cupl_print_info(cfg);
00021 
00022     /* Print parsed items. */
00023     cupl_print_items(cfg);
00024 
00025     printf("Listen address is %s.\n", cupl_get_var("ListenAddress", cfg));
00026 
00027     /* Close config file and free cfg data object. */
00028     cupl_release_cfg(cfg);
00029 
00030     return 1;
00031 }
00032 
00033 

Generated on Sat Aug 26 12:34:54 2006 for CUPL (Common UNIX Programming Library) by  doxygen 1.3.9.1