Fix up still more casts; use NULL instead of (char *)0.

This commit is contained in:
dholland 2011-08-06 20:42:43 +00:00
parent 8041af98f6
commit 2c0ecb1ab6
14 changed files with 55 additions and 55 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg Exp $ */ /* $NetBSD: hack.apply.c,v 1.12 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg Exp $"); __RCSID("$NetBSD: hack.apply.c,v 1.12 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -255,7 +255,7 @@ use_ice_box(struct obj *obj)
else { else {
pline("Do you want to take something out of the ice-box? [yn] "); pline("Do you want to take something out of the ice-box? [yn] ");
if (readchar() == 'y') if (readchar() == 'y')
if (askchain(fcobj, (char *) 0, 0, out_ice_box, ck_ice_box, 0)) if (askchain(fcobj, NULL, 0, out_ice_box, ck_ice_box, 0))
return; return;
pline("That was all. Do you wish to put something in? [yn] "); pline("That was all. Do you wish to put something in? [yn] ");
if (readchar() != 'y') if (readchar() != 'y')
@ -490,7 +490,7 @@ use_pick_axe(struct obj *obj)
&& !sobj_at(ENORMOUS_ROCK, rx, ry)) { && !sobj_at(ENORMOUS_ROCK, rx, ry)) {
/* ACCESSIBLE or POOL */ /* ACCESSIBLE or POOL */
pline("You swing your %s through thin air.", pline("You swing your %s through thin air.",
aobjnam(obj, (char *) 0)); aobjnam(obj, NULL));
} else { } else {
if (dig_pos.x != rx || dig_pos.y != ry if (dig_pos.x != rx || dig_pos.y != ry
|| dig_level != dlevel || dig_down) { || dig_level != dlevel || dig_down) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.cmd.c,v 1.11 2010/02/03 15:34:38 roy Exp $ */ /* $NetBSD: hack.cmd.c,v 1.12 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.cmd.c,v 1.11 2010/02/03 15:34:38 roy Exp $"); __RCSID("$NetBSD: hack.cmd.c,v 1.12 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -139,7 +139,7 @@ static const struct func_tab cmdlist[] = {
static const struct ext_func_tab extcmdlist[] = { static const struct ext_func_tab extcmdlist[] = {
{ "dip", dodip }, { "dip", dodip },
{ "pray", dopray }, { "pray", dopray },
{ (char *) 0, donull } { NULL, donull }
}; };
static char lowc(int); static char lowc(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg Exp $ */ /* $NetBSD: hack.eat.c,v 1.11 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg Exp $"); __RCSID("$NetBSD: hack.eat.c,v 1.11 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -212,7 +212,7 @@ gotit:
goto no_opener; goto no_opener;
} }
pline("Using your %s you try to open the tin.", pline("Using your %s you try to open the tin.",
aobjnam(uwep, (char *) 0)); aobjnam(uwep, NULL));
} else { } else {
no_opener: no_opener:
pline("It is not so easy to open this tin."); pline("It is not so easy to open this tin.");

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.end.c,v 1.16 2011/08/06 20:29:37 dholland Exp $ */ /* $NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.end.c,v 1.16 2011/08/06 20:29:37 dholland Exp $"); __RCSID("$NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -206,7 +206,7 @@ done(const char *st1)
} }
if (*st1 == 'c') if (*st1 == 'c')
killer = st1; /* after outrip() */ killer = st1; /* after outrip() */
settty((char *) 0); /* does a clear_screen() */ settty(NULL); /* does a clear_screen() */
if (!done_stopprint) if (!done_stopprint)
printf("Goodbye %s %s...\n\n", pl_character, plname); printf("Goodbye %s %s...\n\n", pl_character, plname);
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.engrave.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ /* $NetBSD: hack.engrave.c,v 1.13 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.engrave.c,v 1.12 2011/08/06 20:29:37 dholland Exp $"); __RCSID("$NetBSD: hack.engrave.c,v 1.13 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -230,7 +230,7 @@ doengrave(void)
if (uwep && uwep->cursed) { if (uwep && uwep->cursed) {
/* Andreas Bormann */ /* Andreas Bormann */
pline("Since your weapon is welded to your hand,"); pline("Since your weapon is welded to your hand,");
pline("you use the %s.", aobjnam(uwep, (char *) 0)); pline("you use the %s.", aobjnam(uwep, NULL));
otmp = uwep; otmp = uwep;
} else { } else {
if (!otmp) if (!otmp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.invent.c,v 1.16 2011/08/06 20:29:37 dholland Exp $ */ /* $NetBSD: hack.invent.c,v 1.17 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.invent.c,v 1.16 2011/08/06 20:29:37 dholland Exp $"); __RCSID("$NetBSD: hack.invent.c,v 1.17 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <assert.h> #include <assert.h>
@ -80,7 +80,7 @@ __RCSID("$NetBSD: hack.invent.c,v 1.16 2011/08/06 20:29:37 dholland Exp $");
static int lastinvnr = 51; /* 0 ... 51 */ static int lastinvnr = 51; /* 0 ... 51 */
static char *xprname(struct obj *, char); static char *xprname(struct obj *, char);
static void doinv(char *); static void doinv(const char *);
static int merged(struct obj *, struct obj *, int); static int merged(struct obj *, struct obj *, int);
static void static void
@ -499,7 +499,7 @@ getobj(const char *let, const char *word)
continue; continue;
/* he typed a letter (not a space) to more() */ /* he typed a letter (not a space) to more() */
} else if (ilet == '*') { } else if (ilet == '*') {
doinv((char *) 0); doinv(NULL);
if (!(ilet = morc)) if (!(ilet = morc))
continue; continue;
/* ... */ /* ... */
@ -716,14 +716,14 @@ xprname(struct obj *obj, char let)
int int
ddoinv(void) ddoinv(void)
{ {
doinv((char *) 0); doinv(NULL);
return (0); return (0);
} }
/* called with 0 or "": all objects in inventory */ /* called with 0 or "": all objects in inventory */
/* otherwise: all objects with (serial) letter in lets */ /* otherwise: all objects with (serial) letter in lets */
static void static void
doinv(char *lets) doinv(const char *lets)
{ {
struct obj *otmp; struct obj *otmp;
char ilet; char ilet;
@ -736,7 +736,7 @@ doinv(char *lets)
pline("Not carrying anything."); pline("Not carrying anything.");
return; return;
} }
cornline(0, (char *) 0); cornline(0, NULL);
ilet = 'a'; ilet = 'a';
for (otmp = invent; otmp; otmp = otmp->nobj) { for (otmp = invent; otmp; otmp = otmp->nobj) {
if (flags.invlet_constant) if (flags.invlet_constant)
@ -883,10 +883,10 @@ dolook(void)
} }
if (ct == 1 && !gold) { if (ct == 1 && !gold) {
pline("You %s here %s.", verb, doname(otmp0)); pline("You %s here %s.", verb, doname(otmp0));
cornline(3, (char *) 0); cornline(3, NULL);
} }
if (ct > 1) if (ct > 1)
cornline(2, (char *) 0); cornline(2, NULL);
return (!!Blind); return (!!Blind);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.ioctl.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */ /* $NetBSD: hack.ioctl.c,v 1.10 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.ioctl.c,v 1.9 2009/08/12 07:28:40 dholland Exp $"); __RCSID("$NetBSD: hack.ioctl.c,v 1.10 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -95,7 +95,7 @@ dosuspend(void)
{ {
#ifdef SIGTSTP #ifdef SIGTSTP
if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) { if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
settty((char *) 0); settty(NULL);
(void) signal(SIGTSTP, SIG_DFL); (void) signal(SIGTSTP, SIG_DFL);
(void) kill(0, SIGTSTP); (void) kill(0, SIGTSTP);
gettty(); gettty();

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.main.c,v 1.16 2011/05/23 22:53:25 joerg Exp $ */ /* $NetBSD: hack.main.c,v 1.17 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.main.c,v 1.16 2011/05/23 22:53:25 joerg Exp $"); __RCSID("$NetBSD: hack.main.c,v 1.17 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -471,7 +471,7 @@ not_recovered:
#ifdef MAIL #ifdef MAIL
ckmailstatus(); ckmailstatus();
#endif #endif
rhack((char *) 0); rhack(NULL);
} }
if (multi && multi % 7 == 0) if (multi && multi % 7 == 0)
(void) fflush(stdout); (void) fflush(stdout);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mklev.c,v 1.8 2009/08/12 07:28:40 dholland Exp $ */ /* $NetBSD: hack.mklev.c,v 1.9 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mklev.c,v 1.8 2009/08/12 07:28:40 dholland Exp $"); __RCSID("$NetBSD: hack.mklev.c,v 1.9 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <unistd.h> #include <unistd.h>
@ -188,7 +188,7 @@ makelevel(void)
} }
} }
qsort((char *) rooms, nroom, sizeof(struct mkroom), comp); qsort(rooms, nroom, sizeof(rooms[0]), comp);
makecorridors(); makecorridors();
make_niches(); make_niches();

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.o_init.c,v 1.13 2011/08/06 20:32:25 dholland Exp $ */ /* $NetBSD: hack.o_init.c,v 1.14 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.o_init.c,v 1.13 2011/08/06 20:32:25 dholland Exp $"); __RCSID("$NetBSD: hack.o_init.c,v 1.14 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -228,9 +228,9 @@ dodiscovered(void)
} }
if (ct == 0) { if (ct == 0) {
pline("You haven't discovered anything yet..."); pline("You haven't discovered anything yet...");
cornline(3, (char *) 0); cornline(3, NULL);
} else } else
cornline(2, (char *) 0); cornline(2, NULL);
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.pager.c,v 1.18 2011/08/06 20:29:37 dholland Exp $ */ /* $NetBSD: hack.pager.c,v 1.19 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.pager.c,v 1.18 2011/08/06 20:29:37 dholland Exp $"); __RCSID("$NetBSD: hack.pager.c,v 1.19 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
/* This file contains the command routine dowhatis() and a pager. */ /* This file contains the command routine dowhatis() and a pager. */
@ -392,7 +392,7 @@ page_file(const char *fnam, boolean silent)
if (!silent) if (!silent)
printf("Cannot open %s as stdin.\n", fnam); printf("Cannot open %s as stdin.\n", fnam);
} else { } else {
execl(catmore, "page", (char *) 0); execl(catmore, "page", (char *)NULL);
if (!silent) if (!silent)
printf("Cannot exec %s.\n", catmore); printf("Cannot exec %s.\n", catmore);
} }
@ -428,9 +428,9 @@ dosh(void)
char *str; char *str;
if (child(0)) { if (child(0)) {
if ((str = getenv("SHELL")) != NULL) if ((str = getenv("SHELL")) != NULL)
execl(str, str, (char *) 0); execl(str, str, (char *)NULL);
else else
execl("/bin/sh", "sh", (char *) 0); execl("/bin/sh", "sh", (char *)NULL);
pline("sh: cannot execute."); pline("sh: cannot execute.");
exit(1); exit(1);
} }
@ -446,7 +446,7 @@ child(int wt)
f = fork(); f = fork();
if (f == 0) { /* child */ if (f == 0) { /* child */
settty((char *) 0); /* also calls end_screen() */ settty(NULL); /* also calls end_screen() */
(void) setuid(getuid()); (void) setuid(getuid());
(void) setgid(getgid()); (void) setgid(getgid());
#ifdef CHDIR #ifdef CHDIR

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.save.c,v 1.15 2011/08/06 20:00:33 dholland Exp $ */ /* $NetBSD: hack.save.c,v 1.16 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.save.c,v 1.15 2011/08/06 20:00:33 dholland Exp $"); __RCSID("$NetBSD: hack.save.c,v 1.16 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -192,7 +192,7 @@ dorecover(int fd)
mread(fd, fut_geno, sizeof fut_geno); mread(fd, fut_geno, sizeof fut_geno);
restnames(fd); restnames(fd);
while (1) { while (1) {
if (read(fd, (char *) &tmp, sizeof tmp) != sizeof tmp) if (read(fd, &tmp, sizeof tmp) != sizeof tmp)
break; break;
getlev(fd, 0, tmp); getlev(fd, 0, tmp);
glo(tmp); glo(tmp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.tty.c,v 1.15 2010/02/03 15:34:39 roy Exp $ */ /* $NetBSD: hack.tty.c,v 1.16 2011/08/06 20:42:43 dholland Exp $ */
/*- /*-
* Copyright (c) 1988, 1993 * Copyright (c) 1988, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: hack.tty.c,v 1.15 2010/02/03 15:34:39 roy Exp $"); __RCSID("$NetBSD: hack.tty.c,v 1.16 2011/08/06 20:42:43 dholland Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -206,7 +206,7 @@ error(const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
if (settty_needed) if (settty_needed)
settty((char *) 0); settty(NULL);
vprintf(fmt, ap); vprintf(fmt, ap);
va_end(ap); va_end(ap);
putchar('\n'); putchar('\n');

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.unix.c,v 1.14 2009/08/12 07:28:41 dholland Exp $ */ /* $NetBSD: hack.unix.c,v 1.15 2011/08/06 20:42:43 dholland Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.unix.c,v 1.14 2009/08/12 07:28:41 dholland Exp $"); __RCSID("$NetBSD: hack.unix.c,v 1.15 2011/08/06 20:42:43 dholland Exp $");
#endif /* not lint */ #endif /* not lint */
/* This file collects some Unix dependencies; hack.pager.c contains some more */ /* This file collects some Unix dependencies; hack.pager.c contains some more */
@ -242,7 +242,7 @@ veryold(int fd)
int lockedpid; /* should be the same size as int lockedpid; /* should be the same size as
* hackpid */ * hackpid */
if (read(fd, (char *) &lockedpid, sizeof(lockedpid)) != if (read(fd, &lockedpid, sizeof(lockedpid)) !=
sizeof(lockedpid)) sizeof(lockedpid))
/* strange ... */ /* strange ... */
return (0); return (0);
@ -327,7 +327,7 @@ gotlock:
if (fd == -1) { if (fd == -1) {
error("cannot creat lock file."); error("cannot creat lock file.");
} else { } else {
if (write(fd, (char *) &hackpid, sizeof(hackpid)) if (write(fd, &hackpid, sizeof(hackpid))
!= sizeof(hackpid)) { != sizeof(hackpid)) {
error("cannot write lock"); error("cannot write lock");
} }
@ -506,7 +506,7 @@ readmail(void)
if (!(mr = getenv("MAILREADER"))) if (!(mr = getenv("MAILREADER")))
mr = DEF_MAILREADER; mr = DEF_MAILREADER;
if (child(1)) { if (child(1)) {
execl(mr, mr, (char *) 0); execl(mr, mr, (char *)NULL);
exit(1); exit(1);
} }
#else /* DEF_MAILREADER */ #else /* DEF_MAILREADER */