Permalink
Browse files

to ask for help is not an error

  • Loading branch information...
1 parent 2dfd6b6 commit ff5ba4f9e50a560411768776663d08d4c211fe98 Winfried Angele committed Apr 29, 2014
Showing with 41 additions and 16 deletions.
  1. +3 −3 pdns/dynloader.cc
  2. +3 −3 pdns/pdns_recursor.cc
  3. +3 −3 pdns/pdnssec.cc
  4. +7 −1 pdns/rec_control.cc
  5. +3 −3 pdns/receiver.cc
  6. +7 −1 pdns/zone2json.cc
  7. +8 −1 pdns/zone2ldap.cc
  8. +7 −1 pdns/zone2sql.cc
View
@@ -70,9 +70,9 @@ int main(int argc, char **argv)
::arg().laxParse(argc,argv);
if(::arg().mustDo("help")) {
- cerr<<"syntax:"<<endl<<endl;
- cerr<<::arg().helpstring(::arg()["help"])<<endl;
- exit(99);
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring(::arg()["help"])<<endl;
+ exit(0);
}
const vector<string>commands=::arg().getCommands();
@@ -2185,9 +2185,9 @@ int main(int argc, char **argv)
::arg().set("delegation-only")=toLower(::arg()["delegation-only"]);
if(::arg().mustDo("help")) {
- cerr<<"syntax:"<<endl<<endl;
- cerr<<::arg().helpstring(::arg()["help"])<<endl;
- exit(99);
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring(::arg()["help"])<<endl;
+ exit(0);
}
if(::arg().mustDo("version")) {
showProductVersion();
View
@@ -118,9 +118,9 @@ void loadMainConfig(const std::string& configdir)
//::arg().laxParse(argc,argv);
if(::arg().mustDo("help")) {
- cerr<<"syntax:"<<endl<<endl;
- cerr<<::arg().helpstring(::arg()["help"])<<endl;
- exit(99);
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring(::arg()["help"])<<endl;
+ exit(0);
}
if(::arg()["config-name"]!="")
View
@@ -49,7 +49,13 @@ static void initArguments(int argc, char** argv)
arg().setCmd("help","Provide this helpful message");
arg().laxParse(argc,argv);
- if(arg().getCommands().empty() || arg().mustDo("help")) {
+ if(arg().mustDo("help")) {
+ cout<<"syntax: rec_control [options] command, options as below: "<<endl<<endl;
+ cout<<arg().helpstring(arg()["help"])<<endl;
+ exit(0);
+ }
+
+ if(arg().getCommands().empty()) {
cerr<<"syntax: rec_control [options] command, options as below: "<<endl<<endl;
cerr<<arg().helpstring(arg()["help"])<<endl;
exit(99);
View
@@ -509,9 +509,9 @@ int main(int argc, char **argv)
}
if(::arg().mustDo("help")) {
- cerr<<"syntax:"<<endl<<endl;
- cerr<<::arg().helpstring(::arg()["help"])<<endl;
- exit(99);
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring(::arg()["help"])<<endl;
+ exit(0);
}
if(::arg().mustDo("config")) {
View
@@ -155,7 +155,13 @@ try
::arg().parse(argc, argv);
- if(argc<2 || ::arg().mustDo("help")) {
+ if(::arg().mustDo("help")) {
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring()<<endl;
+ exit(0);
+ }
+
+ if(argc<2) {
cerr<<"syntax:"<<endl<<endl;
cerr<<::arg().helpstring()<<endl;
exit(1);
View
@@ -169,7 +169,14 @@ int main( int argc, char* argv[] )
args.parse( argc, argv );
- if( argc < 2 || args.mustDo( "help" ) )
+ if( args.mustDo( "help" ) )
+ {
+ cout << "Syntax:" << endl << endl;
+ cout << args.helpstring() << endl;
+ exit( 0 );
+ }
+
+ if( argc < 2 )
{
cerr << "Syntax:" << endl << endl;
cerr << args.helpstring() << endl;
View
@@ -291,7 +291,13 @@ try
::arg().parse(argc, argv);
- if(argc<2 || ::arg().mustDo("help")) {
+ if(::arg().mustDo("help")) {
+ cout<<"syntax:"<<endl<<endl;
+ cout<<::arg().helpstring()<<endl;
+ exit(0);
+ }
+
+ if(argc<2) {
cerr<<"syntax:"<<endl<<endl;
cerr<<::arg().helpstring()<<endl;
exit(1);

0 comments on commit ff5ba4f

Please sign in to comment.