]> diplodocus.org Git - nmh/commitdiff
Replace printf(3) with fputs(3) where possible.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 30 Oct 2017 19:55:14 +0000 (19:55 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 30 Oct 2017 19:55:14 +0000 (19:55 +0000)
The format string has no format specifiers, and doesn't end with `\n',
so fputs() to stdout is sufficient.

uip/ali.c
uip/anno.c
uip/fmtdump.c
uip/fmttest.c
uip/install-mh.c
uip/mhlogin.c
uip/mhlsbr.c
uip/mhstoresbr.c
uip/msgchk.c
uip/post.c
uip/slocal.c

index a1b642c..f4e4664 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -177,10 +177,10 @@ print_aka (char *p, bool list, int margin)
                        printf ("\n%*s", margin, "");
                    else {
                        if (pos >= 68) {
-                           printf (",\n ");
+                           fputs(",\n ", stdout);
                            pos = 2;
                        } else {
-                           printf (", ");
+                           fputs(", ", stdout);
                            pos += 2;
                        }
                    }
index 1c4e0ca..2335ada 100644 (file)
@@ -274,7 +274,7 @@ make_comp (char **ap)
     char *cp, buffer[BUFSIZ];
 
     if (*ap == NULL) {
-       printf ("Enter component name: ");
+       fputs("Enter component name: ", stdout);
        fflush (stdout);
 
        if (fgets (buffer, sizeof buffer, stdin) == NULL)
index be6b763..3fa0876 100644 (file)
@@ -155,7 +155,7 @@ dumpone(struct format *fmt)
        case FT_LS_COMP:
        case FT_LV_COMPFLAG:
        case FT_LV_COMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -187,7 +187,7 @@ dumpone(struct format *fmt)
        case FT_LOCALDATE:
        case FT_GMTDATE:
        case FT_PARSEDATE:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -211,7 +211,7 @@ dumpone(struct format *fmt)
        case FT_MYMBOX:
        case FT_GETMYMBOX:
        case FT_GETMYADDR:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -222,7 +222,7 @@ dumpone(struct format *fmt)
        case FT_COMPF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' name ");
+               fputs("' name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -245,7 +245,7 @@ dumpone(struct format *fmt)
        case FT_LITF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' ");
+               fputs("' ", stdout);
                litputs(fmt->f_text);
                break;
 
@@ -261,7 +261,7 @@ dumpone(struct format *fmt)
        case FT_IF_S_NULL:
        case FT_IF_MATCH:
        case FT_IF_AMATCH:
-               printf(" continue else goto");
+               fputs(" continue else goto", stdout);
                /* FALLTHRU */
        case FT_GOTO:
                i = findlabel(fmt + fmt->f_skip);
@@ -288,17 +288,17 @@ dumpone(struct format *fmt)
                break;
 
        case FT_LS_LIT:
-               printf(" str ");
+               fputs(" str ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_GETENV:
-               printf(" getenv ");
+               fputs(" getenv ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_DECODECOMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                break;
 
index 9a569ae..d458bb6 100644 (file)
@@ -734,7 +734,7 @@ test_trace(void *context, struct format *fmt, int num, char *str,
     if (str != ctx->str) {
        if (changed++)
             putchar(' ');
-       printf("str=");
+       fputs("str=", stdout);
        litputs(str);
        ctx->str = str;
     }
@@ -743,7 +743,7 @@ test_trace(void *context, struct format *fmt, int num, char *str,
         putchar('\n');
 
     if (strcmp(outbuf, ctx->outbuf) != 0) {
-       printf("outbuf=");
+       fputs("outbuf=", stdout);
        litputs(outbuf);
        putchar('\n');
        free(ctx->outbuf);
@@ -783,7 +783,7 @@ dumpone(struct format *fmt)
        case FT_LS_COMP:
        case FT_LV_COMPFLAG:
        case FT_LV_COMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -815,7 +815,7 @@ dumpone(struct format *fmt)
        case FT_LOCALDATE:
        case FT_GMTDATE:
        case FT_PARSEDATE:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -839,7 +839,7 @@ dumpone(struct format *fmt)
        case FT_MYMBOX:
        case FT_GETMYMBOX:
        case FT_GETMYADDR:
-               printf(", c_name ");
+               fputs(", c_name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -850,7 +850,7 @@ dumpone(struct format *fmt)
        case FT_COMPF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' name ");
+               fputs("' name ", stdout);
                litputs(fmt->f_comp->c_name);
                if (fmt->f_comp->c_type)
                        printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
@@ -873,7 +873,7 @@ dumpone(struct format *fmt)
        case FT_LITF:
                printf(", width %d, fill '", fmt->f_width);
                litputc(fmt->f_fill);
-               printf("' ");
+               fputs("' ", stdout);
                litputs(fmt->f_text);
                break;
 
@@ -889,7 +889,7 @@ dumpone(struct format *fmt)
        case FT_IF_S_NULL:
        case FT_IF_MATCH:
        case FT_IF_AMATCH:
-               printf(" continue else goto");
+               fputs(" continue else goto", stdout);
                /* FALLTHRU */
        case FT_GOTO:
                i = findlabel(fmt + fmt->f_skip);
@@ -916,17 +916,17 @@ dumpone(struct format *fmt)
                break;
 
        case FT_LS_LIT:
-               printf(" str ");
+               fputs(" str ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_GETENV:
-               printf(" getenv ");
+               fputs(" getenv ", stdout);
                litputs(fmt->f_text);
                break;
 
        case FT_LS_DECODECOMP:
-               printf(", comp ");
+               fputs(", comp ", stdout);
                litputs(fmt->f_comp->c_name);
                break;
 
index 0d5b3bb..3a1fa2a 100644 (file)
@@ -153,7 +153,7 @@ query:
                pathname = read_line ();
                if (pathname == NULL) done (1);
            } else {
-               printf ("What is the whole path?  /");
+               fputs("What is the whole path?  /", stdout);
                pathname = read_line ();
                if (pathname == NULL) done (1);
                pathname = concat ("/", pathname, NULL);
index e02ef46..da4f639 100644 (file)
@@ -98,7 +98,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
                " to access %s:\n\n%s\n\n",
                mh_oauth_svc_display_name(ctx), url);
     }
-    printf("Enter the authorization code: ");
+    fputs("Enter the authorization code: ", stdout);
     fflush(stdout);
     code = geta();
 
index 5c050e3..1c8ab4e 100644 (file)
@@ -933,7 +933,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
        if (digest)
            fputs(ofilen == 1 ? delim3 : delim4, stdout);
        else {
-           printf ("\n-------");
+           fputs("\n-------", stdout);
            if (ofilen == 1)
                printf (" Forwarded Message%s", PLURALS(ofilec));
            else
index 18f0290..a9993d6 100644 (file)
@@ -1291,7 +1291,7 @@ clobber_check (char *original_file, mhstoreinfo_t info) {
               break;
             case NMH_RENAME: {
               char buf[PATH_MAX];
-              printf ("Enter filename or full path of the new file: ");
+              fputs("Enter filename or full path of the new file: ", stdout);
               if (fgets (buf, sizeof buf, stdin) == NULL  ||
                   buf[0] == '\0') {
                 file = NULL;
index 3e04f8f..5551e50 100644 (file)
@@ -368,7 +368,7 @@ remotemail (char *host, char *port, char *user, char *proxy, int notifysw,
     if (nmsgs) {
        if (notifysw & NT_MAIL) {
            if (personal)
-               printf ("You have ");
+               fputs("You have ", stdout);
            else
                printf ("%s has ", user);
 
index c6a0917..93531c9 100644 (file)
@@ -1370,26 +1370,26 @@ pl (void)
     int i;
     struct mailname *mp;
 
-    printf ("-------\n\t-- Addresses --\nlocal:\t");
+    fputs("-------\n\t-- Addresses --\nlocal:\t", stdout);
     for (mp = localaddrs.m_next; mp; mp = mp->m_next)
        printf ("%s%s%s", mp->m_mbox,
                mp->m_bcc ? "[BCC]" : "",
                mp->m_next ? ",\n\t" : "");
 
-    printf ("\nnet:\t");
+    fputs("\nnet:\t", stdout);
     for (mp = netaddrs.m_next; mp; mp = mp->m_next)
        printf ("%s%s@%s%s%s", FENDNULL(mp->m_path),
                mp->m_mbox, mp->m_host,
                mp->m_bcc ? "[BCC]" : "",
                mp->m_next ? ",\n\t" : "");
 
-    printf ("\nuucp:\t");
+    fputs("\nuucp:\t", stdout);
     for (mp = uuaddrs.m_next; mp; mp = mp->m_next)
        printf ("%s!%s%s%s", mp->m_host, mp->m_mbox,
                mp->m_bcc ? "[BCC]" : "",
                mp->m_next ? ",\n\t" : "");
 
-    printf ("\n\t-- Folder Copies --\nfcc:\t");
+    fputs("\n\t-- Folder Copies --\nfcc:\t", stdout);
     for (i = 0; i < fccind; i++)
        printf ("%s%s", fccfold[i], i + 1 < fccind ? ",\n\t" : "");
     putchar('\n');
@@ -1848,7 +1848,7 @@ do_an_address (struct mailname *lp, int talk)
        return;
     }
     if (talk)
-       printf (": ");
+       fputs(": ", stdout);
     fflush (stdout);
 
     switch (retval = sm_wadr (mbox, host,
index dae9ca9..cfdc0df 100644 (file)
@@ -1354,7 +1354,7 @@ adorn (char *what, char *fmt, ...)
     char *s;
 
     eindex = errno;    /* save the errno */
-    printf(", ");
+    fputs(", ", stdout);
 
     va_start(ap, fmt);
     vprintf(fmt, ap);