diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2017-04-26 21:25:44 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2017-04-26 21:25:44 +0000 |
commit | f2c2ff6db58333f01653fa656b88a921a8e76d88 (patch) | |
tree | ce58764c0c95d01e25441fca039ae1ca2be7b5c8 /bin/ed | |
parent | fc836b6dfdfb08e60ee41ce793e33bd8ee611661 (diff) |
silence clang warnings: add an extra pair of parentheses and stop
passing empty format strings to printf-family functions; ok millert@
Diffstat (limited to 'bin/ed')
-rw-r--r-- | bin/ed/glbl.c | 4 | ||||
-rw-r--r-- | bin/ed/io.c | 8 | ||||
-rw-r--r-- | bin/ed/main.c | 37 |
3 files changed, 27 insertions, 22 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index b4cb41f85e9..27ebc0c6852 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glbl.c,v 1.18 2016/03/22 17:58:28 mmcc Exp $ */ +/* $OpenBSD: glbl.c,v 1.19 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */ /* glob.c: This file contains the global command routines for the ed line @@ -67,7 +67,7 @@ build_active_list(int isgcmd) return ERR; if (isbinary) NUL_TO_NEWLINE(s, lp->len); - if (!regexec(pat, s, 0, NULL, 0) == isgcmd && + if ((!regexec(pat, s, 0, NULL, 0)) == isgcmd && set_active_node(lp) < 0) return ERR; } diff --git a/bin/ed/io.c b/bin/ed/io.c index 2a81d2ab1a7..13e2c583b8d 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.19 2016/03/22 17:58:28 mmcc Exp $ */ +/* $OpenBSD: io.c,v 1.20 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */ /* io.c: This file contains the i/o routines for the ed line editor */ @@ -63,7 +63,8 @@ read_file(char *fn, int n) seterrmsg("cannot close input file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return current_addr - n; } @@ -164,7 +165,8 @@ write_file(char *fn, char *mode, int n, int m) seterrmsg("cannot close output file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return n ? m - n + 1 : 0; } diff --git a/bin/ed/main.c b/bin/ed/main.c index 33c3550f500..3ddf399eee6 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.59 2017/01/03 20:24:29 tb Exp $ */ +/* $OpenBSD: main.c,v 1.60 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */ /* main.c: This file contains the main control and user-interface routines @@ -218,9 +218,10 @@ top: fputs("?\n", stderr); seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } clearerr(stdin); @@ -252,28 +253,30 @@ top: fputs("?\n", stderr); /* give warning */ seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; case FATAL: - if (!interactive) - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); - else - fprintf(stderr, garrulous ? "%s\n" : "", - errmsg); + if (!interactive) { + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); + } else if (garrulous) + fprintf(stderr, "%s\n", errmsg); quit(3); break; default: fputs("?\n", stderr); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; |