X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fmarcdump.c;h=662445ea00c339808c5c6222a4e2f8027ada089d;hb=394286df42e6e2c01e5b1b446ae1cf8d0b117f35;hp=03ae3a2ce2f468e22ac56efbf05372633f6246f3;hpb=b93c50cd7770a18bddd602a612ccd83795cd4922;p=yaz-moved-to-github.git diff --git a/util/marcdump.c b/util/marcdump.c index 03ae3a2..662445e 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: marcdump.c,v 1.55 2007-12-18 21:13:06 adam Exp $ */ #define _FILE_OFFSET_BITS 64 @@ -103,12 +101,6 @@ static void marcdump_read_line(yaz_marc_t mt, const char *fname) fputs(wrbuf_cstr(wrbuf), stdout); wrbuf_destroy(wrbuf); } - { - WRBUF wrbuf = wrbuf_alloc(); - yaz_marc_write_trailer(mt, wrbuf); - fputs(wrbuf_cstr(wrbuf), stdout); - wrbuf_destroy(wrbuf); - } fclose(inf); } @@ -147,8 +139,6 @@ static void marcdump_read_xml(yaz_marc_t mt, const char *fname) } } } - yaz_marc_write_trailer(mt, wrbuf); - fputs(wrbuf_cstr(wrbuf), stdout); } #else xmlDocPtr doc = xmlParseFile(fname); @@ -182,7 +172,6 @@ static void marcdump_read_xml(yaz_marc_t mt, const char *fname) xmlFreeDoc(doc); } #endif - yaz_marc_write_trailer(mt, wrbuf); fputs(wrbuf_cstr(wrbuf), stdout); wrbuf_destroy(wrbuf); } @@ -343,7 +332,11 @@ static void dump(const char *fname, const char *from, const char *to, r = yaz_marc_decode_buf(mt, buf, -1, &result, &len_result); if (r > 0 && result) { - fwrite (result, len_result, 1, stdout); + if (fwrite(result, len_result, 1, stdout) != 1) + { + fprintf(stderr, "Write to stdout failed\n"); + break; + } } if (r > 0 && cfile) {