From 96846ff64680fa4945300ede843b93311fea74fc Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 25 Apr 1999 22:37:58 +0000 Subject: [PATCH] More egcs warning fixes: o main returns int not void o use return 0 at end of main when needed o use braces to avoid potentially ambiguous else o don't default to type int o #ifdef 0 -> #if 0 Reviewed by: obrien and chuckr --- usr.bin/at/at.c | 4 ++-- usr.bin/calendar/calendar.h | 4 ++-- usr.bin/chpass/edit.c | 4 ++-- usr.bin/chpass/pw_copy.c | 3 ++- usr.bin/cmp/regular.c | 3 ++- usr.bin/cmp/special.c | 6 ++++-- usr.bin/colcrt/colcrt.c | 4 ++-- usr.bin/gencat/gencat.c | 3 ++- usr.bin/sed/process.c | 5 +++-- usr.bin/tn3270/tools/mkdctype/mkdctype.c | 3 ++- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index 3264d5502a2d..d21dfd39c92b 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -92,12 +92,12 @@ enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */ /* File scope variables */ -static const char rcsid[] = "$Id: at.c,v 1.14 1998/10/15 13:30:48 mckay Exp $"; +static const char rcsid[] = "$Id: at.c,v 1.15 1998/12/06 07:42:09 archie Exp $"; char *no_export[] = { "TERM", "TERMCAP", "DISPLAY", "_" } ; -static send_mail = 0; +static int send_mail = 0; /* External variables */ diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h index 6579e11269e5..1a95fa2eee8c 100644 --- a/usr.bin/calendar/calendar.h +++ b/usr.bin/calendar/calendar.h @@ -63,8 +63,8 @@ void setnnames __P((void)); #define F_ISDAYVAR 0x04 /* variables day of week, like SundayLast */ #define F_EASTER 0x08 /* Easter or easter depending days */ -extern f_dayAfter; /* days after current date */ -extern f_dayBefore; /* days bevore current date */ +extern int f_dayAfter; /* days after current date */ +extern int f_dayBefore; /* days bevore current date */ struct fixs { char *name; diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c index 83cd2c8b7861..cf4ae4d40299 100644 --- a/usr.bin/chpass/edit.c +++ b/usr.bin/chpass/edit.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: edit.c,v 1.12 1998/12/06 22:58:14 archie Exp $ + * $Id: edit.c,v 1.13 1999/02/23 02:41:26 ghelmer Exp $ */ #ifndef lint @@ -120,7 +120,7 @@ display(fd, pw) *pw->pw_shell ? pw->pw_shell : _PATH_BSHELL); } /* Only admin can change "restricted" shells. */ -#ifdef 0 +#if 0 else if (ok_shell(pw->pw_shell)) /* * Make shell a restricted field. Ugly with a diff --git a/usr.bin/chpass/pw_copy.c b/usr.bin/chpass/pw_copy.c index d60f75177492..f584ba3e7eaf 100644 --- a/usr.bin/chpass/pw_copy.c +++ b/usr.bin/chpass/pw_copy.c @@ -109,7 +109,7 @@ pw_copy(ffd, tfd, pw) if (ferror(to)) goto err; } - if (!done) + if (!done) { #ifdef YP /* Ultra paranoid: shouldn't happen. */ if (getuid()) { @@ -126,6 +126,7 @@ pw_copy(ffd, tfd, pw) pw->pw_fields & _PWF_CHANGE ? chgstr : "", pw->pw_fields & _PWF_EXPIRE ? expstr : "", pw->pw_gecos, pw->pw_dir, pw->pw_shell); + } if (ferror(to)) err: pw_error(NULL, 1, 1); diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index 3b82bae11a69..c5a1e3bbba08 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -93,13 +93,14 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2) p1 += skip1 - off1; p2 += skip2 - off2; for (byte = line = 1; length--; ++p1, ++p2, ++byte) { - if ((ch = *p1) != *p2) + if ((ch = *p1) != *p2) { if (lflag) { dfound = 1; (void)printf("%6qd %3o %3o\n", byte, ch, *p2); } else diffmsg(file1, file2, byte, line); /* NOTREACHED */ + } if (ch == '\n') ++line; } diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index b843cc8fc9cc..a9033b363c86 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -73,13 +73,15 @@ c_special(fd1, file1, skip1, fd2, file2, skip2) ch2 = getc(fp2); if (ch1 == EOF || ch2 == EOF) break; - if (ch1 != ch2) + if (ch1 != ch2) { if (lflag) { dfound = 1; (void)printf("%6qd %3o %3o\n", byte, ch1, ch2); - } else + } else { diffmsg(file1, file2, byte, line); /* NOTREACHED */ + } + } if (ch1 == '\n') ++line; } diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c index e6dc44543580..c165177bf4ed 100644 --- a/usr.bin/colcrt/colcrt.c +++ b/usr.bin/colcrt/colcrt.c @@ -80,8 +80,8 @@ main(argc, argv) int argc; char *argv[]; { - register c; - register char *cp, *dp; + int c; + char *cp, *dp; argc--; argv++; diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c index 8085642ba57a..78cb6ae6980e 100644 --- a/usr.bin/gencat/gencat.c +++ b/usr.bin/gencat/gencat.c @@ -85,7 +85,7 @@ usage() exit(1); } -void main( +int main( #if ANSI_C || defined(__cplusplus) int argc, char *argv[]) #else @@ -155,6 +155,7 @@ char *argv[]; } else { usage(); } + return 0; } static void writeIfChanged( diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 535405af28bb..cf0edbef809d 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; #endif static const char rcsid[] = - "$Id: process.c,v 1.7 1998/04/29 21:58:36 ache Exp $"; + "$Id: process.c,v 1.8 1998/12/07 05:33:39 archie Exp $"; #endif /* not lint */ #include @@ -464,7 +464,7 @@ lputs(s) struct winsize win; static int termwidth = -1; - if (termwidth == -1) + if (termwidth == -1) { if ((p = getenv("COLUMNS"))) termwidth = atoi(p); else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 && @@ -472,6 +472,7 @@ lputs(s) termwidth = win.ws_col; else termwidth = 60; + } for (count = 0; *s; ++s) { if (count >= termwidth) { diff --git a/usr.bin/tn3270/tools/mkdctype/mkdctype.c b/usr.bin/tn3270/tools/mkdctype/mkdctype.c index 24ee0959581f..2e694866f43d 100644 --- a/usr.bin/tn3270/tools/mkdctype/mkdctype.c +++ b/usr.bin/tn3270/tools/mkdctype/mkdctype.c @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkdctype.c 8.1 (Berkeley) 6/6/93"; extern unsigned char ectype[256]; -void +int main() { static unsigned char dctype[192] = { 0 }; @@ -96,4 +96,5 @@ main() } printf(",\n"); } + return (0); }