X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaziconv.c;h=9f7f7975cce2de57a6c926b42169d8115d54cdbb;hb=93f4285bbf2ed5a42fe62f92c7c4618df5f20583;hp=958aa9acd7ae8b6885650b060f7d09e0864fec35;hpb=38d29054baec012561d8a69ade2a55d6bee22c00;p=yaz-moved-to-github.git diff --git a/util/yaziconv.c b/util/yaziconv.c index 958aa9a..9f7f797 100644 --- a/util/yaziconv.c +++ b/util/yaziconv.c @@ -1,14 +1,13 @@ -/* - * Copyright (c) 1997-2003, Index Data +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: yaziconv.c,v 1.1 2003-04-23 20:34:08 adam Exp $ */ #if HAVE_CONFIG_H #include #endif +#include #include #include #include @@ -43,6 +42,11 @@ void convert (FILE *inf, yaz_iconv_t cd, int verbose) { if (outbuf != outbuf0) fwrite (outbuf0, 1, outbuf - outbuf0, stdout); + outbuf = outbuf0; + outbytesleft = CHUNK_OUT; + r = yaz_iconv (cd, 0, 0, &outbuf, &outbytesleft); + if (outbuf != outbuf0) + fwrite (outbuf0, 1, outbuf - outbuf0, stdout); break; } inbytesleft = r; @@ -50,8 +54,8 @@ void convert (FILE *inf, yaz_iconv_t cd, int verbose) } if (verbose > 1) { - fprintf (stderr, "yaz_iconv: inbytesleft=%d outbytesleft=%d\n", - inbytesleft, outbytesleft); + fprintf (stderr, "yaz_iconv: inbytesleft=%ld outbytesleft=%ld\n", + (long) inbytesleft, (long) outbytesleft); } r = yaz_iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); @@ -80,7 +84,7 @@ void convert (FILE *inf, yaz_iconv_t cd, int verbose) } if (r == 0) { - fprintf (stderr, "invalid sequence\n"); + fprintf (stderr, "invalid sequence due to missing input\n"); return ; } inbytesleft += r; @@ -147,7 +151,7 @@ int main (int argc, char **argv) break; default: fprintf (stderr, "yaziconv: Usage\n" - "siconv -f encoding -t encoding [-v] [file]\n"); + "yaziconv -f encoding -t encoding [-v] [file]\n"); exit(1); } } @@ -179,3 +183,11 @@ int main (int argc, char **argv) yaz_iconv_close (cd); return 0; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +