2 * fclose.c - flush a stream and close the file
4 /* $Id: fclose.c,v 1.5 1994/06/24 11:48:38 ceriel Exp $ */
15 register int i, retval = 0;
17 for (i=0; i<FOPEN_MAX; i++)
18 if (fp == __iotab[i]) {
24 if (fflush(fp)) retval = EOF;
25 if (_close(fileno(fp))) retval = EOF;
26 if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
27 free((void *)fp->_buf);
28 if (fp != stdin && fp != stdout && fp != stderr)