Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / net / tcl-scotty / patches / patch-ah
blobd88e734b65d4df12fc0b4dfea64b80e0368521cf
1 $NetBSD$
3 Avoid use of _res, since scotty is a pthread-linked program.
4 Instead, use the newer resolver interfaces.
6 --- tnm/generic/tnmDns.c.orig   1997-11-13 11:17:41.000000000 +0000
7 +++ tnm/generic/tnmDns.c
8 @@ -141,6 +141,8 @@ AssocDeleteProc(clientData, interp)
9   *----------------------------------------------------------------------
10   */
12 +static struct __res_state rs;
14  static void
15  DnsInit(timeout, retries, server)
16      int timeout;
17 @@ -150,20 +152,20 @@ DnsInit(timeout, retries, server)
18      static int initialized = 0;
20      if (! initialized) {
21 -       res_init();
22 -       _res.options |= RES_RECURSE | RES_DNSRCH | RES_DEFNAMES | RES_AAONLY;
23 +       res_ninit(&rs);
24 +       rs.options |= RES_RECURSE | RES_DNSRCH | RES_DEFNAMES | RES_AAONLY;
25         initialized = 1;
26 -       if (_res.nscount > 0) {
27 -           *server = _res.nsaddr.sin_addr;
28 +       if (rs.nscount > 0) {
29 +           *server = rs.nsaddr.sin_addr;
30         }
31         if (! server->s_addr) {
32             server->s_addr = htonl(INADDR_LOOPBACK);
33         }
34      }
36 -    _res.retrans = timeout;
37 -    _res.retry = retries + 1;
38 -    _res.nsaddr.sin_addr = *server;
39 +    rs.retrans = timeout;
40 +    rs.retry = retries + 1;
41 +    rs.nsaddr.sin_addr = *server;
42  }
43  \f
44  /*
45 @@ -248,7 +250,7 @@ DnsDoQuery(query_string, query_type, que
46       * res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen) 
47       */
48         
49 -    qlen = res_mkquery(QUERY, query_string, C_IN, query_type, 
50 +    qlen = res_nmkquery(&rs, QUERY, query_string, C_IN, query_type, 
51                        (u_char *) 0, 0, 0,
52                        (u_char *) &query, sizeof(query));
53      if (qlen <= 0) {
54 @@ -261,7 +263,7 @@ DnsDoQuery(query_string, query_type, que
55       * res_send(msg, msglen, answer, anslen)
56       */
58 -    alen = res_send((u_char *) &query, qlen, 
59 +    alen = res_nsend(&rs, (u_char *) &query, qlen, 
60                     (u_char *) &answer, sizeof (answer));
61      if (alen <= 0) {
62         query_result->n = -1;
63 @@ -499,10 +501,10 @@ DnsHaveQuery(query_string, query_type, q
65          if (i == -1) {
66             strcpy(tmp, query_string);
67 -       } else if (! _res.dnsrch[i]) {
68 +       } else if (! rs.dnsrch[i]) {
69             break;
70         } else {
71 -           sprintf(tmp, "%s.%s", query_string, _res.dnsrch[i]);
72 +           sprintf(tmp, "%s.%s", query_string, rs.dnsrch[i]);
73         }
74         
75         DnsDoQuery(tmp, query_type, &res);
76 @@ -529,10 +531,10 @@ DnsHaveQuery(query_string, query_type, q
78         if (i == -1) {
79             strcpy(tmp, query_string);
80 -       } else if (! _res.dnsrch[i]) {
81 +       } else if (! rs.dnsrch[i]) {
82             break;
83         } else {
84 -           sprintf(tmp, "%s.%s", query_string, _res.dnsrch[i]);
85 +           sprintf(tmp, "%s.%s", query_string, rs.dnsrch[i]);
86         }
87         
88         DnsDoQuery(tmp, query_type, &res);
89 @@ -562,8 +564,8 @@ DnsHaveQuery(query_string, query_type, q
90         if (tmpres.type != T_A || tmpres.n <= 0) {
91             return;
92         }
93 -       _res.nsaddr.sin_addr = tmpres.u.addr[0];
94 -       _res.nscount = 1;
95 +       rs.nsaddr.sin_addr = tmpres.u.addr[0];
96 +       rs.nscount = 1;
97         DnsHaveQuery(query_string, query_type, query_result, depth + 1);
98         return;
99      }