- set_option (MuttVars[idx].data);
- }
- else if (DTYPE (MuttVars[idx].type) == DT_STR ||
- DTYPE (MuttVars[idx].type) == DT_PATH ||
- DTYPE (MuttVars[idx].type) == DT_ADDR) {
- if (unset) {
- if (DTYPE (MuttVars[idx].type) == DT_ADDR)
- rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
- else
- FREE ((void *) MuttVars[idx].data);
- }
- else if (query || *s->dptr != '=') {
- char _tmp[STRING];
- char *val = NULL;
-
- if (DTYPE (MuttVars[idx].type) == DT_ADDR) {
- _tmp[0] = '\0';
- rfc822_write_address (_tmp, sizeof (_tmp),
- *((ADDRESS **) MuttVars[idx].data), 0);
- val = _tmp;
- }
- else
- val = *((char **) MuttVars[idx].data);
-
- /* user requested the value of this variable */
- snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
- NONULL (val));
- break;
- }
- else {
- s->dptr++;
-
- /* copy the value of the string */
- if (DTYPE (MuttVars[idx].type) == DT_ADDR)
- rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
- else
- FREE ((void *) MuttVars[idx].data);
-
- mutt_extract_token (tmp, s, 0);
- if (DTYPE (MuttVars[idx].type) == DT_PATH) {
- strfcpy (scratch, tmp->data, sizeof (scratch));
- mutt_expand_path (scratch, sizeof (scratch));
- *((char **) MuttVars[idx].data) = safe_strdup (scratch);
- }
- else if (DTYPE (MuttVars[idx].type) == DT_STR) {
- *((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
- if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
- mutt_set_charset (Charset);
- }
- else {
- *((ADDRESS **) MuttVars[idx].data) =
- rfc822_parse_adrlist (NULL, tmp->data);
- }
- }
- }
- else if (DTYPE (MuttVars[idx].type) == DT_RX) {
- REGEXP *ptr = (REGEXP *) MuttVars[idx].data;
- regex_t *rx;
- int e, flags = 0;
-
- if (query || *s->dptr != '=') {
- /* user requested the value of this variable */
- snprintf (err->data, err->dsize, "%s=\"%s\"", MuttVars[idx].option,
- NONULL (ptr->pattern));
- break;
- }
-
- if (option (OPTATTACHMSG)
- && !mutt_strcmp (MuttVars[idx].option, "reply_regexp")) {
- snprintf (err->data, err->dsize,
- "Operation not permitted when in attach-message mode.");
- r = -1;
- break;
- }
-
- s->dptr++;
-
- /* copy the value of the string */
- mutt_extract_token (tmp, s, 0);
-
- if (!ptr->pattern || mutt_strcmp (ptr->pattern, tmp->data) != 0) {
- int not = 0;
-
- /* $mask is case-sensitive */
- if (mutt_strcmp (MuttVars[idx].option, "mask") != 0)
- flags |= mutt_which_case (tmp->data);
-
- p = tmp->data;
- if (mutt_strcmp (MuttVars[idx].option, "mask") == 0) {
- if (*p == '!') {
- not = 1;
- p++;
- }
- }
-
- rx = (regex_t *) safe_malloc (sizeof (regex_t));
- if ((e = REGCOMP (rx, p, flags)) != 0) {
- regerror (e, rx, err->data, err->dsize);
- regfree (rx);
- FREE (&rx);
- break;
- }
-
- /* get here only if everything went smootly */
- if (ptr->pattern) {
- FREE (&ptr->pattern);
- regfree ((regex_t *) ptr->rx);
- FREE (&ptr->rx);
- }
-
- ptr->pattern = safe_strdup (tmp->data);
- ptr->rx = rx;
- ptr->not = not;
-
- /* $reply_regexp and $alterantes require special treatment */
-
- if (Context && Context->msgcount &&
- mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) {
- regmatch_t pmatch[1];
- int i;
-
-#define CUR_ENV Context->hdrs[i]->env
- for (i = 0; i < Context->msgcount; i++) {
- if (CUR_ENV && CUR_ENV->subject) {
- CUR_ENV->real_subj = (regexec (ReplyRegexp.rx,
- CUR_ENV->subject, 1, pmatch,
- 0)) ? CUR_ENV->
- subject : CUR_ENV->subject + pmatch[0].rm_eo;
- }
- }
-#undef CUR_ENV
- }
- }
- }
- else if (DTYPE (MuttVars[idx].type) == DT_MAGIC) {
- if (query || *s->dptr != '=') {
- switch (DefaultMagic) {
- case M_MBOX:
- p = "mbox";
- break;
- case M_MMDF:
- p = "MMDF";
- break;
- case M_MH:
- p = "MH";
- break;
- case M_MAILDIR:
- p = "Maildir";
- break;
- default:
- p = "unknown";