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
This commit is contained in:
Warner Losh 1999-04-25 22:37:58 +00:00
parent ebe70c8f68
commit 96846ff646
10 changed files with 23 additions and 16 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -80,8 +80,8 @@ main(argc, argv)
int argc;
char *argv[];
{
register c;
register char *cp, *dp;
int c;
char *cp, *dp;
argc--;
argv++;

View File

@ -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(

View File

@ -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 <sys/types.h>
@ -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) {

View File

@ -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);
}