static int magic_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef,
const char *value, struct Buffer *err)
{
- if (!cs || !cdef || !value)
+ if (!cs || !cdef)
return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
+ if (!value || !value[0])
+ {
+ mutt_buffer_printf(err, "Option %s may not be empty", cdef->name);
+ return (CSR_ERR_INVALID | CSR_INV_TYPE);
+ }
+
int num = -1;
for (size_t i = 1; magic_values[i]; i++)
{
if (!cs || !cdef)
return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
+ if (!value || !value[0])
+ {
+ mutt_buffer_printf(err, "Option %s may not be empty", cdef->name);
+ return (CSR_ERR_INVALID | CSR_INV_TYPE);
+ }
+
int num = 0;
- if (!value || !value[0] || (mutt_str_atoi(value, &num) < 0))
+ if (mutt_str_atoi(value, &num) < 0)
{
- mutt_buffer_printf(err, "Invalid number: %s", value);
+ mutt_buffer_printf(err, "Invalid number: %s", NONULL(value));
return (CSR_ERR_INVALID | CSR_INV_TYPE);
}
static int sort_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef,
const char *value, struct Buffer *err)
{
- if (!cs || !cdef || !value)
+ if (!cs || !cdef)
return CSR_ERR_CODE; /* LCOV_EXCL_LINE */
intptr_t id = -1;
int flags = 0;
+ if (!value || !value[0])
+ {
+ mutt_buffer_printf(err, "Option %s may not be empty", cdef->name);
+ return (CSR_ERR_INVALID | CSR_INV_TYPE);
+ }
+
if (mutt_str_strncmp("reverse-", value, 8) == 0)
{
flags |= SORT_REVERSE;
s->dptr++;
}
- if (!bq && (inv || unset))
+ if (!bq && (inv || (unset && prefix)))
{
if (data == MUTT_SET_SET)
+ {
mutt_buffer_printf(err, "ERR06 prefixes 'no' and 'inv' may only be "
"used with bool/quad variables");
+ }
else
+ {
mutt_buffer_printf(err, "ERR07 command '%s' can only be used with bool/quad variables",
set_commands[data]);
+ }
return -1;
}
size_t scratchlen = mutt_str_strlen(scratch);
if (scratchlen != 0)
{
- if ((scratch[scratchlen - 1] != '|') && /* not a command */
+ if ((scratch[scratchlen - 1] != '|') && /* not a command */
(url_check_scheme(scratch) == U_UNKNOWN)) /* probably a local file */
{
struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
}
}
}
-
}
rc = cs_he_string_set(Config, he, buf->data, err);
if (CSR_RESULT(rc) != CSR_SUCCESS)
}
}
- if (bq)
+ if (my)
+ {
+ myvar_del(buf->data);
+ }
+ else if (bq)
{
if (inv)
{
if (CSR_RESULT(rc) != CSR_SUCCESS)
return -1;
}
+ continue;
+ }
+ else
+ {
+ rc = cs_str_string_set(Config, buf->data, NULL, err);
+ if (CSR_RESULT(rc) != CSR_SUCCESS)
+ return -1;
}
}