Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / lib / msvcrt / stdio / flsbuf.c
index 4af1ee9..691f481 100644 (file)
@@ -1,13 +1,7 @@
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <msvcrti.h>
 
-#include <msvcrt/stdio.h>
-#include <msvcrt/wchar.h>
-#include <msvcrt/sys/types.h>
-#include <msvcrt/stdlib.h>
-#include <msvcrt/internal/file.h>
-#include <msvcrt/io.h>
-#include <msvcrt/errno.h>
 
 int cntcr(char *bufp, int bufsiz);
 int convert(char *endp, int bufsiz,int n);
@@ -31,7 +25,7 @@ _flsbuf(int c, FILE *f)
 // no file associated with buffer
 // this is a memory stream
 
-  if ( fileno(f) == -1 )
+  if ( _fileno(f) == -1 )
        return c;
 
   /* if the buffer is not yet allocated, allocate it */
@@ -49,7 +43,7 @@ _flsbuf(int c, FILE *f)
       f->_cnt = f->_bufsiz = size;
       f->_ptr = base;
       rn = 0;
-      if (f == stdout && isatty (fileno (stdout)))
+      if (f == stdout && _isatty (_fileno (stdout)))
        f->_flag |= _IOLBF;
     }
   }
@@ -86,7 +80,7 @@ _flsbuf(int c, FILE *f)
     rn = f->_ptr - base;
     f->_ptr = base;
     if ( (f->_flag & _IOAHEAD) == _IOAHEAD )
-       _lseek(fileno(f),-(rn+f->_cnt), SEEK_CUR);
+       _lseek(_fileno(f),-(rn+f->_cnt), SEEK_CUR);
     f->_cnt = f->_bufsiz;
     f->_flag &= ~_IOAHEAD;
   }
@@ -96,7 +90,7 @@ _flsbuf(int c, FILE *f)
   f->_flag &= ~_IODIRTY;
   while (rn > 0)
   {
-    n = _write(fileno(f), base, rn);
+    n = _write(_fileno(f), base, rn);
     if (n <= 0)
     {
       f->_flag |= _IOERR;