Path: blob/main/comms/aprsd/files/patch-src_osdep.h
16461 views
--- src/osdep.h.orig 2003-04-20 18:34:47 UTC1+++ src/osdep.h2@@ -32,6 +32,14 @@3extern "C"4{5#include <netdb.h>6+#if (defined(__unix__) || defined(unix)) && !defined(USG)7+#include <sys/param.h>8+#endif9+#ifdef BSD10+#include <sys/types.h>11+#include <sys/socket.h>12+#include <netdb.h>13+#endif1415#if TIME_WITH_SYS_TIME16# include <sys/time.h>17@@ -63,10 +71,27 @@ namespace aprsd18char *buf, size_t buflen, struct hostent **result,19int *h_errnop)20{21-#ifdef __GLIBC__22+#ifdef BSD23+#if (__FreeBSD_version >= 600000)24return ::gethostbyname_r (name.c_str (), result_buf,25buf, buflen, result, h_errnop);26#else27+ struct hostent *h;28+ h = gethostbyname (name.c_str());29+ if (h != NULL) {30+ memcpy(result_buf,h,sizeof(*h));31+ *result = h;32+ *h_errnop = 0;33+ return 0;34+ } else {35+ *h_errnop = 0;36+ return 1;37+ }38+#endif39+#endif40+#ifdef __GLIBC__41+ return ::gethostbyname_r (name.c_str (), result_buf,42+ buf, buflen, result, h_errnop);43if (buflen < sizeof (hostent_data))44{45if (h_errnop != NULL)464748