From 7c5417dd3c8525baae999c47318242899a8b9694 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 10 Jul 2000 03:10:18 +0000 Subject: Bail if getch() returns ERR. In ncurses < 5.1 getch() incorrectly returned 0 on EOF (due to a side effect of how curses buffers reads). --- usr.bin/systat/keyboard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c index 120dc0cc38d..b7e73df32d1 100644 --- a/usr.bin/systat/keyboard.c +++ b/usr.bin/systat/keyboard.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keyboard.c,v 1.5 2000/06/04 23:06:17 aaron Exp $ */ +/* $OpenBSD: keyboard.c,v 1.6 2000/07/10 03:10:17 millert Exp $ */ /* $NetBSD: keyboard.c,v 1.2 1995/01/20 08:51:59 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: keyboard.c,v 1.5 2000/06/04 23:06:17 aaron Exp $"; +static char rcsid[] = "$OpenBSD: keyboard.c,v 1.6 2000/07/10 03:10:17 millert Exp $"; #endif /* not lint */ #include @@ -59,7 +59,9 @@ keyboard() move(CMDLINE, 0); do { refresh(); - ch = getch() & 0177; + if ((ch = getch()) == ERR) + exit(1); + ch &= 0177; if (ch == 0177 && ferror(stdin)) { clearerr(stdin); continue; -- cgit v1.2.3