|  |  |  | libuser Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <libuser/config.h> GList * lu_cfg_read (struct lu_context *context,const char *key,const char *default_value); const char * lu_cfg_read_single (struct lu_context *context,const char *key,const char *default_value); GList * lu_cfg_read_keys (struct lu_context *context,const char *parent_key);
These routines allow an application or module to read configuration data from the libuser configuration.
GList * lu_cfg_read (struct lu_context *context,const char *key,const char *default_value);
Reads the list of values for a given key from the configuration space.
| 
 | A valid libuser library context. | 
| 
 | The value to be read from the configuration. The key should be of the form "section/key" for most purposes. For example, the files module uses keys of the form "files/foo" for all of its configuration data. | 
| 
 | A default value to be returned in case none are found.  Can
be NULL. | 
| Returns : | A GList of values, formatted as strings.  The list must be freed
by calling g_list_free(). | 
const char * lu_cfg_read_single (struct lu_context *context,const char *key,const char *default_value);
Read a single value set for a given key in the configuration space. This is a convenience function. Additional values, if any, will be ignored.
| 
 | A valid libuser library context. | 
| 
 | The value to be read from the configuration. The key should be of the form "section/key" for most purposes. For example, the files module uses keys of the form "files/foo" for all of its configuration data. | 
| 
 | A default value to be returned in case none are found.  Can
be NULL. | 
| Returns : | A string representation of one of the values set for the key. This string must not be freed. | 
GList * lu_cfg_read_keys (struct lu_context *context,const char *parent_key);
Read the names of all of the keys in a specified section of the configuration space. This function is typically used for walking the configuration space.
| 
 | A valid libuser library context. | 
| 
 | The parent key under which the caller wishes to know which subkeys are present. | 
| Returns : | A GList of string representations of key names.  The list must be
freed using g_list_free(). |