CVS commit: src/games/hack
Module Name:src Committed By: fox Date: Sat Feb 8 00:59:55 UTC 2020 Modified Files: src/games/hack: Makefile Log Message: games/hack: Suppress -Werror=stringop-truncation error. Add GCC_NO_STRINGOP_TRUNCATION to hack.end.c to prevent build failure. Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag. Reviewed by: kamil@ To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/games/hack/Makefile 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/Makefile diff -u src/games/hack/Makefile:1.46 src/games/hack/Makefile:1.47 --- src/games/hack/Makefile:1.46 Sun Oct 13 07:28:09 2019 +++ src/games/hack/Makefile Sat Feb 8 00:59:55 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.46 2019/10/13 07:28:09 mrg Exp $ +# $NetBSD: Makefile,v 1.47 2020/02/08 00:59:55 fox Exp $ # @(#)Makefile 8.2 (Berkeley) 4/27/95 .include @@ -39,6 +39,7 @@ hack.h: hack.onames.h COPTS.hack.mon.c+= -Wno-format-nonliteral COPTS.hack.rip.c+= -Wno-format-nonliteral +COPTS.hack.end.c+= ${GCC_NO_STRINGOP_TRUNCATION} .if !exists(${DESTDIR}${FILESDIR}/perm) afterinstall: clobber
CVS commit: src/games/hack
Module Name:src Committed By: fox Date: Fri Feb 7 22:04:02 UTC 2020 Modified Files: src/games/hack: hack.end.c Log Message: games/hack: Revert the strlcpy(1) change since this changes expected behavior from strncpy(3). Reviewed by: kamil@ To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/games/hack/hack.end.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.end.c diff -u src/games/hack/hack.end.c:1.18 src/games/hack/hack.end.c:1.19 --- src/games/hack/hack.end.c:1.18 Fri Feb 7 20:34:18 2020 +++ src/games/hack/hack.end.c Fri Feb 7 22:04:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $ */ +/* $NetBSD: hack.end.c,v 1.19 2020/02/07 22:04:02 fox Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $"); +__RCSID("$NetBSD: hack.end.c,v 1.19 2020/02/07 22:04:02 fox Exp $"); #endif/* not lint */ #include @@ -362,7 +362,7 @@ topten(void) t0->plchar = pl_character[0]; t0->sex = (flags.female ? 'F' : 'M'); t0->uid = uid; - (void) strlcpy(t0->name, plname, NAMSZ); + (void) strncpy(t0->name, plname, NAMSZ); (t0->name)[NAMSZ] = 0; (void) strncpy(t0->death, killer, DTHSZ); (t0->death)[DTHSZ] = 0;
CVS commit: src/games/hack
Module Name:src Committed By: fox Date: Fri Feb 7 20:34:18 UTC 2020 Modified Files: src/games/hack: hack.end.c Log Message: games/hack: Fix -Wstringop-truncation warning. Replace strncpy(3) with strlcpy(3). Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag. Reviewed by: kamil@ To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/games/hack/hack.end.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.end.c diff -u src/games/hack/hack.end.c:1.17 src/games/hack/hack.end.c:1.18 --- src/games/hack/hack.end.c:1.17 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.end.c Fri Feb 7 20:34:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $"); +__RCSID("$NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $"); #endif/* not lint */ #include @@ -362,7 +362,7 @@ topten(void) t0->plchar = pl_character[0]; t0->sex = (flags.female ? 'F' : 'M'); t0->uid = uid; - (void) strncpy(t0->name, plname, NAMSZ); + (void) strlcpy(t0->name, plname, NAMSZ); (t0->name)[NAMSZ] = 0; (void) strncpy(t0->death, killer, DTHSZ); (t0->death)[DTHSZ] = 0;
CVS commit: src/games/hack
Module Name:src Committed By: mrg Date: Mon Feb 4 03:33:15 UTC 2019 Modified Files: src/games/hack: hack.eat.c Log Message: - done() can return in wizard mode. don't NOTREACHED'd it but break instead. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.eat.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.eat.c diff -u src/games/hack/hack.eat.c:1.12 src/games/hack/hack.eat.c:1.13 --- src/games/hack/hack.eat.c:1.12 Sun Aug 7 06:03:45 2011 +++ src/games/hack/hack.eat.c Mon Feb 4 03:33:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.eat.c,v 1.12 2011/08/07 06:03:45 dholland Exp $ */ +/* $NetBSD: hack.eat.c,v 1.13 2019/02/04 03:33:15 mrg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.eat.c,v 1.12 2011/08/07 06:03:45 dholland Exp $"); +__RCSID("$NetBSD: hack.eat.c,v 1.13 2019/02/04 03:33:15 mrg Exp $"); #endif/* not lint */ #include "hack.h" @@ -539,7 +539,7 @@ eatcorpse(struct obj *otmp) pline("You turn to stone."); killer = "dead cockatrice"; done("died"); - /* NOTREACHED */ + break; case 'a': if (Stoned) { pline("What a pity - you just destroyed a future piece of art!");
CVS commit: src/games/hack
Module Name:src Committed By: joerg Date: Sat Aug 27 23:42:33 UTC 2011 Modified Files: src/games/hack: extern.h Log Message: Mark error() as dead, so that validation for setclipped works correctly. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/games/hack/extern.h 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/extern.h diff -u src/games/hack/extern.h:1.17 src/games/hack/extern.h:1.18 --- src/games/hack/extern.h:1.17 Fri Aug 26 06:18:17 2011 +++ src/games/hack/extern.h Sat Aug 27 23:42:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.17 2011/08/26 06:18:17 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.18 2011/08/27 23:42:33 joerg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -449,7 +449,7 @@ void gettty(void); void settty(const char *); void setftty(void); -void error(const char *, ...) __printflike(1, 2); +void error(const char *, ...) __printflike(1, 2) __dead; void getlin(char *); void getret(void); void cgetret(const char *);
CVS commit: src/games/hack
Module Name:src Committed By: plunky Date: Wed Aug 24 17:39:32 UTC 2011 Modified Files: src/games/hack: Makefile Log Message: -Wno-shadow is no longer needed for HAVE_PCC, here To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/games/hack/Makefile 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/Makefile diff -u src/games/hack/Makefile:1.44 src/games/hack/Makefile:1.45 --- src/games/hack/Makefile:1.44 Tue Aug 16 09:26:22 2011 +++ src/games/hack/Makefile Wed Aug 24 17:39:32 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.44 2011/08/16 09:26:22 christos Exp $ +# $NetBSD: Makefile,v 1.45 2011/08/24 17:39:32 plunky Exp $ # @(#)Makefile 8.2 (Berkeley) 4/27/95 .include bsd.own.mk @@ -37,10 +37,6 @@ hack.h: hack.onames.h -.if defined(HAVE_PCC) -COPTS.hack.bones.c+= -Wno-shadow -COPTS.hack.do.c+= -Wno-shadow -.endif COPTS.hack.mon.c+= -Wno-format-nonliteral COPTS.hack.rip.c+= -Wno-format-nonliteral
CVS commit: src/games/hack
Module Name:src Committed By: christos Date: Tue Aug 16 09:26:22 UTC 2011 Modified Files: src/games/hack: Makefile def.monst.h hack.monst.c hack.vault.c Log Message: - document non-literal format strings - avoid strict aliasing violations, but adding an intermediate function. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/games/hack/Makefile cvs rdiff -u -r1.8 -r1.9 src/games/hack/def.monst.h \ src/games/hack/hack.vault.c cvs rdiff -u -r1.6 -r1.7 src/games/hack/hack.monst.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/Makefile diff -u src/games/hack/Makefile:1.43 src/games/hack/Makefile:1.44 --- src/games/hack/Makefile:1.43 Tue Jun 21 22:49:43 2011 +++ src/games/hack/Makefile Tue Aug 16 05:26:22 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2011/06/22 02:49:43 mrg Exp $ +# $NetBSD: Makefile,v 1.44 2011/08/16 09:26:22 christos Exp $ # @(#)Makefile 8.2 (Berkeley) 4/27/95 .include bsd.own.mk @@ -41,6 +41,8 @@ COPTS.hack.bones.c+= -Wno-shadow COPTS.hack.do.c+= -Wno-shadow .endif +COPTS.hack.mon.c+= -Wno-format-nonliteral +COPTS.hack.rip.c+= -Wno-format-nonliteral .if !exists(${DESTDIR}${FILESDIR}/perm) afterinstall: clobber @@ -57,8 +59,3 @@ rm -f ${DESTDIR}/var/games/hackdir/bones* .include bsd.prog.mk - -# XXX -.if ${HAVE_GCC} == 45 -COPTS.hack.vault.c+= -fno-strict-aliasing -.endif Index: src/games/hack/def.monst.h diff -u src/games/hack/def.monst.h:1.8 src/games/hack/def.monst.h:1.9 --- src/games/hack/def.monst.h:1.8 Sat Aug 6 16:18:26 2011 +++ src/games/hack/def.monst.h Tue Aug 16 05:26:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: def.monst.h,v 1.8 2011/08/06 20:18:26 dholland Exp $ */ +/* $NetBSD: def.monst.h,v 1.9 2011/08/16 09:26:22 christos Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -112,6 +112,8 @@ extern struct monst *fmon; extern struct monst *fallen_down; +extern void *monster_private(struct monst *); + /* these are in mspeed */ #define MSLOW 1 /* slow monster */ #define MFAST 2 /* speeded monster */ Index: src/games/hack/hack.vault.c diff -u src/games/hack/hack.vault.c:1.8 src/games/hack/hack.vault.c:1.9 --- src/games/hack/hack.vault.c:1.8 Sun Jun 7 14:30:39 2009 +++ src/games/hack/hack.vault.c Tue Aug 16 05:26:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.vault.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.vault.c,v 1.9 2011/08/16 09:26:22 christos Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.vault.c,v 1.8 2009/06/07 18:30:39 dholland Exp $); +__RCSID($NetBSD: hack.vault.c,v 1.9 2011/08/16 09:26:22 christos Exp $); #endif/* not lint */ #include hack.h @@ -116,7 +116,6 @@ static struct monst *guard; static int gdlevel; -#define EGD ((struct egd *)((guard-mextra[0]))) static void restfakecorr(void); static int goldincorridor(void); @@ -126,19 +125,20 @@ { int fcx, fcy, fcbeg; struct rm *crm; + struct egd *egd = monster_private(guard); - while ((fcbeg = EGD-fcbeg) EGD-fcend) { - fcx = EGD-fakecorr[fcbeg].fx; - fcy = EGD-fakecorr[fcbeg].fy; + while ((fcbeg = egd-fcbeg) egd-fcend) { + fcx = egd-fakecorr[fcbeg].fx; + fcy = egd-fakecorr[fcbeg].fy; if ((u.ux == fcx u.uy == fcy) || cansee(fcx, fcy) || m_at(fcx, fcy)) return; crm = levl[fcx][fcy]; - crm-typ = EGD-fakecorr[fcbeg].ftyp; + crm-typ = egd-fakecorr[fcbeg].ftyp; if (!crm-typ) crm-seen = 0; newsym(fcx, fcy); - EGD-fcbeg++; + egd-fcbeg++; } /* it seems he left the corridor - let the guard disappear */ mondead(guard); @@ -149,9 +149,10 @@ goldincorridor(void) { int fci; + struct egd *egd = monster_private(guard); - for (fci = EGD-fcbeg; fci EGD-fcend; fci++) - if (g_at(EGD-fakecorr[fci].fx, EGD-fakecorr[fci].fy)) + for (fci = egd-fcbeg; fci egd-fcend; fci++) + if (g_at(egd-fakecorr[fci].fx, egd-fakecorr[fci].fy)) return (1); return (0); } @@ -173,6 +174,7 @@ invault(void) { int tmp = inroom(u.ux, u.uy); + struct egd *egd; if (tmp 0 || rooms[tmp].rtype != VAULT) { u.uinvault = 0; return; @@ -221,7 +223,8 @@ if (!(guard = makemon(pm_guard, x, y))) return; guard-isgd = guard-mpeaceful = 1; - EGD-gddone = 0; + egd = monster_private(guard); + egd-gddone = 0; gdlevel = dlevel; if (!cansee(guard-mx, guard-my)) { mondead(guard); @@ -249,14 +252,14 @@ pline(\Most likely all that gold was stolen from this vault.\); pline(\Please drop your gold (say d$ ) and follow me.\); } - EGD-gdx = gx; - EGD-gdy = gy; - EGD-fcbeg = 0; - EGD-fakecorr[0].fx = x; - EGD-fakecorr[0].fy = y; - EGD-fakecorr[0].ftyp = levl[x][y].typ; + egd-gdx = gx; + egd-gdy = gy; + egd-fcbeg = 0; + egd-fakecorr[0].fx = x; + egd-fakecorr[0].fy = y; + egd-fakecorr[0].ftyp =
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sun Aug 7 06:03:45 UTC 2011 Modified Files: src/games/hack: hack.apply.c hack.c hack.do_name.c hack.dog.c hack.eat.c hack.engrave.c hack.invent.c hack.mkobj.c hack.mkshop.c hack.mon.c hack.objnam.c hack.shk.c hack.trap.c hack.wizard.c Log Message: Fix up some lint. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.apply.c \ src/games/hack/hack.do_name.c src/games/hack/hack.shk.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.c src/games/hack/hack.mkshop.c \ src/games/hack/hack.objnam.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.dog.c \ src/games/hack/hack.eat.c cvs rdiff -u -r1.13 -r1.14 src/games/hack/hack.engrave.c \ src/games/hack/hack.mon.c cvs rdiff -u -r1.17 -r1.18 src/games/hack/hack.invent.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.mkobj.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.trap.c \ src/games/hack/hack.wizard.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.12 src/games/hack/hack.apply.c:1.13 --- src/games/hack/hack.apply.c:1.12 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.apply.c Sun Aug 7 06:03:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.apply.c,v 1.12 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.apply.c,v 1.13 2011/08/07 06:03:45 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.12 2011/08/06 20:42:43 dholland Exp $); +__RCSID($NetBSD: hack.apply.c,v 1.13 2011/08/07 06:03:45 dholland Exp $); #endif/* not lint */ #include hack.h @@ -108,7 +108,7 @@ use_magic_whistle(obj); break; } - /* fall into next case */ + /* FALLTHROUGH */ case WHISTLE: use_whistle(obj); break; Index: src/games/hack/hack.do_name.c diff -u src/games/hack/hack.do_name.c:1.12 src/games/hack/hack.do_name.c:1.13 --- src/games/hack/hack.do_name.c:1.12 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.do_name.c Sun Aug 7 06:03:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.13 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $); +__RCSID($NetBSD: hack.do_name.c,v 1.13 2011/08/07 06:03:45 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -119,7 +119,8 @@ { charbuf[BUFSZ]; coord cc; - int cx, cy, lth; + int cx, cy; + size_t lth; unsignedi; struct monst *mtmp, *mtmp2; cc = getpos(0, the monster you want to name); @@ -173,7 +174,7 @@ do_oname(struct obj *obj) { struct obj *otmp, *otmp2; - int lth; + size_t lth; charbuf[BUFSZ]; pline(What do you want to name %s? , doname(obj)); getlin(buf); @@ -295,7 +296,7 @@ (void) strlcpy(buf, shkname(mtmp), sizeof(buf)); break; } - /* fall into next case */ + /* FALLTHROUGH */ default: (void) snprintf(buf, sizeof(buf), the %s%s, mtmp-minvis ? invisible : , Index: src/games/hack/hack.shk.c diff -u src/games/hack/hack.shk.c:1.12 src/games/hack/hack.shk.c:1.13 --- src/games/hack/hack.shk.c:1.12 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.shk.c Sun Aug 7 06:03:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.shk.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.shk.c,v 1.13 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.shk.c,v 1.12 2011/08/06 20:29:37 dholland Exp $); +__RCSID($NetBSD: hack.shk.c,v 1.13 2011/08/07 06:03:45 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -890,6 +890,7 @@ break; case CHAIN_SYM: pline(Strange ..., carrying a chain?); + /* FALLTHROUGH */ case BALL_SYM: tmp = 10; break; Index: src/games/hack/hack.c diff -u src/games/hack/hack.c:1.10 src/games/hack/hack.c:1.11 --- src/games/hack/hack.c:1.10 Wed Feb 3 15:34:38 2010 +++ src/games/hack/hack.c Sun Aug 7 06:03:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.c,v 1.10 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: hack.c,v 1.11 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.c,v 1.10 2010/02/03 15:34:38 roy Exp $); +__RCSID($NetBSD: hack.c,v 1.11 2011/08/07 06:03:45 dholland Exp $); #endif/* not lint */ #include hack.h @@ -600,7 +600,7 @@ break; if (flags.run != 1)
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 19:23:38 UTC 2011 Modified Files: src/games/hack: def.objclass.h Log Message: Don't refer to index() in comments; use strchr(). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/games/hack/def.objclass.h 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/def.objclass.h diff -u src/games/hack/def.objclass.h:1.6 src/games/hack/def.objclass.h:1.7 --- src/games/hack/def.objclass.h:1.6 Wed Apr 2 18:36:34 2003 +++ src/games/hack/def.objclass.h Sat Aug 6 19:23:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: def.objclass.h,v 1.6 2003/04/02 18:36:34 jsm Exp $ */ +/* $NetBSD: def.objclass.h,v 1.7 2011/08/06 19:23:38 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -117,7 +117,7 @@ * hack.mkobj.c: char mkobjstr[] = ))[[/=**; * hack.apply.c: otmp = getobj(0#%, put in); * hack.eat.c: otmp = getobj(%, eat); - * hack.invent.c: if(index(!%?[)=*(0/\, sym)){ - * hack.invent.c:|| index(%?!*,otmp-olet))){ + * hack.invent.c: if(strchr(!%?[)=*(0/\, sym)){ + * hack.invent.c:|| strchr(%?!*,otmp-olet))){ */ #endif /* _DEF_OBJCLASS_H_ */
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 19:32:59 UTC 2011 Modified Files: src/games/hack: config.h hack.u_init.c Log Message: Remove the PYRAMID_BUG code. I don't think Pyramids are coming back, nor do we care if their compiler vomits trying to decrement a bitfield. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/hack/config.h cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.u_init.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/config.h diff -u src/games/hack/config.h:1.7 src/games/hack/config.h:1.8 --- src/games/hack/config.h:1.7 Wed Apr 2 18:36:33 2003 +++ src/games/hack/config.h Sat Aug 6 19:32:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.7 2003/04/02 18:36:33 jsm Exp $ */ +/* $NetBSD: config.h,v 1.8 2011/08/06 19:32:58 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -85,7 +85,6 @@ /* #define STUPID */ /* avoid some complicated expressions if your C compiler chokes on them */ -/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ /* #define NOWAITINCLUDE */ /* neither wait.h nor sys/wait.h exists */ #define WIZARD bruno /* the person allowed to use the -D option */ Index: src/games/hack/hack.u_init.c diff -u src/games/hack/hack.u_init.c:1.12 src/games/hack/hack.u_init.c:1.13 --- src/games/hack/hack.u_init.c:1.12 Wed Feb 3 15:34:39 2010 +++ src/games/hack/hack.u_init.c Sat Aug 6 19:32:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.u_init.c,v 1.12 2010/02/03 15:34:39 roy Exp $ */ +/* $NetBSD: hack.u_init.c,v 1.13 2011/08/06 19:32:58 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.u_init.c,v 1.12 2010/02/03 15:34:39 roy Exp $); +__RCSID($NetBSD: hack.u_init.c,v 1.13 2011/08/06 19:32:58 dholland Exp $); #endif/* not lint */ #include ctype.h @@ -377,16 +377,8 @@ if (obj-olet == WEAPON_SYM) if (!uwep) setuwep(obj); -#ifndef PYRAMID_BUG if (--trop-trquan) continue; /* make a similar object */ -#else - if (trop-trquan) { /* check if zero first */ - --trop-trquan; - if (trop-trquan) -continue; /* make a similar object */ - } -#endif /* PYRAMID_BUG */ trop++; } }
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 19:47:54 UTC 2011 Modified Files: src/games/hack: config.h hack.h Log Message: abolish references to index/rindex To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/hack/config.h cvs rdiff -u -r1.14 -r1.15 src/games/hack/hack.h 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/config.h diff -u src/games/hack/config.h:1.8 src/games/hack/config.h:1.9 --- src/games/hack/config.h:1.8 Sat Aug 6 19:32:58 2011 +++ src/games/hack/config.h Sat Aug 6 19:47:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.8 2011/08/06 19:32:58 dholland Exp $ */ +/* $NetBSD: config.h,v 1.9 2011/08/06 19:47:54 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -75,9 +75,7 @@ * sys/wait.h wait.h * sys/time.h time.h * sgtty.h termio.h - * Some routines are called differently - * index strchr - * rindex strrchr + * * Also, the code for suspend and various ioctls is only given for BSD4.2 * (I do not have access to a SYSV system.) */ Index: src/games/hack/hack.h diff -u src/games/hack/hack.h:1.14 src/games/hack/hack.h:1.15 --- src/games/hack/hack.h:1.14 Sat Jul 2 02:10:33 2011 +++ src/games/hack/hack.h Sat Aug 6 19:47:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.h,v 1.14 2011/07/02 02:10:33 mrg Exp $ */ +/* $NetBSD: hack.h,v 1.15 2011/08/06 19:47:54 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -69,11 +69,6 @@ #include string.h #include sys/time.h -#ifndef BSD -#define index strchr -#define rindex strrchr -#endif /* BSD */ - #define Null(type) ((struct type *) 0) #include def.objclass.h
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 19:53:24 UTC 2011 Modified Files: src/games/hack: config.h hack.pager.c Log Message: sys/wait.h is standard, so just use it instead of fiddling about with ifdefs for long-dead systems. While here, remove union wait. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/games/hack/config.h cvs rdiff -u -r1.15 -r1.16 src/games/hack/hack.pager.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/config.h diff -u src/games/hack/config.h:1.9 src/games/hack/config.h:1.10 --- src/games/hack/config.h:1.9 Sat Aug 6 19:47:54 2011 +++ src/games/hack/config.h Sat Aug 6 19:53:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.9 2011/08/06 19:47:54 dholland Exp $ */ +/* $NetBSD: config.h,v 1.10 2011/08/06 19:53:24 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -83,7 +83,6 @@ /* #define STUPID */ /* avoid some complicated expressions if your C compiler chokes on them */ -/* #define NOWAITINCLUDE */ /* neither wait.h nor sys/wait.h exists */ #define WIZARD bruno /* the person allowed to use the -D option */ #define RECORD record/* the file containing the list of topscorers */ Index: src/games/hack/hack.pager.c diff -u src/games/hack/hack.pager.c:1.15 src/games/hack/hack.pager.c:1.16 --- src/games/hack/hack.pager.c:1.15 Mon May 23 22:53:25 2011 +++ src/games/hack/hack.pager.c Sat Aug 6 19:53:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pager.c,v 1.15 2011/05/23 22:53:25 joerg Exp $ */ +/* $NetBSD: hack.pager.c,v 1.16 2011/08/06 19:53:24 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.15 2011/05/23 22:53:25 joerg Exp $); +__RCSID($NetBSD: hack.pager.c,v 1.16 2011/08/06 19:53:24 dholland Exp $); #endif/* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -73,6 +73,7 @@ */ #include sys/types.h +#include sys/wait.h #include signal.h #include stdlib.h #include unistd.h @@ -438,25 +439,6 @@ } #endif /* SHELL */ -#ifdef NOWAITINCLUDE -union wait { /* used only for the cast (union wait *) 0 */ - int w_status; - struct { - unsigned short w_Termsig:7; - unsigned short w_Coredump:1; - unsigned short w_Retcode:8; - } w_T; -}; - -#else - -#ifdef BSD -#include sys/wait.h -#else -#include wait.h -#endif /* BSD */ -#endif /* NOWAITINCLUDE */ - static int child(int wt) {
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 20:00:33 UTC 2011 Modified Files: src/games/hack: extern.h hack.engrave.c hack.lev.c hack.o_init.c hack.save.c Log Message: Remove silly casts. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/games/hack/extern.h src/games/hack/hack.save.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.engrave.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.lev.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.o_init.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/extern.h diff -u src/games/hack/extern.h:1.14 src/games/hack/extern.h:1.15 --- src/games/hack/extern.h:1.14 Mon May 30 03:11:15 2011 +++ src/games/hack/extern.h Sat Aug 6 20:00:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.14 2011/05/30 03:11:15 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.15 2011/08/06 20:00:33 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -202,7 +202,7 @@ void saveobjchn(int, struct obj *); void savemonchn(int, struct monst *); void getlev(int, int, xchar); -void mread(int, char *, unsigned); +void mread(int, void *, size_t); void mklev(void); /* hack.main.c */ Index: src/games/hack/hack.save.c diff -u src/games/hack/hack.save.c:1.14 src/games/hack/hack.save.c:1.15 --- src/games/hack/hack.save.c:1.14 Wed Feb 3 15:34:38 2010 +++ src/games/hack/hack.save.c Sat Aug 6 20:00:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.save.c,v 1.14 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: hack.save.c,v 1.15 2011/08/06 20:00:33 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.14 2010/02/03 15:34:38 roy Exp $); +__RCSID($NetBSD: hack.save.c,v 1.15 2011/08/06 20:00:33 dholland Exp $); #endif/* not lint */ #include signal.h @@ -172,7 +172,7 @@ setworn(otmp, otmp-owornmask); fcobj = restobjchn(fd); fallen_down = restmonchn(fd); - mread(fd, (char *) tmp, sizeof tmp); + mread(fd, tmp, sizeof tmp); if (tmp != (int) getuid()) { /* strange ... */ (void) close(fd); (void) unlink(SAVEF); @@ -180,16 +180,16 @@ restoring = FALSE; return (0); } - mread(fd, (char *) flags, sizeof(struct flag)); - mread(fd, (char *) dlevel, sizeof dlevel); - mread(fd, (char *) maxdlevel, sizeof maxdlevel); - mread(fd, (char *) moves, sizeof moves); - mread(fd, (char *) u, sizeof(struct you)); + mread(fd, flags, sizeof(struct flag)); + mread(fd, dlevel, sizeof dlevel); + mread(fd, maxdlevel, sizeof maxdlevel); + mread(fd, moves, sizeof moves); + mread(fd, u, sizeof(struct you)); if (u.ustuck) - mread(fd, (char *) mid, sizeof mid); - mread(fd, (char *) pl_character, sizeof pl_character); - mread(fd, (char *) genocided, sizeof genocided); - mread(fd, (char *) fut_geno, sizeof fut_geno); + mread(fd, mid, sizeof mid); + mread(fd, pl_character, sizeof pl_character); + mread(fd, genocided, sizeof genocided); + mread(fd, fut_geno, sizeof fut_geno); restnames(fd); while (1) { if (read(fd, (char *) tmp, sizeof tmp) != sizeof tmp) @@ -247,7 +247,7 @@ struct obj *first = 0; int xl; while (1) { - mread(fd, (char *) xl, sizeof(xl)); + mread(fd, xl, sizeof(xl)); if (xl == -1) break; otmp = newobj(xl); @@ -255,7 +255,7 @@ first = otmp; else otmp2-nobj = otmp; - mread(fd, (char *) otmp, (unsigned) xl + sizeof(struct obj)); + mread(fd, otmp, (unsigned) xl + sizeof(struct obj)); if (!otmp-o_id) otmp-o_id = flags.ident++; otmp2 = otmp; @@ -277,7 +277,7 @@ struct permonst *monbegin; longdiffer; - mread(fd, (char *) monbegin, sizeof(monbegin)); + mread(fd, monbegin, sizeof(monbegin)); differ = (const char *) (mons[0]) - (const char *) (monbegin); #ifdef lint @@ -285,7 +285,7 @@ mtmp2 = 0; #endif /* lint */ while (1) { - mread(fd, (char *) xl, sizeof(xl)); + mread(fd, xl, sizeof(xl)); if (xl == -1) break; mtmp = newmonst(xl); @@ -293,7 +293,7 @@ first = mtmp; else mtmp2-nmon = mtmp; - mread(fd, (char *) mtmp, (unsigned) xl + sizeof(struct monst)); + mread(fd, mtmp, (unsigned) xl + sizeof(struct monst)); if (!mtmp-m_id) mtmp-m_id = flags.ident++; mtmp-data = (const struct permonst *) Index: src/games/hack/hack.engrave.c diff -u src/games/hack/hack.engrave.c:1.9 src/games/hack/hack.engrave.c:1.10 --- src/games/hack/hack.engrave.c:1.9 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.engrave.c Sat Aug 6 20:00:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.engrave.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.engrave.c,v 1.10 2011/08/06 20:00:33 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.9 2009/08/12 07:28:40
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 20:18:26 UTC 2011 Modified Files: src/games/hack: alloc.c def.gen.h def.gold.h def.monst.h def.obj.h def.trap.h def.wseg.h extern.h hack.end.c hack.engrave.c hack.h hack.o_init.c hack.pager.c hack.rumors.c hack.topl.c Log Message: Use the right type for the malloc wrapper function, and don't cast the return value. (XXX: Except for a pile of allocation macros that produce typed pointer results; there the typechecking of the result assignment is more valuable than the warning if the alloc function isn't declared properly. These macros should go away.) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/hack/alloc.c src/games/hack/hack.rumors.c cvs rdiff -u -r1.5 -r1.6 src/games/hack/def.gen.h src/games/hack/def.gold.h \ src/games/hack/def.obj.h src/games/hack/def.trap.h \ src/games/hack/def.wseg.h cvs rdiff -u -r1.7 -r1.8 src/games/hack/def.monst.h cvs rdiff -u -r1.15 -r1.16 src/games/hack/extern.h src/games/hack/hack.h cvs rdiff -u -r1.14 -r1.15 src/games/hack/hack.end.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.engrave.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.o_init.c cvs rdiff -u -r1.16 -r1.17 src/games/hack/hack.pager.c cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.topl.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/alloc.c diff -u src/games/hack/alloc.c:1.8 src/games/hack/alloc.c:1.9 --- src/games/hack/alloc.c:1.8 Sun Jan 17 22:55:20 2010 +++ src/games/hack/alloc.c Sat Aug 6 20:18:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $ */ +/* $NetBSD: alloc.c,v 1.9 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,21 +63,22 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $); +__RCSID($NetBSD: alloc.c,v 1.9 2011/08/06 20:18:26 dholland Exp $); #endif/* not lint */ #include stdlib.h #include hack.h #include extern.h -long * -alloc(unsigned lth) +void * +alloc(size_t len) { - long *ptr; + void *ptr; - if (!(ptr = malloc(lth))) - panic(Cannot get %d bytes, lth); - return (ptr); + ptr = malloc(len); + if (ptr == NULL) + panic(Cannot get %zu bytes, len); + return ptr; } #if 0 /* unused */ Index: src/games/hack/hack.rumors.c diff -u src/games/hack/hack.rumors.c:1.8 src/games/hack/hack.rumors.c:1.9 --- src/games/hack/hack.rumors.c:1.8 Mon May 23 22:53:25 2011 +++ src/games/hack/hack.rumors.c Sat Aug 6 20:18:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.rumors.c,v 1.8 2011/05/23 22:53:25 joerg Exp $ */ +/* $NetBSD: hack.rumors.c,v 1.9 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.rumors.c,v 1.8 2011/05/23 22:53:25 joerg Exp $); +__RCSID($NetBSD: hack.rumors.c,v 1.9 2011/08/06 20:18:26 dholland Exp $); #endif/* not lint */ #include hack.h /* for RUMORFILE and BSD (strchr) */ @@ -88,7 +88,7 @@ n_rumors++; rewind(rumf); i = n_rumors / CHARSZ; - usedbits = (char *) alloc((unsigned) (i + 1)); + usedbits = alloc(i + 1); for (; i = 0; i--) usedbits[i] = 0; } Index: src/games/hack/def.gen.h diff -u src/games/hack/def.gen.h:1.5 src/games/hack/def.gen.h:1.6 --- src/games/hack/def.gen.h:1.5 Wed Apr 2 18:36:34 2003 +++ src/games/hack/def.gen.h Sat Aug 6 20:18:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: def.gen.h,v 1.5 2003/04/02 18:36:34 jsm Exp $ */ +/* $NetBSD: def.gen.h,v 1.6 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -73,5 +73,5 @@ #define ONCE 0100 }; extern struct gen *fgold, *ftrap; -#define newgen() (struct gen *) alloc(sizeof(struct gen)) +#define newgen() ((struct gen *) alloc(sizeof(struct gen))) #endif /* _DEF_GEN_H_ */ Index: src/games/hack/def.gold.h diff -u src/games/hack/def.gold.h:1.5 src/games/hack/def.gold.h:1.6 --- src/games/hack/def.gold.h:1.5 Wed Apr 2 18:36:34 2003 +++ src/games/hack/def.gold.h Sat Aug 6 20:18:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: def.gold.h,v 1.5 2003/04/02 18:36:34 jsm Exp $ */ +/* $NetBSD: def.gold.h,v 1.6 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -69,6 +69,6 @@ long amount; }; -#define newgold() (struct gold *) alloc(sizeof(struct gold)) +#define newgold() ((struct gold *) alloc(sizeof(struct gold))) extern struct gold *fgold; #endif /* _DEF_GOLD_H_ */ Index: src/games/hack/def.obj.h diff -u src/games/hack/def.obj.h:1.5 src/games/hack/def.obj.h:1.6 --- src/games/hack/def.obj.h:1.5 Wed Apr 2 18:36:34 2003 +++ src/games/hack/def.obj.h Sat Aug 6 20:18:26 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: def.obj.h,v 1.5 2003/04/02 18:36:34 jsm Exp $ */
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 20:24:35 UTC 2011 Modified Files: src/games/hack: hack.mon.c Log Message: drop private (and wrong) definition of NULL To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.mon.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.mon.c diff -u src/games/hack/hack.mon.c:1.11 src/games/hack/hack.mon.c:1.12 --- src/games/hack/hack.mon.c:1.11 Mon May 30 03:11:15 2011 +++ src/games/hack/hack.mon.c Sat Aug 6 20:24:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.11 2011/05/30 03:11:15 joerg Exp $ */ +/* $NetBSD: hack.mon.c,v 1.12 2011/08/06 20:24:35 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.mon.c,v 1.11 2011/05/30 03:11:15 joerg Exp $); +__RCSID($NetBSD: hack.mon.c,v 1.12 2011/08/06 20:24:35 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -71,10 +71,6 @@ #include extern.h #include hack.mfndpos.h -#ifndef NULL -#define NULL (char *) 0 -#endif - static int warnlevel; /* used by movemon and dochugw */ static long lastwarntime; static int lastwarnlev;
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 20:29:37 UTC 2011 Modified Files: src/games/hack: hack.do.c hack.do_name.c hack.end.c hack.engrave.c hack.invent.c hack.lev.c hack.mon.c hack.pager.c hack.read.c hack.shk.c hack.steal.c hack.topl.c hack.worm.c Log Message: Remove more silly casts. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.do.c \ src/games/hack/hack.read.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.do_name.c \ src/games/hack/hack.engrave.c src/games/hack/hack.shk.c cvs rdiff -u -r1.15 -r1.16 src/games/hack/hack.end.c \ src/games/hack/hack.invent.c cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.lev.c \ src/games/hack/hack.mon.c cvs rdiff -u -r1.17 -r1.18 src/games/hack/hack.pager.c cvs rdiff -u -r1.7 -r1.8 src/games/hack/hack.steal.c cvs rdiff -u -r1.13 -r1.14 src/games/hack/hack.topl.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.worm.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.do.c diff -u src/games/hack/hack.do.c:1.10 src/games/hack/hack.do.c:1.11 --- src/games/hack/hack.do.c:1.10 Wed Jul 20 07:04:30 2011 +++ src/games/hack/hack.do.c Sat Aug 6 20:29:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do.c,v 1.10 2011/07/20 07:04:30 dholland Exp $ */ +/* $NetBSD: hack.do.c,v 1.11 2011/08/06 20:29:37 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do.c,v 1.10 2011/07/20 07:04:30 dholland Exp $); +__RCSID($NetBSD: hack.do.c,v 1.11 2011/08/06 20:29:37 dholland Exp $); #endif/* not lint */ /* Contains code for 'd', 'D' (drop), '', '' (up, down) and 't' (throw) */ @@ -101,7 +101,7 @@ if (Invisible) newsym(u.ux, u.uy); } - free((char *) obj); + free(obj); return (1); } if (obj-owornmask (W_ARMOR | W_RING)) { Index: src/games/hack/hack.read.c diff -u src/games/hack/hack.read.c:1.10 src/games/hack/hack.read.c:1.11 --- src/games/hack/hack.read.c:1.10 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.read.c Sat Aug 6 20:29:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.read.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.read.c,v 1.11 2011/08/06 20:29:37 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.read.c,v 1.10 2009/08/12 07:28:41 dholland Exp $); +__RCSID($NetBSD: hack.read.c,v 1.11 2011/08/06 20:29:37 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -203,7 +203,7 @@ Punished = 0; freeobj(uchain); unpobj(uchain); -free((char *) uchain); +free(uchain); uball-spe = 0; uball-owornmask = ~W_BALL; uchain = uball = (struct obj *) 0; Index: src/games/hack/hack.do_name.c diff -u src/games/hack/hack.do_name.c:1.11 src/games/hack/hack.do_name.c:1.12 --- src/games/hack/hack.do_name.c:1.11 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.do_name.c Sat Aug 6 20:29:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.11 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do_name.c,v 1.11 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -211,7 +211,7 @@ #if 0 obfree(obj, otmp2); /* now unnecessary: no pointers on bill */ #endif - free((char *) obj); /* let us hope nobody else saved a pointer */ + free(obj); /* let us hope nobody else saved a pointer */ } int Index: src/games/hack/hack.engrave.c diff -u src/games/hack/hack.engrave.c:1.11 src/games/hack/hack.engrave.c:1.12 --- src/games/hack/hack.engrave.c:1.11 Sat Aug 6 20:18:26 2011 +++ src/games/hack/hack.engrave.c Sat Aug 6 20:29:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.engrave.c,v 1.11 2011/08/06 20:18:26 dholland Exp $ */ +/* $NetBSD: hack.engrave.c,v 1.12 2011/08/06 20:29:37 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.11 2011/08/06 20:18:26 dholland Exp $); +__RCSID($NetBSD: hack.engrave.c,v 1.12 2011/08/06 20:29:37 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -392,5 +392,5 @@ return; fnd: ; } - free((char *) ep); + free(ep); } Index: src/games/hack/hack.shk.c diff -u src/games/hack/hack.shk.c:1.11 src/games/hack/hack.shk.c:1.12 --- src/games/hack/hack.shk.c:1.11 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.shk.c Sat Aug 6 20:29:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD:
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sat Aug 6 20:32:25 UTC 2011 Modified Files: src/games/hack: hack.lev.c hack.o_init.c Log Message: Remove *another* set of useless casts. sheesh To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/games/hack/hack.lev.c cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.o_init.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.lev.c diff -u src/games/hack/hack.lev.c:1.13 src/games/hack/hack.lev.c:1.14 --- src/games/hack/hack.lev.c:1.13 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.lev.c Sat Aug 6 20:32:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.lev.c,v 1.13 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.lev.c,v 1.14 2011/08/06 20:32:25 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.lev.c,v 1.13 2011/08/06 20:29:37 dholland Exp $); +__RCSID($NetBSD: hack.lev.c,v 1.14 2011/08/06 20:32:25 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -94,14 +94,14 @@ if (lev = 0 lev = MAXLEVEL) level_exists[lev] = TRUE; - bwrite(fd, (char *) hackpid, sizeof(hackpid)); - bwrite(fd, (char *) lev, sizeof(lev)); - bwrite(fd, (char *) levl, sizeof(levl)); - bwrite(fd, (char *) moves, sizeof(long)); - bwrite(fd, (char *) xupstair, sizeof(xupstair)); - bwrite(fd, (char *) yupstair, sizeof(yupstair)); - bwrite(fd, (char *) xdnstair, sizeof(xdnstair)); - bwrite(fd, (char *) ydnstair, sizeof(ydnstair)); + bwrite(fd, hackpid, sizeof(hackpid)); + bwrite(fd, lev, sizeof(lev)); + bwrite(fd, levl, sizeof(levl)); + bwrite(fd, moves, sizeof(long)); + bwrite(fd, xupstair, sizeof(xupstair)); + bwrite(fd, yupstair, sizeof(yupstair)); + bwrite(fd, xdnstair, sizeof(xdnstair)); + bwrite(fd, ydnstair, sizeof(ydnstair)); savemonchn(fd, fmon); savegoldchn(fd, fgold); savetrapchn(fd, ftrap); @@ -110,23 +110,23 @@ billobjs = 0; save_engravings(fd); #ifndef QUEST - bwrite(fd, (char *) rooms, sizeof(rooms)); - bwrite(fd, (char *) doors, sizeof(doors)); + bwrite(fd, rooms, sizeof(rooms)); + bwrite(fd, doors, sizeof(doors)); #endif /* QUEST */ fgold = 0; ftrap = 0; fmon = 0; fobj = 0; #ifndef NOWORM - bwrite(fd, (char *) wsegs, sizeof(wsegs)); + bwrite(fd, wsegs, sizeof(wsegs)); for (tmp = 1; tmp 32; tmp++) { for (wtmp = wsegs[tmp]; wtmp; wtmp = wtmp2) { wtmp2 = wtmp-nseg; - bwrite(fd, (char *) wtmp, sizeof(struct wseg)); + bwrite(fd, wtmp, sizeof(struct wseg)); } wsegs[tmp] = 0; } - bwrite(fd, (char *) wgrowtime, sizeof(wgrowtime)); + bwrite(fd, wgrowtime, sizeof(wgrowtime)); #endif /* NOWORM */ } @@ -148,12 +148,12 @@ while (otmp) { otmp2 = otmp-nobj; xl = otmp-onamelth; - bwrite(fd, (char *) xl, sizeof(int)); - bwrite(fd, (char *) otmp, xl + sizeof(struct obj)); + bwrite(fd, xl, sizeof(int)); + bwrite(fd, otmp, xl + sizeof(struct obj)); free(otmp); otmp = otmp2; } - bwrite(fd, (char *) minusone, sizeof(int)); + bwrite(fd, minusone, sizeof(int)); } void @@ -169,14 +169,14 @@ while (mtmp) { mtmp2 = mtmp-nmon; xl = mtmp-mxlth + mtmp-mnamelth; - bwrite(fd, (char *) xl, sizeof(int)); - bwrite(fd, (char *) mtmp, xl + sizeof(struct monst)); + bwrite(fd, xl, sizeof(int)); + bwrite(fd, mtmp, xl + sizeof(struct monst)); if (mtmp-minvent) saveobjchn(fd, mtmp-minvent); free(mtmp); mtmp = mtmp2; } - bwrite(fd, (char *) minusone, sizeof(int)); + bwrite(fd, minusone, sizeof(int)); } static void @@ -185,7 +185,7 @@ struct gold*gold2; while (gold) { gold2 = gold-ngold; - bwrite(fd, (char *) gold, sizeof(struct gold)); + bwrite(fd, gold, sizeof(struct gold)); free(gold); gold = gold2; } @@ -198,7 +198,7 @@ struct trap*trap2; while (trap) { trap2 = trap-ntrap; - bwrite(fd, (char *) trap, sizeof(struct trap)); + bwrite(fd, trap, sizeof(struct trap)); free(trap); trap = trap2; } Index: src/games/hack/hack.o_init.c diff -u src/games/hack/hack.o_init.c:1.12 src/games/hack/hack.o_init.c:1.13 --- src/games/hack/hack.o_init.c:1.12 Sat Aug 6 20:18:26 2011 +++ src/games/hack/hack.o_init.c Sat Aug 6 20:32:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.o_init.c,v 1.12 2011/08/06 20:18:26 dholland Exp $ */ +/* $NetBSD: hack.o_init.c,v 1.13 2011/08/06 20:32:25 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.12 2011/08/06 20:18:26 dholland Exp $); +__RCSID($NetBSD: hack.o_init.c,v 1.13 2011/08/06 20:32:25 dholland Exp $); #endif/* not lint */ #include string.h @@ -181,8 +181,8 @@ { int i; size_t len; - bwrite(fd, (char *) bases, sizeof bases); - bwrite(fd, (char *) objects, sizeof objects); + bwrite(fd, bases, sizeof
CVS commit: src/games/hack
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 $);
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Wed Jul 20 07:04:30 UTC 2011 Modified Files: src/games/hack: hack.bones.c hack.do.c Log Message: Include system headers before private headers. Avoids various possible symbol conflicts. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.bones.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.do.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.bones.c diff -u src/games/hack/hack.bones.c:1.8 src/games/hack/hack.bones.c:1.9 --- src/games/hack/hack.bones.c:1.8 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.bones.c Wed Jul 20 07:04:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.bones.c,v 1.8 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.bones.c,v 1.9 2011/07/20 07:04:30 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,13 +63,13 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.bones.c,v 1.8 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: hack.bones.c,v 1.9 2011/07/20 07:04:30 dholland Exp $); #endif/* not lint */ -#include hack.h -#include extern.h #include fcntl.h #include unistd.h +#include hack.h +#include extern.h static char bones[] = bones_xx; Index: src/games/hack/hack.do.c diff -u src/games/hack/hack.do.c:1.9 src/games/hack/hack.do.c:1.10 --- src/games/hack/hack.do.c:1.9 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.do.c Wed Jul 20 07:04:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.do.c,v 1.10 2011/07/20 07:04:30 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,16 +63,16 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do.c,v 1.9 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: hack.do.c,v 1.10 2011/07/20 07:04:30 dholland Exp $); #endif/* not lint */ /* Contains code for 'd', 'D' (drop), '', '' (up, down) and 't' (throw) */ -#include hack.h -#include extern.h #include fcntl.h #include unistd.h #include stdlib.h +#include hack.h +#include extern.h static int drop(struct obj *);
CVS commit: src/games/hack
Module Name:src Committed By: joerg Date: Mon May 30 03:11:15 UTC 2011 Modified Files: src/games/hack: extern.h hack.mon.c Log Message: Use consistent sign in compare, the function is only called with constants as third argument anyway. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/games/hack/extern.h cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.mon.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/extern.h diff -u src/games/hack/extern.h:1.13 src/games/hack/extern.h:1.14 --- src/games/hack/extern.h:1.13 Wed Feb 3 15:34:38 2010 +++ src/games/hack/extern.h Mon May 30 03:11:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.13 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: extern.h,v 1.14 2011/05/30 03:11:15 joerg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -249,7 +249,7 @@ /* hack.mon.c */ void movemon(void); void justswld(struct monst *, const char *); -void youswld(struct monst *, int, int, const char *); +void youswld(struct monst *, int, unsigned int, const char *); int dochug(struct monst *); int m_move(struct monst *, int); int mfndpos(struct monst *, coord[9 ], int[9 ], int); Index: src/games/hack/hack.mon.c diff -u src/games/hack/hack.mon.c:1.10 src/games/hack/hack.mon.c:1.11 --- src/games/hack/hack.mon.c:1.10 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.mon.c Mon May 30 03:11:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.mon.c,v 1.11 2011/05/30 03:11:15 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.mon.c,v 1.10 2009/08/12 07:28:41 dholland Exp $); +__RCSID($NetBSD: hack.mon.c,v 1.11 2011/05/30 03:11:15 joerg Exp $); #endif/* not lint */ #include stdlib.h @@ -196,7 +196,7 @@ } void -youswld(struct monst *mtmp, int dam, int die, const char *name) +youswld(struct monst *mtmp, int dam, unsigned int die, const char *name) { if (mtmp != u.ustuck) return;
CVS commit: src/games/hack
Module Name:src Committed By: joerg Date: Mon May 23 22:53:25 UTC 2011 Modified Files: src/games/hack: hack.apply.c hack.eat.c hack.invent.c hack.main.c hack.options.c hack.pager.c hack.potion.c hack.rumors.c hack.timeout.c Log Message: Correctly print variables as strings, not as format string. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.apply.c \ src/games/hack/hack.options.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.eat.c cvs rdiff -u -r1.14 -r1.15 src/games/hack/hack.invent.c \ src/games/hack/hack.pager.c cvs rdiff -u -r1.15 -r1.16 src/games/hack/hack.main.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.potion.c \ src/games/hack/hack.timeout.c cvs rdiff -u -r1.7 -r1.8 src/games/hack/hack.rumors.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.10 src/games/hack/hack.apply.c:1.11 --- src/games/hack/hack.apply.c:1.10 Sun Jun 7 18:30:39 2009 +++ src/games/hack/hack.apply.c Mon May 23 22:53:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.apply.c,v 1.10 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg 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.10 2009/06/07 18:30:39 dholland Exp $); +__RCSID($NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg Exp $); #endif/* not lint */ #include hack.h @@ -383,7 +383,7 @@ digtxt = Now what exactly was it that you were digging in?; mnewsym(dpx, dpy); prl(dpx, dpy); - pline(digtxt); /* after mnewsym prl */ + pline(%s, digtxt); /* after mnewsym prl */ return (0); } else { if (IS_WALL(levl[dpx][dpy].typ)) { Index: src/games/hack/hack.options.c diff -u src/games/hack/hack.options.c:1.10 src/games/hack/hack.options.c:1.11 --- src/games/hack/hack.options.c:1.10 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.options.c Mon May 23 22:53:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.options.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.options.c,v 1.11 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.options.c,v 1.10 2009/08/12 07:28:41 dholland Exp $); +__RCSID($NetBSD: hack.options.c,v 1.11 2011/05/23 22:53:25 joerg Exp $); #endif/* not lint */ #include stdlib.h @@ -271,7 +271,7 @@ if (*--eop == ',') *eop = 0; } - pline(buf); + pline(%s, buf); } else parseoptions(buf, FALSE); Index: src/games/hack/hack.eat.c diff -u src/games/hack/hack.eat.c:1.9 src/games/hack/hack.eat.c:1.10 --- src/games/hack/hack.eat.c:1.9 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.eat.c Mon May 23 22:53:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.eat.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg 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.9 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg Exp $); #endif/* not lint */ #include hack.h @@ -138,7 +138,7 @@ useup(tin.tin); r = rn2(2 * TTSZ); if (r TTSZ) { - pline(tintxts[r].txt); + pline(%s, tintxts[r].txt); lesshungry(tintxts[r].nut); if (r == 1) { /* SALMON */ Glib = rnd(15); Index: src/games/hack/hack.invent.c diff -u src/games/hack/hack.invent.c:1.14 src/games/hack/hack.invent.c:1.15 --- src/games/hack/hack.invent.c:1.14 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.invent.c Mon May 23 22:53:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.14 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.invent.c,v 1.15 2011/05/23 22:53:25 joerg 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.14 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: hack.invent.c,v 1.15 2011/05/23 22:53:25 joerg Exp $); #endif/* not lint */ #include assert.h @@ -655,7 +655,7 @@ if (ckfn !(*ckfn) (otmp)) continue; if (!allflag) { - pline(xprname(otmp, ilet)); + pline(%s, xprname(otmp, ilet)); addtopl( [nyaq]? ); sym = readchar(); } else @@ -699,7 +699,7 @@ void prinv(struct obj *obj) { - pline(xprname(obj, obj_to_let(obj))); + pline(%s, xprname(obj, obj_to_let(obj))); } static char * Index: src/games/hack/hack.pager.c diff -u src/games/hack/hack.pager.c:1.14 src/games/hack/hack.pager.c:1.15 --- src/games/hack/hack.pager.c:1.14 Wed Feb 3 15:34:38 2010 +++ src/games/hack/hack.pager.c Mon May 23
CVS commit: src/games/hack
Module Name:src Committed By: wiz Date: Sun Jan 17 22:55:21 UTC 2010 Modified Files: src/games/hack: alloc.c Log Message: Simplify alloc() to avoid ifdef(LINT) workaround. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/hack/alloc.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/alloc.c diff -u src/games/hack/alloc.c:1.7 src/games/hack/alloc.c:1.8 --- src/games/hack/alloc.c:1.7 Wed Aug 12 07:28:40 2009 +++ src/games/hack/alloc.c Sun Jan 17 22:55:20 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,41 +63,21 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 dholland Exp $); +__RCSID($NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $); #endif/* not lint */ #include stdlib.h #include hack.h #include extern.h -#ifdef LINT - -/* - a ridiculous definition, suppressing - possible pointer alignment problem for (long *) malloc() - enlarg defined but never used - ftell defined (in stdio.h) but never used - from lint -*/ -long * -alloc(unsigned n) -{ - longdummy = ftell(stderr); - if (n) - dummy = 0; /* make sure arg is used */ - return (dummy); -} - -#else - long * alloc(unsigned lth) { - char *ptr; + long *ptr; if (!(ptr = malloc(lth))) panic(Cannot get %d bytes, lth); - return ((long *) ptr); + return (ptr); } #if 0 /* unused */ @@ -111,5 +91,3 @@ return ((long *) nptr); } #endif - -#endif /* LINT */
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Mon Jun 29 23:05:33 UTC 2009 Modified Files: src/games/hack: hack.do_name.c hack.h hack.invent.c hack.main.c hack.rip.c hack.topl.c hack.unix.c Log Message: Fix two serious string-handling bugs (one exploitable, one probably exploitable) and also add proper checking/paranoia in several other places. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.do_name.c cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.h src/games/hack/hack.invent.c \ src/games/hack/hack.main.c src/games/hack/hack.unix.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.rip.c \ src/games/hack/hack.topl.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.do_name.c diff -u src/games/hack/hack.do_name.c:1.9 src/games/hack/hack.do_name.c:1.10 --- src/games/hack/hack.do_name.c:1.9 Sun Jun 7 20:13:18 2009 +++ src/games/hack/hack.do_name.c Mon Jun 29 23:05:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.9 2009/06/07 20:13:18 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.10 2009/06/29 23:05:33 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do_name.c,v 1.9 2009/06/07 20:13:18 dholland Exp $); +__RCSID($NetBSD: hack.do_name.c,v 1.10 2009/06/29 23:05:33 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -279,7 +279,7 @@ gn = ghostnames[rn2(SIZE(ghostnames))]; if (!rn2(2)) (void) - strcpy((char *) mtmp-mextra, !rn2(5) ? plname : gn); + strlcpy((char *) mtmp-mextra, !rn2(5) ? plname : gn, mtmp-mxlth); } (void) snprintf(buf, sizeof(buf), %s's ghost, gn); } Index: src/games/hack/hack.h diff -u src/games/hack/hack.h:1.12 src/games/hack/hack.h:1.13 --- src/games/hack/hack.h:1.12 Sun Jun 7 21:04:54 2009 +++ src/games/hack/hack.h Mon Jun 29 23:05:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.h,v 1.12 2009/06/07 21:04:54 dholland Exp $ */ +/* $NetBSD: hack.h,v 1.13 2009/06/29 23:05:33 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -202,7 +202,7 @@ extern char SAVEF[]; extern char fut_geno[60]; /* idem */ extern char genocided[60]; /* defined in Decl.c */ -extern char lock[]; +extern char lock[PL_NSIZ + 4]; extern const char mlarge[]; extern char morc; extern const char nul[]; Index: src/games/hack/hack.invent.c diff -u src/games/hack/hack.invent.c:1.12 src/games/hack/hack.invent.c:1.13 --- src/games/hack/hack.invent.c:1.12 Sun Jun 7 20:13:18 2009 +++ src/games/hack/hack.invent.c Mon Jun 29 23:05:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.12 2009/06/07 20:13:18 dholland Exp $ */ +/* $NetBSD: hack.invent.c,v 1.13 2009/06/29 23:05:33 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,9 +63,10 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.invent.c,v 1.12 2009/06/07 20:13:18 dholland Exp $); +__RCSID($NetBSD: hack.invent.c,v 1.13 2009/06/29 23:05:33 dholland Exp $); #endif/* not lint */ +#include assert.h #include stdlib.h #include hack.h #include extern.h @@ -555,7 +556,7 @@ charbuf[BUFSZ]; char *ip; charsym; - int oletct = 0, iletct = 0; + unsignedoletct = 0, iletct = 0; boolean allflag = FALSE; charolets[20], ilets[20]; int (*ckfn)(struct obj *) = @@ -586,6 +587,7 @@ if (invent) ilets[iletct++] = 'a'; ilets[iletct] = 0; + assert(iletct sizeof(ilets)); } pline(What kinds of thing do you want to %s? [%s] , word, ilets); @@ -614,6 +616,7 @@ olets[oletct++] = sym; olets[oletct] = 0; } + assert(oletct sizeof(olets)); } else pline(You don't have any %c's., sym); } @@ -723,7 +726,7 @@ { struct obj *otmp; charilet; - int ct = 0; + unsignedct = 0; charany[BUFSZ]; morc = 0; /* just to be sure */ @@ -746,6 +749,7 @@ ilet = 'A'; } any[ct] = 0; + assert(ct sizeof(any)); cornline(2, any); } @@ -755,7 +759,7 @@ /* Changed to one type only, so he doesnt have to type cr */ charc, ilet; charstuff[BUFSZ]; - int stct; + unsignedstct; struct obj *otmp; boolean billx = inshop() doinvbill(0); boolean unpd = FALSE; @@ -781,6 +785,7 @@ if (billx) stuff[stct++] = 'x'; stuff[stct] = 0; + assert(stct sizeof(stuff)); if (stct 1) { pline(What type of object [%s] do you want an inventory of? , @@ -817,6 +822,8 @@ ilet = 'A'; } stuff[stct] = '\0'; + assert(stct sizeof(stuff)); + if (stct == 0) pline(You have no such objects.); else Index: src/games/hack/hack.main.c diff -u src/games/hack/hack.main.c:1.12
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sun Jun 7 20:13:18 UTC 2009 Modified Files: src/games/hack: extern.h hack.do_name.c hack.eat.c hack.end.c hack.fight.c hack.invent.c hack.main.c hack.objnam.c hack.options.c hack.pri.c hack.rip.c hack.shk.c hack.topl.c hack.unix.c Log Message: sprintf - snprintf, plus some use of strlcpy/strlcat where appropriate XXX: there's still one sprintf left which will take some hacking to expunge. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/games/hack/extern.h src/games/hack/hack.pri.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.do_name.c \ src/games/hack/hack.objnam.c src/games/hack/hack.options.c cvs rdiff -u -r1.7 -r1.8 src/games/hack/hack.eat.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.end.c \ src/games/hack/hack.invent.c src/games/hack/hack.main.c \ src/games/hack/hack.unix.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.fight.c \ src/games/hack/hack.rip.c src/games/hack/hack.shk.c \ src/games/hack/hack.topl.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/extern.h diff -u src/games/hack/extern.h:1.10 src/games/hack/extern.h:1.11 --- src/games/hack/extern.h:1.10 Wed May 6 02:59:12 2009 +++ src/games/hack/extern.h Sun Jun 7 20:13:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.10 2009/05/06 02:59:12 ginsbach Exp $ */ +/* $NetBSD: extern.h,v 1.11 2009/06/07 20:13:18 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -356,7 +356,7 @@ char *typename(int); char *xname(struct obj *); char *doname(struct obj *); -void setan(const char *, char *); +void setan(const char *, char *, size_t); char *aobjnam(struct obj *, const char *); char *Doname(struct obj *); struct obj *readobjnam(char *); Index: src/games/hack/hack.pri.c diff -u src/games/hack/hack.pri.c:1.10 src/games/hack/hack.pri.c:1.11 --- src/games/hack/hack.pri.c:1.10 Sun Jun 7 18:30:39 2009 +++ src/games/hack/hack.pri.c Sun Jun 7 20:13:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pri.c,v 1.10 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.pri.c,v 1.11 2009/06/07 20:13:18 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.pri.c,v 1.10 2009/06/07 18:30:39 dholland Exp $); +__RCSID($NetBSD: hack.pri.c,v 1.11 2009/06/07 20:13:18 dholland Exp $); #endif/* not lint */ #include hack.h @@ -712,33 +712,47 @@ { char *ob = oldbot, *nb = newbot; int i; + size_t pos; + if (flags.botlx) *ob = 0; flags.botl = flags.botlx = 0; #ifdef GOLD_ON_BOTL - (void) sprintf(newbot, + (void) snprintf(newbot, sizeof(newbot), Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Str , dlevel, u.ugold, u.uhp, u.uhpmax, u.uac); #else - (void) sprintf(newbot, + (void) snprintf(newbot, sizeof(newbot), Level %-2d Hp %3d(%d) Ac %-2d Str , dlevel, u.uhp, u.uhpmax, u.uac); #endif /* GOLD_ON_BOTL */ if (u.ustr 18) { if (u.ustr 117) - (void) strcat(newbot, 18/**); - else - (void) sprintf(eos(newbot), 18/%02d, u.ustr - 18); - } else - (void) sprintf(eos(newbot), %-2d , u.ustr); + (void) strlcat(newbot, 18/**, sizeof(newbot)); + else { + pos = strlen(newbot); + (void) snprintf(newbot+pos, sizeof(newbot)-pos, + 18/%02d, u.ustr - 18); + } + } else { + pos = strlen(newbot); + (void) snprintf(newbot+pos, sizeof(newbot)-pos, +%-2d , u.ustr); + } + pos = strlen(newbot); #ifdef EXP_ON_BOTL - (void) sprintf(eos(newbot), Exp %2d/%-5lu , u.ulevel, u.uexp); + (void) snprintf(newbot+pos, sizeof(newbot)-pos, + Exp %2d/%-5lu , u.ulevel, u.uexp); #else - (void) sprintf(eos(newbot),Exp %2u , u.ulevel); + (void) snprintf(newbot+pos, sizeof(newbot)-pos, + Exp %2u , u.ulevel); #endif /* EXP_ON_BOTL */ - (void) strcat(newbot, hu_stat[u.uhs]); - if (flags.time) - (void) sprintf(eos(newbot), %ld, moves); + (void) strlcat(newbot, hu_stat[u.uhs], sizeof(newbot)); + if (flags.time) { + pos = strlen(newbot); + (void) snprintf(newbot+pos, sizeof(newbot)-pos, + %ld, moves); + } if (strlen(newbot) = COLNO) { char *bp0, *bp1; bp0 = bp1 = newbot; Index: src/games/hack/hack.do_name.c diff -u src/games/hack/hack.do_name.c:1.8 src/games/hack/hack.do_name.c:1.9 --- src/games/hack/hack.do_name.c:1.8 Sun Jun 7 18:30:39 2009 +++ src/games/hack/hack.do_name.c Sun Jun 7 20:13:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.9 2009/06/07 20:13:18 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 dholland Exp $);
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sun Jun 7 20:30:49 UTC 2009 Modified Files: src/games/hack: hack.engrave.c Log Message: remove unnecessary casts To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/games/hack/hack.engrave.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.engrave.c diff -u src/games/hack/hack.engrave.c:1.7 src/games/hack/hack.engrave.c:1.8 --- src/games/hack/hack.engrave.c:1.7 Sun Jun 7 18:30:39 2009 +++ src/games/hack/hack.engrave.c Sun Jun 7 20:30:49 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.engrave.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.engrave.c,v 1.8 2009/06/07 20:30:49 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.7 2009/06/07 18:30:39 dholland Exp $); +__RCSID($NetBSD: hack.engrave.c,v 1.8 2009/06/07 20:30:49 dholland Exp $); #endif/* not lint */ #include stdlib.h @@ -345,11 +345,11 @@ ep = ep-nxt_engr; continue; } - bwrite(fd, (char *) (ep-engr_lth), sizeof(ep-engr_lth)); - bwrite(fd, (char *) ep, sizeof(struct engr) + ep-engr_lth); + bwrite(fd, (ep-engr_lth), sizeof(ep-engr_lth)); + bwrite(fd, ep, sizeof(struct engr) + ep-engr_lth); ep = ep-nxt_engr; } - bwrite(fd, (char *) nul, sizeof(unsigned)); + bwrite(fd, nul, sizeof(unsigned)); head_engr = 0; }
CVS commit: src/games/hack
Module Name:src Committed By: dholland Date: Sun Jun 7 20:31:10 UTC 2009 Modified Files: src/games/hack: hack.Decl.c hack.fight.c hack.h Log Message: sprinkle some more const To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/games/hack/hack.Decl.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.fight.c src/games/hack/hack.h 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.Decl.c diff -u src/games/hack/hack.Decl.c:1.6 src/games/hack/hack.Decl.c:1.7 --- src/games/hack/hack.Decl.c:1.6 Wed Apr 2 18:36:35 2003 +++ src/games/hack/hack.Decl.c Sun Jun 7 20:31:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.Decl.c,v 1.6 2003/04/02 18:36:35 jsm Exp $ */ +/* $NetBSD: hack.Decl.c,v 1.7 2009/06/07 20:31:10 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,11 +63,11 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.Decl.c,v 1.6 2003/04/02 18:36:35 jsm Exp $); +__RCSID($NetBSD: hack.Decl.c,v 1.7 2009/06/07 20:31:10 dholland Exp $); #endif/* not lint */ #include hack.h -charnul[40]; /* contains zeros */ +const char nul[40]; /* contains zeros */ charplname[PL_NSIZ];/* player name */ charlock[PL_NSIZ + 4] = 1lock; /* long enough for login name * .99 */ Index: src/games/hack/hack.fight.c diff -u src/games/hack/hack.fight.c:1.10 src/games/hack/hack.fight.c:1.11 --- src/games/hack/hack.fight.c:1.10 Sun Jun 7 20:13:18 2009 +++ src/games/hack/hack.fight.c Sun Jun 7 20:31:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.fight.c,v 1.10 2009/06/07 20:13:18 dholland Exp $ */ +/* $NetBSD: hack.fight.c,v 1.11 2009/06/07 20:31:10 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: hack.fight.c,v 1.10 2009/06/07 20:13:18 dholland Exp $); +__RCSID($NetBSD: hack.fight.c,v 1.11 2009/06/07 20:31:10 dholland Exp $); #endif/* not lint */ #include hack.h @@ -209,7 +209,7 @@ } } -charmlarge[] = bCDdegIlmnoPSsTUwY',; +const char mlarge[] = bCDdegIlmnoPSsTUwY',; /* return TRUE if mon still alive */ boolean Index: src/games/hack/hack.h diff -u src/games/hack/hack.h:1.10 src/games/hack/hack.h:1.11 --- src/games/hack/hack.h:1.10 Tue Jan 27 20:30:29 2004 +++ src/games/hack/hack.h Sun Jun 7 20:31:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.h,v 1.10 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: hack.h,v 1.11 2009/06/07 20:31:10 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -203,9 +203,9 @@ extern char fut_geno[60]; /* idem */ extern char genocided[60]; /* defined in Decl.c */ extern char lock[]; -extern char mlarge[]; +extern const char mlarge[]; extern char morc; -extern char nul[]; +extern const char nul[]; extern char plname[PL_NSIZ], pl_character[PL_CSIZ]; extern const char quitchars[]; extern char sdir[]; /* defined in hack.c */
CVS commit: src/games/hack
Module Name:src Committed By: ginsbach Date: Wed May 6 02:59:12 UTC 2009 Modified Files: src/games/hack: extern.h hack.end.c hack.unix.c Log Message: Change getdate() to getdatestr() since the former maybe present on systems supporting X/Open System Interfaces Extension (XSI) getdate() in time.h. This prevents a function prototype conflict. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/games/hack/extern.h src/games/hack/hack.end.c \ 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/extern.h diff -u src/games/hack/extern.h:1.9 src/games/hack/extern.h:1.10 --- src/games/hack/extern.h:1.9 Sun Jan 18 00:34:03 2009 +++ src/games/hack/extern.h Wed May 6 02:59:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.9 2009/01/18 00:34:03 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.10 2009/05/06 02:59:12 ginsbach Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -576,7 +576,7 @@ void setrandom(void); struct tm *getlt(void); int getyear(void); -char *getdate(void); +char *getdatestr(void); int phase_of_the_moon(void); int night(void); int midnight(void); Index: src/games/hack/hack.end.c diff -u src/games/hack/hack.end.c:1.9 src/games/hack/hack.end.c:1.10 --- src/games/hack/hack.end.c:1.9 Mon Jan 28 06:55:41 2008 +++ src/games/hack/hack.end.c Wed May 6 02:59:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.end.c,v 1.9 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.end.c,v 1.10 2009/05/06 02:59:12 ginsbach 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.9 2008/01/28 06:55:41 dholland Exp $); +__RCSID($NetBSD: hack.end.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $); #endif/* not lint */ #include signal.h @@ -360,7 +360,7 @@ (t0-name)[NAMSZ] = 0; (void) strncpy(t0-death, killer, DTHSZ); (t0-death)[DTHSZ] = 0; - (void) strcpy(t0-date, getdate()); + (void) strcpy(t0-date, getdatestr()); /* assure minimum number of points */ if (t0-points POINTSMIN) Index: src/games/hack/hack.unix.c diff -u src/games/hack/hack.unix.c:1.9 src/games/hack/hack.unix.c:1.10 --- src/games/hack/hack.unix.c:1.9 Wed Apr 2 18:36:41 2003 +++ src/games/hack/hack.unix.c Wed May 6 02:59:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hack.unix.c,v 1.9 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.unix.c,v 1.10 2009/05/06 02:59:12 ginsbach 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.9 2003/04/02 18:36:41 jsm Exp $); +__RCSID($NetBSD: hack.unix.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $); #endif/* not lint */ /* This file collects some Unix dependencies; hack.pager.c contains some more */ @@ -118,7 +118,7 @@ } char * -getdate() +getdatestr() { static char datestr[7]; struct tm *lt = getlt();