]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_getch.c
ncurses 6.1 - patch 20180623
[ncurses.git] / ncurses / base / lib_getch.c
index 1495670556b219369e4d9776da769a2baafc27b9..5bfeb24d85632aa6b167619151983f4d57708bfc 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2016,2018 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_getch.c,v 1.135 2016/06/11 21:52:23 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.137 2018/06/24 00:06:37 tom Exp $")
 
 #include <fifo_defs.h>
 
 
 #include <fifo_defs.h>
 
@@ -125,7 +125,7 @@ _nc_use_meta(WINDOW *win)
 }
 
 #ifdef USE_TERM_DRIVER
 }
 
 #ifdef USE_TERM_DRIVER
-# ifdef __MINGW32__
+# ifdef _WIN32
 static HANDLE
 _nc_get_handle(int fd)
 {
 static HANDLE
 _nc_get_handle(int fd)
 {
@@ -146,7 +146,7 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
 #ifdef USE_TERM_DRIVER
     TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
     rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
 #ifdef USE_TERM_DRIVER
     TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
     rc = TCBOf(sp)->drv->td_testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
-# ifdef __MINGW32__
+# ifdef _WIN32
     /* if we emulate terminfo on console, we have to use the console routine */
     if (IsTermInfoOnConsole(sp)) {
        HANDLE fd = _nc_get_handle(sp->_ifd);
     /* if we emulate terminfo on console, we have to use the console routine */
     if (IsTermInfoOnConsole(sp)) {
        HANDLE fd = _nc_get_handle(sp->_ifd);
@@ -224,11 +224,6 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
     if (tail < 0)
        return ERR;
 
     if (tail < 0)
        return ERR;
 
-#ifdef HIDE_EINTR
-  again:
-    errno = 0;
-#endif
-
 #ifdef NCURSES_WGETCH_EVENTS
     if (evl
 #if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
 #ifdef NCURSES_WGETCH_EVENTS
     if (evl
 #if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
@@ -288,7 +283,7 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
     {                          /* Can block... */
 #ifdef USE_TERM_DRIVER
        int buf;
     {                          /* Can block... */
 #ifdef USE_TERM_DRIVER
        int buf;
-#ifdef __MINGW32__
+#ifdef _WIN32
        if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak)
            n = _nc_mingw_console_read(sp,
                                       _nc_get_handle(sp->_ifd),
        if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && sp->_cbreak)
            n = _nc_mingw_console_read(sp,
                                       _nc_get_handle(sp->_ifd),
@@ -313,24 +308,6 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
 #endif
     }
 
 #endif
     }
 
-#ifdef HIDE_EINTR
-    /*
-     * Under System V curses with non-restarting signals, getch() returns
-     * with value ERR when a handled signal keeps it from completing.
-     * If signals restart system calls, OTOH, the signal is invisible
-     * except to its handler.
-     *
-     * We don't want this difference to show.  This piece of code
-     * tries to make it look like we always have restarting signals.
-     */
-    if (n <= 0 && errno == EINTR
-# if USE_PTHREADS_EINTR
-       && (_nc_globals.have_sigwinch == 0)
-# endif
-       )
-       goto again;
-#endif
-
     if ((n == -1) || (n == 0)) {
        TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
        ch = ERR;
     if ((n == -1) || (n == 0)) {
        TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
        ch = ERR;