Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-03-27 13:38:39 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-03-27 13:38:39 +0400
commit409c27f83478e2962c446be23e104a97b3f5f2e0 (patch)
tree4548f42d093397fb049fdfae40f28968d59499ab /newlib/libc/stdio/fputws.c
parent1ebc8da242a1e8dd7707f2bcc51c22d4e1e64990 (diff)
* acconfig.h (_FVWRITE_IN_STREAMIO): Undefine.
* newlib.hin (_FVWRITE_IN_STREAMIO): Undefine. * configure.in (--disable-newlib-fvwrite-in-streamio): New option. * configure: Regenerated. * libc/stdio/fputs.c (_fputs_r): Use _FVWRITE_IN_STREAMIO to control __sfvwrite_r. Add alternative implementation. * libc/stdio/fputws.c (_fputws_r): Ditto. * libc/stdio/fwrite.c (_fwrite_r): Ditto. * libc/stdio/puts.c (_puts_r): Ditto. * libc/stdio/vfprintf.c (__ssputs_r, __sfputs_r): New function. (_VFPRINTF_R): Use _FVWRITE_IN_STREAMIO to control vector buffer. (__SPRINT): Use _FVWRITE_IN_STREAMIO to control macro definition. * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use _FVWRITE_IN_STREAMIO to control vector buffer.
Diffstat (limited to 'newlib/libc/stdio/fputws.c')
-rw-r--r--newlib/libc/stdio/fputws.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fputws.c b/newlib/libc/stdio/fputws.c
index c88111cb0..0893b3c33 100644
--- a/newlib/libc/stdio/fputws.c
+++ b/newlib/libc/stdio/fputws.c
@@ -84,6 +84,7 @@ _DEFUN(_fputws_r, (ptr, ws, fp),
{
size_t nbytes;
char buf[BUFSIZ];
+#ifdef _FVWRITE_IN_STREAMIO
struct __suio uio;
struct __siov iov;
@@ -108,8 +109,35 @@ _DEFUN(_fputws_r, (ptr, ws, fp),
return (0);
error:
- _newlib_flockfile_end(fp);
+ _newlib_flockfile_end (fp);
return (-1);
+#else
+ _newlib_flockfile_start (fp);
+ ORIENT (fp, 1);
+ if (cantwrite (ptr, fp) != 0)
+ goto error;
+
+ do
+ {
+ size_t i = 0;
+ nbytes = _wcsrtombs_r (ptr, buf, &ws, sizeof (buf), &fp->_mbstate);
+ if (nbytes == (size_t) -1)
+ goto error;
+ while (i < nbytes)
+ {
+ if (__sputc_r (ptr, buf[i], fp) == EOF)
+ goto error;
+ i++;
+ }
+ }
+ while (ws != NULL);
+ _newlib_flockfile_exit (fp);
+ return (0);
+
+error:
+ _newlib_flockfile_end (fp);
+ return (-1);
+#endif
}
int