/***********************************************************************\

    Filename: bytread.c

\***********************************************************************/

#include <memory.h>
#include "proxio.h"
#include "proxerr.h"
#include "spdef.h"

char *SPJumpLoc[1];
unsigned _SPErrNum[1];
unsigned _THErrNum[1];
unsigned _SPTHID[1];
unsigned _SPActive[] = { 0 };       /* Fucking C compiler won't let me use */
unsigned _THActive[] = { 0 };       /* long references any other way.      */
int *toolErr[1];

abytread(pptr, len, file)
char       **pptr;
unsigned    len;
HANDLE      file;
{
char *ptr;

   *pptr = ptr = (char *) zalloc(_SPTHID[0], len);
   if (!ptr)
       return (ERROR);
   if (bytread(ptr, len, file) == ERROR)
   {
       *pptr = 0;
       nzfree(ptr);
       return (ERROR);
   }
   return (OKAY);
}

bytread(ptr, len, file)
char     *ptr;
unsigned len;
HANDLE  file;
{
unsigned x;

   if ((x = stdread((char *) ptr, len, file)) != len)
       return (ERROR);
   return (OKAY);
}
