cli: Disable XON/XOFF in the tty 77/12977/3
authorChris Luke <chrisy@flirble.org>
Sun, 10 Jun 2018 17:42:45 +0000 (13:42 -0400)
committerFlorin Coras <florin.coras@gmail.com>
Sun, 10 Jun 2018 19:54:26 +0000 (19:54 +0000)
- 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>
src/vlib/unix/cli.c

index 6c49d80..727b954 100644 (file)
@@ -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 */