summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-07-21 04:23:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-21 03:00:26 -0700
commit7ad75da5e8cb57336380f688650547275b939c3a (patch)
tree35eb77c9cccafb3929e96c04277875d25afc6214 /cli
parent066778ac7994bb574bd49281e8b225c3cd378f44 (diff)
cli: fix consistent behaviour with newlines in cli_out()
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-probe.c12
-rw-r--r--cli/src/cli-cmd-volume.c2
-rw-r--r--cli/src/cli-cmd.c4
-rw-r--r--cli/src/cli.c6
-rw-r--r--cli/src/cli3_1-cops.c8
-rw-r--r--cli/src/input.c2
6 files changed, 18 insertions, 16 deletions
diff --git a/cli/src/cli-cmd-probe.c b/cli/src/cli-cmd-probe.c
index 9f7a1da77..7d1c6eee7 100644
--- a/cli/src/cli-cmd-probe.c
+++ b/cli/src/cli-cmd-probe.c
@@ -40,19 +40,19 @@ extern rpc_clnt_prog_t *cli_rpc_prog;
void
cli_cmd_probe_usage ()
{
- cli_out ("Usage: probe <hostname> [port]\n");
+ cli_out ("Usage: probe <hostname> [port]");
}
void
cli_cmd_deprobe_usage ()
{
- cli_out ("Usage: detach <hostname> [port]\n");
+ cli_out ("Usage: detach <hostname> [port]");
}
void
cli_cmd_peer_status_usage ()
{
- cli_out ("Usage: peer status <hostname> [port]\n");
+ cli_out ("Usage: peer status <hostname> [port]");
}
int
@@ -95,7 +95,7 @@ cli_cmd_probe_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (ret)
- cli_out ("Probe failed\n");
+ cli_out ("Probe failed");
return ret;
}
@@ -138,7 +138,7 @@ cli_cmd_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (ret)
- cli_out ("Detach failed\n");
+ cli_out ("Detach failed");
return ret;
}
@@ -168,7 +168,7 @@ cli_cmd_peer_status_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (ret)
- cli_out ("Command Execution failed\n");
+ cli_out ("Command Execution failed");
return ret;
}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 7aafddccc..d3960d065 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -426,7 +426,7 @@ cli_cmd_volume_set_transport_cbk (struct cli_state *state,
struct cli_cmd_word *word,
const char **words, int wordcount)
{
- cli_out ("volume set-transport not implemented\n");
+ cli_out ("volume set-transport not implemented");
return 0;
}
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index 24c7dea0e..4ef8e86cd 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -63,13 +63,13 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv)
}
if (!word) {
- cli_out ("unrecognized word: %s (position %d)\n",
+ cli_out ("unrecognized word: %s (position %d)",
argv[i], i);
return -1;
}
if (!word->cbkfn) {
- cli_out ("unrecognized command\n");
+ cli_out ("unrecognized command");
return -1;
}
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 5bf32ec89..b31e9feda 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -368,6 +368,7 @@ cli_out (const char *fmt, ...)
{
struct cli_state *state = NULL;
va_list ap;
+ int ret = 0;
state = global_state;
@@ -378,7 +379,10 @@ cli_out (const char *fmt, ...)
return cli_rl_out(state, fmt, ap);
#endif
- return vprintf (fmt, ap);
+ ret = vprintf (fmt, ap);
+ printf ("\n");
+
+ return ret;
}
struct rpc_clnt *
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 1f9feeac0..dc9241bc6 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -178,7 +178,7 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
if (ret)
goto out;
- cli_out ("hostname:%s, port:%d, uuid:%s, state:%d\n",
+ cli_out ("hostname:%s, port:%d, uuid:%s, state:%d",
hostname_buf, port, uuid_buf, state);
i++;
}
@@ -192,7 +192,7 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
out:
if (ret)
- cli_out ("Command Execution Failed\n");
+ cli_out ("Command Execution Failed");
if (dict)
dict_destroy (dict);
@@ -285,7 +285,7 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
cli_out ("Volume Name:%s, type:%d, status:%d,"
- "brick_count: %d\n",
+ "brick_count: %d",
volname, type, status, brick_count);
i++;
}
@@ -300,7 +300,7 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
out:
cli_cmd_broadcast_response ();
if (ret)
- cli_out ("Command Execution Failed\n");
+ cli_out ("Command Execution Failed");
if (dict)
dict_destroy (dict);
diff --git a/cli/src/input.c b/cli/src/input.c
index 62bd8c406..314058e05 100644
--- a/cli/src/input.c
+++ b/cli/src/input.c
@@ -33,8 +33,6 @@
#define CMDBUFSIZ 1024
-#define cli_out(fmt...) fprintf (stdout, ##fmt)
-
void *
cli_batch (void *d)
{