diff options
Diffstat (limited to 'cli/src/cli-cmd-misc.c')
| -rw-r--r-- | cli/src/cli-cmd-misc.c | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/cli/src/cli-cmd-misc.c b/cli/src/cli-cmd-misc.c index 1e356c63b..566d7c978 100644 --- a/cli/src/cli-cmd-misc.c +++ b/cli/src/cli-cmd-misc.c @@ -1,22 +1,12 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> - This file is part of GlusterFS. - - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. -*/ + Copyright (c) 2010-2012 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -41,6 +31,8 @@ extern struct cli_cmd volume_cmds[]; extern struct cli_cmd cli_probe_cmds[]; extern struct cli_cmd cli_log_cmds[]; extern struct cli_cmd cli_system_cmds[]; +extern struct cli_cmd cli_bd_cmds[]; +extern struct cli_cmd snapshot_cmds[]; struct cli_cmd cli_misc_cmds[]; int @@ -54,23 +46,20 @@ 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; - - 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); + struct cli_cmd *cmd[] = {volume_cmds, cli_probe_cmds, + cli_misc_cmds, snapshot_cmds, + NULL}; + struct cli_cmd *cmd_ind = NULL; + int i = 0; + + /* cli_system_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; } @@ -84,6 +73,10 @@ struct cli_cmd cli_misc_cmds[] = { cli_cmd_display_help, "display command options"}, + { "exit", + cli_cmd_quit_cbk, + "exit"}, + { NULL, NULL, NULL } }; @@ -95,8 +88,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; } |
