From d169b6f46fff91e76b451ef5465e3d5cc8af3960 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Sun, 9 Apr 2000 12:39:02 +0000 Subject: [PATCH] The "!!" shortcut had another flaw. Noted by Martin Michlmayr . --- muttlib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/muttlib.c b/muttlib.c index baa073dd..7c3b8ae7 100644 --- a/muttlib.c +++ b/muttlib.c @@ -304,6 +304,7 @@ char *mutt_expand_path (char *s, size_t slen) { char p[_POSIX_PATH_MAX] = ""; char *q = NULL; + char *next; if (*s == '~') { @@ -359,12 +360,16 @@ char *mutt_expand_path (char *s, size_t slen) } else { + next = s + 1; if (*s == '>') q = Inbox; else if (*s == '<') q = Outbox; else if (!mutt_strcmp (s, "!!")) /* elm compatibility */ + { q = LastFolder; + next = s + 2; + } else if (*s == '!') q = Spoolfile; else if (*s == '-') @@ -374,8 +379,9 @@ char *mutt_expand_path (char *s, size_t slen) if (!q) return s; - snprintf (p, sizeof (p), "%s%s", q, s + 1); + snprintf (p, sizeof (p), "%s%s", q, next); } + if (*p) strfcpy (s, p, slen); /* replace the string with the expanded version. */ return (s); -- 2.50.1