From c559a3ca84a0258e4773571ae73fa7bba4c927b0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 25 Nov 1999 19:27:07 +0000 Subject: Update. 1999-11-25 H.J. Lu * stdlib/exit.c (exit): Run funtions only if __exit_funcs->idx > 0. 1999-11-25 Ulrich Drepper * manual/charset.texi (iconv Examples): Add iconv call to flush state. Reported by Andrew Clausen . 1999-11-25 Andreas Jaeger * manual/install.texi (Running make install): Better describe update from libc5. Patch by Michael Deutschmann . 1999-11-25 Andreas Jaeger * include/sys/mman.h: Remove K&R compatibility. 1999-11-15 Andreas Jaeger * misc/sys/mman.h: Use __REDIRECT for mmap, correct prototype to use __off64_t. 1999-11-25 Ulrich Drepper * iconv/iconv_prog.c (process_block): For stateful charsets write out byte sequence to get to initial state at the end of the file. which was reported to not work (which proofed to be wrong). --- iconv/iconv_prog.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'iconv') diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index efa9e24..0144ac4 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -338,8 +338,32 @@ conversion stopped due to problem in writing the output")); } if (n != (size_t) -1) - /* Everything is processed. */ - break; + { + /* All the input test is processed. For state-dependent + character sets we have to flush the state now. */ + outptr = outbuf; + outlen = OUTBUF_SIZE; + n = iconv (cd, NULL, NULL, &outptr, &outlen); + + if (outptr != outbuf) + { + /* We have something to write out. */ + int errno_save = errno; + + if (fwrite (outbuf, 1, outptr - outbuf, output) < outptr - outbuf + || ferror (output)) + { + /* Error occurred while printing the result. */ + error (0, 0, _("\ +conversion stopped due to problem in writing the output")); + return -1; + } + + errno = errno_save; + } + + break; + } if (errno != E2BIG) { -- cgit v1.1