1 #ifndef __CONFIGLIB_H
2 #define __CONFIGLIB_H
3 
4 typedef struct
5 {
6   char *var;
7   char *val;
8 } confObj_t;
9 
10 /* Base of the chained list */
11 typedef struct config_t
12 {
13   confObj_t       *conf;
14   struct config_t *next;
15 } config_t;
16 
17 config_t *parseConfig ( char *filename );
18 config_t *_conf_setValue( config_t *start, confObj_t *confObj );
19 confObj_t *_conf_parseLine( char *line );
20 
21 config_t *_conf_getValue( config_t *start, char *var, char **dest);
22 void _conf_freeConfig( config_t *start );
23 void _conf_printConfig ( config_t *start );
24 void _conf_writeConfig( FILE *stream, config_t *config );
25 
26 int _conf_is_valid_line ( char *line, unsigned int size );
27 
28 /* Trem's contribution */
29 
30 void set_str_from_conf(config_t *config, char *type, char **value, char *def, char *errMsg, int exit_n);
31 
32 void set_int_from_conf(config_t *config, char *type, int *value, int def, char *errMsg, int exit_n);
33 
34 /* End of trem's contrib! */
35 
36 void set_bool_from_conf(config_t *config, char *type, int *value, int def, char *errMsg, int exit_n);
37 
38 #endif
39