summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-08-19 11:50:08 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-19 11:23:57 -0700
commit1fd482cae739799d2cdb0ffe78b544c249784305 (patch)
tree091b1d649d658247938058c42264745a687de83f /cli
parenta5dac1f49eb247d854348fe8ec54c33e664adf30 (diff)
cli: Fix issues in non readline mode
Signed-off by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1300 (gluster core dump) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1300
Diffstat (limited to 'cli')
-rw-r--r--cli/src/input.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/src/input.c b/cli/src/input.c
index 8bfe14d64..e762fbd13 100644
--- a/cli/src/input.c
+++ b/cli/src/input.c
@@ -56,17 +56,19 @@ cli_input (void *d)
int ret = 0;
char cmdbuf[CMDBUFSIZ];
char *cmd = NULL;
+ size_t len = 0;
state = d;
for (;;) {
- cli_out ("%s", state->prompt);
+ printf ("%s", state->prompt);
cmd = fgets (cmdbuf, CMDBUFSIZ, stdin);
if (!cmd)
break;
-
- printf ("processing command: '%s'\n", cmd);
+ len = strlen(cmd);
+ if (len > 0 && cmd[len - 1] == '\n') //strip trailing \n
+ cmd[len - 1] = '\0';
ret = cli_cmd_process_line (state, cmd);
}