home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / v1 / fpurge.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-23  |  370 b   |  19 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <stdio.h>
  3. #include <libc/file.h>
  4.  
  5. int
  6. fpurge(FILE *f)
  7. {
  8.   char *base;
  9.  
  10.   if ((f->_flag&(_IONBF|_IOWRT))==_IOWRT
  11.       && (base = f->_base) != NULL
  12.       && (f->_ptr - base) > 0)
  13.   {
  14.     f->_ptr = base;
  15.     f->_cnt = (f->_flag&(_IOLBF|_IONBF)) ? 0 : f->_bufsiz;
  16.   }
  17.   return 0;
  18. }
  19.