summaryrefslogtreecommitdiff
path: root/net/udptunnel/patches/patch-ac
blob: 2dd413e4fbe9d0e9142e4944d43b102f30043372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$NetBSD: patch-ac,v 1.1 2005/11/02 15:08:44 tv Exp $

--- host2ip.c.orig	1999-05-19 15:58:25.000000000 -0400
+++ host2ip.c
@@ -1,10 +1,13 @@
 #include <sys/types.h>
 #include <sys/socket.h>      /* struct sockaddr */
 #include <stdlib.h>
+#include <string.h>
 #include <netdb.h>           /* gethostbyname() */
 #include <netinet/in.h>      /* sockaddr_in */
 #include <arpa/inet.h>       /* inet_addr() */
+#if HAVE_RPCSVC_YPCLNT_H
 #include <rpcsvc/ypclnt.h>   /* YP */
+#endif
 #include <ctype.h>           /* isspace() */
 
 #include "host2ip.h"
@@ -39,6 +42,7 @@ struct in_addr host2ip(char *host)
   }
   /* As a last resort, try YP. */
   else {
+#if HAVE_RPCSVC_YPCLNT_H
     static char *domain = 0;  /* YP domain */
     char *value;              /* key value */
     int value_len;            /* length of returned value */
@@ -47,9 +51,12 @@ struct in_addr host2ip(char *host)
     if (yp_match(domain, "hosts.byname", host, strlen(host), &value, &value_len) == 0) {
       in.s_addr = inet_addr(value);
     } else {
+#endif
       /* Everything failed */
       in.s_addr = INADDR_ANY;
+#if HAVE_RPCSVC_YPCLNT_H
     }
+#endif
   }
   return in;
 } /* host2ip */