-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
39 lines (34 loc) · 799 Bytes
/
main.cpp
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 "Server.hpp"
#include <ctime>
// int parsing(char **av)
// {
// for (int i = 0; av[1][i] != '\0'; i++)
// {
// if (!isdigit(av[1][i]))
// {
// std::cout << "Please enter a valid port number" << std::endl;
// return 1;
// }
// }
// }
int main(int ac, char **av){
if(ac != 3)
{
std::cout << "Correct usage is ./irc [port] [password]" << std::endl;
return 1;
}
// if (parsing(av))
// return 1;
Server ser(std::atoi(av[1]), av[2]);
std::time_t serv_timeCreation = std::time(NULL);
ser.set_time(std::ctime(&serv_timeCreation));
try{
ser.execution();
}
catch(std::string e)
{
std::cout << e << std::endl;
return 1;
}
return 0;
}