Wow. Our 'main' function is almost impossible to modify.

This commit is contained in:
JoelKatz
2012-10-24 15:56:15 -07:00
parent 253e3f5243
commit c49fb35a88

View File

@@ -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.