Skip to content

Commit ff5ba4f

Browse files
committed
to ask for help is not an error
1 parent 2dfd6b6 commit ff5ba4f

File tree

8 files changed

+41
-16
lines changed

8 files changed

+41
-16
lines changed

pdns/dynloader.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ int main(int argc, char **argv)
7070
::arg().laxParse(argc,argv);
7171

7272
if(::arg().mustDo("help")) {
73-
cerr<<"syntax:"<<endl<<endl;
74-
cerr<<::arg().helpstring(::arg()["help"])<<endl;
75-
exit(99);
73+
cout<<"syntax:"<<endl<<endl;
74+
cout<<::arg().helpstring(::arg()["help"])<<endl;
75+
exit(0);
7676
}
7777

7878
const vector<string>commands=::arg().getCommands();

pdns/pdns_recursor.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,9 +2185,9 @@ int main(int argc, char **argv)
21852185
::arg().set("delegation-only")=toLower(::arg()["delegation-only"]);
21862186

21872187
if(::arg().mustDo("help")) {
2188-
cerr<<"syntax:"<<endl<<endl;
2189-
cerr<<::arg().helpstring(::arg()["help"])<<endl;
2190-
exit(99);
2188+
cout<<"syntax:"<<endl<<endl;
2189+
cout<<::arg().helpstring(::arg()["help"])<<endl;
2190+
exit(0);
21912191
}
21922192
if(::arg().mustDo("version")) {
21932193
showProductVersion();

pdns/pdnssec.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ void loadMainConfig(const std::string& configdir)
118118
//::arg().laxParse(argc,argv);
119119

120120
if(::arg().mustDo("help")) {
121-
cerr<<"syntax:"<<endl<<endl;
122-
cerr<<::arg().helpstring(::arg()["help"])<<endl;
123-
exit(99);
121+
cout<<"syntax:"<<endl<<endl;
122+
cout<<::arg().helpstring(::arg()["help"])<<endl;
123+
exit(0);
124124
}
125125

126126
if(::arg()["config-name"]!="")

pdns/rec_control.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ static void initArguments(int argc, char** argv)
4949
arg().setCmd("help","Provide this helpful message");
5050

5151
arg().laxParse(argc,argv);
52-
if(arg().getCommands().empty() || arg().mustDo("help")) {
52+
if(arg().mustDo("help")) {
53+
cout<<"syntax: rec_control [options] command, options as below: "<<endl<<endl;
54+
cout<<arg().helpstring(arg()["help"])<<endl;
55+
exit(0);
56+
}
57+
58+
if(arg().getCommands().empty()) {
5359
cerr<<"syntax: rec_control [options] command, options as below: "<<endl<<endl;
5460
cerr<<arg().helpstring(arg()["help"])<<endl;
5561
exit(99);

pdns/receiver.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ int main(int argc, char **argv)
509509
}
510510

511511
if(::arg().mustDo("help")) {
512-
cerr<<"syntax:"<<endl<<endl;
513-
cerr<<::arg().helpstring(::arg()["help"])<<endl;
514-
exit(99);
512+
cout<<"syntax:"<<endl<<endl;
513+
cout<<::arg().helpstring(::arg()["help"])<<endl;
514+
exit(0);
515515
}
516516

517517
if(::arg().mustDo("config")) {

pdns/zone2json.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ try
155155

156156
::arg().parse(argc, argv);
157157

158-
if(argc<2 || ::arg().mustDo("help")) {
158+
if(::arg().mustDo("help")) {
159+
cout<<"syntax:"<<endl<<endl;
160+
cout<<::arg().helpstring()<<endl;
161+
exit(0);
162+
}
163+
164+
if(argc<2) {
159165
cerr<<"syntax:"<<endl<<endl;
160166
cerr<<::arg().helpstring()<<endl;
161167
exit(1);

pdns/zone2ldap.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ int main( int argc, char* argv[] )
169169

170170
args.parse( argc, argv );
171171

172-
if( argc < 2 || args.mustDo( "help" ) )
172+
if( args.mustDo( "help" ) )
173+
{
174+
cout << "Syntax:" << endl << endl;
175+
cout << args.helpstring() << endl;
176+
exit( 0 );
177+
}
178+
179+
if( argc < 2 )
173180
{
174181
cerr << "Syntax:" << endl << endl;
175182
cerr << args.helpstring() << endl;

pdns/zone2sql.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ try
291291

292292
::arg().parse(argc, argv);
293293

294-
if(argc<2 || ::arg().mustDo("help")) {
294+
if(::arg().mustDo("help")) {
295+
cout<<"syntax:"<<endl<<endl;
296+
cout<<::arg().helpstring()<<endl;
297+
exit(0);
298+
}
299+
300+
if(argc<2) {
295301
cerr<<"syntax:"<<endl<<endl;
296302
cerr<<::arg().helpstring()<<endl;
297303
exit(1);

0 commit comments

Comments
 (0)