Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/atc In atc(6), the function getAChar() has BSD and SYS...



details:   https://anonhg.NetBSD.org/src/rev/a7ba8011db5a
branches:  trunk
changeset: 474970:a7ba8011db5a
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Wed Jul 28 02:01:30 1999 +0000

description:
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@localhost>

diffstat:

 games/atc/graphics.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (39 lines):

diff -r 3f4e4c541720 -r a7ba8011db5a games/atc/graphics.c
--- a/games/atc/graphics.c      Wed Jul 28 01:59:46 1999 +0000
+++ b/games/atc/graphics.c      Wed Jul 28 02:01:30 1999 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index