code: 9ferno

ref: 25e4f8ae90bd66f124f6b96ffdf70ae00100d4c0
dir: /emu/port/file.c/

View raw version
#include	"dat.h"
#include	"fns.h"
#include	"error.h"

int
openmode(ulong o)
{
	if(o >= (OTRUNC|OCEXEC|ORCLOSE|OEXEC))
		error(Ebadarg);
	o &= ~(OTRUNC|OCEXEC|ORCLOSE);
	if(o > OEXEC)
		error(Ebadarg);
	if(o == OEXEC)
		return OREAD;
	return o;
}