]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: fix argument parsing to allow commands with '-' in them
authorSage Weil <sage@newdream.net>
Fri, 13 Mar 2009 19:50:06 +0000 (12:50 -0700)
committerSage Weil <sage@newdream.net>
Fri, 13 Mar 2009 19:50:06 +0000 (12:50 -0700)
src/ceph.cc

index 3ef5b57f25dd200ffb496d54828e8db388f49ae4..4dd7f8ba3bad870fa1cf698898914030ec3f48ae 100644 (file)
@@ -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]);