-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (30 loc) · 726 Bytes
/
main.cpp
File metadata and controls
33 lines (30 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <fstream>
#include <sstream>
#include <signal.h>
#include <csignal>
#include "include/ServerConf.hpp"
#include "include/Parser.hpp"
#include "include/CheckConfig.hpp"
#include "include/Tokenizer.hpp"
bool g_signal = false;
void signalHandler(int signum)
{
if (signum == SIGINT || signum == SIGTERM)
g_signal = true;
}
int main(int ac, char **av)
{
if (ac != 2)
{
std::cerr << "Usage: " << av[0] << " <config_file>" << std::endl;
return 1;
}
signal(SIGINT, signalHandler);
signal(SIGTERM, signalHandler);
signal(SIGPIPE, SIG_IGN);
std::cout << BLUE << "🚀 Initializing server" << RESET << std::endl;
CheckConfig checkConf(av[1]);
checkConf.checkConfig();
return 0;
}