Debug/Telnet CLI enhancements 69/869/3
authorChris Luke <chrisy@flirble.org>
Mon, 25 Apr 2016 17:48:54 +0000 (13:48 -0400)
committerDave Barach <openvpp@barachs.net>
Wed, 27 Apr 2016 13:32:48 +0000 (13:32 +0000)
commit0aca5eb1b88524fc8e988deb6488d14c092b0137
treebd38ae395a66b02227a22f044cf0e2ddd857183d
parentb3656ea0b847ef7bd1a19d2915cdd5938f32b314
Debug/Telnet CLI enhancements

A fairly comprehensive re-work of the built-in debug and telnet CLI
to add various command line editing features and to add command history
to the debug CLI.

This may seem like a large change but a good amount of it is merely
reworking the existing CLI code (which changed its indent level).

The features this patch enables include:

- Enable history in the debug CLI.
- Put both stdin and telnet connections in char-by-char mode.
- Echo from the server, not the client, for more control.
- Add a mostly no-op but fairly complete Telnet protocol processor.
- Perform control code parsing on the input byte stream to match strings
  of both control codes and ANSI/VT100 escape sequences.
- Up/down keys scroll through the history (like ^P/^N).
- Do CRLF output cooking (\n -> \r\n) for connections that need it.
- Left/right cursor movements, insert/erase at cursor.
- Home/end cursor jumps.
- Jump left/right word at a time (Ctrl-left/right).
- Negotiate the terminal type from Telnet clients. (well, the code doesn’t
  really negotiate, it demands it, but the client is led to believe it
  was a negotiation)
- Read terminal type from TERM variable for the local debug CLI.
- Delete from cursor to end of line (^K). Delete char-right (^D/Del).
- Clear screen (^L) and repaint prompt/current command (on non-ANSI
  terminals it just newlines and repaints the line).

Change-Id: Id274b56ccfd4cc8c19ddc0f478890f21f284262a
Signed-off-by: Chris Luke <chrisy@flirble.org>
vlib/vlib/unix/cli.c
vlib/vlib/unix/unix.h