/*)LIBRARY
*/

#include	<rsts.h>
 
rs_read(channel, buffer, buflen, block, blockmsb, wait, modifier)
int		channel;		/* Channel to read from		*/
char		*buffer;		/* I/O buffer			*/
int		buflen;			/* Buffer size			*/
int		block;			/* Block number for disk	*/
int		blockmsb;		/* High-byte for disk block	*/
int		wait;			/* Wait time for terminal	*/
int		modifier;		/* Device modifier		*/
/*
 * read from this channel. Return
 *	>= 0	Number of bytes read
 *	<  0	-(error code)
 */
{
	register int	errcode;

	clrxrb();
	xrb.xrlen	= buflen;	/* Buffer length		*/
	xrb.xrbc	= 0;		/* Must be zero			*/
	xrb.xrloc	= buffer;	/* Buffer start			*/
	xrb.xrci	= channel * 2;	/* Channel number		*/
	xrb.xrblkm	= blockmsb;	/* High-byte for disk i/o	*/
	xrb.xrblk	= block;	/* Block number			*/
	xrb.xrtime	= wait;		/* Wait time for i/o		*/
	xrb.xrmod	= modifier;	/* Device (record) modifier	*/
	errcode = rstsys(_READ);
	return((errcode == 0) ? xrb.xrbc : -errcode);
}
