WeChatFerry/wcf/main.cpp

37 lines
750 B
C++
Raw Normal View History

2023-02-25 01:53:02 +08:00
#include <stdio.h>
2023-04-08 22:52:35 +08:00
#include <stdlib.h>
2023-02-25 01:53:02 +08:00
#include <string.h>
2023-02-25 02:11:04 +08:00
#include "framework.h"
#include "log.h"
2023-02-25 01:53:02 +08:00
#include "sdk.h"
2023-04-08 22:52:35 +08:00
void help()
{
LOG_INFO("\nUsage: \n启动: wcf.exe start port [debug]\n关闭: wcf.exe stop\nport: 命令端口, 消息端口为命令端口+1\n");
}
2023-02-25 01:53:02 +08:00
int main(int argc, char *argv[])
{
int ret = -1;
bool debug = false;
2023-02-25 02:11:04 +08:00
2023-04-08 18:58:10 +08:00
if ((argc < 2) || (argc > 4)) {
2023-02-25 01:53:02 +08:00
help();
2023-04-08 18:58:10 +08:00
} else if (argc == 4) {
2023-04-08 22:52:35 +08:00
debug = (strcmp(argv[3], "debug") == 0);
2023-02-25 01:53:02 +08:00
}
if (strcmp(argv[1], "start") == 0) {
2023-04-08 22:52:35 +08:00
int port = strtol(argv[2], NULL, 10);
ret = WxInitSDK(debug, port);
2023-02-25 01:53:02 +08:00
} else if (strcmp(argv[1], "stop") == 0) {
ret = WxDestroySDK();
} else {
help();
}
return ret;
}