Module Name: src
Committed By: christos
Date: Mon Jan 16 17:38:16 UTC 2012
Modified Files:
src/games/battlestar: getcom.c
src/sbin/routed: parms.c
src/usr.bin/mail: edit.c
src/usr.bin/tftp: main.c
src/usr.sbin/timed/timedc: timedc.c
Log Message:
PR/45842: Henning Petersen: compare fgets with NULL not 0
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/battlestar/getcom.c
cvs rdiff -u -r1.25 -r1.26 src/sbin/routed/parms.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/edit.c
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/tftp/main.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/timed/timedc/timedc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/games/battlestar/getcom.c
diff -u src/games/battlestar/getcom.c:1.13 src/games/battlestar/getcom.c:1.14
--- src/games/battlestar/getcom.c:1.13 Fri Jul 1 02:04:54 2005
+++ src/games/battlestar/getcom.c Mon Jan 16 12:38:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: getcom.c,v 1.13 2005/07/01 06:04:54 jmc Exp $ */
+/* $NetBSD: getcom.c,v 1.14 2012/01/16 17:38:16 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getcom.c,v 1.13 2005/07/01 06:04:54 jmc Exp $");
+__RCSID("$NetBSD: getcom.c,v 1.14 2012/01/16 17:38:16 christos Exp $");
#endif
#endif /* not lint */
@@ -45,7 +45,7 @@ getcom(char *buf, int size, const char *
{
for (;;) {
fputs(prompt, stdout);
- if (fgets(buf, size, stdin) == 0) {
+ if (fgets(buf, size, stdin) == NULL) {
if (feof(stdin))
die();
clearerr(stdin);
Index: src/sbin/routed/parms.c
diff -u src/sbin/routed/parms.c:1.25 src/sbin/routed/parms.c:1.26
--- src/sbin/routed/parms.c:1.25 Tue May 24 08:03:04 2011
+++ src/sbin/routed/parms.c Mon Jan 16 12:38:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: parms.c,v 1.25 2011/05/24 12:03:04 joerg Exp $ */
+/* $NetBSD: parms.c,v 1.26 2012/01/16 17:38:16 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#include <sys/stat.h>
#ifdef __NetBSD__
-__RCSID("$NetBSD: parms.c,v 1.25 2011/05/24 12:03:04 joerg Exp $");
+__RCSID("$NetBSD: parms.c,v 1.26 2012/01/16 17:38:16 christos Exp $");
#elif defined(__FreeBSD__)
__RCSID("$FreeBSD$");
#else
@@ -192,7 +192,7 @@ gwkludge(void)
}
for (lnum = 1; ; lnum++) {
- if (0 == fgets(lbuf, sizeof(lbuf), fp))
+ if (fgets(lbuf, sizeof(lbuf), fp) == NULL)
break;
lptr = lbuf;
while (*lptr == ' ')
Index: src/usr.bin/mail/edit.c
diff -u src/usr.bin/mail/edit.c:1.25 src/usr.bin/mail/edit.c:1.26
--- src/usr.bin/mail/edit.c:1.25 Fri Apr 10 09:08:24 2009
+++ src/usr.bin/mail/edit.c Mon Jan 16 12:38:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.c,v 1.25 2009/04/10 13:08:24 christos Exp $ */
+/* $NetBSD: edit.c,v 1.26 2012/01/16 17:38:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: edit.c,v 1.25 2009/04/10 13:08:24 christos Exp $");
+__RCSID("$NetBSD: edit.c,v 1.26 2012/01/16 17:38:16 christos Exp $");
#endif
#endif /* not lint */
@@ -172,7 +172,7 @@ edit1(int *msgvec, int editortype)
char *p;
(void)printf("Edit message %d [ynq]? ", msgvec[i]);
- if (fgets(buf, (int)sizeof(buf), stdin) == 0)
+ if (fgets(buf, (int)sizeof(buf), stdin) == NULL)
break;
p = skip_WSP(buf);
if (*p == 'q')
Index: src/usr.bin/tftp/main.c
diff -u src/usr.bin/tftp/main.c:1.29 src/usr.bin/tftp/main.c:1.30
--- src/usr.bin/tftp/main.c:1.29 Sat Sep 17 11:15:46 2011
+++ src/usr.bin/tftp/main.c Mon Jan 16 12:38:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2011/09/17 15:15:46 christos Exp $ */
+/* $NetBSD: main.c,v 1.30 2012/01/16 17:38:16 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: main.c,v 1.29 2011/09/17 15:15:46 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.30 2012/01/16 17:38:16 christos Exp $");
#endif
#endif /* not lint */
@@ -662,7 +662,7 @@ command(void)
for (;;) {
(void)printf("%s> ", prompt);
- if (fgets(line, LBUFLEN, stdin) == 0) {
+ if (fgets(line, LBUFLEN, stdin) == NULL) {
if (feof(stdin)) {
exit(0);
} else {
Index: src/usr.sbin/timed/timedc/timedc.c
diff -u src/usr.sbin/timed/timedc/timedc.c:1.21 src/usr.sbin/timed/timedc/timedc.c:1.22
--- src/usr.sbin/timed/timedc/timedc.c:1.21 Mon Jul 21 09:37:00 2008
+++ src/usr.sbin/timed/timedc/timedc.c Mon Jan 16 12:38:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: timedc.c,v 1.21 2008/07/21 13:37:00 lukem Exp $ */
+/* $NetBSD: timedc.c,v 1.22 2012/01/16 17:38:16 christos Exp $ */
/*-
* Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
#if 0
static char sccsid[] = "@(#)timedc.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: timedc.c,v 1.21 2008/07/21 13:37:00 lukem Exp $");
+__RCSID("$NetBSD: timedc.c,v 1.22 2012/01/16 17:38:16 christos Exp $");
#endif
#endif /* not lint */
@@ -105,7 +105,7 @@ main(int argc, char *argv[])
printf("timedc> ");
(void) fflush(stdout);
}
- if (fgets(cmdline, sizeof(cmdline), stdin) == 0)
+ if (fgets(cmdline, sizeof(cmdline), stdin) == NULL)
quit(0, NULL);
if (cmdline[0] == 0)
break;