diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2010-08-25 01:58:23 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-25 02:08:43 -0700 |
commit | a0c874f09e294ec75a18a5436bd01eaa97f22f81 (patch) | |
tree | be08d4601d05b035b17aa5e5d630255cb7fb3660 /cli/src/cli.c | |
parent | 5ad84d3decb201e587cca5de7dd0c2c13e6419f6 (diff) |
Help Added to the Gluster-CLI for all sub commands (some deletions in the old patch)
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1156 (gluster --help should display all the options)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1156
Diffstat (limited to 'cli/src/cli.c')
-rw-r--r-- | cli/src/cli.c | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index c165255a0ef..48490ddf4c5 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -76,9 +76,6 @@ extern int connected; /* using argp for command line parsing */ -static char gf_doc[] = ""; - -static char argp_doc[] = "COMMAND [PARAM ...]"; const char *argp_program_version = "" \ PACKAGE_NAME" "PACKAGE_VERSION" built on "__DATE__" "__TIME__ \ @@ -91,14 +88,7 @@ const char *argp_program_version = "" \ const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; -static struct argp_option gf_options[] = { - {0, 0, 0, 0, "Basic options:"}, - {"debug", ARGP_DEBUG_KEY, 0, 0, - "Process runs in foreground and logs to console"}, - {"remote-port", ARGP_PORT_KEY, "PORT", 0, - "glusterd port to connect with"}, - {0, } -}; + struct rpc_clnt *global_rpc; @@ -107,44 +97,7 @@ rpc_clnt_prog_t *cli_rpc_prog; extern struct rpc_clnt_program cli3_1_prog; -static error_t -parse_opts (int key, char *arg, struct argp_state *argp_state) -{ - struct cli_state *state = NULL; - char **argv = NULL; - - state = argp_state->input; - - switch (key) { - case ARGP_DEBUG_KEY: - break; - case ARGP_PORT_KEY: - state->remote_port = strtol (arg, NULL, 0); - break; - case ARGP_KEY_ARG: - if (!state->argc) { - argv = calloc (state->argc + 2, - sizeof (*state->argv)); - } else { - argv = realloc (state->argv, (state->argc + 2) * - sizeof (*state->argv)); - } - if (!argv) - return -1; - - state->argv = argv; - - argv[state->argc] = strdup (arg); - if (!argv[state->argc]) - return -1; - state->argc++; - argv[state->argc] = NULL; - - break; - } - return 0; -} static char * @@ -375,14 +328,9 @@ int parse_cmdline (int argc, char *argv[], struct cli_state *state) { int ret = 0; - struct argp argp = { 0,}; - - argp.options = gf_options; - argp.parser = parse_opts; - argp.args_doc = argp_doc; - argp.doc = gf_doc; - ret = argp_parse (&argp, argc, argv, ARGP_IN_ORDER, NULL, state); + state->argc=argc-1; + state->argv=&argv[1]; return ret; } |