From 426e9c1dcc6b3d9d4a5ad436aecaa1c2f9d29e17 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 25 Apr 1999 21:13:34 +0000 Subject: [PATCH] First set of fixes to keep egcs happy. These include {} around single statement if blocks[*] when the else could be ambiguous, not defaulting to int type and removal of some unused variables. [*] This is explicitly allowed by style(9) when the single statement spans more than one line. Reviewed by: obrien, chuckr --- bin/chio/chio.c | 3 ++- bin/cp/cp.c | 5 +++-- bin/cp/utils.c | 5 +++-- bin/csh/dol.c | 5 +++-- bin/csh/func.c | 5 +++-- bin/csh/lex.c | 4 ++-- bin/csh/sem.c | 5 +++-- bin/date/vary.c | 8 +++++--- bin/dd/dd.c | 11 ++++++----- bin/sh/arith_lex.l | 6 +++--- bin/sh/input.c | 3 +-- 11 files changed, 34 insertions(+), 26 deletions(-) diff --git a/bin/chio/chio.c b/bin/chio/chio.c index bb5f749f194..180d568352d 100644 --- a/bin/chio/chio.c +++ b/bin/chio/chio.c @@ -656,7 +656,7 @@ do_status(char *cname, int argc, char **argv) printf(" avoltag: <%s:%d>", ces->ces_avoltag.cv_volid, ces->ces_avoltag.cv_serial); - if (source) + if (source) { if (ces->ces_flags & CES_SOURCE_VALID) printf(" source: <%s %d>", element_type_name( @@ -664,6 +664,7 @@ do_status(char *cname, int argc, char **argv) ces->ces_source_addr); else printf(" source: <>"); + } if (intaddr) printf(" intaddr: <%d>", ces->ces_int_addr); if (scsi) { diff --git a/bin/cp/cp.c b/bin/cp/cp.c index bf890111229..e3ddbfa80bc 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -45,7 +45,7 @@ static char const copyright[] = static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94"; #endif static const char rcsid[] = - "$Id: cp.c,v 1.16 1998/05/13 07:25:14 charnier Exp $"; + "$Id: cp.c,v 1.17 1998/06/09 13:42:51 dt Exp $"; #endif /* not lint */ /* @@ -295,7 +295,7 @@ copy(argv, type, fts_options) * Since the first level MUST be FTS_ROOTLEVEL, base * is always initialized. */ - if (curr->fts_level == FTS_ROOTLEVEL) + if (curr->fts_level == FTS_ROOTLEVEL) { if (type != DIR_TO_DNE) { p = strrchr(curr->fts_path, '/'); base = (p == NULL) ? 0 : @@ -306,6 +306,7 @@ copy(argv, type, fts_options) base += 1; } else base = curr->fts_pathlen; + } p = &curr->fts_path[base]; nlen = curr->fts_pathlen - base; diff --git a/bin/cp/utils.c b/bin/cp/utils.c index f6c0f0d21d5..9118efcc32f 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #endif static const char rcsid[] = - "$Id: utils.c,v 1.20 1998/06/10 06:29:23 peter Exp $"; + "$Id: utils.c,v 1.21 1998/11/18 11:47:45 bde Exp $"; #endif /* not lint */ #include @@ -183,7 +183,7 @@ copy_file(entp, dne) */ #define RETAINBITS \ (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) - else if (fs->st_mode & (S_ISUID | S_ISGID) && fs->st_uid == myuid) + else if (fs->st_mode & (S_ISUID | S_ISGID) && fs->st_uid == myuid) { if (fstat(to_fd, &to_stat)) { warn("%s", to.p_path); rval = 1; @@ -192,6 +192,7 @@ copy_file(entp, dne) warn("%s", to.p_path); rval = 1; } + } (void)close(from_fd); if (close(to_fd)) { warn("%s", to.p_path); diff --git a/bin/csh/dol.c b/bin/csh/dol.c index 21d6487f946..79a53496a04 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93"; #else static const char rcsid[] = - "$Id: dol.c,v 1.7 1998/05/06 06:50:39 charnier Exp $"; + "$Id: dol.c,v 1.8 1998/05/13 07:28:52 charnier Exp $"; #endif #endif /* not lint */ @@ -605,11 +605,12 @@ Dgetdol() stderror(ERR_SYNTAX); } else { - if (subscr > 0) + if (subscr > 0) { if (subscr > upb) lwb = 1, upb = 0; else lwb = upb = subscr; + } unDredc(c); } if (dimen) { diff --git a/bin/csh/func.c b/bin/csh/func.c index 1b8da96bf67..f5cbe528a43 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93"; #else static const char rcsid[] = - "$Id: func.c,v 1.10 1998/02/28 10:49:56 jraynard Exp $"; + "$Id: func.c,v 1.11 1998/07/27 21:15:52 nectar Exp $"; #endif #endif /* not lint */ @@ -754,11 +754,12 @@ getword(wp) c = readc(1); if (c == '\\' && (c = readc(1)) == '\n') c = ' '; - if (c == '\'' || c == '"') + if (c == '\'' || c == '"') { if (d == 0) d = c; else if (d == c) d = 0; + } if (c < 0) goto past; if (wp) { diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 3ec0425c55e..56acc414338 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93"; #else static const char rcsid[] = - "$Id: lex.c,v 1.9 1998/05/06 06:50:52 charnier Exp $"; + "$Id: lex.c,v 1.10 1998/05/13 07:29:05 charnier Exp $"; #endif #endif /* not lint */ @@ -1328,7 +1328,7 @@ readc(wanteof) bool wanteof; { int c; - static sincereal; + static int sincereal; aret = F_SEEK; if ((c = peekread) != '\0') { diff --git a/bin/csh/sem.c b/bin/csh/sem.c index 753b839c4a5..f9fedda9202 100644 --- a/bin/csh/sem.c +++ b/bin/csh/sem.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93"; #else static const char rcsid[] = - "$Id: sem.c,v 1.7 1998/02/28 10:50:00 jraynard Exp $"; + "$Id: sem.c,v 1.8 1998/05/06 06:51:00 charnier Exp $"; #endif #endif /* not lint */ @@ -203,7 +203,7 @@ execute(t, wanttty, pipein, pipeout) * We have to fork for eval too. */ (bifunc && (t->t_dflg & (F_PIPEIN | F_PIPEOUT)) != 0 && - bifunc->bfunct == doeval)) + bifunc->bfunct == doeval)) { if (t->t_dtyp == NODE_PAREN || t->t_dflg & (F_REPEAT | F_AMPERSAND) || bifunc) { forked++; @@ -339,6 +339,7 @@ execute(t, wanttty, pipein, pipeout) } } + } if (pid != 0) { /* * It would be better if we could wait for the whole job when we diff --git a/bin/date/vary.c b/bin/date/vary.c index d2345d4b2d6..0e82722ed1c 100644 --- a/bin/date/vary.c +++ b/bin/date/vary.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$Id: vary.c,v 1.4 1998/05/06 06:51:20 charnier Exp $"; + "$Id: vary.c,v 1.5 1999/03/09 09:38:54 brian Exp $"; #endif /* not lint */ #include @@ -140,11 +140,12 @@ adjmon(struct tm *t, char type, int val, int istext) switch (type) { case '+': - if (istext) + if (istext) { if (val <= t->tm_mon) val += 11 - t->tm_mon; /* early next year */ else val -= t->tm_mon + 1; /* later this year */ + } if (!adjyear(t, '+', (t->tm_mon + val) / 12)) return 0; val %= 12; @@ -154,11 +155,12 @@ adjmon(struct tm *t, char type, int val, int istext) break; case '-': - if (istext) + if (istext) { if (val-1 > t->tm_mon) val = 13 - val + t->tm_mon; /* later last year */ else val = t->tm_mon - val + 1; /* early this year */ + } if (!adjyear(t, '-', val / 12)) return 0; val %= 12; diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 1e1c52f3320..7aac8c62e34 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -46,7 +46,7 @@ static char const copyright[] = static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94"; #endif static const char rcsid[] = - "$Id: dd.c,v 1.14 1998/05/06 06:51:39 charnier Exp $"; + "$Id: dd.c,v 1.15 1998/05/13 07:33:47 charnier Exp $"; #endif /* not lint */ #include @@ -178,8 +178,8 @@ setup() * table that does both at once. If just converting case, use the * built-in tables. */ - if (ddflags & (C_LCASE|C_UCASE)) - if (ddflags & C_ASCII) + if (ddflags & (C_LCASE|C_UCASE)) { + if (ddflags & C_ASCII) { if (ddflags & C_LCASE) { for (cnt = 0; cnt <= 0377; ++cnt) if (isupper(ctab[cnt])) @@ -189,7 +189,7 @@ setup() if (islower(ctab[cnt])) ctab[cnt] = toupper(ctab[cnt]); } - else if (ddflags & C_EBCDIC) + } else if (ddflags & C_EBCDIC) { if (ddflags & C_LCASE) { for (cnt = 0; cnt <= 0377; ++cnt) if (isupper(cnt)) @@ -199,7 +199,7 @@ setup() if (islower(cnt)) ctab[cnt] = ctab[toupper(cnt)]; } - else { + } else { ctab = ddflags & C_LCASE ? u2l : l2u; if (ddflags & C_LCASE) { for (cnt = 0; cnt <= 0377; ++cnt) @@ -215,6 +215,7 @@ setup() ctab[cnt] = cnt; } } + } (void)gettimeofday(&tv, (struct timezone *)NULL); st.start = tv.tv_sec + tv.tv_usec * 1e-6; } diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l index b5ca746d9fc..ef29c122299 100644 --- a/bin/sh/arith_lex.l +++ b/bin/sh/arith_lex.l @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: arith_lex.l,v 1.11 1998/08/24 10:20:36 cracauer Exp $ + * $Id: arith_lex.l,v 1.12 1998/08/25 09:33:34 cracauer Exp $ */ #ifndef lint @@ -42,14 +42,14 @@ static char sccsid[] = "@(#)arith_lex.l 8.3 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id$"; + "$Id: arith_lex.l,v 1.12 1998/08/25 09:33:34 cracauer Exp $"; #endif /* not lint */ #include #include "y.tab.h" #include "error.h" -extern yylval; +extern int yylval; extern char *arith_buf, *arith_startbuf; #undef YY_INPUT #define YY_INPUT(buf,result,max) \ diff --git a/bin/sh/input.c b/bin/sh/input.c index 1c9f2ad7c68..f44749c6d79 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95"; #endif static const char rcsid[] = - "$Id$"; + "$Id: input.c,v 1.11 1998/05/18 06:43:45 charnier Exp $"; #endif /* not lint */ #include /* defines BUFSIZ */ @@ -232,7 +232,6 @@ preadbuffer() char *p, *q; int more; int something; - extern EditLine *el; char savec; if (parsefile->strpush) {