X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fex_router_flexml.cpp;h=8b9d612b2f04e5f410de46808e7e9106b6cb567e;hb=51bd69f6e778ab83e4017172625c0decc8465e1b;hp=3793ea22f3d752f22ebca7b03b6ff9d0b5fc3fa8;hpb=ec5548301e2549fc0f8d2f962aade24cb6f90d1b;p=metaproxy-moved-to-github.git diff --git a/src/ex_router_flexml.cpp b/src/ex_router_flexml.cpp index 3793ea2..8b9d612 100644 --- a/src/ex_router_flexml.cpp +++ b/src/ex_router_flexml.cpp @@ -1,59 +1,65 @@ -/* $Id: ex_router_flexml.cpp,v 1.6 2006-01-09 13:43:59 adam Exp $ - Copyright (c) 2005, Index Data. +/* This file is part of Metaproxy. + Copyright (C) 2005-2012 Index Data -%LICENSE% - */ +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 +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +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 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 -#include "filter.hpp" -#include "package.hpp" +#include +#include #include "router_flexml.hpp" #include "factory_static.hpp" +namespace mp = metaproxy_1; + int main(int argc, char **argv) { try { + int ret; + char *arg; + char *fname = 0; - 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")) + while ((ret = options("h{help}c{config}:", + argv, argc, &arg)) != -2) { - std::vector config_fnames = - vm["config"].as< std::vector >(); - - if (config_fnames.size() != 1) + 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"; @@ -67,10 +73,10 @@ int main(int argc, char **argv) } if (doc) { - yp2::FactoryStatic factory; - yp2::RouterFleXML router(doc, factory); + mp::FactoryStatic factory; + mp::RouterFleXML router(doc, factory, false, 0); - yp2::Package pack; + mp::Package pack; pack.router(router).move(); @@ -86,13 +92,12 @@ 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 */ +