]> diplodocus.org Git - nmh/commitdiff
Replace printf("%s\n", foo) and similar with puts(foo).
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 10 Sep 2017 10:21:42 +0000 (11:21 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 10 Sep 2017 10:21:42 +0000 (11:21 +0100)
sbr/netsec.c
sbr/pidstatus.c
test/fakesmtp.c
test/getcanon.c
test/getfullname.c
uip/mhical.c
uip/popsbr.c

index edb8d8c5ce9d183bb7db9684852632ea70167458..bdf39a3004ed743307ff97368eebbfeab5d3dcd6 100644 (file)
@@ -461,8 +461,10 @@ retry:
                if (nsc->ns_snoop_cb)
                    nsc->ns_snoop_cb(nsc, sptr, strlen(sptr),
                                     nsc->ns_snoop_context);
                if (nsc->ns_snoop_cb)
                    nsc->ns_snoop_cb(nsc, sptr, strlen(sptr),
                                     nsc->ns_snoop_context);
-               else
-                   fprintf(stderr, "%s\n", sptr);
+               else {
+                    fputs(sptr, stderr);
+                    putc('\n', stderr);
+                }
            }
            return sptr;
        }
            }
            return sptr;
        }
index 6e4c2c7d405b1acaaf3ac8835a06e46e384585fd..d11a37e4f63e63633f57f9ec1a3beb4281f50cc0 100644 (file)
@@ -61,8 +61,11 @@ pidstatus (int status, FILE *fp, char *cp)
            if (signame)
                fprintf (fp, " (%s%s)\n", signame,
                         WCOREDUMP(status) ? ", core dumped" : "");
            if (signame)
                fprintf (fp, " (%s%s)\n", signame,
                         WCOREDUMP(status) ? ", core dumped" : "");
-           else
-               fprintf (fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : "");
+           else {
+                if (WCOREDUMP(status))
+                    fputs(" (core dumped)", fp);
+                putc('\n', fp);
+            }
        }
     }
 
        }
     }
 
index 35230957416a966ae73c369355272f9bcfb75d69..d48531de17cfa2d1911fcaf3ffed2ce5893e5014 100644 (file)
@@ -71,7 +71,8 @@ main(int argc, char *argv[])
                if (rc == -1)
                        break;  /* EOF */
 
                if (rc == -1)
                        break;  /* EOF */
 
-               fprintf(f, "%s\n", line);
+                fputs(line, f);
+                putc('\n', f);
 
                switch (smtp_state) {
                case SMTP_DATA:
 
                switch (smtp_state) {
                case SMTP_DATA:
index ada6802a51f9b946d20d3c573e3d4082fc96cf39..3e75f32f2b311505aa000cda068152b6259b3014 100644 (file)
@@ -46,10 +46,10 @@ main(int argc, char *argv[])
   hints.ai_family = AF_UNSPEC;
 
   if (getaddrinfo(hostname, NULL, &hints, &res)) {
   hints.ai_family = AF_UNSPEC;
 
   if (getaddrinfo(hostname, NULL, &hints, &res)) {
-    printf("%s\n", hostname);
+    puts(hostname);
     return 1;
   }
     return 1;
   }
-  printf("%s\n", res->ai_canonname);
+  puts(res->ai_canonname);
 
   return 0;
 }
 
   return 0;
 }
index 89a5491037e1253ee0018041ae8e26d39ba0c3d2..9a342ca1a8f9a6ca6f23b33bc6064800da450807 100644 (file)
@@ -53,8 +53,7 @@ main(int argc, char *argv[])
         * Quote the entire string if it has a special character in it.
         */
        escape_display_name (buf, sizeof(buf));
         * Quote the entire string if it has a special character in it.
         */
        escape_display_name (buf, sizeof(buf));
-
-       printf("%s\n", buf);
+       puts(buf);
 
        exit(0);
 }
 
        exit(0);
 }
index 3249d0855c25dd4a17d1645aa9bbe39d37f7ebe3..d62fce95d7049b4e37f17611cd913cdb46e28370 100644 (file)
@@ -535,11 +535,10 @@ output (FILE *file, contentline *clines, int contenttype) {
             line = fold (add (node->value, line),
                          clines->cr_before_lf == CR_BEFORE_LF);
 
             line = fold (add (node->value, line),
                          clines->cr_before_lf == CR_BEFORE_LF);
 
-            if (clines->cr_before_lf == LF_ONLY) {
-                fprintf (file, "%s\n", line);
-            } else {
-                fprintf (file, "%s\r\n", line);
-            }
+            fputs(line, file);
+            if (clines->cr_before_lf != LF_ONLY)
+                putc('\r', file);
+            putc('\n', file);
             free (line);
         }
     }
             free (line);
         }
     }
index ecf1aa3857fa8eb90e7460d529304d353b36861c..a93190541f48e2c4a04e9649211c837e40fcaebd 100644 (file)
@@ -270,8 +270,10 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop,
 
        case NOTOK: 
        case DONE: 
 
        case NOTOK: 
        case DONE: 
-           if (poprint)            
-               fprintf (stderr, "%s\n", response);
+           if (poprint) {
+               fputs(response, stderr);
+                putc('\n', stderr);
+            }
            netsec_shutdown(nsc);
            nsc = NULL;
            return NOTOK;
            netsec_shutdown(nsc);
            nsc = NULL;
            return NOTOK;
@@ -596,8 +598,10 @@ vcommand (const char *fmt, va_list ap)
 
        case NOTOK: 
        case DONE: 
 
        case NOTOK: 
        case DONE: 
-           if (poprint)            
-               fprintf (stderr, "%s\n", response);
+           if (poprint) {
+               fputs(response, stderr);
+                putc('\n', stderr);
+            }
            return NOTOK;
     }
 
            return NOTOK;
     }