summaryrefslogtreecommitdiffstats
path: root/Utilities/cmtar/compat/gethostbyname_r.c
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-28 15:18:37 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-28 15:18:37 (GMT)
commitbc1548b236515514c138da8b59f61af2efbfc4a5 (patch)
treeab8ab5b2bceca941f363ca7064248ece6779b617 /Utilities/cmtar/compat/gethostbyname_r.c
parent552842d11f845ad53e4f34be549aa4007737564b (diff)
downloadCMake-bc1548b236515514c138da8b59f61af2efbfc4a5.zip
CMake-bc1548b236515514c138da8b59f61af2efbfc4a5.tar.gz
CMake-bc1548b236515514c138da8b59f61af2efbfc4a5.tar.bz2
ENH: Initial import
Diffstat (limited to 'Utilities/cmtar/compat/gethostbyname_r.c')
-rw-r--r--Utilities/cmtar/compat/gethostbyname_r.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/Utilities/cmtar/compat/gethostbyname_r.c b/Utilities/cmtar/compat/gethostbyname_r.c
new file mode 100644
index 0000000..1b88bad
--- /dev/null
+++ b/Utilities/cmtar/compat/gethostbyname_r.c
@@ -0,0 +1,41 @@
+/*
+** Copyright 2002 University of Illinois Board of Trustees
+** Copyright 2002 Mark D. Roth
+** All rights reserved.
+**
+** gethostbyname_r.c - gethostbyname_r() function for compatibility library
+**
+** Mark D. Roth <roth@uiuc.edu>
+** Campus Information Technologies and Educational Services
+** University of Illinois at Urbana-Champaign
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <netdb.h>
+
+
+int
+compat_gethostbyname_r(const char *name, struct hostent *hp,
+ char *buf, size_t buflen,
+ struct hostent **hpp, int *herr)
+{
+#if GETHOSTBYNAME_R_NUM_ARGS == 5
+ *hpp = gethostbyname_r(name, hp, buf, buflen, herr);
+
+ if (*hpp == NULL)
+ return -1;
+ return 0;
+#elif GETHOSTBYNAME_R_NUM_ARGS == 3
+ struct hostent_data hdata;
+
+ if (gethostbyname_r(name, hp, &hdata) == -1)
+ return -1;
+ *hpp = hp;
+ return 0;
+#endif /* GETHOSTBYNAME_R_NUM_ARGS == 5 */
+}
+
+