config-engine

Name

config-engine -- 

Synopsis



int         config_get_section              (config_t *cfg,
                                             const char *section,
                                             int *line);
const char* config_get                      (config_t *cfg,
                                             const char *section,
                                             const char *entry,
                                             int *line);
int         config_set                      (config_t *cfg,
                                             const char *section,
                                             const char *entry,
                                             const char *val);
config_t*   config_open                     (const char *filename);
int         config_close                    (config_t *cfg);

Description

Details

config_get_section ()

int         config_get_section              (config_t *cfg,
                                             const char *section,
                                             int *line);

If section is found, line is updated to reflect the line where the section was found.

cfg :

section :

Section we are searching for.

line :

Pointer to a line number we should start the search at.

Returns :

0 if the section was found, -1 otherwise.


config_get ()

const char* config_get                      (config_t *cfg,
                                             const char *section,
                                             const char *entry,
                                             int *line);

cfg :

section :

entry :

line :

Returns :


config_set ()

int         config_set                      (config_t *cfg,
                                             const char *section,
                                             const char *entry,
                                             const char *val);

Set an entry 'entry' to the specified value, and, in case it is not NULL, in the specified section in the config file identified by 'cfg'.

cfg :

Configuration file identifier.

section :

Section where the entry should be set.

entry :

Entry to set.

val :

Value for the entry.

Returns :

0 on success, -1 otherwise.


config_open ()

config_t*   config_open                     (const char *filename);

Open the configuration file pointed to by 'filename' and load it into memory, the returned config_t object will have to be used for any operation on this configuration file.

filename :

The configuration file.

Returns :

a config_t object on success, NULL otherwise.


config_close ()

int         config_close                    (config_t *cfg);

Close the 'cfg' object, used to access the configuration file. Any change made with the config_set() function call will be written.

cfg :

Configuration file identifier.

Returns :

0 on success, -1 otherwise.