]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add --help and --version to dumresp
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 29 Apr 2016 15:36:39 +0000 (17:36 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 29 Apr 2016 15:36:39 +0000 (17:36 +0200)
pdns/dumresp.cc

index b9d26f0d87dffd35e86945aabd9bb2b7af8f7743..fc556ce8090d9c91deb1f50a0b43c129c4703216 100644 (file)
@@ -21,15 +21,30 @@ void printStatus()
   }
 }
 
+void usage() {
+  cerr<<"Syntax: dumresp LOCAL-ADDRESS LOCAL-PORT NUMBER-OF-PROCESSES"<<endl;
+}
+
 int main(int argc, char** argv)
 try
 {
+  for(int i = 1; i < argc; i++) {
+    if((string) argv[i] == "--help"){
+      usage();
+      return(EXIT_SUCCESS);
+    }
+
+    if((string) argv[i] == "--version"){
+      cerr<<"dumresp "<<VERSION<<endl;
+      return(EXIT_SUCCESS);
+    }
+  }
+
   if(argc != 4) {
-    cerr<<"Syntax: dumresp local-address local-port number-of-processes "<<endl;
+    usage();
     exit(EXIT_FAILURE);
   }
 
-
   auto ptr = mmap(NULL, sizeof(std::atomic<uint64_t>), PROT_READ | PROT_WRITE,
                  MAP_SHARED | MAP_ANONYMOUS, -1, 0);