X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fex_filter_frontend_net.cpp;h=b0da53ec713d7f36a09d3daff255c26df4d9831d;hb=665559cbc22546e8df69be33a7d492294cab9fb1;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..b0da53e 100644 --- a/src/ex_filter_frontend_net.cpp +++ b/src/ex_filter_frontend_net.cpp @@ -1,7 +1,5 @@ -/* $Id: ex_filter_frontend_net.cpp,v 1.30 2007-05-09 21:23:09 adam Exp $ - Copyright (c) 2005-2007, Index Data. - -This file is part of Metaproxy. +/* This file is part of Metaproxy. + Copyright (C) 2005-2008 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -14,10 +12,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Metaproxy; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "config.hpp" @@ -25,10 +22,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 +68,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 @@ -159,8 +155,9 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +