summaryrefslogblamecommitdiff
path: root/src/network/gethostbyname2.c
blob: 9fbe2647b4daa6638e34c4151992adda3e0930fa (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                   
#define _GNU_SOURCE

#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <netinet/in.h>

struct hostent *gethostbyname2(const char *name, int af)
{
	static struct hostent h;
	static long buf[512/sizeof(long)];
	struct hostent *res;
	if (gethostbyname2_r(name, af, &h,
		(void *)buf, sizeof buf, &res, &h_errno)) return 0;
	return &h;
}