/* ghostbya.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */

#include <stdlib.h>
#include <sys/types.h>
#include <netdb.h>
#include <errno.h>
#include <emx/syscalls.h>

extern int h_errno;

struct hostent *gethostbyaddr (const char *addr, int len, int type)
{
  struct hostent *result;
  int saved_errno;

  saved_errno = errno;
  if (__gethostbyaddr (addr, len, type, &result) != 0)
    {
      if (errno > 4)            /* ENOSYS! */
        h_errno = NO_RECOVERY;
      else
        h_errno = errno;
      result = NULL;
    }
  errno = saved_errno;
  return result;
}
