int e, flags = 0;
const char *p = NULL;
regex_t *rx = NULL;
- struct Regex *ptr = *(struct Regex **) MuttVars[idx].data;
+ struct Regex *ptr = *(struct Regex **) MuttVars[idx].var;
if (ptr)
{
*/
int mutt_option_index(const char *s)
{
- for (int i = 0; MuttVars[i].option; i++)
- if (mutt_str_strcmp(s, MuttVars[i].option) == 0)
+ for (int i = 0; MuttVars[i].name; i++)
+ if (mutt_str_strcmp(s, MuttVars[i].name) == 0)
return (MuttVars[i].type == DT_SYNONYM ?
- mutt_option_index((char *) MuttVars[i].data) :
+ mutt_option_index((char *) MuttVars[i].var) :
i);
return -1;
}
#ifdef USE_LUA
int mutt_option_to_string(const struct Option *opt, char *val, size_t len)
{
- mutt_debug(2, " * mutt_option_to_string(%s)\n", NONULL((char *) opt->data));
- int idx = mutt_option_index((const char *) opt->option);
+ mutt_debug(2, " * mutt_option_to_string(%s)\n", NONULL((char *) opt->var));
+ int idx = mutt_option_index((const char *) opt->name);
if (idx != -1)
return var_to_string(idx, val, len);
return 0;
if (opt)
{
memset(opt, 0, sizeof(*opt));
- opt->option = s;
+ opt->name = s;
opt->type = DT_STRING;
}
return true;
int mutt_option_set(const struct Option *val, struct Buffer *err)
{
mutt_debug(2, " * mutt_option_set()\n");
- int idx = mutt_option_index(val->option);
+ int idx = mutt_option_index(val->name);
if (idx != -1)
{
switch (DTYPE(MuttVars[idx].type))
err2.dsize = sizeof(err_str);
struct Buffer tmp;
- tmp.data = (char *) val->data;
- tmp.dsize = strlen((char *) val->data);
+ tmp.data = (char *) val->var;
+ tmp.dsize = strlen((char *) val->var);
if (parse_regex(idx, &tmp, &err2))
{
/* $reply_regexp and $alternates require special treatment */
if (Context && Context->msgcount &&
- (mutt_str_strcmp(MuttVars[idx].option, "reply_regexp") == 0))
+ (mutt_str_strcmp(MuttVars[idx].name, "reply_regexp") == 0))
{
regmatch_t pmatch[1];
}
else
{
- snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].option);
+ snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].name);
return -1;
}
break;
if (!map)
{
- snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].option);
+ snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].name);
return -1;
}
- if (parse_sort((short *) MuttVars[idx].data, (const char *) val->data, map, err) == -1)
+ if (parse_sort((short *) MuttVars[idx].var, (const char *) val->var, map, err) == -1)
{
return -1;
}
break;
case DT_MBTABLE:
{
- struct MbTable **tbl = (struct MbTable **) MuttVars[idx].data;
+ struct MbTable **tbl = (struct MbTable **) MuttVars[idx].var;
free_mbtable(tbl);
- *tbl = parse_mbtable((const char *) val->data);
+ *tbl = parse_mbtable((const char *) val->var);
}
break;
case DT_ADDRESS:
- mutt_addr_free((struct Address **) MuttVars[idx].data);
- *((struct Address **) MuttVars[idx].data) =
- mutt_addr_parse_list(NULL, (const char *) val->data);
+ mutt_addr_free((struct Address **) MuttVars[idx].var);
+ *((struct Address **) MuttVars[idx].var) =
+ mutt_addr_parse_list(NULL, (const char *) val->var);
break;
case DT_PATH:
{
char scratch[LONG_STRING];
- mutt_str_strfcpy(scratch, NONULL((const char *) val->data), sizeof(scratch));
+ mutt_str_strfcpy(scratch, NONULL((const char *) val->var), sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
- FREE((void *) MuttVars[idx].data);
- *((char **) MuttVars[idx].data) = mutt_str_strdup(scratch);
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
break;
}
case DT_STRING:
{
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
- FREE((void *) MuttVars[idx].data);
- *((char **) MuttVars[idx].data) = mutt_str_strdup((char *) val->data);
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(*(char **) val->var);
}
break;
case DT_BOOL:
- if (val->data)
- *(bool *) MuttVars[idx].data = true;
+ if (val->var)
+ *(bool *) MuttVars[idx].var = true;
else
- *(bool *) MuttVars[idx].data = false;
+ *(bool *) MuttVars[idx].var = false;
break;
case DT_QUAD:
- *(short *) MuttVars[idx].data = val->data;
+ *(short *) MuttVars[idx].var = val->var;
break;
case DT_NUMBER:
- *((short *) MuttVars[idx].data) = val->data;
+ *(short *) MuttVars[idx].var = val->var;
break;
default:
return -1;
}
}
/* set the string as a myvar if it's one */
- if (mutt_str_strncmp("my_", val->option, 3) == 0)
+ if (mutt_str_strncmp("my_", val->name, 3) == 0)
{
- myvar_set(val->option, (const char *) val->data);
+ myvar_set(val->name, (const char *) val->var);
}
return 0;
}
switch (DTYPE(p->type))
{
case DT_ADDRESS:
- mutt_addr_free((struct Address **) p->data);
+ mutt_addr_free((struct Address **) p->var);
break;
case DT_REGEX:
- pp = (struct Regex **) p->data;
+ pp = (struct Regex **) p->var;
FREE(&(*pp)->pattern);
if ((*pp)->regex)
{
break;
case DT_PATH:
case DT_STRING:
- FREE((char **) p->data);
+ FREE((char **) p->var);
break;
}
}
*/
void mutt_free_opts(void)
{
- for (int i = 0; MuttVars[i].option; i++)
+ for (int i = 0; MuttVars[i].name; i++)
free_opt(MuttVars + i);
mutt_regexlist_free(&Alternates);
switch (DTYPE(p->type))
{
case DT_STRING:
- if (!p->init && *((char **) p->data))
- p->init = (unsigned long) mutt_str_strdup(*((char **) p->data));
+ if (!p->initial && *((char **) p->var))
+ p->initial = (unsigned long) mutt_str_strdup(*((char **) p->var));
break;
case DT_PATH:
- if (!p->init && *((char **) p->data))
+ if (!p->initial && *((char **) p->var))
{
- char *cp = mutt_str_strdup(*((char **) p->data));
+ char *cp = mutt_str_strdup(*((char **) p->var));
/* mutt_pretty_mailbox (cp); */
- p->init = (unsigned long) cp;
+ p->initial = (unsigned long) cp;
}
break;
case DT_ADDRESS:
- if (!p->init && *((struct Address **) p->data))
+ if (!p->initial && *((struct Address **) p->var))
{
char tmp[HUGE_STRING];
*tmp = '\0';
- rfc822_write_address(tmp, sizeof(tmp), *((struct Address **) p->data), 0);
- p->init = (unsigned long) mutt_str_strdup(tmp);
+ rfc822_write_address(tmp, sizeof(tmp), *((struct Address **) p->var), 0);
+ p->initial = (unsigned long) mutt_str_strdup(tmp);
}
break;
case DT_REGEX:
{
- struct Regex *pp = (struct Regex *) p->data;
- if (!p->init && pp->pattern)
- p->init = (unsigned long) mutt_str_strdup(pp->pattern);
+ struct Regex *pp = (struct Regex *) p->var;
+ if (!p->initial && pp->pattern)
+ p->initial = (unsigned long) mutt_str_strdup(pp->pattern);
break;
}
}
switch (DTYPE(p->type))
{
case DT_STRING:
- mutt_str_replace((char **) p->data, (char *) p->init);
+ mutt_str_replace((char **) p->var, (char *) p->initial);
break;
case DT_MBTABLE:
- free_mbtable((struct MbTable **) p->data);
- *((struct MbTable **) p->data) = parse_mbtable((char *) p->init);
+ free_mbtable((struct MbTable **) p->var);
+ *((struct MbTable **) p->var) = parse_mbtable((char *) p->initial);
break;
case DT_PATH:
- FREE((char **) p->data);
+ FREE((char **) p->var);
char *init = NULL;
- if (mutt_str_strcmp(p->option, "debug_file") == 0 && debugfile_cmdline)
+ if (mutt_str_strcmp(p->name, "debug_file") == 0 && debugfile_cmdline)
init = debugfile_cmdline;
else
- init = (char *) p->init;
+ init = (char *) p->initial;
if (init)
{
char path[_POSIX_PATH_MAX];
mutt_str_strfcpy(path, init, sizeof(path));
mutt_expand_path(path, sizeof(path));
- *((char **) p->data) = mutt_str_strdup(path);
+ *((char **) p->var) = mutt_str_strdup(path);
}
break;
case DT_ADDRESS:
- mutt_addr_free((struct Address **) p->data);
- if (p->init)
- *((struct Address **) p->data) = mutt_addr_parse_list(NULL, (char *) p->init);
+ mutt_addr_free((struct Address **) p->var);
+ if (p->initial)
+ *((struct Address **) p->var) = mutt_addr_parse_list(NULL, (char *) p->initial);
break;
case DT_BOOL:
- if (p->init)
- *(bool *) p->data = true;
+ if (p->initial)
+ *(bool *) p->var = true;
else
- *(bool *) p->data = false;
+ *(bool *) p->var = false;
break;
case DT_QUAD:
- *(unsigned char *) p->data = p->init;
+ *(unsigned char *) p->var = p->initial;
break;
case DT_NUMBER:
case DT_SORT:
case DT_MAGIC:
- if (mutt_str_strcmp(p->option, "debug_level") == 0 && debuglevel_cmdline)
- *((short *) p->data) = debuglevel_cmdline;
+ if (mutt_str_strcmp(p->name, "debug_level") == 0 && debuglevel_cmdline)
+ *((short *) p->var) = debuglevel_cmdline;
else
- *((short *) p->data) = p->init;
+ *((short *) p->var) = p->initial;
break;
case DT_REGEX:
{
- struct Regex **pp = (struct Regex **) p->data;
+ struct Regex **pp = (struct Regex **) p->var;
if (*pp)
{
FREE(&(*pp)->pattern);
*pp = mutt_mem_calloc(1, sizeof(struct Regex));
}
- if (p->init)
+ if (p->initial)
{
int flags = 0;
- char *s = (char *) p->init;
+ char *s = (char *) p->initial;
(*pp)->regex = mutt_mem_calloc(1, sizeof(regex_t));
- (*pp)->pattern = mutt_str_strdup((char *) p->init);
- if ((mutt_str_strcmp(p->option, "mask") != 0) &&
- (mutt_mb_is_lower((const char *) p->init)))
+ (*pp)->pattern = mutt_str_strdup((char *) p->initial);
+ if ((mutt_str_strcmp(p->name, "mask") != 0) &&
+ (mutt_mb_is_lower((const char *) p->initial)))
{
flags |= REG_ICASE;
}
- if ((mutt_str_strcmp(p->option, "mask") == 0) && *s == '!')
+ if ((mutt_str_strcmp(p->name, "mask") == 0) && *s == '!')
{
s++;
(*pp)->not = true;
char msgbuf[STRING];
regerror(rc, (*pp)->regex, msgbuf, sizeof(msgbuf));
fprintf(stderr, _("restore_default(%s): error in regex: %s\n"),
- p->option, (*pp)->pattern);
+ p->name, (*pp)->pattern);
fprintf(stderr, "%s\n", msgbuf);
mutt_sleep(0);
FREE(&(*pp)->pattern);
{
char *q = NULL, *s = mutt_str_strdup(val);
int rc = 0;
- bool strict = (strcmp(opt->option, "send_charset") == 0);
+ bool strict = (strcmp(opt->name, "send_charset") == 0);
if (!s)
return rc;
_("Not available in this menu."));
return -1;
}
- for (idx = 0; MuttVars[idx].option; idx++)
+ for (idx = 0; MuttVars[idx].name; idx++)
restore_default(&MuttVars[idx]);
mutt_set_current_menu_redraw_full();
OPT_SORT_SUBTHREADS = true;
if (query)
{
snprintf(err->data,
- err->dsize, *(bool *) MuttVars[idx].data ? _("%s is set") : _("%s is unset"),
+ err->dsize, *(bool *) MuttVars[idx].var ? _("%s is set") : _("%s is unset"),
tmp->data);
return 0;
}
CHECK_PAGER;
if (unset)
- *(bool *) MuttVars[idx].data = false;
+ *(bool *) MuttVars[idx].var = false;
else if (inv)
- *(bool *) MuttVars[idx].data = !(*(bool *) MuttVars[idx].data);
+ *(bool *) MuttVars[idx].var = !(*(bool *) MuttVars[idx].var);
else
- *(bool *) MuttVars[idx].data = true;
+ *(bool *) MuttVars[idx].var = true;
}
else if (myvar || DTYPE(MuttVars[idx].type) == DT_STRING ||
DTYPE(MuttVars[idx].type) == DT_PATH || DTYPE(MuttVars[idx].type) == DT_ADDRESS ||
if (myvar)
myvar_del(myvar);
else if (DTYPE(MuttVars[idx].type) == DT_ADDRESS)
- mutt_addr_free((struct Address **) MuttVars[idx].data);
+ mutt_addr_free((struct Address **) MuttVars[idx].var);
else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE)
- free_mbtable((struct MbTable **) MuttVars[idx].data);
+ free_mbtable((struct MbTable **) MuttVars[idx].var);
else
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
- FREE((void *) MuttVars[idx].data);
+ FREE((void *) MuttVars[idx].var);
}
else if (query || *s->dptr != '=')
{
{
tmp2[0] = '\0';
rfc822_write_address(tmp2, sizeof(tmp2),
- *((struct Address **) MuttVars[idx].data), 0);
+ *((struct Address **) MuttVars[idx].var), 0);
val = tmp2;
}
else if (DTYPE(MuttVars[idx].type) == DT_PATH)
{
tmp2[0] = '\0';
- mutt_str_strfcpy(tmp2, NONULL(*((char **) MuttVars[idx].data)), sizeof(tmp2));
+ mutt_str_strfcpy(tmp2, NONULL(*((char **) MuttVars[idx].var)), sizeof(tmp2));
mutt_pretty_mailbox(tmp2, sizeof(tmp2));
val = tmp2;
}
else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE)
{
- struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].data));
+ struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].var));
val = mbt ? NONULL(mbt->orig_str) : "";
}
else
- val = *((char **) MuttVars[idx].data);
+ val = *((char **) MuttVars[idx].var);
/* user requested the value of this variable */
- pretty_var(err->data, err->dsize, MuttVars[idx].option, NONULL(val));
+ pretty_var(err->data, err->dsize, MuttVars[idx].name, NONULL(val));
break;
}
else
}
else if (DTYPE(MuttVars[idx].type) == DT_PATH)
{
- if (mutt_str_strcmp(MuttVars[idx].option, "debug_file") == 0 && debugfile_cmdline)
+ if (mutt_str_strcmp(MuttVars[idx].name, "debug_file") == 0 && debugfile_cmdline)
{
mutt_message(_("set debug_file ignored, it has been overridden by "
"the cmdline"));
break;
}
- /* MuttVars[idx].data is already 'char**' (or some 'void**') or...
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
- FREE((void *) MuttVars[idx].data);
+ FREE((void *) MuttVars[idx].var);
mutt_str_strfcpy(scratch, tmp->data, sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
- *((char **) MuttVars[idx].data) = mutt_str_strdup(scratch);
- if (mutt_str_strcmp(MuttVars[idx].option, "debug_file") == 0)
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
+ if (mutt_str_strcmp(MuttVars[idx].name, "debug_file") == 0)
restart_debug();
}
else if (DTYPE(MuttVars[idx].type) == DT_STRING)
{
- if ((strstr(MuttVars[idx].option, "charset") &&
+ if ((strstr(MuttVars[idx].name, "charset") &&
check_charset(&MuttVars[idx], tmp->data) < 0) |
/* $charset can't be empty, others can */
- ((strcmp(MuttVars[idx].option, "charset") == 0) && !*tmp->data))
+ ((strcmp(MuttVars[idx].name, "charset") == 0) && !*tmp->data))
{
snprintf(err->data, err->dsize,
_("Invalid value for option %s: \"%s\""),
- MuttVars[idx].option, tmp->data);
+ MuttVars[idx].name, tmp->data);
return -1;
}
- FREE((void *) MuttVars[idx].data);
- *((char **) MuttVars[idx].data) = mutt_str_strdup(tmp->data);
- if (mutt_str_strcmp(MuttVars[idx].option, "charset") == 0)
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(tmp->data);
+ if (mutt_str_strcmp(MuttVars[idx].name, "charset") == 0)
mutt_set_charset(Charset);
- if ((mutt_str_strcmp(MuttVars[idx].option,
+ if ((mutt_str_strcmp(MuttVars[idx].name,
"show_multipart_alternative") == 0) &&
!valid_show_multipart_alternative(tmp->data))
{
snprintf(err->data, err->dsize,
- _("Invalid value for option %s: \"%s\""),
- MuttVars[idx].option, tmp->data);
+ _("Invalid value for name %s: \"%s\""), MuttVars[idx].name,
+ tmp->data);
return -1;
}
}
else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE)
{
- free_mbtable((struct MbTable **) MuttVars[idx].data);
- *((struct MbTable **) MuttVars[idx].data) = parse_mbtable(tmp->data);
+ free_mbtable((struct MbTable **) MuttVars[idx].var);
+ *((struct MbTable **) MuttVars[idx].var) = parse_mbtable(tmp->data);
}
else
{
- mutt_addr_free((struct Address **) MuttVars[idx].data);
- *((struct Address **) MuttVars[idx].data) =
+ mutt_addr_free((struct Address **) MuttVars[idx].var);
+ *((struct Address **) MuttVars[idx].var) =
mutt_addr_parse_list(NULL, tmp->data);
}
}
if (query || *s->dptr != '=')
{
/* user requested the value of this variable */
- struct Regex *ptr = *(struct Regex **) MuttVars[idx].data;
+ struct Regex *ptr = *(struct Regex **) MuttVars[idx].var;
const char *value = ptr ? ptr->pattern : NULL;
- pretty_var(err->data, err->dsize, MuttVars[idx].option, NONULL(value));
+ pretty_var(err->data, err->dsize, MuttVars[idx].name, NONULL(value));
break;
}
if (OPT_ATTACH_MSG &&
- (mutt_str_strcmp(MuttVars[idx].option, "reply_regexp") == 0))
+ (mutt_str_strcmp(MuttVars[idx].name, "reply_regexp") == 0))
{
snprintf(err->data, err->dsize,
"Operation not permitted when in attach-message mode.");
if (parse_regex(idx, tmp, err))
/* $reply_regexp and $alternates require special treatment */
if (Context && Context->msgcount &&
- (mutt_str_strcmp(MuttVars[idx].option, "reply_regexp") == 0))
+ (mutt_str_strcmp(MuttVars[idx].name, "reply_regexp") == 0))
{
regmatch_t pmatch[1];
p = "unknown";
break;
}
- snprintf(err->data, err->dsize, "%s=%s", MuttVars[idx].option, p);
+ snprintf(err->data, err->dsize, "%s=%s", MuttVars[idx].name, p);
break;
}
}
else if (DTYPE(MuttVars[idx].type) == DT_NUMBER)
{
- short *ptr = (short *) MuttVars[idx].data;
+ short *ptr = (short *) MuttVars[idx].var;
short val;
int rc;
{
val = *ptr;
/* compatibility alias */
- if (mutt_str_strcmp(MuttVars[idx].option, "wrapmargin") == 0)
+ if (mutt_str_strcmp(MuttVars[idx].name, "wrapmargin") == 0)
val = *ptr < 0 ? -*ptr : 0;
/* user requested the value of this variable */
- snprintf(err->data, err->dsize, "%s=%d", MuttVars[idx].option, val);
+ snprintf(err->data, err->dsize, "%s=%d", MuttVars[idx].name, val);
break;
}
r = -1;
break;
}
- else if (mutt_str_strcmp(MuttVars[idx].option, "debug_level") == 0 && debuglevel_cmdline)
+ else if (mutt_str_strcmp(MuttVars[idx].name, "debug_level") == 0 && debuglevel_cmdline)
{
mutt_message(_(
"set debug_level ignored, it has been overridden by the cmdline"));
*ptr = val;
/* these ones need a sanity check */
- if (mutt_str_strcmp(MuttVars[idx].option, "history") == 0)
+ if (mutt_str_strcmp(MuttVars[idx].name, "history") == 0)
{
if (*ptr < 0)
*ptr = 0;
mutt_init_history();
}
- else if (mutt_str_strcmp(MuttVars[idx].option, "debug_level") == 0)
+ else if (mutt_str_strcmp(MuttVars[idx].name, "debug_level") == 0)
{
if (*ptr < 0)
*ptr = 0;
restart_debug();
}
- else if (mutt_str_strcmp(MuttVars[idx].option, "pager_index_lines") == 0)
+ else if (mutt_str_strcmp(MuttVars[idx].name, "pager_index_lines") == 0)
{
if (*ptr < 0)
*ptr = 0;
}
- else if (mutt_str_strcmp(MuttVars[idx].option, "wrapmargin") == 0)
+ else if (mutt_str_strcmp(MuttVars[idx].name, "wrapmargin") == 0)
{
if (*ptr < 0)
*ptr = 0;
*ptr = -*ptr;
}
#ifdef USE_IMAP
- else if (mutt_str_strcmp(MuttVars[idx].option, "imap_pipeline_depth") == 0)
+ else if (mutt_str_strcmp(MuttVars[idx].name, "imap_pipeline_depth") == 0)
{
if (*ptr < 0)
*ptr = 0;
{
static const char *const vals[] = { "no", "yes", "ask-no", "ask-yes" };
- snprintf(err->data, err->dsize, "%s=%s", MuttVars[idx].option,
- vals[*(unsigned char *) MuttVars[idx].data]);
+ snprintf(err->data, err->dsize, "%s=%s", MuttVars[idx].name,
+ vals[*(unsigned char *) MuttVars[idx].var]);
break;
}
s->dptr++;
mutt_extract_token(tmp, s, 0);
if (mutt_str_strcasecmp("yes", tmp->data) == 0)
- MuttVars[idx].data = MUTT_YES;
+ *(unsigned char *) MuttVars[idx].var = MUTT_YES;
else if (mutt_str_strcasecmp("no", tmp->data) == 0)
- MuttVars[idx].data = MUTT_NO;
+ *(unsigned char *) MuttVars[idx].var = MUTT_NO;
else if (mutt_str_strcasecmp("ask-yes", tmp->data) == 0)
- MuttVars[idx].data = MUTT_ASKYES;
+ *(unsigned char *) MuttVars[idx].var = MUTT_ASKYES;
else if (mutt_str_strcasecmp("ask-no", tmp->data) == 0)
- MuttVars[idx].data = MUTT_ASKNO;
+ *(unsigned char *) MuttVars[idx].var = MUTT_ASKNO;
else
{
snprintf(err->data, err->dsize, _("%s: invalid value"), tmp->data);
else
{
if (inv)
- toggle_quadoption(MuttVars[idx].data);
+ *(unsigned char *) MuttVars[idx].var =
+ toggle_quadoption(*(unsigned char *) MuttVars[idx].var);
else if (unset)
- MuttVars[idx].data = MUTT_NO;
+ *(unsigned char *) MuttVars[idx].var = MUTT_NO;
else
- MuttVars[idx].data = MUTT_YES;
+ *(unsigned char *) MuttVars[idx].var = MUTT_YES;
}
}
else if (DTYPE(MuttVars[idx].type) == DT_SORT)
if (!map)
{
- snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].option);
+ snprintf(err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].name);
r = -1;
break;
}
if (query || *s->dptr != '=')
{
- p = mutt_map_get_name(*((short *) MuttVars[idx].data) & SORT_MASK, map);
+ p = mutt_map_get_name(*((short *) MuttVars[idx].var) & SORT_MASK, map);
- snprintf(err->data, err->dsize, "%s=%s%s%s", MuttVars[idx].option,
- (*((short *) MuttVars[idx].data) & SORT_REVERSE) ? "reverse-" : "",
- (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" : "", p);
+ snprintf(err->data, err->dsize, "%s=%s%s%s", MuttVars[idx].name,
+ (*((short *) MuttVars[idx].var) & SORT_REVERSE) ? "reverse-" : "",
+ (*((short *) MuttVars[idx].var) & SORT_LAST) ? "last-" : "", p);
return 0;
}
CHECK_PAGER;
s->dptr++;
mutt_extract_token(tmp, s, 0);
- if (parse_sort((short *) MuttVars[idx].data, tmp->data, map, err) == -1)
+ if (parse_sort((short *) MuttVars[idx].var, tmp->data, map, err) == -1)
{
r = -1;
break;
{
if (query || (*s->dptr != '='))
{
- pretty_var(err->data, err->dsize, MuttVars[idx].option,
- NONULL((*(char **) MuttVars[idx].data)));
+ pretty_var(err->data, err->dsize, MuttVars[idx].name,
+ NONULL((*(char **) MuttVars[idx].var)));
break;
}
mutt_extract_token(tmp, s, 0);
if (mutt_hcache_is_valid_backend(tmp->data))
{
- FREE((void *) MuttVars[idx].data);
- *(char **) (MuttVars[idx].data) = mutt_str_strdup(tmp->data);
+ FREE((void *) MuttVars[idx].var);
+ *(char **) (MuttVars[idx].var) = mutt_str_strdup(tmp->data);
}
else
{
#endif
else
{
- snprintf(err->data, err->dsize, _("%s: unknown type"), MuttVars[idx].option);
+ snprintf(err->data, err->dsize, _("%s: unknown type"), MuttVars[idx].name);
r = -1;
break;
}
mutt_str_strfcpy(UserTyped, pt, sizeof(UserTyped));
memset(Matches, 0, MatchesListsize);
memset(Completed, 0, sizeof(Completed));
- for (num = 0; MuttVars[num].option; num++)
- candidate(Completed, UserTyped, MuttVars[num].option, sizeof(Completed));
+ for (num = 0; MuttVars[num].name; num++)
+ candidate(Completed, UserTyped, MuttVars[num].name, sizeof(Completed));
for (myv = MyVars; myv; myv = myv->next)
candidate(Completed, UserTyped, myv->name, sizeof(Completed));
matches_ensure_morespace(NumMatched);
if ((DTYPE(MuttVars[idx].type) == DT_STRING) ||
(DTYPE(MuttVars[idx].type) == DT_PATH) || (DTYPE(MuttVars[idx].type) == DT_REGEX))
{
- mutt_str_strfcpy(tmp, NONULL(*((char **) MuttVars[idx].data)), sizeof(tmp));
+ mutt_str_strfcpy(tmp, NONULL(*((char **) MuttVars[idx].var)), sizeof(tmp));
if (DTYPE(MuttVars[idx].type) == DT_PATH)
mutt_pretty_mailbox(tmp, sizeof(tmp));
}
else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE)
{
- struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].data));
+ struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].var));
mutt_str_strfcpy(tmp, mbt ? NONULL(mbt->orig_str) : "", sizeof(tmp));
}
else if (DTYPE(MuttVars[idx].type) == DT_ADDRESS)
{
- rfc822_write_address(tmp, sizeof(tmp), *((struct Address **) MuttVars[idx].data), 0);
+ rfc822_write_address(tmp, sizeof(tmp), *((struct Address **) MuttVars[idx].var), 0);
}
else if (DTYPE(MuttVars[idx].type) == DT_QUAD)
- mutt_str_strfcpy(tmp, vals[*(unsigned char *) MuttVars[idx].data], sizeof(tmp));
+ mutt_str_strfcpy(tmp, vals[*(unsigned char *) MuttVars[idx].var], sizeof(tmp));
else if (DTYPE(MuttVars[idx].type) == DT_NUMBER)
{
- short sval = *((short *) MuttVars[idx].data);
+ short sval = *((short *) MuttVars[idx].var);
/* avert your eyes, gentle reader */
- if (mutt_str_strcmp(MuttVars[idx].option, "wrapmargin") == 0)
+ if (mutt_str_strcmp(MuttVars[idx].name, "wrapmargin") == 0)
sval = sval > 0 ? 0 : -sval;
snprintf(tmp, sizeof(tmp), "%d", sval);
map = SortMethods;
break;
}
- p = mutt_map_get_name(*((short *) MuttVars[idx].data) & SORT_MASK, map);
+ p = mutt_map_get_name(*((short *) MuttVars[idx].var) & SORT_MASK, map);
snprintf(tmp, sizeof(tmp), "%s%s%s",
- (*((short *) MuttVars[idx].data) & SORT_REVERSE) ? "reverse-" : "",
- (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" : "", p);
+ (*((short *) MuttVars[idx].var) & SORT_REVERSE) ? "reverse-" : "",
+ (*((short *) MuttVars[idx].var) & SORT_LAST) ? "last-" : "", p);
}
else if (DTYPE(MuttVars[idx].type) == DT_MAGIC)
{
mutt_str_strfcpy(tmp, p, sizeof(tmp));
}
else if (DTYPE(MuttVars[idx].type) == DT_BOOL)
- mutt_str_strfcpy(tmp, *(bool *) MuttVars[idx].data ? "yes" : "no", sizeof(tmp));
+ mutt_str_strfcpy(tmp, *(bool *) MuttVars[idx].var ? "yes" : "no", sizeof(tmp));
else
return 0;
err.dsize = STRING;
err.data = mutt_mem_malloc(err.dsize);
- for (int i = 0; MuttVars[i].option; i++)
+ for (int i = 0; MuttVars[i].name; i++)
{
if (MuttVars[i].type == DT_SYNONYM)
continue;
if (hide_sensitive && IS_SENSITIVE(MuttVars[i]))
{
- printf("%s='***'\n", MuttVars[i].option);
+ printf("%s='***'\n", MuttVars[i].name);
continue;
}
- snprintf(command, sizeof(command), "set ?%s\n", MuttVars[i].option);
+ snprintf(command, sizeof(command), "set ?%s\n", MuttVars[i].name);
if (mutt_parse_rc_line(command, &token, &err) == -1)
{
fprintf(stderr, "%s\n", err.data);
else
{
int i = mutt_option_index("debug_file");
- if ((i >= 0) && (MuttVars[i].init != 0))
- DebugFile = mutt_str_strdup((const char *) MuttVars[i].init);
+ if ((i >= 0) && (MuttVars[i].initial != 0))
+ DebugFile = mutt_str_strdup((const char *) MuttVars[i].initial);
}
start_debug();
}
Matches = mutt_mem_calloc(MatchesListsize, sizeof(char *));
/* Set standard defaults */
- for (int i = 0; MuttVars[i].option; i++)
+ for (int i = 0; MuttVars[i].name; i++)
{
set_default(&MuttVars[i]);
restore_default(&MuttVars[i]);