57static char *
path_tidy(
const char *path,
bool is_dir)
59 if (!path || (*path ==
'\0'))
79 const char **str = (
const char **) var;
93 if (value && (value[0] ==
'\0'))
114 rc = cdef->
validator(cdef, (intptr_t) value, err);
126 *(
const char **) var = str;
145 const char *str = NULL;
148 str = *(
const char **) var;
163 intptr_t value,
struct Buffer *err)
165 const char *str = (
const char *) value;
168 if (str && (str[0] ==
'\0'))
200 *(
const char **) var = str;
209 const char *str = *(
const char **) var;
211 return (intptr_t) str;
220 const char *value = *(
const char **) var;
266 *(
const char **) var = str;
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
const struct ConfigSetType CstPath
Config type representing a path.
static char * path_tidy(const char *path, bool is_dir)
Tidy a path for storage.
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.
Convenience wrapper for the core headers.
static void path_destroy(void *var, const struct ConfigDef *cdef)
Destroy a Path - Implements ConfigSetType::destroy() -.
static bool path_has_been_set(void *var, const struct ConfigDef *cdef)
Is the config value different to its initial value? - Implements ConfigSetType::has_been_set() -.
static intptr_t path_native_get(void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get a string from a Path config item - Implements ConfigSetType::native_get() -.
static int path_native_set(void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Path config item by string - Implements ConfigSetType::native_set() -.
static int path_reset(void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Path to its initial value - Implements ConfigSetType::reset() -.
static int path_string_get(void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Path as a string - Implements ConfigSetType::string_get() -.
static int path_string_set(void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Path by string - Implements ConfigSetType::string_set() -.
Convenience wrapper for the library headers.
bool mutt_path_tidy(struct Buffer *path, bool is_dir)
Remove unnecessary parts of a path.
bool mutt_path_tilde(struct Buffer *path, const char *homedir)
Expand '~' in a path.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
const char * name
User-visible name.
int(* validator)(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 Accounts, Notifications.
char * home_dir
User's home directory.
Constants for all the config types.
#define D_PATH_DIR
Path is a directory.
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
@ DT_PATH
a path to a file/directory
#define D_NOT_EMPTY
Empty strings are not allowed.