summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-01-12 09:20:34 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-01-12 09:20:34 +0000
commite243f491b73c0082f28d72aebbe9da8e6555b93a (patch)
treeb3ff38bd3ab0cd36f9f8920441ff9e4a7626c3da /init.c
parentf992ce3dfe5eb25f41e4add5718cc4dff8265285 (diff)
It was impossible to unset a string. If you did "unset realname" it
would just print out the value of the string. Attached is the fix.
Diffstat (limited to 'init.c')
-rw-r--r--init.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/init.c b/init.c
index 56e65105..f01ed33e 100644
--- a/init.c
+++ b/init.c
@@ -843,7 +843,14 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
DTYPE (MuttVars[idx].type) == DT_PATH ||
DTYPE (MuttVars[idx].type) == DT_ADDR)
{
- if (query || *s->dptr != '=')
+ if (unset)
+ {
+ if (DTYPE (MuttVars[idx].type) == DT_ADDR)
+ rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
+ else
+ safe_free ((void **) MuttVars[idx].data);
+ }
+ else if (query || *s->dptr != '=')
{
char _tmp[STRING];
char *val = NULL;
@@ -862,29 +869,31 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
NONULL (val));
break;
}
-
- s->dptr++;
-
- /* copy the value of the string */
- if (DTYPE (MuttVars[idx].type) == DT_ADDR)
- rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
- else
- FREE (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);
- }
else
{
- *((ADDRESS **) MuttVars[idx].data) = rfc822_parse_adrlist (NULL, tmp->data);
+ s->dptr++;
+
+ /* copy the value of the string */
+ if (DTYPE (MuttVars[idx].type) == DT_ADDR)
+ rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
+ else
+ FREE (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);
+ }
+ else
+ {
+ *((ADDRESS **) MuttVars[idx].data) = rfc822_parse_adrlist (NULL, tmp->data);
+ }
}
}
else if (DTYPE(MuttVars[idx].type) == DT_RX)