begin rewrite: add lionkor/commandline

This commit is contained in:
Lion Kortlepel
2021-02-14 13:03:59 +01:00
committed by Anonymous275
parent 6a2ce7faab
commit e5e447c7af
43 changed files with 120 additions and 3536 deletions

View File

@@ -1,50 +1,12 @@
#include "CustomAssert.h"
#include "Settings.h"
#include "Startup.h"
#include <atomic>
#include <functional>
#include <iostream>
#include <thread>
#ifndef WIN32
#include <csignal>
void UnixSignalHandler(int sig) {
switch (sig) {
case SIGPIPE:
warn(("ignored signal SIGPIPE: Pipe broken"));
break;
default:
error(("Signal arrived in handler but was not handled: ") + std::to_string(sig));
break;
}
}
#endif // WIN32
[[noreturn]] void loop() {
DebugPrintTID();
#include "TConsole.h"
int main(int argc, char** argv) {
TConsole Console;
while (true) {
std::cout.flush();
std::this_thread::sleep_for(std::chrono::milliseconds(600));
}
}
int main(int argc, char* argv[]) {
#ifndef WIN32
// ignore SIGPIPE, the signal that is sent for example when a client
// disconnects while data is being sent to him ("broken pipe").
signal(SIGPIPE, UnixSignalHandler);
#endif // WIN32
DebugPrintTID();
#ifdef DEBUG
std::thread t1(loop);
t1.detach();
#endif
StartTime = std::chrono::high_resolution_clock::now();
ConsoleInit();
InitServer(argc, argv);
InitConfig();
InitLua();
InitRes();
HBInit();
StatInit();
NetMain();
return 0;
}