From: Kevin McCarthy Date: Thu, 17 Nov 2016 23:07:14 +0000 (-0800) Subject: Backout inlining of MUTT_VERSION in 42fee7585fae. X-Git-Tag: mutt-1-8-rel~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f4d02d95e9a8ff54edf1d1b16f886afc50527ba;p=mutt Backout inlining of MUTT_VERSION in 42fee7585fae. If MUTT_VERSION contains a %, this will result in problems. --- diff --git a/commands.c b/commands.c index 42436231..2202a673 100644 --- a/commands.c +++ b/commands.c @@ -879,7 +879,7 @@ int mutt_save_message (HEADER *h, int delete, void mutt_version (void) { - mutt_message ("Mutt " MUTT_VERSION " (%s)", ReleaseDate); + mutt_message ("Mutt %s (%s)", MUTT_VERSION, ReleaseDate); } void mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) diff --git a/compose.c b/compose.c index ac7cd89b..aa59506e 100644 --- a/compose.c +++ b/compose.c @@ -448,7 +448,8 @@ compose_format_str (char *buf, size_t buflen, size_t col, int cols, char op, con break; case 'v': - strfcpy(buf, "Mutt " MUTT_VERSION, buflen); + snprintf (fmt, sizeof (fmt), "Mutt %%s"); + snprintf (buf, buflen, fmt, MUTT_VERSION); break; case 0: diff --git a/dotlock.c b/dotlock.c index 3828fdaa..5bf03480 100644 --- a/dotlock.c +++ b/dotlock.c @@ -339,7 +339,7 @@ END_PRIVILEGED (void) static void usage (const char *av0) { - fprintf (stderr, "dotlock [Mutt " MUTT_VERSION " (%s)]\n", ReleaseDate); + fprintf (stderr, "dotlock [Mutt %s (%s)]\n", MUTT_VERSION, ReleaseDate); fprintf (stderr, "usage: %s [-t|-f|-u|-d] [-p] [-r ] file\n", av0); diff --git a/init.c b/init.c index 370acddd..7d620815 100644 --- a/init.c +++ b/init.c @@ -2851,8 +2851,8 @@ static void start_debug (void) if ((debugfile = safe_fopen(buf, "w")) != NULL) { setbuf (debugfile, NULL); /* don't buffer the debugging output! */ - dprint(1,(debugfile,"Mutt/" MUTT_VERSION " (%s) debugging at level %d\n", - ReleaseDate, debuglevel)); + dprint(1,(debugfile,"Mutt/%s (%s) debugging at level %d\n", + MUTT_VERSION, ReleaseDate, debuglevel)); } } #endif @@ -2901,11 +2901,11 @@ static void mutt_srandom (void) static char* mutt_find_cfg (const char *home, const char *xdg_cfg_home) { - const char* names[] = + const char* names[][2] = { - "muttrc-" MUTT_VERSION, - "muttrc", - NULL, + { "muttrc", "-" MUTT_VERSION }, + { "muttrc", "" }, + { NULL, NULL }, }; const char* locations[][2] = @@ -2925,12 +2925,12 @@ static char* mutt_find_cfg (const char *home, const char *xdg_cfg_home) if (!locations[i][0]) continue; - for (j = 0; names[j]; j++) + for (j = 0; names[j][0]; j++) { char buffer[STRING]; - snprintf (buffer, sizeof (buffer), - "%s/%s%s", locations[i][0], locations[i][1], names[j]); + snprintf (buffer, sizeof (buffer), "%s/%s%s%s", + locations[i][0], locations[i][1], names[j][0], names[j][1]); if (access (buffer, F_OK) == 0) return safe_strdup(buffer); } @@ -3198,11 +3198,11 @@ void mutt_init (int skip_sys_rc, LIST *commands) requested not to via "-n". */ if (!skip_sys_rc) { - snprintf (buffer, sizeof(buffer), "%s/Muttrc-" MUTT_VERSION, SYSCONFDIR); + snprintf (buffer, sizeof(buffer), "%s/Muttrc-%s", SYSCONFDIR, MUTT_VERSION); if (access (buffer, F_OK) == -1) snprintf (buffer, sizeof(buffer), "%s/Muttrc", SYSCONFDIR); if (access (buffer, F_OK) == -1) - snprintf (buffer, sizeof (buffer), "%s/Muttrc-" MUTT_VERSION, PKGDATADIR); + snprintf (buffer, sizeof (buffer), "%s/Muttrc-%s", PKGDATADIR, MUTT_VERSION); if (access (buffer, F_OK) == -1) snprintf (buffer, sizeof (buffer), "%s/Muttrc", PKGDATADIR); if (access (buffer, F_OK) != -1) diff --git a/muttlib.c b/muttlib.c index baf48aa9..a60ba0f7 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1850,8 +1850,8 @@ void mutt_set_mtime (const char* from, const char* to) const char *mutt_make_version (void) { static char vstring[STRING]; - snprintf (vstring, sizeof (vstring), "Mutt " MUTT_VERSION " (%s)", - ReleaseDate); + snprintf (vstring, sizeof (vstring), "Mutt %s (%s)", + MUTT_VERSION, ReleaseDate); return vstring; } diff --git a/status.c b/status.c index 86113a8e..52baa8c1 100644 --- a/status.c +++ b/status.c @@ -272,7 +272,8 @@ status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, cons break; case 'v': - strfcpy (buf, "Mutt " MUTT_VERSION, buflen); + snprintf (fmt, sizeof (fmt), "Mutt %%s"); + snprintf (buf, buflen, fmt, MUTT_VERSION); break; case 'V':