X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmetaproxy_prog.cpp;h=d2638b2aa52c3d2d5480ccb5182522341ed57c7c;hb=098f68aa472b0827a0dfdfda38a338cde577ef98;hp=d6f8251871d81af1bb528d1406b9b1c494f82768;hpb=ef8d07cc801049c2b60fa81d289d1335a7394b3b;p=metaproxy-moved-to-github.git diff --git a/src/metaproxy_prog.cpp b/src/metaproxy_prog.cpp index d6f8251..d2638b2 100644 --- a/src/metaproxy_prog.cpp +++ b/src/metaproxy_prog.cpp @@ -1,7 +1,7 @@ -/* $Id: metaproxy_prog.cpp,v 1.3 2006-04-29 08:47:40 adam Exp $ +/* $Id: metaproxy_prog.cpp,v 1.8 2006-12-01 12:37:26 marc Exp $ Copyright (c) 2005-2006, Index Data. -%LICENSE% + See the LICENSE file for details */ #include "config.hpp" @@ -11,6 +11,7 @@ namespace po = boost::program_options; #include #include +#include #include "filter.hpp" #include "package.hpp" @@ -26,6 +27,7 @@ int main(int argc, char **argv) po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") + ("version,V", "show version") ("config", po::value< std::vector >(), "xml config") ; @@ -41,7 +43,10 @@ int main(int argc, char **argv) std::cout << desc << "\n"; return 1; } - + if (vm.count("version")) { + std::cout << "Metaproxy " VERSION "\n"; + return 0; + } xmlDocPtr doc = 0; if (vm.count("config")) { @@ -54,12 +59,23 @@ int main(int argc, char **argv) std::exit(1); } - doc = xmlParseFile(config_fnames[0].c_str()); + // need to parse with xinclude tags + // XML_PARSE_XINCLUDE XML_PARSE_NOBLANKS + // XML_PARSE_NSCLEAN XML_PARSE_NONET + doc = xmlReadFile(config_fnames[0].c_str(), + NULL, + XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS + + XML_PARSE_NSCLEAN + XML_PARSE_NONET ); + if (!doc) { - std::cerr << "xmlParseFile failed\n"; + std::cerr << "XML parsing failed\n"; std::exit(1); } + // and perform Xinclude then + if (xmlXIncludeProcess(doc) > 0) { + std::cerr << "processing XInclude directive\n"; + } } else { @@ -75,7 +91,7 @@ int main(int argc, char **argv) pack.router(router).move(); } catch (std::runtime_error &e) { - std::cout << "std::runtime error: " << e.what() << "\n"; + std::cerr << "std::runtime error: " << e.what() << "\n"; std::exit(1); } xmlFreeDoc(doc); @@ -90,7 +106,7 @@ int main(int argc, char **argv) std::exit(1); } catch (std::runtime_error &e) { - std::cout << "std::runtime error: " << e.what() << "\n"; + std::cerr << "std::runtime error: " << e.what() << "\n"; std::exit(1); } catch ( ... ) {