/*
 *			f r g e t . c
 */

/*)LIBRARY
*/

#ifdef DOCUMENTATION

title	frget	Fixed Length Get
index		fixed length Get

synopsis

	int
	frget(buffer,bufsiz,ioptr,number)
	 char *buffer;		/* where to put it */
	 unsigned bufsiz;	/* how much to get */
	 FILE *ioptr;		/* where to get it from */
	 long number;		/* which record to get */

description

	frget() get's a specified record of a specified length from the
	specified input file, and places it in the buffer.
	This is a FCS 'C' interface routine. Returns 0 for sucess, or
	$$ferr on error. See RSX11M I/O error codes.

bugs

	Very sleezy, and needs to be re-written.

author

	Machiavelli Systems

#endif

#define _production

#include <stdio.h>
#include <cx.h>
#include <nboff.h>
#include <fdoff.h>

#define	FDBOFF	024		/* where the fdb really is in FILE struct */





int	frget(buffer,bufsiz,ioptr,number)	/* random access get */
char		*buffer;		/* where it is to go */
unsigned	bufsiz;			/* how much to get */
long		number;			/* the record number to get */
{
	int		r;			/* how many actually got */

	/* pointer the record pointer at what we wnat to get */
	recnum(ioptr,number);

	/* go get the data */
	r = fget(buffer,bufsiz,ioptr);

	/* if nothing read, return the error code, otherwise return 0 */
	return	(r?0:$$ferr);
}
