err = PBHOpenDFSync(&hpb); if ((err == fnfErr) && (flags & PR_CREATE_FILE)) { err = PBHCreateSync(&hpb); if (err == noErr) goto open; }
err = PBHOpenDFSync(&hpb);
PRInt32 _MD_Open(const char *path, PRIntn flags, int mode){// Macintosh doesn't really have mode bits, just drop them#pragma unused (mode)	OSErr 				err; 	HParamBlockRec 		hpb; 	ParamBlockRec 		pb;	char	 			*macFileName = NULL;	Str255				pascalName;	PRInt8 				perm;    err = ConvertUnixPathToMacPath(path, &macFileName);		if (err != noErr)		goto ErrorExit;	hpb.ioParam.ioCompletion	= NULL;	PStrFromCStr(macFileName, pascalName);	PR_DELETE(macFileName);	hpb.ioParam.ioNamePtr 	= pascalName;	hpb.ioParam.ioVRefNum 	= 0;	hpb.ioParam.ioVersNum 	= 0;	hpb.fileParam.ioDirID	= 0;	if (flags & PR_RDWR)		perm = fsRdWrPerm;	else if (flags & PR_WRONLY)		perm = fsWrPerm;	else		perm = fsRdPerm;		hpb.ioParam.ioPermssn 	= perm;	open:	err = PBHOpenDFSync(&hpb);	if ((err == fnfErr) && (flags & PR_CREATE_FILE)) {		err = PBHCreateSync(&hpb);		if (err == noErr)			goto open;	}	if (err != noErr)		goto ErrorExit;	if (flags & PR_TRUNCATE) {		pb.ioParam.ioCompletion = NULL;		pb.ioParam.ioRefNum = hpb.ioParam.ioRefNum;		pb.ioParam.ioMisc = NULL;		err = PBSetEOFSync(&pb);		if (err != noErr)			goto ErrorExit;	} else if (flags & PR_APPEND) {		pb.ioParam.ioCompletion = NULL;		pb.ioParam.ioRefNum = hpb.ioParam.ioRefNum;		pb.ioParam.ioPosMode = fsFromLEOF;		pb.ioParam.ioPosOffset = 0;		err = PBSetFPosSync(&pb);		if (err != noErr)			goto ErrorExit;	}	return hpb.ioParam.ioRefNum;		ErrorExit:	_PR_MD_CURRENT_THREAD()->md.osErrCode = err;	_MD_SetError(err);    return -1;}