X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=recctrl%2Fmarcread.c;h=49a27fcbbc4d293a7709aaec6b6e0b5d9e2791b6;hp=4afdd7a81964ebc527fba9e50b52b0d3d58c6bce;hb=896c0427df9d8eff5de6a1735dcd992e067df844;hpb=3ecabdd7340cf895d4d446a217b8b69c17a2d781 diff --git a/recctrl/marcread.c b/recctrl/marcread.c index 4afdd7a..49a27fc 100644 --- a/recctrl/marcread.c +++ b/recctrl/marcread.c @@ -1,10 +1,26 @@ -/* - * Copyright (C) 1997-2002, Index Data - * All rights reserved. - * Sebastian Hammer, Adam Dickmeiss - * - * $Id: marcread.c,v 1.13 2002-05-03 13:50:25 adam Exp $ - */ +/* $Id: marcread.c,v 1.17 2002-08-02 19:26:56 adam Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 + Index Data Aps + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Zebra; see the file LICENSE.zebra. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +*/ + + #include #include #include @@ -31,8 +47,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) #if MARC_DEBUG FILE *outf = stdout; #endif - - data1_node *res_root; + data1_node *res_root, *res_top; char *absynName; data1_marctab *marctab; @@ -66,6 +81,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) yaz_log (LOG_WARN, "cannot read MARC without an abstract syntax"); return 0; } + res_top = data1_mk_tag (p->dh, p->mem, absynName, 0, res_root); marctab = res_root->u.root.absyn->marc; @@ -94,7 +110,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) int i, i0; char tag[4]; data1_node *res; - data1_node *parent = res_root; + data1_node *parent = res_top; memcpy (tag, buf+entry_p, 3); entry_p += 3; @@ -102,7 +118,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) /* generate field node */ - res = data1_mk_tag_n (p->dh, p->mem, tag, 3, res_root); + res = data1_mk_tag_n (p->dh, p->mem, tag, 3, 0 /* attr */, parent); #if MARC_DEBUG fprintf (outf, "%s ", tag); @@ -121,7 +137,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) int j; #endif res = data1_mk_tag_n (p->dh, p->mem, - buf+i, indicator_length, res); + buf+i, indicator_length, 0 /* attr */, res); #if MARC_DEBUG for (j = 0; jdh, p->mem, - buf+i+1, identifier_length-1, parent); + buf+i+1, identifier_length-1, + 0 /* attr */, parent); #if MARC_DEBUG fprintf (outf, " $"); for (j = 1; j i0) { - data1_node *res = data1_mk_tag_n (p->dh, p->mem, - "@", 1, parent); - data1_mk_text_n (p->dh, p->mem, buf + i0, i - i0, res); + data1_mk_text_n (p->dh, p->mem, buf + i0, i - i0, parent); } #if MARC_DEBUG fprintf (outf, "\n");