62 const char *value,
struct Buffer *err)
65 if (value && (value[0] ==
'\0'))
83 char opt[128] = { 0 };
85 snprintf(opt,
sizeof(opt),
_(
"Option %s: "), cdef->
name);
104 rc = cdef->
validator(cdef, (intptr_t) exp, err);
115 *(
struct Expando **) var = exp;
137 const char *str = NULL;
161 intptr_t value,
struct Buffer *err)
189 struct Expando *exp_copy = NULL;
202 *(
struct Expando **) var = exp_copy;
213 return (intptr_t) exp;
220 const char *value,
struct Buffer *err)
223 if (!value || (value[0] ==
'\0'))
234 if (exp_old && exp_old->
string)
245 char opt[128] = { 0 };
247 snprintf(opt,
sizeof(opt),
_(
"Option %s: "), cdef->
name);
260 rc = cdef->
validator(cdef, (intptr_t) exp_new, err);
270 *(
struct Expando **) var = exp_new;
280 const char *initial = (
const char *) cdef->
initial;
283 const char *exp_str = exp ? exp->
string : NULL;
294 const char *initial = (
const char *) cdef->
initial;
319 rc = cdef->
validator(cdef, (intptr_t) exp, err);
333 *(
struct Expando **) var = exp;
376 return (
const struct Expando *) value;
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_insert(struct Buffer *buf, size_t offset, const char *s)
Add a string in the middle of a buffer.
Convenience wrapper for the config headers.
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_SUC_EMPTY
Value is empty/unset.
#define CSR_SUCCESS
Action completed successfully.
const struct ConfigSetType CstExpando
Config type representing an Expando.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
struct Expando * expando_parse(const char *str, const struct ExpandoDefinition *defs, struct Buffer *err)
Parse an Expando string.
void expando_free(struct Expando **ptr)
Free an Expando object.
bool expando_equal(const struct Expando *a, const struct Expando *b)
Compare two expandos.
static void expando_destroy(void *var, const struct ConfigDef *cdef)
Destroy an Expando object - Implements ConfigSetType::destroy() -.
static bool expando_has_been_set(void *var, const struct ConfigDef *cdef)
Is the config value different to its initial value? - Implements ConfigSetType::has_been_set() -.
static int expando_native_set(void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.
static intptr_t expando_native_get(void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.
static int expando_reset(void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset an Expando to its initial value - Implements ConfigSetType::reset() -.
static int expando_string_get(void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get an Expando as a string - Implements ConfigSetType::string_get() -.
static int expando_string_plus_equals(void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
Add to an Expando by string - Implements ConfigSetType::string_plus_equals() -.
static int expando_string_set(void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set an Expando by string - Implements ConfigSetType::string_set() -.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
int mutt_str_asprintf(char **strp, const char *fmt,...)
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
String manipulation buffer.
const char * name
User-visible name.
int(* validator)(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t data
Extra variable data.
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
A set of inherited config items.
Definition of a format string.
const char * string
Pointer to the parsed string.
The item stored in a Hash Table.
int type
Type of data stored in Hash Table, e.g. DT_STRING.
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
#define D_NOT_EMPTY
Empty strings are not allowed.