From 6b2cb3ab1d9e9cf09e2f6a6e8a119105adccbc00 Mon Sep 17 00:00:00 2001 From: mes5k Date: Sun, 26 Nov 2006 18:32:04 +0000 Subject: [PATCH] moved exit from CmdLine to StdOutput to provide users more control over when/how the exit happens --- include/tclap/CmdLine.h | 2 +- include/tclap/DocBookOutput.h | 1 + include/tclap/StdOutput.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h index 6634358..bb6eb5c 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h @@ -418,7 +418,7 @@ inline void CmdLine::parse(int argc, char** argv) if ( requiredCount > _numRequired ) throw(CmdLineParseException("Too many arguments!")); - } catch ( ArgException& e ) { _output->failure(*this,e); exit(1); } + } catch ( ArgException& e ) { _output->failure(*this,e); } } inline bool CmdLine::_emptyCombined(const std::string& s) diff --git a/include/tclap/DocBookOutput.h b/include/tclap/DocBookOutput.h index c9d00bc..c833c08 100644 --- a/include/tclap/DocBookOutput.h +++ b/include/tclap/DocBookOutput.h @@ -192,6 +192,7 @@ inline void DocBookOutput::failure( CmdLineInterface& _cmd, ArgException& e ) { std::cout << e.what() << std::endl; + exit(1); } inline void DocBookOutput::substituteSpecialChars( std::string& s, diff --git a/include/tclap/StdOutput.h b/include/tclap/StdOutput.h index 0162cb3..6216c24 100644 --- a/include/tclap/StdOutput.h +++ b/include/tclap/StdOutput.h @@ -148,6 +148,7 @@ inline void StdOutput::failure( CmdLineInterface& _cmd, else usage(_cmd); + exit(1); } inline void StdOutput::_shortUsage( CmdLineInterface& _cmd,