mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-08-04 10:16:41 -04:00
raise ExitException instead of calling exit
This commit is contained in:
parent
ce79a6fa1c
commit
0953ea9976
@ -1,3 +1,4 @@
|
|||||||
|
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@ -192,7 +193,7 @@ inline void DocBookOutput::failure( CmdLineInterface& _cmd,
|
|||||||
ArgException& e )
|
ArgException& e )
|
||||||
{
|
{
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
exit(1);
|
throw ExitException(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DocBookOutput::substituteSpecialChars( std::string& s,
|
inline void DocBookOutput::substituteSpecialChars( std::string& s,
|
||||||
|
@ -60,7 +60,7 @@ class HelpVisitor: public Visitor
|
|||||||
* Calls the usage method of the CmdLineOutput for the
|
* Calls the usage method of the CmdLineOutput for the
|
||||||
* specified CmdLine.
|
* specified CmdLine.
|
||||||
*/
|
*/
|
||||||
void visit() { (*_out)->usage(*_cmd); exit(0); }
|
void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@ -148,10 +149,11 @@ inline void StdOutput::failure( CmdLineInterface& _cmd,
|
|||||||
else
|
else
|
||||||
usage(_cmd);
|
usage(_cmd);
|
||||||
|
|
||||||
exit(1);
|
throw ExitException(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void StdOutput::_shortUsage( CmdLineInterface& _cmd,
|
inline void
|
||||||
|
StdOutput::_shortUsage( CmdLineInterface& _cmd,
|
||||||
std::ostream& os ) const
|
std::ostream& os ) const
|
||||||
{
|
{
|
||||||
std::list<Arg*> argList = _cmd.getArgList();
|
std::list<Arg*> argList = _cmd.getArgList();
|
||||||
@ -182,10 +184,11 @@ inline void StdOutput::_shortUsage( CmdLineInterface& _cmd,
|
|||||||
if ( secondLineOffset > 75/2 )
|
if ( secondLineOffset > 75/2 )
|
||||||
secondLineOffset = static_cast<int>(75/2);
|
secondLineOffset = static_cast<int>(75/2);
|
||||||
|
|
||||||
spacePrint( std::cout, s, 75, 3, secondLineOffset );
|
spacePrint( os, s, 75, 3, secondLineOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void StdOutput::_longUsage( CmdLineInterface& _cmd,
|
inline void
|
||||||
|
StdOutput::_longUsage( CmdLineInterface& _cmd,
|
||||||
std::ostream& os ) const
|
std::ostream& os ) const
|
||||||
{
|
{
|
||||||
std::list<Arg*> argList = _cmd.getArgList();
|
std::list<Arg*> argList = _cmd.getArgList();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@ -61,7 +62,10 @@ class VersionVisitor: public Visitor
|
|||||||
* Calls the version method of the output object using the
|
* Calls the version method of the output object using the
|
||||||
* specified CmdLine.
|
* specified CmdLine.
|
||||||
*/
|
*/
|
||||||
void visit() { (*_out)->version(*_cmd); exit(0); }
|
void visit() {
|
||||||
|
(*_out)->version(*_cmd);
|
||||||
|
throw ExitException(0);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user