-/* $Id: pazpar2.c,v 1.4 2006-12-21 04:27:48 quinn Exp $ */;
+/* $Id: pazpar2.c,v 1.5 2006-12-22 04:43:11 quinn Exp $ */;
#include <stdlib.h>
#include <stdio.h>
#include <yaz/readconf.h>
#include <yaz/pquery.h>
#include <yaz/yaz-util.h>
+#include <yaz/nmem.h>
#include "pazpar2.h"
#include "eventl.h"
0,
0,
0,
+ 0,
0
};
session_alert_watch(s, SESSION_WATCH_RECORDS);
}
+xsltStylesheetPtr load_stylesheet(const char *fname)
+{
+ xsltStylesheetPtr ret;
+ if (!(ret = xsltParseStylesheetFile((const xmlChar *) fname)))
+ {
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "Failed to load stylesheet %s", fname);
+ exit(1);
+ }
+ return ret;
+}
+
static void do_presentResponse(IOCHAN i, Z_APDU *a)
{
struct connection *co = iochan_getdata(i);
return termlist_highscore(s->termlist, num);
}
+#ifdef REPORT_NMEM
+// conditional compilation by SH: This lead to a warning with currently installed
+// YAZ header files on us1
void report_nmem_stats(void)
{
size_t in_use, is_free;
yaz_log(YLOG_LOG, "nmem stat: use=%ld free=%ld",
(long) in_use, (long) is_free);
}
+#endif
struct record **show(struct session *s, int start, int *num, int *total,
int *sumhits, NMEM nmem_show)
yaz_log_init(YLOG_DEFAULT_LEVEL, "pazpar2", 0);
- while ((ret = options("c:h:p:C:s:", argv, argc, &arg)) != -2)
+ while ((ret = options("x:c:h:p:C:s:", argv, argc, &arg)) != -2)
{
switch (ret) {
case 'c':
case 's':
load_simpletargets(arg);
break;
+ case 'x':
+ global_parameters.xsl = load_stylesheet(arg);
+ break;
default:
fprintf(stderr, "Usage: pazpar2\n"
" -h [host:]port (REST protocol listener)\n"
exit(1);
}
- global_parameters.ccl_filter = load_cclfile("default.bib");
+ if (!global_parameters.xsl)
+ global_parameters.xsl = load_stylesheet("../etc/default.xsl");
+ global_parameters.ccl_filter = load_cclfile("../etc/default.bib");
global_parameters.yaz_marc = yaz_marc_create();
yaz_marc_subfield_str(global_parameters.yaz_marc, "\t");
global_parameters.odr_in = odr_createmem(ODR_DECODE);