changeset: 6858:3c6d322912e3
user:      Kevin McCarthy <[email protected]>
date:      Thu Nov 17 15:07:14 2016 -0800
link:      http://dev.mutt.org/hg/mutt/rev/3c6d322912e3

Backout inlining of MUTT_VERSION in 42fee7585fae.

If MUTT_VERSION contains a %, this will result in problems.

diffs (124 lines):

diff -r 91b3449f426b -r 3c6d322912e3 commands.c
--- a/commands.c        Wed Nov 16 16:05:02 2016 -0800
+++ b/commands.c        Thu Nov 17 15:07:14 2016 -0800
@@ -879,7 +879,7 @@
 
 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 -r 91b3449f426b -r 3c6d322912e3 compose.c
--- a/compose.c Wed Nov 16 16:05:02 2016 -0800
+++ b/compose.c Thu Nov 17 15:07:14 2016 -0800
@@ -448,7 +448,8 @@
       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 -r 91b3449f426b -r 3c6d322912e3 dotlock.c
--- a/dotlock.c Wed Nov 16 16:05:02 2016 -0800
+++ b/dotlock.c Thu Nov 17 15:07:14 2016 -0800
@@ -339,7 +339,7 @@
 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 <retries>] file\n",
          av0);
 
diff -r 91b3449f426b -r 3c6d322912e3 init.c
--- a/init.c    Wed Nov 16 16:05:02 2016 -0800
+++ b/init.c    Thu Nov 17 15:07:14 2016 -0800
@@ -2851,8 +2851,8 @@
   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 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 @@
     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 @@
      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 -r 91b3449f426b -r 3c6d322912e3 muttlib.c
--- a/muttlib.c Wed Nov 16 16:05:02 2016 -0800
+++ b/muttlib.c Thu Nov 17 15:07:14 2016 -0800
@@ -1850,8 +1850,8 @@
 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 -r 91b3449f426b -r 3c6d322912e3 status.c
--- a/status.c  Wed Nov 16 16:05:02 2016 -0800
+++ b/status.c  Thu Nov 17 15:07:14 2016 -0800
@@ -272,7 +272,8 @@
       break;
 
     case 'v':
-      strfcpy (buf, "Mutt " MUTT_VERSION, buflen);
+      snprintf (fmt, sizeof (fmt), "Mutt %%s");
+      snprintf (buf, buflen, fmt, MUTT_VERSION);
       break;
 
     case 'V':

Reply via email to