fixed fflush: it didn't even compile!

This commit is contained in:
eck 1990-02-13 17:08:05 +00:00
parent c6d14bb079
commit e4d7651f02

View file

@ -3,10 +3,12 @@
*/ */
/* $Header$ */ /* $Header$ */
#include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include "loc_incl.h" #include "loc_incl.h"
int _write(int d, const char *buf, int nbytes); int _write(int d, const char *buf, int nbytes);
off_t _lseek(int fildes, off_t offset, int whence);
int int
fflush(FILE *stream) fflush(FILE *stream)
@ -21,8 +23,8 @@ fflush(FILE *stream)
} }
if (!stream->_buf if (!stream->_buf
|| (!io_testflag(_IOREADING) || (!io_testflag(stream, _IOREADING)
&& !io_testflag(_IOWRITING))) && !io_testflag(stream, _IOWRITING)))
return 0; return 0;
if (io_testflag(stream, _IOREADING)) { if (io_testflag(stream, _IOREADING)) {
(void) fseek(stream, 0L, SEEK_CUR); (void) fseek(stream, 0L, SEEK_CUR);
@ -39,7 +41,7 @@ fflush(FILE *stream)
return 0; return 0;
if (io_testflag(stream, _IOAPPEND)) { if (io_testflag(stream, _IOAPPEND)) {
if (lseek(fileno(stream), 0L, SEEK_END) == -1) { if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
stream->_flags |= _IOERR; stream->_flags |= _IOERR;
return EOF; return EOF;
} }