summaryrefslogtreecommitdiff
path: root/ext/io
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-18 10:25:18 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-18 10:33:05 +0900
commit77e3078ede833e86a1ee0e2ce745b15e892bdbf6 (patch)
tree0c81ab319ce78b8fd44d0f63ea1cb64a6b328f5d /ext/io
parent254477248cde5bf82c4f256dca05b13d01c9774c (diff)
[ruby/io-console] Set raw mode strictly same as cfmakeraw
* Default VMIN and VTIME to minimum input. * Disable parity check bits explicitly. * Disable all bits for flow control on input. Co-Authored-By: NARUSE, Yui <naruse@airemix.jp> https://github.com/ruby/io-console/commit/5ce201a686
Diffstat (limited to 'ext/io')
-rw-r--r--ext/io/console/console.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 9bd825aaa0b..ac5b6a611c7 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -165,11 +165,13 @@ set_rawmode(conmode *t, void *arg)
cfmakeraw(t);
t->c_lflag &= ~(ECHOE|ECHOK);
#elif defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
- t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ t->c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL);
t->c_oflag &= ~OPOST;
- t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN);
+ t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|XCASE);
t->c_cflag &= ~(CSIZE|PARENB);
t->c_cflag |= CS8;
+ t->c_cc[VMIN] = 1;
+ t->c_cc[VTIME] = 0;
#elif defined HAVE_SGTTY_H
t->sg_flags &= ~ECHO;
t->sg_flags |= RAW;