From: Sage Weil Date: Fri, 13 Mar 2009 19:50:06 +0000 (-0700) Subject: ceph: fix argument parsing to allow commands with '-' in them X-Git-Tag: v0.7.1^2~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55d30127a6592ac1183de3efc4544716f61ab492;p=ceph.git ceph: fix argument parsing to allow commands with '-' in them --- diff --git a/src/ceph.cc b/src/ceph.cc index 3ef5b57f25d..4dd7f8ba3ba 100644 --- a/src/ceph.cc +++ b/src/ceph.cc @@ -553,9 +553,10 @@ int main(int argc, const char **argv, const char *envp[]) CONF_SAFE_SET_ARG_VAL(&observe, OPT_BOOL); } else if (CONF_ARG_EQ("poll", 'p')) { CONF_SAFE_SET_ARG_VAL(&watch, OPT_BOOL); - } else if (args[i][0] == '-') { - if (!CONF_ARG_EQ("help", 'h')) - cerr << "unrecognized option " << args[i] << std::endl; + } else if (CONF_ARG_EQ("help", 'h')) { + usage(); + } else if (args[i][0] == '-' && nargs.empty()) { + cerr << "unrecognized option " << args[i] << std::endl; usage(); } else nargs.push_back(args[i]);