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

index 3aa620c764338c038da59e8d4d7eddee15467f4d..c07514c2f0217dcccc23e8830f657ef1d2df25f1 100644 (file)
@@ -31,11 +31,28 @@ ArgvMap &arg()
   return arg;
 }
 
+void usage() {
+  cerr<<"Syntax: notify IP_ADDRESS[:PORT] DOMAIN"<<endl;
+}
+
 int main(int argc, char** argv)
 try
 {
+
+  for(int n=1 ; n < argc; ++n) {
+    if ((string) argv[n] == "--help") {
+      usage();
+      return EXIT_SUCCESS;
+    }
+
+    if ((string) argv[n] == "--version") {
+      cerr<<"notify "<<VERSION<<endl;
+      return EXIT_SUCCESS;
+    }
+  }
+
   if(argc!=3) {
-    cerr<<"Syntax: notify ip:port domain"<<endl;
+    usage();
     exit(1);
   }