6 |
|
|
7 |
|
#include "Smersh.hpp" |
8 |
|
#include "Matcher.hpp" |
9 |
+ |
#include "Person.hpp" |
10 |
+ |
#include "Daemon.hpp" |
11 |
+ |
#include "Redirector.hpp" |
12 |
+ |
|
13 |
+ |
string program; |
14 |
+ |
bool debug(false); |
15 |
|
|
16 |
|
int main(int argc, char* argv[]) |
17 |
|
{ |
18 |
< |
Smersh smersh; |
18 |
> |
program = argv[0]; |
19 |
> |
|
20 |
> |
int port(8080); |
21 |
> |
bool daemon(false), redirector(false); |
22 |
> |
string redirect; |
23 |
> |
|
24 |
> |
for (int index(1); index < argc; ++index) |
25 |
> |
{ |
26 |
> |
string arg(argv[index]); |
27 |
> |
Matcher matcher; |
28 |
> |
|
29 |
> |
if (arg == "-D") |
30 |
> |
{ |
31 |
> |
if (!debug) debug = true; |
32 |
> |
} |
33 |
> |
else if (arg == "-daemon") |
34 |
> |
{ |
35 |
> |
if (!daemon) daemon = true; |
36 |
> |
} |
37 |
> |
else if (arg == matcher("^-redirector=(.+)$")) |
38 |
> |
{ |
39 |
> |
if (!redirector) redirector = true; |
40 |
> |
|
41 |
> |
redirect = matcher[1]; |
42 |
> |
} |
43 |
> |
else if (arg == matcher("^-port=([0-9]+)$")) |
44 |
> |
{ |
45 |
> |
port = lexical_cast<int>(matcher[1]); |
46 |
> |
} |
47 |
> |
} |
48 |
> |
|
49 |
> |
if (daemon) |
50 |
> |
{ |
51 |
> |
Daemon daemon(port); |
52 |
> |
} |
53 |
> |
else if (redirector) |
54 |
> |
{ |
55 |
> |
Redirector redirector(port, redirect); |
56 |
> |
} |
57 |
> |
else |
58 |
> |
{ |
59 |
> |
Smersh smersh; |
60 |
> |
} |
61 |
|
|
62 |
|
return 0; |
63 |
|
} |