projects
/
metaproxy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
91be390
)
Use boost::program_options in ex_filter_frontend_net program.
author
Adam Dickmeiss
<adam@indexdata.dk>
Fri, 14 Oct 2005 13:22:57 +0000
(13:22 +0000)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Fri, 14 Oct 2005 13:22:57 +0000
(13:22 +0000)
src/ex_filter_frontend_net.cpp
patch
|
blob
|
history
diff --git
a/src/ex_filter_frontend_net.cpp
b/src/ex_filter_frontend_net.cpp
index
f8cbf5a
..
4ae21fa
100644
(file)
--- a/
src/ex_filter_frontend_net.cpp
+++ b/
src/ex_filter_frontend_net.cpp
@@
-3,6
+3,9
@@
#include <iostream>
#include <stdexcept>
#include <iostream>
#include <stdexcept>
+#include <boost/program_options.hpp>
+namespace po = boost::program_options;
+
#include "config.hpp"
#include "filter_frontend_net.hpp"
#include "config.hpp"
#include "filter_frontend_net.hpp"
@@
-51,7
+54,7
@@
public:
break;
}
odr_destroy(odr);
break;
}
odr_destroy(odr);
- }
+ }
return package.move();
};
};
return package.move();
};
};
@@
-60,6
+63,22
@@
int main(int argc, char **argv)
{
try
{
{
try
{
+ po::options_description desc("Allowed options");
+ desc.add_options()
+ ("help", "produce help message")
+ ("duration", po::value<int>(),
+ "number of seconds for server to exist")
+ ;
+
+ po::variables_map vm;
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ if (vm.count("help")) {
+ std::cout << desc << "\n";
+ return 1;
+ }
+
{
yp2::RouterChain router;
{
yp2::RouterChain router;
@@
-68,7
+87,10
@@
int main(int argc, char **argv)
filter_front.listen_address() = "tcp:@:9999";
// 0=no time, >0 timeout in seconds
filter_front.listen_address() = "tcp:@:9999";
// 0=no time, >0 timeout in seconds
- filter_front.listen_duration() = 0;
+ if (vm.count("duration")) {
+ filter_front.listen_duration() =
+ vm["duration"].as<int>();
+ }
router.rule(filter_front);
// put in a backend
router.rule(filter_front);
// put in a backend
@@
-86,6
+108,7
@@
int main(int argc, char **argv)
std::cerr << "unknown exception\n";
std::exit(1);
}
std::cerr << "unknown exception\n";
std::exit(1);
}
+ std::exit(0);
}
/*
}
/*