diff options
author | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-08-31 18:15:20 -0700 |
---|---|---|
committer | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2011-09-06 15:23:17 -0700 |
commit | bb167e50bdae78b81f67bb93c8a3af4440158873 (patch) | |
tree | 592044ea901ea0c3af5a75769720e77ba19e0f11 | |
parent | 7293537d645aa563853662f07f4623a19dcc7292 (diff) | |
download | ceph-bb167e50bdae78b81f67bb93c8a3af4440158873.tar.gz |
gceph tool: convert to new-style arg parsing
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
-rw-r--r-- | src/tools/gceph.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/tools/gceph.cc b/src/tools/gceph.cc index 9fd0b9f5e5e..5557b775294 100644 --- a/src/tools/gceph.cc +++ b/src/tools/gceph.cc @@ -31,18 +31,20 @@ static std::ostringstream gss; static void usage() { - derr << "usage: gceph [options]" << dendl; - derr << dendl; - derr << "Runs the ceph graphical monitor" << dendl; + cerr << "usage: gceph [options]\n\n"; + cerr << "Runs the ceph graphical monitor\n"; generic_client_usage(); // Will exit() } -static void parse_gceph_args(const vector<const char*> &args) +static void parse_gceph_args(vector<const char*> &args) { - DEFINE_CONF_VARS(usage); - FOR_EACH_ARG(args) { - if (CEPH_ARGPARSE_EQ("help", 'h')) { + std::vector<const char*>::iterator i; + std::string val; + for (i = args.begin(); i != args.end(); ) { + if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) { usage(); + } else { + ++i; } } } @@ -73,18 +75,15 @@ int main(int argc, const char **argv) { int ret = 0; - DEFINE_CONF_VARS(usage); vector<const char*> args; argv_to_vec(argc, argv, args); env_to_vec(args); + parse_gceph_args(args); global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); - vec_to_argv(args, argc, argv); - parse_gceph_args(args); - ctx = ceph_tool_common_init(CEPH_TOOL_MODE_GUI, false); if (!ctx) { derr << "cephtool_common_init failed." << dendl; |