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>
This commit is contained in:
Ravishankar N 2013-04-28 11:35:52 +05:30 committed by Vijay Bellur
parent e6b6d1235d
commit fc8aa43d46

View File

@ -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);
}