From 4822432874e997891c75df8d30dcab4c52d1a9fa Mon Sep 17 00:00:00 2001 From: billf Date: Sun, 4 Jul 1999 17:26:16 +0000 Subject: Clean up some ambiguous nested if/elses. --- usr.bin/finger/finger.c | 5 +++-- usr.bin/ftp/ruserpass.c | 7 ++++--- usr.bin/hexdump/odsyntax.c | 5 +++-- usr.bin/id/id.c | 8 +++++--- usr.bin/indent/indent.c | 8 ++++---- usr.bin/indent/io.c | 8 +++++--- usr.bin/join/join.c | 5 +++-- usr.bin/ncal/ncal.c | 5 +++-- usr.bin/nice/nice.c | 3 ++- usr.bin/rdist/expand.c | 5 +++-- usr.bin/rpcgen/rpc_cout.c | 8 +++++--- usr.bin/tail/tail.c | 3 ++- usr.bin/tcopy/tcopy.c | 5 +++-- usr.bin/touch/touch.c | 3 ++- usr.bin/tset/term.c | 5 +++-- usr.bin/tsort/tsort.c | 5 +++-- usr.bin/w/w.c | 5 +++-- usr.bin/write/write.c | 5 +++-- usr.bin/yacc/mkpar.c | 5 +++-- 19 files changed, 62 insertions(+), 41 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c index 8a2cb2b..ec0e6b9 100644 --- a/usr.bin/finger/finger.c +++ b/usr.bin/finger/finger.c @@ -55,7 +55,7 @@ static char copyright[] = static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95"; #else static const char rcsid[] = - "$Id: finger.c,v 1.12 1997/07/02 06:34:48 charnier Exp $"; + "$Id: finger.c,v 1.13 1999/05/08 00:46:04 obrien Exp $"; #endif #endif /* not lint */ @@ -208,11 +208,12 @@ main(argc, argv) if (!sflag) lflag = 1; /* if -s not explicit, force -l */ } - if (entries) + if (entries) { if (lflag) lflag_print(); else sflag_print(); + } return (0); } diff --git a/usr.bin/ftp/ruserpass.c b/usr.bin/ftp/ruserpass.c index bc19f62..c0e7f95 100644 --- a/usr.bin/ftp/ruserpass.c +++ b/usr.bin/ftp/ruserpass.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: ruserpass.c,v 1.7 1997/12/13 20:38:20 pst Exp $ */ /* $NetBSD: ruserpass.c,v 1.14.2.1 1997/11/18 01:02:05 mellon Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95"; #else -__RCSID("$Id$"); +__RCSID("$Id: ruserpass.c,v 1.7 1997/12/13 20:38:20 pst Exp $"); __RCSID_SOURCE("$NetBSD: ruserpass.c,v 1.14.2.1 1997/11/18 01:02:05 mellon Exp $"); #endif #endif /* not lint */ @@ -149,7 +149,7 @@ next: while ((t = token()) && t != MACH && t != DEFAULT) switch(t) { case LOGIN: - if (token()) + if (token()) { if (*aname == NULL) { *aname = strdup(tokval); if (*aname == NULL) @@ -158,6 +158,7 @@ next: if (strcmp(*aname, tokval)) goto next; } + } break; case PASSWD: if ((*aname == NULL || strcmp(*aname, "anonymous")) && diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c index 7ad7c37..7636ab8 100644 --- a/usr.bin/hexdump/odsyntax.c +++ b/usr.bin/hexdump/odsyntax.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)odsyntax.c 8.2 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id: odsyntax.c,v 1.5 1997/07/10 06:48:21 charnier Exp $"; + "$Id: odsyntax.c,v 1.6 1997/11/04 05:33:14 ache Exp $"; #endif /* not lint */ #include @@ -222,7 +222,7 @@ odoffset(argc, argvp) return; } - if (*p) + if (*p) { if (*p == 'B') { skip *= 1024; ++p; @@ -230,6 +230,7 @@ odoffset(argc, argvp) skip *= 512; ++p; } + } if (*p) { skip = 0; diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c index c1e5902..2b6c96b 100644 --- a/usr.bin/id/id.c +++ b/usr.bin/id/id.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)id.c 8.2 (Berkeley) 2/16/94"; #endif static const char rcsid[] = - "$Id: id.c,v 1.6 1998/02/18 17:35:16 steve Exp $"; + "$Id: id.c,v 1.7 1998/08/21 06:47:58 obrien Exp $"; #endif /* not lint */ #include @@ -181,16 +181,18 @@ pretty(pw) else (void)printf("uid\t%u\n", rid); - if ((eid = geteuid()) != rid) + if ((eid = geteuid()) != rid) { if ((pw = getpwuid(eid))) (void)printf("euid\t%s\n", pw->pw_name); else (void)printf("euid\t%u\n", eid); - if ((rid = getgid()) != (eid = getegid())) + } + if ((rid = getgid()) != (eid = getegid())) { if ((gr = getgrgid(rid))) (void)printf("rgid\t%s\n", gr->gr_name); else (void)printf("rgid\t%u\n", rid); + } (void)printf("groups\t"); group(NULL, 1); } diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index ff5e420..c903d70 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -46,7 +46,7 @@ static const char copyright[] = static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93"; #endif static const char rcsid[] = - "$Id: indent.c,v 1.2 1997/07/15 09:50:59 charnier Exp $"; + "$Id: indent.c,v 1.3 1998/10/18 04:46:24 thepish Exp $"; #endif /* not lint */ #include @@ -208,16 +208,16 @@ main(argc, argv) else set_option(argv[i]); } /* end of for */ - if (input == 0) { + if (input == 0) input = stdin; - } - if (output == 0) + if (output == 0) { if (troff || input == stdin) output = stdout; else { out_name = in_name; bakcopy(); } + } if (ps.com_ind <= 1) ps.com_ind = 2; /* dont put normal comments before column 2 */ if (troff) { diff --git a/usr.bin/indent/io.c b/usr.bin/indent/io.c index d2222aa..11c9a8d 100644 --- a/usr.bin/indent/io.c +++ b/usr.bin/indent/io.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: io.c,v 1.3 1997/07/15 09:50:59 charnier Exp $"; #endif /* not lint */ #include @@ -84,7 +84,7 @@ dump_line() else if (!inhibit_formatting) { suppress_blanklines = 0; ps.bl_line = false; - if (prefix_blankline_requested && not_first_line) + if (prefix_blankline_requested && not_first_line) { if (swallow_optional_blanklines) { if (n_real_blanklines == 1) n_real_blanklines = 0; @@ -93,6 +93,7 @@ dump_line() if (n_real_blanklines == 0) n_real_blanklines = 1; } + } while (--n_real_blanklines >= 0) putc('\n', output); n_real_blanklines = 0; @@ -238,11 +239,12 @@ dump_line() e_com--; cur_col = pad_output(cur_col, target); if (!ps.box_com) { - if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) + if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) com_st[1] = '*'; else fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); + } } fwrite(com_st, e_com - com_st, 1, output); ps.comment_delta = ps.n_comment_delta; diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c index 276f988..a0229b5 100644 --- a/usr.bin/join/join.c +++ b/usr.bin/join/join.c @@ -46,7 +46,7 @@ static const char copyright[] = static char sccsid[] = "@(#)join.c 8.6 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id: join.c,v 1.7 1997/07/15 09:57:28 charnier Exp $"; + "$Id: join.c,v 1.8 1997/08/19 15:58:15 jlemon Exp $"; #endif /* not lint */ #include @@ -458,7 +458,7 @@ outfield(lp, fieldno, out_empty) { if (needsep++) (void)printf("%c", *tabchar); - if (!ferror(stdout)) + if (!ferror(stdout)) { if (lp->fieldcnt <= fieldno || out_empty) { if (empty != NULL) (void)printf("%s", empty); @@ -467,6 +467,7 @@ outfield(lp, fieldno, out_empty) return; (void)printf("%s", lp->fields[fieldno]); } + } if (ferror(stdout)) err(1, "stdout"); } diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c index 0902177..03f48a9 100644 --- a/usr.bin/ncal/ncal.c +++ b/usr.bin/ncal/ncal.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$Id: ncal.c,v 1.6 1998/01/15 10:23:34 helbig Exp $"; + "$Id: ncal.c,v 1.7 1999/03/27 21:08:13 helbig Exp $"; #endif /* not lint */ #include @@ -482,7 +482,7 @@ printyear(int y, int jd_flag) mw, year[j + 2].lines[i], year[j + 3].lines[i]); } - if (flag_weeks) + if (flag_weeks) { if (mpl == 3) printf(" %-*s%-*s%-s\n", mw, year[j].weeks, @@ -494,6 +494,7 @@ printyear(int y, int jd_flag) mw, year[j + 1].weeks, mw, year[j + 2].weeks, year[j + 3].weeks); + } } } diff --git a/usr.bin/nice/nice.c b/usr.bin/nice/nice.c index 300dc87..c731ca9 100644 --- a/usr.bin/nice/nice.c +++ b/usr.bin/nice/nice.c @@ -67,12 +67,13 @@ main(argc, argv) if (argc < 2) usage(); - if (argv[1][0] == '-') + if (argv[1][0] == '-') { if (argv[1][1] == '-' || isdigit(argv[1][1])) { niceness = atoi(argv[1] + 1); ++argv; } else errx(1, "illegal option -- %s", argv[1]); + } if (argv[1] == NULL) usage(); diff --git a/usr.bin/rdist/expand.c b/usr.bin/rdist/expand.c index a98056c..83178d0 100644 --- a/usr.bin/rdist/expand.c +++ b/usr.bin/rdist/expand.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: expand.c,v 1.6 1998/04/06 06:18:20 charnier Exp $"; #endif /* not lint */ #include "defs.h" @@ -508,7 +508,7 @@ slash: while (*s) addpath(*s++); addpath('/'); - if (stat(path, &stb) == 0 && ISDIR(stb.st_mode)) + if (stat(path, &stb) == 0 && ISDIR(stb.st_mode)) { if (*p == '\0') { if (which & E_TILDE) Cat(path, ""); @@ -516,6 +516,7 @@ slash: Cat(tilde, tpathp); } else expsh(p); + } pathp = spathp; *pathp = '\0'; return (0); diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index f8dd6b3..4fc6684 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -34,7 +34,7 @@ static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #endif static const char rcsid[] = - "$Id$"; + "$Id: rpc_cout.c,v 1.5 1997/08/06 06:47:39 charnier Exp $"; #endif /* @@ -466,7 +466,7 @@ int flag; } } } else { - if (i > 0) + if (i > 0) { if (sizestr == NULL && size < inline){ /* * don't expand into inline code @@ -482,7 +482,7 @@ int flag; if (sizestr == NULL) f_print(fout, "buf = XDR_INLINE(xdrs, %d * BYTES_PER_XDR_UNIT);", size); - else + else { if (size == 0) f_print(fout, "buf = XDR_INLINE(xdrs, (%s) * BYTES_PER_XDR_UNIT);", @@ -492,6 +492,7 @@ int flag; "buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);", size, sizestr); + } f_print(fout, "\n"); tabify(fout, indent + 1); f_print(fout, @@ -514,6 +515,7 @@ int flag; tabify(fout, indent + 1); f_print(fout, "}\n"); } + } size = 0; i = 0; sizestr = NULL; diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index 454ef65..416d441 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -154,7 +154,7 @@ main(argc, argv) * If style not specified, the default is the whole file for -r, and * the last 10 lines if not -r. */ - if (style == NOTSET) + if (style == NOTSET) { if (rflag) { off = 0; style = REVERSE; @@ -162,6 +162,7 @@ main(argc, argv) off = 10; style = RLINES; } + } if (*argv) for (first = 1; fname = *argv++;) { diff --git a/usr.bin/tcopy/tcopy.c b/usr.bin/tcopy/tcopy.c index b004868..3b9ffdd81a 100644 --- a/usr.bin/tcopy/tcopy.c +++ b/usr.bin/tcopy/tcopy.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)tcopy.c 8.2 (Berkeley) 4/17/94"; #endif static const char rcsid[] = - "$Id: tcopy.c,v 1.4 1997/08/14 06:41:00 charnier Exp $"; + "$Id: tcopy.c,v 1.5 1999/04/30 13:13:32 phk Exp $"; #endif /* not lint */ #include @@ -282,11 +282,12 @@ void intr(signo) int signo; { - if (record) + if (record) { if (record - lastrec > 1) fprintf(msg, "records %qu to %qu\n", lastrec, record); else fprintf(msg, "record %qu\n", lastrec); + } fprintf(msg, "interrupt at file %d: record %qu\n", filen, record); fprintf(msg, "total length: %ld bytes\n", tsize + size); exit(1); diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c index 30d3677..b56b05f 100644 --- a/usr.bin/touch/touch.c +++ b/usr.bin/touch/touch.c @@ -129,7 +129,7 @@ main(argc, argv) for (rval = 0; *argv; ++argv) { /* See if the file exists. */ - if (stat(*argv, &sb)) + if (stat(*argv, &sb)) { if (!cflag) { /* Create the file. */ fd = open(*argv, @@ -145,6 +145,7 @@ main(argc, argv) continue; } else continue; + } if (!aflag) TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec); diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c index 714ef65..f64b869 100644 --- a/usr.bin/tset/term.c +++ b/usr.bin/tset/term.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: term.c,v 1.2 1997/08/18 07:27:56 charnier Exp $"; #endif /* not lint */ #include @@ -104,11 +104,12 @@ found: if ((p = getenv("TERMCAP")) != NULL && *p != '/') * ttype now contains a pointer to the type of the terminal. * If the first character is '?', ask the user. */ - if (ttype[0] == '?') + if (ttype[0] == '?') { if (ttype[1] != '\0') ttype = askuser(ttype + 1); else ttype = askuser(NULL); + } /* Find the termcap entry. If it doesn't exist, ask the user. */ while ((rval = tgetent(tbuf, ttype)) == 0) { diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 591ad16..fca46e9 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tsort.c,v 1.7 1997/03/11 14:48:14 peter Exp $ + * $Id: tsort.c,v 1.8 1997/03/29 04:33:15 imp Exp $ */ #ifndef lint @@ -340,7 +340,7 @@ tsort() err(1, NULL); } for (n = graph; n != NULL; n = n->n_next) - if (!(n->n_flags & NF_ACYCLIC)) + if (!(n->n_flags & NF_ACYCLIC)) { if ((cnt = find_cycle(n, n, 0, 0))) { if (!quiet) { warnx("cycle in data"); @@ -356,6 +356,7 @@ tsort() n->n_flags |= NF_ACYCLIC; clear_cycle(); } + } if (n == NULL) errx(1, "internal error -- could not find cycle"); diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 9e1fe70..1e5eceb 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94"; #endif static const char rcsid[] = - "$Id: w.c,v 1.33 1999/03/31 21:01:39 brian Exp $"; + "$Id: w.c,v 1.34 1999/04/22 23:40:56 ache Exp $"; #endif /* not lint */ /* @@ -325,7 +325,7 @@ main(argc, argv) } } - if (!nflag) + if (!nflag) { if (gethostname(domain, sizeof(domain) - 1) < 0 || (p = strchr(domain, '.')) == 0) domain[0] = '\0'; @@ -333,6 +333,7 @@ main(argc, argv) domain[sizeof(domain) - 1] = '\0'; memmove(domain, p, strlen(p) + 1); } + } for (ep = ehead; ep != NULL; ep = ep->next) { char host_buf[UT_HOSTSIZE + 1]; diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index 908bda0..f1a37fb 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: write.c,v 1.9 1997/09/15 00:17:38 ache Exp $"; + "$Id: write.c,v 1.10 1997/09/15 00:40:34 ache Exp $"; #endif /* not lint */ #include @@ -259,11 +259,12 @@ do_write(tty, mytty, myuid) char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512]; /* Determine our login name before the we reopen() stdout */ - if ((login = getlogin()) == NULL) + if ((login = getlogin()) == NULL) { if ((pwd = getpwuid(myuid))) login = pwd->pw_name; else login = "???"; + } (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); if ((freopen(path, "w", stdout)) == NULL) diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c index 212a79b..b6ef27d 100644 --- a/usr.bin/yacc/mkpar.c +++ b/usr.bin/yacc/mkpar.c @@ -39,7 +39,7 @@ static char const sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91"; #endif static const char rcsid[] = - "$Id$"; + "$Id: mkpar.c,v 1.7 1997/08/28 06:33:53 charnier Exp $"; #endif /* not lint */ #include @@ -245,11 +245,12 @@ unused_rules() for (i = 3; i < nrules; ++i) if (!rules_used[i]) ++nunused; - if (nunused) + if (nunused) { if (nunused == 1) warnx("1 rule never reduced"); else warnx("%d rules never reduced", nunused); + } } -- cgit v1.1