Example #1
0
File: fsync.c Project: aosm/bind
int __bind_mpe_fsync(int file) {

int ccode_return,dummy=0;

/* Complete I/O */
FCONTROL(_mpe_fileno(file),2,__bind_mpe_longaddr(&dummy));
if ((ccode_return=ccode()) != CCE) {
  fprintf(stderr,"MPE fsync complete failed, ccode=%d\n",ccode_return);
  PRINTFILEINFO(_mpe_fileno(file));
  errno = ESYSERR;
  return -1;
}

return 0;
}
Example #2
0
/** Open terminal device **/
int ttopen()
{
	short value;
	short error;

	/* Open terminal for input */
	mpetermin = FOPEN(0, 0444, 0, -80);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("Cannot open $STDIN\n");
#endif /* DEBUG */
		goto error_stdin;
	}

	/* Open terminal for output */
	mpetermout = FOPEN(0, 0414, 1, -80);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("Cannot open $STDLIST\n");
#endif /* DEBUG */
		goto error_stdlist;
	}

	/* Get terminal type */
	FCONTROL(mpetermin, 39, &mpetype);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("FCONTROL(39) failed\n");
#endif /* DEBUG */
		goto error_other;
	}

	/* Set transparent editing mode */
#ifdef DEBUG
	value = '*';
#else
	value = '\377';
#endif
	FDEVICECONTROL(mpetermin, &value, 1, 192, 15, 2, &error);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("FDEVICECONTROL(15) failed; error %d\n", error);
#endif /* DEBUG */
		goto error_other;
	}

	/* Turn off echo */
	mpeoecho = 0;
	FDEVICECONTROL(mpetermin, &mpeoecho, 1, 192, 4, 3, &error);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("FDEVICECONTROL(4) failed; error %d\n", error);
#endif /* DEBUG */
		goto error_other;
	}

	/* Set type ahead */
	mpeotahd = 1;
	FDEVICECONTROL(mpetermin, &mpeotahd, 1, 192, 51, 3, &error);
	if (ccode() != CCE) {
#ifdef DEBUG
		printf("FDEVICECONTROL(51) failed; error %d\n", error);
#endif /* DEBUG */
		goto error_other;
	}

	/* Success */
	return(0);

error_other:
	FCLOSE(mpetermout, 0, 0);
error_stdlist:
	FCLOSE(mpetermin, 0, 0);
error_stdin:
	return -1;
}