From 259d7eb2a0c31853affc5147d1d57223345a1625 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sat, 17 Feb 2007 10:53:05 +0000 Subject: [PATCH] Fixed compilation and tests for case where Libxml2 is unavailable. --- src/marcdisp.c | 6 +++++- test/tstmarcxml.sh | 4 ++-- util/marcdump.c | 11 ++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/marcdisp.c b/src/marcdisp.c index 17518e4..9037b5b 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdisp.c,v 1.45 2007-01-22 09:21:16 adam Exp $ + * $Id: marcdisp.c,v 1.46 2007-02-17 10:53:05 adam Exp $ */ /** @@ -643,6 +643,7 @@ static int yaz_marc_write_marcxml_ns(yaz_marc_t mt, WRBUF wr, { if (mt->write_using_libxml2) { +#if YAZ_HAVE_XML2 int ret; xmlNode *root_ptr; @@ -662,6 +663,9 @@ static int yaz_marc_write_marcxml_ns(yaz_marc_t mt, WRBUF wr, xmlFreeDoc(doc); } return ret; +#else + return -1; +#endif } else return yaz_marc_write_marcxml_ns1(mt, wr, ns, format, type); diff --git a/test/tstmarcxml.sh b/test/tstmarcxml.sh index 6093628..34c81e4 100755 --- a/test/tstmarcxml.sh +++ b/test/tstmarcxml.sh @@ -1,12 +1,12 @@ #!/bin/sh -# $Id: tstmarcxml.sh,v 1.4 2006-12-15 19:28:47 adam Exp $ +# $Id: tstmarcxml.sh,v 1.5 2007-02-17 10:53:05 adam Exp $ # Tests reading of MARCXML and checks that we get identical ISO2709 output. # # Reads marc?.xml files , Generates marc?.xml.marc files srcdir=${srcdir:-.} ecode=0 # Skip this test if Libxml2 support is not enabled -../util/yaz-marcdump -x >/dev/null 2>&1 +../util/yaz-marcdump -i marcxml >/dev/null 2>&1 if test $? = "3"; then exit 0 fi diff --git a/util/marcdump.c b/util/marcdump.c index 1542fb1..b329696 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdump.c,v 1.47 2007-01-03 08:42:16 adam Exp $ + * $Id: marcdump.c,v 1.48 2007-02-17 10:53:06 adam Exp $ */ #define _FILE_OFFSET_BITS 64 @@ -341,6 +341,15 @@ int main (int argc, char **argv) fprintf(stderr, "%s: bad input format: %s\n", prog, arg); exit(1); } +#if YAZ_HAVE_XML2 +#else + if (input_format == YAZ_MARC_MARCXML + || input_format == YAZ_MARC_XCHANGE) + { + fprintf(stderr, "%s: Libxml2 support not enabled\n", prog); + exit(3); + } +#endif break; case 'o': /* dirty hack so we can make Libxml2 do the writing .. -- 1.7.10.4