+#if defined(HAVE_GETHOSTBYADDR_R_8_ARGS)
+ gethostbyaddr_r((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET,
+ &result, hbuf, HOSTENT_BUFFER_SIZE,
+ &host, &thd_err);
+#elif defined(HAVE_GETHOSTBYADDR_R_7_ARGS)
+ host = gethostbyaddr_r((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET,
+ &result, hbuf, HOSTENT_BUFFER_SIZE, &thd_err);
+#elif defined(HAVE_GETHOSTBYADDR_R_5_ARGS)
+ if (0 == gethostbyaddr_r((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET,
+ &result, &hdata))
+ {
+ host = &result;
+ }
+ else
+ {
+ host = NULL;
+ }
+#else