changeset 20787:62564952e161

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Wed, 02 Dec 2015 14:09:09 -0800
parents b6f2909e7f94 (current diff) a8ee668e7fd7 (diff)
children 4c15057e1bc6
files configure.ac libinterp/corefcn/sysdep.cc
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Dec 02 16:54:13 2015 -0500
+++ b/configure.ac	Wed Dec 02 14:09:09 2015 -0800
@@ -2276,7 +2276,7 @@
 AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal])
 AC_CHECK_FUNCS([tcgetattr tcsetattr tgammaf toascii])
 AC_CHECK_FUNCS([umask waitpid])
-AC_CHECK_FUNCS([_kbhit])
+AC_CHECK_FUNCS([_getch _kbhit])
 
 dnl There are no workarounds in the code for missing these functions.
 AC_CHECK_FUNCS([modf pow sqrt sqrtf], [],
--- a/libinterp/corefcn/sysdep.cc	Wed Dec 02 16:54:13 2015 -0500
+++ b/libinterp/corefcn/sysdep.cc	Wed Dec 02 14:09:09 2015 -0800
@@ -508,8 +508,15 @@
 int
 octave_kbhit (bool wait)
 {
-#ifdef HAVE__KBHIT
-  int c = (! wait && ! _kbhit ()) ? 0 : std::cin.get ();
+#ifdef HAVE__KBHIT && HAVE__GETCH
+  // This essentially means we are on a Windows system.
+  int c;
+
+  if (wait)
+    c = _getch ();
+  else
+    c = (! _kbhit ()) ? 0 : _getch ();
+
 #else
   raw_mode (true, wait);