From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E54E838708CE; Fri, 19 Feb 2021 17:09:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E54E838708CE Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Add support for FLUSHO and Ctrl-O. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 9677efcf005a76e9bb23693243801df0a9e5398c X-Git-Newrev: b56a371436192c965984013682043412cb22fc57 Message-Id: <20210219170923.E54E838708CE@sourceware.org> Date: Fri, 19 Feb 2021 17:09:23 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 17:09:24 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b56a371436192c965984013682043412cb22fc57 commit b56a371436192c965984013682043412cb22fc57 Author: Takashi Yano via Cygwin-patches Date: Fri Feb 19 17:44:02 2021 +0900 Cygwin: console: Add support for FLUSHO and Ctrl-O. - With this patch, FLUSHO and Ctrl-O (VDISCARD) get working. Diff: --- winsup/cygwin/fhandler_console.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index ca8eb6400..6ded9eabf 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -259,6 +259,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp) { ttyp->kill_pgrp (sig); ttyp->output_stopped = false; + ti.c_lflag &= ~FLUSHO; /* Discard type ahead input */ goto skip_writeback; } @@ -286,6 +287,13 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp) && c && i >= output_stopped_at) goto restart_output; } + if ((ti.c_lflag & ICANON) && (ti.c_lflag & IEXTEN) + && CCEQ (ti.c_cc[VDISCARD], c)) + { + if (input_rec[i].Event.KeyEvent.bKeyDown) + ti.c_lflag ^= FLUSHO; + processed = true; + } break; case WINDOW_BUFFER_SIZE_EVENT: SHORT y = con.dwWinSize.Y; @@ -3052,6 +3060,9 @@ fhandler_console::write (const void *vsrc, size_t len) if (bg <= bg_eof) return (ssize_t) bg; + if (get_ttyp ()->ti.c_lflag & FLUSHO) + return len; /* Discard write data */ + if (get_ttyp ()->output_stopped && is_nonblocking ()) { set_errno (EAGAIN);