Changes in lemon/arg_parser.cc [956:141f9c0db4a3:311:c887e703b566] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/arg_parser.cc
r956 r311 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 105 * Copyright (C) 2003-2008 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 21 21 namespace lemon { 22 22 23 void ArgParser::_terminate(ArgParserException::Reason reason) const24 {25 if(_exit_on_problems)26 exit(1);27 else throw(ArgParserException(reason));28 }29 30 31 23 void ArgParser::_showHelp(void *p) 32 24 { 33 25 (static_cast<ArgParser*>(p))->showHelp(); 34 (static_cast<ArgParser*>(p))->_terminate(ArgParserException::HELP);26 exit(1); 35 27 } 36 28 37 29 ArgParser::ArgParser(int argc, const char * const *argv) 38 :_argc(argc), _argv(argv), _command_name(argv[0]), 39 _exit_on_problems(true) { 30 :_argc(argc), _argv(argv), _command_name(argv[0]) { 40 31 funcOption("-help","Print a short help message",_showHelp,this); 41 32 synonym("help","-help"); … … 352 343 i!=_others_help.end();++i) showHelp(i); 353 344 for(Opts::const_iterator i=_opts.begin();i!=_opts.end();++i) showHelp(i); 354 _terminate(ArgParserException::HELP);345 exit(1); 355 346 } 356 347 … … 361 352 std::cerr << "\nType '" << _command_name << 362 353 " --help' to obtain a short summary on the usage.\n\n"; 363 _terminate(ArgParserException::UNKNOWN_OPT);354 exit(1); 364 355 } 365 356 … … 424 415 std::cerr << "\nType '" << _command_name << 425 416 " --help' to obtain a short summary on the usage.\n\n"; 426 _terminate(ArgParserException::INVALID_OPT);417 exit(1); 427 418 } 428 419 }
Note: See TracChangeset
for help on using the changeset viewer.