X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fex_filter_frontend_net.cpp;h=9c66b3766c3aea1cef3f58e1ecb2254751f1c5d0;hb=85189f2d04df4cfc8b16ee78187fb89d00dfe3ff;hp=e402e68f5efd96cbd9aa4e9405fd2e6d110a745a;hpb=637a685d61a9ff0e3f398a59da426979815c4d68;p=metaproxy-moved-to-github.git diff --git a/src/ex_filter_frontend_net.cpp b/src/ex_filter_frontend_net.cpp index e402e68..9c66b37 100644 --- a/src/ex_filter_frontend_net.cpp +++ b/src/ex_filter_frontend_net.cpp @@ -1,4 +1,4 @@ -/* $Id: ex_filter_frontend_net.cpp,v 1.30 2007-05-09 21:23:09 adam Exp $ +/* $Id: ex_filter_frontend_net.cpp,v 1.32 2008-02-20 15:07:51 adam Exp $ Copyright (c) 2005-2007, Index Data. This file is part of Metaproxy. @@ -25,10 +25,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include -namespace po = boost::program_options; - - +#include #include "util.hpp" #include "filter_frontend_net.hpp" #include "filter_z3950_client.hpp" @@ -74,32 +71,34 @@ int main(int argc, char **argv) { try { - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "produce help message") - ("duration", po::value(), - "number of seconds for server to exist") - ("port", po::value< std::vector >(), "listener port") - ; - - po::positional_options_description p; - p.add("port", -1); - - po::variables_map vm; - po::store(po::command_line_parser(argc, argv). - options(desc).positional(p).run(), vm); - po::notify(vm); - - if (vm.count("help")) { - std::cout << desc << "\n"; - return 1; - } + std::vector ports; + int duration = -1; + int ret; + char *arg; - if (vm.count("port")) + while ((ret = options("h{help}d{duration}:p{port}:", + argv, argc, &arg)) != -2) + { + switch(ret) + { + case -1: + std::cerr << "bad option " << arg << std::endl; + case 'h': + std::cerr << "ex_filter_frontend_net\n" + " -h|--help help\n" + " -d|--duration n duration\n" + " -p|--port n port number\n" + << std::endl; + break; + case 'p': + ports.push_back(arg); + break; + case 'd': + duration = atoi(arg); + break; + } + } { - std::vector ports = - vm["port"].as< std::vector >(); - for (size_t i = 0; i0 timeout in seconds - if (vm.count("duration")) { - filter_front.listen_duration() = vm["duration"].as(); - } + if (duration != -1) + filter_front.set_listen_duration(duration); + router.append(filter_front); // put log filter in router