mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
356 B
17 lines
356 B
|
15 years ago
|
#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;
|
||
|
|
}
|