wut/libraries/wutsocket/host.c
GaryOderNichts 2c98cc91aa
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
Run clang-format
`find . -regex '.*\.\(cpp\|hpp\|cu\|cuh\|c\|h\)' -exec clang-format -style=file -i {} \;`
2025-06-05 11:06:04 +01:00

41 lines
724 B
C

#include "wut_socket.h"
#include <netdb.h>
#include <nsysnet/_netdb.h>
struct hostent *
gethostbyaddr(const void *addr,
socklen_t len,
int type)
{
if (!addr || !len) {
h_errno = HOST_NOT_FOUND;
return NULL;
}
if (type != AF_INET) {
h_errno = HOST_NOT_FOUND;
return NULL;
}
struct hostent *ent = RPLWRAP(gethostbyaddr)(addr, len, type);
h_errno = *RPLWRAP(get_h_errno)();
return ent;
}
struct hostent *
gethostbyname(const char *name)
{
if (!name) {
h_errno = HOST_NOT_FOUND;
return NULL;
}
struct hostent *ent = RPLWRAP(gethostbyname)(name);
h_errno = *RPLWRAP(get_h_errno)();
return ent;
}