From 89565bacd17453c1ce2a8cff7cf6ea5822a262f5 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 2 Apr 2012 14:34:21 +0200 Subject: [PATCH] since the default method is not available in older boost we should check by ourselfs if the options are given and dont use notify --- apps/mwiniimporter/main.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 9a6e61645d..43b17b76ac 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -9,7 +9,7 @@ namespace bpo = boost::program_options; int main(int argc, char *argv[]) { - bpo::options_description desc("Syntax: mwiniimporter \nAllowed options"); + bpo::options_description desc("Syntax: mwiniimporter -i inifile -c configfile \nAllowed options"); desc.add_options() ("help,h", "produce help message") ("verbose,v", "verbose output") @@ -20,25 +20,11 @@ int main(int argc, char *argv[]) { ; bpo::variables_map vm; - try { - bpo::store(boost::program_options::parse_command_line(argc, argv, desc), vm); + bpo::store(boost::program_options::parse_command_line(argc, argv, desc), vm); - // parse help before calling notify because we dont want it to throw an error if help is set - if(vm.count("help")) { - std::cout << desc; - return 0; - } - - bpo::notify(vm); - - } - catch(std::exception& e) { - std::cerr << "Error:" << e.what() << std::endl; - return -1; - } - catch(...) { - std::cerr << "Error" << std::endl; - return -2; + if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) { + std::cout << desc; + return 0; } std::string iniFile = vm["ini"].as();