# include	"machine.h"

# if !CR_VMS && !CR_DOS
# include	"unix.c"
# endif

# if CR_VMS
# include	"vms.c"
# endif

# if CR_DOS
# include	"dos.c"
# endif

/**********************************************************************/
/*   Routines  which  are  machine  independent  but  are useful for  */
/*   making the rest of the code portable, especially to VMS.	      */
/**********************************************************************/
int
sys_read(fd, buf, size)
int	fd;
char	*buf;
int	size;
{	int	n;
	int	osize = size;
	do {
		n = read(fd, buf, size);
		size -= n;
		buf += n;
		}
	while (n > 0);
	return osize - size;
}
# if	!defined(VMS)
/* VMS version in vms.c */
int
sys_write(fd, buf, size)
int	fd;
char	*buf;
int	size;
{	

# if CR_DOS
	extern compat_flag;
	if (!compat_flag) {
		dos_write(buf, size);
		return size;
		}
# else
	turn_on_delay(fd);
# endif

	write(fd, buf, size);
	return size;
}
# endif
