Location of configfile: $XDG_CONFIG_HOME/$CFG_NAME/configfile
.
More...
Classes | |
union | conf_entry_val |
Configuration array entry value. More... | |
struct | conf |
Configuration array entry. More... | |
Macros | |
#define | MAIN_ERR_PREFIX "CONF: " |
Message prefix for CONF module. | |
#define | CONF_PERM (posix_mode_t) (POSIX_S_IRUSR | POSIX_S_IWUSR) |
Permissions for config file. | |
#define | CONF_NUM 57 |
Number of entries in global configuration array. | |
Functions | |
void | conf_delete (struct conf *cfg) |
Delete configuration. More... | |
int | conf_load (struct conf *cfg) |
Load configuration from config file. More... | |
int | conf_store (struct conf *cfg) |
Store configuration to config file. More... | |
int | conf_string_replace (struct conf *cfg, const char *s) |
Replace configuration string. More... | |
int | conf_integer_check (enum conf_entry id, int min, int max) |
Check integer value against lower and upper bounds. More... | |
Variables | |
struct conf | config [CONF_NUM] |
Global configuration. More... | |
int | conf_ephemeral_passwd = 0 |
Flag indicating that password should not be stored in configfile. More... | |
Location of configfile: $XDG_CONFIG_HOME/$CFG_NAME/configfile
.
Any line starting with #
is treated as a comment (not parsed and ignored).
To add a new entry:
conf_init_configuration()
to init the new entry to a default enum conf_entry |
IDs for use as index in configuration array.
enum conf_entry_type |
void conf_delete | ( | struct conf * | cfg | ) |
Delete configuration.
This function will free the memory allocated for the configuration array entries with string type.
[in] | cfg | Pointer to configuration array |
Definition at line 726 of file conf.c.
Referenced by conf_load().
int conf_integer_check | ( | enum conf_entry | id, |
int | min, | ||
int | max | ||
) |
Check integer value against lower and upper bounds.
[in] | id | ID of integer value to check |
[in] | min | Lower limit |
[in] | max | Upper limit |
The integer value associated with id is compared against the specified limits.
If the value is lower than min or greater than max , it is clamped to the limits. Otherwise the value is unchanged.
Definition at line 958 of file conf.c.
References config, conf_entry_val::i, and conf::val.
int conf_load | ( | struct conf * | cfg | ) |
Load configuration from config file.
[in] | cfg | Pointer to configuration array |
For configuration entries with string type, this function allocates memory. On success the caller is responsible to free this memory with the function conf_delete() .
Definition at line 762 of file conf.c.
References conf_delete().
int conf_store | ( | struct conf * | cfg | ) |
int conf_string_replace | ( | struct conf * | cfg, |
const char * | s | ||
) |
Replace configuration string.
[in] | cfg | Pointer to configuration array entry |
[in] | s | Pointer to new string |
cfg must point to a configuration entry of string type. The current string will be replaced with s .
Definition at line 912 of file conf.c.
References CONF_TYPE_STRING, conf_entry_val::s, secure_clear_string(), conf::type, and conf::val.
int conf_ephemeral_passwd = 0 |
Flag indicating that password should not be stored in configfile.
If this flag is nonzero a call to conf_store() will delete the password from the configuration before writing it to disk.
Global configuration.
There must be CONF_NUM entries of type conf in ascending order starting from zero without holes, so that conf_entry IDs can be used as index.
Definition at line 63 of file conf.c.
Referenced by conf_integer_check(), core_get_cancel_key(), core_get_datetime(), core_get_distribution(), core_get_introduction(), core_get_signature(), core_post_article(), enc_mime_flowed_decode(), ext_editor(), ext_inews(), ext_pp_filter(), filter_exit(), filter_init(), filter_match_own(), group_exit(), group_init(), tls_cert_verify(), and tls_crl_update_check().