code: 9ferno

ref: 8d0725d57a988ed0ed2ef0a33e0cebe48a85b5db
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;
}