From bb167e50bdae78b81f67bb93c8a3af4440158873 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 31 Aug 2011 18:15:20 -0700 Subject: [PATCH] gceph tool: convert to new-style arg parsing Signed-off-by: Colin McCabe --- src/tools/gceph.cc | 21 ++++++++++----------- 1 file 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 &args) +static void parse_gceph_args(vector &args) { - DEFINE_CONF_VARS(usage); - FOR_EACH_ARG(args) { - if (CEPH_ARGPARSE_EQ("help", 'h')) { + std::vector::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 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; -- 2.47.3