From fc8aa43d4689b3945681a2ab27427daebac297c7 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Sun, 28 Apr 2013 11:35:52 +0530 Subject: cli: Avoid storing empty lines in command history When the console manager is run in the interactive mode, it also saves empty lines (i.e. the Enter key is pressed without running a command) in it's command history. Avoid this by processing the line only if readline() returns a non-empty string. Makes it easier to navigate the history using arrow keys. modified: cli/src/cli-rl.c Change-Id: I0fcce394474589bb345b7c9ef39d25849dc0c2af BUG: 957139 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/4894 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-rl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/src/cli-rl.c b/cli/src/cli-rl.c index 6f75b6f4c..ade1c8ebb 100644 --- a/cli/src/cli-rl.c +++ b/cli/src/cli-rl.c @@ -365,7 +365,8 @@ cli_rl_input (void *_data) if (!line) exit(0); //break; - cli_rl_process_line (line); + if (*line) + cli_rl_process_line (line); free (line); } -- cgit