aboutsummaryrefslogtreecommitdiff
path: root/unix/os/net/ghostbynm.c
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /unix/os/net/ghostbynm.c
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/os/net/ghostbynm.c')
-rw-r--r--unix/os/net/ghostbynm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/unix/os/net/ghostbynm.c b/unix/os/net/ghostbynm.c
new file mode 100644
index 00000000..42c9fb4a
--- /dev/null
+++ b/unix/os/net/ghostbynm.c
@@ -0,0 +1,37 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#include <stdio.h>
+#include "netdb.h"
+
+#define import_kernel
+#define import_knames
+#define import_spp
+#include <iraf.h>
+
+
+/* TCP_GETHOSTBYNAME -- Scan the host name table to get the internet address
+ * of the named host.
+ */
+struct hostent *
+tcp_gethostbyname (name)
+register char *name;
+{
+ register struct hostent *p;
+ register char **cp;
+ struct hostent *tcp_ghostent();
+
+eprintf("gethostbyname %s\n", name);
+ tcp_ophnt();
+
+ while (p = tcp_ghostent()) {
+ if (strcmp (p->h_name, name) == 0)
+ break;
+ for (cp = p->h_aliases; *cp != 0; cp++)
+ if (strcmp (*cp, name) == 0)
+ goto found;
+ }
+found:
+ tcp_clhnt();
+ return (p);
+}