1 #include "stdio_impl.h"
12 static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
16 struct cookie *c = f->cookie;
17 if (s!=f->wbase && sw_write(f, f->wbase, f->wpos-f->wbase)==-1)
19 while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {
27 f->wpos = f->wbase = f->wend = 0;
31 f->wend = f->buf + f->buf_size;
32 f->wpos = f->wbase = f->buf;
36 int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_list ap)
39 unsigned char buf[256];
40 struct cookie c = { s, n-1 };
46 .buf_size = sizeof buf,
52 } else if (n > INT_MAX) {
56 r = vfwprintf(&f, fmt, ap);