forked from Pinkyboi/IRC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (30 loc) · 725 Bytes
/
main.cpp
File metadata and controls
35 lines (30 loc) · 725 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
#include "Server.hpp"
#include <csignal>
void sig_handler(int signo)
{
if (signo == SIGINT)
{
std::cout << "Server shutting down..." << std::endl;
Server::deleteInstance();
exit(0);
}
}
int main(int argc, char **argv)
{
if (argc != 3)
std::cout << "Usage: ./ircserv <port> <pass>" << std::endl;
else
{
try {
signal(SIGINT, sig_handler);
Server::initServer(argv[1], argv[2]);
Server *serv = Server::getInstance();
serv->setup();
serv->start();
}
catch (Server::ServerException & e) {
std::cout << "ircserv: " << e.what() << std::endl;
}
}
return (0);
}