summaryrefslogtreecommitdiffstats
path: root/usr/klibc/inet/inet_ntoa.c
blob: 6dbf05730c302b014504629174a3c8a65fed2839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * inet/inet_ntoa.c
 */

#include <stdint.h>
#include <arpa/inet.h>
#include <stdio.h>

char *inet_ntoa(struct in_addr addr)
{
	static char name[16];
	const uint8_t *cp = (const uint8_t *) &addr.s_addr;

	sprintf(name, "%u.%u.%u.%u", cp[0], cp[1], cp[2], cp[3]);
	return name;
}