From: Thomas Roessler Date: Tue, 16 May 2000 15:49:17 +0000 (+0000) Subject: Hack: mutt_restore_default() now stores the latest value of a X-Git-Tag: mutt-1-3-1-rel~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8064719de611d44ef16aede62aa61c309e86bcc;p=mutt Hack: mutt_restore_default() now stores the latest value of a variable as it's default if there was no default before. The code in question is executed precisely once: when mutt_restore_default() is invoked from mutt_init(). --- diff --git a/init.c b/init.c index a7ef2a3b..b4d858ff 100644 --- a/init.c +++ b/init.c @@ -648,6 +648,8 @@ static void mutt_restore_default (struct option_t *p) case DT_STR: if (p->init) mutt_str_replace ((char **) p->data, (char *) p->init); + else if (*((char **) p->data)) + p->init = (unsigned long) safe_strdup (* ((char **) p->data)); break; case DT_PATH: if (p->init) @@ -658,6 +660,8 @@ static void mutt_restore_default (struct option_t *p) mutt_expand_path (path, sizeof (path)); mutt_str_replace ((char **) p->data, path); } + else if (*((char **) p->data)) + p->init = (unsigned long) safe_strdup (* ((char **) p->data)); break; case DT_ADDR: if (p->init) @@ -665,6 +669,12 @@ static void mutt_restore_default (struct option_t *p) rfc822_free_address ((ADDRESS **) p->data); *((ADDRESS **) p->data) = rfc822_parse_adrlist (NULL, (char *) p->init); } + else if (*((ADDRESS **) p->data)) + { + char tmp[HUGE_STRING]; + rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data)); + p->init = (unsigned long) safe_strdup (tmp); + } break; case DT_BOOL: if (p->init) @@ -691,6 +701,7 @@ static void mutt_restore_default (struct option_t *p) regfree (pp->rx); FREE (&pp->rx); } + if (p->init) { char *s = (char *) p->init; @@ -715,9 +726,12 @@ static void mutt_restore_default (struct option_t *p) FREE (&pp->rx); } } + else if (pp->pattern) + p->init = (unsigned long) safe_strdup (pp->pattern); } break; } + if (p->flags & R_INDEX) set_option (OPTFORCEREDRAWINDEX); if (p->flags & R_PAGER)