46 const char *value,
struct Buffer *err)
48 if (!value || (value[0] ==
'\0'))
55 if (!mutt_str_atol_full(value, &num))
69 if (num == (*(
long *) var))
77 int rc = cdef->
validator(cs, cdef, (intptr_t) num, err);
102 value = *(
long *) var;
122 if (value == (*(
long *) var))
130 int rc = cdef->
validator(cs, cdef, value, err);
136 *(
long *) var = value;
146 return *(
long *) var;
154 const char *value,
struct Buffer *err)
157 if (!mutt_str_atol_full(value, &num))
163 long result = *((
long *) var) + num;
170 if (result == (*(
long *) var))
178 int rc = cdef->
validator(cs, cdef, (intptr_t) result, err);
184 *(
long *) var = result;
193 const char *value,
struct Buffer *err)
196 if (!mutt_str_atol_full(value, &num))
202 long result = *((
long *) var) - num;
209 if (result == (*(
long *) var))
217 int rc = cdef->
validator(cs, cdef, (intptr_t) result, err);
223 *(
long *) var = result;
233 if (cdef->
initial == (*(
long *) var))
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
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_TYPE
Value is not valid for the type.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_SUCCESS
Action completed successfully.
static intptr_t long_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get a long from a Long config item - Implements ConfigSetType::native_get() -.
static int long_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Long config item by long - Implements ConfigSetType::native_set() -.
static int long_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Long to its initial value - Implements ConfigSetType::reset() -.
static int long_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Long as a string - Implements ConfigSetType::string_get() -.
static int long_string_minus_equals(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
Subtract from a Long by string - Implements ConfigSetType::string_minus_equals() -.
static int long_string_plus_equals(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
Add to a Long by string - Implements ConfigSetType::string_plus_equals() -.
static int long_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Long by string - Implements ConfigSetType::string_set() -.
const struct ConfigSetType CstLong
Config type representing a long.
Convenience wrapper for the library headers.
String manipulation buffer.
const char * name
User-visible name.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
Container for lots of config items.
Constants for all the config types.
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.