Make port configurable

This commit is contained in:
Changhua
2023-04-08 22:52:35 +08:00
parent dd02c4b6ff
commit b643f92681
8 changed files with 33 additions and 35 deletions
+9 -3
View File
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "framework.h"
@@ -6,7 +7,10 @@
#include "log.h"
#include "sdk.h"
void help() { LOG_INFO("Usage: \n启动: wcf.exe start url [debug]\n关闭: wcf.exe stop"); }
void help()
{
LOG_INFO("\nUsage: \n启动: wcf.exe start port [debug]\n关闭: wcf.exe stop\nport: 命令端口, 消息端口为命令端口+1\n");
}
int main(int argc, char *argv[])
{
@@ -16,11 +20,13 @@ int main(int argc, char *argv[])
if ((argc < 2) || (argc > 4)) {
help();
} else if (argc == 4) {
debug = (strcmp(argv[2], "debug") == 0);
debug = (strcmp(argv[3], "debug") == 0);
}
if (strcmp(argv[1], "start") == 0) {
ret = WxInitSDK(debug, argv[2]);
int port = strtol(argv[2], NULL, 10);
ret = WxInitSDK(debug, port);
} else if (strcmp(argv[1], "stop") == 0) {
ret = WxDestroySDK();
} else {