Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Feb 1997 10:10:59 +0100 (CET)
From:      Arne Henrik Juul <arnej@imf.unit.no>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2752: NULL is used instead of 0 many places
Message-ID:  <199702170910.KAA09922@frida.imf.unit.no>
Resent-Message-ID: <199702170920.BAA03485@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2752
>Category:       bin
>Synopsis:       NULL is used instead of 0 many places
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 17 01:20:02 PST 1997
>Last-Modified:
>Originator:     Arne Henrik Juul
>Organization:
Norwegian University of Technology and Science
>Release:        FreeBSD 2.2-GAMMA i386
>Environment:

	Note that this was tested with a make world on 2.2-GAMMA, but the
	patches applies (with a little fuzz) to 3.0-current as well.  I
	can generate a clean set for 3.0-current on request.

>Description:

	Many places in the code NULL is used in integer context, where
	plain 0 should be used.  This happens to work because we #define
	NULL to 0, but is stylistically wrong and can cause problems
	for people trying to port bits of code to other environments.
	

>How-To-Repeat:

	#define NULL ((void *)0) in various include files and recompile
	the world.

>Fix:

	Appy following patch.  This changes NULL to 0 most places
	but to '\0' in character context, to be more stylistically
	correct.

Index: games/cribbage/io.c
===================================================================
RCS file: /usr/cvs/src/games/cribbage/io.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 io.c
--- io.c	1994/09/04 04:02:35	1.1.1.1
+++ io.c	1997/02/15 11:50:53
@@ -250,10 +250,10 @@
 	if (!(line = getline()))
 		goto gotit;
 	p = p1 = line;
-	while (*p1 != ' ' && *p1 != NULL)
+	while (*p1 != ' ' && *p1 != '\0')
 		++p1;
-	*p1++ = NULL;
-	if (*p == NULL)
+	*p1++ = '\0';
+	if (*p == '\0')
 		goto gotit;
 
 	/* IMPORTANT: no real card has 2 char first name */
@@ -289,17 +289,17 @@
 	if (rnk == EMPTY)
 		goto gotit;
 	p = p1;
-	while (*p1 != ' ' && *p1 != NULL)
+	while (*p1 != ' ' && *p1 != '\0')
 		++p1;
-	*p1++ = NULL;
-	if (*p == NULL)
+	*p1++ = '\0';
+	if (*p == '\0')
 		goto gotit;
 	if (!strcmp("OF", p)) {
 		p = p1;
-		while (*p1 != ' ' && *p1 != NULL)
+		while (*p1 != ' ' && *p1 != '\0')
 			++p1;
-		*p1++ = NULL;
-		if (*p == NULL)
+		*p1++ = '\0';
+		if (*p == '\0')
 			goto gotit;
 	}
 	sut = EMPTY;
@@ -348,7 +348,7 @@
 
 	for (sum = 0;;) {
 		msg(prompt);
-		if (!(p = getline()) || *p == NULL) {
+		if (!(p = getline()) || *p == '\0') {
 			msg(quiet ? "Not a number" :
 			    "That doesn't look like a number");
 			continue;
@@ -363,7 +363,7 @@
 				++p;
 			}
 
-		if (*p != ' ' && *p != '\t' && *p != NULL)
+		if (*p != ' ' && *p != '\t' && *p != '\0')
 			sum = lo - 1;
 		if (sum >= lo && sum <= hi)
 			break;
Index: games/cribbage/score.c
===================================================================
RCS file: /usr/cvs/src/games/cribbage/score.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 score.c
--- score.c	1994/09/04 04:02:35	1.1.1.1
+++ score.c	1997/02/15 11:51:08
@@ -115,7 +115,7 @@
 	CARD h[(CINHAND + 1)];
 	char buf[32];
 
-	expl[0] = NULL;		/* initialize explanation */
+	expl[0] = '\0';		/* initialize explanation */
 	score = 0;
 	flag = TRUE;
 	k = hand[0].suit;
@@ -131,7 +131,7 @@
 	}
 
 	if (flag && n >= CINHAND) {
-		if (do_explain && expl[0] != NULL)
+		if (do_explain && expl[0] != '\0')
 			strcat(expl, ", ");
 		if (starter.suit == k) {
 			score += 5;
@@ -140,13 +140,13 @@
 		} else
 			if (!crb) {
 				score += 4;
-				if (do_explain && expl[0] != NULL)
+				if (do_explain && expl[0] != '\0')
 					strcat(expl, ", Four-flush");
 				else
 					strcpy(expl, "Four-flush");
 			}
 	}
-	if (do_explain && expl[0] != NULL)
+	if (do_explain && expl[0] != '\0')
 		strcat(expl, ", ");
 	h[n] = starter;
 	sorthand(h, n + 1);	/* sort by rank */
Index: games/rogue/inventory.c
===================================================================
RCS file: /usr/cvs/src/games/rogue/inventory.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 inventory.c
--- inventory.c	1994/09/04 04:03:13	1.1.1.1
+++ inventory.c	1997/02/15 11:44:39
@@ -176,9 +176,9 @@
 	'b',	"b       down & left",
 	'c',	"c       call object",
 	'n',	"n       down & right",
-	NULL,	"<SHIFT><dir>: run that way",
+	'\0',	"<SHIFT><dir>: run that way",
 	')',	")       print current weapon",
-	NULL,	"<CTRL><dir>: run till adjacent",
+	'\0',	"<CTRL><dir>: run till adjacent",
 	']',	"]       print current armor",
 	'f',	"f<dir>  fight till death or near death",
 	'=',	"=       print current rings",
Index: gnu/usr.bin/as/config/atof-ieee.c
===================================================================
RCS file: /usr/cvs/src/gnu/usr.bin/as/config/atof-ieee.c,v
retrieving revision 1.5
diff -u -r1.5 atof-ieee.c
--- atof-ieee.c	1996/10/01 00:12:30	1.5
+++ atof-ieee.c	1997/02/15 09:11:03
@@ -174,7 +174,7 @@
 	generic_floating_point_number.low	= bits + MAX_PRECISION;
 	generic_floating_point_number.high	= NULL;
 	generic_floating_point_number.leader	= NULL;
-	generic_floating_point_number.exponent	= NULL;
+	generic_floating_point_number.exponent	= 0;
 	generic_floating_point_number.sign	= '\0';
 
 	/* Use more LittleNums than seems */
Index: gnu/usr.bin/ld/rtld/rtld.c
===================================================================
RCS file: /usr/cvs/src/gnu/usr.bin/ld/rtld/rtld.c,v
retrieving revision 1.40.2.1
diff -u -r1.40.2.1 rtld.c
--- rtld.c	1997/01/20 19:37:13	1.40.2.1
+++ rtld.c	1997/02/15 08:58:47
@@ -2007,7 +2007,7 @@
 	L("LD_TRACE_LOADED_OBJECTS=",	0, &ld_tracing)
 	L("LD_SUPPRESS_WARNINGS=",	0, &ld_suppress_warnings)
 	L("LD_WARN_NON_PURE_CODE=",	0, &ld_warn_non_pure_code)
-	{ NULL, 0, NULL }
+	{ NULL, 0, 0, NULL }
 };
 #undef L
 
Index: gnu/usr.bin/man/man/man.c
===================================================================
RCS file: /usr/cvs/src/gnu/usr.bin/man/man/man.c,v
retrieving revision 1.21.2.3
diff -u -r1.21.2.3 man.c
--- man.c	1997/01/12 21:54:27	1.21.2.3
+++ man.c	1997/02/16 17:06:50
@@ -468,7 +468,7 @@
   register char **vs;
 
   for (vs = section_list; *vs != NULL; vs++)
-    if ((strcmp (*vs, name) == NULL)
+    if ((strcmp (*vs, name) == 0)
 	|| (isdigit (name[0]) && strlen(name) == 1))
       return strdup (name);
 
@@ -557,7 +557,7 @@
   t1 = strrchr (to_name, '/');
   if (t1 != NULL)
     {
-      *t1 = NULL;
+      *t1 = '\0';
       t2 = strrchr (to_name, '/');
       *t1 = '/';
     }
Index: lib/libc/db/btree/bt_seq.c
===================================================================
RCS file: /usr/cvs/src/lib/libc/db/btree/bt_seq.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 bt_seq.c
--- bt_seq.c	1996/02/27 01:58:41	1.1.1.2
+++ bt_seq.c	1997/02/15 10:00:54
@@ -358,7 +358,7 @@
 	 * page) and return it.
 	 */
 	if ((ep = __bt_search(t, key, exactp)) == NULL)
-		return (NULL);
+		return (0);
 	if (*exactp) {
 		if (F_ISSET(t, B_NODUPS)) {
 			*erval = *ep;
Index: lib/libc/gen/getcap.c
===================================================================
RCS file: /usr/cvs/src/lib/libc/gen/getcap.c,v
retrieving revision 1.4
diff -u -r1.4 getcap.c
--- getcap.c	1995/10/22 14:36:15	1.4
+++ getcap.c	1997/02/15 10:01:16
@@ -735,7 +735,7 @@
 			}
 		}
 		rp = buf;
-		for(cp = nbuf; *cp != NULL; cp++)
+		for(cp = nbuf; *cp != '\0'; cp++)
 			if (*cp == '|' || *cp == ':')
 				break;
 			else
Index: lib/libc/gen/getpwent.c
===================================================================
RCS file: /usr/cvs/src/lib/libc/gen/getpwent.c,v
retrieving revision 1.35.2.1
diff -u -r1.35.2.1 getpwent.c
--- getpwent.c	1996/12/31 17:42:32	1.35.2.1
+++ getpwent.c	1997/02/15 10:05:11
@@ -417,7 +417,7 @@
 				latch++;
 			}
 again:
-			if (getnetgrent(&host, &user, &domain) == NULL) {
+			if (getnetgrent(&host, &user, &domain) == 0) {
 				if ((gr = getgrnam(grp+2)) != NULL)
 					goto grpagain;
 				latch = 0;
@@ -441,7 +441,7 @@
 		if (grp[1] == '@') {
 			setnetgrent(grp+2);
 			rv = 0;
-			while(getnetgrent(&host, &user, &domain) != NULL) {
+			while(getnetgrent(&host, &user, &domain) != 0) {
 				store(user);
 				rv++;
 			}
Index: lib/libftpio/ftpio.c
===================================================================
RCS file: /usr/cvs/src/lib/libftpio/ftpio.c,v
retrieving revision 1.15.2.2
diff -u -r1.15.2.2 ftpio.c
--- ftpio.c	1996/12/17 20:28:06	1.15.2.2
+++ ftpio.c	1997/02/15 10:27:19
@@ -399,7 +399,7 @@
 
     name = host = NULL;
     /* XXX add http:// here or somewhere reasonable at some point XXX */
-    if (strncmp("ftp://", url_in, 6) != NULL)
+    if (strncmp("ftp://", url_in, 6) != 0)
 	return FAILURE;
     /* We like to stomp a lot on the URL string in dissecting it, so copy it first */
     strncpy(url, url_in, BUFSIZ);
Index: libexec/ftpd/ftpcmd.y
===================================================================
RCS file: /usr/cvs/src/libexec/ftpd/ftpcmd.y,v
retrieving revision 1.8
diff -u -r1.8 ftpcmd.y
--- ftpcmd.y	1996/09/22 21:53:23	1.8
+++ ftpcmd.y	1997/02/16 17:07:06
@@ -956,7 +956,7 @@
 			}
 			(void) alarm(0);
 #ifdef SETPROCTITLE
-			if (strncasecmp(cbuf, "PASS", 4) != NULL)
+			if (strncasecmp(cbuf, "PASS", 4) != 0)
 				setproctitle("%s: %s", proctitle, cbuf);
 #endif /* SETPROCTITLE */
 			if ((cp = strchr(cbuf, '\r'))) {
Index: libexec/lfs_cleanerd/library.c
===================================================================
RCS file: /usr/cvs/src/libexec/lfs_cleanerd/library.c,v
retrieving revision 1.4
diff -u -r1.4 library.c
--- library.c	1996/09/22 21:53:52	1.4
+++ library.c	1997/02/16 17:08:25
@@ -544,7 +544,7 @@
 		    0, fid, seg_byte);
 		if (*(long *)segbuf < 0) {
 			err(0, "mmap_segment: mmap failed");
-			return (NULL);
+			return (0);
 		}
 	} else {
 #ifdef VERBOSE
@@ -555,7 +555,7 @@
 		*segbuf = malloc(ssize);
 		if (!*segbuf) {
 			err(0, "mmap_segment: malloc failed");
-			return(NULL);
+			return(0);
 		}
 
 		/* read the segment data into the buffer */
Index: libexec/revnetgroup/revnetgroup.c
===================================================================
RCS file: /usr/cvs/src/libexec/revnetgroup/revnetgroup.c,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 revnetgroup.c
--- revnetgroup.c	1996/12/22 15:13:03	1.3.2.1
+++ revnetgroup.c	1997/02/16 17:08:34
@@ -150,7 +150,7 @@
 		gcur = gtable[i];
 		while(gcur) {
 			__setnetgrent(gcur->key);
-			while(__getnetgrent(&host, &user, &domain) != NULL) {
+			while(__getnetgrent(&host, &user, &domain) != 0) {
 				if (hosts ? host && strcmp(host,"-") : user && strcmp(user, "-"))
 					mstore(mtable, hosts ? host : user, gcur->key, domain);
 			}
Index: sbin/dset/dset.c
===================================================================
RCS file: /usr/cvs/src/sbin/dset/dset.c,v
retrieving revision 1.7
diff -u -r1.7 dset.c
--- dset.c	1996/10/02 07:22:26	1.7
+++ dset.c	1997/02/16 17:13:55
@@ -188,7 +188,7 @@
 			fatal("kvmread", NULL);
 		dev_found = 0;
 
-		while(pos_t!=NULL) {
+		while(pos_t!=0) {
 			if (kvm_read(kd, pos_t, &buf1, sizeof(struct isa_device)) < 0)
 				fatal("kvmread", NULL);
 
Index: sbin/i386/ft/ft.c
===================================================================
RCS file: /usr/cvs/src/sbin/i386/ft/ft.c,v
retrieving revision 1.3
diff -u -r1.3 ft.c
--- ft.c	1995/05/30 06:09:13	1.3
+++ ft.c	1997/02/16 17:17:38
@@ -53,7 +53,7 @@
 int tvno = 1;				/* tape volume number */
 int tvlast;				/* TRUE if last volume in set */
 long tvsize = 0;			/* tape volume size in bytes */
-long tvtime = NULL;			/* tape change time */
+long tvtime = 0;			/* tape change time */
 char *tvnote = "";			/* tape note */
 int doretension = 0;			/* TRUE if we should retension tape */
 
Index: sbin/ifconfig/ifconfig.c
===================================================================
RCS file: /usr/cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.19
diff -u -r1.19 ifconfig.c
--- ifconfig.c	1996/09/04 19:41:31	1.19
+++ ifconfig.c	1997/02/16 17:15:35
@@ -471,7 +471,7 @@
 		if (rafp->af_ridreq == NULL || rafp->af_difaddr == 0) {
 			warnx("interface %s cannot change %s addresses!",
 			      name, rafp->af_name);
-			clearaddr = NULL;
+			clearaddr = 0;
 		}
 	}
 	if (clearaddr) {
@@ -488,7 +488,7 @@
 		if (rafp->af_ridreq == NULL || rafp->af_difaddr == 0) {
 			warnx("interface %s cannot change %s addresses!",
 			      name, rafp->af_name);
-			newaddr = NULL;
+			newaddr = 0;
 		}
 	}
 	if (newaddr) {
Index: sbin/mount/mount.c
===================================================================
RCS file: /usr/cvs/src/sbin/mount/mount.c,v
retrieving revision 1.15
diff -u -r1.15 mount.c
--- mount.c	1996/09/03 07:13:56	1.15
+++ mount.c	1997/02/16 17:16:01
@@ -97,7 +97,7 @@
 	{ MNT_SYNCHRONOUS,	"synchronous" },
 	{ MNT_UNION,		"union" },
 	{ MNT_USER,		"user mount" },
-	{ NULL }
+	{ 0, NULL }
 };
 
 int
Index: sbin/restore/dirs.c
===================================================================
RCS file: /usr/cvs/src/sbin/restore/dirs.c,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 dirs.c
--- dirs.c	1997/01/01 00:05:17	1.6.2.1
+++ dirs.c	1997/02/16 17:16:45
@@ -306,7 +306,7 @@
 	while (*path == '/')
 		path++;
 	dp = NULL;
-	while ((name = strsep(&path, "/")) != NULL && *name != NULL) {
+	while ((name = strsep(&path, "/")) != NULL && *name != '\0') {
 		if ((dp = searchdir(ino, name)) == NULL)
 			return (NULL);
 		ino = dp->d_ino;
Index: sbin/restore/restore.c
===================================================================
RCS file: /usr/cvs/src/sbin/restore/restore.c,v
retrieving revision 1.2
diff -u -r1.2 restore.c
--- restore.c	1995/05/30 06:09:50	1.2
+++ restore.c	1997/02/16 17:16:08
@@ -781,7 +781,7 @@
 			ep->e_flags &= ~KEEP;
 			if (ep->e_type == NODE)
 				ep->e_flags &= ~(NEW|EXISTED);
-			if (ep->e_flags != NULL)
+			if (ep->e_flags != 0)
 				badentry(ep, "incomplete operations");
 		}
 	}
Index: sbin/umount/umount.c
===================================================================
RCS file: /usr/cvs/src/sbin/umount/umount.c,v
retrieving revision 1.4
diff -u -r1.4 umount.c
--- umount.c	1995/05/30 06:10:04	1.4
+++ umount.c	1997/02/16 17:17:25
@@ -342,7 +342,7 @@
 		which = IN_LIST;
 
 	/* Count the number of types. */
-	for (i = 0, nextcp = fslist; *nextcp != NULL; ++nextcp)
+	for (i = 0, nextcp = fslist; *nextcp != '\0'; ++nextcp)
 		if (*nextcp == ',')
 			i++;
 
Index: usr.bin/calendar/day.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/calendar/day.c,v
retrieving revision 1.6.4.1
diff -u -r1.6.4.1 day.c
--- day.c	1997/02/06 05:49:56	1.6.4.1
+++ day.c	1997/02/16 17:22:43
@@ -182,12 +182,12 @@
 
 
     /* day */
-    *(date+2) = NULL;
+    *(date+2) = '\0';
     tm.tm_mday = atoi(date);
 
     /* month */
     if (len >= 4) {
-	*(date+5) = NULL;
+	*(date+5) = '\0';
 	tm.tm_mon = atoi(date+3) - 1;
     }
 
Index: usr.bin/error/touch.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/error/touch.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 touch.c
--- touch.c	1994/05/27 12:31:06	1.1.1.1
+++ touch.c	1997/02/16 17:23:09
@@ -589,7 +589,7 @@
 
 	botch = 0;
 	oktorm = 1;
-	while((nread = fread(edbuf, 1, sizeof(edbuf), o_touchedfile)) != NULL){
+	while((nread = fread(edbuf, 1, sizeof(edbuf), o_touchedfile)) != 0) {
 		if (nread != fwrite(edbuf, 1, nread, n_touchedfile)){
 			/*
 			 *	Catastrophe in temporary area: file system full?
@@ -649,7 +649,7 @@
 {
 	int	nread;
 
-	while((nread = fread(edbuf, 1, sizeof(edbuf), tmpfile)) != NULL){
+	while((nread = fread(edbuf, 1, sizeof(edbuf), tmpfile)) != 0) {
 		if (mustwrite(edbuf, nread, preciousfile) == 0)
 			return(0);
 	}
Index: usr.bin/finger/finger.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/finger/finger.c,v
retrieving revision 1.9
diff -u -r1.9 finger.c
--- finger.c	1996/03/15 16:41:48	1.9
+++ finger.c	1997/02/16 17:23:33
@@ -200,7 +200,7 @@
 
 	if (!freopen(_PATH_UTMP, "r", stdin))
 		err("%s: %s", _PATH_UTMP, strerror(errno));
-	name[UT_NAMESIZE] = NULL;
+	name[UT_NAMESIZE] = '\0';
 	while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
 		if (!user.ut_name[0])
 			continue;
Index: usr.bin/finger/net.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/finger/net.c,v
retrieving revision 1.6
diff -u -r1.6 net.c
--- net.c	1996/03/15 16:41:49	1.6
+++ net.c	1997/02/16 17:23:39
@@ -72,7 +72,7 @@
 
 	if (!(host = rindex(name, '@')))
 		return;
-	*host++ = NULL;
+	*host++ = '\0';
 	if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
 		def.h_name = host;
 		def.h_addr_list = alist;
Index: usr.bin/finger/util.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/finger/util.c,v
retrieving revision 1.3
diff -u -r1.3 util.c
--- util.c	1995/01/04 01:02:43	1.3
+++ util.c	1997/02/16 17:23:51
@@ -113,7 +113,7 @@
 	    (long)pn->uid * sizeof(ll) ||
 	    read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
 			/* as if never logged in */
-			ll.ll_line[0] = ll.ll_host[0] = NULL;
+			ll.ll_line[0] = ll.ll_host[0] = '\0';
 			ll.ll_time = 0;
 		}
 	if ((w = pn->whead) == NULL)
Index: usr.bin/ftp/cmds.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/ftp/cmds.c,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 cmds.c
--- cmds.c	1996/12/17 19:30:37	1.5.2.1
+++ cmds.c	1997/02/16 17:24:18
@@ -477,7 +477,7 @@
 					if (!*tp) {
 						tp = cp;
 						tp2 = tmpbuf;
-						while ((*tp2 = *tp) != NULL) {
+						while ((*tp2 = *tp) != '\0') {
 						     if (isupper(*tp2)) {
 						        *tp2 = 'a' + *tp2 - 'A';
 						     }
@@ -620,7 +620,7 @@
 		if (!*tp) {
 			tp = argv[2];
 			tp2 = tmpbuf;
-			while ((*tp2 = *tp) != NULL) {
+			while ((*tp2 = *tp) != '\0') {
 				if (isupper(*tp2)) {
 					*tp2 = 'a' + *tp2 - 'A';
 				}
Index: usr.bin/lock/lock.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/lock/lock.c,v
retrieving revision 1.2
diff -u -r1.2 lock.c
--- lock.c	1996/09/14 09:00:52	1.2
+++ lock.c	1997/02/16 17:24:27
@@ -162,7 +162,7 @@
 			ioctl(0, TIOCSETP, &tty);
 			exit(1);
 		}
-		s[0] = NULL;
+		s[0] = '\0';
 		mypw = s1;
 	}
 
Index: usr.bin/mail/cmd1.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mail/cmd1.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cmd1.c
--- cmd1.c	1994/05/27 12:32:05	1.1.1.1
+++ cmd1.c	1997/02/16 17:24:36
@@ -152,7 +152,7 @@
 {
 	register int *ip;
 
-	for (ip = msgvec; *ip != NULL; ip++)
+	for (ip = msgvec; *ip != 0; ip++)
 		printhead(*ip);
 	if (--ip >= msgvec)
 		dot = &message[*ip - 1];
Index: usr.bin/mail/cmd2.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mail/cmd2.c,v
retrieving revision 1.2
diff -u -r1.2 cmd2.c
--- cmd2.c	1995/05/30 06:31:39	1.2
+++ cmd2.c	1997/02/16 17:26:14
@@ -58,7 +58,7 @@
 	register int *ip, *ip2;
 	int list[2], mdot;
 
-	if (*msgvec != NULL) {
+	if (*msgvec != 0) {
 
 		/*
 		 * If some messages were supplied, find the
@@ -73,10 +73,10 @@
 		 * message list which follows dot.
 		 */
 
-		for (ip = msgvec; *ip != NULL; ip++)
+		for (ip = msgvec; *ip != 0; ip++)
 			if (*ip > mdot)
 				break;
-		if (*ip == NULL)
+		if (*ip == 0)
 			ip = msgvec;
 		ip2 = ip;
 		do {
@@ -85,9 +85,9 @@
 				dot = mp;
 				goto hitit;
 			}
-			if (*ip2 != NULL)
+			if (*ip2 != 0)
 				ip2++;
-			if (*ip2 == NULL)
+			if (*ip2 == 0)
 				ip2 = msgvec;
 		} while (ip2 != ip);
 		printf("No messages applicable\n");
@@ -121,7 +121,7 @@
 	 */
 
 	list[0] = dot - &message[0] + 1;
-	list[1] = NULL;
+	list[1] = 0;
 	return(type(list));
 }
 
@@ -170,11 +170,11 @@
 		return(1);
 	if (!f) {
 		*msgvec = first(0, MMNORM);
-		if (*msgvec == NULL) {
+		if (*msgvec == 0) {
 			printf("No messages to %s.\n", cmd);
 			return(1);
 		}
-		msgvec[1] = NULL;
+		msgvec[1] = 0;
 	}
 	if (f && getmsglist(str, msgvec, 0) < 0)
 		return(1);
@@ -291,7 +291,7 @@
 		list[0] = dot - &message[0] + 1;
 		if (list[0] > lastdot) {
 			touch(dot);
-			list[1] = NULL;
+			list[1] = 0;
 			return(type(list));
 		}
 		printf("At EOF\n");
@@ -313,18 +313,18 @@
 	register *ip;
 	int last;
 
-	last = NULL;
-	for (ip = msgvec; *ip != NULL; ip++) {
+	last = 0;
+	for (ip = msgvec; *ip != 0; ip++) {
 		mp = &message[*ip - 1];
 		touch(mp);
 		mp->m_flag |= MDELETED|MTOUCH;
 		mp->m_flag &= ~(MPRESERVE|MSAVED|MBOX);
 		last = *ip;
 	}
-	if (last != NULL) {
+	if (last != 0) {
 		dot = &message[last-1];
 		last = first(0, MDELETED);
-		if (last != NULL) {
+		if (last != 0) {
 			dot = &message[last-1];
 			return(0);
 		}
Index: usr.bin/mail/cmd3.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mail/cmd3.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cmd3.c
--- cmd3.c	1994/05/27 12:32:06	1.1.1.1
+++ cmd3.c	1997/02/16 17:26:33
@@ -293,7 +293,7 @@
 		printf("Cannot \"preserve\" in edit mode\n");
 		return(1);
 	}
-	for (ip = msgvec; *ip != NULL; ip++) {
+	for (ip = msgvec; *ip != 0; ip++) {
 		mesg = *ip;
 		mp = &message[mesg-1];
 		mp->m_flag |= MPRESERVE;
@@ -312,7 +312,7 @@
 {
 	register int *ip;
 
-	for (ip = msgvec; *ip != NULL; ip++) {
+	for (ip = msgvec; *ip != 0; ip++) {
 		dot = &message[*ip-1];
 		dot->m_flag &= ~(MREAD|MTOUCH);
 		dot->m_flag |= MSTATUS;
@@ -330,7 +330,7 @@
 	register struct message *mp;
 	register int *ip, mesg;
 
-	for (ip = msgvec; *ip != NULL; ip++) {
+	for (ip = msgvec; *ip != 0; ip++) {
 		mesg = *ip;
 		mp = &message[mesg-1];
 		printf("%d: %d/%ld\n", mesg, mp->m_lines, mp->m_size);
Index: usr.bin/mail/collect.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mail/collect.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 collect.c
--- collect.c	1994/05/27 12:32:06	1.1.1.1
+++ collect.c	1997/02/16 17:26:49
@@ -523,11 +523,11 @@
 		return(0);
 	if (*msgvec == 0) {
 		*msgvec = first(0, MMNORM);
-		if (*msgvec == NULL) {
+		if (*msgvec == 0) {
 			printf("No appropriate messages\n");
 			return(0);
 		}
-		msgvec[1] = NULL;
+		msgvec[1] = 0;
 	}
 	if (f == 'f' || f == 'F')
 		tabst = NOSTR;
Index: usr.bin/mail/lex.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mail/lex.c,v
retrieving revision 1.2
diff -u -r1.2 lex.c
--- lex.c	1995/08/15 19:40:24	1.2
+++ lex.c	1997/02/16 17:27:03
@@ -342,9 +342,9 @@
 		if (c  == 0) {
 			*msgvec = first(com->c_msgflag,
 				com->c_msgmask);
-			msgvec[1] = NULL;
+			msgvec[1] = 0;
 		}
-		if (*msgvec == NULL) {
+		if (*msgvec == 0) {
 			printf("No applicable messages\n");
 			break;
 		}
Index: usr.bin/mkstr/mkstr.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/mkstr/mkstr.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mkstr.c
--- mkstr.c	1994/05/27 12:32:23	1.1.1.1
+++ mkstr.c	1997/02/16 18:33:38
@@ -231,7 +231,7 @@
 	int mesgpt = 0;
 
 	rewind(mesgread);
-	while (fgetNUL(buf, sizeof buf, mesgread) != NULL) {
+	while (fgetNUL(buf, sizeof buf, mesgread) != 0) {
 		hashit(buf, 0, mesgpt);
 		mesgpt += strlen(buf) + 2;
 	}
@@ -306,5 +306,5 @@
 		*buf++ = c;
 	*buf++ = 0;
 	getc(file);
-	return ((feof(file) || ferror(file)) ? NULL : 1);
+	return ((feof(file) || ferror(file)) ? 0 : 1);
 }
Index: usr.bin/tip/libacu/multitech.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/tip/libacu/multitech.c,v
retrieving revision 1.3
diff -u -r1.3 multitech.c
--- multitech.c	1995/05/30 06:34:59	1.3
+++ multitech.c	1997/02/16 17:28:49
@@ -91,7 +91,7 @@
 	if (lock_baud)
 	{
 		int i;
-		if ((i = speed(number(value(BAUDRATE)))) == NULL)
+		if ((i = speed(number(value(BAUDRATE)))) == 0)
 			return 0;
 		ttysetup (i);
 	}
Index: usr.bin/tip/libacu/unidialer.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/tip/libacu/unidialer.c,v
retrieving revision 1.4
diff -u -r1.4 unidialer.c
--- unidialer.c	1996/03/05 19:11:49	1.4
+++ unidialer.c	1997/02/16 17:29:09
@@ -416,7 +416,7 @@
 
 	if (lock_baud) {
 		int i;
-		if ((i = speed(number(value(BAUDRATE)))) == NULL)
+		if ((i = speed(number(value(BAUDRATE)))) == 0)
 			return 0;
 		ttysetup (i);
 	}
Index: usr.bin/tip/tip/tip.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/tip/tip/tip.c,v
retrieving revision 1.2
diff -u -r1.2 tip.c
--- tip.c	1995/11/26 21:08:36	1.2
+++ tip.c	1997/02/16 17:29:15
@@ -177,7 +177,7 @@
 		PH = _PATH_PHONES;
 	vinit();				/* init variables */
 	setparity("even");			/* set the parity table */
-	if ((i = speed(number(value(BAUDRATE)))) == NULL) {
+	if ((i = speed(number(value(BAUDRATE)))) == 0) {
 		printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));
 		(void)uu_unlock(uucplock);
 		exit(3);
Index: usr.bin/tip/tip/vars.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/tip/tip/vars.c,v
retrieving revision 1.1
diff -u -r1.1 vars.c
--- vars.c	1995/03/31 11:47:39	1.1
+++ vars.c	1997/02/16 17:29:52
@@ -113,5 +113,5 @@
 	  "le",		(char *)FALSE },
 	{ "parity",	STRING|INIT|IREMOTE,	(READ|WRITE)<<PUBLIC,
 	  "par",	(char *)&PA },
-	{ NOSTR, NULL, NULL, NOSTR, NOSTR }
+	{ NOSTR, 0, 0, NOSTR, NOSTR }
 };
Index: usr.bin/tset/map.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/tset/map.c,v
retrieving revision 1.3
diff -u -r1.3 map.c
--- map.c	1995/08/04 06:44:53	1.3
+++ map.c	1997/02/16 17:30:09
@@ -138,7 +138,7 @@
 		mapp->speed = baudrate(p);
 	}
 
-	if (*arg == NULL)			/* Non-optional type. */
+	if (*arg == '\0')			/* Non-optional type. */
 		goto badmopt;
 
 	mapp->type = arg;
Index: usr.bin/uudecode/uudecode.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/uudecode/uudecode.c,v
retrieving revision 1.4
diff -u -r1.4 uudecode.c
--- uudecode.c	1996/10/21 22:02:24	1.4
+++ uudecode.c	1997/02/16 17:30:18
@@ -157,7 +157,7 @@
 			    filename);
 			return(1);
 		}
-		*p++ = NULL;
+		*p++ = '\0';
 		if (!(pw = getpwnam(buf + 1))) {
 			(void)fprintf(stderr, "uudecode: %s: no user %s.\n",
 			    filename, buf);
Index: usr.bin/vacation/vacation.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/vacation/vacation.c,v
retrieving revision 1.3
diff -u -r1.3 vacation.c
--- vacation.c	1996/09/28 13:37:38	1.3
+++ vacation.c	1997/02/16 17:30:28
@@ -297,7 +297,7 @@
 	} ignore[] = {
 		{"-request", 8},	{"postmaster", 10},	{"uucp", 4},
 		{"mailer-daemon", 13},	{"mailer", 6},		{"-relay", 6},
-		{NULL, NULL},
+		{NULL, 0},
 	};
 	register struct ignore *cur;
 	register int len;
Index: usr.bin/vgrind/vfontedpr.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/vgrind/vfontedpr.c,v
retrieving revision 1.6
diff -u -r1.6 vfontedpr.c
--- vfontedpr.c	1996/10/22 16:18:17	1.6
+++ vfontedpr.c	1997/02/16 17:32:14
@@ -245,7 +245,7 @@
 	    cpp = l_keywds;
 	    while (*cp) {
 		while (*cp == ' ' || *cp =='\t')
-		    *cp++ = NULL;
+		    *cp++ = '\0';
 		if (*cp)
 		    *cpp++ = cp;
 		while (*cp != ' ' && *cp  != '\t' && *cp)
@@ -289,7 +289,7 @@
 	_escaped = FALSE;
 	blklevel = 0;
 	for (psptr=0; psptr<PSMAX; psptr++) {
-	    pstack[psptr][0] = NULL;
+	    pstack[psptr][0] = '\0';
 	    plstack[psptr] = 0;
 	}
 	psptr = -1;
@@ -374,7 +374,7 @@
 	if (psptr < PSMAX) {
 	    ++psptr;
 	    strncpy (pstack[psptr], pname, PNAMELEN);
-	    pstack[psptr][PNAMELEN] = NULL;
+	    pstack[psptr][PNAMELEN] = '\0';
 	    plstack[psptr] = blklevel;
 	}
     }
@@ -694,7 +694,7 @@
 isproc(s)
     char *s;
 {
-    pname[0] = NULL;
+    pname[0] = '\0';
     if (!l_toplex || blklevel == 0)
 	if (expmatch (s, l_prcbeg, pname) != NIL) {
 	    return (TRUE);
Index: usr.bin/xstr/xstr.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/xstr/xstr.c,v
retrieving revision 1.2
diff -u -r1.2 xstr.c
--- xstr.c	1995/05/30 06:36:25	1.2
+++ xstr.c	1997/02/16 17:33:54
@@ -273,7 +273,7 @@
 		return;
 	for (;;) {
 		mesgpt = tellpt;
-		if (fgetNUL(buf, sizeof buf, mesgread) == NULL)
+		if (fgetNUL(buf, sizeof buf, mesgread) == 0)
 			break;
 		ignore(hashit(buf, 0));
 	}
@@ -291,7 +291,7 @@
 	while (--rmdr > 0 && (c = xgetc(file)) != 0 && c != EOF)
 		*buf++ = c;
 	*buf++ = 0;
-	return ((feof(file) || ferror(file)) ? NULL : 1);
+	return ((feof(file) || ferror(file)) ? 0 : 1);
 }
 
 xgetc(file)
Index: usr.sbin/pkg_install/add/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/add/main.c,v
retrieving revision 1.11
diff -u -r1.11 main.c
--- main.c	1996/07/30 10:48:09	1.11
+++ main.c	1997/02/16 17:37:34
@@ -133,7 +133,7 @@
 	usage(prog_name, "Missing package name(s)");
     else if (ch > 1 && AddMode == MASTER)
 	usage(prog_name, "Only one package name may be specified with master mode");
-    if ((err = pkg_perform(pkgs)) != NULL) {
+    if ((err = pkg_perform(pkgs)) != 0) {
 	if (Verbose)
 	    fprintf(stderr, "%d package addition(s) failed.\n", err);
 	return err;
Index: usr.sbin/pkg_install/delete/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/delete/main.c,v
retrieving revision 1.6
diff -u -r1.6 main.c
--- main.c	1996/07/30 10:48:15	1.6
+++ main.c	1997/02/16 17:39:03
@@ -89,7 +89,7 @@
     *pkgs = NULL;
     if (!Fake && getuid() != 0)
 	errx(1, "You must be root to delete packages.");
-    if ((error = pkg_perform(start)) != NULL) {
+    if ((error = pkg_perform(start)) != 0) {
 	if (Verbose)
 	    fprintf(stderr, "%d package deletion(s) failed.\n", error);
 	return error;
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702170910.KAA09922>