X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=data1%2Fd1_marc.c;h=d2b6dae54caa711d6e3f37d74a56abe7e664f7fc;hb=1e58ebd4607490d810c7396a4e87eb70d9528166;hp=ef3d301493a1c20c7ca19f1952ff6a4d87c58e5b;hpb=0348ff0e69495870d980f29198072070e06f9c4e;p=idzebra-moved-to-github.git diff --git a/data1/d1_marc.c b/data1/d1_marc.c index ef3d301..d2b6dae 100644 --- a/data1/d1_marc.c +++ b/data1/d1_marc.c @@ -1,4 +1,4 @@ -/* $Id: d1_marc.c,v 1.5 2003-11-28 23:06:59 adam Exp $ +/* $Id: d1_marc.c,v 1.9 2004-12-13 20:51:28 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -26,13 +26,13 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include #include #include #include #include -#include +#include data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { @@ -45,7 +45,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } @@ -70,7 +70,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d:Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d:Missing arg for %s", file, lineno, *argv); continue; } @@ -80,13 +80,13 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown tagset reference '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'", file, lineno, argv[1]); continue; } @@ -95,7 +95,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -105,7 +105,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -115,7 +115,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -125,7 +125,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -135,7 +135,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -145,14 +145,14 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } res->force_identifier_length = atoi(argv[1]); } else - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, *argv); fclose(f); @@ -234,13 +234,12 @@ static int nodetomarc(data1_handle dh, #if 0 data1_pr_tree(dh, n, stdout); #endif - yaz_log (LOG_DEBUG, "nodetomarc"); + yaz_log (YLOG_DEBUG, "nodetomarc"); memcpy (leader+5, p->record_status, 1); memcpy (leader+6, p->implementation_codes, 4); memint (leader+10, p->indicator_length, 1); memint (leader+11, p->identifier_length, 1); - memint (leader+12, base_address, 5); memcpy (leader+17, p->user_systems, 3); memint (leader+20, p->length_data_entry, 1); memint (leader+21, p->length_starting, 1); @@ -322,6 +321,11 @@ static int nodetomarc(data1_handle dh, *buf = (char *)xrealloc(*buf, *size = len); op = *buf; + + /* we know the base address now */ + memint (leader+12, base_address, 5); + + /* copy temp leader to real output buf op */ memcpy (op, leader, 24); memint (op, len, 5); @@ -416,7 +420,7 @@ static int nodetomarc(data1_handle dh, } } else if (subf->which != DATA1N_tag) - yaz_log(LOG_WARN, "Malformed fields for marc output."); + yaz_log(YLOG_WARN, "Malformed fields for marc output."); else identifier = subf->u.tag.tag; op[data_p] = ISO2709_IDFS;