## config

config — Routines for reading configuration information for the libuser library.

## Functions

GList * | lu_cfg_read ()
const char * | lu_cfg_read_single ()
GList * | lu_cfg_read_keys ()

## Includes

    #include <libuser/config.h>

## Description

These routines allow an application or module to read configuration data from the libuser configuration.

## Functions

### lu_cfg_read ()

    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.

#### Parameters

context | A valid libuser library context. |
key | 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. |
default_value | 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()`.

### lu_cfg_read_single ()

    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.

#### Parameters

context | A valid libuser library context. |
key | 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. |
default_value | 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.

### lu_cfg_read_keys ()

    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.

#### Parameters

context | A valid libuser library context. |
parent_key | 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()`.

## Types and Values