#

include(`dict.h')
include(`KERcalls.h')

/*
 *       SCCS File Type - Emulator Source File
 *
 *       What identification string
 */
static char *_S_K17	"@(#)EM_K17.c	3.1";
	/****************************************************************/
	/*
	 *      K_read_block
	 */


/*
 *      K_read_block (
 *          1   od,       : openDescriptor : int    (* to read from  *)
 *          2   blockNo,  : fBlockNumber   : long   (* which block ? *)
 *          3  &inP,      : p_block        : struct (* where to read *)
 *          4   id,       : asyncId        : int    (* asynch ID     *)
 *          5  &errs,     : ioStatus       : long   (* IO status     *)
 *          6  &bytesRead : cardinal       : int    (* byte count    *)
 *              )
 */

K_read_block(Pod, PblockNo, PinPP, Pid, PerrsP, PbytesReadP)
	openDescriptor  Pod;
	fBlockNumber    PblockNo;
	p_block         *PinPP;
	asyncId         Pid;
	ioStatus        *PerrsP;
	cardinal        *PbytesReadP;

{
	K_err_num       ex;

	struct  {       /* Kread_param  */
			openDescriptor  od;     /* const */
			fBlockNumber    blockNo;/* const */
			p_block         inP;    /* const */
			asyncId         id;     /* const */
			/* vars */
			ioStatus        verrs;
			cardinal        vcount;
		}pb;

	pb.od = Pod;
	pb.blockNo= PblockNo;
	st_copy(PinPP, &pb.inP, sizeof(p_block) );
	pb.id = Pid;

	ex = EMT17(&pb);

	*PerrsP         = pb.verrs;
	*PbytesReadP    = pb.vcount;

	return( ex );
}

