mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Wow. Our 'main' function is almost impossible to modify.
This commit is contained in:
25
src/main.cpp
25
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<std::string>() : "");
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user