-static int
-rcaux (struct servent *sp, struct hostent *hp, int rproto,
- char *response, int len_response)
-{
- int sd;
- struct in_addr in;
- register struct addrent *ap;
- struct sockaddr_in in_socket;
- register struct sockaddr_in *isock = &in_socket;
-
-#ifdef KPOP
- int rem;
- struct hostent *hp2;
-#endif /* KPOP */
-
- for (ap = nets; ap < n1; ap++)
- if (ap->a_addrtype == hp->h_addrtype && inet (hp, ap->a_net))
- return NOTOK;
-
- for (ap = hosts; ap < h1; ap++)
- if (ap->a_addrtype == hp->h_addrtype
- && memcmp(ap->a_addr, hp->h_addr, hp->h_length) == 0)
- return NOTOK;
-
- if ((sd = getport (rproto, hp->h_addrtype, response, len_response)) == NOTOK)
- return OOPS2;
-
- memset (isock, 0, sizeof(*isock));
- isock->sin_family = hp->h_addrtype;
- inaddr_copy (hp, isock);
- isock->sin_port = sp->s_port;
-
- if (connect (sd, (struct sockaddr *) isock, sizeof(*isock)) == NOTOK)
- switch (errno) {
- case ENETDOWN:
- case ENETUNREACH:
- close (sd);
- if (n1 < n2) {
- n1->a_addrtype = hp->h_addrtype;
- memcpy(&in, hp->h_addr, sizeof(in));
- n1->a_net = inet_netof (in);
- n1++;
- }
- return OOPS1;
-
- case ETIMEDOUT:
- case ECONNREFUSED:
- default:
- close (sd);
- if (h1 < h2) {
- h1->a_addrtype = hp->h_addrtype;
- memcpy(h1->a_addr, hp->h_addr, hp->h_length);
- h1++;
- }
- return NOTOK;
- }