Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 * pANS stdio -- fclose
3
 */
4
#include "iolib.h"
5
int fclose(FILE *f){
6
	int error=0;
7
	if(f->state==CLOSED) return EOF;
8
	if(fflush(f)==EOF) error=EOF;
9
	if(f->flags&BALLOC) free(f->buf);
10
	if(!(f->flags&STRING) && close(f->fd)<0) error=EOF;
11
	f->state=CLOSED;
12
	f->flags=0;
13
	return error;
14
}