diff options
| author | Bradley Smith | 2008-03-07 21:49:03 +0000 | 
|---|---|---|
| committer | Bradley Smith | 2008-03-07 21:49:03 +0000 | 
| commit | e873d9aba5c545c1fa78e13a496baf6ac746f889 (patch) | |
| tree | a653c2fe99ba60274f6394b4e0b943e445e0471d /lib/x11plugin.c | |
| parent | Add -pedantic-errors and -Werror flags to compile, and fix code to comply. (diff) | |
| download | gnurobots-e873d9aba5c545c1fa78e13a496baf6ac746f889.tar.gz | |
Add readline support to x11_plugin's commandline input.
Signed-off-by: Bradley Smith <brad@brad-smith.co.uk>
Diffstat (limited to 'lib/x11plugin.c')
| -rw-r--r-- | lib/x11plugin.c | 21 | 
1 files changed, 19 insertions, 2 deletions
| diff --git a/lib/x11plugin.c b/lib/x11plugin.c index 4585be5..81bba80 100644 --- a/lib/x11plugin.c +++ b/lib/x11plugin.c @@ -27,6 +27,8 @@  #include "configs.h"  #include "x11plugin.h" +#include <readline.h> +  enum  {    ARG_0, @@ -580,8 +582,23 @@ inline void x11_plugin_get_string (X11Plugin *x11,    /* You want me to write a text-box using xlib?      * You got to be kidding me     * */ -  fputs (prompt, stdout); -  fgets (buff, len, stdin); +/*  fputs (prompt, stdout); */ +/*  fgets (buff, len, stdin); */ + +  char* line = (char*)NULL; + +  line = readline(prompt); + +  if(line && *line) +  { +    add_history(line); + +    g_strlcpy(buff, line, len); +  } +  else +    buff = ""; + +  free(line);  }  inline void x11_update_status (X11Plugin *x11, | 
