summaryrefslogtreecommitdiffstats
path: root/trek/computer.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-05-24 23:20:22 +0000
committerdholland <dholland@NetBSD.org>2009-05-24 23:20:22 +0000
commit478be95d8d1ddb2e9cb1831f0115097af1e41bc4 (patch)
tree81172dfe5cc4fc359e2a3a3e251e366c5c2d1706 /trek/computer.c
parent5a874af0513d6e4a0b2b796da83651a4c2351310 (diff)
downloadbsdgames-darwin-478be95d8d1ddb2e9cb1831f0115097af1e41bc4.tar.gz
bsdgames-darwin-478be95d8d1ddb2e9cb1831f0115097af1e41bc4.tar.zst
bsdgames-darwin-478be95d8d1ddb2e9cb1831f0115097af1e41bc4.zip
Abolish cgetc(). It contained one line of code, which was wrong.
Call getchar() directly, and handle EOF properly instead of looping (in some cases) or pretending that EOF is 0 (which it isn't).
Diffstat (limited to 'trek/computer.c')
-rw-r--r--trek/computer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/trek/computer.c b/trek/computer.c
index 04c62f53..c3c507d4 100644
--- a/trek/computer.c
+++ b/trek/computer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: computer.c,v 1.14 2009/05/24 22:55:03 dholland Exp $ */
+/* $NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: computer.c,v 1.14 2009/05/24 22:55:03 dholland Exp $");
+__RCSID("$NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $");
#endif
#endif /* not lint */
@@ -293,8 +293,8 @@ computer(int v __unused)
* means get new computer request; newline means
* exit computer mode.
*/
- while ((i = cgetc(0)) != ';') {
- if (i == '\0')
+ while ((i = getchar()) != ';') {
+ if (i == EOF)
exit(1);
if (i == '\n') {
ungetc(i, stdin);