From 18451d9c4ce377951796a0ac6188ca7b1bf34335 Mon Sep 17 00:00:00 2001 From: dholland Date: Sat, 6 Aug 2011 20:42:43 +0000 Subject: Fix up still more casts; use NULL instead of (char *)0. --- hack/hack.apply.c | 8 ++++---- hack/hack.cmd.c | 6 +++--- hack/hack.eat.c | 6 +++--- hack/hack.end.c | 6 +++--- hack/hack.engrave.c | 6 +++--- hack/hack.invent.c | 18 +++++++++--------- hack/hack.ioctl.c | 6 +++--- hack/hack.main.c | 6 +++--- hack/hack.mklev.c | 6 +++--- hack/hack.o_init.c | 8 ++++---- hack/hack.pager.c | 12 ++++++------ hack/hack.save.c | 6 +++--- hack/hack.tty.c | 6 +++--- hack/hack.unix.c | 10 +++++----- 14 files changed, 55 insertions(+), 55 deletions(-) (limited to 'hack') diff --git a/hack/hack.apply.c b/hack/hack.apply.c index a9984b94..24d7443a 100644 --- a/hack/hack.apply.c +++ b/hack/hack.apply.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include "hack.h" @@ -255,7 +255,7 @@ use_ice_box(struct obj *obj) else { pline("Do you want to take something out of the ice-box? [yn] "); 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; pline("That was all. Do you wish to put something in? [yn] "); if (readchar() != 'y') @@ -490,7 +490,7 @@ use_pick_axe(struct obj *obj) && !sobj_at(ENORMOUS_ROCK, rx, ry)) { /* ACCESSIBLE or POOL */ pline("You swing your %s through thin air.", - aobjnam(obj, (char *) 0)); + aobjnam(obj, NULL)); } else { if (dig_pos.x != rx || dig_pos.y != ry || dig_level != dlevel || dig_down) { diff --git a/hack/hack.cmd.c b/hack/hack.cmd.c index e2e931f9..e1143147 100644 --- a/hack/hack.cmd.c +++ b/hack/hack.cmd.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include "hack.h" @@ -139,7 +139,7 @@ static const struct func_tab cmdlist[] = { static const struct ext_func_tab extcmdlist[] = { { "dip", dodip }, { "pray", dopray }, - { (char *) 0, donull } + { NULL, donull } }; static char lowc(int); diff --git a/hack/hack.eat.c b/hack/hack.eat.c index aca3643c..bf8703bd 100644 --- a/hack/hack.eat.c +++ b/hack/hack.eat.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include "hack.h" @@ -212,7 +212,7 @@ gotit: goto no_opener; } pline("Using your %s you try to open the tin.", - aobjnam(uwep, (char *) 0)); + aobjnam(uwep, NULL)); } else { no_opener: pline("It is not so easy to open this tin."); diff --git a/hack/hack.end.c b/hack/hack.end.c index 8e57ff7e..b1dca4b9 100644 --- a/hack/hack.end.c +++ b/hack/hack.end.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -206,7 +206,7 @@ done(const char *st1) } if (*st1 == 'c') killer = st1; /* after outrip() */ - settty((char *) 0); /* does a clear_screen() */ + settty(NULL); /* does a clear_screen() */ if (!done_stopprint) printf("Goodbye %s %s...\n\n", pl_character, plname); { diff --git a/hack/hack.engrave.c b/hack/hack.engrave.c index 2e00b882..2f7d3a2a 100644 --- a/hack/hack.engrave.c +++ b/hack/hack.engrave.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -230,7 +230,7 @@ doengrave(void) if (uwep && uwep->cursed) { /* Andreas Bormann */ 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; } else { if (!otmp) diff --git a/hack/hack.invent.c b/hack/hack.invent.c index 0032cdb9..2a6fddb6 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -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 char *xprname(struct obj *, char); -static void doinv(char *); +static void doinv(const char *); static int merged(struct obj *, struct obj *, int); static void @@ -499,7 +499,7 @@ getobj(const char *let, const char *word) continue; /* he typed a letter (not a space) to more() */ } else if (ilet == '*') { - doinv((char *) 0); + doinv(NULL); if (!(ilet = morc)) continue; /* ... */ @@ -716,14 +716,14 @@ xprname(struct obj *obj, char let) int ddoinv(void) { - doinv((char *) 0); + doinv(NULL); return (0); } /* called with 0 or "": all objects in inventory */ /* otherwise: all objects with (serial) letter in lets */ static void -doinv(char *lets) +doinv(const char *lets) { struct obj *otmp; char ilet; @@ -736,7 +736,7 @@ doinv(char *lets) pline("Not carrying anything."); return; } - cornline(0, (char *) 0); + cornline(0, NULL); ilet = 'a'; for (otmp = invent; otmp; otmp = otmp->nobj) { if (flags.invlet_constant) @@ -883,10 +883,10 @@ dolook(void) } if (ct == 1 && !gold) { pline("You %s here %s.", verb, doname(otmp0)); - cornline(3, (char *) 0); + cornline(3, NULL); } if (ct > 1) - cornline(2, (char *) 0); + cornline(2, NULL); return (!!Blind); } diff --git a/hack/hack.ioctl.c b/hack/hack.ioctl.c index 776c6aab..45c73b17 100644 --- a/hack/hack.ioctl.c +++ b/hack/hack.ioctl.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ /* @@ -95,7 +95,7 @@ dosuspend(void) { #ifdef SIGTSTP if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) { - settty((char *) 0); + settty(NULL); (void) signal(SIGTSTP, SIG_DFL); (void) kill(0, SIGTSTP); gettty(); diff --git a/hack/hack.main.c b/hack/hack.main.c index cb0537f3..5083a36e 100644 --- a/hack/hack.main.c +++ b/hack/hack.main.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -471,7 +471,7 @@ not_recovered: #ifdef MAIL ckmailstatus(); #endif - rhack((char *) 0); + rhack(NULL); } if (multi && multi % 7 == 0) (void) fflush(stdout); diff --git a/hack/hack.mklev.c b/hack/hack.mklev.c index dbf6c8d4..7cf9294c 100644 --- a/hack/hack.mklev.c +++ b/hack/hack.mklev.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -188,7 +188,7 @@ makelevel(void) } } - qsort((char *) rooms, nroom, sizeof(struct mkroom), comp); + qsort(rooms, nroom, sizeof(rooms[0]), comp); makecorridors(); make_niches(); diff --git a/hack/hack.o_init.c b/hack/hack.o_init.c index 47284544..9ca796e2 100644 --- a/hack/hack.o_init.c +++ b/hack/hack.o_init.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -228,9 +228,9 @@ dodiscovered(void) } if (ct == 0) { pline("You haven't discovered anything yet..."); - cornline(3, (char *) 0); + cornline(3, NULL); } else - cornline(2, (char *) 0); + cornline(2, NULL); return (0); } diff --git a/hack/hack.pager.c b/hack/hack.pager.c index af7ac54c..5f2c50fd 100644 --- a/hack/hack.pager.c +++ b/hack/hack.pager.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ /* This file contains the command routine dowhatis() and a pager. */ @@ -392,7 +392,7 @@ page_file(const char *fnam, boolean silent) if (!silent) printf("Cannot open %s as stdin.\n", fnam); } else { - execl(catmore, "page", (char *) 0); + execl(catmore, "page", (char *)NULL); if (!silent) printf("Cannot exec %s.\n", catmore); } @@ -428,9 +428,9 @@ dosh(void) char *str; if (child(0)) { if ((str = getenv("SHELL")) != NULL) - execl(str, str, (char *) 0); + execl(str, str, (char *)NULL); else - execl("/bin/sh", "sh", (char *) 0); + execl("/bin/sh", "sh", (char *)NULL); pline("sh: cannot execute."); exit(1); } @@ -446,7 +446,7 @@ child(int wt) f = fork(); if (f == 0) { /* child */ - settty((char *) 0); /* also calls end_screen() */ + settty(NULL); /* also calls end_screen() */ (void) setuid(getuid()); (void) setgid(getgid()); #ifdef CHDIR diff --git a/hack/hack.save.c b/hack/hack.save.c index 00fc42b4..1e93d7ef 100644 --- a/hack/hack.save.c +++ b/hack/hack.save.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -192,7 +192,7 @@ dorecover(int fd) mread(fd, fut_geno, sizeof fut_geno); restnames(fd); while (1) { - if (read(fd, (char *) &tmp, sizeof tmp) != sizeof tmp) + if (read(fd, &tmp, sizeof tmp) != sizeof tmp) break; getlev(fd, 0, tmp); glo(tmp); diff --git a/hack/hack.tty.c b/hack/hack.tty.c index 474afab5..9c9bcefd 100644 --- a/hack/hack.tty.c +++ b/hack/hack.tty.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -206,7 +206,7 @@ error(const char *fmt, ...) va_start(ap, fmt); if (settty_needed) - settty((char *) 0); + settty(NULL); vprintf(fmt, ap); va_end(ap); putchar('\n'); diff --git a/hack/hack.unix.c b/hack/hack.unix.c index 77db96d7..44db67fb 100644 --- a/hack/hack.unix.c +++ b/hack/hack.unix.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ /* 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 * hackpid */ - if (read(fd, (char *) &lockedpid, sizeof(lockedpid)) != + if (read(fd, &lockedpid, sizeof(lockedpid)) != sizeof(lockedpid)) /* strange ... */ return (0); @@ -327,7 +327,7 @@ gotlock: if (fd == -1) { error("cannot creat lock file."); } else { - if (write(fd, (char *) &hackpid, sizeof(hackpid)) + if (write(fd, &hackpid, sizeof(hackpid)) != sizeof(hackpid)) { error("cannot write lock"); } @@ -506,7 +506,7 @@ readmail(void) if (!(mr = getenv("MAILREADER"))) mr = DEF_MAILREADER; if (child(1)) { - execl(mr, mr, (char *) 0); + execl(mr, mr, (char *)NULL); exit(1); } #else /* DEF_MAILREADER */ -- cgit v1.2.3-56-ge451