git: 9front

ref: 2b5e9756f86ce90bec3f739037a0ee192e16fafe
dir: /sys/src/ape/lib/ap/stdio/fopen.c/

View raw version
/*
 * pANS stdio -- fopen
 */
#include "iolib.h"
FILE *fopen(const char *name, const char *mode){
	FILE *f;
	for(f=_IO_stream;f!=&_IO_stream[FOPEN_MAX];f++)
		if(f->state==CLOSED)
			return freopen(name, mode, f);
	return NULL;
}