summaryrefslogtreecommitdiff
path: root/src/arpa/inet/inet_ntop.c
blob: efd14684a652917804ecc68aaa892c53cd84d036 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#if 0

#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>

const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size)
{
	if (af == AF_INET) {
		in_addr_t *a = src;
		char s[INET_ADDRSTRLEN] = "";
		if (snprintf(s, sizeof(s), "%hhu.%hhu.%hhu.%hhu",
			(*src >> 24) & 0xff,
			(*src >> 16) & 0xff,
			(*src >> 8) & 0xff,
			(*src) & 0xff) > size) {
			errno = ENOSPC;
			return NULL;
		}
		strcpy(dst, s);
		return dst;
	}

	if (af != AF_INET6) {
		errno = EAFNOSUPPORT;
		return NULL;
	}

	/*
	char s[INET6_ADDRSTRLEN] = "";
	unsigned char *a = src;
	*/
	/* do IPv6 conversion */
	return dst;
}


#endif