Reverted latest changes.
[reactos.git] / reactos / lib / msvcrt / stdio / fprintf.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <msvcrt/stdio.h>
3 #include <msvcrt/wchar.h>
4 #include <msvcrt/internal/file.h>
5
6 int
7 fprintf(register FILE *iop, const char *fmt, ...)
8 {
9 int len;
10 char localbuf[BUFSIZ];
11 va_list a=0;
12
13
14 va_start( a, fmt );
15 if (iop->_flag & _IONBF)
16 {
17 iop->_flag &= ~_IONBF;
18 iop->_ptr = iop->_base = localbuf;
19 iop->_bufsiz = BUFSIZ;
20 len = vfprintf(iop,fmt,a);
21 fflush(iop);
22 iop->_flag |= _IONBF;
23 iop->_base = NULL;
24 iop->_bufsiz = 0;
25 iop->_cnt = 0;
26 }
27 else
28 len = vfprintf(iop, fmt, a);
29 return ferror(iop) ? EOF : len;
30 }
31
32 int
33 fwprintf(register FILE *iop, const wchar_t *fmt, ...)
34 {
35 int len;
36 wchar_t localbuf[BUFSIZ];
37 va_list a=0;
38
39
40 va_start( a, fmt );
41 if (iop->_flag & _IONBF)
42 {
43 iop->_flag &= ~_IONBF;
44 iop->_ptr = iop->_base = (char *)localbuf;
45 iop->_bufsiz = BUFSIZ;
46 len = vfwprintf(iop,fmt,a);
47 fflush(iop);
48 iop->_flag |= _IONBF;
49 iop->_base = NULL;
50 iop->_bufsiz = 0;
51 iop->_cnt = 0;
52 }
53 else
54 len = vfwprintf(iop, fmt, a);
55 return ferror(iop) ? EOF : len;
56 }