public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Lessen the side effect of workaround for rlwarp.
@ 2021-01-19  9:27 Takashi Yano
  2021-01-19  9:57 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2021-01-19  9:27 UTC (permalink / raw)
  To: cygwin-patches

- This patch lessens the side effect of the workaround for rlwrap
  introduced by commit 4e16b033.
---
 winsup/cygwin/fhandler_tty.cc | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 473c0c968..c78e996e8 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1176,11 +1176,19 @@ fhandler_pty_slave::tcgetattr (struct termios *t)
 {
   reset_switch_to_pcon ();
   *t = get_ttyp ()->ti;
+
   /* Workaround for rlwrap */
-  if (get_ttyp ()->pcon_start)
-    t->c_lflag &= ~(ICANON | ECHO);
-  if (get_ttyp ()->h_pseudo_console)
-    t->c_iflag &= ~ICRNL;
+  cygheap_fdenum cfd (false);
+  while (cfd.next () >= 0)
+    if (cfd->get_major () == DEV_PTYM_MAJOR
+	&& cfd->get_minor () == get_minor ())
+      {
+	if (get_ttyp ()->pcon_start)
+	  t->c_lflag &= ~(ICANON | ECHO);
+	if (get_ttyp ()->h_pseudo_console)
+	  t->c_iflag &= ~ICRNL;
+	break;
+      }
   return 0;
 }
 
-- 
2.30.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: pty: Lessen the side effect of workaround for rlwarp.
  2021-01-19  9:27 [PATCH] Cygwin: pty: Lessen the side effect of workaround for rlwarp Takashi Yano
@ 2021-01-19  9:57 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-01-19  9:57 UTC (permalink / raw)
  To: cygwin-patches

On Jan 19 18:27, Takashi Yano via Cygwin-patches wrote:
> - This patch lessens the side effect of the workaround for rlwrap
>   introduced by commit 4e16b033.
> ---
>  winsup/cygwin/fhandler_tty.cc | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index 473c0c968..c78e996e8 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -1176,11 +1176,19 @@ fhandler_pty_slave::tcgetattr (struct termios *t)
>  {
>    reset_switch_to_pcon ();
>    *t = get_ttyp ()->ti;
> +
>    /* Workaround for rlwrap */
> -  if (get_ttyp ()->pcon_start)
> -    t->c_lflag &= ~(ICANON | ECHO);
> -  if (get_ttyp ()->h_pseudo_console)
> -    t->c_iflag &= ~ICRNL;
> +  cygheap_fdenum cfd (false);
> +  while (cfd.next () >= 0)
> +    if (cfd->get_major () == DEV_PTYM_MAJOR
> +	&& cfd->get_minor () == get_minor ())
> +      {
> +	if (get_ttyp ()->pcon_start)
> +	  t->c_lflag &= ~(ICANON | ECHO);
> +	if (get_ttyp ()->h_pseudo_console)
> +	  t->c_iflag &= ~ICRNL;
> +	break;
> +      }
>    return 0;
>  }
>  
> -- 
> 2.30.0

Pushed.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-19  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  9:27 [PATCH] Cygwin: pty: Lessen the side effect of workaround for rlwarp Takashi Yano
2021-01-19  9:57 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).