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

index f9a0afc3347a8199b6242553a6b55ea6e897cde4..084839d45158122d361a6c241ed5972fd3d276c4 100644 (file)
@@ -25,6 +25,10 @@ using namespace ::boost::multi_index;
 #include "namespaces.hh"
 StatBag S;
 
+void usage() {
+  cerr<<"syntax: dnsscan INFILE ..."<<endl;
+}
+
 int main(int argc, char** argv)
 try
 {
@@ -37,8 +41,20 @@ try
   */
 
   if(argc<2) {
-    cerr<<"Syntax: dnsscan file1 [file2 ..] "<<endl;
-    exit(1);
+    usage();
+    exit(EXIT_SUCCESS);
+  }
+
+  for(int n=1; n < argc; ++n) {
+    if ((string) argv[n] == "--help") {
+      usage();
+      return EXIT_SUCCESS;
+    }
+
+    if ((string) argv[n] == "--version") {
+      cerr<<"dnsscan "<<VERSION<<endl;
+      return EXIT_SUCCESS;
+    }
   }
 
   unsigned int counts[256];