]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: add --show-args option
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 22 May 2012 20:53:11 +0000 (13:53 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 22 May 2012 20:53:11 +0000 (13:53 -0700)
The --show-args dumps the arguments passed on the command line.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/ceph_argparse.cc

index 75b413d60edaa27c701c4484b4bc9c15543b1847..22343271e5e6c1964f04921a89dc1218f5c4453a 100644 (file)
@@ -343,6 +343,9 @@ CephInitParameters ceph_argparse_early_args
 {
   CephInitParameters iparams(module_type);
   std::string val;
+
+  vector<const char *> orig_args = args;
+
   for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
     if (strcmp(*i, "--") == 0) {
       /* Normally we would use ceph_argparse_double_dash. However, in this
@@ -375,6 +378,15 @@ CephInitParameters ceph_argparse_early_args
        _exit(1);
       }
     }
+    else if (ceph_argparse_flag(args, i, "--show_args", (char*)NULL)) {
+      cout << "args: ";
+      for (std::vector<const char *>::iterator ci = orig_args.begin(); ci != orig_args.end(); ++ci) {
+        if (ci != orig_args.begin())
+          cout << " ";
+        cout << *ci;
+      }
+      cout << std::endl;
+    }
     else {
       // ignore
       ++i;