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/wizard.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/wizard.c')
-rw-r--r-- | games/adventure/wizard.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c index 2d94312145f..fd011127e5e 100644 --- a/games/adventure/wizard.c +++ b/games/adventure/wizard.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wizard.c,v 1.10 2003/04/06 18:50:33 deraadt Exp $ */ +/* $OpenBSD: wizard.c,v 1.11 2003/04/07 18:19:37 millert Exp $ */ /* $NetBSD: wizard.c,v 1.3 1995/04/24 12:21:41 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93"; #else -static char rcsid[] = "$OpenBSD: wizard.c,v 1.10 2003/04/06 18:50:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: wizard.c,v 1.11 2003/04/07 18:19:37 millert Exp $"; #endif #endif /* not lint */ @@ -113,13 +113,11 @@ Start() int wizard() /* not as complex as advent/10 (for now) */ { - char *word, *x; - if (!yesm(16, 0, 7)) return (FALSE); mspeak(17); - getin(&word, &x); - if (!weq(word, magic)) { + getin(wd1, sizeof(wd1), wd2, sizeof(wd2)); + if (!weq(wd1, magic)) { mspeak(20); return (FALSE); } @@ -136,9 +134,9 @@ ciao() printf("What would you like to call the saved version?\n"); for (c = fname; c - fname < MAXPATHLEN; c++) { - *c = ch = getchar(); - if ((*c = getchar()) == '\n' || ch == EOF) + if ((ch = getchar()) == '\n' || ch == EOF) break; + *c = ch; } if (c - fname == MAXPATHLEN) { c--; |