Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses PR lib/53615



details:   https://anonhg.NetBSD.org/src/rev/73e750405712
branches:  trunk
changeset: 993578:73e750405712
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Sep 18 22:46:18 2018 +0000

description:
PR lib/53615

getch() and get_wch() should return KEY_RESIZE when interrupted by SIGWINCH.

OK roy

diffstat:

 lib/libcurses/get_wch.c |  12 +++++++++---
 lib/libcurses/getch.c   |  11 ++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)

diffs (70 lines):

diff -r 86ad0158bd3f -r 73e750405712 lib/libcurses/get_wch.c
--- a/lib/libcurses/get_wch.c   Tue Sep 18 22:12:19 2018 +0000
+++ b/lib/libcurses/get_wch.c   Tue Sep 18 22:46:18 2018 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: get_wch.c,v 1.14 2017/01/31 09:17:53 roy Exp $ */
+/*   $NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,9 +36,10 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.14 2017/01/31 09:17:53 roy Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $");
 #endif                                           /* not lint */
 
+#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -596,7 +597,12 @@
 
                if (ferror(infd)) {
                        clearerr(infd);
-                       return ERR;
+                       if (errno == EINTR && _cursesi_screen->resized) {
+                               _cursesi_screen->resized = 0;
+                               *ch = KEY_RESIZE;
+                               return KEY_CODE_YES;
+                       } else
+                               return ERR;
                } else {
                        ret = c;
                        inp = c;
diff -r 86ad0158bd3f -r 73e750405712 lib/libcurses/getch.c
--- a/lib/libcurses/getch.c     Tue Sep 18 22:12:19 2018 +0000
+++ b/lib/libcurses/getch.c     Tue Sep 18 22:46:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getch.c,v 1.65 2017/01/31 09:17:53 roy Exp $   */
+/*     $NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $   */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,10 +34,11 @@
 #if 0
 static char sccsid[] = "@(#)getch.c    8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: getch.c,v 1.65 2017/01/31 09:17:53 roy Exp $");
+__RCSID("$NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $");
 #endif
 #endif                                 /* not lint */
 
+#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -889,7 +890,11 @@
 
                if (ferror(infd)) {
                        clearerr(infd);
-                       inp = ERR;
+                       if (errno == EINTR && _cursesi_screen->resized) {
+                               _cursesi_screen->resized = 0;
+                               inp = KEY_RESIZE;
+                       } else
+                               inp = ERR;
                } else {
                        inp = c;
                }



Home | Main Index | Thread Index | Old Index