Module Name: src Committed By: dholland Date: Sat Aug 6 20:42:44 UTC 2011
Modified Files: src/games/hack: hack.apply.c hack.cmd.c hack.eat.c hack.end.c hack.engrave.c hack.invent.c hack.ioctl.c hack.main.c hack.mklev.c hack.o_init.c hack.pager.c hack.save.c hack.tty.c hack.unix.c Log Message: Fix up still more casts; use NULL instead of (char *)0. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.apply.c \ src/games/hack/hack.cmd.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.eat.c cvs rdiff -u -r1.16 -r1.17 src/games/hack/hack.end.c \ src/games/hack/hack.invent.c src/games/hack/hack.main.c cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.engrave.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.ioctl.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.mklev.c cvs rdiff -u -r1.13 -r1.14 src/games/hack/hack.o_init.c cvs rdiff -u -r1.18 -r1.19 src/games/hack/hack.pager.c cvs rdiff -u -r1.15 -r1.16 src/games/hack/hack.save.c \ src/games/hack/hack.tty.c cvs rdiff -u -r1.14 -r1.15 src/games/hack/hack.unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/hack/hack.apply.c diff -u src/games/hack/hack.apply.c:1.11 src/games/hack/hack.apply.c:1.12 --- src/games/hack/hack.apply.c:1.11 Mon May 23 22:53:25 2011 +++ src/games/hack/hack.apply.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 @@ 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 @@ && !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) { Index: src/games/hack/hack.cmd.c diff -u src/games/hack/hack.cmd.c:1.11 src/games/hack/hack.cmd.c:1.12 --- src/games/hack/hack.cmd.c:1.11 Wed Feb 3 15:34:38 2010 +++ src/games/hack/hack.cmd.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 ext_func_tab extcmdlist[] = { { "dip", dodip }, { "pray", dopray }, - { (char *) 0, donull } + { NULL, donull } }; static char lowc(int); Index: src/games/hack/hack.eat.c diff -u src/games/hack/hack.eat.c:1.10 src/games/hack/hack.eat.c:1.11 --- src/games/hack/hack.eat.c:1.10 Mon May 23 22:53:25 2011 +++ src/games/hack/hack.eat.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 @@ 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."); Index: src/games/hack/hack.end.c diff -u src/games/hack/hack.end.c:1.16 src/games/hack/hack.end.c:1.17 --- src/games/hack/hack.end.c:1.16 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.end.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <signal.h> @@ -206,7 +206,7 @@ } 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); { Index: src/games/hack/hack.invent.c diff -u src/games/hack/hack.invent.c:1.16 src/games/hack/hack.invent.c:1.17 --- src/games/hack/hack.invent.c:1.16 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.invent.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <assert.h> @@ -80,7 +80,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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); } Index: src/games/hack/hack.main.c diff -u src/games/hack/hack.main.c:1.16 src/games/hack/hack.main.c:1.17 --- src/games/hack/hack.main.c:1.16 Mon May 23 22:53:25 2011 +++ src/games/hack/hack.main.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <signal.h> @@ -471,7 +471,7 @@ #ifdef MAIL ckmailstatus(); #endif - rhack((char *) 0); + rhack(NULL); } if (multi && multi % 7 == 0) (void) fflush(stdout); Index: src/games/hack/hack.engrave.c diff -u src/games/hack/hack.engrave.c:1.12 src/games/hack/hack.engrave.c:1.13 --- src/games/hack/hack.engrave.c:1.12 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.engrave.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -230,7 +230,7 @@ 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) Index: src/games/hack/hack.ioctl.c diff -u src/games/hack/hack.ioctl.c:1.9 src/games/hack/hack.ioctl.c:1.10 --- src/games/hack/hack.ioctl.c:1.9 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.ioctl.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 @@ { #ifdef SIGTSTP if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) { - settty((char *) 0); + settty(NULL); (void) signal(SIGTSTP, SIG_DFL); (void) kill(0, SIGTSTP); gettty(); Index: src/games/hack/hack.mklev.c diff -u src/games/hack/hack.mklev.c:1.8 src/games/hack/hack.mklev.c:1.9 --- src/games/hack/hack.mklev.c:1.8 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.mklev.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <unistd.h> @@ -188,7 +188,7 @@ } } - qsort((char *) rooms, nroom, sizeof(struct mkroom), comp); + qsort(rooms, nroom, sizeof(rooms[0]), comp); makecorridors(); make_niches(); Index: src/games/hack/hack.o_init.c diff -u src/games/hack/hack.o_init.c:1.13 src/games/hack/hack.o_init.c:1.14 --- src/games/hack/hack.o_init.c:1.13 Sat Aug 6 20:32:25 2011 +++ src/games/hack/hack.o_init.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <string.h> @@ -228,9 +228,9 @@ } 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); } Index: src/games/hack/hack.pager.c diff -u src/games/hack/hack.pager.c:1.18 src/games/hack/hack.pager.c:1.19 --- src/games/hack/hack.pager.c:1.18 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.pager.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 @@ 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 @@ 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 @@ 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 Index: src/games/hack/hack.save.c diff -u src/games/hack/hack.save.c:1.15 src/games/hack/hack.save.c:1.16 --- src/games/hack/hack.save.c:1.15 Sat Aug 6 20:00:33 2011 +++ src/games/hack/hack.save.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 <signal.h> @@ -192,7 +192,7 @@ 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); Index: src/games/hack/hack.tty.c diff -u src/games/hack/hack.tty.c:1.15 src/games/hack/hack.tty.c:1.16 --- src/games/hack/hack.tty.c:1.15 Wed Feb 3 15:34:39 2010 +++ src/games/hack/hack.tty.c Sat Aug 6 20:42:43 2011 @@ -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 @@ va_start(ap, fmt); if (settty_needed) - settty((char *) 0); + settty(NULL); vprintf(fmt, ap); va_end(ap); putchar('\n'); Index: src/games/hack/hack.unix.c diff -u src/games/hack/hack.unix.c:1.14 src/games/hack/hack.unix.c:1.15 --- src/games/hack/hack.unix.c:1.14 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.unix.c Sat Aug 6 20:42:43 2011 @@ -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 <sys/cdefs.h> #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 @@ 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 @@ 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 @@ 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 */