summaryrefslogtreecommitdiffstats
path: root/Tools/ProtoProxy/ProtoProxy.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-08-24 21:45:03 +0200
committerMattes D <github@xoft.cz>2016-08-24 22:26:53 +0200
commitd2e8643607424cd74616e2e863f5609e7b8458a5 (patch)
treed5afab6035ca6bb0b58fd03ad5cfe3b3f8e1da55 /Tools/ProtoProxy/ProtoProxy.cpp
parentMerge pull request #3342 from cuberite/FixEmptyHeader (diff)
downloadcuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.gz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.bz2
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.lz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.xz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.zst
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.zip
Diffstat (limited to 'Tools/ProtoProxy/ProtoProxy.cpp')
-rw-r--r--Tools/ProtoProxy/ProtoProxy.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/Tools/ProtoProxy/ProtoProxy.cpp b/Tools/ProtoProxy/ProtoProxy.cpp
index 06a486778..ac5858d02 100644
--- a/Tools/ProtoProxy/ProtoProxy.cpp
+++ b/Tools/ProtoProxy/ProtoProxy.cpp
@@ -27,14 +27,29 @@ int main(int argc, char ** argv)
cLogger::InitiateMultithreading();
- int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564;
- int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565;
- printf("Initializing ProtoProxy. Listen port %d, connect port %d.\n", ListenPort, ConnectPort);
+ UInt16 ListenPort = 25564;
+ UInt16 ConnectPort = 25565;
+ if (argc > 1)
+ {
+ if (!StringToInteger(argv[1], ListenPort))
+ {
+ LOGERROR("Invalid argument 1, expected port number, got \"%s\". Aborting.", argv[1]);
+ return 1;
+ }
+ if (argc > 2)
+ {
+ if (!StringToInteger(argv[2], ConnectPort))
+ {
+ LOGERROR("Invalid argument 2, expected port number, got \"%s\". Aborting.", argv[2]);
+ return 2;
+ }
+ }
+ }
cServer Server;
int res = Server.Init(ListenPort, ConnectPort);
if (res != 0)
{
- printf("Server initialization failed: %d", res);
+ LOGERROR("Server initialization failed: %d", res);
return res;
}