From: Ken Raeburn Date: Fri, 2 May 2003 08:05:23 +0000 (+0000) Subject: * port-sockets.h (inet_ntop) [!_WIN32 && !HAVE_MACSOCK_H]: Define as a macro if X-Git-Tag: krb5-1.4-beta1~988 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=542bd125d08d99affabd3077c40d54ffdfa36278;p=krb5.git * port-sockets.h (inet_ntop) [!_WIN32 && !HAVE_MACSOCK_H]: Define as a macro if not provided by the OS. ticket: 1435 target_version: 1.3 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15391 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 15b749707..e3b83e825 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,8 @@ +2003-05-02 Ken Raeburn + + * port-sockets.h (inet_ntop) [!_WIN32 && !HAVE_MACSOCK_H]: Define + as a macro if not provided by the OS. + 2003-04-28 Ken Raeburn * k5-int.h (struct _krb5_context): Change os_context to be an diff --git a/src/include/port-sockets.h b/src/include/port-sockets.h index 34489669b..eb87bc1c9 100644 --- a/src/include/port-sockets.h +++ b/src/include/port-sockets.h @@ -153,6 +153,21 @@ typedef struct iovec sg_buf; #define SHUTDOWN_WRITE 1 #define SHUTDOWN_BOTH 2 +#ifndef HAVE_INET_NTOP +#define inet_ntop(AF,SRC,DST,CNT) \ + ((AF) == AF_INET \ + ? ((CNT) < 16 \ + ? (SOCKET_SET_ERRNO(ENOSPC), NULL) \ + : (sprintf((DST), "%d.%d.%d.%d", \ + ((const unsigned char *)(const void *)(SRC))[0] & 0xff, \ + ((const unsigned char *)(const void *)(SRC))[1] & 0xff, \ + ((const unsigned char *)(const void *)(SRC))[2] & 0xff, \ + ((const unsigned char *)(const void *)(SRC))[3] & 0xff), \ + (DST))) \ + : (SOCKET_SET_ERRNO(EAFNOSUPPORT), NULL)) +#define HAVE_INET_NTOP +#endif + #endif /* HAVE_MACSOCK_H */ #endif /* _WIN32 */