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

ssprint_r.c « stdio « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eedbd6a9390ed4cae246371a94915a2192ad39c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <newlib.h>

#ifdef _FVWRITE_IN_STREAMIO

#include <reent.h>
#include <stdio.h>
#include "fvwrite.h"

extern int __ssputs_r (struct _reent *ptr, FILE *fp, const char *buf,
		       size_t len);

int
__ssprint_r (struct _reent *ptr,
	FILE *fp,
	register struct __suio *uio)
{
	register struct __siov *iov = uio->uio_iov;
	register size_t len;
	int ret = 0;

	while (uio->uio_resid > 0 && uio->uio_iovcnt-- > 0) {
		if ((len = iov->iov_len) > 0) {
			if (__ssputs_r (ptr, fp, iov->iov_base, len) == EOF) {
				ret = EOF;
				break;
			}
			uio->uio_resid -= len;	/* pretend we copied all */
		}
		iov++;
	}
	uio->uio_resid = 0;
	uio->uio_iovcnt = 0;
	return ret;
}

#endif