From: Thomas Roessler Date: Sun, 9 Apr 2000 12:39:02 +0000 (+0000) Subject: The "!!" shortcut had another flaw. Noted by Martin Michlmayr X-Git-Tag: mutt-1-1-12-rel~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d169b6f46fff91e76b451ef5465e3d5cc8af3960;p=mutt The "!!" shortcut had another flaw. Noted by Martin Michlmayr . --- 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);