diff options
author | HaoTNN <haotnn@gmail.com> | 2015-05-23 23:06:37 +0200 |
---|---|---|
committer | HaoTNN <haotnn@gmail.com> | 2015-05-23 23:06:37 +0200 |
commit | 2578afb2449ac27defb3ac9dcc3d140e980d0d1a (patch) | |
tree | 4f8e0f52f39c1eb3189680b0395134d4b72a2228 /src/main.cpp | |
parent | Merge remote-tracking branch 'upstream/master' (diff) | |
parent | Merge pull request #2107 from mc-server/cow-waterspawn (diff) | |
download | cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.gz cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.bz2 cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.lz cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.xz cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.zst cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.zip |
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/src/main.cpp b/src/main.cpp index 8a237b8ee..5cd057278 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -374,6 +374,14 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv) 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 noBufArg("", "no-output-buffering", "Disable output buffering", cmd); + cmd.parse(argc, argv); auto repo = cpp14::make_unique<cMemorySettingsRepository>(); @@ -396,6 +404,22 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv) } } + if (commLogArg.getValue()) + { + g_ShouldLogCommIn = true; + g_ShouldLogCommOut = true; + } + else + { + g_ShouldLogCommIn = commLogInArg.getValue(); + g_ShouldLogCommOut = commLogOutArg.getValue(); + } + + if (noBufArg.getValue()) + { + setvbuf(stdout, nullptr, _IONBF, 0); + } + repo->SetReadOnly(); return repo; @@ -473,35 +497,7 @@ int main(int argc, char **argv) for (int i = 0; i < argc; i++) { AString Arg(argv[i]); - if ( - (NoCaseCompare(Arg, "/commlog") == 0) || - (NoCaseCompare(Arg, "/logcomm") == 0) - ) - { - g_ShouldLogCommIn = true; - g_ShouldLogCommOut = true; - } - else if ( - (NoCaseCompare(Arg, "/commlogin") == 0) || - (NoCaseCompare(Arg, "/comminlog") == 0) || - (NoCaseCompare(Arg, "/logcommin") == 0) - ) - { - g_ShouldLogCommIn = true; - } - else if ( - (NoCaseCompare(Arg, "/commlogout") == 0) || - (NoCaseCompare(Arg, "/commoutlog") == 0) || - (NoCaseCompare(Arg, "/logcommout") == 0) - ) - { - g_ShouldLogCommOut = true; - } - else if (NoCaseCompare(Arg, "nooutbuf") == 0) - { - setvbuf(stdout, nullptr, _IONBF, 0); - } - else if (NoCaseCompare(Arg, "/service") == 0) + if (NoCaseCompare(Arg, "/service") == 0) { cRoot::m_RunAsService = true; } |