From: Adam Dickmeiss Date: Wed, 2 Oct 2002 15:51:52 +0000 (+0000) Subject: Create entities for MARC data (& <) X-Git-Tag: YAZ.1.9.1~10 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=906a5ab4a9c3b8b9a4bef15de1df58ab873a1cb5;p=yaz-moved-to-github.git Create entities for MARC data (& <) --- diff --git a/util/marcdisp.c b/util/marcdisp.c index 840c0b1..8133832 100644 --- a/util/marcdisp.c +++ b/util/marcdisp.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: marcdisp.c,v 1.19 2002-03-18 18:11:45 adam Exp $ + * $Id: marcdisp.c,v 1.20 2002-10-02 15:51:52 adam Exp $ */ #if HAVE_CONFIG_H @@ -192,7 +192,12 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) while (buf[i] != ISO2709_RS && buf[i] != ISO2709_IDFS && buf[i] != ISO2709_FS && i < end_offset) { - wrbuf_putc (wr, buf[i]); + if (xml && buf[i] == '<') + wrbuf_puts(wr, "<"); + else if (xml && buf[i] == '&') + wrbuf_puts(wr, "&"); + else + wrbuf_putc (wr, buf[i]); i++; } if (xml) @@ -200,7 +205,12 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) } else { - wrbuf_putc (wr, buf[i]); + if (xml && buf[i] == '<') + wrbuf_puts(wr, "<"); + else if (xml && buf[i] == '&') + wrbuf_puts(wr, "&"); + else + wrbuf_putc (wr, buf[i]); i++; } }