summaryrefslogtreecommitdiffstats
path: root/cribbage/io.c
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2005-04-19 20:12:07 +0000
committerrillig <rillig@NetBSD.org>2005-04-19 20:12:07 +0000
commitc3bbeb79806311e9e1543cb085b2dc1dbfffac42 (patch)
tree0bbcbebe27466206e03b174b82ba44812a10bfb4 /cribbage/io.c
parent73877620f60db66ab60ad3e64f471e01dab784cb (diff)
downloadbsdgames-darwin-c3bbeb79806311e9e1543cb085b2dc1dbfffac42.tar.gz
bsdgames-darwin-c3bbeb79806311e9e1543cb085b2dc1dbfffac42.tar.zst
bsdgames-darwin-c3bbeb79806311e9e1543cb085b2dc1dbfffac42.zip
Fixed wrong use of datatypes. In wait_for(), a char was used together
with getchar(), in readchar(), a char was used to read input, which in getuchar() is used as an argument to islower() and toupper(). Also removed a condition which terminated the process if the user typed in character 255. Approved by christos.
Diffstat (limited to 'cribbage/io.c')
-rw-r--r--cribbage/io.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/cribbage/io.c b/cribbage/io.c
index 3d692576..60e83d19 100644
--- a/cribbage/io.c
+++ b/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.18 2004/11/05 21:30:31 dsl Exp $ */
+/* $NetBSD: io.c,v 1.19 2005/04/19 20:12:07 rillig Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: io.c,v 1.18 2004/11/05 21:30:31 dsl Exp $");
+__RCSID("$NetBSD: io.c,v 1.19 2005/04/19 20:12:07 rillig Exp $");
#endif
#endif /* not lint */
@@ -490,7 +490,7 @@ void
wait_for(ch)
int ch;
{
- char c;
+ int c;
if (ch == '\n')
while ((c = readchar()) != '\n')
@@ -508,11 +508,11 @@ int
readchar()
{
int cnt;
- char c;
+ unsigned char c;
over:
cnt = 0;
- while (read(STDIN_FILENO, &c, sizeof(char)) <= 0)
+ while (read(STDIN_FILENO, &c, sizeof(unsigned char)) <= 0)
if (cnt++ > 100) { /* if we are getting infinite EOFs */
bye(); /* quit the game */
exit(1);
@@ -545,9 +545,6 @@ getline()
refresh();
/* loop reading in the string, and put it in a temporary buffer */
for (sp = linebuf; (c = readchar()) != '\n'; clrtoeol(), refresh()) {
- if (c == -1)
- continue;
- else
if (c == erasechar()) { /* process erase character */
if (sp > linebuf) {
int i;