diff options
author | christos <christos@NetBSD.org> | 2001-02-05 00:57:32 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2001-02-05 00:57:32 +0000 |
commit | b1c8e14afd5a078ca925fe471733a693ca4a8076 (patch) | |
tree | 479753089c657c4900becbda1592945edbc418bb /larn/global.c | |
parent | 5813ff28d2110a139386e10f5e3977f3b88dbda8 (diff) | |
download | bsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.tar.gz bsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.tar.zst bsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.zip |
- rename getchar to lgetchar to avoid conflicts with the stdio getchar
- fix redundant decls and nested externs
- use snprintf instead of sprintf
Diffstat (limited to 'larn/global.c')
-rw-r--r-- | larn/global.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/larn/global.c b/larn/global.c index 90e41823..c4e75bfb 100644 --- a/larn/global.c +++ b/larn/global.c @@ -1,4 +1,4 @@ -/* $NetBSD: global.c,v 1.6 1997/10/18 20:03:20 christos Exp $ */ +/* $NetBSD: global.c,v 1.7 2001/02/05 00:57:33 christos Exp $ */ /* * global.c Larn is copyrighted 1986 by Noah Morgan. @@ -23,22 +23,20 @@ */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: global.c,v 1.6 1997/10/18 20:03:20 christos Exp $"); +__RCSID("$NetBSD: global.c,v 1.7 2001/02/05 00:57:33 christos Exp $"); #endif /* not lint */ #include <string.h> #include <unistd.h> #include "header.h" #include "extern.h" -extern int score[], srcount, dropflag; -extern int random; /* the random number seed */ -extern short playerx, playery, lastnum, level; -extern u_char cheat; -extern char monstnamelist[], logname[]; -extern char lastmonst[], *what[], *who[]; +extern int score[], dropflag; +extern int random; /* the random number seed */ +extern char *what[], *who[]; extern char winner[]; -extern u_char monstlevel[]; -extern char sciv[SCORESIZE + 1][26][2], *potionname[], *scrollname[]; +extern char sciv[SCORESIZE + 1][26][2]; +extern char *password; + /* *********** RAISE LEVEL @@ -435,7 +433,7 @@ quit() strcpy(lastmonst, ""); lprcat("\n\nDo you really want to quit?"); while (1) { - i = getchar(); + i = lgetchar(); if (i == 'y') { died(300); return; @@ -466,7 +464,7 @@ more() lprcat("\n --- press "); standout("space"); lprcat(" to continue --- "); - while (getchar() != ' '); + while (lgetchar() != ' '); } /* @@ -808,10 +806,10 @@ gettokstr(str) { int i, j; i = 50; - while ((getchar() != '"') && (--i > 0)); + while ((lgetchar() != '"') && (--i > 0)); i = 36; while (--i > 0) { - if ((j = getchar()) != '"') + if ((j = lgetchar()) != '"') *str++ = j; else i = 0; @@ -820,7 +818,7 @@ gettokstr(str) i = 50; if (j != '"') /* if end due to too long, then find closing quote */ - while ((getchar() != '"') && (--i > 0)); + while ((lgetchar() != '"') && (--i > 0)); } /* @@ -833,7 +831,6 @@ getpassword() { int i, j; char *gpwp; - extern char *password; scbr(); /* system("stty -echo cbreak"); */ gpwp = gpwbuf; lprcat("\nEnter Password: "); @@ -861,7 +858,7 @@ getyn() int i; i = 0; while (i != 'y' && i != 'n' && i != '\33') - i = getchar(); + i = lgetchar(); return (i); } |