aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Luke <chrisy@flirble.org>2018-06-10 13:42:45 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-06-10 19:54:26 +0000
commit01dc6b968aa1bfa9deea9917b3b45b89c80f6a24 (patch)
tree1d12bbae38dcefe701666fafdac6d332029ff6fb
parentfc379d28ab06760c8dcf0d976a5b224f1b062b97 (diff)
cli: Disable XON/XOFF in the tty
- CLI history forward-search is bound to ^S which is common, but that is also the tty's default control byte to pause output. So we disable XON/XOFF in the tty so that we can use ^S. Change-Id: I61717c77a11733d64eed7f8119677e7cd2e20029 Signed-off-by: Chris Luke <chrisy@flirble.org>
-rw-r--r--src/vlib/unix/cli.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 6c49d80aabd..727b9544854 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2927,8 +2927,12 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
tio = um->tio_stdin;
/* echo off, canonical mode off, ext'd input processing off */
tio.c_lflag &= ~(ECHO | ICANON | IEXTEN);
+ /* disable XON/XOFF, so ^S invokes the history search */
+ tio.c_iflag &= ~(IXON | IXOFF);
tio.c_cc[VMIN] = 1; /* 1 byte at a time */
tio.c_cc[VTIME] = 0; /* no timer */
+ tio.c_cc[VSTOP] = _POSIX_VDISABLE; /* not ^S */
+ tio.c_cc[VSTART] = _POSIX_VDISABLE; /* not ^Q */
tcsetattr (STDIN_FILENO, TCSAFLUSH, &tio);
/* See if we can do ANSI/VT100 output */