summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2013-04-28 11:35:52 +0530
committerVijay Bellur <vbellur@redhat.com>2013-04-28 22:26:52 -0700
commitfc8aa43d4689b3945681a2ab27427daebac297c7 (patch)
tree06bdf7084a3b1d86d5e1eca172e9428f9f8bd5a6 /cli/src
parente6b6d1235daa483384d2b0701561b8f3a85be583 (diff)
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 <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/4894 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-rl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/src/cli-rl.c b/cli/src/cli-rl.c
index 6f75b6f4c70..ade1c8ebb37 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);
}