Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src PR/45842: Henning Petersen: compare fgets with NULL not 0



details:   https://anonhg.NetBSD.org/src/rev/90c4ea43b028
branches:  trunk
changeset: 772788:90c4ea43b028
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 17:38:16 2012 +0000

description:
PR/45842: Henning Petersen: compare fgets with NULL not 0

diffstat:

 games/battlestar/getcom.c      |  6 +++---
 sbin/routed/parms.c            |  6 +++---
 usr.bin/mail/edit.c            |  6 +++---
 usr.bin/tftp/main.c            |  6 +++---
 usr.sbin/timed/timedc/timedc.c |  6 +++---
 5 files changed, 15 insertions(+), 15 deletions(-)

diffs (135 lines):

diff -r 0955b2800478 -r 90c4ea43b028 games/battlestar/getcom.c
--- a/games/battlestar/getcom.c Mon Jan 16 17:34:18 2012 +0000
+++ b/games/battlestar/getcom.c Mon Jan 16 17:38:16 2012 +0000
@@ -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 @@
 {
        for (;;) {
                fputs(prompt, stdout);
-               if (fgets(buf, size, stdin) == 0) {
+               if (fgets(buf, size, stdin) == NULL) {
                        if (feof(stdin))
                                die();
                        clearerr(stdin);
diff -r 0955b2800478 -r 90c4ea43b028 sbin/routed/parms.c
--- a/sbin/routed/parms.c       Mon Jan 16 17:34:18 2012 +0000
+++ b/sbin/routed/parms.c       Mon Jan 16 17:38:16 2012 +0000
@@ -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 @@
        }
 
        for (lnum = 1; ; lnum++) {
-               if (0 == fgets(lbuf, sizeof(lbuf), fp))
+               if (fgets(lbuf, sizeof(lbuf), fp) == NULL)
                        break;
                lptr = lbuf;
                while (*lptr == ' ')
diff -r 0955b2800478 -r 90c4ea43b028 usr.bin/mail/edit.c
--- a/usr.bin/mail/edit.c       Mon Jan 16 17:34:18 2012 +0000
+++ b/usr.bin/mail/edit.c       Mon Jan 16 17:38:16 2012 +0000
@@ -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 @@
                        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')
diff -r 0955b2800478 -r 90c4ea43b028 usr.bin/tftp/main.c
--- a/usr.bin/tftp/main.c       Mon Jan 16 17:34:18 2012 +0000
+++ b/usr.bin/tftp/main.c       Mon Jan 16 17:38:16 2012 +0000
@@ -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 @@
 #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 @@
 
        for (;;) {
                (void)printf("%s> ", prompt);
-               if (fgets(line, LBUFLEN, stdin) == 0) {
+               if (fgets(line, LBUFLEN, stdin) == NULL) {
                        if (feof(stdin)) {
                                exit(0);
                        } else {
diff -r 0955b2800478 -r 90c4ea43b028 usr.sbin/timed/timedc/timedc.c
--- a/usr.sbin/timed/timedc/timedc.c    Mon Jan 16 17:34:18 2012 +0000
+++ b/usr.sbin/timed/timedc/timedc.c    Mon Jan 16 17:38:16 2012 +0000
@@ -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 @@
 #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 @@
                        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;



Home | Main Index | Thread Index | Old Index