1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 #include <string.h>
5 #include <sys/types.h>
6 #include <sys/socket.h>
7 #include <netinet/in.h>
8 #include <arpa/inet.h>
9 
10 const char *
11 my_inet_ntop( int af, void *src, char *dst, size_t cnt )
12 {
13 #ifdef HAVE_INET_NTOP
14    return inet_ntop(af, src, dst, cnt);
15 #else
16    /* This is not that pretty.. assuming src = sockaddr_in
17       and not really thread-safe on some OS .. blah */
18    return strncpy( dst, inet_ntoa( *(struct in_addr *)src ), cnt );
19 #endif
20 }
21