From: Ralph Corderoy Date: Sun, 10 Sep 2017 10:21:42 +0000 (+0100) Subject: Replace printf("%s\n", foo) and similar with puts(foo). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/89edf0508f6df4700d0e28cace04e44fec4ff735?hp=95b3a95e742da57976a1cd8f723cc0819cbba53c Replace printf("%s\n", foo) and similar with puts(foo). --- diff --git a/sbr/netsec.c b/sbr/netsec.c index edb8d8c5..bdf39a30 100644 --- a/sbr/netsec.c +++ b/sbr/netsec.c @@ -461,8 +461,10 @@ retry: 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; } diff --git a/sbr/pidstatus.c b/sbr/pidstatus.c index 6e4c2c7d..d11a37e4 100644 --- a/sbr/pidstatus.c +++ b/sbr/pidstatus.c @@ -61,8 +61,11 @@ pidstatus (int status, FILE *fp, char *cp) 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); + } } } diff --git a/test/fakesmtp.c b/test/fakesmtp.c index 35230957..d48531de 100644 --- a/test/fakesmtp.c +++ b/test/fakesmtp.c @@ -71,7 +71,8 @@ main(int argc, char *argv[]) if (rc == -1) break; /* EOF */ - fprintf(f, "%s\n", line); + fputs(line, f); + putc('\n', f); switch (smtp_state) { case SMTP_DATA: diff --git a/test/getcanon.c b/test/getcanon.c index ada6802a..3e75f32f 100644 --- a/test/getcanon.c +++ b/test/getcanon.c @@ -46,10 +46,10 @@ main(int argc, char *argv[]) hints.ai_family = AF_UNSPEC; if (getaddrinfo(hostname, NULL, &hints, &res)) { - printf("%s\n", hostname); + puts(hostname); return 1; } - printf("%s\n", res->ai_canonname); + puts(res->ai_canonname); return 0; } diff --git a/test/getfullname.c b/test/getfullname.c index 89a54910..9a342ca1 100644 --- a/test/getfullname.c +++ b/test/getfullname.c @@ -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)); - - printf("%s\n", buf); + puts(buf); exit(0); } diff --git a/uip/mhical.c b/uip/mhical.c index 3249d085..d62fce95 100644 --- a/uip/mhical.c +++ b/uip/mhical.c @@ -535,11 +535,10 @@ output (FILE *file, contentline *clines, int contenttype) { 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); } } diff --git a/uip/popsbr.c b/uip/popsbr.c index ecf1aa38..a9319054 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -270,8 +270,10 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, 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; @@ -596,8 +598,10 @@ vcommand (const char *fmt, va_list ap) case NOTOK: case DONE: - if (poprint) - fprintf (stderr, "%s\n", response); + if (poprint) { + fputs(response, stderr); + putc('\n', stderr); + } return NOTOK; }