X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fex_router_flexml.cpp;h=d5637a665f788aea13f6efca14a1b5f729566f21;hb=e9530d6289df9b848e4901d7c73f5a2f27706d66;hp=f2db2ef56c84182f3c557d672f7e30438de8e691;hpb=637a685d61a9ff0e3f398a59da426979815c4d68;p=metaproxy-moved-to-github.git diff --git a/src/ex_router_flexml.cpp b/src/ex_router_flexml.cpp index f2db2ef..d5637a6 100644 --- a/src/ex_router_flexml.cpp +++ b/src/ex_router_flexml.cpp @@ -1,7 +1,5 @@ -/* $Id: ex_router_flexml.cpp,v 1.11 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,15 +12,13 @@ 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" -#include -namespace po = boost::program_options; +#include #include #include @@ -38,38 +34,32 @@ int main(int argc, char **argv) { try { - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "produce help message") - ("config", po::value< std::vector >(), "xml config") - ; - - po::positional_options_description p; - p.add("config", -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; - } - - xmlDocPtr doc = 0; - if (vm.count("config")) - { - std::vector config_fnames = - vm["config"].as< std::vector >(); + int ret; + char *arg; + char *fname = 0; - if (config_fnames.size() != 1) + while ((ret = options("h{help}c{config}:", + argv, argc, &arg)) != -2) + { + switch(ret) { - std::cerr << "Only one configuration must be given\n"; + case -1: + std::cerr << "bad option " << arg << std::endl; + case 'h': + std::cerr << "ex_router_flexml\n" + " -h|--help help\n" + " -c|--config fname configuation\n" + << std::endl; std::exit(1); + case 'c': + fname = arg; } - - doc = xmlParseFile(config_fnames[0].c_str()); + } + + xmlDocPtr doc = 0; + if (fname) + { + doc = xmlParseFile(fname); if (!doc) { std::cerr << "xmlParseFile failed\n"; @@ -84,7 +74,7 @@ int main(int argc, char **argv) if (doc) { mp::FactoryStatic factory; - mp::RouterFleXML router(doc, factory); + mp::RouterFleXML router(doc, factory, false); mp::Package pack;