code: purgatorio

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