diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-04-07 18:19:38 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-04-07 18:19:38 +0000 |
commit | c9eae24eceba05cbd55018c71ec59d0df9c081f8 (patch) | |
tree | 58a10e14efdc064a99b0ae7f8829d0600068eab1 /games/adventure/subr.c | |
parent | dafa347d401328cc9c6464983dd6468413efb1e1 (diff) |
Change wd1 and wd2 from pointers to arrays. This removes the need
for getin() to have static buffers and allows us to do "sizeof wd1".
Also fix saved game path. It was removing the first 2 chars of
the filename due to a bug.
tdeval@ OK
Diffstat (limited to 'games/adventure/subr.c')
-rw-r--r-- | games/adventure/subr.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/games/adventure/subr.c b/games/adventure/subr.c index 921a63c9185..3d7d44969ab 100644 --- a/games/adventure/subr.c +++ b/games/adventure/subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.c,v 1.5 2003/04/06 18:50:33 deraadt Exp $ */ +/* $OpenBSD: subr.c,v 1.6 2003/04/07 18:19:37 millert Exp $ */ /* $NetBSD: subr.c,v 1.2 1995/03/21 12:05:11 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: subr.c,v 1.5 2003/04/06 18:50:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: subr.c,v 1.6 2003/04/07 18:19:37 millert Exp $"; #endif #endif /* not lint */ @@ -555,11 +555,11 @@ trsay() /* 9030 */ { int i; - if (*wd2 != 0) - strcpy(wd1, wd2); + if (wd2[0] != 0) + strlcpy(wd1, wd2, sizeof(wd1)); i = vocab(wd1, -1, 0); if (i == 62 || i == 65 || i == 71 || i == 2025) { - *wd2 = 0; + wd2[0] = 0; obj = 0; return (2630); } @@ -833,7 +833,7 @@ trkill() /* 9120 */ rspeak(49); verb = 0; obj = 0; - getin(&wd1, &wd2); + getin(wd1, sizeof(wd1), wd2, sizeof(wd2)); if (!weq(wd1, "y") && !weq(wd1, "yes")) return (2608); pspeak(dragon, 1); |