X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fmarcdisp.c;h=342e5d11220543b6693d48764774542ba8642ffb;hb=835cca40fdee0597232361c5129cf47160d77e79;hp=81338326117e420a8be8ba976f3ac3bf7c6d1f14;hpb=906a5ab4a9c3b8b9a4bef15de1df58ab873a1cb5;p=yaz-moved-to-github.git diff --git a/util/marcdisp.c b/util/marcdisp.c index 8133832..342e5d1 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.20 2002-10-02 15:51:52 adam Exp $ + * $Id: marcdisp.c,v 1.22 2002-10-04 11:24:55 adam Exp $ */ #if HAVE_CONFIG_H @@ -58,19 +58,38 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) if (xml) { - char str[40]; + char str[80]; int i; - wrbuf_puts (wr, " 1) { - sprintf (str, " ImplDefined%d=\"%c\"\n", i, buf[6+i]); + wrbuf_puts( + wr, + "\n", + buf[5], buf[6], buf[7]); wrbuf_puts (wr, str); } - wrbuf_puts (wr, ">\n"); + else + { + wrbuf_puts (wr, "\n"); + } } if (debug) { @@ -115,19 +134,6 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) memcpy (tag, buf+entry_p, 3); entry_p += 3; tag[3] = '\0'; - if (xml) - { - wrbuf_puts (wr, " 1) + { + if (identifier_flag) + wrbuf_puts (wr, " 1) + sprintf (nostr, " i%d=\"%c\"", j+1, buf[i]); + else + sprintf (nostr, " Indicator%d=\"%c\"", j+1, buf[i]); wrbuf_puts (wr, nostr); } else @@ -177,7 +213,10 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) i++; if (xml) { - wrbuf_puts (wr, " 1) + wrbuf_puts (wr, " "); @@ -209,6 +248,8 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) wrbuf_puts(wr, "<"); else if (xml && buf[i] == '&') wrbuf_puts(wr, "&"); + else if (xml && buf[i] == '"') + wrbuf_puts(wr, """); else wrbuf_putc (wr, buf[i]); i++; @@ -221,10 +262,25 @@ int yaz_marc_decode (const char *buf, WRBUF wr, int debug, int bsize, int xml) if (buf[i] != ISO2709_RS && buf[i] != ISO2709_FS) wrbuf_puts (wr, " \n"); if (xml) - wrbuf_puts (wr, "\n"); + { + if (xml > 1) + { + if (identifier_flag) + wrbuf_puts (wr, "\n"); + else + wrbuf_puts (wr, "\n"); + } + else + wrbuf_puts (wr, "\n"); + } } if (xml) - wrbuf_puts (wr, "\n"); + { + if (xml > 1) + wrbuf_puts (wr, "\n"); + else + wrbuf_puts (wr, "\n"); + } wrbuf_puts (wr, ""); return record_length; }