X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaziconv.c;h=72dd075dcae267374c2d14e72cc5169ad3b8a143;hb=f3c256e67f73eee9cace104051db51bfd13166b4;hp=af52e2d3c56a869e58a070661dfa02f6fd49f7e3;hpb=4c176312acdc3444c9afc820f76a393e64668e52;p=yaz-moved-to-github.git diff --git a/util/yaziconv.c b/util/yaziconv.c index af52e2d..72dd075 100644 --- a/util/yaziconv.c +++ b/util/yaziconv.c @@ -1,14 +1,15 @@ /* - * Copyright (C) 1995-2005, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: yaziconv.c,v 1.2 2005-01-15 19:47:15 adam Exp $ + * $Id: yaziconv.c,v 1.9 2007-05-25 16:19:46 marc Exp $ */ #if HAVE_CONFIG_H #include #endif +#include #include #include #include @@ -43,6 +44,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 +56,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 +86,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 +153,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 +185,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 + */ +