19 |
|
#include <unistd.h> |
20 |
|
} |
21 |
|
|
22 |
< |
int main(int argc, char* argv[]) |
22 |
> |
int zoe(const std::vector<const char*> args) |
23 |
|
{ |
24 |
< |
Zoe::program = argv[0]; |
24 |
> |
Zoe::program = args[0]; |
25 |
|
|
26 |
< |
for (int index(1); index < argc; ++index) |
26 |
> |
for (int index(1); index < args.size(); ++index) |
27 |
|
{ |
28 |
< |
ext::String arg(argv[index]); |
28 |
> |
ext::String arg(args[index]); |
29 |
|
Matcher matcher; |
30 |
|
|
31 |
|
if (arg == matcher("^-config=(.*)$")) |
48 |
|
{ |
49 |
|
if (!Zoe::debug) Zoe::debug = true; |
50 |
|
} |
51 |
< |
else |
52 |
< |
{ |
53 |
< |
cerr << "Usage: " << Zoe::program << " [-config=config] " |
54 |
< |
"[-collector] [-publisher] [-color] [-D]\n"; |
55 |
< |
|
56 |
< |
return 1; |
57 |
< |
} |
51 |
> |
else Zoe::usage(); |
52 |
|
} |
53 |
|
|
54 |
|
Zoe zoe; |
56 |
|
return 0; |
57 |
|
} |
58 |
|
|
59 |
+ |
int main(int argc, char* argv[]) |
60 |
+ |
{ |
61 |
+ |
std::vector<const char*> args(argv, argv + argc); |
62 |
+ |
|
63 |
+ |
return app::be::ThreadMain_(etl::BindAll(&zoe, args)); |
64 |
+ |
} |
65 |
+ |
|
66 |
|
Zoe::Zoe() |
67 |
|
{ |
68 |
+ |
if (!(collector || publisher)) usage(); |
69 |
+ |
|
70 |
|
configure(); |
71 |
|
initialize(); |
72 |
|
|
78 |
|
Zoe::color(false); |
79 |
|
ext::String Zoe::program, Zoe::config("zoe.xml"); |
80 |
|
|
81 |
+ |
void Zoe::usage() |
82 |
+ |
{ |
83 |
+ |
cerr << "Usage: " << Zoe::program << " [-config=config] [-collector] " |
84 |
+ |
"[-publisher] [-color] [-D]\n"; |
85 |
+ |
|
86 |
+ |
exit(1); |
87 |
+ |
} |
88 |
+ |
|
89 |
|
ext::String Zoe::generator(Generator generator) |
90 |
|
{ |
91 |
|
ext::String generator_(generator == all || generator == agent ? "Zoe" : ""); |
186 |
|
cerr << "}\n"; |
187 |
|
} |
188 |
|
|
178 |
– |
if (!collector && !publisher) { collector = true; publisher = true; } |
179 |
– |
|
189 |
|
if (debug) cerr << "collector = " << lexical_cast<ext::String>(collector) |
190 |
|
<< "\npublisher = " << lexical_cast<ext::String>(publisher) |
191 |
|
<< "\ncolor = " << lexical_cast<ext::String>(color) << '\n'; |