58static char *
path_tidy(
const char *path,
bool is_dir)
60 if (!path || (*path ==
'\0'))
80 const char **str = (
const char **) var;
91 const char *value,
struct Buffer *err)
94 if (value && (value[0] ==
'\0'))
115 rc = cdef->
validator(cs, cdef, (intptr_t) value, err);
127 *(
const char **) var = str;
147 const char *str = NULL;
150 str = *(
const char **) var;
167 const char *str = (
const char *) value;
170 if (str && (str[0] ==
'\0'))
189 rc = cdef->
validator(cs, cdef, value, err);
202 *(
const char **) var = str;
212 const char *str = *(
const char **) var;
214 return (intptr_t) str;
257 *(
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.
char * HomeDir
User's home directory.
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.
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(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 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_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.