summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-misc.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-04-21 06:55:44 +0000
committerAnand Avati <avati@gluster.com>2011-04-22 03:52:24 -0700
commit49603aec03e98a2a38fad66627593b69b6269cbf (patch)
treec779d7f8be2e4477d057f17d49713fdb007639f6 /cli/src/cli-cmd-misc.c
parentb5848ed21b9e718011a8f3f3870c4ed978ff17a5 (diff)
cli: changes in struct cli_cmd to disable gluster command at run-time
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2744 (make geo-replication package friendly) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2744
Diffstat (limited to 'cli/src/cli-cmd-misc.c')
-rw-r--r--cli/src/cli-cmd-misc.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/cli/src/cli-cmd-misc.c b/cli/src/cli-cmd-misc.c
index 1e356c63bea..55825f6993b 100644
--- a/cli/src/cli-cmd-misc.c
+++ b/cli/src/cli-cmd-misc.c
@@ -54,23 +54,19 @@ int
cli_cmd_display_help (struct cli_state *state, struct cli_cmd_word *in_word,
const char **words, int wordcount)
{
- struct cli_cmd *cmd = NULL;
+ struct cli_cmd *cmd[] = {volume_cmds, cli_probe_cmds,
+ cli_misc_cmds, NULL};
+ struct cli_cmd *cmd_ind = NULL;
+ int i = 0;
- for (cmd = volume_cmds; cmd->pattern; cmd++)
- cli_out ("%s - %s", cmd->pattern, cmd->desc);
-
- for (cmd = cli_probe_cmds; cmd->pattern; cmd++)
- cli_out ("%s - %s", cmd->pattern, cmd->desc);
-
- /*
- * commands for internal usage, don't expose
-
- for (cmd = cli_system_cmds; cmd->pattern; cmd++)
- cli_out ("%s - %s", cmd->pattern, cmd->desc);
+ /* cli_systerm_cmds commands for internal usage
+ they are not exposed
*/
-
- for (cmd = cli_misc_cmds; cmd->pattern; cmd++)
- cli_out ("%s - %s", cmd->pattern, cmd->desc);
+ for (i=0; cmd[i]!=NULL; i++)
+ for (cmd_ind = cmd[i]; cmd_ind->pattern; cmd_ind++)
+ if (_gf_false == cmd_ind->disable)
+ cli_out ("%s - %s", cmd_ind->pattern,
+ cmd_ind->desc);
return 0;
}
@@ -95,8 +91,8 @@ cli_cmd_misc_register (struct cli_state *state)
struct cli_cmd *cmd = NULL;
for (cmd = cli_misc_cmds; cmd->pattern; cmd++) {
- ret = cli_cmd_register (&state->tree, cmd->pattern, cmd->cbk,
- cmd->desc);
+
+ ret = cli_cmd_register (&state->tree, cmd);
if (ret)
goto out;
}