Initial revision
This commit is contained in:
22
lang/cem/libcc/stdio/fclose.c
Normal file
22
lang/cem/libcc/stdio/fclose.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
fclose(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i=0; i<_NFILES; i++)
|
||||
if (fp == _io_table[i]) {
|
||||
_io_table[i] = 0;
|
||||
break;
|
||||
}
|
||||
if (i >= _NFILES)
|
||||
return(EOF);
|
||||
fflush(fp);
|
||||
close(fileno(fp));
|
||||
if ( io_testflag(fp,IO_MYBUF) && fp->_buf )
|
||||
free( fp->_buf );
|
||||
free(fp);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user