-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (34 loc) · 1.36 KB
/
Copy pathmain.cpp
File metadata and controls
42 lines (34 loc) · 1.36 KB
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
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmaila <mmaila@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/05 18:40:52 by nazouz #+# #+# */
/* Updated: 2025/03/08 19:31:10 by mmaila ### ########.fr */
/* */
/* ************************************************************************** */
#include "./HTTPServer/Webserv.hpp"
#include "./Config/Config.hpp"
#include "signal.h"
void handleINT(int sig)
{
(void)sig;
Webserv::stop();
}
int main(int argc, char **argv)
{
if (argc != 2)
return (std::cerr << BOLD << "usage: Webserv <config file>" << RESET << std::endl, 1);
signal(SIGINT, handleINT);
signal(SIGPIPE, SIG_IGN);
Config conf;
if (!conf.parse(argv[1]))
return (1);
Webserv Main(conf.getServers());
if (!Main.initServers())
return (1);
Main.run();
return (0);
}