]> git.pond.sub.org Git - empserver/commit
client: Add readline support to empire client
authorMartin Haukeli <martin.haukeli@gmail.com>
Sun, 8 Nov 2015 22:57:14 +0000 (23:57 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 09:22:29 +0000 (11:22 +0200)
commitf1fc0df03d3350ffe65cd2ff929bcf3ddc958c7c
tree3cef3428a1b730101309ac8a17e6ccb9ed2c554b
parent594cd20f7629b0d84267f02458963d7586715516
client: Add readline support to empire client

Readline provides fancy command line editing such as <Arrow Up> for
previous commands and CTRL+A to jump to the beginning of the line.

This patch does not add any completion on <tab> key, a TODO, if you
will.

A new command line flag, -H, turns on saving the history to disk.
This may have security implications on shared computers, as all
commands are saved as-is.  Thus "change re 1234" would be logged
directly to the file.

Signed-off-by: Martin Haukeli <martin.haukeli@gmail.com>
Rebase on top of preparatory work, fix a few bugs, and tidy up:

* Update the standalone client build, too.

* Fix the Windows build.

* Keep command line options sorted case-insensitively.

* Error out when $HOME is unset and getpwuid() fails, just like we do
  for $LOGNAME.

* Give @input_from_rl, @has_rl_input static linkage.

* @has_rl_input is a flag, not a counter, set and test it accordingly.

* Save all input in history, not just commands.  Martin's attempt to
  recognize commands works only as long as the server sends prompts
  faster than the user sends input.  Drop that part, and update commit
  message accordingly.

* Fix recv_input() not to truncate value of strlen() to int, and to
  use memmove() for updating @input_from_rl in place.

* Clean up whitespace in a few places.

* Tweak commit message.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Make.mk
configure.ac
m4/ax_lib_readline.m4 [new file with mode: 0644]
man/empire.6
src/client/configure.ac
src/client/main.c
src/client/misc.h
src/client/play.c
src/client/servcmd.c