From c49fb35a886432ecb462f803b048157d06b8d9cc Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 24 Oct 2012 15:56:15 -0700 Subject: [PATCH] Wow. Our 'main' function is almost impossible to modify. --- src/main.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6c6356160..360c07857 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,7 +84,6 @@ int main(int argc, char* argv[]) { int iResult = 0; po::variables_map vm; // Map of options. - bool bTest = false; // // Set up option parsing. @@ -117,15 +116,11 @@ int main(int argc, char* argv[]) iResult = 2; } + if (iResult) { nothing(); } - else if (argc >= 2 && !strcmp(argv[1], "--test")) - { - bTest = true; - Log::setMinSeverity(lsTRACE, true); - } else { // Parse options, if no error. @@ -143,11 +138,18 @@ int main(int argc, char* argv[]) } } + if (vm.count("verbose")) Log::setMinSeverity(lsTRACE, true); - else if (!bTest) + else Log::setMinSeverity(lsWARNING, true); + if (vm.count("test")) + { + unit_test_main(init_unit_test, argc, argv); + return 0; + } + if (!iResult) { theConfig.setup(vm.count("conf") ? vm["conf"].as() : ""); @@ -170,15 +172,6 @@ int main(int argc, char* argv[]) { iResult = 1; } - else if (vm.count("test")) - { - std::cerr << "--test must be first parameter." << std::endl; - iResult = 1; - } - else if (bTest) - { - iResult = unit_test_main(init_unit_test, argc, argv); - } else if (!vm.count("parameters")) { // No arguments. Run server.