]> diplodocus.org Git - nmh/commitdiff
whatnow: Remove undocumented printf-formatting of -prompt string.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 28 Oct 2017 12:57:00 +0000 (13:57 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 28 Oct 2017 12:57:00 +0000 (13:57 +0100)
whatnow(1)'s -prompt option would use the value as a printf(3) format
string, supplying `invo_name' as the sole value to be formatted.  This
was undocumented, and upset gcc's checking of format strings.  As no
requests to keep the ability appeared on nmh-workers in reply to
2017-08-09's email, treat -prompt's value as a simple string.

uip/whatnowsbr.c

index 4cab2ba..9092f0e 100644 (file)
@@ -123,7 +123,7 @@ WhatNow (int argc, char **argv)
     int isdf = 0, nedit = 0, use = 0, atfile = 1;
     char *cp, *dfolder = NULL, *dmsg = NULL;
     char *ed = NULL, *drft = NULL, *msgnam = NULL;
     int isdf = 0, nedit = 0, use = 0, atfile = 1;
     char *cp, *dfolder = NULL, *dmsg = NULL;
     char *ed = NULL, *drft = NULL, *msgnam = NULL;
-    char buf[BUFSIZ], prompt[BUFSIZ];
+    char buf[BUFSIZ];
     char **argp, **arguments;
     struct stat st;
     char       cwd[PATH_MAX + 1];      /* current working directory */
     char **argp, **arguments;
     struct stat st;
     char       cwd[PATH_MAX + 1];      /* current working directory */
@@ -224,12 +224,11 @@ WhatNow (int argc, char **argv)
                            NULL, 1, atfile) < 0)
        done (1);
 
                            NULL, 1, atfile) < 0)
        done (1);
 
-    snprintf (prompt, sizeof(prompt), myprompt, invo_name);
     for (;;) {
 #ifdef READLINE_SUPPORT
     for (;;) {
 #ifdef READLINE_SUPPORT
-       if (!(argp = read_switch_multiword_via_readline (prompt, aleqs))) {
+       if (!(argp = read_switch_multiword_via_readline(myprompt, aleqs))) {
 #else /* ! READLINE_SUPPORT */
 #else /* ! READLINE_SUPPORT */
-       if (!(argp = read_switch_multiword (prompt, aleqs))) {
+       if (!(argp = read_switch_multiword(myprompt, aleqs))) {
 #endif /* READLINE_SUPPORT */
            (void) m_unlink (LINK);
            done (1);
 #endif /* READLINE_SUPPORT */
            (void) m_unlink (LINK);
            done (1);