1 #include "stdio_impl.h"
13 static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
17 struct cookie *c = f->cookie;
18 if (s!=f->wbase && sw_write(f, f->wbase, f->wpos-f->wbase)==-1)
20 while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {
28 f->wpos = f->wbase = f->wend = 0;
32 f->wend = f->buf + f->buf_size;
33 f->wpos = f->wbase = f->buf;
37 int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_list ap)
41 unsigned char buf[256];
42 struct cookie c = { s, n-1 };
44 memset(&f, 0, sizeof(FILE));
47 f.buf_size = sizeof buf;
53 } else if (n > INT_MAX) {
57 r = vfwprintf(&f, fmt, ap);