56static char *
path_tidy(
const char *path,
bool is_dir)
58 if (!path || (*path ==
'\0'))
75 const char **str = (
const char **) var;
86 const char *value,
struct Buffer *err)
89 if (value && (value[0] ==
'\0'))
107 rc = cdef->
validator(cs, cdef, (intptr_t) value, err);
119 *(
const char **) var = str;
139 const char *str = NULL;
142 str = *(
const char **) var;
159 const char *str = (
const char *) value;
162 if (str && (str[0] ==
'\0'))
178 rc = cdef->
validator(cs, cdef, value, err);
191 *(
const char **) var = str;
201 const char *str = *(
const char **) var;
203 return (intptr_t) str;
240 *(
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.
const struct ConfigSetType CstPath
Config type representing a path.
static char * path_tidy(const char *path, bool is_dir)
Tidy a path for storage.
char * HomeDir
User's home directory.
#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.
static void path_destroy(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
Destroy a Path - Implements ConfigSetType::destroy() -.
static intptr_t path_native_get(const struct ConfigSet *cs, 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(const struct ConfigSet *cs, 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(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Path to its initial value - Implements ConfigSetType::reset() -.
static int path_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Path as a string - Implements ConfigSetType::string_get() -.
static int path_string_set(const struct ConfigSet *cs, 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(char *buf, bool is_dir)
Remove unnecessary parts of a path.
bool mutt_path_tilde(char *buf, size_t buflen, 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.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
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 DT_INITIAL_SET
Config item must have its initial value freed.
#define DT_PATH_DIR
Path is a directory.
#define DT_PATH
a path to a file/directory
#define DT_NOT_EMPTY
Empty strings are not allowed.