-#if 0
- char str[128]; /* IPv6 address will fit, hostnames hopefully too */
- struct addrinfo *result = NULL;
- int rc;
- struct addrinfo hint;
-
- memset(&hint, 0 , sizeof(hint));
- /* hint.ai_family = AF_UNSPEC; - zero anyway */
- /* Needed. Or else we will get each address thrice (or more)
- * for each possible socket type (tcp,udp,raw...): */
- hint.ai_socktype = SOCK_STREAM;
- // hint.ai_flags = AI_CANONNAME;
- rc = getaddrinfo(hostname, NULL /*service*/, &hint, &result);
-
- if (!rc) {
- struct addrinfo *cur = result;
- // printf("%s\n", cur->ai_canonname); ?
- while (cur) {
- sockaddr_to_dotted(cur->ai_addr, str, sizeof(str));
- printf("%s %s\nAddress: %s", header, hostname, str);
- str[0] = ' ';
- if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str+1, sizeof(str)-1, NULL, 0, NI_NAMEREQD))
- str[0] = '\0';
- puts(str);
- cur = cur->ai_next;
- }
- } else {
- bb_error_msg("getaddrinfo('%s') failed: %s", hostname, gai_strerror(rc));
- }
- freeaddrinfo(result);
- return (rc != 0);
-
-#else
- /* We can't use host2sockaddr() - we want to get ALL addresses,