#define MAXNETS 5
#define MAXHOSTS 25
-extern int errno;
-
struct addrent {
int a_addrtype; /* assumes AF_INET for inet_netof () */
union {
char *PrincipalHostname();
#endif /* KPOP */
-#if defined(BIND) && !defined(h_addr)
+#if !defined(h_addr)
# define h_addr h_addr_list[0]
#endif
char *arguments[MAXARGS];
register struct hostent *hp;
register struct servent *sp;
-#ifndef BIND
+#ifndef HAVE_GETHOSTBYNAME
register struct netent *np;
#endif
for (ap = arguments; *ap; ap++) {
if (**ap == '\01') {
-#ifndef BIND
+/*
+ * the assumption here is that if the system doesn't have a
+ * gethostbyname() function, it must not use DNS. So we need to look
+ * into the /etc/hosts using gethostent(). There probablly aren't any
+ * systems still like this, but you never know. On every system I have
+ * access to, this section is ignored.
+ */
+#ifndef HAVE_GETHOSTBYNAME
if ((np = getnetbyname (*ap + 1))) {
+#ifdef HAVE_SETHOSTENT
sethostent (1);
+#endif /* HAVE_SETHOSTENT */
while ((hp = gethostent()))
if (np->n_addrtype == hp->h_addrtype
&& inet (hp, np->n_net)) {
break;
}
}
-#endif
+#endif /* don't HAVE_GETHOSTBYNAME */
continue;
}