- if (!fname)
- {
- std::cerr << "No configuration given\n";
- std::exit(1);
- }
- xmlDocPtr doc = xmlReadFile(fname,
- NULL,
- XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS
- + XML_PARSE_NSCLEAN + XML_PARSE_NONET );
-
- if (!doc)
+ }
+ if (!fname)
+ {
+ std::cerr << "No configuration given; use -h for help\n";
+ return 1;
+ }
+
+ yaz_log(YLOG_LOG, "metaproxy %s " VERSION
+#ifdef VERSION_SHA1
+ " " VERSION_SHA1
+#endif
+ , test_config ? "test" : "start"
+ );
+
+ yaz_log_xml_errors(0, YLOG_LOG);
+ xmlDocPtr doc = xmlReadFile(fname,
+ NULL,
+ XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS
+ + XML_PARSE_NSCLEAN + XML_PARSE_NONET );
+
+ if (!doc)
+ {
+ yaz_log(YLOG_FATAL,"XML parsing failed");
+ return 1;
+ }
+ // and perform Xinclude then
+ int r = xmlXIncludeProcess(doc);
+ if (r == -1)
+ {
+ yaz_log(YLOG_FATAL, "XInclude processing failed");
+ return 1;
+ }
+ mp::wrbuf base_path;
+ const char *last_p = strrchr(fname,
+#ifdef WIN32
+ '\\'
+#else
+ '/'
+#endif
+ );
+ if (last_p)
+ wrbuf_write(base_path, fname, last_p - fname);
+ else
+ wrbuf_puts(base_path, ".");
+ ret = 0;
+ try {
+ mp::RouterXML *router =
+ new mp::RouterXML(doc, test_config, wrbuf_cstr(base_path));
+ if (!test_config)