From 63ec13f022ae99c1664fbdbc9e6623903ba843af Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 15 Sep 2010 08:11:15 +0000 Subject: cli: add a simplistic option parser, convert "mode script" to "--mode=script" Signed-off-by: Csaba Henk Signed-off-by: Vijay Bellur BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570 --- cli/src/input.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'cli/src/input.c') diff --git a/cli/src/input.c b/cli/src/input.c index 2c67b354d4c..7c3e78b16ca 100644 --- a/cli/src/input.c +++ b/cli/src/input.c @@ -41,10 +41,7 @@ cli_batch (void *d) state = d; - if (state->mode == GLUSTER_MODE_SCRIPT) - ret = cli_cmd_process (state, state->argc - 2, state->argv + 2); - else - ret = cli_cmd_process (state, state->argc, state->argv); + ret = cli_cmd_process (state, state->argc, state->argv); gf_log ("", GF_LOG_NORMAL, "Exiting with: %d", ret); exit (ret); @@ -86,22 +83,8 @@ int cli_input_init (struct cli_state *state) { int ret = 0; - gf_boolean_t is_batch = _gf_false; - - if (1 < state->argc) { - if (!strcmp ("mode", state->argv[0]) && - !strcmp ("script", state->argv[1])) { - state->mode = GLUSTER_MODE_SCRIPT; - if (2 < state->argc) - is_batch = _gf_true; - } else { - is_batch = _gf_true; - } - } else if (1 == state->argc) { - is_batch = _gf_true; - } - if (is_batch) { + if (state->argc) { ret = pthread_create (&state->input, NULL, cli_batch, state); return ret; } -- cgit