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

cfg-sample.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <cupl.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main int  argc,
char **  argv
 

Definition at line 5 of file cfg-sample.c.

References cupl_get_var(), cupl_init_cfg(), cupl_print_info(), cupl_print_items(), and cupl_release_cfg().

00005                                 {
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 }


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