prepare move old cruft
[reactos.git] / reactos / lib / crtdll / old cruft / stdio / fputws.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
3 #include <precomp.h>
4 #include <msvcrt/stdio.h>
5 #include <msvcrt/internal/file.h>
6 #include <msvcrt/string.h>
7
8 //int fputws(const wchar_t* wsOutput, FILE* fileWrite)
9 //int fputs(const char *s, FILE *f)
10
11 int
12 fputws(const wchar_t* s, FILE* f)
13 {
14 int r = 0;
15 int c;
16 int unbuffered;
17 wchar_t localbuf[BUFSIZ];
18
19 unbuffered = f->_flag & _IONBF;
20 if (unbuffered)
21 {
22 f->_flag &= ~_IONBF;
23 f->_ptr = f->_base = localbuf;
24 f->_bufsiz = BUFSIZ;
25 }
26
27 while ((c = *s++))
28 r = putwc(c, f);
29
30 if (unbuffered)
31 {
32 fflush(f);
33 f->_flag |= _IONBF;
34 f->_base = NULL;
35 f->_bufsiz = 0;
36 f->_cnt = 0;
37 }
38 return(r);
39 }