
# HG changeset patch
# User Mike Miller <mtmiller@octave.org>
# Date 1554238576 25200
# Node ID c3716220d5b93c49e1c7cc8ebe0b76dd961f4ec7
# Parent  fc73dafece570f201c18a4eb4a8729a654cfcfbb
fix pause and kbhit with glibc 2.28 end-of-file state behavior (bug #55029)

* sysdep.cc (octave::kbhit): Call "clearerr (stdin)" on end-of-file condition
in addition to "std::cin.clear ()".  In glibc 2.28, end-of-file is persistent
and must be cleared by the application.

diff --git a/libinterp/corefcn/sysdep.cc b/libinterp/corefcn/sysdep.cc
--- a/libinterp/corefcn/sysdep.cc
+++ b/libinterp/corefcn/sysdep.cc
@@ -566,7 +566,10 @@
     int c = std::cin.get ();
 
     if (std::cin.fail () || std::cin.eof ())
-      std::cin.clear ();
+      {
+        std::cin.clear ();
+        clearerr (stdin);
+      }
 
     // Restore it, enabling system call restarts (if possible).
     octave::set_interrupt_handler (saved_interrupt_handler, true);

