- for (ep=q; ctype_digit(*ep); ep++);
- if (ep==q || (*ep && *ep!=' ')) Psyntax("invalid port number");
- *ep= 0;
- hint.ai_socktype= SOCK_DGRAM;
- hint.ai_family= AF_UNSPEC;
- hint.ai_flags= AI_NUMERICHOST | AI_NUMERICSERV;
- err= getaddrinfo(p, q, &hint, &ai);
+ ul= strtoul(q,&ep,10);
+ if (*ep && *ep != ' ') Psyntax("invalid port (bad syntax)");
+ if (ul >= 65536) Psyntax("port too large");
+ a.len= sizeof(a.addr);
+ err= adns_text2addr(p, (int)ul, 0, &a.addr.sa,&a.len);