diff options
Diffstat (limited to 'src/arpa/inet/inet_ntoa.c')
-rw-r--r-- | src/arpa/inet/inet_ntoa.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/arpa/inet/inet_ntoa.c b/src/arpa/inet/inet_ntoa.c new file mode 100644 index 00000000..c2ca7fc6 --- /dev/null +++ b/src/arpa/inet/inet_ntoa.c @@ -0,0 +1,14 @@ +#include <arpa/inet.h> +#include <netinet/in.h> +#include <stdio.h> + +char *inet_ntoa(struct in_addr in) +{ + static char s[INET_ADDRSTRLEN] = ""; + sprintf(s, "%hhu.%hhu.%hhu.%hhu", + (in.s_addr >> 24) & 0xff, + (in.s_addr >> 16) & 0xff, + (in.s_addr >> 8) & 0xff, + (in.s_addr) & 0xff); + return s; +} |