diff --git a/bin/date/netdate.c b/bin/date/netdate.c
index c4f01c4..f5e6163 100644
--- a/bin/date/netdate.c
+++ b/bin/date/netdate.c
@@ -137,7 +137,7 @@ loop:
 
 	FD_ZERO(&ready);
 	FD_SET(s, &ready);
-	found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout);
+	found = select(FD_SETSIZE, &ready, NULL, NULL, &tout);
 
 	length = sizeof(errn);
 	if (!getsockopt(s,
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index 9776879..6420901 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -328,10 +328,10 @@ static const struct limits limits[] = {
 	{ "locked memory",	"kbytes",	RLIMIT_MEMLOCK, 1024, 'l' },
 #endif
 #ifdef RLIMIT_NPROC
-	{ "max user processes",	(char *)0,	RLIMIT_NPROC,      1, 'u' },
+	{ "max user processes",	NULL,		RLIMIT_NPROC,      1, 'u' },
 #endif
 #ifdef RLIMIT_NOFILE
-	{ "open files",		(char *)0,	RLIMIT_NOFILE,     1, 'n' },
+	{ "open files",		NULL,		RLIMIT_NOFILE,     1, 'n' },
 #endif
 #ifdef RLIMIT_VMEM
 	{ "virtual mem size",	"kbytes",	RLIMIT_VMEM,	1024, 'v' },
@@ -343,9 +343,9 @@ static const struct limits limits[] = {
 	{ "sbsize",		"bytes",	RLIMIT_SBSIZE,	   1, 'b' },
 #endif
 #ifdef RLIMIT_POSIXLOCK
-	{ "posixlocks",		(char *)0,	RLIMIT_POSIXLOCK,  1, 'k' },
+	{ "posixlocks",		NULL,		RLIMIT_POSIXLOCK,  1, 'k' },
 #endif
-	{ (char *) 0,		(char *)0,	0,		   0, '\0' }
+	{ NULL,			NULL,		0,		   0, '\0' }
 };
 
 int
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index a767e9d..9744732 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -319,7 +319,7 @@ getsigaction(int signo, sig_t *sigact)
 {
 	struct sigaction sa;
 
-	if (sigaction(signo, (struct sigaction *)0, &sa) == -1)
+	if (sigaction(signo, NULL, &sa) == -1)
 		return 0;
 	*sigact = (sig_t) sa.sa_handler;
 	return 1;
diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c
index 662c229..945a57b 100644
--- a/games/battlestar/com6.c
+++ b/games/battlestar/com6.c
@@ -121,7 +121,7 @@ post(unsigned int ch)
 
 	s = sigblock(sigmask(SIGINT));
 
-	gettimeofday(&tv, (struct timezone *)0);	/* can't call time */
+	gettimeofday(&tv, NULL);	/* can't call time */
 	tvsec = (time_t) tv.tv_sec;
 	date = ctime(&tvsec);
 	date[24] = '\0';
diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c
index c02d57e..bae7718 100644
--- a/games/hack/hack.invent.c
+++ b/games/hack/hack.invent.c
@@ -385,7 +385,7 @@ getobj(const char *let, const char *word)
 			continue;
 		}
 		if(index(quitchars,ilet))
-			return((struct obj *)0);
+			return(NULL);
 		if(ilet == '-') {
 			return(allownone ? &zeroobj : (struct obj *) 0);
 		}
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
index 5a42a89..909ba3c 100644
--- a/games/hack/hack.main.c
+++ b/games/hack/hack.main.c
@@ -292,7 +292,7 @@ not_recovered:
 			  (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) {
 				movemon();
 				if(!rn2(70))
-				    makemon((struct permonst *)0, 0, 0);
+				    makemon(NULL, 0, 0);
 			}
 			if(Glib) glibr();
 			p_timeout();
diff --git a/games/hack/hack.wizard.c b/games/hack/hack.wizard.c
index f3a04c3..977a174 100644
--- a/games/hack/hack.wizard.c
+++ b/games/hack/hack.wizard.c
@@ -137,7 +137,7 @@ inrange(struct monst *mtmp)
 		    case 0:
 			/* create a nasty monster from a deep level */
 			/* (for the moment, 'nasty' is not implemented) */
-			makemon((struct permonst *)0, u.ux, u.uy);
+			makemon(NULL, u.ux, u.uy);
 			break;
 		    case 1:
 			pline("\"Destroy the thief, my pets!\"");
diff --git a/games/larn/diag.c b/games/larn/diag.c
index 63b1a47..ff8a8b3 100644
--- a/games/larn/diag.c
+++ b/games/larn/diag.c
@@ -32,7 +32,7 @@ diag(void)
 	cursors();  lwclose();
 	if (lcreat(diagfile) < 0)	/*	open the diagnostic file	*/
 		{
-		lcreat((char*)0); lprcat("\ndiagnostic failure\n"); return(-1);
+		lcreat(NULL); lprcat("\ndiagnostic failure\n"); return(-1);
 		}
 
 	write(1,"\nDiagnosing . . .\n",18);
@@ -113,7 +113,7 @@ diag(void)
 	for (i=0; i<16; i++)  { lprintf("  %5d",(long)rndcount[i]); if (i==7) lprc('\n'); }
 
 	lprcat("\n\n");			lwclose();
-	lcreat((char*)0);		lprcat("Done Diagnosing . . .");
+	lcreat(NULL);		lprcat("Done Diagnosing . . .");
 	return(0);
 	}
 /*
@@ -166,7 +166,7 @@ savegame(char *fname)
 	ointerest();
 	if (lcreat(fname) < 0)
 		{
-		lcreat((char*)0); lprintf("\nCan't open file <%s> to save game\n",fname);
+		lcreat(NULL); lprintf("\nCan't open file <%s> to save game\n",fname);
 		nosignal=0;  return(-1);
 		}
 
@@ -198,7 +198,7 @@ savegame(char *fname)
 #ifndef VT100
 	setscroll();
 #endif /* VT100 */
-	lcreat((char*)0);  nosignal=0;
+	lcreat(NULL);  nosignal=0;
 	return(0);
 	}
 
@@ -211,7 +211,7 @@ restoregame(char *fname)
 	cursors(); lprcat("\nRestoring . . .");  lflush();
 	if (lopen(fname) <= 0)
 		{
-		lcreat((char*)0); lprintf("\nCan't open file <%s>to restore game\n",fname);
+		lcreat(NULL); lprintf("\nCan't open file <%s>to restore game\n",fname);
 		nap(2000); c[GOLD]=c[BANKACCOUNT]=0;  died(-265); return;
 		}
 
@@ -265,7 +265,7 @@ restoregame(char *fname)
 	if (strcmp(fname,ckpfile) == 0)
 		{
 		if (lappend(fname) < 0) fcheat();  else { lprc(' '); lwclose(); }
-		lcreat((char*)0);
+		lcreat(NULL);
 		}
 	else if (unlink(fname) < 0) fcheat(); /* can't unlink save file */
 /*	for the greedy cheater checker	*/
diff --git a/games/larn/io.c b/games/larn/io.c
index 5678c84..457ca52 100644
--- a/games/larn/io.c
+++ b/games/larn/io.c
@@ -171,7 +171,7 @@ newgame(void)
 	long *p,*pe;
 	for (p=c,pe=c+100; p<pe; *p++ =0);
 	time(&initialtime);             srandomdev();
-	lcreat((char*)0);	/* open buffering for output to terminal */
+	lcreat(NULL);	/* open buffering for output to terminal */
 	}
 
 /*
@@ -437,7 +437,7 @@ lgetl(void)
  *	lcreat(filename)			Create a new file for write
  *		char *filename;
  *
- *	lcreat((char*)0); means to the terminal
+ *	lcreat(NULL); means to the terminal
  *	Returns -1 if error, otherwise the file descriptor opened.
  */
 int
diff --git a/games/larn/main.c b/games/larn/main.c
index 58c0a25..06e1bd8 100644
--- a/games/larn/main.c
+++ b/games/larn/main.c
@@ -113,7 +113,7 @@ main(int argc, char **argv)
 	inbuffer = malloc((5*MAXIBUF)>>2);	/* output buffer */
 	if ((lpbuf==0) || (inbuffer==0)) died(-285); /* malloc() failure */
 
-	lcreat((char*)0);	newgame();		/*	set the initial clock  */ hard= -1;
+	lcreat(NULL);	newgame();		/*	set the initial clock  */ hard= -1;
 
 #ifdef VT100
 /*
diff --git a/games/larn/scores.c b/games/larn/scores.c
index 807d52a..78bf8a0 100644
--- a/games/larn/scores.c
+++ b/games/larn/scores.c
@@ -112,7 +112,7 @@ readboard(void)
 	if (lopen(scorefile)<0)
 	  { lprcat("Can't read scoreboard\n"); lflush(); return(-1); }
 	lrfill((char*)sco,sizeof(sco));		lrfill((char*)winr,sizeof(winr));
-	lrclose();  lcreat((char*)0);  return(0);
+	lrclose();  lcreat(NULL);  return(0);
 	}
 
 /*
@@ -127,7 +127,7 @@ writeboard(void)
 	if (lcreat(scorefile)<0)
 	  { lprcat("Can't write scoreboard\n"); lflush(); return(-1); }
 	lwrite((char*)sco,sizeof(sco));		lwrite((char*)winr,sizeof(winr));
-	lwclose();  lcreat((char*)0);  return(0);
+	lwclose();  lcreat(NULL);  return(0);
 	}
 
 /*
@@ -293,7 +293,7 @@ void
 showscores(void)
 	{
 	int i,j;
-	lflush();  lcreat((char*)0);  if (readboard()<0) return;
+	lflush();  lcreat(NULL);  if (readboard()<0) return;
 	i=winshou();	j=shou(0);
 	if (i+j == 0) lprcat(esb); else lprc('\n');
 	lflush();
@@ -308,7 +308,7 @@ void
 showallscores(void)
 	{
 	int i,j;
-	lflush();  lcreat((char*)0);  if (readboard()<0) return;
+	lflush();  lcreat(NULL);  if (readboard()<0) return;
 	c[WEAR] = c[WIELD] = c[SHIELD] = -1;  /* not wielding or wearing anything */
 	for (i=0; i<MAXPOTION; i++) potionname[i] = potionhide[i];
 	for (i=0; i<MAXSCROLL; i++) scrollname[i] = scrollhide[i];
@@ -522,7 +522,7 @@ invalid:
 			{
 			if (lcreat(logfile)<0) /* and can't create new log file */
 		    	{
-				lcreat((char*)0);
+				lcreat(NULL);
 				lprcat("\nCan't open record file:  I can't post your score.\n");
 				sncbr();  resetscroll();  lflush();  exit(1);
 				}
@@ -596,7 +596,7 @@ diedlog(void)
 	int n;
 	char *p;
 	struct stat stbuf;
-	lcreat((char*)0);
+	lcreat(NULL);
 	if (lopen(logfile)<0)
 		{
 		lprintf("Can't locate log file <%s>\n",logfile);
@@ -668,7 +668,7 @@ addone:
 	if (lappend(playerids) < 0) return(-1);	/* can't open file for append */
 	lprintf("%d\n%s",(long)++high,name);  /* new id # and name */
 	lwclose();
-	lcreat((char*)0);	/* re-open terminal channel */
+	lcreat(NULL);	/* re-open terminal channel */
 	return(high);
 	}
 #endif /* UIDSCORE */
diff --git a/games/larn/signal.c b/games/larn/signal.c
index 6b72fd1..a69f986 100644
--- a/games/larn/signal.c
+++ b/games/larn/signal.c
@@ -55,7 +55,7 @@ static void
 tstop(void) /* control Y	*/
 	{
 	if (nosignal)   return;  /* nothing if inhibited */
-	lcreat((char*)0);  clearvt100();	lflush();	  signal(SIGTSTP,SIG_DFL);
+	lcreat(NULL);  clearvt100();	lflush();	  signal(SIGTSTP,SIG_DFL);
 #ifdef SIGVTALRM
 	/* looks like BSD4.2 or higher - must clr mask for signal to take effect*/
 	sigsetmask(sigblock(0)& ~BIT(SIGTSTP));
diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h
index 98ff79c..6930f51 100644
--- a/games/rogue/rogue.h
+++ b/games/rogue/rogue.h
@@ -254,8 +254,8 @@ struct obj {				/* comment is monster meaning */
 
 typedef struct obj object;
 
-#define INIT_AW (object*)0,(object*)0
-#define INIT_RINGS (object*)0,(object*)0
+#define INIT_AW NULL,NULL
+#define INIT_RINGS NULL,NULL
 #define INIT_HP 12
 #define INIT_STR 16,16
 #define INIT_EXP 1,0
diff --git a/games/rogue/spec_hit.c b/games/rogue/spec_hit.c
index 7c12aeb..c5b5cc4 100644
--- a/games/rogue/spec_hit.c
+++ b/games/rogue/spec_hit.c
@@ -148,7 +148,7 @@ freeze(object *monster)
 			for (i = 0; i < 50; i++) {
 				mv_mons();
 			}
-			killed_by((object *)0, HYPOTHERMIA);
+			killed_by(NULL, HYPOTHERMIA);
 		}
 		message(you_can_move_again, 1);
 		monster->m_flags &= (~FREEZING_ROGUE);
diff --git a/games/sail/assorted.c b/games/sail/assorted.c
index f26cd73..1d682d9 100644
--- a/games/sail/assorted.c
+++ b/games/sail/assorted.c
@@ -103,7 +103,7 @@ table(int rig, int shot, int hittable,
 		rigg[3] -= rhits;
 	}
 	if (rig && !rigg[2] && (!rigg[3] || rigg[3] == -1))
-		makesignal(on, "dismasted!", (struct ship *)0);
+		makesignal(on, "dismasted!", NULL);
 	if (portside(from, on, 0)) {
 		guns = on->specs->gunR;
 		car = on->specs->carR;
@@ -180,7 +180,7 @@ table(int rig, int shot, int hittable,
 			message = "main topmast and mizzen mast shattered";
 			break;
 		}
-		makesignal(on, message, (struct ship *)0);
+		makesignal(on, message, NULL);
 	} else if (roll == 6) {
 		switch (Hhit) {
 		case 0:
@@ -206,7 +206,7 @@ table(int rig, int shot, int hittable,
 			message = "shot holes below the water line";
 			break;
 		}
-		makesignal(on, message, (struct ship *)0);
+		makesignal(on, message, NULL);
 	}
 	if (!hull)
 		strike(on, from);
diff --git a/games/sail/dr_2.c b/games/sail/dr_2.c
index b7a15f6..79fca21 100644
--- a/games/sail/dr_2.c
+++ b/games/sail/dr_2.c
@@ -98,13 +98,13 @@ checkup(void)
 			foreachship(sq)
 				cleansnag(sp, sq, 1);
 		if (sink != 1) {
-			makesignal(sp, "exploding!", (struct ship *)0);
+			makesignal(sp, "exploding!", NULL);
 			foreachship(sq) {
 				if (sp != sq && sq->file->dir && range(sp, sq) < 4)
 					table(RIGGING, L_EXPLODE, sp->specs->guns/13, sq, sp, 6);
 			}
 		} else
-			makesignal(sp, "sinking!", (struct ship *)0);
+			makesignal(sp, "sinking!", NULL);
 	}
 }
 
diff --git a/games/sail/dr_3.c b/games/sail/dr_3.c
index d4f6a6d..e5a0228 100644
--- a/games/sail/dr_3.c
+++ b/games/sail/dr_3.c
@@ -271,8 +271,7 @@ sendbp(struct ship *from, struct ship *to, int sections, char isdefense)
 		Write(isdefense ? W_DBP : W_OBP, from,
 			n, turn, to->file->index, sections);
 		if (isdefense)
-			makesignal(from, "repelling boarders",
-				(struct ship *)0);
+			makesignal(from, "repelling boarders", NULL);
 		else
 			makesignal(from, "boarding the %s (%c%c)", to);
 	}
diff --git a/games/sail/machdep.h b/games/sail/machdep.h
index 4ce6ad3..d244035 100644
--- a/games/sail/machdep.h
+++ b/games/sail/machdep.h
@@ -42,12 +42,12 @@
 		sigset_t sigset;					\
 		sigemptyset(&sigset);					\
 		sigaddset(&sigset, SIGALRM);				\
-		sigprocmask(SIG_BLOCK, &sigset, (sigset_t *)0);		\
+		sigprocmask(SIG_BLOCK, &sigset, NULL);			\
 	} while (0)
 #define	unblockalarm() \
 	do {								\
 		sigset_t sigset;					\
 		sigemptyset(&sigset);					\
 		sigaddset(&sigset, SIGALRM);				\
-		sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *)0);	\
+		sigprocmask(SIG_UNBLOCK, &sigset, NULL);		\
 	} while (0)
diff --git a/games/sail/pl_1.c b/games/sail/pl_1.c
index b6f73d5..c689ee4 100644
--- a/games/sail/pl_1.c
+++ b/games/sail/pl_1.c
@@ -58,27 +58,27 @@ leave(int conditions)
 
 	if (done_curses) {
 		Signal("It looks like you've had it!",
-			(struct ship *)0);
+			NULL);
 		switch (conditions) {
 		case LEAVE_QUIT:
 			break;
 		case LEAVE_CAPTURED:
 			Signal("Your ship was captured.",
-				(struct ship *)0);
+				NULL);
 			break;
 		case LEAVE_HURRICAN:
 			Signal("Hurricane!  All ships destroyed.",
-				(struct ship *)0);
+				NULL);
 			break;
 		case LEAVE_DRIVER:
-			Signal("The driver died.", (struct ship *)0);
+			Signal("The driver died.", NULL);
 			break;
 		case LEAVE_SYNC:
-			Signal("Synchronization error.", (struct ship *)0);
+			Signal("Synchronization error.", NULL);
 			break;
 		default:
 			Signal("A funny thing happened (%d).",
-				(struct ship *)0, conditions);
+				NULL, conditions);
 		}
 	} else {
 		switch (conditions) {
@@ -103,7 +103,7 @@ leave(int conditions)
 		write_log(ms);
 		if (conditions != LEAVE_SYNC) {
 			makesignal(ms, "Captain %s relinquishing.",
-				(struct ship *)0, mf->captain);
+				NULL, mf->captain);
 			Write(W_END, ms, 0, 0, 0, 0);
 			Sync();
 		}
@@ -127,7 +127,7 @@ child(void)
 
 	signal(SIGCHLD, SIG_IGN);
 	do {
-		pid = wait3((int *)&status, WNOHANG, (struct rusage *)0);
+		pid = wait3((int *)&status, WNOHANG, NULL);
 		if (pid < 0 || (pid > 0 && !WIFSTOPPED(status)))
 			hasdriver = 0;
 	} while (pid > 0);
diff --git a/games/sail/pl_2.c b/games/sail/pl_2.c
index 0c8b5c1..b512ddb 100644
--- a/games/sail/pl_2.c
+++ b/games/sail/pl_2.c
@@ -43,7 +43,7 @@ play(void)
 	struct ship *sp;
 
 	for (;;) {
-		switch (sgetch("~\b", (struct ship *)0, 0)) {
+		switch (sgetch("~\b", NULL, 0)) {
 		case 'm':
 			acceptmove();
 			break;
@@ -57,7 +57,7 @@ play(void)
 			unfoulplayer();
 			break;
 		case 'v':
-			Signal("%s", (struct ship *)0, version);
+			Signal("%s", NULL, version);
 			break;
 		case 'b':
 			acceptboard();
@@ -75,7 +75,7 @@ play(void)
 			repair();
 			break;
 		case 'B':
-			Signal("'Hands to stations!'", (struct ship *)0);
+			Signal("'Hands to stations!'", NULL);
 			unboard(ms, ms, 1);	/* cancel DBP's */
 			unboard(ms, ms, 0);	/* cancel offense */
 			break;
@@ -91,10 +91,10 @@ play(void)
 			mf->loadR = L_EMPTY;
 			mf->readyL = R_EMPTY;
 			mf->readyR = R_EMPTY;
-			Signal("Broadsides unloaded", (struct ship *)0);
+			Signal("Broadsides unloaded", NULL);
 			break;
 		case 'q':
-			Signal("Type 'Q' to quit", (struct ship *)0);
+			Signal("Type 'Q' to quit", NULL);
 			break;
 		case 'Q':
 			leave(LEAVE_QUIT);
@@ -106,7 +106,7 @@ play(void)
 			break;
 		case 'i':
 			if ((sp = closestenemy(ms, 0, 1)) == 0)
-				Signal("No more ships left.", (struct ship *)0);
+				Signal("No more ships left.", NULL);
 			else
 				eyeball(sp);
 			break;
diff --git a/games/sail/pl_3.c b/games/sail/pl_3.c
index 7c3a42c..b3397d9 100644
--- a/games/sail/pl_3.c
+++ b/games/sail/pl_3.c
@@ -95,7 +95,7 @@ acceptcombat(void)
 			closest, r ? "right" : "left");
 		if (load > L_CHAIN && target < 6) {
 			switch (sgetch("Aim for hull or rigging? ",
-				(struct ship *)0, 1)) {
+				NULL, 1)) {
 			case 'r':
 				shootat = RIGGING;
 				break;
@@ -105,13 +105,13 @@ acceptcombat(void)
 			default:
 				shootat = -1;
 				Signal("'Avast there! Hold your fire.'",
-					(struct ship *)0);
+					NULL);
 			}
 		} else {
-			if (sgetch("Fire? ", (struct ship *)0, 1) == 'n') {
+			if (sgetch("Fire? ", NULL, 1) == 'n') {
 				shootat = -1;
 				Signal("Belay that! Hold your fire.",
-					(struct ship *)0);
+					NULL);
 			} else
 				shootat = RIGGING;
 		}
@@ -193,9 +193,9 @@ acceptcombat(void)
 			table(shootat, load, hit, closest, ms, roll);
 		}
 		Signal("Damage inflicted on the %s:",
-			(struct ship *)0, closest->shipname);
+			NULL, closest->shipname);
 		Signal("\t%d HULL, %d GUNS, %d CREW, %d RIGGING",
-			(struct ship *)0, hhits, ghits, chits, rhits);
+			NULL, hhits, ghits, chits, rhits);
 		if (!r) {
 			mf->loadL = L_EMPTY;
 			mf->readyL = R_EMPTY;
@@ -206,7 +206,7 @@ acceptcombat(void)
 		continue;
 	cant:
 		Signal("Unable to fire %s broadside",
-			(struct ship *)0, r ? "right" : "left");
+			NULL, r ? "right" : "left");
 	}
 	blockalarm();
 	draw_stat();
@@ -231,10 +231,10 @@ grapungrap(void)
 			    || ms->nationality == capship(sp)->nationality) {
 				Write(W_GRAP, ms, sp->file->index, 0, 0, 0);
 				Write(W_GRAP, sp, player, 0, 0, 0);
-				Signal("Attempt succeeds!", (struct ship *)0);
+				Signal("Attempt succeeds!", NULL);
 				makesignal(ms, "grappled with %s (%c%c)", sp);
 			} else
-				Signal("Attempt fails.", (struct ship *)0);
+				Signal("Attempt fails.", NULL);
 			break;
 		case 'u':
 			for (i = grappled2(ms, sp); --i >= 0;) {
@@ -243,13 +243,13 @@ grapungrap(void)
 				    || die() < 3) {
 					cleangrapple(ms, sp, 0);
 					Signal("Attempt succeeds!",
-						(struct ship *)0);
+						NULL);
 					makesignal(ms,
 						"ungrappling with %s (%c%c)",
 						sp);
 				} else
 					Signal("Attempt fails.",
-						(struct ship *)0);
+						NULL);
 			}
 			break;
 		}
@@ -270,10 +270,10 @@ unfoulplayer(void)
 		for (i = fouled2(ms, to); --i >= 0;) {
 			if (die() <= 2) {
 				cleanfoul(ms, to, 0);
-				Signal("Attempt succeeds!", (struct ship *)0);
+				Signal("Attempt succeeds!", NULL);
 				makesignal(ms, "Unfouling %s (%c%c)", to);
 			} else
-				Signal("Attempt fails.", (struct ship *)0);
+				Signal("Attempt fails.", NULL);
 		}
 	}
 }
diff --git a/games/sail/pl_4.c b/games/sail/pl_4.c
index 390c0b9..0549c92 100644
--- a/games/sail/pl_4.c
+++ b/games/sail/pl_4.c
@@ -49,19 +49,19 @@ changesail(void)
 	if (mc->crew3 && rig) {
 		if (!full) {
 			if (sgetch("Increase to Full sails? ",
-				(struct ship *)0, 1) == 'y') {
+				NULL, 1) == 'y') {
 				changed = 1;
 				Write(W_FS, ms, 1, 0, 0, 0);
 			}
 		} else {
 			if (sgetch("Reduce to Battle sails? ",
-				(struct ship *)0, 1) == 'y') {
+				NULL, 1) == 'y') {
 				Write(W_FS, ms, 0, 0, 0, 0);
 				changed = 1;
 			}
 		}
 	} else if (!rig)
-		Signal("Sails rent to pieces", (struct ship *)0);
+		Signal("Sails rent to pieces", NULL);
 }
 
 void
@@ -119,7 +119,7 @@ eyeball(struct ship *ship)
 
 	if (ship->file->dir != 0) {
 		Signal("Sail ho! (range %d, %s)",
-			(struct ship *)0, range(ms, ship), saywhat(ship, 0));
+			NULL, range(ms, ship), saywhat(ship, 0));
 		i = portside(ms, ship, 1) - mf->dir;
 		if (i <= 0)
 			i += 8;
diff --git a/games/sail/pl_5.c b/games/sail/pl_5.c
index fd179d4..2a08803 100644
--- a/games/sail/pl_5.c
+++ b/games/sail/pl_5.c
@@ -55,7 +55,7 @@ acceptmove(void)
 	char *p;
 
 	if (!mc->crew3 || snagged(ms) || !windspeed) {
-		Signal("Unable to move", (struct ship *)0);
+		Signal("Unable to move", NULL);
 		return;
 	}
 
@@ -76,7 +76,7 @@ acceptmove(void)
 				dir = 1;
 			if (last == 't') {
 				Signal("Ship can't turn that fast.",
-					(struct ship *)0);
+					NULL);
 				*p-- = '\0';
 			}
 			last = 't';
@@ -104,7 +104,7 @@ acceptmove(void)
 		case '5': case '6': case '7':
 			if (last == '0') {
 				Signal("Can't move that fast.",
-					(struct ship *)0);
+					NULL);
 				*p-- = '\0';
 			}
 			last = '0';
@@ -116,18 +116,18 @@ acceptmove(void)
 			break;
 		default:
 			if (!isspace(*p)) {
-				Signal("Input error.", (struct ship *)0);
+				Signal("Input error.", NULL);
 				*p-- = '\0';
 			}
 		}
 	if ((ta < 0 && moved) || (vma < 0 && moved)
 	    || (af && turnfirst(buf) && moved)) {
-		Signal("Movement error.", (struct ship *)0);
+		Signal("Movement error.", NULL);
 		if (ta < 0 && moved) {
 			if (mf->FS == 1) {
 				Write(W_FS, ms, 0, 0, 0, 0);
 				Signal("No hands to set full sails.",
-					(struct ship *)0);
+					NULL);
 			}
 		} else if (ma >= 0)
 			buf[1] = '\0';
@@ -136,7 +136,7 @@ acceptmove(void)
 		if (mf->FS == 1) {
 			Write(W_FS, ms, 0, 0, 0, 0);
 			Signal("No hands to set full sails.",
-				(struct ship *)0);
+				NULL);
 		}
 	}
 	if (*buf)
@@ -144,7 +144,7 @@ acceptmove(void)
 	else
 		strcpy(movebuf, "d");
 	Writestr(W_MOVE, ms, movebuf);
-	Signal("Helm: %s.", (struct ship *)0, movebuf);
+	Signal("Helm: %s.", NULL, movebuf);
 }
 
 void
@@ -192,7 +192,7 @@ acceptboard(void)
 	}
 	if (crew[2]) {
 		c = sgetch("How many sections to repel boarders? ",
-			(struct ship *)0, 1);
+			NULL, 1);
 		parties(crew, ms, 1, c);
 	}
 	blockalarm();
@@ -224,7 +224,7 @@ parties(int crew[3], struct ship *to, char isdefense, char buf)
 			}
 			if (buf > '0')
 				Signal("Sending all crew sections.",
-					(struct ship *)0);
+					NULL);
 			Write(isdefense ? W_DBP : W_OBP, ms,
 				j, turn, to->file->index, men);
 			if (isdefense) {
@@ -236,7 +236,7 @@ parties(int crew[3], struct ship *to, char isdefense, char buf)
 						wmove(slot_w, 2, 1 + k);
 				mvwaddstr(slot_w, 3, 0, "DBP");
 				makesignal(ms, "repelling boarders",
-					(struct ship *)0);
+					NULL);
 			} else {
 				wmove(slot_w, 0, 0);
 				for (k=0; k < NBP; k++)
@@ -251,6 +251,6 @@ parties(int crew[3], struct ship *to, char isdefense, char buf)
 			wrefresh(slot_w);
 			unblockalarm();
 		} else
-			Signal("Sending no crew sections.", (struct ship *)0);
+			Signal("Sending no crew sections.", NULL);
 	}
 }
diff --git a/games/sail/pl_6.c b/games/sail/pl_6.c
index ffa702d..adc68e5 100644
--- a/games/sail/pl_6.c
+++ b/games/sail/pl_6.c
@@ -51,10 +51,10 @@ repair(void)
 	? (ptr->x += count, count = 0) : (count -= m - ptr->x, ptr->x = m))
 
 	if (repaired || loaded || fired || changed || turned()) {
-		Signal("No hands free to repair", (struct ship *)0);
+		Signal("No hands free to repair", NULL);
 		return;
 	}
-	c = sgetch("Repair (hull, guns, rigging)? ", (struct ship *)0, 1);
+	c = sgetch("Repair (hull, guns, rigging)? ", NULL, 1);
 	switch (c) {
 		case 'h':
 			repairs = &mf->RH;
@@ -66,7 +66,7 @@ repair(void)
 			repairs = &mf->RR;
 			break;
 		default:
-			Signal("Avast heaving!", (struct ship *)0);
+			Signal("Avast heaving!", NULL);
 			return;
 	}
 	if (++*repairs >= 3) {
@@ -118,7 +118,7 @@ repair(void)
 			break;
 		}
 		if (count == 2) {
-			Signal("Repairs completed.", (struct ship *)0);
+			Signal("Repairs completed.", NULL);
 			*repairs = 2;
 		} else {
 			*repairs = 0;
@@ -151,14 +151,14 @@ loadplayer(void)
 	int loadL, loadR, ready, load;
 
 	if (!mc->crew3) {
-		Signal("Out of crew", (struct ship *)0);
+		Signal("Out of crew", NULL);
 		return;
 	}
 	loadL = mf->loadL;
 	loadR = mf->loadR;
 	if (!loadL && !loadR) {
 		c = sgetch("Load which broadside (left or right)? ",
-			(struct ship *)0, 1);
+			NULL, 1);
 		if (c == 'r')
 			loadL = 1;
 		else
@@ -166,7 +166,7 @@ loadplayer(void)
 	}
 	if ((!loadL && loadR) || (loadL && !loadR)) {
 		c = sgetch("Reload with (round, double, chain, grape)? ",
-			(struct ship *)0, 1);
+			NULL, 1);
 		switch (c) {
 		case 'r':
 			load = L_ROUND;
@@ -186,7 +186,7 @@ loadplayer(void)
 			break;
 		default:
 			Signal("Broadside not loaded.",
-				(struct ship *)0);
+				NULL);
 			return;
 		}
 		if (!loadR) {
diff --git a/games/sail/pl_7.c b/games/sail/pl_7.c
index bc2696c..93475e1 100644
--- a/games/sail/pl_7.c
+++ b/games/sail/pl_7.c
@@ -216,7 +216,7 @@ sgetstr(const char *pr, char *buf, int n)
 	int c;
 	char *p = buf;
 
-	prompt(pr, (struct ship *)0);
+	prompt(pr, NULL);
 	sc_buf = buf;
 	for (;;) {
 		*p = 0;
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 04ba3e6..e0a0b26 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -51,7 +51,7 @@ pl_main(void)
 		exit(1);
 	}
 	initialize();
-	Signal("Aye aye, Sir", (struct ship *)0);
+	Signal("Aye aye, Sir", NULL);
 	play();
 	return 0;			/* for lint,  play() never returns */
 }
diff --git a/lib/libatm/ip_addr.c b/lib/libatm/ip_addr.c
index 3acdd1f..5dc5246 100644
--- a/lib/libatm/ip_addr.c
+++ b/lib/libatm/ip_addr.c
@@ -88,7 +88,7 @@ get_ip_addr(char *p)
 		 * IP address is in dotted decimal format
 		 */
 		if ((sin.sin_addr.s_addr = inet_addr(p)) == -1) {
-			return((struct sockaddr_in *)0);
+			return(NULL);
 		}
 	} else {
 		/*
@@ -97,7 +97,7 @@ get_ip_addr(char *p)
 		ip_host = gethostbyname(p);
 		if (!ip_host ||
 				ip_host->h_addrtype != AF_INET) {
-			return((struct sockaddr_in *)0);
+			return(NULL);
 		}
 		sin.sin_addr.s_addr = *(u_long *)ip_host->h_addr_list[0];
 	}
diff --git a/lib/libatm/timer.c b/lib/libatm/timer.c
index fdf070e..a5abc85 100644
--- a/lib/libatm/timer.c
+++ b/lib/libatm/timer.c
@@ -204,7 +204,7 @@ init_timer(void)
 	timeval.it_interval.tv_usec = 0;
 
 	if (setitimer(ITIMER_REAL, &timeval,
-			(struct itimerval *)0) == -1) {
+			NULL) == -1) {
 		rc = errno;
 		(void)signal(SIGALRM, SIG_DFL);
 	}
diff --git a/lib/libc/citrus/modules/citrus_iso2022.c b/lib/libc/citrus/modules/citrus_iso2022.c
index 6416c8a..d7e2d66 100644
--- a/lib/libc/citrus/modules/citrus_iso2022.c
+++ b/lib/libc/citrus/modules/citrus_iso2022.c
@@ -1176,7 +1176,7 @@ sideok:
 	len = (size_t)(p - tmp);
 	if (n < len) {
 		if (result)
-			*result = (char *)0;
+			*result = NULL;
 		*nresult = (size_t)-1;
 		return E2BIG;
 	}
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index 0adf101..be9829e 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -96,7 +96,7 @@ void
 verrc(int eval, int code, const char *fmt, va_list ap)
 {
 	if (err_file == 0)
-		err_set_file((FILE *)0);
+		err_set_file(NULL);
 	fprintf(err_file, "%s: ", getprogname());
 	if (fmt != NULL) {
 		vfprintf(err_file, fmt, ap);
@@ -121,7 +121,7 @@ void
 verrx(int eval, const char *fmt, va_list ap)
 {
 	if (err_file == 0)
-		err_set_file((FILE *)0);
+		err_set_file(NULL);
 	fprintf(err_file, "%s: ", getprogname());
 	if (fmt != NULL)
 		vfprintf(err_file, fmt, ap);
@@ -160,7 +160,7 @@ void
 vwarnc(int code, const char *fmt, va_list ap)
 {
 	if (err_file == 0)
-		err_set_file((FILE *)0);
+		err_set_file(NULL);
 	fprintf(err_file, "%s: ", getprogname());
 	if (fmt != NULL) {
 		vfprintf(err_file, fmt, ap);
@@ -182,7 +182,7 @@ void
 vwarnx(const char *fmt, va_list ap)
 {
 	if (err_file == 0)
-		err_set_file((FILE *)0);
+		err_set_file(NULL);
 	fprintf(err_file, "%s: ", getprogname());
 	if (fmt != NULL)
 		vfprintf(err_file, fmt, ap);
diff --git a/lib/libc/gen/getnetgrent.3 b/lib/libc/gen/getnetgrent.3
index e5ea06b..38b8b3e 100644
--- a/lib/libc/gen/getnetgrent.3
+++ b/lib/libc/gen/getnetgrent.3
@@ -73,7 +73,7 @@ The function
 sets the three pointer arguments to the strings of the next member of the
 current netgroup.
 If any of the string pointers are
-.Sy (char *)0
+.Dv NULL
 that field is considered a wildcard.
 .Pp
 The functions
@@ -95,12 +95,12 @@ The function
 .Fn innetgr
 searches for a match of all fields within the specified group.
 If any of the
-.Sy host ,
-.Sy user ,
+.Fa host ,
+.Fa user ,
 or
-.Sy domain
+.Fa domain
 arguments are
-.Sy (char *)0
+.Dv NULL
 those fields will match any string value in the netgroup member.
 .Sh RETURN VALUES
 The function
@@ -122,7 +122,7 @@ netgroup database file
 .Sh COMPATIBILITY
 The netgroup members have three string fields to maintain compatibility
 with other vendor implementations, however it is not obvious what use the
-.Sy domain
+.Fa domain
 string has within
 .Bx .
 .Sh SEE ALSO
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index 76746b3..10baa89 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -135,7 +135,7 @@ static struct {
 	NULL,
 	NULL,
 };
-static FILE *netf = (FILE *)0;
+static FILE *netf = NULL;
 static int parse_netgrp(const char *);
 static struct linelist *read_for_group(const char *);
 
@@ -160,7 +160,7 @@ setnetgrent(const char *group)
 	if (group == NULL || !strlen(group))
 		return;
 
-	if (grouphead.gr == (struct netgrp *)0 ||
+	if (grouphead.gr == NULL ||
 		strcmp(group, grouphead.grname)) {
 		endnetgrent();
 #ifdef YP
@@ -250,10 +250,10 @@ endnetgrent(void)
 		free(olp->l_line);
 		free((char *)olp);
 	}
-	linehead = (struct linelist *)0;
+	linehead = NULL;
 	if (grouphead.grname) {
 		free(grouphead.grname);
-		grouphead.grname = (char *)0;
+		grouphead.grname = NULL;
 	}
 	gp = grouphead.gr;
 	while (gp) {
@@ -267,7 +267,7 @@ endnetgrent(void)
 			free(ogp->ng_str[NG_DOM]);
 		free((char *)ogp);
 	}
-	grouphead.gr = (struct netgrp *)0;
+	grouphead.gr = NULL;
 #ifdef YP
 	_netgr_yp_enabled = 0;
 #endif
@@ -430,8 +430,8 @@ parse_netgrp(const char *group)
 			break;
 		lp = lp->l_next;
 	}
-	if (lp == (struct linelist *)0 &&
-	    (lp = read_for_group(group)) == (struct linelist *)0)
+	if (lp == NULL &&
+	    (lp = read_for_group(group)) == NULL)
 		return (1);
 	if (lp->l_parsed) {
 #ifdef DEBUG
@@ -541,7 +541,7 @@ read_for_group(const char *group)
 					strlen(group), &result, &resultlen)) {
 				free(result);
 				if (_use_only_yp)
-					return ((struct linelist *)0);
+					return (NULL);
 				else {
 					_netgr_yp_enabled = 0;
 					continue;
diff --git a/lib/libc/gen/getvfsbyname.c b/lib/libc/gen/getvfsbyname.c
index 23b6d2b..d79605f 100644
--- a/lib/libc/gen/getvfsbyname.c
+++ b/lib/libc/gen/getvfsbyname.c
@@ -55,14 +55,14 @@ getvfsbyname(const char *fsname, struct vfsconf *vfcp)
 	name[1] = VFS_GENERIC;
 	name[2] = VFS_MAXTYPENUM;
 	buflen = sizeof(maxtypenum);
-	if (sysctl(name, 3, &maxtypenum, &buflen, (void *)0, (size_t)0) < 0)
+	if (sysctl(name, 3, &maxtypenum, &buflen, NULL, (size_t)0) < 0)
 		return (-1);
 
 	name[2] = VFS_CONF;
 	buflen = sizeof(*vfcp);
 	for (cnt = 0; cnt < maxtypenum; cnt++) {
 		name[3] = cnt;
-		if (sysctl(name, 4, vfcp, &buflen, (void *)0, (size_t)0) < 0) {
+		if (sysctl(name, 4, vfcp, &buflen, NULL, (size_t)0) < 0) {
 			if (errno == EOPNOTSUPP)
 				continue;
 			return (-1);
diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c
index 96d589d..eaa6742 100644
--- a/lib/libc/gen/getvfsent.c
+++ b/lib/libc/gen/getvfsent.c
@@ -31,7 +31,7 @@ initvfs(void)
 	size_t size = 0;
 	int rv;
 
-	rv = sysctl(mib, 2, (void *)0, &size, (void *)0, (size_t)0);
+	rv = sysctl(mib, 2, NULL, &size, NULL, (size_t)0);
 	if(rv < 0)
 		return 0;
 
@@ -41,7 +41,7 @@ initvfs(void)
 	if(!_vfslist)
 		return 0;
 
-	rv = sysctl(mib, 2, _vfslist, &size, (void *)0, (size_t)0);
+	rv = sysctl(mib, 2, _vfslist, &size, NULL, (size_t)0);
 	if(rv < 0) {
 		free(_vfslist);
 		_vfslist = 0;
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 4cd8239..33682d1 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -175,7 +175,7 @@ pclose(FILE *iop)
 	fclose(iop);
 
 	do {
-		pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
+		pid = _wait4(cur->pid, &pstat, 0, NULL);
 	} while (pid == -1 && errno == EINTR);
 
 	/* Remove the entry from the linked list. */
diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c
index a6ed2bb..56dc8c3 100644
--- a/lib/libc/gen/siginterrupt.c
+++ b/lib/libc/gen/siginterrupt.c
@@ -52,7 +52,7 @@ siginterrupt(int sig, int flag)
 	struct sigaction sa;
 	int ret;
 
-	if ((ret = _sigaction(sig, (struct sigaction *)0, &sa)) < 0)
+	if ((ret = _sigaction(sig, NULL, &sa)) < 0)
 		return (ret);
 	if (flag) {
 		sigaddset(&_sigintr, sig);
@@ -61,5 +61,5 @@ siginterrupt(int sig, int flag)
 		sigdelset(&_sigintr, sig);
 		sa.sa_flags |= SA_RESTART;
 	}
-	return (_sigaction(sig, &sa, (struct sigaction *)0));
+	return (_sigaction(sig, &sa, NULL));
 }
diff --git a/lib/libc/gen/time.c b/lib/libc/gen/time.c
index b73d978..fd9ca8f 100644
--- a/lib/libc/gen/time.c
+++ b/lib/libc/gen/time.c
@@ -42,7 +42,7 @@ time(time_t *t)
 {
 	struct timeval tt;
 
-	if (gettimeofday(&tt, (struct timezone *)0) < 0)
+	if (gettimeofday(&tt, NULL) < 0)
 		return(-1);
 	if (t)
 		*t = tt.tv_sec;
diff --git a/lib/libc/gen/times.c b/lib/libc/gen/times.c
index 7c7518a..3596621 100644
--- a/lib/libc/gen/times.c
+++ b/lib/libc/gen/times.c
@@ -59,7 +59,7 @@ times(struct tms *tp)
 		return ((clock_t)-1);
 	tp->tms_cutime = CONVTCK(ru.ru_utime);
 	tp->tms_cstime = CONVTCK(ru.ru_stime);
-	if (gettimeofday(&t, (struct timezone *)0))
+	if (gettimeofday(&t, NULL))
 		return ((clock_t)-1);
 	return ((clock_t)(CONVTCK(t)));
 }
diff --git a/lib/libc/gen/wait.c b/lib/libc/gen/wait.c
index c5eca6e..4469b6b 100644
--- a/lib/libc/gen/wait.c
+++ b/lib/libc/gen/wait.c
@@ -46,7 +46,7 @@
 pid_t
 __wait(int *istat)
 {
-	return (_wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
+	return (_wait4(WAIT_ANY, istat, 0, NULL));
 }
 
 __weak_reference(__wait, wait);
diff --git a/lib/libc/gen/waitpid.c b/lib/libc/gen/waitpid.c
index acc56f8..68620fc 100644
--- a/lib/libc/gen/waitpid.c
+++ b/lib/libc/gen/waitpid.c
@@ -46,7 +46,7 @@
 pid_t
 __waitpid(pid_t pid, int *istat, int options)
 {
-	return (_wait4(pid, istat, options, (struct rusage *)0));
+	return (_wait4(pid, istat, options, NULL));
 }
 
 __weak_reference(__waitpid, waitpid);
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index cdf5f1b..f145af1 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -235,7 +235,7 @@ moncontrol(int mode)
 		p->state = GMON_PROF_ON;
 	} else {
 		/* stop */
-		profil((char *)0, 0, 0, 0);
+		profil(NULL, 0, 0, 0);
 		p->state = GMON_PROF_OFF;
 	}
 }
diff --git a/lib/libc/quad/divdi3.c b/lib/libc/quad/divdi3.c
index 013f44d..f6b9197 100644
--- a/lib/libc/quad/divdi3.c
+++ b/lib/libc/quad/divdi3.c
@@ -58,6 +58,6 @@ __divdi3(quad_t a, quad_t b)
 		ub = -(u_quad_t)b, neg ^= 1;
 	else
 		ub = b;
-	uq = __qdivrem(ua, ub, (u_quad_t *)0);
+	uq = __qdivrem(ua, ub, NULL);
 	return (neg ? -uq : uq);
 }
diff --git a/lib/libc/quad/udivdi3.c b/lib/libc/quad/udivdi3.c
index 6bf9203..37078a8 100644
--- a/lib/libc/quad/udivdi3.c
+++ b/lib/libc/quad/udivdi3.c
@@ -47,5 +47,5 @@ u_quad_t
 __udivdi3(u_quad_t a, u_quad_t b)
 {
 
-	return (__qdivrem(a, b, (u_quad_t *)0));
+	return (__qdivrem(a, b, NULL));
 }
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index f65c34f..421dc0a 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -285,7 +285,7 @@ static char *malloc_func;
 
 /* Macro for mmap */
 #define MMAP(size) \
-	mmap((void *)0, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \
+	mmap(NULL, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \
 	    -1, (off_t)0)
 
 /*
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index d69c650..8cfac5c 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -88,7 +88,7 @@ __system(const char *command)
 	default:			/* parent */
 		savedpid = pid;
 		do {
-			pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
+			pid = _wait4(savedpid, &pstat, 0, NULL);
 		} while (pid == -1 && errno == EINTR);
 		break;
 	}
diff --git a/lib/libstand/cd9660.c b/lib/libstand/cd9660.c
index 53feaa6..77ceb2c 100644
--- a/lib/libstand/cd9660.c
+++ b/lib/libstand/cd9660.c
@@ -448,7 +448,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
 	blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE;
 
 	if (blkno != fp->f_buf_blkno) {
-		if (fp->f_buf == (char *)0)
+		if (fp->f_buf == NULL)
 			fp->f_buf = malloc(ISO_DEFAULT_BLOCK_SIZE);
 
 		twiddle();
diff --git a/lib/libstand/ext2fs.c b/lib/libstand/ext2fs.c
index fc0f16a..61b790c 100644
--- a/lib/libstand/ext2fs.c
+++ b/lib/libstand/ext2fs.c
@@ -660,7 +660,7 @@ block_map(struct open_file *f, daddr_t file_block, daddr_t *disk_block_p)
 		}
 
 		if (fp->f_blkno[level] != ind_block_num) {
-			if (fp->f_blk[level] == (char *)0)
+			if (fp->f_blk[level] == NULL)
 				fp->f_blk[level] =
 					malloc(fs->fs_bsize);
 			twiddle();
@@ -714,7 +714,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
 		if (error)
 			goto done;
 
-		if (fp->f_buf == (char *)0)
+		if (fp->f_buf == NULL)
 			fp->f_buf = malloc(fs->fs_bsize);
 
 		if (disk_block == 0) {
@@ -794,8 +794,8 @@ ext2fs_close(struct open_file *f)
 	struct file *fp = (struct file *)f->f_fsdata;
 	int level;
 
-	f->f_fsdata = (void *)0;
-	if (fp == (struct file *)0)
+	f->f_fsdata = NULL;
+	if (fp == NULL)
 		return (0);
 
 	for (level = 0; level < NIADDR; level++) {
diff --git a/lib/libstand/net.c b/lib/libstand/net.c
index f3b0035..52e26b4 100644
--- a/lib/libstand/net.c
+++ b/lib/libstand/net.c
@@ -259,7 +259,7 @@ ip_convertaddr(char *p)
 #define IP_ANYADDR	0
 	n_long addr = 0, n;
 
-	if (p == (char *)0 || *p == '\0')
+	if (p == NULL || *p == '\0')
 		return IP_ANYADDR;
 	p = number(p, &n);
 	addr |= (n << 24) & 0xff000000;
diff --git a/lib/libstand/netif.c b/lib/libstand/netif.c
index 12b092d..29ac20c 100644
--- a/lib/libstand/netif.c
+++ b/lib/libstand/netif.c
@@ -278,7 +278,7 @@ netif_open(void *machdep_hint)
 	
 	/* find a free socket */
 	for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
-		if (s->io_netif == (struct netif *)0)
+		if (s->io_netif == NULL)
 			goto fnd;
 	errno = EMFILE;
 	return (-1);
@@ -308,7 +308,7 @@ netif_close(int sock)
 		return(-1);
 	}
 	netif_detach(sockets[sock].io_netif);
-	sockets[sock].io_netif = (struct netif *)0;
+	sockets[sock].io_netif = NULL;
 
 	return(0);
 }
diff --git a/lib/libstand/open.c b/lib/libstand/open.c
index 90b603e..5547c8e 100644
--- a/lib/libstand/open.c
+++ b/lib/libstand/open.c
@@ -103,15 +103,15 @@ open(const char *fname, int mode)
 
     f = &files[fd];
     f->f_flags = mode + 1;
-    f->f_dev = (struct devsw *)0;
-    f->f_ops = (struct fs_ops *)0;
+    f->f_dev = NULL;
+    f->f_ops = NULL;
     f->f_offset = 0;
     f->f_devdata = NULL;
     f->f_fsdata = NULL;
     file = NULL;
     error = devopen(f, fname, &file);
     if (error ||
-	(((f->f_flags & F_NODEV) == 0) && f->f_dev == (struct devsw *)0))
+	(((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL))
 	goto err;
 
     /* see if we opened a raw device; otherwise, 'file' is the file name. */
diff --git a/lib/libstand/qdivrem.c b/lib/libstand/qdivrem.c
index d6ca6f9..78b450c 100644
--- a/lib/libstand/qdivrem.c
+++ b/lib/libstand/qdivrem.c
@@ -285,7 +285,7 @@ u_quad_t
 __udivdi3(u_quad_t a, u_quad_t b)
 {
 
-	return (__qdivrem(a, b, (u_quad_t *)0));
+	return (__qdivrem(a, b, NULL));
 }
 
 /*
diff --git a/lib/libstand/ufs.c b/lib/libstand/ufs.c
index 3f2afa1..a47a5aa 100644
--- a/lib/libstand/ufs.c
+++ b/lib/libstand/ufs.c
@@ -250,7 +250,7 @@ block_map(struct open_file *f, daddr_t file_block, daddr_t *disk_block_p)
 		}
 
 		if (fp->f_blkno[level] != ind_block_num) {
-			if (fp->f_blk[level] == (char *)0)
+			if (fp->f_blk[level] == NULL)
 				fp->f_blk[level] =
 					malloc(fs->fs_bsize);
 			twiddle();
@@ -310,7 +310,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
 		if (rc)
 			return (rc);
 
-		if (fp->f_buf == (char *)0)
+		if (fp->f_buf == NULL)
 			fp->f_buf = malloc(fs->fs_bsize);
 
 		if (disk_block == 0) {
diff --git a/lib/libvgl/main.c b/lib/libvgl/main.c
index 864d535..d9cfbfa 100644
--- a/lib/libvgl/main.c
+++ b/lib/libvgl/main.c
@@ -278,7 +278,7 @@ VGLInit(int mode)
     VGLEnd();
     return -9;
   }
-  VGLTextSetFontFile((byte*)0);
+  VGLTextSetFontFile(NULL);
   VGLClear(VGLDisplay, 0);
   return 0;
 }
diff --git a/lib/libvgl/text.c b/lib/libvgl/text.c
index 61c7293..5c91125 100644
--- a/lib/libvgl/text.c
+++ b/lib/libvgl/text.c
@@ -48,7 +48,7 @@ FILE *fd;
     free(VGLTextFont);
   }
 
-  if ((VGLTextFont=(VGLText*)malloc(sizeof(VGLText))) == (VGLText*)0)
+  if ((VGLTextFont=(VGLText*)malloc(sizeof(VGLText))) == NULL)
 	return 1;
 
   if (filename==NULL) {
@@ -57,7 +57,7 @@ FILE *fd;
     VGLTextFont->BitmapArray = VGLFont;
   }
   else {
-    if ((fd=fopen(filename, "r"))==(FILE*)0)
+    if ((fd=fopen(filename, "r"))==NULL)
       return 1;
     fread(&VGLTextFont->Width, 1 , 1, fd);
     fread(&VGLTextFont->Height, 1 , 1, fd);
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index 942fb98..cd77f4c 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -388,7 +388,7 @@ main(int argc, char **argv)
 				exit(1);
 			}
 			signal(SIGINT, SIG_DFL);
-			for (i = 0; environ[i] != (char *)0; i++)
+			for (i = 0; environ[i] != NULL; i++)
 				env[i] = environ[i];
 			makeenv(&env[i]);
 
diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c
index bcb33aa..287fe44 100644
--- a/libexec/getty/subr.c
+++ b/libexec/getty/subr.c
@@ -734,7 +734,7 @@ makeenv(char *env[])
 		if (*p)
 			*ep++ = p;
 	}
-	*ep = (char *)0;
+	*ep = NULL;
 }
 
 /*
diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c
index a4484c1..6f8f432 100644
--- a/libexec/rbootd/rbootd.c
+++ b/libexec/rbootd/rbootd.c
@@ -304,7 +304,7 @@ DoTimeout()
 	RMPCONN *rtmp;
 	struct timeval now;
 
-	(void) gettimeofday(&now, (struct timezone *)0);
+	(void) gettimeofday(&now, NULL);
 
 	/*
 	 *  For each active connection, if RMP_TIMEOUT seconds have passed
diff --git a/libexec/rbootd/rmpproto.c b/libexec/rbootd/rmpproto.c
index 5bc87e3..31985ed 100644
--- a/libexec/rbootd/rmpproto.c
+++ b/libexec/rbootd/rmpproto.c
@@ -582,7 +582,7 @@ SendPacket(rconn)
 	/*
 	 *  Last time this connection was active.
 	 */
-	(void) gettimeofday(&rconn->tstamp, (struct timezone *)0);
+	(void) gettimeofday(&rconn->tstamp, NULL);
 
 	if (DbgFp != NULL)			/* display packet */
 		DispPkt(rconn,DIR_SENT);
diff --git a/libexec/revnetgroup/parse_netgroup.c b/libexec/revnetgroup/parse_netgroup.c
index 3e09974..5b90887 100644
--- a/libexec/revnetgroup/parse_netgroup.c
+++ b/libexec/revnetgroup/parse_netgroup.c
@@ -73,14 +73,14 @@ struct netgrp {
 #define NG_USER		1	/* User name */
 #define NG_DOM		2	/* and Domain name */
 
-static struct linelist	*linehead = (struct linelist *)0;
-static struct netgrp	*nextgrp = (struct netgrp *)0;
+static struct linelist	*linehead = NULL;
+static struct netgrp	*nextgrp = NULL;
 static struct {
 	struct netgrp	*gr;
 	char		*grname;
 } grouphead = {
-	(struct netgrp *)0,
-	(char *)0,
+	NULL,
+	NULL,
 };
 static int parse_netgrp(char *);
 static struct linelist *read_for_group(char *);
@@ -100,7 +100,7 @@ __setnetgrent(char *group)
 	if (group == NULL || !strlen(group))
 		return;
 
-	if (grouphead.gr == (struct netgrp *)0 ||
+	if (grouphead.gr == NULL ||
 		strcmp(group, grouphead.grname)) {
 		__endnetgrent();
 		if (parse_netgrp(group))
@@ -147,10 +147,10 @@ __endnetgrent(void)
 		free(olp->l_line);
 		free((char *)olp);
 	}
-	linehead = (struct linelist *)0;
+	linehead = NULL;
 	if (grouphead.grname) {
 		free(grouphead.grname);
-		grouphead.grname = (char *)0;
+		grouphead.grname = NULL;
 	}
 	gp = grouphead.gr;
 	while (gp) {
@@ -164,7 +164,7 @@ __endnetgrent(void)
 			free(ogp->ng_str[NG_DOM]);
 		free((char *)ogp);
 	}
-	grouphead.gr = (struct netgrp *)0;
+	grouphead.gr = NULL;
 }
 
 /*
@@ -190,8 +190,8 @@ parse_netgrp(char *group)
 			break;
 		lp = lp->l_next;
 	}
-	if (lp == (struct linelist *)0 &&
-	    (lp = read_for_group(group)) == (struct linelist *)0)
+	if (lp == NULL &&
+	    (lp = read_for_group(group)) == NULL)
 		return (1);
 	if (lp->l_parsed) {
 #ifdef DEBUG
@@ -357,5 +357,5 @@ read_for_group(char *group)
 #endif
 			return (lp);
 	}
-	return ((struct linelist *)0);
+	return (NULL);
 }
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c
index 5721999..e53d148 100644
--- a/libexec/rshd/rshd.c
+++ b/libexec/rshd/rshd.c
@@ -500,8 +500,8 @@ fail:
 						break;
 				} else
 #endif
-					if (select(nfd, &ready, (fd_set *)0,
-					  (fd_set *)0, (struct timeval *)0) < 0)
+					if (select(nfd, &ready, NULL,
+					  NULL, NULL) < 0)
 						break;
 				if (FD_ISSET(s, &ready)) {
 					int	ret;
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 9e677ca..eddf1dc 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1970,7 +1970,7 @@ dladdr(const void *addr, Dl_info *info)
     }
     info->dli_fname = obj->path;
     info->dli_fbase = obj->mapbase;
-    info->dli_saddr = (void *)0;
+    info->dli_saddr = NULL;
     info->dli_sname = NULL;
 
     /*
diff --git a/libexec/talkd/process.c b/libexec/talkd/process.c
index 88ceb46..17f160c 100644
--- a/libexec/talkd/process.c
+++ b/libexec/talkd/process.c
@@ -116,7 +116,7 @@ process_request(mp, rp)
 
 	case LEAVE_INVITE:
 		ptr = find_request(mp);
-		if (ptr != (CTL_MSG *)0) {
+		if (ptr != NULL) {
 			rp->id_num = htonl(ptr->id_num);
 			rp->answer = SUCCESS;
 		} else
@@ -125,7 +125,7 @@ process_request(mp, rp)
 
 	case LOOK_UP:
 		ptr = find_match(mp);
-		if (ptr != (CTL_MSG *)0) {
+		if (ptr != NULL) {
 			rp->id_num = htonl(ptr->id_num);
 			rp->addr = ptr->addr;
 			rp->addr.sa_family = htons(ptr->addr.sa_family);
@@ -164,7 +164,7 @@ do_announce(mp, rp)
 #define	satosin(sa)	((struct sockaddr_in *)(sa))
 	hp = gethostbyaddr(&satosin(&mp->ctl_addr)->sin_addr,
 		sizeof (struct in_addr), AF_INET);
-	if (hp == (struct hostent *)0) {
+	if (hp == NULL) {
 		rp->answer = MACHINE_UNKNOWN;
 		return;
 	}
diff --git a/libexec/talkd/table.c b/libexec/talkd/table.c
index 5fea450..9ab5cfe 100644
--- a/libexec/talkd/table.c
+++ b/libexec/talkd/table.c
@@ -55,8 +55,6 @@
 
 #define MAX_ID 16000	/* << 2^15 so I don't have sign troubles */
 
-#define NIL ((TABLE_ENTRY *)0)
-
 extern	int debug;
 struct	timeval tp;
 struct	timezone txp;
@@ -70,7 +68,7 @@ struct table_entry {
 	TABLE_ENTRY *last;
 };
 
-TABLE_ENTRY *table = NIL;
+TABLE_ENTRY *table = NULL;
 
 void delete (TABLE_ENTRY *);
 CTL_MSG *find_request();
@@ -93,7 +91,7 @@ find_match(request)
 	current_time = tp.tv_sec;
 	if (debug)
 		print_request("find_match", request);
-	for (ptr = table; ptr != NIL; ptr = ptr->next) {
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
 		if ((ptr->time - current_time) > MAX_LIFE) {
 			/* the entry is too old */
 			if (debug)
@@ -109,7 +107,7 @@ find_match(request)
 		     ptr->request.type == LEAVE_INVITE)
 			return (&ptr->request);
 	}
-	return ((CTL_MSG *)0);
+	return (NULL);
 }
 
 /*
@@ -131,7 +129,7 @@ find_request(request)
 	 */
 	if (debug)
 		print_request("find_request", request);
-	for (ptr = table; ptr != NIL; ptr = ptr->next) {
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
 		if ((ptr->time - current_time) > MAX_LIFE) {
 			/* the entry is too old */
 			if (debug)
@@ -151,7 +149,7 @@ find_request(request)
 			return (&ptr->request);
 		}
 	}
-	return ((CTL_MSG *)0);
+	return (NULL);
 }
 
 void
@@ -168,16 +166,16 @@ insert_table(request, response)
 	response->id_num = htonl(request->id_num);
 	/* insert a new entry into the top of the list */
 	ptr = (TABLE_ENTRY *)malloc(sizeof(TABLE_ENTRY));
-	if (ptr == NIL) {
+	if (ptr == NULL) {
 		syslog(LOG_ERR, "insert_table: Out of memory");
 		_exit(1);
 	}
 	ptr->time = current_time;
 	ptr->request = *request;
 	ptr->next = table;
-	if (ptr->next != NIL)
+	if (ptr->next != NULL)
 		ptr->next->last = ptr;
-	ptr->last = NIL;
+	ptr->last = NULL;
 	table = ptr;
 }
 
@@ -208,13 +206,13 @@ delete_invite(id_num)
 	ptr = table;
 	if (debug)
 		syslog(LOG_DEBUG, "delete_invite(%d)", id_num);
-	for (ptr = table; ptr != NIL; ptr = ptr->next) {
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
 		if (ptr->request.id_num == id_num)
 			break;
 		if (debug)
 			print_request("", &ptr->request);
 	}
-	if (ptr != NIL) {
+	if (ptr != NULL) {
 		delete(ptr);
 		return (SUCCESS);
 	}
@@ -233,9 +231,9 @@ delete(ptr)
 		print_request("delete", &ptr->request);
 	if (table == ptr)
 		table = ptr->next;
-	else if (ptr->last != NIL)
+	else if (ptr->last != NULL)
 		ptr->last->next = ptr->next;
-	if (ptr->next != NIL)
+	if (ptr->next != NULL)
 		ptr->next->last = ptr->last;
 	free((char *)ptr);
 }
diff --git a/libexec/telnetd/slc.c b/libexec/telnetd/slc.c
index 06aea4a..568d8b7 100644
--- a/libexec/telnetd/slc.c
+++ b/libexec/telnetd/slc.c
@@ -41,7 +41,7 @@
 /*
  * local variables
  */
-static unsigned char	*def_slcbuf = (unsigned char *)0;
+static unsigned char	*def_slcbuf = NULL;
 static int		def_slclen = 0;
 static int		slcchange;	/* change to slc is requested */
 static unsigned char	*slcptr;	/* pointer into slc buffer */
@@ -447,10 +447,10 @@ do_opt_slc(unsigned char *ptr, int len)
 		 * save this slc buffer if it is the first, otherwise dump
 		 * it.
 		 */
-		if (def_slcbuf == (unsigned char *)0) {
+		if (def_slcbuf == NULL) {
 			def_slclen = len;
 			def_slcbuf = (unsigned char *)malloc((unsigned)len);
-			if (def_slcbuf == (unsigned char *)0)
+			if (def_slcbuf == NULL)
 				return;  /* too bad */
 			memmove(def_slcbuf, ptr, len);
 		}
@@ -471,7 +471,7 @@ deferslc(void)
 		do_opt_slc(def_slcbuf, def_slclen);
 		(void) end_slc(0);
 		free(def_slcbuf);
-		def_slcbuf = (unsigned char *)0;
+		def_slcbuf = NULL;
 		def_slclen = 0;
 	}
 
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 60cb0de..569731b 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -273,11 +273,11 @@ spcset(int func, cc_t *valp, cc_t **valpp)
 	case SLC_AYT:
 	case SLC_EOR:
 		*valp = (cc_t)0;
-		*valpp = (cc_t *)0;
+		*valpp = NULL;
 		return(SLC_DEFAULT);
 	default:
 		*valp = (cc_t)0;
-		*valpp = (cc_t *)0;
+		*valpp = NULL;
 		return(SLC_NOSUPPORT);
 	}
 }
@@ -288,7 +288,7 @@ spcset(int func, cc_t *valp, cc_t **valpp)
 #define	setval(a, b)	*valp = termbuf.c_cc[a]; \
 			*valpp = &termbuf.c_cc[a]; \
 			return(b);
-#define	defval(a) *valp = ((cc_t)a); *valpp = (cc_t *)0; return(SLC_DEFAULT);
+#define	defval(a) *valp = ((cc_t)a); *valpp = NULL; return(SLC_DEFAULT);
 
 int
 spcset(int func, cc_t *valp, cc_t **valpp)
@@ -868,7 +868,7 @@ getptyslave(void)
 # ifdef	TIOCNOTTY
 	t = open(_PATH_TTY, O_RDWR);
 	if (t >= 0) {
-		(void) ioctl(t, TIOCNOTTY, (char *)0);
+		(void) ioctl(t, TIOCNOTTY, NULL);
 		(void) close(t);
 	}
 # endif
@@ -1094,7 +1094,7 @@ addarg(char **argv, const char *val)
 		if (argv == NULL)
 			return(NULL);
 		*argv++ = (char *)10;
-		*argv = (char *)0;
+		*argv = NULL;
 	}
 	for (cpp = argv; *cpp; cpp++)
 		;
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 744a0ba..10d810b 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -758,7 +758,7 @@ telnet(int f, int p, char *host)
 		int t;
 		t = open(_PATH_TTY, O_RDWR);
 		if (t >= 0) {
-			(void) ioctl(t, TIOCNOTTY, (char *)0);
+			(void) ioctl(t, TIOCNOTTY, NULL);
 			(void) close(t);
 		}
 	}
@@ -839,8 +839,7 @@ telnet(int f, int p, char *host)
 		if (!SYNCHing) {
 			FD_SET(f, &xbits);
 		}
-		if ((c = select(nfd, &ibits, &obits, &xbits,
-						(struct timeval *)0)) < 1) {
+		if ((c = select(nfd, &ibits, &obits, &xbits, NULL)) < 1) {
 			if (c == -1) {
 				if (errno == EINTR) {
 					continue;
diff --git a/libexec/telnetd/utility.c b/libexec/telnetd/utility.c
index db9d52e..473834d 100644
--- a/libexec/telnetd/utility.c
+++ b/libexec/telnetd/utility.c
@@ -96,7 +96,7 @@ stilloob(int s)
 	FD_ZERO(&excepts);
 	FD_SET(s, &excepts);
 	memset((char *)&timeout, 0, sizeof timeout);
-	value = select(s+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout);
+	value = select(s+1, NULL, NULL, &excepts, &timeout);
     } while ((value == -1) && (errno == EINTR));
 
     if (value < 0) {
diff --git a/sbin/atm/atm/atm_show.c b/sbin/atm/atm/atm_show.c
index 7ee3a60..c183649 100644
--- a/sbin/atm/atm/atm_show.c
+++ b/sbin/atm/atm/atm_show.c
@@ -398,7 +398,7 @@ void
 show_ip_vcc(int argc, char **argv, __unused const struct cmd *cmdp)
 {
 	int			buf_len, ip_info_len, rc;
-	char			*if_name = (char *)0;
+	char			*if_name = NULL;
 	struct atminfreq	air;
 	struct air_ip_vcc_rsp	*ip_info, *ip_info_base;
 	struct sockaddr_in	*sin;
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 75baf14..bec4f33 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -815,9 +815,9 @@ editit(void)
 		sigsetmask(omask);
 		setgid(getgid());
 		setuid(getuid());
-		if ((ed = getenv("EDITOR")) == (char *)0)
+		if ((ed = getenv("EDITOR")) == NULL)
 			ed = DEFEDITOR;
-		execlp(ed, ed, tmpfil, (char *)0);
+		execlp(ed, ed, tmpfil, NULL);
 		err(1, "%s", ed);
 	}
 	while ((xpid = wait(&status)) >= 0)
diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c
index d6b1b01..d765994 100644
--- a/sbin/disklabel64/disklabel64.c
+++ b/sbin/disklabel64/disklabel64.c
@@ -822,9 +822,9 @@ editit(void)
 		sigsetmask(omask);
 		setgid(getgid());
 		setuid(getuid());
-		if ((ed = getenv("EDITOR")) == (char *)0)
+		if ((ed = getenv("EDITOR")) == NULL)
 			ed = DEFEDITOR;
-		execlp(ed, ed, tmpfil, (char *)0);
+		execlp(ed, ed, tmpfil, NULL);
 		err(1, "%s", ed);
 	}
 	while ((xpid = wait(&status)) >= 0)
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index e914772..677a6d8 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -167,8 +167,7 @@ rmtgetconn(void)
 	msg("%s", "");
 #ifdef KERBEROS
 	if (dokerberos)
-		rmtape = krcmd(&rmtpeer, sp->s_port, tuser, rmt, &errfd,
-			       (char *)0);
+		rmtape = krcmd(&rmtpeer, sp->s_port, tuser, rmt, &errfd, NULL);
 	else
 #endif
 		rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name,
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index ca2bcce..36cad43 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -88,8 +88,7 @@ main(int argc, char **argv)
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_DUMPDEV;
 
-	rv = sysctl(mib, 2, (void *)0, (size_t *)0, &stab.st_rdev,
-		    sizeof stab.st_rdev);
+	rv = sysctl(mib, 2, NULL, NULL, &stab.st_rdev, sizeof stab.st_rdev);
 	if (rv) {
 		err(EX_OSERR, "sysctl: kern.dumpdev");
 	}
diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c
index 15a0020..16f1fbf 100644
--- a/sbin/fsck/inode.c
+++ b/sbin/fsck/inode.c
@@ -416,7 +416,7 @@ getinoinfo(ufs1_ino_t inumber)
 		return (inp);
 	}
 	errx(EEXIT, "cannot find inode %d", inumber);
-	return ((struct inoinfo *)0);
+	return (NULL);
 }
 
 /*
diff --git a/sbin/fsck/main.c b/sbin/fsck/main.c
index 1159dc0..8e5e4ac 100644
--- a/sbin/fsck/main.c
+++ b/sbin/fsck/main.c
@@ -312,9 +312,9 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
 			printf("\n");
 		}
 	}
-	zlnhead = (struct zlncnt *)0;
-	duplist = (struct dups *)0;
-	muldup = (struct dups *)0;
+	zlnhead = NULL;
+	duplist = NULL;
+	muldup = NULL;
 	inocleanup();
 	if (fsmodified) {
 		sblock.fs_time = time(NULL);
diff --git a/sbin/fsck/utilities.c b/sbin/fsck/utilities.c
index fd35817..19b1f4a 100644
--- a/sbin/fsck/utilities.c
+++ b/sbin/fsck/utilities.c
@@ -137,7 +137,7 @@ bufinit(void)
 	long bufcnt, i;
 	char *bufp;
 
-	pbp = pdirbp = (struct bufarea *)0;
+	pbp = pdirbp = NULL;
 	bufp = malloc((unsigned int)sblock.fs_bsize);
 	if (bufp == 0)
 		errx(EEXIT, "cannot allocate buffer pool");
@@ -273,7 +273,7 @@ ckfini(int markclean)
 	}
 	if (bufhead.b_size != cnt)
 		errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt);
-	pbp = pdirbp = (struct bufarea *)0;
+	pbp = pdirbp = NULL;
 	if (sblock.fs_clean != markclean) {
 		sblock.fs_clean = markclean;
 		sbdirty();
diff --git a/sbin/init/init.c b/sbin/init/init.c
index b0095c5..0a749f1 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -310,8 +310,8 @@ invalid:
 	sigemptyset(&sa.sa_mask);
 	sa.sa_flags = 0;
 	sa.sa_handler = SIG_IGN;
-	sigaction(SIGTTIN, &sa, (struct sigaction *)0);
-	sigaction(SIGTTOU, &sa, (struct sigaction *)0);
+	sigaction(SIGTTIN, &sa, NULL);
+	sigaction(SIGTTOU, &sa, NULL);
 
 	/*
 	 * Paranoia.
@@ -762,8 +762,8 @@ runcom(void)
 		sigemptyset(&sa.sa_mask);
 		sa.sa_flags = 0;
 		sa.sa_handler = SIG_IGN;
-		sigaction(SIGTSTP, &sa, (struct sigaction *)0);
-		sigaction(SIGHUP, &sa, (struct sigaction *)0);
+		sigaction(SIGTSTP, &sa, NULL);
+		sigaction(SIGHUP, &sa, NULL);
 
 		setctty(_PATH_CONSOLE);
 
@@ -1456,7 +1456,7 @@ death(void)
 		clang = 0;
 		alarm(DEATH_WATCH);
 		do
-			if ((pid = waitpid(-1, (int *)0, 0)) != -1)
+			if ((pid = waitpid(-1, NULL, 0)) != -1)
 				collect_child(pid);
 		while (clang == 0 && errno != ECHILD);
 
@@ -1506,8 +1506,8 @@ runshutdown(void)
 		sigemptyset(&sa.sa_mask);
 		sa.sa_flags = 0;
 		sa.sa_handler = SIG_IGN;
-		sigaction(SIGTSTP, &sa, (struct sigaction *)0);
-		sigaction(SIGHUP, &sa, (struct sigaction *)0);
+		sigaction(SIGTSTP, &sa, NULL);
+		sigaction(SIGHUP, &sa, NULL);
 
 		if ((fd = open(_PATH_CONSOLE, O_RDWR)) == -1)
 		    warning("can't open %s: %m", _PATH_CONSOLE);
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index 571a051..9453be8 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -118,11 +118,11 @@ struct mntopt mopts[] = {
 
 struct nfs_args nfsdefargs = {
 	NFS_ARGSVERSION,
-	(struct sockaddr *)0,
+	NULL,
 	sizeof (struct sockaddr_in),
 	SOCK_DGRAM,
 	0,
-	(u_char *)0,
+	NULL,
 	0,
 	NFSMNT_RESVPORT,
 	NFS_WSIZE,
@@ -134,7 +134,7 @@ struct nfs_args nfsdefargs = {
 	NFS_DEFRAHEAD,
 	0,
 	NFS_DEADTHRESH,
-	(char *)0,
+	NULL,
 	/* args version 4 */
 	NFS_MINATTRTIMO,
 	NFS_MAXATTRTIMO,
@@ -538,7 +538,7 @@ main(int argc, char **argv)
 			 */
 			if (kret == KSUCCESS &&
 			    ktick.kt.length <= (RPCAUTH_MAXSIZ-3*NFSX_UNSIGNED)
-			    && gettimeofday(&ktv, (struct timezone *)0) == 0) {
+			    && gettimeofday(&ktv, NULL) == 0) {
 			    ncd.ncd_authtype = RPCAUTH_KERB4;
 			    ncd.ncd_authstr = (u_char *)&ktick;
 			    ncd.ncd_authlen = nfsm_rndup(ktick.kt.length) +
diff --git a/sbin/mount_portal/pt_tcplisten.c b/sbin/mount_portal/pt_tcplisten.c
index 522cfc7..68256e9 100644
--- a/sbin/mount_portal/pt_tcplisten.c
+++ b/sbin/mount_portal/pt_tcplisten.c
@@ -157,7 +157,7 @@ portal_tcplisten(struct portal_cred *pcr, char *key, char **v, int kso,
                sain.sin_addr.s_addr = INADDR_ANY;
                if (bind(so, (struct sockaddr *) &sain, sizeof(sain)) == 0) {
                        listen(so, 1);
-                       if ((sock = accept(so, (struct sockaddr *)0, (int *)0)) == -1) {
+                       if ((sock = accept(so, NULL, NULL)) == -1) {
                                syslog(LOG_ERR, "accept: %m");
                                close(so);
                                return (errno);
@@ -184,7 +184,7 @@ portal_tcplisten(struct portal_cred *pcr, char *key, char **v, int kso,
                sain.sin_addr = *ipp[0];
                if (bind(so, (struct sockaddr *) &sain, sizeof(sain)) == 0) {
                        listen(so, 1);
-                       if ((sock = accept(so, (struct sockaddr *)0, (int *)0)) == -1) {
+                       if ((sock = accept(so, NULL, NULL)) == -1) {
                                syslog(LOG_ERR, "accept: %m");
                                close(so);
                                return (errno);
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index bf96ada..7835557 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -267,7 +267,7 @@ chkquota(char *fsname, char *mntpt, struct quotaname *qnp)
 				continue;
 			if (qnp->flags & HASGRP) {
 				fup = addid((u_long)dp->di_gid, GRPQUOTA,
-				    (char *)0);
+				    NULL);
 				fup->fu_curinodes++;
 				if (mode == IFREG || mode == IFDIR ||
 				    mode == IFLNK)
@@ -275,7 +275,7 @@ chkquota(char *fsname, char *mntpt, struct quotaname *qnp)
 			}
 			if (qnp->flags & HASUSR) {
 				fup = addid((u_long)dp->di_uid, USRQUOTA,
-				    (char *)0);
+				    NULL);
 				fup->fu_curinodes++;
 				if (mode == IFREG || mode == IFDIR ||
 				    mode == IFLNK)
diff --git a/sbin/restore/main.c b/sbin/restore/main.c
index 4bcc368..1f665d1 100644
--- a/sbin/restore/main.c
+++ b/sbin/restore/main.c
@@ -209,7 +209,7 @@ main(int argc, char **argv)
 			 * This is a level zero dump tape.
 			 */
 			vprintf(stdout, "Begin level 0 restore\n");
-			initsymtable((char *)0);
+			initsymtable(NULL);
 			extractdirs(1);
 			vprintf(stdout, "Calculate extraction list.\n");
 			treescan(".", ROOTINO, nodeupdates);
@@ -243,7 +243,7 @@ main(int argc, char **argv)
 	case 't':
 		setup();
 		extractdirs(0);
-		initsymtable((char *)0);
+		initsymtable(NULL);
 		while (argc--) {
 			canon(*argv++, name, sizeof(name));
 			ino = dirlookup(name);
@@ -258,7 +258,7 @@ main(int argc, char **argv)
 	case 'x':
 		setup();
 		extractdirs(1);
-		initsymtable((char *)0);
+		initsymtable(NULL);
 		while (argc--) {
 			canon(*argv++, name, sizeof(name));
 			ino = dirlookup(name);
diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c
index f98727c..cd3880d 100644
--- a/sbin/slattach/slattach.c
+++ b/sbin/slattach/slattach.c
@@ -72,7 +72,7 @@ static void acquire_line(void);		/* get tty device as controlling terminal */
 static void usage(void);
 
 int	fd = -1;
-char	*dev = (char *)0;	/* path name of the tty (e.g. /dev/tty01) */
+char	*dev = NULL;	/* path name of the tty (e.g. /dev/tty01) */
 char    *dvname;                /* basename of dev */
 int     locked = 0;             /* uucp lock active */
 int	flow_control = 0;	/* non-zero to enable hardware flow control. */
@@ -174,7 +174,7 @@ main(int argc, char **argv)
 	    warnx("too many args, first='%s'", argv[optind]);
 	if (optind > (argc - 1))
 	    warnx("not enough args");
-	if (dev == (char *)0) {
+	if (dev == NULL) {
 		usage();
 		exit_handler(2);
 	}
diff --git a/share/man/man4/ifmib.4 b/share/man/man4/ifmib.4
index 009c67a..4e3b167 100644
--- a/share/man/man4/ifmib.4
+++ b/share/man/man4/ifmib.4
@@ -110,7 +110,7 @@ get_ifmib_general(int row, struct ifmibdata *ifmd)
 
 	len = sizeof(*ifmd);
 
-	return sysctl(name, 6, ifmd, &len, (void *)0, 0);
+	return sysctl(name, 6, ifmd, &len, NULL, 0);
 }
 .Ed
 .Pp
diff --git a/share/man/man4/ttcp.4 b/share/man/man4/ttcp.4
index 11331c4..cf5f5ea 100644
--- a/share/man/man4/ttcp.4
+++ b/share/man/man4/ttcp.4
@@ -195,7 +195,7 @@ phase would ordinarily have included a call to
 .Fn write ,
 one substitutes:
 .Pp
-.Dl "sendto(sock, buf, len, MSG_EOF, (struct sockaddr *)0, 0)"
+.Dl "sendto(sock, buf, len, MSG_EOF, NULL, 0)"
 .Pp
 In this case, the reply is sent immediately, but as in the client
 case, the socket is no longer useful for anything and should be
diff --git a/sys/conf/nfsswapkernel.c b/sys/conf/nfsswapkernel.c
index 28833c5..7161369 100644
--- a/sys/conf/nfsswapkernel.c
+++ b/sys/conf/nfsswapkernel.c
@@ -67,8 +67,8 @@ struct nfs_diskless nfs_diskless = {
  	},
 	{ 0x10, 0x2, { 0x0, 0x0, 0x83, 0x68, 0x30, 0x12, } },
 	{
-	  (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
-	  0, 8192, 8192, 10, 100, (char *)0,
+	  NULL, SOCK_DGRAM, 0, NULL,
+	  0, 8192, 8192, 10, 100, NULL,
 	},
 	{
 		0xf,
@@ -107,8 +107,8 @@ struct nfs_diskless nfs_diskless = {
 	{ 0x10, 0x2, { 0x8, 0x1, 0x83, 0x68, 0x30, 0x5, } },
 	"happy",
 	{
-	  (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
-	  0, 8192, 8192, 10, 100, (char *)0,
+	  NULL, SOCK_DGRAM, 0, NULL,
+	  0, 8192, 8192, 10, 100, NULL,
 	},
 	{
 		0x0,
diff --git a/sys/crypto/sha2/sha2.c b/sys/crypto/sha2/sha2.c
index c8507ab..e53edd3 100644
--- a/sys/crypto/sha2/sha2.c
+++ b/sys/crypto/sha2/sha2.c
@@ -319,7 +319,7 @@ static const char *sha2_hex_digits = "0123456789abcdef";
 
 /*** SHA-256: *********************************************************/
 void SHA256_Init(SHA256_CTX* context) {
-	if (context == (SHA256_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	bcopy(sha256_initial_hash_value, context->state, SHA256_DIGEST_LENGTH);
@@ -511,7 +511,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
 	}
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
+	assert(context != NULL && data != NULL);
 
 	usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
 	if (usedspace > 0) {
@@ -555,10 +555,10 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
 	unsigned int	usedspace;
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
 #if BYTE_ORDER == LITTLE_ENDIAN
 		/* Convert FROM host byte order */
@@ -618,9 +618,9 @@ char *SHA256_End(SHA256_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA256_Final(digest, context);
 
 		for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
@@ -647,7 +647,7 @@ char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_S
 
 /*** SHA-512: *********************************************************/
 void SHA512_Init(SHA512_CTX* context) {
-	if (context == (SHA512_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	bcopy(sha512_initial_hash_value, context->state, SHA512_DIGEST_LENGTH);
@@ -833,7 +833,7 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
 	}
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
+	assert(context != NULL && data != NULL);
 
 	usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
 	if (usedspace > 0) {
@@ -917,10 +917,10 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
 	sha2_word64	*d = (sha2_word64*)digest;
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		SHA512_Last(context);
 
 		/* Save the hash data for output: */
@@ -947,9 +947,9 @@ char *SHA512_End(SHA512_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA512_Final(digest, context);
 
 		for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
@@ -976,7 +976,7 @@ char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_S
 
 /*** SHA-384: *********************************************************/
 void SHA384_Init(SHA384_CTX* context) {
-	if (context == (SHA384_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	bcopy(sha384_initial_hash_value, context->state, SHA512_DIGEST_LENGTH);
@@ -992,10 +992,10 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
 	sha2_word64	*d = (sha2_word64*)digest;
 
 	/* Sanity check: */
-	assert(context != (SHA384_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		SHA512_Last((SHA512_CTX*)context);
 
 		/* Save the hash data for output: */
@@ -1022,9 +1022,9 @@ char *SHA384_End(SHA384_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA384_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA384_Final(digest, context);
 
 		for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 8425c91..becb3b2 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -238,7 +238,7 @@ db_command(struct command **last_cmdp, struct command *cmd_table,
 	    modif[0] = '\0';
 	}
 	else if (t == tEXCL) {
-	    db_fncall((db_expr_t)0, (boolean_t)0, (db_expr_t)0, (char *)0);
+	    db_fncall((db_expr_t)0, (boolean_t)0, (db_expr_t)0, NULL);
 	    return;
 	}
 	else if (t != tIDENT) {
@@ -373,7 +373,7 @@ static struct command db_show_all_cmds[] = {
 	{ "threads",	db_show_all_threads,	0,	0 },
 #endif
 	{ "procs",	db_ps,			0,	0 },
-	{ (char *)0 }
+	{ NULL }
 };
 
 static struct command db_show_cmds[] = {
@@ -386,7 +386,7 @@ static struct command db_show_cmds[] = {
 #if 0
 	{ "port",	ipc_port_print,		0,	0 },
 #endif
-	{ (char *)0, }
+	{ NULL, }
 };
 
 static struct command db_command_table[] = {
@@ -419,7 +419,7 @@ static struct command db_command_table[] = {
 	{ "ps",		db_ps,			0,	0 },
 	{ "gdb",	db_gdb,			0,	0 },
 	{ "reset",	db_reset,		0,	0 },
-	{ (char *)0, }
+	{ NULL, }
 };
 
 static struct command	*db_last_command = 0;
diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c
index fe48a62..ca27e93 100644
--- a/sys/ddb/db_input.c
+++ b/sys/ddb/db_input.c
@@ -343,14 +343,14 @@ db_check_interrupt(void)
 		return;
 
 	    case CTRL('c'):
-		db_error((char *)0);
+		db_error(NULL);
 		/*NOTREACHED*/
 
 	    case CTRL('s'):
 		do {
 		    c = cnmaygetc();
 		    if (c == CTRL('c'))
-			db_error((char *)0);
+			db_error(NULL);
 		} while (c != CTRL('q'));
 		break;
 
diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c
index f886901..04c6a88 100644
--- a/sys/ddb/db_variables.c
+++ b/sys/ddb/db_variables.c
@@ -47,10 +47,10 @@ static int	db_set_variable (db_expr_t value);
 #endif
 
 static struct db_variable db_vars[] = {
-	{ "radix",	&db_radix, FCN_NULL },
-	{ "maxoff",	&db_maxoff, FCN_NULL },
-	{ "maxwidth",	&db_max_width, FCN_NULL },
-	{ "tabstops",	&db_tab_stop_width, FCN_NULL },
+	{ "radix",	&db_radix, NULL },
+	{ "maxoff",	&db_maxoff, NULL },
+	{ "maxwidth",	&db_max_width, NULL },
+	{ "tabstops",	&db_tab_stop_width, NULL },
 };
 static struct db_variable *db_evars = 
 		db_vars + sizeof(db_vars)/sizeof(db_vars[0]);
@@ -113,7 +113,7 @@ db_read_variable(struct db_variable *vp, db_expr_t *valuep)
 {
 	db_varfcn_t	*func = vp->fcn;
 
-	if (func == FCN_NULL)
+	if (func == NULL)
 	    *valuep = *(vp->valuep);
 	else
 	    (*func)(vp, valuep, DB_VAR_GET);
@@ -124,7 +124,7 @@ db_write_variable(struct db_variable *vp, db_expr_t *valuep)
 {
 	db_varfcn_t	*func = vp->fcn;
 
-	if (func == FCN_NULL)
+	if (func == NULL)
 	    *(vp->valuep) = *valuep;
 	else
 	    (*func)(vp, valuep, DB_VAR_SET);
diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h
index 4af6017..808e7e2 100644
--- a/sys/ddb/db_variables.h
+++ b/sys/ddb/db_variables.h
@@ -56,8 +56,6 @@ struct db_variable {
 #define DB_VAR_GET	0
 #define DB_VAR_SET	1
 
-#define	FCN_NULL	((db_varfcn_t *)0)
-
 #ifdef _KERNEL
 
 extern struct db_variable	db_regs[];	/* machine registers */
diff --git a/sys/dev/disk/nata/ata-raid.c b/sys/dev/disk/nata/ata-raid.c
index 36b0f5c..1d50afe 100644
--- a/sys/dev/disk/nata/ata-raid.c
+++ b/sys/dev/disk/nata/ata-raid.c
@@ -261,7 +261,7 @@ ata_raid_flush(struct ar_softc *rdp, struct bio *bp)
     int disk, error;
 
     error = 0;
-    bp->bio_driver_info = (void *)0;
+    bp->bio_driver_info = NULL;
 
     for (disk = 0; disk < rdp->total_disks; disk++) {
 	if ((dev = rdp->disks[disk].dev) != NULL)
diff --git a/sys/dev/netif/sr/if_sr.c b/sys/dev/netif/sr/if_sr.c
index 3ac584f..5ad77fb 100644
--- a/sys/dev/netif/sr/if_sr.c
+++ b/sys/dev/netif/sr/if_sr.c
@@ -2459,7 +2459,7 @@ sr_modemck(void *arg)
 	for (card = 0; card < NSR; card++) {
 		hc = &sr_hardc[card];
 
-		if (hc->sc == (void *)0)
+		if (hc->sc == NULL)
 			continue;
 
 		Card[cards++] = hc;
diff --git a/sys/dev/netif/wl/if_wl.c b/sys/dev/netif/wl/if_wl.c
index 985f297..cbb00f1 100644
--- a/sys/dev/netif/wl/if_wl.c
+++ b/sys/dev/netif/wl/if_wl.c
@@ -1139,7 +1139,7 @@ wlread(struct wl_softc *sc, u_short fd_p)
 	if (!(bytes_in_mbuf -= bytes)) {
 	    MGET(tm->m_next, MB_DONTWAIT, MT_DATA);
 	    tm = tm->m_next;
-	    if (tm == (struct mbuf *)0) {
+	    if (tm == NULL) {
 		m_freem(m);
 		if_printf(ifp, "read(): No mbuf nth\n");
 		if (wlhwrst(sc) != TRUE) {
@@ -1843,7 +1843,7 @@ wlxmt(struct wl_softc *sc, struct mbuf *m)
 	    outw(PIOR0(base), tbd_p);  /* address of act_count */
 	    outw(PIOP0(base), inw(PIOP0(base)) + count);
 	    xmtdata_p += len;
-	    if ((tm_p = tm_p->m_next) == (struct mbuf *)0)
+	    if ((tm_p = tm_p->m_next) == NULL)
 		break;
 	    if (count & 1) {
 		/* go to the next descriptor */
@@ -1870,7 +1870,7 @@ wlxmt(struct wl_softc *sc, struct mbuf *m)
 		    continue;
 		}
 	    }
-	} else if ((tm_p = tm_p->m_next) == (struct mbuf *)0)
+	} else if ((tm_p = tm_p->m_next) == NULL)
 	    break;
 	count = tm_p->m_len;
 	mb_p = mtod(tm_p, u_char *);
@@ -2327,8 +2327,8 @@ wlhdwsleaze(u_short *countp, u_char **mb_pp, struct mbuf **tm_pp)
 	count += tm_p->m_len;
 	if (tm_p->m_len & 1)
 	    break;
-    } while ((tm_p = tm_p->m_next) != (struct mbuf *)0);
-    if ( (tm_p == (struct mbuf *)0) ||
+    } while ((tm_p = tm_p->m_next) != NULL);
+    if ( (tm_p == NULL) ||
 	 count > HDW_THRESHOLD) {
 	*countp = (*tm_pp)->m_len;
 	*mb_pp = mtod((*tm_pp), u_char *);
@@ -2346,7 +2346,7 @@ wlhdwsleaze(u_short *countp, u_char **mb_pp, struct mbuf **tm_pp)
 	if (count > HDW_THRESHOLD)
 			break;
 	cp += len;
-	if (tm_p->m_next == (struct mbuf *)0)
+	if (tm_p->m_next == NULL)
 	    break;
 	tm_p = tm_p->m_next;
     }
@@ -2368,7 +2368,7 @@ wlsftwsleaze(u_short *countp, u_char **mb_pp, struct mbuf **tm_pp)
 	bcopy(mtod(tm_p, u_char *), cp, len = tm_p->m_len);
 	count += len;
 	cp += len;
-	if (tm_p->m_next == (struct mbuf *)0)
+	if (tm_p->m_next == NULL)
 	    break;
 	tm_p = tm_p->m_next;
     }
diff --git a/sys/dev/serial/rp/rpreg.h b/sys/dev/serial/rp/rpreg.h
index e3673b5..1c8dc50 100644
--- a/sys/dev/serial/rp/rpreg.h
+++ b/sys/dev/serial/rp/rpreg.h
@@ -141,7 +141,6 @@ typedef unsigned int DWordIO_t;
 
 #define NULLDEV -1		    /* identifies non-existant device */
 #define NULLCTL -1		    /* identifies non-existant controller */
-#define NULLCTLPTR (CONTROLLER_T *)0 /* identifies non-existant controller */
 #define NULLAIOP -1		    /* identifies non-existant AIOP */
 #define NULLCHAN -1		    /* identifies non-existant channel */
 
@@ -786,7 +785,7 @@ Comments: This function must be called once for every channel structure
 */
 #define sInitChanDefaults(ChP) \
 { \
-   (ChP)->CtlP = NULLCTLPTR; \
+   (ChP)->CtlP = NULL; \
    (ChP)->AiopNum = NULLAIOP; \
    (ChP)->ChanID = AIOPID_NULL; \
    (ChP)->ChanNum = NULLCHAN; \
diff --git a/sys/dev/serial/stl/stallion.c b/sys/dev/serial/stl/stallion.c
index 71a2da0..06e5111 100644
--- a/sys/dev/serial/stl/stallion.c
+++ b/sys/dev/serial/stl/stallion.c
@@ -1781,7 +1781,7 @@ void stlintr(void *arg)
 
 static void stlpciintr(void *arg)
 {
-	stlintr((void *)0);
+	stlintr(NULL);
 }
 
 #endif
diff --git a/sys/dev/video/meteor/meteor.c b/sys/dev/video/meteor/meteor.c
index 2fb6c5a..a475f13 100644
--- a/sys/dev/video/meteor/meteor.c
+++ b/sys/dev/video/meteor/meteor.c
@@ -524,7 +524,7 @@ met_probe (pcici_t tag, pcidi_t type)
 	case SAA7116_PHILIPS_ID:	/* meteor */
 		return("Philips SAA 7116");
 	};
-	return ((char *)0);
+	return (NULL);
 }
 
 	/* interrupt handling routine 
@@ -1177,7 +1177,7 @@ meteor_open(struct dev_open_args *ap)
 	mtr->frames_captured = 0;
 	mtr->even_fields_captured = 0;
 	mtr->odd_fields_captured = 0;
-	mtr->proc = (struct proc *)0;
+	mtr->proc = NULL;
 	set_fps(mtr, 30);
 #ifdef METEOR_TEST_VIDEO
 	mtr->video.addr = 0;
@@ -1216,7 +1216,7 @@ meteor_close(struct dev_close_args *ap)
 	 */
 	mtr->base->cap_cntl = 0x8ff0;
 	mtr->flags &= ~(METEOR_CAP_MASK|METEOR_WANT_MASK);
-	mtr->proc = (struct proc *)0;
+	mtr->proc = NULL;
 
 #ifdef METEOR_DEALLOC_PAGES
 	if (mtr->bigbuf != NULL) {
@@ -1388,7 +1388,7 @@ meteor_ioctl(struct dev_ioctl_args *ap)
 		if (mtr->signal) {
 		  mtr->proc = curproc;	/* might be NULL */
 		} else {
-		  mtr->proc = (struct proc *)0;
+		  mtr->proc = NULL;
 		}
 		break;
 	case METEORGSIGNAL:
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index dc3b4f1..14f9d36 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -261,7 +261,7 @@ acct_process(struct proc *p)
 	 */
 	return (vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
 	    (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred,
-	    (int *)0));
+	    NULL));
 }
 
 /*
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 732659d..3589400 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1126,7 +1126,7 @@ sys_setlogin(struct setlogin_args *uap)
 	if ((error = priv_check_cred(p->p_ucred, PRIV_ROOT, PRISON_ROOT)))
 		return (error);
 	error = copyinstr((caddr_t) uap->namebuf, (caddr_t) logintmp,
-	    sizeof(logintmp), (size_t *)0);
+	    sizeof(logintmp), NULL);
 	if (error == ENAMETOOLONG)
 		error = EINVAL;
 	else if (!error)
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 02129a6..c07e82f 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1375,7 +1375,7 @@ m_adj(struct mbuf *mp, int req_len)
 		count = 0;
 		for (;;) {
 			count += m->m_len;
-			if (m->m_next == (struct mbuf *)0)
+			if (m->m_next == NULL)
 				break;
 			m = m->m_next;
 		}
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index cd2d27c..76bfdc6 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -613,7 +613,7 @@ restart:
 				   top == NULL ? M_PKTHDR : 0, &mlen);
 			if (top == NULL) {
 				m->m_pkthdr.len = 0;
-				m->m_pkthdr.rcvif = (struct ifnet *)0;
+				m->m_pkthdr.rcvif = NULL;
 			}
 			len = min(min(mlen, resid), space);
 			if (resid < MINCLSIZE) {
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index adb6390..ac6c1e1 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -233,7 +233,7 @@ sonewconn(struct socket *head, int connstatus)
 	struct pru_attach_info ai;
 
 	if (head->so_qlen > 3 * head->so_qlimit / 2)
-		return ((struct socket *)0);
+		return (NULL);
 	so = soalloc(1);
 	if (so == NULL)
 		return (NULL);
@@ -254,7 +254,7 @@ sonewconn(struct socket *head, int connstatus)
 	    /* Directly call function since we're already at protocol level. */
 	    (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, &ai)) {
 		sodealloc(so);
-		return ((struct socket *)0);
+		return (NULL);
 	}
 
 	if (connstatus) {
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5c31d01..de1c93a 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1496,7 +1496,7 @@ db_show_locked_vnodes(struct mount *mp, void *data __unused)
 
 	TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
 		if (vn_islocked(vp))
-			vprint((char *)0, vp);
+			vprint(NULL, vp);
 	}
 	return(0);
 }
@@ -1833,7 +1833,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep,
 		MALLOC(nfs_pub.np_index, char *, namelen, M_TEMP,
 		    M_WAITOK);
 		error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
-		    namelen, (size_t *)0);
+		    namelen, NULL);
 		if (!error) {
 			/*
 			 * Check for illegal filenames.
diff --git a/sys/libkern/divdi3.c b/sys/libkern/divdi3.c
index dd184d2..084d931 100644
--- a/sys/libkern/divdi3.c
+++ b/sys/libkern/divdi3.c
@@ -58,6 +58,6 @@ __divdi3(quad_t a, quad_t b)
 		ub = -(u_quad_t)b, neg ^= 1;
 	else
 		ub = b;
-	uq = __qdivrem(ua, ub, (u_quad_t *)0);
+	uq = __qdivrem(ua, ub, NULL);
 	return (neg ? -uq : uq);
 }
diff --git a/sys/libkern/udivdi3.c b/sys/libkern/udivdi3.c
index 68b1387..e69be04 100644
--- a/sys/libkern/udivdi3.c
+++ b/sys/libkern/udivdi3.c
@@ -47,5 +47,5 @@ u_quad_t
 __udivdi3(u_quad_t a, u_quad_t b)
 {
 
-	return (__qdivrem(a, b, (u_quad_t *)0));
+	return (__qdivrem(a, b, NULL));
 }
diff --git a/sys/net/i4b/driver/i4b_ing.c b/sys/net/i4b/driver/i4b_ing.c
index beac90a..e0f434a 100644
--- a/sys/net/i4b/driver/i4b_ing.c
+++ b/sys/net/i4b/driver/i4b_ing.c
@@ -32,7 +32,7 @@
  *
  *	last edit-date: [Tue Jan  1 10:43:58 2002]
  *
- *---------------------------------------------------------------------------*/ 
+ *---------------------------------------------------------------------------*/
 
 #include "use_i4bing.h"
 
@@ -84,7 +84,7 @@ struct ing_softc {
 	struct ifqueue  sc_fastq;	/* interactive traffic		*/
 	int		sc_dialresp;	/* dialresponse			*/
 	int		sc_lastdialresp;/* last dialresponse		*/
-	
+
 #if I4BINGACCT
 	struct callout	sc_timeout;
 	int		sc_iinb;	/* isdn driver # of inbytes	*/
@@ -94,18 +94,18 @@ struct ing_softc {
 	int		sc_linb;	/* last # of bytes rx'd		*/
 	int		sc_loutb;	/* last # of bytes tx'd 	*/
 	int		sc_fn;		/* flag, first null acct	*/
-#endif	
+#endif
 
 	int		sc_inpkt;	/* incoming packets		*/
-	int		sc_outpkt;	/* outgoing packets		*/	
+	int		sc_outpkt;	/* outgoing packets		*/
 
 	struct ifqueue  xmitq_hipri;    /* hi-priority transmit queue */
 	struct ifqueue  xmitq;	  /* transmit queue */
-		
+
 	node_p		node;		/* back pointer to node */
 	char		nodename[NG_NODESIZ]; /* store our node name */
 	hook_p  	debughook;
-	hook_p  	hook;	
+	hook_p  	hook;
 
 	u_int   	packets_in;	/* packets in from downstream */
 	u_int   	packets_out;	/* packets out towards downstream */
@@ -237,19 +237,19 @@ i4bingattach(void *dummy)
 	int ret;
 
 	kprintf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4BING);
-	
+
 	for(i=0; i < NI4BING; sc++, i++)
 	{
 		sc->sc_unit = i;
-		
+
 		ing_init_linktab(i);
 
 		NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
 
 		sc->sc_state = ST_IDLE;
-		
+
 		sc->sc_fastq.ifq_maxlen = I4BINGMAXQLEN;
-		
+
 #if I4BINGACCT
 		callout_init(&sc->sc_timeout);
 		sc->sc_iinb = 0;
@@ -262,13 +262,13 @@ i4bingattach(void *dummy)
 #endif
 
 		sc->sc_inpkt = 0;
-		sc->sc_outpkt = 0;		
+		sc->sc_outpkt = 0;
 
 		sc->sc_updown = SOFT_ENA;	/* soft enabled */
 
 		sc->sc_dialresp = DSTAT_NONE;	/* no response */
 		sc->sc_lastdialresp = DSTAT_NONE;
-		
+
 		/* setup a netgraph node */
 
 		if ((ret = ng_make_node_common(&typestruct, &sc->node)))
@@ -280,7 +280,7 @@ i4bingattach(void *dummy)
 
 		sc->xmitq.ifq_maxlen = IFQ_MAXLEN;
 		sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN;
-				
+
 		/* name the netgraph node */
 
 		ksprintf(sc->nodename, "%s%d", NG_ING_NODE_TYPE, sc->sc_unit);
@@ -303,15 +303,15 @@ ing_timeout(struct ing_softc *sc)
 	bchan_statistics_t bs;
 	int unit = sc->sc_unit;
 
-	/* get # of bytes in and out from the HSCX driver */ 
-	
+	/* get # of bytes in and out from the HSCX driver */
+
 	(*isdn_linktab[unit]->bch_stat)
 		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
 
 	sc->sc_ioutb += bs.outbytes;
 	sc->sc_iinb += bs.inbytes;
-	
-	if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) 
+
+	if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
 	{
 		int ri = (sc->sc_iinb - sc->sc_linb)/I4BINGACCTINTVL;
 		int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BINGACCTINTVL;
@@ -320,7 +320,7 @@ ing_timeout(struct ing_softc *sc)
 			sc->sc_fn = 0;
 		else
 			sc->sc_fn = 1;
-			
+
 		sc->sc_linb = sc->sc_iinb;
 		sc->sc_loutb = sc->sc_ioutb;
 
@@ -342,7 +342,7 @@ ingclearqueue(struct ifqueue *iq)
 {
 	int x;
 	struct mbuf *m;
-	
+
 	for(;;)
 	{
 		crit_enter();
@@ -354,7 +354,7 @@ ingclearqueue(struct ifqueue *iq)
 		else
 			break;
 	}
-}	
+}
 #endif
 
 /*===========================================================================*
@@ -376,8 +376,8 @@ ing_connect(int unit, void *cdp)
 	NDBGL4(L4_DIALST, "ing%d: setting dial state to ST_CONNECTED", unit);
 
 	sc->sc_dialresp = DSTAT_NONE;
-	sc->sc_lastdialresp = DSTAT_NONE;	
-	
+	sc->sc_lastdialresp = DSTAT_NONE;
+
 #if I4BINGACCT
 	sc->sc_iinb = 0;
 	sc->sc_ioutb = 0;
@@ -390,10 +390,10 @@ ing_connect(int unit, void *cdp)
 #endif
 
 	sc->sc_state = ST_CONNECTED;
-	
+
 	crit_exit();
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from L4 handler at disconnect time
  *---------------------------------------------------------------------------*/
@@ -418,13 +418,13 @@ ing_disconnect(int unit, void *cdp)
 
 	i4b_l4_accounting(BDRV_ING, cd->driver_unit, ACCT_FINAL,
 		 sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-	
-	sc->sc_cdp = (call_desc_t *)0;	
+
+	sc->sc_cdp = NULL;
 
 	NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
 
 	sc->sc_dialresp = DSTAT_NONE;
-	sc->sc_lastdialresp = DSTAT_NONE;	
+	sc->sc_lastdialresp = DSTAT_NONE;
 
 	sc->sc_state = ST_IDLE;
 }
@@ -448,7 +448,7 @@ ing_dialresponse(int unit, int status, cause_t cause)
 /*		ingclearqueues(sc); */
 	}
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	interface soft up/down
  *---------------------------------------------------------------------------*/
@@ -458,7 +458,7 @@ ing_updown(int unit, int updown)
 	struct ing_softc *sc = &ing_softc[unit];
 	sc->sc_updown = updown;
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from the HSCX interrupt handler
  *	when a new frame (mbuf) has been received and was put on
@@ -470,7 +470,7 @@ ing_rx_data_rdy(int unit)
 {
 	struct ing_softc *sc = &ing_softc[unit];
 	struct mbuf *m;
-	
+
 	if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
 		return;
 
@@ -481,7 +481,7 @@ ing_rx_data_rdy(int unit)
 	m->m_pkthdr.rcvif = NULL;
 
 	sc->sc_inpkt++;
-	
+
 	ng_queue_data(sc->hook, m, NULL);
 }
 
@@ -499,7 +499,7 @@ ing_tx_queue_empty(int unit)
 
 	if(sc->sc_state != ST_CONNECTED)
 		return;
-		
+
 	for(;;)
 	{
 		IF_DEQUEUE(&sc->xmitq_hipri, m);
@@ -510,7 +510,7 @@ ing_tx_queue_empty(int unit)
 			if(m == NULL)
 				break;
 		}
-	
+
 #if I4BINGACCT
 		sc->sc_outb += m->m_pkthdr.len;
 #endif
@@ -574,7 +574,7 @@ ing_init_linktab(int unit)
 	ing_drvr_linktab[unit].line_connected = ing_connect;
 	ing_drvr_linktab[unit].line_disconnected = ing_disconnect;
 	ing_drvr_linktab[unit].dial_response = ing_dialresponse;
-	ing_drvr_linktab[unit].updown_ind = ing_updown;	
+	ing_drvr_linktab[unit].updown_ind = ing_updown;
 }
 
 /*===========================================================================*
@@ -649,7 +649,7 @@ ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
 				char *p;
 				int pos = 0;
 
-				NG_MKRESPONSE(resp, msg, 
+				NG_MKRESPONSE(resp, msg,
 				    sizeof(struct ng_mesg) + NG_TEXTRESPONSE,
 				    M_INTWAIT | M_NULLOK);
 
@@ -679,7 +679,7 @@ ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
 				pos = ksprintf(arg, "state = %s (%d)\n", p, sc->sc_state);
 #if I4BINGACCT
 				pos += ksprintf(arg + pos, "%d bytes in, %d bytes out\n", sc->sc_inb, sc->sc_outb);
-#endif			    
+#endif
 				pos += ksprintf(arg + pos, "%d pkts in, %d pkts out\n", sc->sc_inpkt, sc->sc_outpkt);
 
 				resp->header.arglen = pos + 1;
@@ -699,7 +699,7 @@ ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
 			{
 				struct ngingstat *stats;
 
-				NG_MKRESPONSE(resp, msg, sizeof(*stats), 
+				NG_MKRESPONSE(resp, msg, sizeof(*stats),
 				    M_INTWAIT | M_NULLOK);
 
 				if (!resp)
@@ -754,13 +754,13 @@ ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
 {
 	struct ing_softc *sc = hook->node->private;
 	struct ifqueue  *xmitq_p;
-	
+
 	if(hook->private == NULL)
 	{
 		NG_FREE_DATA(m, meta);
 		return(ENETDOWN);
 	}
-	
+
 	if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING)
 	{
 		i4b_l4_dialout(BDRV_ING, sc->sc_unit);
@@ -768,7 +768,7 @@ ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
 	}
 
 	sc->sc_outpkt++;
-	
+
        /*
 	* Now queue the data for when it can be sent
 	*/
@@ -839,7 +839,7 @@ static int
 ng_ing_disconnect(hook_p hook)
 {
 	struct ing_softc *sc = hook->node->private;
-	
+
 	if(hook->private == NULL) {
 		sc->debughook = NULL;
 	}
diff --git a/sys/net/i4b/driver/i4b_ipr.c b/sys/net/i4b/driver/i4b_ipr.c
index 2333f6f..a307c2f 100644
--- a/sys/net/i4b/driver/i4b_ipr.c
+++ b/sys/net/i4b/driver/i4b_ipr.c
@@ -55,7 +55,7 @@
  *	sc->sc_inb		# of incoming bytes after decompression
  *	sc->sc_outb		# of outgoing bytes before compression
  *
- *---------------------------------------------------------------------------*/ 
+ *---------------------------------------------------------------------------*/
 
 #include "use_i4bipr.h"
 
@@ -88,7 +88,7 @@
 #include <netinet/ip.h>
 
 #ifdef IPR_VJ
-#include <net/slcompress.h>       
+#include <net/slcompress.h>
 #define IPR_COMPRESS IFF_LINK0  /* compress TCP traffic */
 #define IPR_AUTOCOMP IFF_LINK1  /* auto-enable TCP compression */
 
@@ -100,7 +100,7 @@
  * CAUTION: i have re-defined IPR_VJ_USEBUFFER because it makes problems
  *          with 2 i4b's back to back running cvs over ssh, cvs simply
  *          aborts because it gets bad data. Everything else (telnet/ftp?etc)
- *          functions fine. 
+ *          functions fine.
  *---------------------------------------------------------------------------*/
 #define IPR_VJ_USEBUFFER	/* define to use an allocated separate buffer*/
 				/* undef to uncompress in the mbuf itself    */
@@ -149,7 +149,7 @@ struct ipr_softc {
 	struct ifqueue  sc_fastq;	/* interactive traffic		*/
 	int		sc_dialresp;	/* dialresponse			*/
 	int		sc_lastdialresp;/* last dialresponse		*/
-	
+
 #if I4BIPRACCT
 	int		sc_iinb;	/* isdn driver # of inbytes	*/
 	int		sc_ioutb;	/* isdn driver # of outbytes	*/
@@ -158,7 +158,7 @@ struct ipr_softc {
 	int		sc_linb;	/* last # of bytes rx'd		*/
 	int		sc_loutb;	/* last # of bytes tx'd 	*/
 	int		sc_fn;		/* flag, first null acct	*/
-#endif	
+#endif
 
 	struct callout	sc_timeout;
 
@@ -217,7 +217,7 @@ i4biprattach(void *dummy)
 #else
 	kprintf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", NI4BIPR);
 #endif
-	
+
 	for(i=0; i < NI4BIPR; sc++, i++)
 	{
 		ipr_init_linktab(i);
@@ -225,7 +225,7 @@ i4biprattach(void *dummy)
 		NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
 
 		sc->sc_state = ST_IDLE;
-		
+
 		if_initname(&(sc->sc_if), "ipr", i);
 
 #ifdef	IPR_VJ
@@ -257,8 +257,8 @@ i4biprattach(void *dummy)
 		sc->sc_if.if_noproto = 0;
 
 #if I4BIPRACCT
-		sc->sc_if.if_timer = 0;	
-		sc->sc_if.if_watchdog = iprwatchdog;	
+		sc->sc_if.if_timer = 0;
+		sc->sc_if.if_watchdog = iprwatchdog;
 		sc->sc_iinb = 0;
 		sc->sc_ioutb = 0;
 		sc->sc_inb = 0;
@@ -282,7 +282,7 @@ i4biprattach(void *dummy)
 		sc->sc_updown = SOFT_ENA;	/* soft enabled */
 		sc->sc_dialresp = DSTAT_NONE;	/* no response */
 		sc->sc_lastdialresp = DSTAT_NONE;
-		
+
 		if_attach(&sc->sc_if, NULL);
 		bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
 	}
@@ -298,14 +298,14 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 	struct ipr_softc *sc;
 	int unit;
 	struct ip *ip;
-	
+
 	crit_enter();
 
 	sc = ifp->if_softc;
 	unit = sc->sc_unit;
 
 	/* check for IP */
-	
+
 	if(dst->sa_family != AF_INET)
 	{
 		kprintf(IPR_FMT "af%d not supported\n", IPR_ARG(sc), dst->sa_family);
@@ -317,7 +317,7 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 	}
 
 	/* check interface state = UP */
-	
+
 	if(!(ifp->if_flags & IFF_UP))
 	{
 		NDBGL4(L4_IPRDBG, "ipr%d: interface is DOWN!", unit);
@@ -328,7 +328,7 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 	}
 
 	/* dial if necessary */
-	
+
 	if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING)
 	{
 
@@ -352,7 +352,7 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 				sc->sc_dialresp = DSTAT_NONE;
 				crit_exit();
 				sc->sc_if.if_oerrors++;
-				return(EHOSTUNREACH);				
+				return(EHOSTUNREACH);
 				break;
 
 			case DSTAT_INONLY:	/* no dialout allowed*/
@@ -362,7 +362,7 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 				sc->sc_dialresp = DSTAT_NONE;
 				crit_exit();
 				sc->sc_if.if_oerrors++;
-				return(EHOSTUNREACH);				
+				return(EHOSTUNREACH);
 				break;
 		}
 #endif
@@ -382,7 +382,7 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 #endif
 
 	/* update access time */
-	
+
 	microtime(&sc->sc_if.if_lastchange);
 
 	/*
@@ -392,9 +392,9 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 	 */
 
 	ip = mtod(m, struct ip *);		/* get ptr to ip header */
-	 
+
 	/* check for space in choosen send queue */
-	
+
 	if (netisr_queue(NETISR_IP, m))
 	{
 		NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit);
@@ -402,9 +402,9 @@ i4biproutput_serialized(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
 		sc->sc_if.if_oerrors++;
 		return(ENOBUFS);
 	}
-	
+
 	NDBGL4(L4_IPRDBG, "ipr%d: add packet to send queue!", unit);
-	
+
 	ipr_tx_queue_empty(unit);
 
 	crit_exit();
@@ -438,7 +438,7 @@ i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data, struct ucred *cr)
 	int error = 0;
 
 	crit_enter();
-	
+
 	switch (cmd)
 	{
 		case SIOCAIFADDR:	/* add interface address */
@@ -472,7 +472,7 @@ i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data, struct ucred *cr)
 			{
 				/* enable debug messages */
 			}
-			
+
 			microtime(&sc->sc_if.if_lastchange);
 			break;
 
@@ -490,7 +490,7 @@ i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data, struct ucred *cr)
 
 #if 0
 	/* not needed for FreeBSD, done in sl_compress_init() (-hm) */
-	
+
 			/* need to add an ioctl:	set VJ max slot ID
 			 * #define IPRIOCSMAXCID	_IOW('I', XXX, int)
 			 */
@@ -546,7 +546,7 @@ iprclearqueues(struct ipr_softc *sc)
 			break;
 	}
 }
-        
+
 #if I4BIPRACCT
 /*---------------------------------------------------------------------------*
  *	watchdog routine
@@ -557,16 +557,16 @@ iprwatchdog(struct ifnet *ifp)
 	struct ipr_softc *sc = ifp->if_softc;
 	int unit = sc->sc_unit;
 	bchan_statistics_t bs;
-	
-	/* get # of bytes in and out from the HSCX driver */ 
-	
+
+	/* get # of bytes in and out from the HSCX driver */
+
 	(*isdn_linktab[unit]->bch_stat)
 		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
 
 	sc->sc_ioutb += bs.outbytes;
 	sc->sc_iinb += bs.inbytes;
-	
-	if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn) 
+
+	if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
 	{
 		int ri = (sc->sc_iinb - sc->sc_linb)/I4BIPRACCTINTVL;
 		int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BIPRACCTINTVL;
@@ -575,14 +575,14 @@ iprwatchdog(struct ifnet *ifp)
 			sc->sc_fn = 0;
 		else
 			sc->sc_fn = 1;
-			
+
 		sc->sc_linb = sc->sc_iinb;
 		sc->sc_loutb = sc->sc_ioutb;
 
 		i4b_l4_accounting(BDRV_IPR, unit, ACCT_DURING,
 			 sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
  	}
-	sc->sc_if.if_timer = I4BIPRACCTINTVL; 	
+	sc->sc_if.if_timer = I4BIPRACCTINTVL;
 }
 #endif /* I4BIPRACCT */
 
@@ -597,7 +597,7 @@ static void
 i4bipr_connect_startio(struct ipr_softc *sc)
 {
 	crit_enter();
-	
+
 	if(sc->sc_state == ST_CONNECTED_W)
 	{
 		sc->sc_state = ST_CONNECTED_A;
@@ -606,7 +606,7 @@ i4bipr_connect_startio(struct ipr_softc *sc)
 
 	crit_exit();
 }
- 
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from L4 handler at connect time
  *---------------------------------------------------------------------------*/
@@ -625,8 +625,8 @@ ipr_connect(int unit, void *cdp)
 	sc->sc_state = ST_CONNECTED_W;
 
 	sc->sc_dialresp = DSTAT_NONE;
-	sc->sc_lastdialresp = DSTAT_NONE;	
-	
+	sc->sc_lastdialresp = DSTAT_NONE;
+
 #if I4BIPRACCT
 	sc->sc_iinb = 0;
 	sc->sc_ioutb = 0;
@@ -677,7 +677,7 @@ ipr_connect(int unit, void *cdp)
 	/* we don't need any negotiation - pass event back right now */
 	i4b_l4_negcomplete(sc->sc_cdp);
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from L4 handler at disconnect time
  *---------------------------------------------------------------------------*/
@@ -706,13 +706,13 @@ ipr_disconnect(int unit, void *cdp)
 
 	i4b_l4_accounting(BDRV_IPR, cd->driver_unit, ACCT_FINAL,
 		 sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-	
-	sc->sc_cdp = (call_desc_t *)0;	
+
+	sc->sc_cdp = NULL;
 
 	NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
 
 	sc->sc_dialresp = DSTAT_NONE;
-	sc->sc_lastdialresp = DSTAT_NONE;	
+	sc->sc_lastdialresp = DSTAT_NONE;
 
 	sc->sc_if.if_flags &= ~IFF_RUNNING;
 	sc->sc_state = ST_IDLE;
@@ -737,7 +737,7 @@ ipr_dialresponse(int unit, int status, cause_t cause)
 		iprclearqueues(sc);
 	}
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	interface soft up/down
  *---------------------------------------------------------------------------*/
@@ -747,7 +747,7 @@ ipr_updown(int unit, int updown)
 	struct ipr_softc *sc = &ipr_softc[unit];
 	sc->sc_updown = updown;
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from the HSCX interrupt handler
  *	when a new frame (mbuf) has been received and was put on
@@ -762,11 +762,11 @@ ipr_rx_data_rdy(int unit)
 #ifdef IPR_VJ
 #ifdef IPR_VJ_USEBUFFER
 	u_char *cp = sc->sc_cbuf;
-#endif	
+#endif
 	int len, c;
 #endif
 	static const uint32_t af = AF_INET;
-	
+
 	if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
 		return;
 
@@ -789,7 +789,7 @@ ipr_rx_data_rdy(int unit)
 	{
 		unsigned char *mp = m->m_data;
 		int i;
-		
+
 		sc->sc_first_pkt = 0;
 
 		for(i = 0; i < m->m_len; i++, mp++)
@@ -798,13 +798,13 @@ ipr_rx_data_rdy(int unit)
 			    ((*mp & 0x0f) >= 0x05) )
 			{
 				m->m_data = mp;
-				m->m_pkthdr.len -= i;				
+				m->m_pkthdr.len -= i;
 				break;
 			}
 		}
 	}
 #endif
-		
+
 	sc->sc_if.if_ipackets++;
 	sc->sc_if.if_ibytes += m->m_pkthdr.len;
 
@@ -818,7 +818,7 @@ ipr_rx_data_rdy(int unit)
 #ifdef IPR_VJ_USEBUFFER
 /* XXX */	m_copydata(m, 0, len, cp);
 #endif
-		
+
 		if(c & 0x80)
 		{
 			c = TYPE_COMPRESSED_TCP;
@@ -828,8 +828,8 @@ ipr_rx_data_rdy(int unit)
 #ifdef IPR_VJ_USEBUFFER
 			*cp &= 0x4f;		/* XXX */
 #else
-			*(mtod(m, u_char *)) &= 0x4f; 			
-#endif			
+			*(mtod(m, u_char *)) &= 0x4f;
+#endif
 		}
 
 		/*
@@ -846,7 +846,7 @@ ipr_rx_data_rdy(int unit)
 #else
 			len = sl_uncompress_tcp((u_char **)&m->m_data, len,
 					(u_int)c, &sc->sc_compr);
-#endif			
+#endif
 
 			if(len <= 0)
 			{
@@ -914,7 +914,7 @@ error:
 	if (netisr_queue(NETISR_IP, m)) {
 		NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit);
 		sc->sc_if.if_ierrors++;
-		sc->sc_if.if_iqdrops++;		
+		sc->sc_if.if_iqdrops++;
 	}
 }
 
@@ -929,14 +929,14 @@ ipr_tx_queue_empty(int unit)
 	static const uint32_t af = AF_INET;
 	struct ipr_softc *sc = &ipr_softc[unit];
 	struct mbuf *m;
-#ifdef	IPR_VJ	
-	struct ip *ip;	
+#ifdef	IPR_VJ
+	struct ip *ip;
 #endif
 	int x = 0;
 
 	if(sc->sc_state != ST_CONNECTED_A)
 		return;
-		
+
 	for(;;)
 	{
                 IF_DEQUEUE(&sc->sc_fastq, m);
@@ -955,12 +955,12 @@ ipr_tx_queue_empty(int unit)
 
 		if (sc->sc_if.if_bpf)
 			bpf_ptap(sc->sc_if.if_bpf, m, &af, sizeof(af));
-	
+
 #if I4BIPRACCT
 		sc->sc_outb += m->m_pkthdr.len;	/* size before compression */
 #endif
 
-#ifdef	IPR_VJ	
+#ifdef	IPR_VJ
 		if((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP)
 		{
 			if(sc->sc_if.if_flags & IPR_COMPRESS)
@@ -1034,7 +1034,7 @@ ipr_init_linktab(int unit)
 	ipr_drvr_linktab[unit].line_connected = ipr_connect;
 	ipr_drvr_linktab[unit].line_disconnected = ipr_disconnect;
 	ipr_drvr_linktab[unit].dial_response = ipr_dialresponse;
-	ipr_drvr_linktab[unit].updown_ind = ipr_updown;	
+	ipr_drvr_linktab[unit].updown_ind = ipr_updown;
 }
 
 /*===========================================================================*/
diff --git a/sys/net/i4b/driver/i4b_isppp.c b/sys/net/i4b/driver/i4b_isppp.c
index a1a044b..43a3af4 100644
--- a/sys/net/i4b/driver/i4b_isppp.c
+++ b/sys/net/i4b/driver/i4b_isppp.c
@@ -12,7 +12,7 @@
  *   2. Redistributions in binary form must reproduce the above copyright
  *      notice, this list of conditions and the following disclaimer in the
  *      documentation and/or other materials provided with the distribution.
- *   
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -66,7 +66,7 @@
 #include <net/sppp/if_sppp.h>
 
 
-#include "use_bpf.h"     
+#include "use_bpf.h"
 #include <sys/time.h>
 #include <net/bpf.h>
 
@@ -82,7 +82,7 @@
 #define	ISPPP_FMT	"%s: "
 #define	ISPPP_ARG(sc)	((sc)->sc_if.if_xname)
 #define IFP2UNIT(ifp)	((struct i4bisppp_softc *)ifp->if_softc)->sc_unit
-		
+
 #  define IOCTL_CMD_T u_long
 
 PDEVSTATIC void i4bispppattach(void *);
@@ -90,7 +90,7 @@ PSEUDO_SET(i4bispppattach, i4b_isppp);
 
 #define I4BISPPPACCT		1	/* enable accounting messages */
 #define	I4BISPPPACCTINTVL	2	/* accounting msg interval in secs */
-#define I4BISPPPDISCDEBUG	1	
+#define I4BISPPPDISCDEBUG	1
 
 #define PPP_HDRLEN   		4	/* 4 octetts PPP header length	*/
 
@@ -181,7 +181,7 @@ i4bispppattach(void *dummy)
 
 	for(i = 0; i < NI4BISPPP; sc++, i++) {
 		i4bisppp_init_linktab(i);
-		
+
 		sc->sc_if.if_softc = sc;
 
 		if_initname(&(sc->sc_if), "isp", i);
@@ -216,8 +216,8 @@ i4bispppattach(void *dummy)
 		sc->sc_if.if_noproto = 0;
 
 #if I4BISPPPACCT
-		sc->sc_if.if_timer = 0;	
-		sc->sc_if.if_watchdog = i4bisppp_watchdog;	
+		sc->sc_if.if_timer = 0;
+		sc->sc_if.if_watchdog = i4bisppp_watchdog;
 		sc->sc_iinb = 0;
 		sc->sc_ioutb = 0;
 		sc->sc_inb = 0;
@@ -333,13 +333,13 @@ i4bisppp_watchdog(struct ifnet *ifp)
 	struct i4bisppp_softc *sc = ifp->if_softc;
 	int unit = IFP2UNIT(ifp);
 	bchan_statistics_t bs;
-	
+
 	(*isdn_linktab[unit]->bch_stat)
 		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
 
 	sc->sc_ioutb += bs.outbytes;
 	sc->sc_iinb += bs.inbytes;
-	
+
 	if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
 	{
 		int ri = (sc->sc_iinb - sc->sc_linb)/I4BISPPPACCTINTVL;
@@ -349,14 +349,14 @@ i4bisppp_watchdog(struct ifnet *ifp)
 			sc->sc_fn = 0;
 		else
 			sc->sc_fn = 1;
-			
+
 		sc->sc_linb = sc->sc_iinb;
 		sc->sc_loutb = sc->sc_ioutb;
 
 		i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_DURING,
 			 sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
  	}
-	sc->sc_if.if_timer = I4BISPPPACCTINTVL; 	
+	sc->sc_if.if_timer = I4BISPPPACCTINTVL;
 
 #if 0 /* old stuff, keep it around */
 	kprintf(ISPPP_FMT "transmit timeout\n", ISPPP_ARG(sc));
@@ -407,8 +407,8 @@ i4bisppp_tlf(struct sppp *sp)
 {
 	struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
 /*	call_desc_t *cd = sc->sc_cdp;	*/
-        struct ifnet *ifp = (struct ifnet *)sp;	
-	
+        struct ifnet *ifp = (struct ifnet *)sp;
+
 	if(sc->sc_state != ST_CONNECTED)
 		return;
 
@@ -426,7 +426,7 @@ static void
 i4bisppp_state_changed(struct sppp *sp, int new_state)
 {
 	struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
-	
+
 	i4b_l4_ifstate_changed(sc->sc_cdp, new_state);
 }
 
@@ -438,7 +438,7 @@ static void
 i4bisppp_negotiation_complete(struct sppp *sp)
 {
 	struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
-	
+
 	i4b_l4_negcomplete(sc->sc_cdp);
 }
 
@@ -469,7 +469,7 @@ i4bisppp_connect(int unit, void *cdp)
 	sc->sc_loutb = 0;
 	sc->sc_if.if_timer = I4BISPPPACCTINTVL;
 #endif
-	
+
 #if 0 /* never used ??? */
 	callout_stop(&sc->sc_timeout);
 #endif
@@ -506,13 +506,13 @@ i4bisppp_disconnect(int unit, void *cdp)
 
 	i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_FINAL,
 		 sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-	
+
 	if (sc->sc_state == ST_CONNECTED)
 	{
 #if 0 /* never used ??? */
 		callout_stop(&sc->sc_timeout);
 #endif
-		sc->sc_cdp = (call_desc_t *)0;	
+		sc->sc_cdp = NULL;
 		/* do this here because pp_down calls i4bisppp_tlf */
 		sc->sc_state = ST_IDLE;
 		sp->pp_down(sp);	/* tell PPP we have hung up */
@@ -536,7 +536,7 @@ i4bisppp_dialresponse(int unit, int status, cause_t cause)
 	if(status != DSTAT_NONE)
 	{
 		struct mbuf *m;
-		
+
 		NDBGL4(L4_ISPDBG, "isp%d: clearing queues", unit);
 
 		if(!(sppp_isempty(&sc->sc_if)))
@@ -545,7 +545,7 @@ i4bisppp_dialresponse(int unit, int status, cause_t cause)
 				m_freem(m);
 		}
 
-		sc->sc_cdp = (call_desc_t *)0;
+		sc->sc_cdp = NULL;
 		/* do this here because pp_down calls i4bisppp_tlf */
 		sc->sc_state = ST_IDLE;
                 /*
@@ -558,7 +558,7 @@ i4bisppp_dialresponse(int unit, int status, cause_t cause)
 		sp->pp_down(sp);
 	}
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	interface up/down
  *---------------------------------------------------------------------------*/
@@ -567,7 +567,7 @@ i4bisppp_updown(int unit, int updown)
 {
 	/* could probably do something useful here */
 }
-	
+
 /*---------------------------------------------------------------------------*
  *	this routine is called from the HSCX interrupt handler
  *	when a new frame (mbuf) has been received and was put on
@@ -578,7 +578,7 @@ i4bisppp_rx_data_rdy(int unit)
 {
 	struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
 	struct mbuf *m;
-	
+
 	if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
 		return;
 
@@ -595,7 +595,7 @@ i4bisppp_rx_data_rdy(int unit)
 #if I4BISPPPACCT
 	sc->sc_inb += m->m_pkthdr.len;
 #endif
-	
+
 #ifdef I4BISPPPDEBUG
 	kprintf("i4bisppp_rx_data_ready: received packet!\n");
 #endif
@@ -615,7 +615,7 @@ i4bisppp_rx_data_rdy(int unit)
 static void
 i4bisppp_tx_queue_empty(int unit)
 {
-	i4bisppp_start(&i4bisppp_softc[unit].sc_if);	
+	i4bisppp_start(&i4bisppp_softc[unit].sc_if);
 }
 
 /*---------------------------------------------------------------------------*
@@ -677,8 +677,8 @@ i4bisppp_init_linktab(int unit)
 	i4bisppp_drvr_linktab[unit].bch_activity = i4bisppp_activity;
 	i4bisppp_drvr_linktab[unit].line_connected = i4bisppp_connect;
 	i4bisppp_drvr_linktab[unit].line_disconnected = i4bisppp_disconnect;
-	i4bisppp_drvr_linktab[unit].dial_response = i4bisppp_dialresponse;	
-	i4bisppp_drvr_linktab[unit].updown_ind = i4bisppp_updown;	
+	i4bisppp_drvr_linktab[unit].dial_response = i4bisppp_dialresponse;
+	i4bisppp_drvr_linktab[unit].updown_ind = i4bisppp_updown;
 }
 
 /*===========================================================================*/
diff --git a/sys/net/i4b/layer1/i4b_l1dmux.c b/sys/net/i4b/layer1/i4b_l1dmux.c
index 6b27b34..be53bae 100644
--- a/sys/net/i4b/layer1/i4b_l1dmux.c
+++ b/sys/net/i4b/layer1/i4b_l1dmux.c
@@ -295,7 +295,7 @@ i4b_l1_mph_status_ind(int drv_unit, int status, int parm, struct i4b_l1mux_func
 
 	if(status == STI_ATTACH)
 	{
-		if (l1mux_func_p == (struct i4b_l1mux_func *)0)
+		if (l1mux_func_p == NULL)
 			panic("i4b_l1_mph_status_ind: i4b_l1mux_func pointer is NULL\n");
 
 		if(numl1units < MAXL1UNITS)
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 9c0d933..9eb7d54 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -262,7 +262,7 @@ typedef void if_init_f_t (void *);
 #define	if_lastchange	if_data.ifi_lastchange
 #define if_recvquota	if_data.ifi_recvquota
 #define	if_xmitquota	if_data.ifi_xmitquota
-#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
+#define if_rawoutput(if, m, sa) if_output(if, m, sa, NULL)
 
 /* for compatibility with other BSDs */
 #define	if_list		if_link
diff --git a/sys/net/ppp_layer/ppp_tty.c b/sys/net/ppp_layer/ppp_tty.c
index 59688a7..b03b982 100644
--- a/sys/net/ppp_layer/ppp_tty.c
+++ b/sys/net/ppp_layer/ppp_tty.c
@@ -412,7 +412,7 @@ pppwrite(struct tty *tp, struct uio *uio, int flag)
     m0->m_len -= PPP_HDRLEN;
 
     /* call the upper layer to "transmit" it... */
-    error = pppoutput(&sc->sc_if, m0, &dst, (struct rtentry *)0);
+    error = pppoutput(&sc->sc_if, m0, &dst, NULL);
     crit_exit();
     return (error);
 }
diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c
index 3e98646..dc05009 100644
--- a/sys/net/raw_usrreq.c
+++ b/sys/net/raw_usrreq.c
@@ -103,7 +103,7 @@ raw_input(struct mbuf *m0, const struct sockproto *proto,
 			n = m_copypacket(m, MB_DONTWAIT);
 			if (n != NULL) {
 				if (ssb_appendaddr(&last->so_rcv, src, n,
-						 (struct mbuf *)0) == 0) {
+						 NULL) == 0) {
 					/* should notify about lost packet */
 					m_freem(n);
 				} else {
@@ -114,7 +114,7 @@ raw_input(struct mbuf *m0, const struct sockproto *proto,
 		last = rp->rcb_socket;
 	}
 	if (last) {
-		if (ssb_appendaddr(&last->so_rcv, src, m, (struct mbuf *)0) == 0)
+		if (ssb_appendaddr(&last->so_rcv, src, m, NULL) == 0)
 			m_freem(m);
 		else
 			sorwakeup(last);
diff --git a/sys/net/zlib.c b/sys/net/zlib.c
index d7bade3..bb6bb15 100644
--- a/sys/net/zlib.c
+++ b/sys/net/zlib.c
@@ -1074,7 +1074,7 @@ deflate(z_streamp strm, int flush)
 		   but not a zero length. */
 		_tr_stored_type_only(s);
             } else { /* FULL_FLUSH or SYNC_FLUSH */
-                _tr_stored_block(s, (char*)0, 0L, 0);
+                _tr_stored_block(s, NULL, 0L, 0);
                 /* For a full flush, this empty block will be recognized
                  * as a special marker by inflate_sync().
                  */
@@ -1950,7 +1950,7 @@ local static_tree_desc  static_d_desc =
 {static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
 
 local static_tree_desc  static_bl_desc =
-{(ct_data *)0, extra_blbits, 0,      BL_CODES, MAX_BL_BITS};
+{NULL, extra_blbits, 0,      BL_CODES, MAX_BL_BITS};
 
 /* ===========================================================================
  * Local (static) routines in this file.
@@ -2737,7 +2737,7 @@ _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
 	if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
 
     } else {
-        Assert(buf != (char*)0, "lost buf");
+        Assert(buf != NULL, "lost buf");
 	opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
     }
 
@@ -2752,7 +2752,7 @@ _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
     if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) {
 #  endif
         /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
-        if (buf == (charf*)0) error ("block vanished");
+        if (buf == NULL) error ("block vanished");
 
         copy_block(s, buf, (unsigned)stored_len, 0); /* without header */
         s->compressed_len = stored_len << 3;
@@ -2761,9 +2761,9 @@ _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
 #endif /* STORED_FILE_OK */
 
 #ifdef FORCE_STORED
-    if (buf != (char*)0) { /* force stored block */
+    if (buf != NULL) { /* force stored block */
 #else
-    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+    if (stored_len+4 <= opt_lenb && buf != NULL) {
                        /* 4: two words for the lengths */
 #endif
         /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
diff --git a/sys/netgraph7/ng_ksocket.c b/sys/netgraph7/ng_ksocket.c
index 3ad98aa..8680bbe 100644
--- a/sys/netgraph7/ng_ksocket.c
+++ b/sys/netgraph7/ng_ksocket.c
@@ -1100,7 +1100,7 @@ ng_ksocket_incoming2(node_p node, hook_p hook, void *arg1, int arg2)
 
 		/* Try to get next packet from socket */
 		if ((error = soreceive(so, (so->so_state & SS_ISCONNECTED) ?
-		    NULL : &sa, &auio, &m, (struct mbuf **)0, &flags)) != 0)
+		    NULL : &sa, &auio, &m, NULL, &flags)) != 0)
 			break;
 
 		/* See if we got anything */
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 808c826..c571c74 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -573,7 +573,7 @@ reflect:
 		icmpsrc.sin_addr = icp->icmp_ip.ip_dst;
 		rtredirect((struct sockaddr *)&icmpsrc,
 		  (struct sockaddr *)&icmpdst,
-		  (struct sockaddr *)0, RTF_GATEWAY | RTF_HOST,
+		  NULL, RTF_GATEWAY | RTF_HOST,
 		  (struct sockaddr *)&icmpgw);
 		kpfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&icmpsrc);
 #ifdef IPSEC
@@ -772,7 +772,7 @@ icmp_send(struct mbuf *m, struct mbuf *opts, struct route *rt)
 	icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen);
 	m->m_data -= hlen;
 	m->m_len += hlen;
-	m->m_pkthdr.rcvif = (struct ifnet *)0;
+	m->m_pkthdr.rcvif = NULL;
 #ifdef ICMPPRINTFS
 	if (icmpprintfs) {
 		char buf[sizeof "aaa.bbb.ccc.ddd"];
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 115b086..d60f90e 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -731,7 +731,7 @@ send:
 			m->m_data += max_linkhdr;
 		m->m_len = hdrlen;
 	}
-	m->m_pkthdr.rcvif = (struct ifnet *)0;
+	m->m_pkthdr.rcvif = NULL;
 	if (isipv6) {
 		ip6 = mtod(m, struct ip6_hdr *);
 		th = (struct tcphdr *)(ip6 + 1);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 92e6376..9f555b8 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -407,7 +407,7 @@ tcp6_usr_listen(struct socket *so, struct thread *td)
 			inp->inp_vflag |= INP_IPV4;
 		else
 			inp->inp_vflag &= ~INP_IPV4;
-		error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+		error = in6_pcbbind(inp, NULL, td);
 	}
 	if (error == 0)
 		tp->t_state = TCPS_LISTEN;
@@ -1084,7 +1084,7 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
 	int error;
 
 	if (inp->inp_lport == 0) {
-		error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+		error = in6_pcbbind(inp, NULL, td);
 		if (error)
 			return error;
 	}
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 57565df..b9759cd 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -816,7 +816,7 @@ in6_ifdetach(struct ifnet *ifp)
 				(struct sockaddr *)&ia->ia_addr,
 				(struct sockaddr *)&ia->ia_addr,
 				(struct sockaddr *)&ia->ia_prefixmask,
-				rtflags, (struct rtentry **)0);
+				rtflags, NULL);
 		}
 
 		/* remove from the linked list */
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 01dd609..b93711d 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -384,7 +384,7 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct thread *td)
 	}
 	if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
 		if (inp->inp_lport == 0) {
-			error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+			error = in6_pcbbind(inp, NULL, td);
 			if (error)
 				return (error);
 		}
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 4a748c6..825697f 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -863,7 +863,7 @@ socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in6 *src)
 	if (s) {
 		if (ssb_appendaddr(&s->so_rcv,
 				 (struct sockaddr *)src,
-				 mm, (struct mbuf *)0) != 0) {
+				 mm, NULL) != 0) {
 			sorwakeup(s);
 			return 0;
 		}
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index ae788df..e919315 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1067,7 +1067,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro,
 			}
 			m_cat(m, m_frgpart);
 			m->m_pkthdr.len = len + hlen + sizeof(*ip6f);
-			m->m_pkthdr.rcvif = (struct ifnet *)0;
+			m->m_pkthdr.rcvif = NULL;
 			ip6f->ip6f_reserved = 0;
 			ip6f->ip6f_ident = id;
 			ip6f->ip6f_nxt = nextproto;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index c38caf9..6c95e9c 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -996,8 +996,7 @@ nd6_free(struct rtentry *rt)
 	 * caches, and disable the route entry not to be used in already
 	 * cached routes.
 	 */
-	rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0,
-		  rt_mask(rt), 0, (struct rtentry **)0);
+	rtrequest(RTM_DELETE, rt_key(rt), NULL, rt_mask(rt), 0, NULL);
 
 	return (next);
 }
diff --git a/sys/netproto/atalk/ddp_input.c b/sys/netproto/atalk/ddp_input.c
index 40757cd..926cb9d 100644
--- a/sys/netproto/atalk/ddp_input.c
+++ b/sys/netproto/atalk/ddp_input.c
@@ -279,7 +279,7 @@ ddp_input(struct mbuf *m, struct ifnet *ifp, struct elaphdr *elh, int phase)
 	&& ( satosat(&forwro.ro_dst)->sat_addr.s_net != to.sat_addr.s_net
 	  || satosat(&forwro.ro_dst)->sat_addr.s_node != to.sat_addr.s_node )) {
 	    RTFREE( forwro.ro_rt );
-	    forwro.ro_rt = (struct rtentry *)0;
+	    forwro.ro_rt = NULL;
 	}
 
 	/*
@@ -287,8 +287,8 @@ ddp_input(struct mbuf *m, struct ifnet *ifp, struct elaphdr *elh, int phase)
 	 * Then get a new route.
 	 * XXX this could cause a 'route leak'. check this!
 	 */
-	if ( forwro.ro_rt == (struct rtentry *)0
-	|| forwro.ro_rt->rt_ifp == (struct ifnet *)0 ) {
+	if ( forwro.ro_rt == NULL
+	|| forwro.ro_rt->rt_ifp == NULL ) {
 	    forwro.ro_dst.sa_len = sizeof( struct sockaddr_at );
 	    forwro.ro_dst.sa_family = AF_APPLETALK;
 	    satosat(&forwro.ro_dst)->sat_addr.s_net = to.sat_addr.s_net;
@@ -369,7 +369,7 @@ ddp_input(struct mbuf *m, struct ifnet *ifp, struct elaphdr *elh, int phase)
      * If we found one, deliver th epacket to the socket
      */
     if (ssb_appendaddr( &ddp->ddp_socket->so_rcv, (struct sockaddr *)&from,
-	    m, (struct mbuf *)0 ) == 0 ) {
+	    m, NULL ) == 0 ) {
 	/* 
 	 * If the socket is full (or similar error) dump the packet.
 	 */
diff --git a/sys/netproto/atalk/ddp_usrreq.c b/sys/netproto/atalk/ddp_usrreq.c
index 5390b52..af1e7be 100644
--- a/sys/netproto/atalk/ddp_usrreq.c
+++ b/sys/netproto/atalk/ddp_usrreq.c
@@ -360,15 +360,15 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
 		satosat( &ro->ro_dst )->sat_addr.s_node !=
 		sat->sat_addr.s_node )) {
 	    RTFREE( ro->ro_rt );
-	    ro->ro_rt = (struct rtentry *)0;
+	    ro->ro_rt = NULL;
 	}
     }
 
     /*
      * If we've got no route for this interface, try to find one.
      */
-    if ( ro->ro_rt == (struct rtentry *)0 ||
-	 ro->ro_rt->rt_ifp == (struct ifnet *)0 ) {
+    if ( ro->ro_rt == NULL ||
+	 ro->ro_rt->rt_ifp == NULL ) {
 	ro->ro_dst.sa_len = sizeof( struct sockaddr_at );
 	ro->ro_dst.sa_family = AF_APPLETALK;
 	if ( hintnet ) {
@@ -397,7 +397,7 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
 
     ddp->ddp_fsat = *sat;
     if ( ddp->ddp_lsat.sat_port == ATADDR_ANYPORT ) {
-	return(at_pcbsetaddr(ddp, (struct sockaddr *)0, td));
+	return(at_pcbsetaddr(ddp, NULL, td));
     }
     return( 0 );
 }
diff --git a/sys/netproto/atm/atm_if.c b/sys/netproto/atm/atm_if.c
index 5c59bba..d10d928 100644
--- a/sys/netproto/atm/atm_if.c
+++ b/sys/netproto/atm/atm_if.c
@@ -1100,7 +1100,7 @@ atm_pifname(char *name)
 	 * Break down name
 	 */
 	if (atm_ifparse(name, n, sizeof(n), &unit))
-		return ((struct atm_pif *)0);
+		return (NULL);
 
 	/*
 	 * Look for the physical interface
@@ -1139,7 +1139,7 @@ atm_nifname(char *name)
 	 * Break down name
 	 */
 	if (atm_ifparse(name, n, sizeof(n), &unit))
-		return ((struct atm_nif *)0);
+		return (NULL);
 
 	/*
 	 * Search thru each physical interface
diff --git a/sys/netproto/atm/spans/spans_subr.c b/sys/netproto/atm/spans/spans_subr.c
index 42b0653..1eb62f4 100644
--- a/sys/netproto/atm/spans/spans_subr.c
+++ b/sys/netproto/atm/spans/spans_subr.c
@@ -221,7 +221,7 @@ spans_open_vcc(struct spans *spp, Atm_connvc *cvp)
 			 */
 			DEQUEUE(svp, struct spans_vccb, sv_sigelem,
 					spp->sp_vccq);
-			cvp->cvc_vcc = (struct vccb *)0;
+			cvp->cvc_vcc = NULL;
 			atm_free((caddr_t)svp);
 			return(err);
 		} else {
diff --git a/sys/netproto/atm/uni/unisig_if.c b/sys/netproto/atm/uni/unisig_if.c
index 900aac6..d177075 100644
--- a/sys/netproto/atm/uni/unisig_if.c
+++ b/sys/netproto/atm/uni/unisig_if.c
@@ -366,8 +366,7 @@ unisig_detach(struct atm_pif *pip)
 	 * Pass the detach event to the signalling manager
 	 * state machine
 	 */
-	err = unisig_sigmgr_state(usp, UNISIG_SIGMGR_DETACH,
-			(KBuffer *)0);
+	err = unisig_sigmgr_state(usp, UNISIG_SIGMGR_DETACH, NULL);
 
 	/*
 	 * Log the fact that we've detached
diff --git a/sys/netproto/atm/uni/unisig_sigmgr_state.c b/sys/netproto/atm/uni/unisig_sigmgr_state.c
index ece9eab..d578058 100644
--- a/sys/netproto/atm/uni/unisig_sigmgr_state.c
+++ b/sys/netproto/atm/uni/unisig_sigmgr_state.c
@@ -395,9 +395,7 @@ unisig_sigmgr_act04(struct unisig *usp, KBuffer *m)
 	/*
 	 * Try to establish an SSCF session.
 	 */
-	err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ,
-			usp->us_conn,
-			(void *)0);
+	err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ, usp->us_conn, NULL);
 	if (err)
 		panic("unisig_sigmgr_act04: SSCF_UNI_ESTABLISH_REQ");
 
@@ -708,9 +706,7 @@ unisig_sigmgr_act13(struct unisig *usp, KBuffer *m)
 	/*
 	 * Establish the SSCF session
 	 */
-	err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ,
-			usp->us_conn,
-			(void *)0);
+	err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ, usp->us_conn, NULL);
 	if (err)
 		panic("unisig_sigmgr_act13: SSCF_UNI_ESTABLISH_REQ");
 
@@ -748,7 +744,7 @@ unisig_sigmgr_act14(struct unisig *usp, KBuffer *m)
 	/*
 	 * Locate the signalling channel's VCCB
 	 */
-	sig_vccb = (struct unisig_vccb *)0;
+	sig_vccb = NULL;
 	if (usp->us_conn && usp->us_conn->co_connvc)
 		sig_vccb = (struct unisig_vccb *)
 				usp->us_conn->co_connvc->cvc_vcc;
diff --git a/sys/netproto/atm/uni/unisig_vc_state.c b/sys/netproto/atm/uni/unisig_vc_state.c
index 5dc108e..a6b33e9 100644
--- a/sys/netproto/atm/uni/unisig_vc_state.c
+++ b/sys/netproto/atm/uni/unisig_vc_state.c
@@ -1274,8 +1274,7 @@ unisig_vc_act14(struct unisig *usp, struct unisig_vccb *uvp,
 		/*
 		 * Resend the RELEASE message
 		 */
-		rc = unisig_send_release(usp, uvp,
-				(struct unisig_msg *)0, T_ATM_ABSENT);
+		rc = unisig_send_release(usp, uvp, NULL, T_ATM_ABSENT);
 		if (rc)
 			return(rc);
 
diff --git a/sys/netproto/ncp/ncp_sock.c b/sys/netproto/ncp/ncp_sock.c
index d024384..5a39892 100644
--- a/sys/netproto/ncp/ncp_sock.c
+++ b/sys/netproto/ncp/ncp_sock.c
@@ -366,13 +366,13 @@ ncp_sock_disconnect(struct ncp_conn *conn) {
 	conn->flags &= ~(NCPFL_SOCONN | NCPFL_ATTACHED | NCPFL_LOGGED);
 	if (conn->ncp_so) {
 		so = conn->ncp_so;
-		conn->ncp_so = (struct socket *)0;
+		conn->ncp_so = NULL;
 		soshutdown(so, SHUT_RDWR);
 		soclose(so, FNONBLOCK);
 	}
 	if (conn->wdg_so) {
 		so = conn->wdg_so;
-		conn->wdg_so = (struct socket *)0;
+		conn->wdg_so = NULL;
 		soshutdown(so, SHUT_RDWR);
 		soclose(so, FNONBLOCK);
 	}
diff --git a/sys/netproto/ns/idp_usrreq.c b/sys/netproto/ns/idp_usrreq.c
index c5f4d69..14ffeb1 100644
--- a/sys/netproto/ns/idp_usrreq.c
+++ b/sys/netproto/ns/idp_usrreq.c
@@ -110,7 +110,7 @@ idp_input(struct mbuf *m, ...)
 		m->m_data += sizeof (struct idp);
 	}
 	if (ssb_appendaddr(&nsp->nsp_socket->so_rcv, (struct sockaddr *)&idp_ns,
-	    m, (struct mbuf *)0) == 0)
+	    m, NULL) == 0)
 		goto bad;
 	sorwakeup(nsp->nsp_socket);
 	return;
@@ -223,7 +223,7 @@ idp_output(struct mbuf *m0, struct socket *so, ...)
 	 * Output datagram.
 	 */
 	if (so->so_options & SO_DONTROUTE)
-		return (ns_output(m, (struct route *)0,
+		return (ns_output(m, NULL,
 		    (so->so_options & SO_BROADCAST) | NS_ROUTETOIF));
 	/*
 	 * Use cached route for previous datagram if
@@ -262,7 +262,7 @@ idp_output(struct mbuf *m0, struct socket *so, ...)
 		} else {
 		re_route:
 			RTFREE(ro->ro_rt);
-			ro->ro_rt = (struct rtentry *)0;
+			ro->ro_rt = NULL;
 		}
 	}
 	nsp->nsp_lastdst = idp->idp_dna;
diff --git a/sys/netproto/ns/ns.c b/sys/netproto/ns/ns.c
index 182d796..17e0aab 100644
--- a/sys/netproto/ns/ns.c
+++ b/sys/netproto/ns/ns.c
@@ -88,14 +88,14 @@ ns_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
 	switch (cmd) {
 
 	case SIOCGIFADDR:
-		if (ia == (struct ns_ifaddr *)0)
+		if (ia == NULL)
 			return (EADDRNOTAVAIL);
 		*(struct sockaddr_ns *)&ifr->ifr_addr = ia->ia_addr;
 		return (0);
 
 
 	case SIOCGIFBRDADDR:
-		if (ia == (struct ns_ifaddr *)0)
+		if (ia == NULL)
 			return (EADDRNOTAVAIL);
 		if ((ifp->if_flags & IFF_BROADCAST) == 0)
 			return (EINVAL);
@@ -103,7 +103,7 @@ ns_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
 		return (0);
 
 	case SIOCGIFDSTADDR:
-		if (ia == (struct ns_ifaddr *)0)
+		if (ia == NULL)
 			return (EADDRNOTAVAIL);
 		if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
 			return (EINVAL);
@@ -132,7 +132,7 @@ ns_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
 
 	case SIOCSIFADDR:
 	case SIOCSIFDSTADDR:
-		if (ia == (struct ns_ifaddr *)0) {
+		if (ia == NULL) {
 			oia = ifa_create(sizeof(*ia), M_WAITOK);
 			if ((ia = ns_ifaddr) != NULL) {
 				for ( ; ia->ia_next; ia = ia->ia_next)
diff --git a/sys/netproto/ns/ns_error.c b/sys/netproto/ns/ns_error.c
index a190d66..286687f 100644
--- a/sys/netproto/ns/ns_error.c
+++ b/sys/netproto/ns/ns_error.c
@@ -165,7 +165,7 @@ ns_error(struct mbuf *om, int type, int param)
 		nip->idp_sum = ns_cksum(m, sizeof(*ep));
 	} else
 		nip->idp_sum = 0xffff;
-	ns_output(m, (struct route *)0, 0);
+	ns_output(m, NULL, 0);
 
 freeit:
 	m_freem(om);
@@ -314,6 +314,6 @@ ns_echo(struct mbuf *m)
 		idp->idp_sum = ns_cksum(m,
 		    (int)(((ntohs(idp->idp_len) - 1)|1)+1));
 	}
-	ns_output(m, (struct route *)0, NS_FORWARDING);
+	ns_output(m, NULL, NS_FORWARDING);
 	return(0);
 }
diff --git a/sys/netproto/ns/ns_ip.c b/sys/netproto/ns/ns_ip.c
index 440426f..852f94f 100644
--- a/sys/netproto/ns/ns_ip.c
+++ b/sys/netproto/ns/ns_ip.c
@@ -284,7 +284,7 @@ nsipoutput_serialized(struct ifnet_en *ifn, struct mbuf *m,
 	/*
 	 * Output final datagram.
 	 */
-	error =  (ip_output(m, (struct mbuf *)0, ro, SO_BROADCAST, NULL));
+	error =  (ip_output(m, NULL, ro, SO_BROADCAST, NULL));
 	if (error) {
 		ifn->ifen_ifnet.if_oerrors++;
 		ifn->ifen_ifnet.if_ierrors = error;
@@ -383,10 +383,10 @@ nsip_route(struct mbuf *m)
 	 */
 	ifr.ifr_name[4] = '0' + nsipif_units - 1;
 	ifr.ifr_dstaddr = * (struct sockaddr *) ns_dst;
-	ns_control((struct socket *)0, (int)SIOCSIFDSTADDR, (caddr_t)&ifr,
+	ns_control(NULL, (int)SIOCSIFDSTADDR, (caddr_t)&ifr,
 			(struct ifnet *)ifn, NULL);
 	satons_addr(ifr.ifr_addr).x_host = ns_thishost;
-	return (ns_control((struct socket *)0, (int)SIOCSIFADDR, (caddr_t)&ifr,
+	return (ns_control(NULL, (int)SIOCSIFADDR, (caddr_t)&ifr,
 			(struct ifnet *)ifn, NULL));
 }
 
diff --git a/sys/netproto/ns/ns_pcb.c b/sys/netproto/ns/ns_pcb.c
index f4fca20..e7c650b 100644
--- a/sys/netproto/ns/ns_pcb.c
+++ b/sys/netproto/ns/ns_pcb.c
@@ -164,14 +164,14 @@ ns_pcbconnect(struct nspcb *nsp, struct sockaddr *nam)
 	flush:
 			if (ro->ro_rt)
 				RTFREE(ro->ro_rt);
-			ro->ro_rt = (struct rtentry *)0;
+			ro->ro_rt = NULL;
 			nsp->nsp_laddr.x_net = ns_zeronet;
 		}
 	}/* else cached route is ok; do nothing */
 	nsp->nsp_lastdst = sns->sns_addr;
 	if ((nsp->nsp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/
-	    (ro->ro_rt == (struct rtentry *)0 ||
-	     ro->ro_rt->rt_ifp == (struct ifnet *)0)) {
+	    (ro->ro_rt == NULL ||
+	     ro->ro_rt->rt_ifp == NULL)) {
 		    /* No route yet, so try to acquire one */
 		    ro->ro_dst.sa_family = AF_NS;
 		    ro->ro_dst.sa_len = sizeof(ro->ro_dst);
@@ -185,7 +185,7 @@ ns_pcbconnect(struct nspcb *nsp, struct sockaddr *nam)
 		 * our src addr is taken from the i/f, else punt.
 		 */
 
-		ia = (struct ns_ifaddr *)0;
+		ia = NULL;
 		/*
 		 * If we found a route, use the address
 		 * corresponding to the outgoing interface
diff --git a/sys/netproto/ns/spp_usrreq.c b/sys/netproto/ns/spp_usrreq.c
index 2b2e5a1..5539cd8 100644
--- a/sys/netproto/ns/spp_usrreq.c
+++ b/sys/netproto/ns/spp_usrreq.c
@@ -276,7 +276,7 @@ spp_input(struct mbuf *m, ...)
 		m_freem(m);
 	}
 	if (cb->s_force || (cb->s_flags & (SF_ACKNOW|SF_WIN|SF_RXT)))
-		spp_output(cb, (struct mbuf *)0);
+		spp_output(cb, NULL);
 	cb->s_flags &= ~(SF_WIN|SF_RXT);
 	return;
 
@@ -345,7 +345,7 @@ spp_reass(struct sppcb *cb, struct spidp *si, struct mbuf *si_m)
 				cb->s_snxt = si->si_ack;
 				cb->s_cwnd = CUNIT;
 				cb->s_force = 1 + SPPT_REXMT;
-				spp_output(cb, (struct mbuf *)0);
+				spp_output(cb, NULL);
 				cb->s_timer[SPPT_REXMT] = cb->s_rxtcur;
 				cb->s_rtt = 0;
 				if (cwnd >= 4 * CUNIT)
@@ -1106,7 +1106,7 @@ send:
 			spp_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
 
 		if (so->so_options & SO_DONTROUTE)
-			error = ns_output(m, (struct route *)0, NS_ROUTETOIF);
+			error = ns_output(m, NULL, NS_ROUTETOIF);
 		else
 			error = ns_output(m, &cb->s_nspcb->nsp_route, 0);
 	}
@@ -1725,7 +1725,7 @@ spp_close(struct sppcb *cb)
 	soisdisconnected(so);
 	ns_pcbdetach(nsp);
 	sppstat.spps_closed++;
-	return ((struct sppcb *)0);
+	return (NULL);
 }
 /*
  *	Someday we may do level 3 handshaking
diff --git a/sys/platform/pc32/i386/db_trace.c b/sys/platform/pc32/i386/db_trace.c
index 7f5c367..355be8a 100644
--- a/sys/platform/pc32/i386/db_trace.c
+++ b/sys/platform/pc32/i386/db_trace.c
@@ -62,22 +62,22 @@ db_varfcn_t db_dr7;
  * Machine register set.
  */
 struct db_variable db_regs[] = {
-	{ "cs",		&ddb_regs.tf_cs,     FCN_NULL },
-	{ "ds",		&ddb_regs.tf_ds,     FCN_NULL },
-	{ "es",		&ddb_regs.tf_es,     FCN_NULL },
-	{ "fs",		&ddb_regs.tf_fs,     FCN_NULL },
-	{ "gs",		&ddb_regs.tf_gs,     FCN_NULL },
-	{ "ss",		&ddb_regs.tf_ss,     FCN_NULL },
-	{ "eax",	&ddb_regs.tf_eax,    FCN_NULL },
-	{ "ecx",	&ddb_regs.tf_ecx,    FCN_NULL },
-	{ "edx",	&ddb_regs.tf_edx,    FCN_NULL },
-	{ "ebx",	&ddb_regs.tf_ebx,    FCN_NULL },
-	{ "esp",	&ddb_regs.tf_esp,    FCN_NULL },
-	{ "ebp",	&ddb_regs.tf_ebp,    FCN_NULL },
-	{ "esi",	&ddb_regs.tf_esi,    FCN_NULL },
-	{ "edi",	&ddb_regs.tf_edi,    FCN_NULL },
-	{ "eip",	&ddb_regs.tf_eip,    FCN_NULL },
-	{ "efl",	&ddb_regs.tf_eflags, FCN_NULL },
+	{ "cs",		&ddb_regs.tf_cs,     NULL },
+	{ "ds",		&ddb_regs.tf_ds,     NULL },
+	{ "es",		&ddb_regs.tf_es,     NULL },
+	{ "fs",		&ddb_regs.tf_fs,     NULL },
+	{ "gs",		&ddb_regs.tf_gs,     NULL },
+	{ "ss",		&ddb_regs.tf_ss,     NULL },
+	{ "eax",	&ddb_regs.tf_eax,    NULL },
+	{ "ecx",	&ddb_regs.tf_ecx,    NULL },
+	{ "edx",	&ddb_regs.tf_edx,    NULL },
+	{ "ebx",	&ddb_regs.tf_ebx,    NULL },
+	{ "esp",	&ddb_regs.tf_esp,    NULL },
+	{ "ebp",	&ddb_regs.tf_ebp,    NULL },
+	{ "esi",	&ddb_regs.tf_esi,    NULL },
+	{ "edi",	&ddb_regs.tf_edi,    NULL },
+	{ "eip",	&ddb_regs.tf_eip,    NULL },
+	{ "efl",	&ddb_regs.tf_eflags, NULL },
 	{ "dr0",	NULL,		     db_dr0 },
 	{ "dr1",	NULL,		     db_dr1 },
 	{ "dr2",	NULL,		     db_dr2 },
diff --git a/sys/platform/pc64/amd64/db_trace.c b/sys/platform/pc64/amd64/db_trace.c
index 2c38d71..bf02be1 100644
--- a/sys/platform/pc64/amd64/db_trace.c
+++ b/sys/platform/pc64/amd64/db_trace.c
@@ -94,30 +94,30 @@ db_varfcn_t db_dr7;
  * Machine register set.
  */
 struct db_variable db_regs[] = {
-	{ "cs",		&ddb_regs.tf_cs,     FCN_NULL },
-/*	{ "ds",		&ddb_regs.tf_ds,     FCN_NULL },
-	{ "es",		&ddb_regs.tf_es,     FCN_NULL },
-	{ "fs",		&ddb_regs.tf_fs,     FCN_NULL },
-	{ "gs",		&ddb_regs.tf_gs,     FCN_NULL }, */
-	{ "ss",		&ddb_regs.tf_ss,     FCN_NULL },
-	{ "rax",	&ddb_regs.tf_rax,    FCN_NULL },
-	{ "rcx",	&ddb_regs.tf_rcx,    FCN_NULL },
-	{ "rdx",	&ddb_regs.tf_rdx,    FCN_NULL },
-	{ "rbx",	&ddb_regs.tf_rbx,    FCN_NULL },
-	{ "rsp",	&ddb_regs.tf_rsp,    FCN_NULL },
-	{ "rbp",	&ddb_regs.tf_rbp,    FCN_NULL },
-	{ "rsi",	&ddb_regs.tf_rsi,    FCN_NULL },
-	{ "rdi",	&ddb_regs.tf_rdi,    FCN_NULL },
-	{ "rip",	&ddb_regs.tf_rip,    FCN_NULL },
-	{ "rfl",	&ddb_regs.tf_rflags, FCN_NULL },
-	{ "r8",		&ddb_regs.tf_r8,     FCN_NULL },
-	{ "r9",		&ddb_regs.tf_r9,     FCN_NULL },
-	{ "r10",	&ddb_regs.tf_r10,    FCN_NULL },
-	{ "r11",	&ddb_regs.tf_r11,    FCN_NULL },
-	{ "r12",	&ddb_regs.tf_r12,    FCN_NULL },
-	{ "r13",	&ddb_regs.tf_r13,    FCN_NULL },
-	{ "r14",	&ddb_regs.tf_r14,    FCN_NULL },
-	{ "r15",	&ddb_regs.tf_r15,    FCN_NULL },
+	{ "cs",		&ddb_regs.tf_cs,     NULL },
+/*	{ "ds",		&ddb_regs.tf_ds,     NULL },
+	{ "es",		&ddb_regs.tf_es,     NULL },
+	{ "fs",		&ddb_regs.tf_fs,     NULL },
+	{ "gs",		&ddb_regs.tf_gs,     NULL }, */
+	{ "ss",		&ddb_regs.tf_ss,     NULL },
+	{ "rax",	&ddb_regs.tf_rax,    NULL },
+	{ "rcx",	&ddb_regs.tf_rcx,    NULL },
+	{ "rdx",	&ddb_regs.tf_rdx,    NULL },
+	{ "rbx",	&ddb_regs.tf_rbx,    NULL },
+	{ "rsp",	&ddb_regs.tf_rsp,    NULL },
+	{ "rbp",	&ddb_regs.tf_rbp,    NULL },
+	{ "rsi",	&ddb_regs.tf_rsi,    NULL },
+	{ "rdi",	&ddb_regs.tf_rdi,    NULL },
+	{ "rip",	&ddb_regs.tf_rip,    NULL },
+	{ "rfl",	&ddb_regs.tf_rflags, NULL },
+	{ "r8",		&ddb_regs.tf_r8,     NULL },
+	{ "r9",		&ddb_regs.tf_r9,     NULL },
+	{ "r10",	&ddb_regs.tf_r10,    NULL },
+	{ "r11",	&ddb_regs.tf_r11,    NULL },
+	{ "r12",	&ddb_regs.tf_r12,    NULL },
+	{ "r13",	&ddb_regs.tf_r13,    NULL },
+	{ "r14",	&ddb_regs.tf_r14,    NULL },
+	{ "r15",	&ddb_regs.tf_r15,    NULL },
 	{ "dr0",	NULL,		     db_dr0 },
 	{ "dr1",	NULL,		     db_dr1 },
 	{ "dr2",	NULL,		     db_dr2 },
diff --git a/sys/platform/vkernel/i386/db_trace.c b/sys/platform/vkernel/i386/db_trace.c
index 706a43e..5dab6bd 100644
--- a/sys/platform/vkernel/i386/db_trace.c
+++ b/sys/platform/vkernel/i386/db_trace.c
@@ -56,22 +56,22 @@ static int db_dr(struct db_variable *vp, db_expr_t *valuep, int op);
  * Machine register set.
  */
 struct db_variable db_regs[] = {
-	{ "cs",		&ddb_regs.tf_cs,     FCN_NULL },
-	{ "ds",		&ddb_regs.tf_ds,     FCN_NULL },
-	{ "es",		&ddb_regs.tf_es,     FCN_NULL },
-	{ "fs",		&ddb_regs.tf_fs,     FCN_NULL },
-	{ "gs",		&ddb_regs.tf_gs,     FCN_NULL },
-	{ "ss",		&ddb_regs.tf_ss,     FCN_NULL },
-	{ "eax",	&ddb_regs.tf_eax,    FCN_NULL },
-	{ "ecx",	&ddb_regs.tf_ecx,    FCN_NULL },
-	{ "edx",	&ddb_regs.tf_edx,    FCN_NULL },
-	{ "ebx",	&ddb_regs.tf_ebx,    FCN_NULL },
-	{ "esp",	&ddb_regs.tf_esp,    FCN_NULL },
-	{ "ebp",	&ddb_regs.tf_ebp,    FCN_NULL },
-	{ "esi",	&ddb_regs.tf_esi,    FCN_NULL },
-	{ "edi",	&ddb_regs.tf_edi,    FCN_NULL },
-	{ "eip",	&ddb_regs.tf_eip,    FCN_NULL },
-	{ "efl",	&ddb_regs.tf_eflags, FCN_NULL },
+	{ "cs",		&ddb_regs.tf_cs,     NULL },
+	{ "ds",		&ddb_regs.tf_ds,     NULL },
+	{ "es",		&ddb_regs.tf_es,     NULL },
+	{ "fs",		&ddb_regs.tf_fs,     NULL },
+	{ "gs",		&ddb_regs.tf_gs,     NULL },
+	{ "ss",		&ddb_regs.tf_ss,     NULL },
+	{ "eax",	&ddb_regs.tf_eax,    NULL },
+	{ "ecx",	&ddb_regs.tf_ecx,    NULL },
+	{ "edx",	&ddb_regs.tf_edx,    NULL },
+	{ "ebx",	&ddb_regs.tf_ebx,    NULL },
+	{ "esp",	&ddb_regs.tf_esp,    NULL },
+	{ "ebp",	&ddb_regs.tf_ebp,    NULL },
+	{ "esi",	&ddb_regs.tf_esi,    NULL },
+	{ "edi",	&ddb_regs.tf_edi,    NULL },
+	{ "eip",	&ddb_regs.tf_eip,    NULL },
+	{ "efl",	&ddb_regs.tf_eflags, NULL },
 	{ "dr0",	NULL,		     db_dr },
 	{ "dr1",	NULL,		     db_dr },
 	{ "dr2",	NULL,		     db_dr },
diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h
index c80ad39..580f229 100644
--- a/sys/sys/semaphore.h
+++ b/sys/sys/semaphore.h
@@ -50,7 +50,7 @@
 struct sem;
 typedef struct sem *sem_t;
 
-#define SEM_FAILED	((sem_t *)0)
+#define SEM_FAILED	(NULL)
 #define SEM_VALUE_MAX	UINT_MAX
 
 #ifndef _KERNEL
diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c
index ef8392c..7b16737 100644
--- a/sys/vfs/fifofs/fifo_vnops.c
+++ b/sys/vfs/fifofs/fifo_vnops.c
@@ -318,8 +318,7 @@ fifo_write(struct vop_write_args *ap)
 	else
 		flags = 0;
 	vn_unlock(ap->a_vp);
-	error = sosend(wso, (struct sockaddr *)0, ap->a_uio, 0,
-		       (struct mbuf *)0, flags, td);
+	error = sosend(wso, NULL, ap->a_uio, 0, NULL, flags, td);
 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
 	return (error);
 }
diff --git a/sys/vfs/gnu/ext2fs/ext2_balloc.c b/sys/vfs/gnu/ext2fs/ext2_balloc.c
index 28b8c5b..66f37a7 100644
--- a/sys/vfs/gnu/ext2fs/ext2_balloc.c
+++ b/sys/vfs/gnu/ext2fs/ext2_balloc.c
@@ -170,7 +170,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
 	nb = ip->i_ib[indirs[0].in_off];
 	if (nb == 0) {
 #if 0
-		pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
+		pref = ext2_blkpref(ip, lbn, 0, NULL, 0);
 #else
 		/* see the comment by ext2_blkpref. What we do here is
 		   to pretend that it'd be good for a block holding indirect
@@ -236,7 +236,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
 			pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
 						lblkno(fs, bp->b_loffset));
 #else
-			pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
+			pref = ext2_blkpref(ip, lbn, 0, NULL, 0);
 #endif
 		if ((error =
 		    ext2_alloc(ip, lbn, pref, (int)fs->s_blocksize, cred, &newb)) != 0) {
diff --git a/sys/vfs/gnu/ext2fs/ext2_lookup.c b/sys/vfs/gnu/ext2fs/ext2_lookup.c
index 7f3862d..8f081d4 100644
--- a/sys/vfs/gnu/ext2fs/ext2_lookup.c
+++ b/sys/vfs/gnu/ext2fs/ext2_lookup.c
@@ -1015,7 +1015,7 @@ ext2_checkpath(struct inode *source, struct inode *target, struct ucred *cred)
 		}
 		error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
 				sizeof (struct dirtemplate), (off_t)0,
-				UIO_SYSSPACE, IO_NODELOCKED, cred, (int *)0);
+				UIO_SYSSPACE, IO_NODELOCKED, cred, NULL);
 		if (error != 0)
 			break;
 		namlen = dirbuf.dotdot_type;	/* like ufs little-endian */
diff --git a/sys/vfs/gnu/ext2fs/ext2_quota.c b/sys/vfs/gnu/ext2fs/ext2_quota.c
index d0a4c74..46432d7 100644
--- a/sys/vfs/gnu/ext2fs/ext2_quota.c
+++ b/sys/vfs/gnu/ext2fs/ext2_quota.c
@@ -918,7 +918,7 @@ ext2_dqflush(struct vnode *vp)
 			if (dq->dq_cnt)
 				panic("dqflush: stray dquot");
 			LIST_REMOVE(dq, dq_hash);
-			dq->dq_ump = (struct ext2mount *)0;
+			dq->dq_ump = NULL;
 		}
 	}
 }
diff --git a/sys/vfs/gnu/ext2fs/ext2_vnops.c b/sys/vfs/gnu/ext2fs/ext2_vnops.c
index 8f07518..7bf177e 100644
--- a/sys/vfs/gnu/ext2fs/ext2_vnops.c
+++ b/sys/vfs/gnu/ext2fs/ext2_vnops.c
@@ -790,7 +790,7 @@ abortit:
 			error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
 					sizeof (struct dirtemplate), (off_t)0,
 					UIO_SYSSPACE, IO_NODELOCKED,
-					tcnp->cn_cred, (int *)0);
+					tcnp->cn_cred, NULL);
 			if (error == 0) {
 				/* Like ext2 little-endian: */
 				namlen = dirbuf.dotdot_type;
@@ -806,7 +806,7 @@ abortit:
 						sizeof (struct dirtemplate),
 						(off_t)0, UIO_SYSSPACE,
 						IO_NODELOCKED|IO_SYNC,
-						tcnp->cn_cred, (int *)0);
+						tcnp->cn_cred, NULL);
 				}
 			}
 		}
@@ -975,7 +975,7 @@ ext2_mkdir(struct vop_old_mkdir_args *ap)
 	dirtemplate.dotdot_reclen = DIRBLKSIZ - 12;
 	error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate,
 			sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
-			IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0);
+			IO_NODELOCKED|IO_SYNC, cnp->cn_cred, NULL);
 	if (error) {
 		dp->i_nlink--;
 		dp->i_flag |= IN_CHANGE;
@@ -1110,7 +1110,7 @@ ext2_symlink(struct vop_old_symlink_args *ap)
 
 		error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
 				UIO_SYSSPACE, IO_NODELOCKED, 
-				ap->a_cnp->cn_cred, (int *)0);
+				ap->a_cnp->cn_cred, NULL);
 
 		if (error)
 			vput(vp);
diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c
index ebd8097..c38e038 100644
--- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c
@@ -682,7 +682,7 @@ cd9660_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
 #else
 	    0,
 #endif
-	    (struct iso_directory_record *)0));
+	    NULL));
 }
 
 int
diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c
index bb660ce..045d742 100644
--- a/sys/vfs/msdosfs/msdosfs_vnops.c
+++ b/sys/vfs/msdosfs/msdosfs_vnops.c
@@ -1246,7 +1246,7 @@ abortit:
 		bcopy(toname, ip->de_Name, 11);	/* update denode */
 		dp->de_fndoffset = to_diroffset;
 		dp->de_fndcnt = to_count;
-		error = createde(ip, dp, (struct denode **)0, tcnp);
+		error = createde(ip, dp, NULL, tcnp);
 		if (error) {
 			bcopy(oldname, ip->de_Name, 11);
 			goto done;
diff --git a/sys/vfs/nfs/nfs_bio.c b/sys/vfs/nfs/nfs_bio.c
index 388396d..0799ac6 100644
--- a/sys/vfs/nfs/nfs_bio.c
+++ b/sys/vfs/nfs/nfs_bio.c
@@ -1103,7 +1103,7 @@ nfs_getcacheblk(struct vnode *vp, off_t loffset, int size, struct thread *td)
 	if (nmp->nm_flag & NFSMNT_INT) {
 		bp = getblk(vp, loffset, size, GETBLK_PCATCH, 0);
 		while (bp == NULL) {
-			if (nfs_sigintr(nmp, (struct nfsreq *)0, td))
+			if (nfs_sigintr(nmp, NULL, td))
 				return (NULL);
 			bp = getblk(vp, loffset, size, 0, 2 * hz);
 		}
diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c
index c56cc07..4b2f1df 100644
--- a/sys/vfs/nfs/nfs_serv.c
+++ b/sys/vfs/nfs/nfs_serv.c
@@ -179,7 +179,7 @@ nfsrv3_access(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 	    (nfsd->nd_flag & ND_KERBAUTH), TRUE);
 	if (error) {
 		nfsm_reply(NFSX_UNSIGNED);
-		nfsm_srvpostop_attr(1, (struct vattr *)0);
+		nfsm_srvpostop_attr(1, NULL);
 		error = 0;
 		goto nfsmout;
 	}
@@ -627,7 +627,7 @@ nfsrv_readlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 
 	nfsdbprintf(("%s %d\n", __FILE__, __LINE__));
 #ifndef nolint
-	mp2 = (struct mbuf *)0;
+	mp2 = NULL;
 #endif
 	mp3 = NULL;
 	fhp = &nfh.fh_generic;
@@ -664,7 +664,7 @@ nfsrv_readlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 		 &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
 	if (error) {
 		nfsm_reply(2 * NFSX_UNSIGNED);
-		nfsm_srvpostop_attr(1, (struct vattr *)0);
+		nfsm_srvpostop_attr(1, NULL);
 		error = 0;
 		goto nfsmout;
 	}
@@ -762,7 +762,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 	if (error) {
 		vp = NULL;
 		nfsm_reply(2 * NFSX_UNSIGNED);
-		nfsm_srvpostop_attr(1, (struct vattr *)0);
+		nfsm_srvpostop_attr(1, NULL);
 		error = 0;
 		goto nfsmout;
 	}
@@ -2072,7 +2072,7 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 
 	nfsdbprintf(("%s %d\n", __FILE__, __LINE__));
 #ifndef nolint
-	fvp = (struct vnode *)0;
+	fvp = NULL;
 #endif
 	ffhp = &fnfh.fh_generic;
 	tfhp = &tnfh.fh_generic;
@@ -2396,7 +2396,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
 	u_int32_t *tl;
 	int32_t t1;
 	struct nfsv2_sattr *sp;
-	char *bpos, *pathcp = (char *)0, *cp2;
+	char *bpos, *pathcp = NULL, *cp2;
 	struct uio io;
 	struct iovec iv;
 	int error = 0, len, len2, dirfor_ret = 1, diraft_ret = 1;
diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c
index f0b09ae..1b620c7 100644
--- a/sys/vfs/nfs/nfs_socket.c
+++ b/sys/vfs/nfs/nfs_socket.c
@@ -212,7 +212,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
 	struct sockaddr_in *sin;
 	struct thread *td = &thread0; /* only used for socreate and sobind */
 
-	nmp->nm_so = (struct socket *)0;
+	nmp->nm_so = NULL;
 	saddr = nmp->nm_nam;
 	error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
 		nmp->nm_soproto, td);
@@ -420,7 +420,7 @@ nfs_disconnect(struct nfsmount *nmp)
 
 	if (nmp->nm_so) {
 		so = nmp->nm_so;
-		nmp->nm_so = (struct socket *)0;
+		nmp->nm_so = NULL;
 		soshutdown(so, SHUT_RDWR);
 		soclose(so, FNONBLOCK);
 	}
@@ -474,7 +474,7 @@ nfs_send(struct socket *so, struct sockaddr *nam, struct mbuf *top,
 	} else
 		soflags = so->so_proto->pr_flags;
 	if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
-		sendnam = (struct sockaddr *)0;
+		sendnam = NULL;
 	else
 		sendnam = nam;
 	if (so->so_type == SOCK_SEQPACKET)
@@ -980,7 +980,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
 	 * Get the RPC header with authorization.
 	 */
 kerbauth:
-	verf_str = auth_str = (char *)0;
+	verf_str = auth_str = NULL;
 	if (nmp->nm_flag & NFSMNT_KERB) {
 		verf_str = nickv;
 		verf_len = sizeof (nickv);
@@ -1140,7 +1140,7 @@ tryagain:
 		else if ((nmp->nm_flag & NFSMNT_KERB) && *tl++ == rpc_autherr) {
 			if (!failed_auth) {
 				failed_auth++;
-				mheadend->m_next = (struct mbuf *)0;
+				mheadend->m_next = NULL;
 				m_freem(mrep);
 				m_freem(rep->r_mreq);
 				goto kerbauth;
@@ -1434,11 +1434,10 @@ nfs_timer(void *arg /* never used */)
 		    nmp->nm_sent < nmp->nm_cwnd) &&
 		   (m = m_copym(rep->r_mreq, 0, M_COPYALL, MB_DONTWAIT))){
 			if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
-			    error = so_pru_send(so, 0, m, (struct sockaddr *)0,
-				     (struct mbuf *)0, td);
+			    error = so_pru_send(so, 0, m, NULL, NULL, td);
 			else
 			    error = so_pru_send(so, 0, m, nmp->nm_nam,
-			        (struct mbuf *)0, td);
+			        NULL, td);
 			if (error) {
 				if (NFSIGNORE_SOERROR(nmp->nm_soflags, error))
 					so->so_error = 0;
@@ -2240,12 +2239,12 @@ nfsrv_getstream(struct nfssvc_sock *slp, int waitflag, int *countp)
 	    recm = NULL;
 	    if (slp->ns_cc == slp->ns_reclen) {
 		recm = slp->ns_raw;
-		slp->ns_raw = slp->ns_rawend = (struct mbuf *)0;
+		slp->ns_raw = slp->ns_rawend = NULL;
 		slp->ns_cc = slp->ns_reclen = 0;
 	    } else if (slp->ns_cc > slp->ns_reclen) {
 		len = 0;
 		m = slp->ns_raw;
-		om = (struct mbuf *)0;
+		om = NULL;
 
 		while (len < slp->ns_reclen) {
 			if ((len + m->m_len) > slp->ns_reclen) {
@@ -2268,7 +2267,7 @@ nfsrv_getstream(struct nfssvc_sock *slp, int waitflag, int *countp)
 				len += m->m_len;
 				m = m->m_next;
 				recm = slp->ns_raw;
-				om->m_next = (struct mbuf *)0;
+				om->m_next = NULL;
 			} else {
 				om = m;
 				len += m->m_len;
@@ -2297,13 +2296,13 @@ nfsrv_getstream(struct nfssvc_sock *slp, int waitflag, int *countp)
 		    m_freem(slp->ns_frag);
 		} else {
 		    nfs_realign(&slp->ns_frag, 10 * NFSX_UNSIGNED);
-		    rec->nr_address = (struct sockaddr *)0;
+		    rec->nr_address = NULL;
 		    rec->nr_packet = slp->ns_frag;
 		    STAILQ_INSERT_TAIL(&slp->ns_rec, rec, nr_link);
 		    ++slp->ns_numrec;
 		    ++*countp;
 		}
-		slp->ns_frag = (struct mbuf *)0;
+		slp->ns_frag = NULL;
 	    }
 	}
 }
diff --git a/sys/vfs/nfs/nfs_subs.c b/sys/vfs/nfs/nfs_subs.c
index 5c65067..8dce3fa 100644
--- a/sys/vfs/nfs/nfs_subs.c
+++ b/sys/vfs/nfs/nfs_subs.c
@@ -722,7 +722,7 @@ nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type,
 	}
 	mb->m_next = mrest;
 	mreq->m_pkthdr.len = authsiz + 10 * NFSX_UNSIGNED + mrest_len;
-	mreq->m_pkthdr.rcvif = (struct ifnet *)0;
+	mreq->m_pkthdr.rcvif = NULL;
 	*mbp = mb;
 	return (mreq);
 }
@@ -1058,7 +1058,7 @@ nfs_init(struct vfsconf *vfsp)
 	/* Ensure async daemons disabled */
 	for (i = 0; i < NFS_MAXASYNCDAEMON; i++) {
 		nfs_iodwant[i] = NULL;
-		nfs_iodmount[i] = (struct nfsmount *)0;
+		nfs_iodmount[i] = NULL;
 	}
 	nfs_nhinit();			/* Init the nfsnode table */
 #ifndef NFS_NOSERVER
@@ -1662,7 +1662,7 @@ nfsm_adj(struct mbuf *mp, int len, int nul)
 	m = mp;
 	for (;;) {
 		count += m->m_len;
-		if (m->m_next == (struct mbuf *)0)
+		if (m->m_next == NULL)
 			break;
 		m = m->m_next;
 	}
@@ -1949,14 +1949,14 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add)
 			dp->ndm_eocookie = 0;
 			LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
 		} else
-			return ((nfsuint64 *)0);
+			return (NULL);
 	}
 	while (pos >= NFSNUMCOOKIES) {
 		pos -= NFSNUMCOOKIES;
 		if (dp->ndm_list.le_next) {
 			if (!add && dp->ndm_eocookie < NFSNUMCOOKIES &&
 				pos >= dp->ndm_eocookie)
-				return ((nfsuint64 *)0);
+				return (NULL);
 			dp = dp->ndm_list.le_next;
 		} else if (add) {
 			MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
@@ -1965,13 +1965,13 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add)
 			LIST_INSERT_AFTER(dp, dp2, ndm_list);
 			dp = dp2;
 		} else
-			return ((nfsuint64 *)0);
+			return (NULL);
 	}
 	if (pos >= dp->ndm_eocookie) {
 		if (add)
 			dp->ndm_eocookie = pos + 1;
 		else
-			return ((nfsuint64 *)0);
+			return (NULL);
 	}
 	return (&dp->ndm_cookies[pos]);
 }
diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c
index ef361d2..e1c913e 100644
--- a/sys/vfs/nfs/nfs_syscalls.c
+++ b/sys/vfs/nfs/nfs_syscalls.c
@@ -205,7 +205,7 @@ sys_nfssvc(struct nfssvc_args *uap)
 		 * Get the client address for connected sockets.
 		 */
 		if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
-			nam = (struct sockaddr *)0;
+			nam = NULL;
 		else {
 			error = getsockaddr(&nam, nfsdarg.name,
 					    nfsdarg.namelen);
@@ -250,12 +250,12 @@ sys_nfssvc(struct nfssvc_args *uap)
 				   kmalloc(sizeof (struct nfsuid), M_NFSUID,
 					M_WAITOK);
 			    } else
-				nuidp = (struct nfsuid *)0;
+				nuidp = NULL;
 			    if ((slp->ns_flag & SLP_VALID) == 0) {
 				if (nuidp)
 				    kfree((caddr_t)nuidp, M_NFSUID);
 			    } else {
-				if (nuidp == (struct nfsuid *)0) {
+				if (nuidp == NULL) {
 				    nuidp = TAILQ_FIRST(&slp->ns_uidlruhead);
 				    LIST_REMOVE(nuidp, nu_hash);
 				    TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
@@ -328,7 +328,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td)
 
 	so = (struct socket *)fp->f_data;
 #if 0
-	tslp = (struct nfssvc_sock *)0;
+	tslp = NULL;
 	/*
 	 * Add it to the list, as required.
 	 */
@@ -441,7 +441,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td)
 	cacherep = RC_DOIT;
 	writes_todo = 0;
 #endif
-	if (nfsd == (struct nfsd *)0) {
+	if (nfsd == NULL) {
 		nsd->nsd_nfsd = nfsd = (struct nfsd *)
 			kmalloc(sizeof (struct nfsd), M_NFSD, M_WAITOK|M_ZERO);
 		crit_enter();
@@ -479,7 +479,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td)
 				if (slp == 0)
 					nfsd_head_flag &= ~NFSD_CHECKSLP;
 			}
-			if ((slp = nfsd->nfsd_slp) == (struct nfssvc_sock *)0)
+			if ((slp = nfsd->nfsd_slp) == NULL)
 				continue;
 			if (slp->ns_flag & SLP_VALID) {
 				if (slp->ns_flag & SLP_DISCONN)
@@ -511,7 +511,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td)
 				kfree((caddr_t)nd, M_NFSRVDESC);
 				nd = NULL;
 			}
-			nfsd->nfsd_slp = (struct nfssvc_sock *)0;
+			nfsd->nfsd_slp = NULL;
 			nfsd->nfsd_flag &= ~NFSD_REQINPROG;
 			nfsrv_slpderef(slp);
 			continue;
@@ -603,7 +603,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td)
 			}
 			nfsstats.srvrpccnt[nd->nd_procnum]++;
 			nfsrv_updatecache(nd, TRUE, mreq);
-			nd->nd_mrep = (struct mbuf *)0;
+			nd->nd_mrep = NULL;
 		    case RC_REPLY:
 			m = mreq;
 			siz = 0;
@@ -617,7 +617,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td)
 			}
 			m = mreq;
 			m->m_pkthdr.len = siz;
-			m->m_pkthdr.rcvif = (struct ifnet *)0;
+			m->m_pkthdr.rcvif = NULL;
 			/*
 			 * For stream protocols, prepend a Sun RPC
 			 * Record Mark.
@@ -691,7 +691,7 @@ done:
 	TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain);
 	crit_exit();
 	kfree((caddr_t)nfsd, M_NFSD);
-	nsd->nsd_nfsd = (struct nfsd *)0;
+	nsd->nsd_nfsd = NULL;
 	if (--nfs_numnfsd == 0)
 		nfsrv_init(TRUE);	/* Reinitialize everything */
 	return (error);
@@ -716,7 +716,7 @@ nfsrv_zapsock(struct nfssvc_sock *slp)
 	slp->ns_flag &= ~SLP_ALLFLAGS;
 	fp = slp->ns_fp;
 	if (fp) {
-		slp->ns_fp = (struct file *)0;
+		slp->ns_fp = NULL;
 		so = slp->ns_so;
 		so->so_rcv.ssb_flags &= ~SSB_UPCALL;
 		so->so_upcall = NULL;
diff --git a/sys/vfs/nfs/nfs_vfsops.c b/sys/vfs/nfs/nfs_vfsops.c
index ed7528c..4a05d64 100644
--- a/sys/vfs/nfs/nfs_vfsops.c
+++ b/sys/vfs/nfs/nfs_vfsops.c
@@ -306,7 +306,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct ucred *cred)
 	u_quad_t tquad;
 
 #ifndef nolint
-	sfp = (struct nfs_statfs *)0;
+	sfp = NULL;
 #endif
 	error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
 	if (error)
@@ -777,7 +777,7 @@ nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp)
 	if (nmp->nm_so && adjsock) {
 		nfs_safedisconnect(nmp);
 		if (nmp->nm_sotype == SOCK_DGRAM)
-			while (nfs_connect(nmp, (struct nfsreq *)0)) {
+			while (nfs_connect(nmp, NULL)) {
 				kprintf("nfs_args: retrying connect\n");
 				(void) tsleep((caddr_t)&lbolt, 0, "nfscon", 0);
 			}
@@ -943,7 +943,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
 	 * the first request, in case the server is not responding.
 	 */
 	if (nmp->nm_sotype == SOCK_DGRAM &&
-		(error = nfs_connect(nmp, (struct nfsreq *)0)))
+		(error = nfs_connect(nmp, NULL)))
 		goto bad;
 
 	/*
diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c
index 1e1e284..656190b 100644
--- a/sys/vfs/nfs/nfs_vnops.c
+++ b/sys/vfs/nfs/nfs_vnops.c
@@ -826,7 +826,7 @@ nfs_setattrrpc(struct vnode *vp, struct vattr *vap,
 		np->n_modestamp = 0;
 		nfsm_wcc_data(vp, wccflag);
 	} else
-		nfsm_loadattr(vp, (struct vattr *)0);
+		nfsm_loadattr(vp, NULL);
 	m_freem(mrep);
 nfsmout:
 	return (error);
@@ -1041,7 +1041,7 @@ nfs_lookup(struct vop_old_lookup_args *ap)
 			nfsm_postop_attr(newvp, attrflag, NFS_LATTR_NOSHRINK);
 			nfsm_postop_attr(dvp, attrflag, NFS_LATTR_NOSHRINK);
 		} else
-			nfsm_loadattr(newvp, (struct vattr *)0);
+			nfsm_loadattr(newvp, NULL);
 		*vpp = newvp;
 		m_freem(mrep);
 		if (!lockparent) {
@@ -1088,7 +1088,7 @@ nfs_lookup(struct vop_old_lookup_args *ap)
 		nfsm_postop_attr(newvp, attrflag, NFS_LATTR_NOSHRINK);
 		nfsm_postop_attr(dvp, attrflag, NFS_LATTR_NOSHRINK);
 	} else
-		nfsm_loadattr(newvp, (struct vattr *)0);
+		nfsm_loadattr(newvp, NULL);
 #if 0
 	/* XXX MOVE TO nfs_nremove() */
 	if ((cnp->cn_flags & CNP_MAKEENTRY) &&
@@ -1240,7 +1240,7 @@ nfs_readrpc(struct vnode *vp, struct uio *uiop)
 			nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			eof = fxdr_unsigned(int, *(tl + 1));
 		} else
-			nfsm_loadattr(vp, (struct vattr *)0);
+			nfsm_loadattr(vp, NULL);
 		nfsm_strsiz(retlen, nmp->nm_rsize);
 		nfsm_mtouio(uiop, retlen);
 		m_freem(mrep);
@@ -1357,7 +1357,7 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, int *iomode, int *must_commit)
 				}
 			}
 		} else {
-			nfsm_loadattr(vp, (struct vattr *)0);
+			nfsm_loadattr(vp, NULL);
 		}
 		m_freem(mrep);
 		if (error)
@@ -1386,8 +1386,8 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
 	u_int32_t *tl;
 	caddr_t cp;
 	int32_t t1, t2;
-	struct vnode *newvp = (struct vnode *)0;
-	struct nfsnode *np = (struct nfsnode *)0;
+	struct vnode *newvp = NULL;
+	struct nfsnode *np = NULL;
 	struct vattr vattr;
 	char *cp2;
 	caddr_t bpos, dpos;
@@ -1437,7 +1437,7 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
 		if (!gotvp) {
 			if (newvp) {
 				vput(newvp);
-				newvp = (struct vnode *)0;
+				newvp = NULL;
 			}
 			error = nfs_lookitup(dvp, cnp->cn_nameptr,
 			    cnp->cn_namelen, cnp->cn_cred, cnp->cn_td, &np);
@@ -1492,8 +1492,8 @@ nfs_create(struct vop_old_create_args *ap)
 	u_int32_t *tl;
 	caddr_t cp;
 	int32_t t1, t2;
-	struct nfsnode *np = (struct nfsnode *)0;
-	struct vnode *newvp = (struct vnode *)0;
+	struct nfsnode *np = NULL;
+	struct vnode *newvp = NULL;
 	caddr_t bpos, dpos, cp2;
 	int error = 0, wccflag = NFSV3_WCCRATTR, gotvp = 0, fmode = 0;
 	struct mbuf *mreq, *mrep, *md, *mb, *mb2;
@@ -1548,7 +1548,7 @@ again:
 		if (!gotvp) {
 			if (newvp) {
 				vput(newvp);
-				newvp = (struct vnode *)0;
+				newvp = NULL;
 			}
 			error = nfs_lookitup(dvp, cnp->cn_nameptr,
 			    cnp->cn_namelen, cnp->cn_cred, cnp->cn_td, &np);
@@ -1911,7 +1911,7 @@ nfs_symlink(struct vop_old_symlink_args *ap)
 	caddr_t bpos, dpos, cp2;
 	int slen, error = 0, wccflag = NFSV3_WCCRATTR, gotvp;
 	struct mbuf *mreq, *mrep, *md, *mb, *mb2;
-	struct vnode *newvp = (struct vnode *)0;
+	struct vnode *newvp = NULL;
 	int v3 = NFS_ISV3(dvp);
 
 	nfsstats.rpccnt[NFSPROC_SYMLINK]++;
@@ -2005,8 +2005,8 @@ nfs_mkdir(struct vop_old_mkdir_args *ap)
 	caddr_t cp;
 	int32_t t1, t2;
 	int len;
-	struct nfsnode *np = (struct nfsnode *)0;
-	struct vnode *newvp = (struct vnode *)0;
+	struct nfsnode *np = NULL;
+	struct vnode *newvp = NULL;
 	caddr_t bpos, dpos, cp2;
 	int error = 0, wccflag = NFSV3_WCCRATTR;
 	int gotvp = 0;
@@ -2051,7 +2051,7 @@ nfsmout:
 	if (error == EEXIST || (!error && !gotvp)) {
 		if (newvp) {
 			vrele(newvp);
-			newvp = (struct vnode *)0;
+			newvp = NULL;
 		}
 		error = nfs_lookitup(dvp, cnp->cn_nameptr, len, cnp->cn_cred,
 			cnp->cn_td, &np);
@@ -2557,7 +2557,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop)
 				dpos = dpossav1;
 				mdsav2 = md;
 				md = mdsav1;
-				nfsm_loadattr(newvp, (struct vattr *)0);
+				nfsm_loadattr(newvp, NULL);
 				dpos = dpossav2;
 				md = mdsav2;
 				dp->nfs_type =
@@ -2678,7 +2678,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
 
 	/* Try lookitups until we get one that isn't there */
 	while (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
-		cnp->cn_td, (struct nfsnode **)0) == 0) {
+		cnp->cn_td, NULL) == 0) {
 		sp->s_name[4]++;
 		if (sp->s_name[4] > 'z') {
 			error = EINVAL;
@@ -2714,7 +2714,7 @@ nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred,
 	u_int32_t *tl;
 	caddr_t cp;
 	int32_t t1, t2;
-	struct vnode *newvp = (struct vnode *)0;
+	struct vnode *newvp = NULL;
 	struct nfsnode *np, *dnp = VTONFS(dvp);
 	caddr_t bpos, dpos, cp2;
 	int error = 0, fhlen, attrflag;
@@ -2762,7 +2762,7 @@ nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred,
 				return (ENOENT);
 			}
 		} else
-			nfsm_loadattr(newvp, (struct vattr *)0);
+			nfsm_loadattr(newvp, NULL);
 	}
 	m_freem(mrep);
 nfsmout:
@@ -3004,7 +3004,7 @@ nfs_flush(struct vnode *vp, int waitfor, struct thread *td, int commit)
 				 * We have to be able to break out if this 
 				 * is an 'intr' mount.
 				 */
-				if (nfs_sigintr(nmp, (struct nfsreq *)0, td)) {
+				if (nfs_sigintr(nmp, NULL, td)) {
 					error = -EINTR;
 					break;
 				}
diff --git a/sys/vfs/nfs/nfsm_subs.h b/sys/vfs/nfs/nfsm_subs.h
index 23a9809..bc78b4f 100644
--- a/sys/vfs/nfs/nfsm_subs.h
+++ b/sys/vfs/nfs/nfsm_subs.h
@@ -192,7 +192,7 @@ struct mbuf *nfsm_rpchead (struct ucred *cr, int nmflag, int procid,
 				nfsm_adv(NFSX_V3FATTR); \
 		} \
 		if (f) \
-			nfsm_loadattr((v), (struct vattr *)0); \
+			nfsm_loadattr((v), NULL); \
 	} while (0)
 
 #define nfsm_getfh(f, s, v3) \
@@ -227,7 +227,7 @@ struct mbuf *nfsm_rpchead (struct ucred *cr, int nmflag, int procid,
 		nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
 		if (((f) = fxdr_unsigned(int, *tl)) != 0) { \
 			if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \
-				(struct vattr *)0, lflags)) != 0) { \
+				NULL, lflags)) != 0) { \
 				error = t1; \
 				(f) = 0; \
 				m_freem(mrep); \
diff --git a/sys/vfs/nwfs/nwfs_vnops.c b/sys/vfs/nwfs/nwfs_vnops.c
index 2514d12..1faaaae 100644
--- a/sys/vfs/nwfs/nwfs_vnops.c
+++ b/sys/vfs/nwfs/nwfs_vnops.c
@@ -400,7 +400,7 @@ nwfs_create(struct vop_old_create_args *ap)
 	struct vattr *vap = ap->a_vap;
 	struct vnode **vpp=ap->a_vpp;
 	struct componentname *cnp = ap->a_cnp;
-	struct vnode *vp = (struct vnode *)0;
+	struct vnode *vp = NULL;
 	int error = 0, fmode;
 	struct vattr vattr;
 	struct nwnode *np;
@@ -595,7 +595,7 @@ nwfs_mkdir(struct vop_old_mkdir_args *ap)
 	int len=cnp->cn_namelen;
 	struct ncp_open_info no;
 	struct nwnode *np;
-	struct vnode *newvp = (struct vnode *)0;
+	struct vnode *newvp = NULL;
 	ncpfid fid;
 	int error = 0;
 	struct vattr vattr;
diff --git a/sys/vfs/ufs/ffs_balloc.c b/sys/vfs/ufs/ffs_balloc.c
index 819e994..670eac4 100644
--- a/sys/vfs/ufs/ffs_balloc.c
+++ b/sys/vfs/ufs/ffs_balloc.c
@@ -241,7 +241,7 @@ ffs_balloc(struct vop_balloc_args *ap)
 	--num;
 	nb = ip->i_ib[indirs[0].in_off];
 	if (nb == 0) {
-		pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0);
+		pref = ffs_blkpref(ip, lbn, 0, NULL);
 		/*
 		 * If the filesystem has run out of space we can skip the
 		 * full fsync/undo of the main [fail] case since no undo
@@ -295,7 +295,7 @@ ffs_balloc(struct vop_balloc_args *ap)
 			continue;
 		}
 		if (pref == 0)
-			pref = ffs_blkpref(ip, lbn, 0, (ufs_daddr_t *)0);
+			pref = ffs_blkpref(ip, lbn, 0, NULL);
 		if ((error =
 		    ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred, &newb)) != 0) {
 			brelse(bp);
diff --git a/sys/vfs/ufs/ufs_lookup.c b/sys/vfs/ufs/ufs_lookup.c
index 9a0b4d2..39d4b15 100644
--- a/sys/vfs/ufs/ufs_lookup.c
+++ b/sys/vfs/ufs/ufs_lookup.c
@@ -1132,7 +1132,7 @@ ufs_checkpath(struct inode *source, struct inode *target, struct ucred *cred)
 		}
 		error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
 				sizeof (struct dirtemplate), (off_t)0,
-				UIO_SYSSPACE, IO_NODELOCKED, cred, (int *)0);
+				UIO_SYSSPACE, IO_NODELOCKED, cred, NULL);
 		if (error != 0)
 			break;
 #		if (BYTE_ORDER == LITTLE_ENDIAN)
diff --git a/sys/vfs/ufs/ufs_quota.c b/sys/vfs/ufs/ufs_quota.c
index 49da8ac..bcf283f 100644
--- a/sys/vfs/ufs/ufs_quota.c
+++ b/sys/vfs/ufs/ufs_quota.c
@@ -960,7 +960,7 @@ ufs_dqflush(struct vnode *vp)
 			if (dq->dq_cnt)
 				panic("dqflush: stray dquot");
 			LIST_REMOVE(dq, dq_hash);
-			dq->dq_ump = (struct ufsmount *)0;
+			dq->dq_ump = NULL;
 		}
 	}
 }
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 0e994ef..f166a1e 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -3567,7 +3567,7 @@ DB_SHOW_COMMAND(map, vm_map_print)
 				db_indent += 2;
 				vm_map_print((db_expr_t)(intptr_t)
 					     entry->object.sub_map,
-					     full, 0, (char *)0);
+					     full, 0, NULL);
 				db_indent -= 2;
 			}
 		} else {
@@ -3587,7 +3587,7 @@ DB_SHOW_COMMAND(map, vm_map_print)
 				db_indent += 2;
 				vm_object_print((db_expr_t)(intptr_t)
 						entry->object.vm_object,
-						full, 0, (char *)0);
+						full, 0, NULL);
 				nlines += 4;
 				db_indent -= 2;
 			}
diff --git a/test/stress/fsx/fsx.c b/test/stress/fsx/fsx.c
index fdf4e3a..64c63df 100644
--- a/test/stress/fsx/fsx.c
+++ b/test/stress/fsx/fsx.c
@@ -956,7 +956,7 @@ main(int argc, char **argv)
 	page_size = getpagesize();
 	page_mask = page_size - 1;
 
-	setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
+	setvbuf(stdout, NULL, _IOLBF, 0); /* line buffered stdout */
 
 	while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:W"))
 	       != EOF)
diff --git a/tools/regression/fsx/fsx.c b/tools/regression/fsx/fsx.c
index ec1966e..b75a311 100644
--- a/tools/regression/fsx/fsx.c
+++ b/tools/regression/fsx/fsx.c
@@ -934,7 +934,7 @@ main(int argc, char **argv)
 	page_size = getpagesize();
 	page_mask = page_size - 1;
 
-	setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
+	setvbuf(stdout, NULL, _IOLBF, 0); /* line buffered stdout */
 
 	while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:W"))
 	       != EOF)
diff --git a/usr.bin/chat/chat.c b/usr.bin/chat/chat.c
index 488b160..4cc0502 100644
--- a/usr.bin/chat/chat.c
+++ b/usr.bin/chat/chat.c
@@ -132,7 +132,7 @@ int have_tty_parameters = 0;
 #define set_term_param(param) tcsetattr(0, TCSANOW, param)
 struct termios saved_tty_parameters;
 
-char *abort_string[MAX_ABORTS], *fail_reason = (char *)0,
+char *abort_string[MAX_ABORTS], *fail_reason = NULL,
 	fail_buffer[50];
 int n_aborts = 0, abort_next = 0, timeout_next = 0, echo_next = 0;
 int clear_abort_next = 0;
@@ -1177,7 +1177,7 @@ get_string(char *string)
     char *s = temp, *end = s + STR_LEN;
     char *logged = temp;
 
-    fail_reason = (char *)0;
+    fail_reason = NULL;
 
     if (strlen(string) > STR_LEN) {
 	chat_logf("expect string is too long");
diff --git a/usr.bin/doscmd/AsyncIO.h b/usr.bin/doscmd/AsyncIO.h
index 0649ae3..c9b0958 100644
--- a/usr.bin/doscmd/AsyncIO.h
+++ b/usr.bin/doscmd/AsyncIO.h
@@ -47,4 +47,4 @@ void	_RegisterIO(int, void (*)(int, int, void *, regcontext_t *),
 }
 #endif
 
-#define	_Un_RegisterIO(x) _RegisterIO((x), (void (*))0, (void *)0, (void (*))0)
+#define	_Un_RegisterIO(x) _RegisterIO((x), (void (*))0, NULL, (void (*))0)
diff --git a/usr.bin/doscmd/ParseBuffer.c b/usr.bin/doscmd/ParseBuffer.c
index fada186..87d3ebc 100644
--- a/usr.bin/doscmd/ParseBuffer.c
+++ b/usr.bin/doscmd/ParseBuffer.c
@@ -71,7 +71,7 @@ ParseBuffer(char *obuf, char **av, int mac)
 
                         *a++ = buf;
 			if (a == e) {
-				a[-1] = (char *)0;
+				a[-1] = NULL;
 				return(mac - 1);
 			}
 
@@ -84,6 +84,6 @@ ParseBuffer(char *obuf, char **av, int mac)
                         buf = p;
                 }
         }
-        *a = (char *)0;
+        *a = NULL;
         return(a - av);
 }
diff --git a/usr.bin/doscmd/doscmd.c b/usr.bin/doscmd/doscmd.c
index 7e9b401..d5b3dd1 100644
--- a/usr.bin/doscmd/doscmd.c
+++ b/usr.bin/doscmd/doscmd.c
@@ -67,7 +67,7 @@ int		booting = 0;
 int		raw_kbd = 0;
 int		timer_disable = 0;
 struct timeval	boot_time;
-unsigned long	*ivec = (unsigned long *)0;
+unsigned long	*ivec = NULL;
 
 #ifndef USE_VM86
 #define PRB_V86_FORMAT  0x4242
diff --git a/usr.bin/doscmd/mem.c b/usr.bin/doscmd/mem.c
index bd39a28..3f81663 100644
--- a/usr.bin/doscmd/mem.c
+++ b/usr.bin/doscmd/mem.c
@@ -47,7 +47,7 @@ char	*dosmem;
 /* locals */
 static int	dosmem_size;
 
-static char	*next_p = (char *)0;
+static char	*next_p = NULL;
 static char	*end_p  = (char *)0xB0000L;
 
 static char *
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index ae2aee0..17ff188 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -225,7 +225,7 @@ trying(const struct addrinfo *ai)
 	char buf[NI_MAXHOST];
 
 	if (getnameinfo(ai->ai_addr, ai->ai_addrlen, buf, sizeof buf,
-			(char *)0, 0, NI_NUMERICHOST) != 0)
+			NULL, 0, NI_NUMERICHOST) != 0)
 		return;		/* XXX can't happen */
 
 	printf("Trying %s...\n", buf);
diff --git a/usr.bin/kzip/kzip.c b/usr.bin/kzip/kzip.c
index 861a1d1..f1e38b9 100644
--- a/usr.bin/kzip/kzip.c
+++ b/usr.bin/kzip/kzip.c
@@ -132,7 +132,7 @@ main(int argc, char **argv)
 		close(pipe1[0]); close(pipe1[1]);
 		close(pipe2[0]); close(pipe2[1]);
 		close(fdi); close(fdo);
-		execlp("gzip", "gzip", "-9", "-n", 0);
+		execlp("gzip", "gzip", "-9", "-n", NULL);
 		exit (0);
 	}
 
@@ -204,7 +204,7 @@ main(int argc, char **argv)
 			"/usr/lib/aout/kzhead.o",
 			obj,
 			"/usr/lib/aout/kztail.o",
-			0);
+			NULL);
 		exit(2);
 	}
 
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 078cd92..554c38b 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -649,7 +649,7 @@ main(int argc, char **argv)
 		err(1, "asprintf()");
 	}
 
-	execlp(shell, arg0, (char *)0);
+	execlp(shell, arg0, NULL);
 	err(1, "%s", shell);
 
 	/*
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 53dab5d..c6984ce 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -797,7 +797,7 @@ icmp_stats(u_long off __unused, char *name, int af __unused)
 #undef p2
 	mib[3] = ICMPCTL_MASKREPL;
 	len = sizeof i;
-	if (sysctl(mib, 4, &i, &len, (void *)0, 0) < 0)
+	if (sysctl(mib, 4, &i, &len, NULL, 0) < 0)
 		return;
 	printf("\tICMP address mask responses are %sabled\n", 
 	       i ? "en" : "dis");
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 9ac29a9..558e699 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -353,7 +353,7 @@ ip6_stats(u_long off __unused, char *name, int af __unused)
 
 	len = sizeof ip6stat;
 	memset(&ip6stat, 0, len);
-	if (sysctl(mib, 4, &ip6stat, &len, (void *)0, 0) < 0)
+	if (sysctl(mib, 4, &ip6stat, &len, NULL, 0) < 0)
 		return;
 	printf("%s:\n", name);
 
@@ -826,7 +826,7 @@ icmp6_stats(u_long off __unused, char *name, int af __unused)
 
 	len = sizeof icmp6stat;
 	memset(&icmp6stat, 0, len);
-	if (sysctl(mib, 4, &icmp6stat, &len, (void *)0, 0) < 0)
+	if (sysctl(mib, 4, &icmp6stat, &len, NULL, 0) < 0)
 		return;
 	printf("%s:\n", name);
 
diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c
index 0c7a614..26348b6 100644
--- a/usr.bin/netstat/iso.c
+++ b/usr.bin/netstat/iso.c
@@ -398,7 +398,7 @@ isonetprint(struct iso_addr *iso, char *sufx, u_short sufxlen, int islocal)
 
 	line =  isonetname(iso);
 	cp = strchr(line, '\0');
-	ihe = (struct iso_hostent *)0;
+	ihe = NULL;
 
 	if( islocal )
 		islocal = 20;
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 3c04ce8..03647ee 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -797,7 +797,7 @@ p_rtentry(struct rtentry *rt)
 			time_t expire_time;
 
 			if ((expire_time =
-			    rt->rt_rmx.rmx_expire - time((time_t *)0)) > 0)
+			    rt->rt_rmx.rmx_expire - time(NULL)) > 0)
 				printf(" %*d", wid_expire, (int)expire_time);
 		} else {
 			printf("%*s ", wid_expire, "");
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index 0dd78b8..5ab46be 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -116,7 +116,7 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
 	if (unp->unp_addr)
 		sa = &xunp->xu_addr;
 	else
-		sa = (struct sockaddr_un *)0;
+		sa = NULL;
 
 	if (first) {
 		printf("Active UNIX domain sockets\n");
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index 0cf198b..e58194e 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -174,7 +174,7 @@ readstats(struct nfsstats *stp)
 		name[0] = CTL_VFS;
 		name[1] = vfc.vfc_typenum;
 		name[2] = NFS_NFSSTATS;
-		if (sysctl(name, 3, stp, &buflen, (void *)0, (size_t)0) < 0) {
+		if (sysctl(name, 3, stp, &buflen, NULL, (size_t)0) < 0) {
 			err(1, "sysctl");
 		}
 	}
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index d514e85..a3b4b7f 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -310,7 +310,7 @@ showquotas(int type, u_long id, const char *name)
 		    qup->dqblk.dqb_bsoftlimit == 0 &&
 		    qup->dqblk.dqb_bhardlimit == 0)
 			continue;
-		msgi = (char *)0;
+		msgi = NULL;
 		if (qup->dqblk.dqb_ihardlimit &&
 		    qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_ihardlimit)
 			msgi = "File limit reached on";
@@ -321,7 +321,7 @@ showquotas(int type, u_long id, const char *name)
 			else
 				msgi = "Over file quota on";
 		}
-		msgb = (char *)0;
+		msgb = NULL;
 		if (qup->dqblk.dqb_bhardlimit &&
 		    qup->dqblk.dqb_curblocks >= qup->dqblk.dqb_bhardlimit)
 			msgb = "Block limit reached on";
@@ -333,12 +333,12 @@ showquotas(int type, u_long id, const char *name)
 				msgb = "Over block quota on";
 		}
 		if (qflag) {
-			if ((msgi != (char *)0 || msgb != (char *)0) &&
+			if ((msgi != NULL || msgb != NULL) &&
 			    lines++ == 0)
 				heading(type, id, name, "");
-			if (msgi != (char *)0)
+			if (msgi != NULL)
 				printf("\t%s %s\n", msgi, qup->fsname);
-			if (msgb != (char *)0)
+			if (msgb != NULL)
 				printf("\t%s %s\n", msgb, qup->fsname);
 			continue;
 		}
@@ -356,19 +356,19 @@ showquotas(int type, u_long id, const char *name)
 				, nam
 				, (u_long) (dbtob(qup->dqblk.dqb_curblocks)
 					    / 1024)
-				, (msgb == (char *)0) ? ' ' : '*'
+				, (msgb == NULL) ? ' ' : '*'
 				, (u_long) (dbtob(qup->dqblk.dqb_bsoftlimit)
 					    / 1024)
 				, (u_long) (dbtob(qup->dqblk.dqb_bhardlimit)
 					    / 1024)
-				, (msgb == (char *)0) ? ""
+				, (msgb == NULL) ? ""
 				    :timeprt(qup->dqblk.dqb_btime));
 			printf("%8lu%c%7lu%8lu%8s\n"
 				, (u_long)qup->dqblk.dqb_curinodes
-				, (msgi == (char *)0) ? ' ' : '*'
+				, (msgi == NULL) ? ' ' : '*'
 				, (u_long)qup->dqblk.dqb_isoftlimit
 				, (u_long)qup->dqblk.dqb_ihardlimit
-				, (msgi == (char *)0) ? ""
+				, (msgi == NULL) ? ""
 				    : timeprt(qup->dqblk.dqb_itime)
 			);
 			continue;
@@ -441,7 +441,7 @@ getprivs(long id, int quotatype)
 	struct statfs *fst;
 	int nfst, i;
 
-	qup = quphead = (struct quotause *)0;
+	qup = quphead = NULL;
 
 	nfst = getmntinfo(&fst, MNT_NOWAIT);
 	if (nfst == 0)
diff --git a/usr.bin/rdist/Makefile b/usr.bin/rdist/Makefile
index f751429..5645c20 100644
--- a/usr.bin/rdist/Makefile
+++ b/usr.bin/rdist/Makefile
@@ -6,7 +6,7 @@ PROG=	rdist
 SRCS=	docmd.c expand.c gram.y lookup.c main.c rshrcmd.c server.c
 CFLAGS+=-I${.CURDIR}
 YFLAGS=
-WARNS?=	0
+WARNS?=	2
 
 # To use the old method, which requires setuid-root and all the baggage and
 # security holes that goes with it, uncomment:
diff --git a/usr.bin/rdist/server.c b/usr.bin/rdist/server.c
index 4a59700..3f6bdf4 100644
--- a/usr.bin/rdist/server.c
+++ b/usr.bin/rdist/server.c
@@ -1360,7 +1360,7 @@ dospecial(char *cmd)
 		close(fd[1]);
 		setgid(groupid);
 		setuid(userid);
-		execl(_PATH_BSHELL, "sh", "-c", cmd, 0);
+		execl(_PATH_BSHELL, "sh", "-c", cmd, NULL);
 		_exit(127);
 	}
 	close(fd[1]);
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c
index 27c8d9f..b700886 100644
--- a/usr.bin/systat/ifstat.c
+++ b/usr.bin/systat/ifstat.c
@@ -259,7 +259,7 @@ fetchifstat(void)
 		old_outb = ifp->if_mib.ifmd_data.ifi_obytes;
 		ifp->tv_lastchanged = ifp->if_mib.ifmd_data.ifi_lastchange;
 
-		if (gettimeofday(&new_tv, (struct timezone *)0) != 0)
+		if (gettimeofday(&new_tv, NULL) != 0)
 			IFSTAT_ERR(2, "error getting time of day");
 		(void)getifmibdata(ifp->if_row, &ifp->if_mib);
 
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index 43b5640..969fbf4 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -91,7 +91,7 @@ main(int argc, char **argv)
 			p = lookup(&argv[0][1]);
 			if (p == (struct cmdtab *)-1)
 				errx(1, "%s: ambiguous request", &argv[0][1]);
-			if (p == (struct cmdtab *)0)
+			if (p == NULL)
 				errx(1, "%s: unknown request", &argv[0][1]);
 			curcmd = p;
 		} else {
diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c
index 50bd3b8..582abfc 100644
--- a/usr.bin/talk/init_disp.c
+++ b/usr.bin/talk/init_disp.c
@@ -76,9 +76,9 @@ init_display(void)
 
 	if (initscr() == NULL)
 		errx(1, "Terminal type unset or lacking necessary features.");
-	(void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
+	(void) sigaction(SIGTSTP, NULL, &sa);
 	sigaddset(&sa.sa_mask, SIGALRM);
-	(void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
+	(void) sigaction(SIGTSTP, &sa, NULL);
 	curses_initialized = 1;
 	clear();
 	refresh();
diff --git a/usr.bin/talk/invite.c b/usr.bin/talk/invite.c
index b1b0a16..d6c8d4b 100644
--- a/usr.bin/talk/invite.c
+++ b/usr.bin/talk/invite.c
@@ -87,7 +87,7 @@ invite_remote(void)
 	 * so we can use the interupt timer to resend the invitation
 	 */
 	end_msgs();
-	setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+	setitimer(ITIMER_REAL, &itimer, NULL);
 	message("Waiting for your party to respond");
 	signal(SIGALRM, re_invite);
 	(void) setjmp(invitebuf);
diff --git a/usr.bin/talk/msgs.c b/usr.bin/talk/msgs.c
index cc82d12..ee9fa53 100644
--- a/usr.bin/talk/msgs.c
+++ b/usr.bin/talk/msgs.c
@@ -64,7 +64,7 @@ start_msgs(void)
 	signal(SIGALRM, disp_msg);
 	itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
 	itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
-	setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+	setitimer(ITIMER_REAL, &itimer, NULL);
 }
 
 void
@@ -74,6 +74,6 @@ end_msgs(void)
 
 	timerclear(&itimer.it_value);
 	timerclear(&itimer.it_interval);
-	setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+	setitimer(ITIMER_REAL, &itimer, NULL);
 	signal(SIGALRM, SIG_DFL);
 }
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index e17a487..079d324 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1314,14 +1314,14 @@ shell(int argc, char *argv[] __unused)
 	    else
 		shellname++;
 	    if (argc > 1)
-		execl(shellp, shellname, "-c", &saveline[1], (char *)0);
+		execl(shellp, shellname, "-c", &saveline[1], NULL);
 	    else
-		execl(shellp, shellname, (char *)0);
+		execl(shellp, shellname, NULL);
 	    perror("Execl");
 	    _exit(1);
 	}
     default:
-	    (void)wait((int *)0);	/* Wait for the shell to complete */
+	    (void)wait(NULL);	/* Wait for the shell to complete */
 
 	    if (TerminalWindowSize(&newrows, &newcols) && connected &&
 		(err_ || ((oldrows != newrows) || (oldcols != newcols)))) {
@@ -2411,7 +2411,7 @@ help(int argc, char *argv[])
 		c = getcmd(arg);
 		if (Ambiguous((void *)c))
 			printf("?Ambiguous help command %s\n", arg);
-		else if (c == (Command *)0)
+		else if (c == NULL)
 			printf("?Invalid help command %s\n", arg);
 		else
 			printf("%s\n", c->help);
diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c
index 94a7794..336dec9 100644
--- a/usr.bin/telnet/network.c
+++ b/usr.bin/telnet/network.c
@@ -86,7 +86,7 @@ stilloob(void)
     do {
 	FD_ZERO(&excepts);
 	FD_SET(net, &excepts);
-	value = select(net+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout);
+	value = select(net+1, NULL, NULL, &excepts, &timeout);
     } while ((value == -1) && (errno == EINTR));
 
     if (value < 0) {
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c
index e1664ca..f05fb10 100644
--- a/usr.bin/telnet/sys_bsd.c
+++ b/usr.bin/telnet/sys_bsd.c
@@ -306,7 +306,7 @@ tcval(int func)
     case SLC_BRK:
     case SLC_EOR:
     default:
-	return((cc_t *)0);
+	return(NULL);
     }
 }
 
@@ -963,7 +963,7 @@ process_rings(int netin, int netout, int netex, int ttyin, int ttyout, int poll)
     if (netex)
 	FD_SET(net, xbitsp);
     if ((c = select(maxfd + 1, ibitsp, obitsp, xbitsp,
-	     (poll == 0)? (struct timeval *)0 : &TimeValue)) < 0) {
+	     (poll == 0)? NULL : &TimeValue)) < 0) {
 	if (c == -1) {
 		    /*
 		     * we can get EINTR if we are in line mode,
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 334acef..f2237b3 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -688,7 +688,7 @@ help(int argc, char **argv)
 		c = getcmd(arg);
 		if (c == (struct cmd *)-1)
 			printf("?Ambiguous help command %s\n", arg);
-		else if (c == (struct cmd *)0)
+		else if (c == NULL)
 			printf("?Invalid help command %s\n", arg);
 		else
 			printf("%s\n", c->help);
diff --git a/usr.bin/tip/libacu/acucommon.c b/usr.bin/tip/libacu/acucommon.c
index f1317ae..e5c3441 100644
--- a/usr.bin/tip/libacu/acucommon.c
+++ b/usr.bin/tip/libacu/acucommon.c
@@ -97,11 +97,11 @@ void acu_nap (unsigned int how_long)
         setvec(vec, acunap_napx);
         ringring = 0;
         (void) sigvec(SIGALRM, &vec, &ovec);
-        (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0);
+        (void) setitimer(ITIMER_REAL, itp, NULL);
         while (!ringring)
 					sigpause(omask &~ mask(SIGALRM));
-        (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0);
-        (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0);
+        (void) sigvec(SIGALRM, &ovec, NULL);
+        (void) setitimer(ITIMER_REAL, &oitv, NULL);
 				(void) sigsetmask(omask);
 }
 
diff --git a/usr.bin/tip/tip/cmds.c b/usr.bin/tip/tip/cmds.c
index 7dda90c..9d12fbf 100644
--- a/usr.bin/tip/tip/cmds.c
+++ b/usr.bin/tip/tip/cmds.c
@@ -751,7 +751,7 @@ shell(void)
 		else
 			cp++;
 		shell_uid();
-		execl(value(SHELL), cp, 0);
+		execl(value(SHELL), cp, NULL);
 		printf("\r\ncan't execl!\r\n");
 		exit(1);
 	}
@@ -849,7 +849,7 @@ execute(char *s)
 	else
 		cp++;
 	shell_uid();
-	execl(value(SHELL), cp, "-c", s, 0);
+	execl(value(SHELL), cp, "-c", s, NULL);
 }
 
 static int
@@ -1028,7 +1028,7 @@ expand(char *name)
 		close(pivec[1]);
 		close(2);
 		shell_uid();
-		execl(Shell, Shell, "-c", cmdbuf, 0);
+		execl(Shell, Shell, "-c", cmdbuf, NULL);
 		_exit(1);
 	}
 	if (pid == -1) {
diff --git a/usr.bin/tip/tip/remcap.c b/usr.bin/tip/tip/remcap.c
index 9ed2de1..aa4721f 100644
--- a/usr.bin/tip/tip/remcap.c
+++ b/usr.bin/tip/tip/remcap.c
@@ -94,7 +94,7 @@ tgetent(bp, name)
 	int rc1, rc2;
 
 	remotefile = cp = getenv(V_TERMCAP);
-	if (cp == (char *)0 || strcmp(cp, _PATH_REMOTE) == 0) {
+	if (cp == NULL || strcmp(cp, _PATH_REMOTE) == 0) {
 		remotefile = cp = _PATH_REMOTE;
 		return (getent(bp, name, cp));
 	} else {
@@ -140,7 +140,7 @@ getent(bp, name, cp)
 	if (cp && *cp) {
 		if (*cp!='/') {
 			cp2 = getenv(V_TERM);
-			if (cp2 == (char *)0 || strcmp(name,cp2) == 0) {
+			if (cp2 == NULL || strcmp(name,cp2) == 0) {
 				strcpy(bp,cp);
 				return (tnchktc());
 			} else
diff --git a/usr.bin/window/cmd4.c b/usr.bin/window/cmd4.c
index 402b0aa..dc2fe0f 100644
--- a/usr.bin/window/cmd4.c
+++ b/usr.bin/window/cmd4.c
@@ -51,6 +51,6 @@ c_colon()
 	wwputc('\n', cmdwin);
 	wwcurtowin(cmdwin);
 	setterse(oldterse);
-	if (dolongcmd(buf, (struct value *)0, 0) < 0)
+	if (dolongcmd(buf, NULL, 0) < 0)
 		error("Out of memory.");
 }
diff --git a/usr.bin/window/lcmd1.c b/usr.bin/window/lcmd1.c
index 3e03ede..e072777 100644
--- a/usr.bin/window/lcmd1.c
+++ b/usr.bin/window/lcmd1.c
@@ -182,7 +182,7 @@ struct value *v, *a;
 	v->v_num = selwin ? selwin->ww_id + 1 : -1;
 	if (a->v_type == V_ERR)
 		return;
-	if ((w = vtowin(a, (struct ww *)0)) == 0)
+	if ((w = vtowin(a, NULL)) == 0)
 		return;
 	setselwin(w);
 }
@@ -334,10 +334,10 @@ struct value *a;
 	struct ww *w;
 
 	if (a->v_type == V_STR && str_match(a->v_str, "all", 3))
-		closewin((struct ww *)0);
+		closewin(NULL);
 	else
 		for (; a->v_type != V_ERR; a++)
-			if ((w = vtowin(a, (struct ww *)0)) != 0)
+			if ((w = vtowin(a, NULL)) != 0)
 				closewin(w);
 }
 
diff --git a/usr.bin/window/lcmd2.c b/usr.bin/window/lcmd2.c
index 608a8b3..6e723f5 100644
--- a/usr.bin/window/lcmd2.c
+++ b/usr.bin/window/lcmd2.c
@@ -119,7 +119,7 @@ struct value *a;
 		return;
 	}
 
-	(void) gettimeofday(&timeval, (struct timezone *)0);
+	(void) gettimeofday(&timeval, NULL);
 	timeval.tv_sec -= starttime.tv_sec;
 	if ((timeval.tv_usec -= starttime.tv_usec) < 0) {
 		timeval.tv_sec--;
@@ -339,7 +339,7 @@ l_alias(v, a)
 				for (p = vp->v_str; *q++ = *p++;)
 					;
 			q[-1] = 0;
-			if ((ap = alias_set(a[0].v_str, (char *)0)) == 0) {
+			if ((ap = alias_set(a[0].v_str, NULL)) == 0) {
 				p_memerror();
 				str_free(str);
 				return;
diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c
index 5e78e42..7f0c435 100644
--- a/usr.bin/window/main.c
+++ b/usr.bin/window/main.c
@@ -116,7 +116,7 @@ char **argv;
 	default_shell[1] = 0;
 	default_nline = NLINE;
 	default_smooth = 1;
-	(void) gettimeofday(&starttime, (struct timezone *)0);
+	(void) gettimeofday(&starttime, NULL);
 	(void) setlocale(LC_CTYPE, "");
 	if (wwinit() < 0) {
 		(void) fprintf(stderr, "%s.\n", wwerror());
@@ -178,7 +178,7 @@ char **argv;
 	setterse(tflag);
 	setcmd(1);
 	if (cmd != 0)
-		(void) dolongcmd(cmd, (struct value *)0, 0);
+		(void) dolongcmd(cmd, NULL, 0);
 	if (!fflag)
 		if (dflag || doconfig() < 0)
 			dodefault();
diff --git a/usr.bin/window/win.c b/usr.bin/window/win.c
index 18ea04b..68580b7 100644
--- a/usr.bin/window/win.c
+++ b/usr.bin/window/win.c
@@ -92,7 +92,7 @@ char *shf, **sh;
 	 * addwin() puts w at the top, so we don't waste an
 	 * insert and delete operation.
 	 */
-	setselwin((struct ww *)0);
+	setselwin(NULL);
 	addwin(w, 0);
 	setselwin(w);
 	if (wwspawn(w, shf, sh) < 0) {
diff --git a/usr.bin/window/wwchild.c b/usr.bin/window/wwchild.c
index 632efc5..419ed3b 100644
--- a/usr.bin/window/wwchild.c
+++ b/usr.bin/window/wwchild.c
@@ -54,7 +54,7 @@ wwchild()
 
 	olderrno = errno;
 	while ((pid =
-	    wait3((int *)&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) {
+	    wait3((int *)&w, WNOHANG|WUNTRACED, NULL)) > 0) {
 		for (wp = wwindex; wp < &wwindex[NWW]; wp++) {
 			if (*wp && (*wp)->ww_state == WWS_HASPROC
 			    && (*wp)->ww_pid == pid) {
diff --git a/usr.bin/window/wwenviron.c b/usr.bin/window/wwenviron.c
index ac0648c..912366a 100644
--- a/usr.bin/window/wwenviron.c
+++ b/usr.bin/window/wwenviron.c
@@ -62,7 +62,7 @@ register struct ww *wp;
 #ifndef TIOCSCTTY
 	if ((i = open("/dev/tty", 0)) < 0)
 		goto bad;
-	if (ioctl(i, TIOCNOTTY, (char *)0) < 0)
+	if (ioctl(i, TIOCNOTTY, NULL) < 0)
 		goto bad;
 	(void) close(i);
 #endif
diff --git a/usr.bin/window/wwiomux.c b/usr.bin/window/wwiomux.c
index baf9e94..ecf87bd 100644
--- a/usr.bin/window/wwiomux.c
+++ b/usr.bin/window/wwiomux.c
@@ -118,7 +118,7 @@ wwiomux()
 			tv.tv_usec = 10000;
 		}
 		wwnselect++;
-		n = select(n + 1, &imask, (fd_set *)0, (fd_set *)0, &tv);
+		n = select(n + 1, &imask, NULL, NULL, &tv);
 		wwsetjmp = 0;
 		noblock = 0;
 
diff --git a/usr.bin/window/wwtty.c b/usr.bin/window/wwtty.c
index 5883834..59a6cc6 100644
--- a/usr.bin/window/wwtty.c
+++ b/usr.bin/window/wwtty.c
@@ -155,7 +155,7 @@ wwstoptty(d)
 	/* not guaranteed to work on the pty side */
 	if (tcflow(d, TCOOFF) < 0)
 #else
-	if (ioctl(d, TIOCSTOP, (char *)0) < 0)
+	if (ioctl(d, TIOCSTOP, NULL) < 0)
 #endif
 	{
 		wwerrno = WWE_SYS;
@@ -170,7 +170,7 @@ wwstarttty(d)
 	/* not guaranteed to work on the pty side */
 	if (tcflow(d, TCOON) < 0)
 #else
-	if (ioctl(d, TIOCSTART, (char *)0) < 0)
+	if (ioctl(d, TIOCSTART, NULL) < 0)
 #endif
 	{
 		wwerrno = WWE_SYS;
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index ab26011..3a5fabf 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -501,7 +501,7 @@ ac(FILE *fp)
 	}
 	fclose(fp);
 	if (!(Flags & AC_W))
-		usr.ut_time = time((time_t *)0);
+		usr.ut_time = time(NULL);
 	strcpy(usr.ut_line, "~");
 
 	if (Flags & AC_D) {
@@ -523,7 +523,7 @@ ac(FILE *fp)
 	head = log_out(head, &usr);
 
 	if (Flags & AC_D)
-		show_today(Users, head, time((time_t *)0));
+		show_today(Users, head, time(NULL));
 	else {
 		if (Flags & AC_P)
 			show_users(Users);
diff --git a/usr.sbin/atm/atmarpd/atmarp_config.c b/usr.sbin/atm/atmarpd/atmarp_config.c
index 34ee7be..d1e085f 100644
--- a/usr.sbin/atm/atmarpd/atmarp_config.c
+++ b/usr.sbin/atm/atmarpd/atmarp_config.c
@@ -78,7 +78,7 @@ int
 atmarp_cfg_netif(char *netif)
 {
 	int			rc;
-	Atmarp_intf		*aip = (Atmarp_intf *)0;
+	Atmarp_intf		*aip = NULL;
 
 	/*
 	 * Get an ATMARP interface block
diff --git a/usr.sbin/atm/atmarpd/atmarp_scsp.c b/usr.sbin/atm/atmarpd/atmarp_scsp.c
index 3330b83..371e783 100644
--- a/usr.sbin/atm/atmarpd/atmarp_scsp.c
+++ b/usr.sbin/atm/atmarpd/atmarp_scsp.c
@@ -80,7 +80,7 @@ atmarp_scsp_cache(Atmarp_intf *aip, Scsp_if_msg *msg)
 {
 	int		i, len, rc = 0;
 	Atmarp		*aap;
-	Scsp_if_msg	*smp = (Scsp_if_msg *)0;
+	Scsp_if_msg	*smp = NULL;
 	Scsp_atmarp_msg	*sap;
 
 	/*
@@ -160,7 +160,7 @@ atmarp_scsp_solicit(Atmarp_intf *aip, Scsp_if_msg *smp)
 {
 	int		i, rc = 0;
 	Atmarp		*aap;
-	Scsp_if_msg	*rsp = (Scsp_if_msg *)0;
+	Scsp_if_msg	*rsp = NULL;
 
 	/*
 	 * Search the interface's ATMARP cache for an entry with
@@ -245,7 +245,7 @@ atmarp_scsp_update(Atmarp *aap, int state)
 {
 	int		rc = 0;
 	Atmarp_intf	*aip = aap->aa_intf;
-	Scsp_if_msg	*smp = (Scsp_if_msg *)0;
+	Scsp_if_msg	*smp = NULL;
 
 	/*
 	 * Make sure the connection to SCSP is active
@@ -441,7 +441,7 @@ int
 atmarp_scsp_read(Atmarp_intf *aip)
 {
 	int		len, rc = 0;
-	char		*buff = (char *)0;
+	char		*buff = NULL;
 	Scsp_if_msg	*smp;
 	Scsp_if_msg_hdr	msg_hdr;
 
@@ -763,7 +763,7 @@ atmarp_scsp_disconnect(Atmarp_intf *aip)
 		for (aap = aip->ai_arptbl[i]; aap; aap = aap->aa_next) {
 			UM_FREE(aap);
 		}
-		aip->ai_arptbl[i] = (Atmarp *)0;
+		aip->ai_arptbl[i] = NULL;
 	}
 
 	return(0);
diff --git a/usr.sbin/atm/atmarpd/atmarp_subr.c b/usr.sbin/atm/atmarpd/atmarp_subr.c
index 03ec5d7..6293412 100644
--- a/usr.sbin/atm/atmarpd/atmarp_subr.c
+++ b/usr.sbin/atm/atmarpd/atmarp_subr.c
@@ -213,10 +213,10 @@ int
 atmarp_if_ready(Atmarp_intf *aip)
 {
 	int			i, len, mtu, rc, sel;
-	Atmarp			*aap = (Atmarp *)0;
+	Atmarp			*aap = NULL;
 	struct atminfreq	air;
-	struct air_netif_rsp	*netif_rsp = (struct air_netif_rsp *)0;
-	struct air_int_rsp	*intf_rsp = (struct air_int_rsp *)0;
+	struct air_netif_rsp	*netif_rsp = NULL;
+	struct air_int_rsp	*intf_rsp = NULL;
 	struct sockaddr_in	*ip_addr;
 	struct sockaddr_in	subnet_mask;
 	Atm_addr_nsap		*anp;
@@ -438,10 +438,10 @@ atmarp_copy_cache_entry(struct air_arp_rsp *cp)
 	 * Sanity checks
 	 */
 	if (!cp)
-		return((Atmarp *)0);
+		return(NULL);
 	aip = atmarp_find_intf_name(cp->aap_intf);
 	if (!aip)
-		return((Atmarp *)0);
+		return(NULL);
 
 	/*
 	 * Get a new cache entry
@@ -449,7 +449,7 @@ atmarp_copy_cache_entry(struct air_arp_rsp *cp)
 	aap = (Atmarp *)UM_ALLOC(sizeof(Atmarp));
 	if (!aap) {
 		errno = ENOMEM;
-		return((Atmarp *)0);
+		return(NULL);
 	}
 	UM_ZERO(aap, sizeof(Atmarp));
 	aap->aa_intf = aip;
@@ -912,7 +912,7 @@ atmarp_sigint(int sig)
 	 * Open the output file
 	 */
 	df = fopen(fname, "w");
-	if (df == (FILE *)0)
+	if (df == NULL)
 		return;
 
 	/*
diff --git a/usr.sbin/atm/atmarpd/atmarpd.c b/usr.sbin/atm/atmarpd/atmarpd.c
index d758e5c..8c27fa1 100644
--- a/usr.sbin/atm/atmarpd/atmarpd.c
+++ b/usr.sbin/atm/atmarpd/atmarpd.c
@@ -70,10 +70,10 @@
 char		*prog;
 int		atmarp_debug_mode = 0;
 int		atmarp_max_socket = 0;
-Atmarp_intf	*atmarp_intf_head = (Atmarp_intf *)0;
-Atmarp_slis	*atmarp_slis_head = (Atmarp_slis *)0;
-FILE		*atmarp_log_file = (FILE *)0;
-char		*atmarp_log_file_name = (char *)0;
+Atmarp_intf	*atmarp_intf_head = NULL;
+Atmarp_slis	*atmarp_slis_head = NULL;
+FILE		*atmarp_log_file = NULL;
+char		*atmarp_log_file_name = NULL;
 Harp_timer	cache_timer, perm_timer;
 
 
@@ -243,7 +243,7 @@ start_daemon(void)
 	}
 	fd = open(_PATH_TTY, O_RDWR);
 	if (fd >= 0) {
-		ioctl(fd, TIOCNOTTY, (char *)0);
+		ioctl(fd, TIOCNOTTY, NULL);
 		close(fd);
 	}
 
@@ -375,7 +375,7 @@ main(int argc, char **argv)
 		}
 		rc = select(atmarp_max_socket + 1,
 				&read_set, &write_set,
-				&except_set, (struct timeval *)0);
+				&except_set, NULL);
 		if (rc < 0) {
 			if (harp_timer_exec) {
 				timer_proc();
diff --git a/usr.sbin/atm/scspd/scsp_cafsm.c b/usr.sbin/atm/scspd/scsp_cafsm.c
index 90abe90..efa2e60 100644
--- a/usr.sbin/atm/scspd/scsp_cafsm.c
+++ b/usr.sbin/atm/scspd/scsp_cafsm.c
@@ -207,8 +207,7 @@ scsp_ca_act_00(Scsp_dcs *dcsp, void *p)
 	/*
 	 * Notify the client I/F FSM
 	 */
-	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_DOWN, (Scsp_msg *)0,
-			(Scsp_if_msg *)0);
+	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_DOWN, NULL, NULL);
 
 	return(rc);
 }
@@ -255,7 +254,7 @@ scsp_ca_act_01(Scsp_dcs *dcsp, void *p)
 	/*
 	 * Select an initial sequence number
 	 */
-	dcsp->sd_ca_seq = (int)time((time_t *)0);
+	dcsp->sd_ca_seq = (int)time(NULL);
 
 	/*
 	 * Send a CA message
@@ -301,8 +300,7 @@ scsp_ca_act_02(Scsp_dcs *dcsp, void *p)
 	/*
 	 * Notify the client I/F FSM
 	 */
-	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_DOWN, (Scsp_msg *)0,
-			(Scsp_if_msg *)0);
+	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_DOWN, NULL, NULL);
 
 	return(rc);
 }
@@ -346,8 +344,7 @@ scsp_ca_act_03(Scsp_dcs *dcsp, void *p)
 		 * Set the new state
 		 */
 		dcsp->sd_ca_state = SCSP_CAFSM_SLAVE;
-		scsp_cfsm(dcsp, SCSP_CIFSM_CA_SUMM,
-				(Scsp_msg *)0, (Scsp_if_msg *)0);
+		scsp_cfsm(dcsp, SCSP_CIFSM_CA_SUMM, NULL, NULL);
 
 		/*
 		 * Save the master's sequence number
@@ -375,8 +372,7 @@ scsp_ca_act_03(Scsp_dcs *dcsp, void *p)
 		 * Set the new state
 		 */
 		dcsp->sd_ca_state = SCSP_CAFSM_MASTER;
-		rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_SUMM,
-				(Scsp_msg *)0, (Scsp_if_msg *)0);
+		rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_SUMM, NULL, NULL);
 
 		/*
 		 * Process the CA message
@@ -439,7 +435,7 @@ scsp_ca_act_04(Scsp_dcs *dcsp, void *p)
 		HARP_CANCEL(&dcsp->sd_ca_rexmt_t);
 		dcsp->sd_ca_state = SCSP_CAFSM_NEG;
 		scsp_dcs_cleanup(dcsp);
-		return(scsp_ca_act_01(dcsp, (Scsp_msg *)0));
+		return(scsp_ca_act_01(dcsp, NULL));
 	}
 
 	/*
@@ -475,7 +471,7 @@ scsp_ca_act_04(Scsp_dcs *dcsp, void *p)
 		 */
 		if (dcsp->sd_ca_rexmt_msg) {
 			scsp_free_msg(dcsp->sd_ca_rexmt_msg);
-			dcsp->sd_ca_rexmt_msg = (Scsp_msg *)0;
+			dcsp->sd_ca_rexmt_msg = NULL;
 		}
 
 		/*
@@ -487,17 +483,13 @@ scsp_ca_act_04(Scsp_dcs *dcsp, void *p)
 			 * Go to Aligned state
 			 */
 			dcsp->sd_ca_state = SCSP_CAFSM_ALIGNED;
-			rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN,
-					(Scsp_msg *)0,
-					(Scsp_if_msg *)0);
+			rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN, NULL, NULL);
 		} else {
 			/*
 			 * Go to Cache Update state
 			 */
 			dcsp->sd_ca_state = SCSP_CAFSM_UPDATE;
-			scsp_cfsm(dcsp, SCSP_CIFSM_CA_UPD,
-					(Scsp_msg *)0,
-					(Scsp_if_msg *)0);
+			scsp_cfsm(dcsp, SCSP_CIFSM_CA_UPD, NULL, NULL);
 			rc = scsp_send_csus(dcsp);
 		}
 	} else {
@@ -543,7 +535,7 @@ scsp_ca_act_05(Scsp_dcs *dcsp, void *p)
 		HARP_CANCEL(&dcsp->sd_ca_rexmt_t);
 		dcsp->sd_ca_state = SCSP_CAFSM_NEG;
 		scsp_dcs_cleanup(dcsp);
-		return(scsp_ca_act_01(dcsp, (Scsp_msg *)0));
+		return(scsp_ca_act_01(dcsp, NULL));
 	}
 
 	/*
@@ -566,7 +558,7 @@ scsp_ca_act_05(Scsp_dcs *dcsp, void *p)
 	 */
 	if (dcsp->sd_ca_rexmt_msg) {
 		scsp_free_msg(dcsp->sd_ca_rexmt_msg);
-		dcsp->sd_ca_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_ca_rexmt_msg = NULL;
 	}
 
 	/*
@@ -600,9 +592,7 @@ scsp_ca_act_05(Scsp_dcs *dcsp, void *p)
 			 * Go to Aligned state
 			 */
 			dcsp->sd_ca_state = SCSP_CAFSM_ALIGNED;
-			rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN,
-					(Scsp_msg *)0,
-					(Scsp_if_msg *)0);
+			rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN, NULL, NULL);
 		} else {
 			/*
 			 * Go to Cache Update state
@@ -612,9 +602,7 @@ scsp_ca_act_05(Scsp_dcs *dcsp, void *p)
 			HARP_TIMER(&dcsp->sd_ca_rexmt_t,
 					dcsp->sd_ca_rexmt_int,
 					scsp_ca_retran_timeout);
-			scsp_cfsm(dcsp, SCSP_CIFSM_CA_UPD,
-					(Scsp_msg *)0,
-					(Scsp_if_msg *)0);
+			scsp_cfsm(dcsp, SCSP_CIFSM_CA_UPD, NULL, NULL);
 			rc = scsp_send_csus(dcsp);
 		}
 	}
@@ -684,14 +672,13 @@ scsp_ca_act_07(Scsp_dcs *dcsp, void *p)
 	if (dcsp->sd_ca_rexmt_msg) {
 		HARP_CANCEL(&dcsp->sd_ca_rexmt_t);
 		scsp_free_msg(dcsp->sd_ca_rexmt_msg);
-		dcsp->sd_ca_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_ca_rexmt_msg = NULL;
 	}
 
 	/*
 	 * Pass the CSUS to the client interface FSM
 	 */
-	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CSU_SOL, msg,
-			(Scsp_if_msg *)0);
+	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CSU_SOL, msg, NULL);
 
 	return(rc);
 }
@@ -729,15 +716,13 @@ scsp_ca_act_08(Scsp_dcs *dcsp, void *p)
 	if (!dcsp->sd_csus_rexmt_msg && !dcsp->sd_crl &&
 			dcsp->sd_ca_state != SCSP_CAFSM_ALIGNED) {
 		dcsp->sd_ca_state = SCSP_CAFSM_ALIGNED;
-		rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN,
-				(Scsp_msg *)0, (Scsp_if_msg *)0);
+		rc = scsp_cfsm(dcsp, SCSP_CIFSM_CA_ALIGN, NULL, NULL);
 	}
 
 	/*
 	 * Pass the CSU Req to the client interface FSM
 	 */
-	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CSU_REQ, msg,
-			(Scsp_if_msg *)0);
+	rc = scsp_cfsm(dcsp, SCSP_CIFSM_CSU_REQ, msg, NULL);
 
 	/*
 	 * Move the CSA chain from the message to the list of
@@ -747,7 +732,7 @@ scsp_ca_act_08(Scsp_dcs *dcsp, void *p)
 			csap = csap->next) {
 		LINK2TAIL(csap, Scsp_csa, dcsp->sd_csu_ack_pend, next);
 	}
-	msg->sc_csu_msg->csu_csa_rec = (Scsp_csa *)0;
+	msg->sc_csu_msg->csu_csa_rec = NULL;
 
 	return(rc);
 }
@@ -775,7 +760,7 @@ scsp_ca_act_09(Scsp_dcs *dcsp, void *p)
 	 */
 	if (dcsp->sd_ca_rexmt_msg) {
 		scsp_free_msg(dcsp->sd_ca_rexmt_msg);
-		dcsp->sd_ca_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_ca_rexmt_msg = NULL;
 	}
 
 	return(0);
@@ -1188,7 +1173,7 @@ scsp_ca_act_15(Scsp_dcs *dcsp, void *p)
 			msg->sc_ca->ca_seq != dcsp->sd_ca_seq) {
 		dcsp->sd_ca_state = SCSP_CAFSM_NEG;
 		scsp_dcs_cleanup(dcsp);
-		rc = scsp_ca_act_01(dcsp, (Scsp_msg *)0);
+		rc = scsp_ca_act_01(dcsp, NULL);
 	} else {
 		/*
 		 * Retransmit the saved CA message and reset the
@@ -1286,7 +1271,7 @@ scsp_ca_act_16(Scsp_dcs *dcsp, void *p)
 		 * ACK pending list is empty--send a CSU Reply
 		 */
 		csap = dcsp->sd_csu_ack;
-		dcsp->sd_csu_ack = (Scsp_csa *)0;
+		dcsp->sd_csu_ack = NULL;
 		rc = scsp_send_csu_reply(dcsp, csap);
 	}
 
diff --git a/usr.sbin/atm/scspd/scsp_config.c b/usr.sbin/atm/scspd/scsp_config.c
index 97c306a..8e3708c 100644
--- a/usr.sbin/atm/scspd/scsp_config.c
+++ b/usr.sbin/atm/scspd/scsp_config.c
@@ -104,7 +104,7 @@ scsp_config(char *cfn)
 	/*
 	 * Initialize current interface pointer
 	 */
-	current_server = (Scsp_server *)0;
+	current_server = NULL;
 
 	/*
 	 * Clear marks on any existing servers
@@ -244,7 +244,7 @@ finish_dcs(void)
 		rc++;
 	}
 
-	current_dcs = (Scsp_dcs *)0;
+	current_dcs = NULL;
 	return(rc);
 }
 
@@ -1066,7 +1066,7 @@ finish_server(void)
 	/*
 	 * Make sure the interface has been configured
 	 */
-	if (ssp->ss_intf == (char *)0) {
+	if (ssp->ss_intf == NULL) {
 		parse_error("netif missing from server specification");
 		rc++;
 	}
@@ -1090,7 +1090,7 @@ finish_server(void)
 	/*
 	 * Make sure at least one DCS is configured
 	 */
-	if (ssp->ss_dcs == (Scsp_dcs *)0) {
+	if (ssp->ss_dcs == NULL) {
 		parse_error("no DCS configured for server");
 		rc++;
 	}
@@ -1098,7 +1098,7 @@ finish_server(void)
 	/*
 	 * Mark the end of the server
 	 */
-	current_server = (Scsp_server *)0;
+	current_server = NULL;
 
 	return(rc);
 }
diff --git a/usr.sbin/atm/scspd/scsp_config_lex.c b/usr.sbin/atm/scspd/scsp_config_lex.c
index 2879f6c..79ccc48 100644
--- a/usr.sbin/atm/scspd/scsp_config_lex.c
+++ b/usr.sbin/atm/scspd/scsp_config_lex.c
@@ -172,7 +172,7 @@ static struct {
 	{ "server",		TOK_SERVER },
 	{ "ServerGroupID",	TOK_SRVGRP },
 	{ "syslog",		TOK_SYSLOG },
-	{ (char *)0,		0 },
+	{ NULL,			0 },
 };
 
 
diff --git a/usr.sbin/atm/scspd/scsp_config_parse.y b/usr.sbin/atm/scspd/scsp_config_parse.y
index d292d7e..0498927 100644
--- a/usr.sbin/atm/scspd/scsp_config_parse.y
+++ b/usr.sbin/atm/scspd/scsp_config_parse.y
@@ -228,7 +228,7 @@ dcs_spec: /* Nothing */
 		/*
 		 * Set DCS address
 		 */
-		rc = set_dcs_addr($2, (char *)0);
+		rc = set_dcs_addr($2, NULL);
 		UM_FREE($2);
 		if (rc)
 			return(rc);
diff --git a/usr.sbin/atm/scspd/scsp_hfsm.c b/usr.sbin/atm/scspd/scsp_hfsm.c
index ebd17cd..dc127e7 100644
--- a/usr.sbin/atm/scspd/scsp_hfsm.c
+++ b/usr.sbin/atm/scspd/scsp_hfsm.c
@@ -235,7 +235,7 @@ scsp_hello_act_02(Scsp_dcs *dcsp, Scsp_msg *msg)
 	/*
 	 * Tell the CA FSM that the conection to the DCS is lost
 	 */
-	rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, (void *)0);
+	rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, NULL);
 
 	/*
 	 * Go to Down state
@@ -350,7 +350,7 @@ scsp_hello_act_04(Scsp_dcs *dcsp, Scsp_msg *msg)
 	/*
 	 * Notify the CA FSM
 	 */
-	rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, (void *)0);
+	rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, NULL);
 
 	return(rc);
 }
@@ -381,7 +381,7 @@ scsp_hello_act_05(Scsp_dcs *dcsp, Scsp_msg *msg)
 	 * Null message pointer means message decode failed, so
 	 * message must have been invalid.  Go to Waiting state.
 	 */
-	if (msg == (Scsp_msg *)0) {
+	if (msg == NULL) {
 		dcsp->sd_hello_state = SCSP_HFSM_WAITING;
 		HARP_CANCEL(&dcsp->sd_hello_rcv_t);
 		return(0);
@@ -432,7 +432,7 @@ scsp_hello_act_05(Scsp_dcs *dcsp, Scsp_msg *msg)
 			dcsp->sd_hello_state = SCSP_HFSM_BI_DIR;
 			rc = scsp_cafsm(dcsp,
 					SCSP_CAFSM_HELLO_UP,
-					(void *)0);
+					NULL);
 			return(rc);
 		}
 	}
@@ -472,10 +472,10 @@ scsp_hello_act_06(Scsp_dcs *dcsp, Scsp_msg *msg)
 	 * Null message pointer means message decode failed, so
 	 * message must have been invalid.  Go to Waiting state.
 	 */
-	if (msg == (Scsp_msg *)0) {
+	if (msg == NULL) {
 		HARP_CANCEL(&dcsp->sd_hello_rcv_t);
 		dcsp->sd_hello_state = SCSP_HFSM_WAITING;
-		rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, (void *)0);
+		rc = scsp_cafsm(dcsp, SCSP_CAFSM_HELLO_DOWN, NULL);
 		return(rc);
 	}
 
@@ -517,7 +517,7 @@ scsp_hello_act_06(Scsp_dcs *dcsp, Scsp_msg *msg)
 			dcsp->sd_hello_state = SCSP_HFSM_WAITING;
 			rc = scsp_cafsm(dcsp,
 					SCSP_CAFSM_HELLO_DOWN,
-					(void *)0);
+					NULL);
 			return(rc);
 		}
 
diff --git a/usr.sbin/atm/scspd/scsp_input.c b/usr.sbin/atm/scspd/scsp_input.c
index 7c5b238..763717a 100644
--- a/usr.sbin/atm/scspd/scsp_input.c
+++ b/usr.sbin/atm/scspd/scsp_input.c
@@ -114,7 +114,7 @@ scsp_free_ca(Scsp_ca *cap)
 	/*
 	 * Return if there's nothing to free
 	 */
-	if (cap == (Scsp_ca *)0)
+	if (cap == NULL)
 		return;
 
 	/*
@@ -150,7 +150,7 @@ scsp_free_csu(Scsp_csu_msg *csup)
 	/*
 	 * Return if there's nothing to free
 	 */
-	if (csup == (Scsp_csu_msg *)0)
+	if (csup == NULL)
 		return;
 
 	/*
@@ -184,7 +184,7 @@ scsp_free_hello(Scsp_hello *hp)
 	/*
 	 * Return if there's nothing to free
 	 */
-	if (hp == (Scsp_hello *)0)
+	if (hp == NULL)
 		return;
 
 	/*
@@ -212,7 +212,7 @@ scsp_free_msg(Scsp_msg *msg)
 	/*
 	 * Return if there's nothing to free
 	 */
-	if (msg == (Scsp_msg *)0)
+	if (msg == NULL)
 		return;
 
 	/*
@@ -960,7 +960,7 @@ scsp_parse_msg(char *buff, int pdu_len)
 {
 	int			ext_off, len, plen;
 	struct scsp_nhdr	*shp;
-	Scsp_msg		*msg = (Scsp_msg *)0;
+	Scsp_msg		*msg = NULL;
 	Scsp_ext		**expp;
 
 	/*
@@ -1064,5 +1064,5 @@ scsp_parse_msg(char *buff, int pdu_len)
 ignore:
 	if (msg)
 		scsp_free_msg(msg);
-	return(Scsp_msg *)0;
+	return NULL;
 }
diff --git a/usr.sbin/atm/scspd/scsp_log.c b/usr.sbin/atm/scspd/scsp_log.c
index 025a57e..f4463d4 100644
--- a/usr.sbin/atm/scspd/scsp_log.c
+++ b/usr.sbin/atm/scspd/scsp_log.c
@@ -69,7 +69,7 @@
 /*
  * Global variables
  */
-FILE	*scsp_trace_file = (FILE *)0;
+FILE	*scsp_trace_file = NULL;
 
 
 /*
@@ -146,7 +146,7 @@ scsp_open_trace(void)
 	 * isn't open and won't try to write to it.
 	 */
 	scsp_trace_file = fopen(fname, "w");
-	if (scsp_trace_file == (FILE *)0) {
+	if (scsp_trace_file == NULL) {
 		scsp_log(LOG_ERR, "Can't open trace file");
 	}
 }
diff --git a/usr.sbin/atm/scspd/scsp_msg.c b/usr.sbin/atm/scspd/scsp_msg.c
index 238d2c9..75ca384 100644
--- a/usr.sbin/atm/scspd/scsp_msg.c
+++ b/usr.sbin/atm/scspd/scsp_msg.c
@@ -161,7 +161,7 @@ scsp_csus_ack(Scsp_dcs *dcsp, Scsp_msg *msg)
 		}
 	}
 
-	if (csusp->csu_csa_rec == (Scsp_csa *)0) {
+	if (csusp->csu_csa_rec == NULL) {
 		/*
 		 * All CSASs in the CSUS message have been
 		 * answered.  Stop the timer and free the
@@ -169,7 +169,7 @@ scsp_csus_ack(Scsp_dcs *dcsp, Scsp_msg *msg)
 		 */
 		HARP_CANCEL(&dcsp->sd_csus_rexmt_t);
 		scsp_free_msg(dcsp->sd_csus_rexmt_msg);
-		dcsp->sd_csus_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_csus_rexmt_msg = NULL;
 
 		/*
 		 * If the CRL isn't empty, send another CSUS
@@ -238,13 +238,13 @@ scsp_send_ca(Scsp_dcs *dcsp)
 		cap->ca_m = 1;
 		cap->ca_i = 0;
 		scsp_ca_csas_setup(dcsp, cap);
-		cap->ca_o = dcsp->sd_ca_csas != (Scsp_cse *)0;
+		cap->ca_o = dcsp->sd_ca_csas != NULL;
 		break;
 	case SCSP_CAFSM_SLAVE:
 		cap->ca_m = 0;
 		cap->ca_i = 0;
 		scsp_ca_csas_setup(dcsp, cap);
-		cap->ca_o = dcsp->sd_ca_csas != (Scsp_cse *)0;
+		cap->ca_o = dcsp->sd_ca_csas != NULL;
 		break;
 	default:
 		scsp_log(LOG_ERR, "Invalid state in scsp_send_ca");
@@ -521,8 +521,7 @@ scsp_send_csu_reply(Scsp_dcs *dcsp, Scsp_csa *csap)
 		case SCSP_PROTO_ATMARP:
 			if (csap1->atmarp_data) {
 				UM_FREE(csap1->atmarp_data);
-				csap1->atmarp_data =
-						(Scsp_atmarp_csa *)0;
+				csap1->atmarp_data = NULL;
 			}
 			break;
 		}
diff --git a/usr.sbin/atm/scspd/scsp_output.c b/usr.sbin/atm/scspd/scsp_output.c
index d764b15..aeddbc0 100644
--- a/usr.sbin/atm/scspd/scsp_output.c
+++ b/usr.sbin/atm/scspd/scsp_output.c
@@ -692,7 +692,7 @@ hello_invalid:
 int
 scsp_format_msg(Scsp_dcs *dcsp, Scsp_msg *msg, char **bpp)
 {
-	char			*buff = (char *)0, *e_buff = (char *)0;
+	char			*buff = NULL, *e_buff = NULL;
 	int			buff_len, e_buff_len;
 	int			e_len, len, plen;
 	struct scsp_nhdr	*shp;
@@ -760,7 +760,7 @@ scsp_format_msg(Scsp_dcs *dcsp, Scsp_msg *msg, char **bpp)
 		 */
 		if (!e_len) {
 			UM_FREE(e_buff);
-			e_buff = (char *)0;
+			e_buff = NULL;
 		}
 	}
 	buff_len -= e_len;
@@ -819,7 +819,7 @@ ignore:
 		UM_FREE(buff);
 	if (e_buff)
 		UM_FREE(e_buff);
-	*bpp = (char *)0;
+	*bpp = NULL;
 	return(0);
 }
 
@@ -886,7 +886,7 @@ scsp_send_msg(Scsp_dcs *dcsp, Scsp_msg *msg)
 		/*
 		 * Inform the Hello FSM
 		 */
-		scsp_hfsm(dcsp, SCSP_HFSM_VC_CLOSED, (Scsp_msg *)0);
+		scsp_hfsm(dcsp, SCSP_HFSM_VC_CLOSED, NULL);
 
 		/*
 		 * Set the return code
diff --git a/usr.sbin/atm/scspd/scsp_print.c b/usr.sbin/atm/scspd/scsp_print.c
index a08576a..9fc8480 100644
--- a/usr.sbin/atm/scspd/scsp_print.c
+++ b/usr.sbin/atm/scspd/scsp_print.c
@@ -92,7 +92,7 @@ static Type_name if_msg_types[] = {
 	{ "Cache Update Indication",	SCSP_UPDATE_IND },
 	{ "Cache Update Request",	SCSP_UPDATE_REQ },
 	{ "Cache Update Response",	SCSP_UPDATE_RSP },
-	{ (char *)0,	0 }
+	{ NULL,				0 }
 };
 
 static Type_name msg_types[] = {
@@ -101,7 +101,7 @@ static Type_name msg_types[] = {
 	{ "CSU Reply",		SCSP_CSU_REPLY_MSG },
 	{ "CSU Solicit",	SCSP_CSUS_MSG },
 	{ "Hello",		SCSP_HELLO_MSG },
-	{ (char *)0,		0 }
+	{ NULL,			0 }
 };
 
 static Type_name proto_types[] = {
@@ -110,14 +110,14 @@ static Type_name proto_types[] = {
 	{ "MARS",	SCSP_PROTO_MARS },
 	{ "DHCP",	SCSP_PROTO_DHCP },
 	{ "LNNI",	SCSP_PROTO_LNNI },
-	{ (char *)0,	0 }
+	{ NULL,		0 }
 };
 
 static Type_name ext_types[] = {
 	{ "End of Extensions",	SCSP_EXT_END },
 	{ "Authentication",	SCSP_EXT_AUTH },
 	{ "Vendor Private",	SCSP_EXT_VENDOR },
-	{ (char *)0,		0 }
+	{ NULL,			0 }
 };
 
 static Type_name hfsm_state_names[] = {
@@ -125,7 +125,7 @@ static Type_name hfsm_state_names[] = {
 	{ "Waiting",		SCSP_HFSM_WAITING },
 	{ "Unidirectional",	SCSP_HFSM_UNI_DIR },
 	{ "Bidirectional",	SCSP_HFSM_BI_DIR },
-	{ (char *)0,		0 }
+	{ NULL,			0 }
 };
 
 static Type_name hfsm_event_names[] = {
@@ -134,7 +134,7 @@ static Type_name hfsm_event_names[] = {
 	{ "Hello timer",	SCSP_HFSM_HELLO_T },
 	{ "Receive timer",	SCSP_HFSM_RCV_T },
 	{ "Msg received",	SCSP_HFSM_RCVD },
-	{ (char *)0,		0 }
+	{ NULL,			0 }
 };
 
 static Type_name cafsm_state_names[] = {
@@ -144,7 +144,7 @@ static Type_name cafsm_state_names[] = {
 	{ "Slave",			SCSP_CAFSM_SLAVE },
 	{ "Update cache",		SCSP_CAFSM_UPDATE },
 	{ "Aligned",			SCSP_CAFSM_ALIGNED },
-	{ (char *)0,			0 }
+	{ NULL,				0 }
 };
 
 static Type_name cafsm_event_names[] = {
@@ -159,7 +159,7 @@ static Type_name cafsm_event_names[] = {
 	{ "CSU timer",			SCSP_CAFSM_CSU_T },
 	{ "Cache Update",		SCSP_CAFSM_CACHE_UPD },
 	{ "Cache Response",		SCSP_CAFSM_CACHE_RSP },
-	{ (char *)0,			0 }
+	{ NULL,				0 }
 };
 
 static Type_name cifsm_state_names[] = {
@@ -167,7 +167,7 @@ static Type_name cifsm_state_names[] = {
 	{ "Summarize",	SCSP_CIFSM_SUM },
 	{ "Update",	SCSP_CIFSM_UPD },
 	{ "Aligned",	SCSP_CIFSM_ALIGN },
-	{ (char *)0,			0 }
+	{ NULL,		0 }
 };
 
 static Type_name cifsm_event_names[] = {
@@ -181,14 +181,14 @@ static Type_name cifsm_event_names[] = {
 	{ "CSU Request",	SCSP_CIFSM_CSU_REQ },
 	{ "CSU Reply",		SCSP_CIFSM_CSU_REPLY },
 	{ "CSU Solicit",	SCSP_CIFSM_CSU_SOL },
-	{ (char *)0,			0 }
+	{ NULL,			0 }
 };
 
 static Type_name atmarp_state_names[] = {
 	{ "New",	SCSP_ASTATE_NEW },
 	{ "Updated",	SCSP_ASTATE_UPD },
 	{ "Deleted",	SCSP_ASTATE_DEL },
-	{ (char *)0,	0 }
+	{ NULL,		0 }
 };
 
 
@@ -267,7 +267,7 @@ scsp_type_name(u_char type, Type_name *tbl)
 	/*
 	 * Search the table
 	 */
-	for (i = 0; tbl[i].name != (char *)0 && tbl[i].type != type;
+	for (i = 0; tbl[i].name != NULL && tbl[i].type != type;
 			i++)
 		;
 
@@ -1095,7 +1095,7 @@ print_scsp_dcs(FILE *fp, Scsp_dcs *dcsp)
 	fprintf(fp, "%sCA Retransmit Msg:    %p\n", indent,
 			dcsp->sd_ca_rexmt_msg);
 	fprintf(fp, "%sCSASs to send:        ", indent);
-	if (dcsp->sd_ca_csas == (Scsp_cse *)0) {
+	if (dcsp->sd_ca_csas == NULL) {
 		fprintf(fp, "Empty\n");
 	} else {
 		fprintf(fp, "%p\n", dcsp->sd_ca_csas);
@@ -1103,7 +1103,7 @@ print_scsp_dcs(FILE *fp, Scsp_dcs *dcsp)
 	fprintf(fp, "%sCSUS Rexmit Int:      %d\n", indent,
 			dcsp->sd_csus_rexmt_int);
 	fprintf(fp, "%sCache Request List:   ", indent);
-	if (dcsp->sd_crl == (Scsp_csa *)0) {
+	if (dcsp->sd_crl == NULL) {
 		fprintf(fp, "Empty\n");
 	} else {
 		fprintf(fp, "%p\n", dcsp->sd_crl);
@@ -1208,7 +1208,7 @@ print_scsp_dump(void)
 	 * Open the output file
 	 */
 	df = fopen(fname, "w");
-	if (df == (FILE *)0)
+	if (df == NULL)
 		return;
 
 	/*
diff --git a/usr.sbin/atm/scspd/scsp_socket.c b/usr.sbin/atm/scspd/scsp_socket.c
index b91988c..974532e 100644
--- a/usr.sbin/atm/scspd/scsp_socket.c
+++ b/usr.sbin/atm/scspd/scsp_socket.c
@@ -591,7 +591,7 @@ scsp_dcs_accept(Scsp_server *ssp)
 	sd = accept(ssp->ss_dcs_lsock,
 			(struct sockaddr *)&dcs_sockaddr, &len);
 	if (sd < 0) {
-		return((Scsp_dcs *)0);
+		return(NULL);
 	}
 	if (sd > scsp_max_socket) {
 		scsp_max_socket = sd;
@@ -685,7 +685,7 @@ dcs_accept_fail:
 	 * An error has occured--clean up and return
 	 */
 	close(sd);
-	return((Scsp_dcs *)0);
+	return(NULL);
 }
 
 
@@ -704,7 +704,7 @@ int
 scsp_dcs_read(Scsp_dcs *dcsp)
 {
 	int			len, rc;
-	char			*buff = (char *)0;
+	char			*buff = NULL;
 	Scsp_server		*ssp = dcsp->sd_server;
 	Scsp_msg		*msg;
 
@@ -777,8 +777,7 @@ dcs_read_fail:
 		 * VCC has been closed--pass the event to
 		 * the Hello FSM
 		 */
-		rc = scsp_hfsm(dcsp, SCSP_HFSM_VC_CLOSED,
-				(Scsp_msg *)0);
+		rc = scsp_hfsm(dcsp, SCSP_HFSM_VC_CLOSED, NULL);
 	}
 	if (errno == ECONNREFUSED) {
 		/*
@@ -950,7 +949,7 @@ Scsp_if_msg *
 scsp_if_sock_read(int sd)
 {
 	int		len;
-	char		*buff = (char *)0;
+	char		*buff = NULL;
 	Scsp_if_msg	*msg;
 	Scsp_if_msg_hdr	msg_hdr;
 
@@ -996,7 +995,7 @@ scsp_if_sock_read(int sd)
 socket_read_fail:
 	if (buff)
 		UM_FREE(buff);
-	return((Scsp_if_msg *)0);
+	return(NULL);
 }
 
 
@@ -1115,8 +1114,7 @@ scsp_server_read(Scsp_server *ssp)
 		 * entry from its cache
 		 */
 		dcsp = (Scsp_dcs *)msg->si_tok;
-		rc = scsp_cfsm(dcsp, SCSP_CIFSM_SOL_RSP, (Scsp_msg *)0,
-				msg);
+		rc = scsp_cfsm(dcsp, SCSP_CIFSM_SOL_RSP, NULL, msg);
 		break;
 	case SCSP_UPDATE_REQ:
 		/*
@@ -1127,7 +1125,7 @@ scsp_server_read(Scsp_server *ssp)
 			for (dcsp = ssp->ss_dcs; dcsp;
 					dcsp = dcsp->sd_next) {
 				rc = scsp_cfsm(dcsp, SCSP_CIFSM_UPD_REQ,
-						(Scsp_msg *)0, msg);
+						NULL, msg);
 			}
 		}
 		break;
@@ -1137,8 +1135,7 @@ scsp_server_read(Scsp_server *ssp)
 		 * DCS associated with the request
 		 */
 		dcsp = (Scsp_dcs *)msg->si_tok;
-		rc = scsp_cfsm(dcsp, SCSP_CIFSM_UPD_RSP,
-				(Scsp_msg *)0, msg);
+		rc = scsp_cfsm(dcsp, SCSP_CIFSM_UPD_RSP, NULL, msg);
 		break;
 	default:
 		scsp_log(LOG_ERR, "invalid message type %d from server",
diff --git a/usr.sbin/atm/scspd/scsp_subr.c b/usr.sbin/atm/scspd/scsp_subr.c
index 95b8535..1d3f8d8 100644
--- a/usr.sbin/atm/scspd/scsp_subr.c
+++ b/usr.sbin/atm/scspd/scsp_subr.c
@@ -235,7 +235,7 @@ scsp_dup_cse(Scsp_cse *csep)
 	 * Copy data to the duplicate
 	 */
 	UM_COPY(csep, dupp, sizeof(Scsp_cse));
-	dupp->sc_next = (Scsp_cse *)0;
+	dupp->sc_next = NULL;
 
 	return(dupp);
 }
@@ -270,7 +270,7 @@ scsp_dup_csa(Scsp_csa *csap)
 	 * Copy data to the duplicate
 	 */
 	UM_COPY(csap, dupp, sizeof(Scsp_csa));
-	dupp->next = (Scsp_csa *)0;
+	dupp->next = NULL;
 
 	/*
 	 * Copy protocol-specific data, if it's present
@@ -403,7 +403,7 @@ scsp_dcs_cleanup(Scsp_dcs *dcsp)
 	 */
 	if (dcsp->sd_ca_rexmt_msg) {
 		scsp_free_msg(dcsp->sd_ca_rexmt_msg);
-		dcsp->sd_ca_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_ca_rexmt_msg = NULL;
 	}
 	HARP_CANCEL(&dcsp->sd_ca_rexmt_t);
 
@@ -413,7 +413,7 @@ scsp_dcs_cleanup(Scsp_dcs *dcsp)
 	 */
 	if (dcsp->sd_csus_rexmt_msg) {
 		scsp_free_msg(dcsp->sd_csus_rexmt_msg);
-		dcsp->sd_csus_rexmt_msg = (Scsp_msg *)0;
+		dcsp->sd_csus_rexmt_msg = NULL;
 	}
 	HARP_CANCEL(&dcsp->sd_csus_rexmt_t);
 
@@ -669,9 +669,9 @@ scsp_get_server_info(Scsp_server *ssp)
 {
 	int			i, len, mtu, rc, sel;
 	struct atminfreq	air;
-	struct air_netif_rsp	*netif_rsp = (struct air_netif_rsp *)0;
-	struct air_int_rsp	*intf_rsp = (struct air_int_rsp *)0;
-	struct air_cfg_rsp	*cfg_rsp = (struct air_cfg_rsp *)0;
+	struct air_netif_rsp	*netif_rsp = NULL;
+	struct air_int_rsp	*intf_rsp = NULL;
+	struct air_cfg_rsp	*cfg_rsp = NULL;
 	struct sockaddr_in	*ip_addr;
 	Atm_addr_nsap		*anp;
 
diff --git a/usr.sbin/atm/scspd/scsp_timer.c b/usr.sbin/atm/scspd/scsp_timer.c
index 8e3a514..ec91aa3 100644
--- a/usr.sbin/atm/scspd/scsp_timer.c
+++ b/usr.sbin/atm/scspd/scsp_timer.c
@@ -122,7 +122,7 @@ scsp_hello_timeout(Harp_timer *stp)
 	/*
 	 * Call the Hello FSM
 	 */
-	scsp_hfsm(dcsp, SCSP_HFSM_HELLO_T, (Scsp_msg *)0);
+	scsp_hfsm(dcsp, SCSP_HFSM_HELLO_T, NULL);
 
 	return;
 }
@@ -156,7 +156,7 @@ scsp_hello_rcv_timeout(Harp_timer *stp)
 	/*
 	 * Call the Hello FSM
 	 */
-	scsp_hfsm(dcsp, SCSP_HFSM_RCV_T, (void *)0);
+	scsp_hfsm(dcsp, SCSP_HFSM_RCV_T, NULL);
 
 	return;
 }
@@ -186,7 +186,7 @@ scsp_ca_retran_timeout(Harp_timer *stp)
 	/*
 	 * Call the CA FSM
 	 */
-	scsp_cafsm(dcsp, SCSP_CAFSM_CA_T, (void *)0);
+	scsp_cafsm(dcsp, SCSP_CAFSM_CA_T, NULL);
 
 	return;
 }
@@ -216,7 +216,7 @@ scsp_csus_retran_timeout(Harp_timer *stp)
 	/*
 	 * Call the CA FSM
 	 */
-	scsp_cafsm(dcsp, SCSP_CAFSM_CSUS_T, (void *)0);
+	scsp_cafsm(dcsp, SCSP_CAFSM_CSUS_T, NULL);
 
 	return;
 }
diff --git a/usr.sbin/atm/scspd/scspd.c b/usr.sbin/atm/scspd/scspd.c
index 05bf800..fdf6ef4 100644
--- a/usr.sbin/atm/scspd/scspd.c
+++ b/usr.sbin/atm/scspd/scspd.c
@@ -69,10 +69,10 @@
  */
 char		*prog;
 char		*scsp_config_file = SCSPD_CONFIG;
-FILE		*scsp_log_file = (FILE *)0;
+FILE		*scsp_log_file = NULL;
 int		scsp_log_syslog = 0;
-Scsp_server	*scsp_server_head = (Scsp_server *)0;
-Scsp_pending	*scsp_pending_head = (Scsp_pending *)0;
+Scsp_server	*scsp_server_head = NULL;
+Scsp_pending	*scsp_pending_head = NULL;
 int		scsp_max_socket = -1;
 int		scsp_debug_mode = 0;
 int		scsp_trace_mode = 0;
@@ -279,7 +279,7 @@ start_daemon(void)
 	}
 	fd = open(_PATH_TTY, O_RDWR);
 	if (fd >= 0) {
-		ioctl(fd, TIOCNOTTY, (char *)0);
+		ioctl(fd, TIOCNOTTY, NULL);
 		close(fd);
 	}
 
@@ -432,7 +432,7 @@ main(int argc, char **argv)
 		}
 		rc = select(scsp_max_socket + 1, &read_set,
 				&write_set, &except_set,
-				(struct timeval *)0);
+				NULL);
 		if (rc < 0) {
 			/*
 			 * Select error--check for possible signals
@@ -488,7 +488,7 @@ main(int argc, char **argv)
 				if ((dcsp = scsp_find_dcs(i)) != NULL) {
 					rc = scsp_hfsm(dcsp,
 						SCSP_HFSM_VC_ESTAB,
-						(Scsp_msg *)0);
+						NULL);
 				}
 			}
 		}
@@ -505,7 +505,7 @@ main(int argc, char **argv)
 				if (dcsp) {
 					rc = scsp_hfsm(dcsp,
 						SCSP_HFSM_VC_ESTAB,
-						(Scsp_msg *)0);
+						NULL);
 				}
 			}
 		}
diff --git a/usr.sbin/cron/cron/cron.c b/usr.sbin/cron/cron/cron.c
index 7eb548c..d831fe0 100644
--- a/usr.sbin/cron/cron/cron.c
+++ b/usr.sbin/cron/cron/cron.c
@@ -303,7 +303,7 @@ cron_sync(void)
 {
  	struct tm *tm;
 
-	TargetTime = time((time_t*)0);
+	TargetTime = time(NULL);
 	tm = localtime(&TargetTime);
 	TargetTime += (60 - tm->tm_sec);
 }
@@ -319,7 +319,7 @@ cron_sleep(cron_db *db)
 	 */
 
 	for (;;) {
-		seconds_to_wait = (int) (TargetTime - time((time_t*)0));
+		seconds_to_wait = (int) (TargetTime - time(NULL));
 
 		/*
 		 * If the seconds_to_wait value is insane, jump the cron
@@ -381,7 +381,7 @@ sigchld_handler(int x)
 #ifdef POSIX
 		pid = waitpid(-1, &waiter, WNOHANG);
 #else
-		pid = wait3(&waiter, WNOHANG, (struct rusage *)0);
+		pid = wait3(&waiter, WNOHANG, NULL);
 #endif
 		switch (pid) {
 		case -1:
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c
index 8916c86..e56f02b 100644
--- a/usr.sbin/cron/cron/do_command.c
+++ b/usr.sbin/cron/cron/do_command.c
@@ -310,7 +310,7 @@ child_process(entry *e, user *u)
 				_exit(OK_EXIT);
 			}
 # endif /*DEBUGGING*/
-			execle(shell, shell, "-c", e->cmd, (char *)0, e->envp);
+			execle(shell, shell, "-c", e->cmd, NULL, e->envp);
 			warn("execl: couldn't exec `%s'", shell);
 			_exit(ERROR_EXIT);
 		}
diff --git a/usr.sbin/cron/lib/compat.c b/usr.sbin/cron/lib/compat.c
index e6e0220..74cd4aa 100644
--- a/usr.sbin/cron/lib/compat.c
+++ b/usr.sbin/cron/lib/compat.c
@@ -108,7 +108,7 @@ setsid(void)
 #  endif
 	if ((fd = open(_PATH_TTY, 2)) >= 0)
 	{
-		ioctl(fd, TIOCNOTTY, (char*)0);
+		ioctl(fd, TIOCNOTTY, NULL);
 		close(fd);
 	}
 # else /*BSD*/
diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c
index f5f9c36..b4bb549 100644
--- a/usr.sbin/devinfo/devinfo.c
+++ b/usr.sbin/devinfo/devinfo.c
@@ -227,7 +227,7 @@ main(int argc, char *argv[])
 		devinfo_foreach_rman(print_rman, NULL);
 	} else {
 		/* print device hierarchy */
-		devinfo_foreach_device_child(root, print_device, (void *)0);
+		devinfo_foreach_device_child(root, print_device, NULL);
 	}
 	return(0);
 }
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index 731edf0..7d2b35f 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -329,7 +329,7 @@ getprivs(long id, int quotatype, char *fspath)
 	static int warned = 0;
 
 	setfsent();
-	quphead = (struct quotause *)0;
+	quphead = NULL;
 	qcmd = QCMD(Q_GETQUOTA, quotatype);
 	while ((fs = getfsent())) {
 		if (fspath && *fspath && strcmp(fspath, fs->fs_spec) &&
@@ -452,9 +452,9 @@ editit(char *tmpf)
 		sigsetmask(omask);
 		setgid(getgid());
 		setuid(getuid());
-		if ((ed = getenv("EDITOR")) == (char *)0)
+		if ((ed = getenv("EDITOR")) == NULL)
 			ed = _PATH_VI;
-		execlp(ed, ed, tmpf, (char *)0);
+		execlp(ed, ed, tmpf, NULL);
 		err(1, "%s", ed);
 	}
 	waitpid(pid, &status, 0);
@@ -524,7 +524,7 @@ readprivs(struct quotause *quplist, char *inname)
 			warnx("%s: bad format", line1);
 			return (0);
 		}
-		if ((cp = strtok((char *)0, "\n")) == NULL) {
+		if ((cp = strtok(NULL, "\n")) == NULL) {
 			warnx("%s: %s: bad format", fsp, &fsp[strlen(fsp) + 1]);
 			return (0);
 		}
@@ -657,7 +657,7 @@ readtimes(struct quotause *quplist, char *inname)
 			warnx("%s: bad format", line1);
 			return (0);
 		}
-		if ((cp = strtok((char *)0, "\n")) == NULL) {
+		if ((cp = strtok(NULL, "\n")) == NULL) {
 			warnx("%s: %s: bad format", fsp, &fsp[strlen(fsp) + 1]);
 			return (0);
 		}
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index 67b5d58..f62a58e 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -768,7 +768,7 @@ sig_child(int sig)
 	int status;
 	pid_t pid;
 
-	pid = wait3(&status, WNOHANG, (struct rusage *)0);
+	pid = wait3(&status, WNOHANG, NULL);
 	if (pid && WEXITSTATUS(status))
 		syslog(LOG_WARNING, "child %d exit status 0x%x", pid, status);
 }
@@ -795,7 +795,7 @@ start_daemon(void)
 	sa.sa_handler = sig_child;
 	sa.sa_flags = SA_NOCLDWAIT;
 	sigemptyset(&sa.sa_mask);
-	sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+	sigaction(SIGCHLD, &sa, NULL);
 #else
 	if (signal(SIGCHLD, sig_child) == SIG_ERR) {
 		exit_failure("signal CHLD: %s", strerror(errno));
diff --git a/usr.sbin/faithd/tcp.c b/usr.sbin/faithd/tcp.c
index 5ace5ff..3093712 100644
--- a/usr.sbin/faithd/tcp.c
+++ b/usr.sbin/faithd/tcp.c
@@ -93,7 +93,7 @@ sig_child(int sig)
 	int status;
 	pid_t pid;
 
-	pid = wait3(&status, WNOHANG, (struct rusage *)0);
+	pid = wait3(&status, WNOHANG, NULL);
 	if (pid && WEXITSTATUS(status))
 		syslog(LOG_WARNING, "child %d exit status 0x%x", pid, status);
 	exit_success("terminate connection due to child termination");
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c
index 79c2416..2a23102 100644
--- a/usr.sbin/fdformat/fdformat.c
+++ b/usr.sbin/fdformat/fdformat.c
@@ -268,7 +268,7 @@ main(int argc, char **argv)
 			break;
 
 		case 'F':	/* fill byte, C-like notation allowed */
-			fill = (int)strtol(optarg, (char **)0, 0);
+			fill = (int)strtol(optarg, NULL, 0);
 			break;
 
 		case 't':	/* steps per track */
diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c
index 3fc357e..15f9c30 100644
--- a/usr.sbin/inetd/builtins.c
+++ b/usr.sbin/inetd/builtins.c
@@ -741,7 +741,7 @@ getline(int fd, char *buf, int len)
 	sa.sa_flags = 0;
 	sigemptyset(&sa.sa_mask);
 	sa.sa_handler = SIG_DFL;
-	sigaction(SIGALRM, &sa, (struct sigaction *)0);
+	sigaction(SIGALRM, &sa, NULL);
 	do {
 		alarm(10);
 		n = read(fd, buf, len-count);
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index b746840..969397a 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -538,8 +538,7 @@ main(int argc, char **argv)
 	    }
 #endif
 	    readable = allsock;
-	    if ((n = select(maxsock + 1, &readable, (fd_set *)0,
-		(fd_set *)0, (struct timeval *)0)) <= 0) {
+	    if ((n = select(maxsock + 1, &readable, NULL, NULL, NULL)) <= 0) {
 		    if (n < 0 && errno != EINTR) {
 			syslog(LOG_WARNING, "select: %m");
 			sleep(1);
@@ -585,8 +584,7 @@ main(int argc, char **argv)
 			    i = 1;
 			    if (ioctl(sep->se_fd, FIONBIO, &i) < 0)
 				    syslog(LOG_ERR, "ioctl (FIONBIO, 1): %m");
-			    ctrl = accept(sep->se_fd, (struct sockaddr *)0,
-				(socklen_t *)0);
+			    ctrl = accept(sep->se_fd, NULL, NULL);
 			    if (debug)
 				    warnx("accept, ctrl %d", ctrl);
 			    if (ctrl < 0) {
@@ -698,9 +696,9 @@ main(int argc, char **argv)
 		    sigsetmask(0L);
 		    if (pid == 0) {
 			    if (dofork) {
-				sigaction(SIGALRM, &saalrm, (struct sigaction *)0);
-				sigaction(SIGCHLD, &sachld, (struct sigaction *)0);
-				sigaction(SIGHUP, &sahup, (struct sigaction *)0);
+				sigaction(SIGALRM, &saalrm, NULL);
+				sigaction(SIGCHLD, &sachld, NULL);
+				sigaction(SIGHUP, &sahup, NULL);
 				/* SIGPIPE reset before exec */
 			    }
 			    /*
@@ -835,8 +833,7 @@ main(int argc, char **argv)
 					}
 				}
 #endif
-				sigaction(SIGPIPE, &sapipe,
-				    (struct sigaction *)0);
+				sigaction(SIGPIPE, &sapipe, NULL);
 				execv(sep->se_server, sep->se_argv);
 				syslog(LOG_ERR,
 				    "cannot execute %s: %m", sep->se_server);
@@ -907,7 +904,7 @@ reapchild(void)
 	struct servtab *sep;
 
 	for (;;) {
-		pid = wait3(&status, WNOHANG, (struct rusage *)0);
+		pid = wait3(&status, WNOHANG, NULL);
 		if (pid <= 0)
 			break;
 		if (debug)
@@ -1435,7 +1432,7 @@ enter(struct servtab *cp)
 	long omask;
 
 	sep = (struct servtab *)malloc(sizeof (*sep));
-	if (sep == (struct servtab *)0) {
+	if (sep == NULL) {
 		syslog(LOG_ERR, "malloc: %m");
 		exit(EX_OSERR);
 	}
@@ -1582,7 +1579,7 @@ more:
 		break;
 	}
 	if (cp == NULL)
-		return ((struct servtab *)0);
+		return (NULL);
 	/*
 	 * clear the static buffer, since some fields (se_ctrladdr,
 	 * for example) don't get initialized here.
@@ -1978,8 +1975,8 @@ again:
 		if (c == ' ' || c == '\t')
 			if ((cp = nextline(fconfig)))
 				goto again;
-		*cpp = (char *)0;
-		return ((char *)0);
+		*cpp = NULL;
+		return (NULL);
 	}
 	if (*cp == '"' || *cp == '\'')
 		quote = *cp++;
@@ -2002,7 +1999,7 @@ nextline(FILE *fd)
 	char *cp;
 
 	if (fgets(line, sizeof (line), fd) == NULL)
-		return ((char *)0);
+		return (NULL);
 	cp = strchr(line, '\n');
 	if (cp)
 		*cp = '\0';
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 6246974..3b56a6d 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -212,11 +212,11 @@ delay(int millisec)
 	struct timeval tdelay;
 
 	if (millisec <= 0 || millisec > 10000)
-		fatal((struct printer *)0, /* fatal() knows how to deal */
+		fatal(NULL, /* fatal() knows how to deal */
 		    "unreasonable delay period (%d)", millisec);
 	tdelay.tv_sec = millisec / 1000;
 	tdelay.tv_usec = millisec * 1000 % 1000000;
-	select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tdelay);
+	select(0, NULL, NULL, NULL, &tdelay);
 }
 
 char *
diff --git a/usr.sbin/lpr/common_source/startdaemon.c b/usr.sbin/lpr/common_source/startdaemon.c
index 962b98f..13d5da6 100644
--- a/usr.sbin/lpr/common_source/startdaemon.c
+++ b/usr.sbin/lpr/common_source/startdaemon.c
@@ -87,7 +87,7 @@ startdaemon(const struct printer *pp)
 	 * Avoid overruns without putting artificial limitations on 
 	 * the length.
 	 */
-	if (writel(s, "\1", pp->printer, "\n", (char *)0) <= 0) {
+	if (writel(s, "\1", pp->printer, "\n", NULL) <= 0) {
 		warn("write");
 		close(s);
 		return(0);
diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c
index 023786f..b13e170 100644
--- a/usr.sbin/lpr/lpc/lpc.c
+++ b/usr.sbin/lpr/lpc/lpc.c
@@ -331,7 +331,7 @@ help(int argc, char **argv)
 		c = getcmd(arg);
 		if (c == (struct cmd *)-1)
 			printf("?Ambiguous help command %s\n", arg);
-		else if (c == (struct cmd *)0)
+		else if (c == NULL)
 			printf("?Invalid help command %s\n", arg);
 		else
 			printf("%-*s\t%s\n", (int) HELPINDENT,
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index b9e9f37..4e1eb85 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -245,7 +245,7 @@ main(int argc, char **argv)
 		if (pid < 0) {
 			err(EX_OSERR, "cannot fork");
 		} else if (pid == 0) {	/* child */
-			execl(_PATH_CHKPRINTCAP, _PATH_CHKPRINTCAP, (char *)0);
+			execl(_PATH_CHKPRINTCAP, _PATH_CHKPRINTCAP, NULL);
 			err(EX_OSERR, "cannot execute %s", _PATH_CHKPRINTCAP);
 		}
 		if (waitpid(pid, &status, 0) < 0) {
@@ -328,7 +328,7 @@ main(int argc, char **argv)
 		exit(1);
 	}
 	umask(0);
-	sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+	sigprocmask(SIG_SETMASK, &omask, NULL);
 	FD_ZERO(&defreadfds);
 	FD_SET(funix, &defreadfds);
 	listen(funix, 5);
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index a43f547..cbb2a86 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -660,7 +660,7 @@ print(struct printer *pp, int format, char *file)
 			execl(_PATH_PR, "pr", width, length,
 			    "-h", *title ? title : " ",
 			    "-L", *locale ? locale : "C",
-			    "-F", (char *)0);
+			    "-F", NULL);
 			syslog(LOG_ERR, "cannot execl %s", _PATH_PR);
 			exit(2);
 		}
@@ -1434,7 +1434,7 @@ sendmail(struct printer *pp, char *userid, int bombed)
 			cp++;
 		else
 			cp = _PATH_SENDMAIL;
-		execl(_PATH_SENDMAIL, cp, "-t", (char *)0);
+		execl(_PATH_SENDMAIL, cp, "-t", NULL);
 		_exit(0);
 	} else if (s > 0) {				/* parent */
 		dup2(p[1], 1);
@@ -1680,7 +1680,7 @@ openpr(const struct printer *pp)
 			else
 				cp++;
 			execl(pp->filters[LPF_OUTPUT], cp, width, length,
-			      (char *)0);
+			      NULL);
 			syslog(LOG_ERR, "%s: execl(%s): %m", pp->printer,
 			    pp->filters[LPF_OUTPUT]);
 			exit(1);
@@ -1793,8 +1793,7 @@ openrem(const struct printer *pp)
 		alarm(0);
 		signal(SIGALRM, savealrm);
 		if (pfd >= 0) {
-			if ((writel(pfd, "\2", pp->remote_queue, "\n", 
-				    (char *)0)
+			if ((writel(pfd, "\2", pp->remote_queue, "\n", NULL)
 			     == 2 + strlen(pp->remote_queue))
 			    && (resp = response(pp)) == 0)
 				break;
@@ -1824,7 +1823,7 @@ setty(const struct printer *pp)
 {
 	struct termios ttybuf;
 
-	if (ioctl(pfd, TIOCEXCL, (char *)0) < 0) {
+	if (ioctl(pfd, TIOCEXCL, NULL) < 0) {
 		syslog(LOG_ERR, "%s: ioctl(TIOCEXCL): %m", pp->printer);
 		exit(1);
 	}
@@ -1868,7 +1867,7 @@ pstatus(const struct printer *pp, const char *msg, ...)
 	ftruncate(fd, 0);
 	vasprintf(&buf, msg, ap);
 	va_end(ap);
-	writel(fd, buf, "\n", (char *)0);
+	writel(fd, buf, "\n", NULL);
 	close(fd);
 	free(buf);
 }
diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c
index 24b9321..1e61d1f 100644
--- a/usr.sbin/mrouted/main.c
+++ b/usr.sbin/mrouted/main.c
@@ -385,7 +385,7 @@ main(int argc, char **argv)
 #ifdef TIOCNOTTY
 	t = open(_PATH_TTY, 2);
 	if (t >= 0) {
-	    ioctl(t, TIOCNOTTY, (char *)0);
+	    ioctl(t, TIOCNOTTY, NULL);
 	    close(t);
 	}
 #else
diff --git a/usr.sbin/mrouted/mtrace.c b/usr.sbin/mrouted/mtrace.c
index 6015723..b096d0a 100644
--- a/usr.sbin/mrouted/mtrace.c
+++ b/usr.sbin/mrouted/mtrace.c
@@ -743,7 +743,7 @@ inet_name(u_int32 addr)
 u_int32 
 host_addr(char *name)
 {
-    struct hostent *e = (struct hostent *)0;
+    struct hostent *e = NULL;
     u_int32  addr;
     int	i, dots = 3;
     char	buf[40];
@@ -1231,8 +1231,7 @@ send_recv(u_int32 dst, int type, int code, int tries, struct resp_buf *save,
 	    if (tv.tv_usec < 0) tv.tv_usec += 1000000L, --tv.tv_sec;
 	    if (tv.tv_sec < 0) tv.tv_sec = tv.tv_usec = 0;
 
-	    count = select(igmp_socket + 1, &fds, (fd_set *)0, (fd_set *)0,
-			   &tv);
+	    count = select(igmp_socket + 1, &fds, NULL, NULL, &tv);
 
 	    if (count < 0) {
 		if (errno != EINTR) warn("select");
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index e4810e3..5dff303 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -1637,7 +1637,7 @@ do_zipwork(struct zipwork_entry *zwork)
 	}
 	if (!pidzip) {
 		/* The child process executes the compression command */
-		execl(pgm_path, pgm_path, "-f", zwork->zw_fname, (char *)0);
+		execl(pgm_path, pgm_path, "-f", zwork->zw_fname, NULL);
 		err(1, "execl(`%s -f %s')", pgm_path, zwork->zw_fname);
 	}
 
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 6061e97..901bbc0 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -529,9 +529,9 @@ writeit(const char *name, const char *reg, const char *data, int width)
 	struct pci_io pi;
 
 	pi.pi_sel = getsel(name);
-	pi.pi_reg = strtoul(reg, (char **)0, 0); /* XXX error check */
+	pi.pi_reg = strtoul(reg, NULL, 0); /* XXX error check */
 	pi.pi_width = width;
-	pi.pi_data = strtoul(data, (char **)0, 0); /* XXX error check */
+	pi.pi_data = strtoul(data, NULL, 0); /* XXX error check */
 
 	fd = open(_PATH_DEVPCI, O_RDWR, 0);
 	if (fd < 0)
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index d4c29d6..4181e8a 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1121,7 +1121,7 @@ device_script(char *program, int in, int out)
 	}
 	setuid(getuid());
 	setgid(getgid());
-	execl("/bin/sh", "sh", "-c", program, (char *)0);
+	execl("/bin/sh", "sh", "-c", program, NULL);
 	syslog(LOG_ERR, "could not exec /bin/sh: %m");
 	_exit(99);
 	/* NOTREACHED */
diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c
index aa24251..eca451a 100644
--- a/usr.sbin/repquota/repquota.c
+++ b/usr.sbin/repquota/repquota.c
@@ -212,7 +212,7 @@ repquota(struct fstab *fs, int type, char *qfpathname)
 		if (dqbuf.dqb_curinodes == 0 && dqbuf.dqb_curblocks == 0)
 			continue;
 		if ((fup = lookup(id, type)) == 0)
-			fup = addid(id, type, (char *)0);
+			fup = addid(id, type, NULL);
 		fup->fu_dqblk = dqbuf;
 	}
 	fclose(qf);
@@ -318,7 +318,7 @@ lookup(u_long id, int type)
 	for (fup = fuhead[type][id & (FUHASH-1)]; fup != 0; fup = fup->fu_next)
 		if (fup->fu_id == id)
 			return (fup);
-	return ((struct fileusage *)0);
+	return (NULL);
 }
 
 /*
diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c
index 93cecf7..c049729 100644
--- a/usr.sbin/rmt/rmt.c
+++ b/usr.sbin/rmt/rmt.c
@@ -82,7 +82,7 @@ main(int argc, char **argv)
 		debug = fopen(*argv, "w");
 		if (debug == 0)
 			exit(1);
-		setbuf(debug, (char *)0);
+		setbuf(debug, NULL);
 	}
 top:
 	errno = 0;
diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c
index 015d3d8..c7dc147 100644
--- a/usr.sbin/rpc.statd/statd.c
+++ b/usr.sbin/rpc.statd/statd.c
@@ -126,7 +126,7 @@ static void
 handle_sigchld(int sig, int code, struct sigcontext *scp)
 {
   int pid, status;
-  pid = wait4(-1, &status, WNOHANG, (struct rusage*)0);
+  pid = wait4(-1, &status, WNOHANG, NULL);
   if (!pid) syslog(LOG_ERR, "Phantom SIGCHLD??");
   else if (status == 0)
   {
diff --git a/usr.sbin/rpc.ypupdated/ypupdated_main.c b/usr.sbin/rpc.ypupdated/ypupdated_main.c
index 7784e61..4007aeb 100644
--- a/usr.sbin/rpc.ypupdated/ypupdated_main.c
+++ b/usr.sbin/rpc.ypupdated/ypupdated_main.c
@@ -138,8 +138,7 @@ ypupdated_svc_run(void)
 #else
 		readfds = svc_fds;
 #endif /* def FD_SETSIZE */
-		switch (select(fd_setsize, &readfds, NULL, NULL,
-			       (struct timeval *)0)) {
+		switch (select(fd_setsize, &readfds, NULL, NULL, NULL)) {
 		case -1:
 			if (errno == EINTR) {
 				continue;
diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
index bf32956..e5aec86 100644
--- a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
+++ b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
@@ -139,8 +139,7 @@ ypxfrd_svc_run(void)
 #else
 		readfds = svc_fds;
 #endif /* def FD_SETSIZE */
-		switch (select(fd_setsize, &readfds, NULL, NULL,
-			       (struct timeval *)0)) {
+		switch (select(fd_setsize, &readfds, NULL, NULL, NULL)) {
 		case -1:
 			if (errno == EINTR) {
 				continue;
diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c
index e344f1a..d19cc1e 100644
--- a/usr.sbin/timed/timed/master.c
+++ b/usr.sbin/timed/timed/master.c
@@ -286,7 +286,7 @@ loop:
 			 * do not want to call synch() while waiting
 			 * to be killed!
 			 */
-			gettimeofday(&ntime, (struct timezone *)0);
+			gettimeofday(&ntime, NULL);
 			pollingtime = ntime.tv_sec + SAMPLEINTVL;
 			break;
 
diff --git a/usr.sbin/timed/timed/measure.c b/usr.sbin/timed/timed/measure.c
index da20aa7..614f5ef 100644
--- a/usr.sbin/timed/timed/measure.c
+++ b/usr.sbin/timed/timed/measure.c
@@ -170,9 +170,8 @@ measure(u_long maxmsec,			/* wait this many msec at most */
 				tout.tv_sec = 0;
 
 			FD_SET(sock_raw, &ready);
-			count = select(sock_raw+1, &ready, (fd_set *)0,
-				       (fd_set *)0, &tout);
-			gettimeofday(&tcur, (struct timezone *)0);
+			count = select(sock_raw+1, &ready, NULL, NULL, &tout);
+			gettimeofday(&tcur, NULL);
 			if (count <= 0)
 				break;
 
diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c
index f2b1854..e0698d4 100644
--- a/usr.sbin/timed/timed/readmsg.c
+++ b/usr.sbin/timed/timed/readmsg.c
@@ -193,8 +193,7 @@ again:
 		}
 
 		FD_SET(sock, &ready);
-		if (!select(sock+1, &ready, (fd_set *)0, (fd_set *)0,
-			   &rwait)) {
+		if (!select(sock+1, &ready, NULL, NULL, &rwait)) {
 			if (rwait.tv_sec == 0 && rwait.tv_usec == 0)
 				return(0);
 			continue;
@@ -217,7 +216,7 @@ again:
 			      inet_ntoa(from.sin_addr));
 			continue;
 		}
-		gettimeofday(&from_when, (struct timezone *)0);
+		gettimeofday(&from_when, NULL);
 		bytehostorder(&msgin);
 
 		if (msgin.tsp_vers > TSPVERSION) {
diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c
index ecdd74f..9399502 100644
--- a/usr.sbin/timed/timed/slave.c
+++ b/usr.sbin/timed/timed/slave.c
@@ -100,7 +100,7 @@ slave(void)
 
 loop:
 	get_goodgroup(0);
-	gettimeofday(&ntime, (struct timezone *)0);
+	gettimeofday(&ntime, NULL);
 	if (ntime.tv_sec > electiontime) {
 		if (trace)
 			fprintf(fd, "election timer expired\n");
diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c
index 172fa6f..2c13276 100644
--- a/usr.sbin/timed/timed/timed.c
+++ b/usr.sbin/timed/timed/timed.c
@@ -228,7 +228,7 @@ main(int argc, char *argv[])
 	/* rounds kernel variable time to multiple of 5 ms. */
 	ntime.tv_sec = 0;
 	ntime.tv_usec = -((ntime.tv_usec/1000) % 5) * 1000;
-	adjtime(&ntime, (struct timeval *)0);
+	adjtime(&ntime, NULL);
 
 	for (nt = nets; nt; nt = nt->next) {
 		nentp = getnetbyname(nt->name);
@@ -690,7 +690,7 @@ date(void)
 	struct	timeval tv;
 	time_t	tv_sec;
 
-	gettimeofday(&tv, (struct timezone *)0);
+	gettimeofday(&tv, NULL);
 	tv_sec = tv.tv_sec;
 	return (ctime(&tv_sec));
 }
diff --git a/usr.sbin/timed/timedc/cmds.c b/usr.sbin/timed/timedc/cmds.c
index 1376fc6..69d2a5c 100644
--- a/usr.sbin/timed/timedc/cmds.c
+++ b/usr.sbin/timed/timedc/cmds.c
@@ -105,8 +105,7 @@ daydiff(char *hostname)
 		for (;;) {
 			FD_ZERO(&ready);
 			FD_SET(sock, &ready);
-			i = select(sock+1, &ready, (fd_set *)0,
-				   (fd_set *)0, &tout);
+			i = select(sock+1, &ready, NULL, NULL, &tout);
 			if (i < 0) {
 				if (errno == EINTR)
 					continue;
@@ -131,7 +130,7 @@ daydiff(char *hostname)
 			}
 			sec -= BU;
 
-			gettimeofday(&now, (struct timezone*)0);
+			gettimeofday(&now, NULL);
 			return (sec - now.tv_sec);
 		}
 	}
@@ -313,8 +312,7 @@ msite(int argc, char *argv[])
 		tout.tv_usec = 0;
 		FD_ZERO(&ready);
 		FD_SET(sock, &ready);
-		if (select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0,
-			   &tout)) {
+		if (select(FD_SETSIZE, &ready, NULL, NULL, &tout)) {
 			length = sizeof(from);
 			cc = recvfrom(sock, &msg, sizeof(struct tsp), 0,
 				      (struct sockaddr *)&from, &length);
@@ -468,7 +466,7 @@ tracing(int argc, char *argv[])
 	tout.tv_usec = 0;
 	FD_ZERO(&ready);
 	FD_SET(sock, &ready);
-	if (select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout)) {
+	if (select(FD_SETSIZE, &ready, NULL, NULL, &tout)) {
 		length = sizeof(from);
 		cc = recvfrom(sock, &msg, sizeof(struct tsp), 0,
 			      (struct sockaddr *)&from, &length);
diff --git a/usr.sbin/timed/timedc/timedc.c b/usr.sbin/timed/timedc/timedc.c
index d9a39e4..94ae45c 100644
--- a/usr.sbin/timed/timedc/timedc.c
+++ b/usr.sbin/timed/timedc/timedc.c
@@ -236,7 +236,7 @@ help(int argc, char **argv)
 		c = getcmd(arg);
 		if (c == (struct cmd *)-1)
 			printf("?Ambiguous help command %s\n", arg);
-		else if (c == (struct cmd *)0)
+		else if (c == NULL)
 			printf("?Invalid help command %s\n", arg);
 		else
 			printf("%-*s\t%s\n", (int)HELPINDENT,
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 6694471..13eff5c 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -755,7 +755,7 @@ wait_for_reply(int sock, struct sockaddr_in *from, struct timeval *sent)
 	if (wait.tv_sec < 0)
 		wait.tv_sec = wait.tv_usec = 0;
 
-	if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
+	if (select(sock+1, fdsp, NULL, NULL, &wait) > 0)
 		cc = recvfrom(s, (char *)packet, sizeof(packet), 0,
 		    (struct sockaddr *)from, &fromlen);
 
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index 57ae5b1..8ae3cdb 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -914,7 +914,7 @@ wait_for_reply(int sock, struct msghdr *mhdr)
 	FD_SET(sock, fdsp);
 	wait.tv_sec = waittime; wait.tv_usec = 0;
 
-	if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
+	if (select(sock+1, fdsp, NULL, NULL, &wait) > 0)
 		cc = recvmsg(rcvsock, mhdr, 0);
 
 	free(fdsp);
