Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdio / swprint_r.c
blobe4be0c839a25f6b30ca8ded686275c1c1d0ec774
1 #include <newlib.h>
3 #ifdef _FVWRITE_IN_STREAMIO
5 #include <reent.h>
6 #include <stdio.h>
7 #include <wchar.h>
8 #include "fvwrite.h"
11 * Flush out all the vectors defined by the given uio,
12 * then reset it so that it can be reused.
14 int
15 __swprint_r (struct _reent *ptr,
16 FILE *fp,
17 register struct __suio *uio)
19 register int err = 0;
20 struct __siov *iov;
21 wchar_t *p;
22 int i, len;
24 if (uio->uio_resid == 0) {
25 uio->uio_iovcnt = 0;
26 return (0);
28 iov = uio->uio_iov;
29 for (; uio->uio_resid != 0;
30 uio->uio_resid -= len, iov++) {
31 p = (wchar_t *) iov->iov_base;
32 len = iov->iov_len;
33 for (i = 0; i < len; i++) {
34 if (_fputwc_r (ptr, p[i], fp) == WEOF) {
35 err = -1;
36 goto out;
40 out:
41 uio->uio_resid = 0;
42 uio->uio_iovcnt = 0;
43 return (err);
46 #endif