diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/main.cpp | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2 cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip |
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/src/main.cpp b/src/main.cpp index dd84e3be4..a7bb05d0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,17 +33,32 @@ static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & a { // Parse the comand line args: TCLAP::CmdLine cmd("Cuberite"); - TCLAP::ValueArg<int> slotsArg ("s", "max-players", "Maximum number of slots for the server to use, overrides setting in setting.ini", false, -1, "number", cmd); - TCLAP::ValueArg<AString> confArg ("c", "config-file", "Config file to use", false, "settings.ini", "string", cmd); - TCLAP::MultiArg<int> portsArg ("p", "port", "The port number the server should listen to", false, "port", cmd); - TCLAP::SwitchArg commLogArg ("", "log-comm", "Log server client communications to file", cmd); - TCLAP::SwitchArg commLogInArg ("", "log-comm-in", "Log inbound server client communications to file", cmd); - TCLAP::SwitchArg commLogOutArg ("", "log-comm-out", "Log outbound server client communications to file", cmd); - TCLAP::SwitchArg crashDumpFull ("", "crash-dump-full", "Crashdumps created by the server will contain full server memory", cmd); - TCLAP::SwitchArg crashDumpGlobals("", "crash-dump-globals", "Crashdumps created by the server will contain the global variables' values", cmd); - TCLAP::SwitchArg noBufArg ("", "no-output-buffering", "Disable output buffering", cmd); - TCLAP::SwitchArg noFileLogArg ("", "no-log-file", "Disable logging to file", cmd); - TCLAP::SwitchArg runAsServiceArg ("d", "service", "Run as a service on Windows, or daemon on UNIX like systems", cmd); + TCLAP::ValueArg<int> slotsArg( + "s", + "max-players", + "Maximum number of slots for the server to use, overrides setting in setting.ini", + false, + -1, + "number", + cmd + ); + TCLAP::ValueArg<AString> confArg("c", "config-file", "Config file to use", false, "settings.ini", "string", cmd); + TCLAP::MultiArg<int> portsArg("p", "port", "The port number the server should listen to", false, "port", cmd); + TCLAP::SwitchArg commLogArg("", "log-comm", "Log server client communications to file", cmd); + TCLAP::SwitchArg commLogInArg("", "log-comm-in", "Log inbound server client communications to file", cmd); + TCLAP::SwitchArg commLogOutArg("", "log-comm-out", "Log outbound server client communications to file", cmd); + TCLAP::SwitchArg + crashDumpFull("", "crash-dump-full", "Crashdumps created by the server will contain full server memory", cmd); + TCLAP::SwitchArg crashDumpGlobals( + "", + "crash-dump-globals", + "Crashdumps created by the server will contain the global variables' values", + cmd + ); + TCLAP::SwitchArg noBufArg("", "no-output-buffering", "Disable output buffering", cmd); + TCLAP::SwitchArg noFileLogArg("", "no-log-file", "Disable logging to file", cmd); + TCLAP::SwitchArg + runAsServiceArg("d", "service", "Run as a service on Windows, or daemon on UNIX like systems", cmd); cmd.parse(argc, argv); // Copy the parsed args' values into a settings repository: @@ -59,7 +74,7 @@ static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & a } if (portsArg.isSet()) { - for (auto port: portsArg.getValue()) + for (auto port : portsArg.getValue()) { a_Settings.AddValue("Server", "Ports", std::to_string(port)); } @@ -117,10 +132,7 @@ static int UniversalMain(int argc, char * argv[], const bool a_RunningAsService) MiniDumpWriter::Register(); } - ~MiniDumpWriterRAII() - { - MiniDumpWriter::Unregister(); - } + ~MiniDumpWriterRAII() { MiniDumpWriter::Unregister(); } } MiniDumpWriter; const struct SleepResolutionBoosterRAII @@ -131,10 +143,7 @@ static int UniversalMain(int argc, char * argv[], const bool a_RunningAsService) SleepResolutionBooster::Register(); } - ~SleepResolutionBoosterRAII() - { - SleepResolutionBooster::Unregister(); - } + ~SleepResolutionBoosterRAII() { SleepResolutionBooster::Unregister(); } } SleepResolutionBooster; // Register signal handlers, enabling graceful shutdown from the terminal: @@ -211,11 +220,10 @@ static int UniversalMain(int argc, char * argv[], const bool a_RunningAsService) int main(int argc, char ** argv) { #if !defined(NDEBUG) && defined(_MSC_VER) - _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); - // _X: The simple built-in CRT leak finder - simply break when allocating the Nth block ({N} is listed in the leak output) - // Only useful when the leak is in the same sequence all the time - // _CrtSetBreakAlloc(85950); + // _X: The simple built-in CRT leak finder - simply break when allocating the Nth block ({N} is listed in the leak + // output) Only useful when the leak is in the same sequence all the time _CrtSetBreakAlloc(85950); #endif // !NDEBUG && _MSC_VER |