Towards GPL
[idzebra-moved-to-github.git] / recctrl / marcread.c
index 7125bc9..49a27fc 100644 (file)
@@ -1,10 +1,26 @@
-/*
- * Copyright (C) 1997-2002, Index Data
- * All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Id: marcread.c,v 1.15 2002-05-28 21:10:34 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 <stdio.h>
 #include <ctype.h>
 #include <assert.h>
@@ -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, 0 /* attr */, res_root);
+        res = data1_mk_tag_n (p->dh, p->mem, tag, 3, 0 /* attr */, parent);
 
 #if MARC_DEBUG
         fprintf (outf, "%s ", tag);