From c225f9c0b0d280dedb06939fb68a1cb06c74a3c0 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 10 Feb 1995 17:05:14 +0000 Subject: [PATCH] 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/iso2709.h | 14 ++++++++++---- util/Makefile | 11 ++++++++--- util/iso2709.c | 28 +++++++++++----------------- util/iso2709dump.c | 16 +++++++++++----- util/iso27dis.c | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 29 deletions(-) create mode 100644 util/iso27dis.c diff --git a/include/iso2709.h b/include/iso2709.h index acaf9bc..8d9e8b6 100644 --- a/include/iso2709.h +++ b/include/iso2709.h @@ -4,11 +4,16 @@ Europagate, 1994-1995. $Log: iso2709.h,v $ - Revision 1.2 1995/02/10 16:50:25 adam - Indicator field moved to 'struct iso2709_dir' from 'struct - iso2709_field'. - Function iso2709_rm implemented - to delete a MARC record. + Revision 1.3 1995/02/10 17:05:14 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. + * Revision 1.2 1995/02/10 16:50:25 adam + * Indicator field moved to 'struct iso2709_dir' from 'struct + * iso2709_field'. + * Function iso2709_rm implemented - to delete a MARC record. + * * Revision 1.1.1.1 1995/02/09 17:27:12 adam * Initial version of email gateway under CVS control. * @@ -22,5 +27,6 @@ typedef struct iso2709_rec *Iso2709Rec; char *iso2709_read (FILE *inf); Iso2709Rec iso2709_cvt (const char *buf); void iso2709_rm (Iso2709Rec rec); +void iso2709_display (Iso2709Rec rec, FILE *out); #endif diff --git a/util/Makefile b/util/Makefile index 8667026..7e8d4a5 100644 --- a/util/Makefile +++ b/util/Makefile @@ -2,8 +2,13 @@ # Europagate, 1995 # # $Log: Makefile,v $ -# Revision 1.1 1995/02/09 17:27:10 adam -# Initial revision +# Revision 1.2 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. +# +# Revision 1.1.1.1 1995/02/09 17:27:11 adam +# Initial version of email gateway under CVS control. # SHELL=/bin/sh INCLUDE=-I../include @@ -11,7 +16,7 @@ CFLAGS=-g -Wall -pedantic -ansi CC=gcc TPROG1=iso2709dump LIB=../lib/util.a -PO=iso2709.o +PO=iso2709.o iso27dis.o CPP=cc -E DEFS=$(INCLUDE) diff --git a/util/iso2709.c b/util/iso2709.c index 927df07..bfb691f 100644 --- a/util/iso2709.c +++ b/util/iso2709.c @@ -1,14 +1,19 @@ /* - gw-res.c: Iso2709 record management + Iso2709 record management Europagate, 1994-1995. $Log: iso2709.c,v $ - Revision 1.2 1995/02/10 16:50:32 adam - Indicator field moved to 'struct iso2709_dir' from 'struct - iso2709_field'. - Function iso2709_rm implemented - to delete a MARC record. - + Revision 1.3 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. + + * Revision 1.2 1995/02/10 16:50:32 adam + * Indicator field moved to 'struct iso2709_dir' from 'struct + * iso2709_field'. + * Function iso2709_rm implemented - to delete a MARC record. + * * Revision 1.1.1.1 1995/02/09 17:27:11 adam * Initial version of email gateway under CVS control. * @@ -115,10 +120,6 @@ Iso2709Rec iso2709_cvt (const char *buf) } pos++; /* deal with datafields */ -#if 0 - fprintf (stderr, "indicator_len=%d, identifier_len=%d\n", - p->indicator_length, p->identifier_length); -#endif for (dp = p->directory; dp; dp = dp->next) { int tag00; @@ -142,9 +143,6 @@ Iso2709Rec iso2709_cvt (const char *buf) tag00 = 0; else tag00 = 1; - fprintf (stderr, "%s", dp->tag); - if (dp->indicator) - fprintf (stderr, " %s", dp->indicator); while (1) { int dpos_n; @@ -166,9 +164,6 @@ Iso2709Rec iso2709_cvt (const char *buf) strncpyx ((*fpp)->data, buf+dpos, dpos_n - dpos); dpos = dpos_n; - if ((*fpp)->identifier) - fprintf (stderr, " *%s", (*fpp)->identifier); - fprintf (stderr, " %s", (*fpp)->data); if (buf[dpos] == ISO2709_FS) break; @@ -176,7 +171,6 @@ Iso2709Rec iso2709_cvt (const char *buf) *fpp = malloc (sizeof(**fpp)); (*fpp)->next = NULL; } - fprintf (stderr, "\n"); } return p; } diff --git a/util/iso2709dump.c b/util/iso2709dump.c index 4a284bf..d8701e1 100644 --- a/util/iso2709dump.c +++ b/util/iso2709dump.c @@ -1,14 +1,19 @@ /* - gw-res.c: Iso2709 record management + Iso2709 record management Europagate, 1994-1995. $Log: iso2709dump.c,v $ - Revision 1.2 1995/02/10 16:50:33 adam - Indicator field moved to 'struct iso2709_dir' from 'struct - iso2709_field'. - Function iso2709_rm implemented - to delete a MARC record. + Revision 1.3 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. + * Revision 1.2 1995/02/10 16:50:33 adam + * Indicator field moved to 'struct iso2709_dir' from 'struct + * iso2709_field'. + * Function iso2709_rm implemented - to delete a MARC record. + * * Revision 1.1.1.1 1995/02/09 17:27:11 adam * Initial version of email gateway under CVS control. * @@ -27,6 +32,7 @@ int main (int argc, char **argv) while ((buf = iso2709_read (stdin))) { rec = iso2709_cvt (buf); + iso2709_display (rec, stderr); free (buf); iso2709_rm (rec); } diff --git a/util/iso27dis.c b/util/iso27dis.c new file mode 100644 index 0000000..b0cfa10 --- /dev/null +++ b/util/iso27dis.c @@ -0,0 +1,41 @@ +/* + 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. + + */ + +#include +#include +#include +#include +#include + +#include + +void iso2709_display (Iso2709Rec rec, FILE *out) +{ + struct iso2709_dir *dir; + + for (dir = rec->directory; dir; dir = dir->next) + { + 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 (field->identifier) + fprintf (out, " $%s", field->identifier); + fprintf (out, " %s", field->data); + } + fprintf (out, "\n"); + } +} -- 1.7.10.4