New 2709 function: iso2709_mk.
[egate.git] / util / iso27dis.c
index b0cfa10..437e497 100644 (file)
@@ -1,14 +1,20 @@
 /*
-   Iso2709 record management
-
-   Europagate, 1994-1995.
-
-   $Log: iso27dis.c,v $
-   Revision 1.1  1995/02/10 17:05:18  adam
-   New function iso2709_display to display MARC records in a
-   line-by-line format. The iso2709_cvt function no longer
-   prints the record to stderr.
-
+ * Iso2709 record management
+ *
+ * Europagate, 1994-1995.
+ *
+ * $Log: iso27dis.c,v $
+ * Revision 1.4  1995/03/29 11:44:29  adam
+ * New functions: iso2709_a_.. for record manipulation.
+ *
+ * Revision 1.3  1995/02/22  21:32:36  adam
+ * Changed header.
+ *
+ * Revision 1.1  1995/02/10  17:05:18  adam
+ * New function iso2709_display to display MARC records in a
+ * line-by-line format. The iso2709_cvt function no longer
+ * prints the record to stderr.
+ *
  */
 
 #include <stdlib.h>
 #include <assert.h>
 #include <ctype.h>
 
-#include <iso2709p.h>
+#include <iso2709.h>
 
 void iso2709_display (Iso2709Rec rec, FILE *out)
 {
-    struct iso2709_dir *dir;
-
-    for (dir = rec->directory; dir; dir = dir->next)
+    Iso2709Anchor a;
+    char *tag;
+    char *indicator;
+    char *identifier;
+    char *data;
+    
+    a = iso2709_a_mk (rec);
+    do
     {
-        struct iso2709_field *field;
-
-        fprintf (out, "%s", dir->tag);
-        if (dir->indicator)
-            fprintf (out, " %s", dir->indicator);
-        for (field = dir->fields; field; field = field->next)
+        if (!iso2709_a_info_line (a, &tag, &indicator))
+            break;
+        fprintf (out, "%s", tag);
+        if (indicator)
+            fprintf (out, " %s", indicator);
+        do
         {
-            if (field->identifier)
-                fprintf (out, " $%s", field->identifier);
-            fprintf (out, " %s", field->data);
-        }
+            iso2709_a_info_field (a, NULL, NULL, &identifier, &data);
+            if (identifier)
+                fprintf (out, " $%s", identifier);
+            fprintf (out, " %s", data);
+        } while (iso2709_a_next_field (a));
         fprintf (out, "\n");
-    }
+    } while (iso2709_a_next_line(a));
 }
+