summaryrefslogtreecommitdiffstats
path: root/atc
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-07-28 02:01:30 +0000
committerhubertf <hubertf@NetBSD.org>1999-07-28 02:01:30 +0000
commit537a50f2e1a1c5acddaaf889c326e1e8f2993074 (patch)
tree7968e957f0ab3b47872726c08f81ec6aa2ed6d97 /atc
parent932e74d4028472671e706b8d64965ef4a4293d0f (diff)
downloadbsdgames-darwin-537a50f2e1a1c5acddaaf889c326e1e8f2993074.tar.gz
bsdgames-darwin-537a50f2e1a1c5acddaaf889c326e1e8f2993074.tar.zst
bsdgames-darwin-537a50f2e1a1c5acddaaf889c326e1e8f2993074.zip
In atc(6), the function getAChar() has BSD and SYSV variants to deal
with variations in EINTR behaviour, but the optimisation of using the BSD version where the SYSV version isn't needed is insignificant. This patch therefore simplifies the code by making there be just one version, a more paranoid (about EOF when errno is already EINTR) version of the SYSV code. Since the BSD/SYSV defines are mainly used to control whether BSD timers are used, this helps where BSD timers but SYSV EINTR handling are wanted. Patch supplied in PR 8091 by Joseph Myers <jsm28@cam.ac.uk>
Diffstat (limited to 'atc')
-rw-r--r--atc/graphics.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/atc/graphics.c b/atc/graphics.c
index 693e0ae9..839f2c08 100644
--- a/atc/graphics.c
+++ b/atc/graphics.c
@@ -1,4 +1,4 @@
-/* $NetBSD: graphics.c,v 1.7 1999/07/25 00:24:38 hubertf Exp $ */
+/* $NetBSD: graphics.c,v 1.8 1999/07/28 02:01:30 hubertf Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -50,7 +50,7 @@
#if 0
static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: graphics.c,v 1.7 1999/07/25 00:24:38 hubertf Exp $");
+__RCSID("$NetBSD: graphics.c,v 1.8 1999/07/28 02:01:30 hubertf Exp $");
#endif
#endif /* not lint */
@@ -69,15 +69,14 @@ WINDOW *radar, *cleanradar, *credit, *input, *planes;
int
getAChar()
{
-#ifdef BSD
- return (getchar());
-#endif
-#ifdef SYSV
int c;
- while ((c = getchar()) == -1 && errno == EINTR) ;
+ errno = 0;
+ while ((c = getchar()) == -1 && errno == EINTR) {
+ errno = 0;
+ clearerr(stdin);
+ }
return(c);
-#endif
}
void