-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (34 loc) · 753 Bytes
/
main.cpp
File metadata and controls
39 lines (34 loc) · 753 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
34
35
36
37
38
39
#include "conf/Lexer.hpp"
#include "conf/Parser.hpp"
#include "cgi/cgi.hpp"
#include "server/Server.hpp"
#include "server/Socket.hpp"
#include "server/Client.hpp"
int main(int ac, char **av)
{
signal(SIGPIPE, SIG_IGN);
Lexer a;
if (ac > 2)
{
std::cerr << "Error!" << std::endl;
}
try
{
if(av[1])
a.start(av[1]);
else
a.start(NULL);
}
catch(std::exception & e)
{
std::cerr << e.what() << std::endl;
return 1;
}
Socket socket;
Server server;
const std::vector<Parser *> *servers = a.getparserv();
std::vector<std::pair<Socket, Parser *> > final_servers;
socket.createServers(servers, final_servers);
server.handleServers(final_servers);
return 0;
}