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/main.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/main.c')
-rw-r--r-- | larn/main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/larn/main.c b/larn/main.c index eba8146c..41a1498c 100644 --- a/larn/main.c +++ b/larn/main.c @@ -1,9 +1,9 @@ -/* $NetBSD: main.c,v 1.15 2000/05/22 12:42:46 blymn Exp $ */ +/* $NetBSD: main.c,v 1.16 2001/02/05 00:57:33 christos Exp $ */ /* main.c */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: main.c,v 1.15 2000/05/22 12:42:46 blymn Exp $"); +__RCSID("$NetBSD: main.c,v 1.16 2001/02/05 00:57:33 christos Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -100,7 +100,8 @@ main(argc, argv) strcpy(savefilename, ptr); strcat(savefilename, "/Larn.sav"); /* save file name in home * directory */ - sprintf(optsfile, "%s/.larnopts", ptr); /* the .larnopts filename */ + snprintf(optsfile, sizeof(optsfile), "%s/.larnopts", ptr); + /* the .larnopts filename */ /* * now malloc the memory for the dungeon @@ -1272,7 +1273,7 @@ whatitem(str) lprintf("\nWhat do you want to %s [* for all] ? ", str); i = 0; while (i > 'z' || (i < 'a' && i != '*' && i != '\33' && i != '.')) - i = getchar(); + i = lgetchar(); if (i == '\33') lprcat(" aborted"); return (i); @@ -1289,7 +1290,7 @@ readnum(mx) int i; unsigned long amt = 0; sncbr(); - if ((i = getchar()) == '*') + if ((i = lgetchar()) == '*') amt = mx; /* allow him to say * for all gold */ else while (i != '\n') { @@ -1300,7 +1301,7 @@ readnum(mx) } if ((i <= '9') && (i >= '0') && (amt < 99999999)) amt = amt * 10 + i - '0'; - i = getchar(); + i = lgetchar(); } scbr(); return (amt); |