mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-14 02:10:06 +00:00
parent
c6ffcd4804
commit
bc1153c97e
19
src/main.cpp
19
src/main.cpp
@ -63,8 +63,20 @@ void terminate(int arg) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifdef _WIN32
|
||||||
|
static BOOL winTerminate(DWORD arg) {
|
||||||
|
terminate(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void initsignals() {
|
void initsignals() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (!SetConsoleCtrlHandler(winTerminate, TRUE)) {
|
||||||
|
std::cerr << "[FATAL] Failed to set control handler" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
|
||||||
memset((void*)&act, 0, sizeof(act));
|
memset((void*)&act, 0, sizeof(act));
|
||||||
@ -82,8 +94,8 @@ void initsignals() {
|
|||||||
perror("sigaction");
|
perror("sigaction");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -92,9 +104,8 @@ int main() {
|
|||||||
std::cerr << "OpenFusion: WSAStartup failed" << std::endl;
|
std::cerr << "OpenFusion: WSAStartup failed" << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
initsignals();
|
|
||||||
#endif
|
#endif
|
||||||
|
initsignals();
|
||||||
settings::init();
|
settings::init();
|
||||||
|
|
||||||
std::cout << "[INFO] OpenFusion v" GIT_VERSION << std::endl;
|
std::cout << "[INFO] OpenFusion v" GIT_VERSION << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user