1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1987-01-27 15:57:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
fflush(iop)
|
|
|
|
FILE *iop;
|
|
|
|
{
|
|
|
|
int count, c1;
|
|
|
|
|
1987-01-28 14:38:38 +00:00
|
|
|
if (!iop->_buf ||
|
|
|
|
io_testflag(iop,IO_UNBUFF) ||
|
|
|
|
!io_testflag(iop,IO_WRITEMODE) )
|
1987-01-27 15:57:55 +00:00
|
|
|
return(0);
|
|
|
|
|
1989-02-21 10:01:55 +00:00
|
|
|
count = iop->_bufsiz - iop->_count;
|
1987-01-27 15:57:55 +00:00
|
|
|
if ( count <= 0 )
|
|
|
|
return(0);
|
|
|
|
|
|
|
|
c1 = write(iop->_fd,iop->_buf,count);
|
|
|
|
|
|
|
|
if ( count == c1 ) {
|
1989-02-21 10:01:55 +00:00
|
|
|
iop->_count = iop->_bufsiz;
|
1987-01-27 15:57:55 +00:00
|
|
|
iop->_ptr = iop->_buf;
|
|
|
|
return(count);
|
|
|
|
}
|
|
|
|
|
|
|
|
iop->_flags |= IO_ERR;
|
|
|
|
return(EOF);
|
|
|
|
}
|