])
AC_SUBST([RESOLV_LIBS])
-# Error printing functions.
-AC_CHECK_FUNC([herror], [],
- [AC_DEFINE([NO_HERROR], [1], [Define if you don't have the herror() function available.])])
-
+# Check errno and socket data types.
AC_CHECK_DECLS([errno], [], [], [[
#include <errno.h>
#include <sys/errno.h>
#endif
-#ifdef NO_HERROR
-#define herror(str) fprintf(stderr, str ": error looking up \"%s\"\n", Hostname);
-#endif
-
-
int DisplayMode;
int display_mode;
int Interactive = 1;
{
struct hostent * host = NULL;
int net_preopen_result;
-#ifdef ENABLE_IPV6
struct addrinfo hints, *res;
int error;
struct hostent trhost;
char * alptr[2];
struct sockaddr_in * sa4;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 * sa6;
#endif
}
}
-#ifdef ENABLE_IPV6
/* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */
memset( &hints, 0, sizeof hints );
hints.ai_family = af;
sa4 = (struct sockaddr_in *) res->ai_addr;
alptr[0] = (void *) &(sa4->sin_addr);
break;
+#ifdef ENABLE_IPV6
case AF_INET6:
sa6 = (struct sockaddr_in6 *) res->ai_addr;
alptr[0] = (void *) &(sa6->sin6_addr);
break;
+#endif
default:
fprintf( stderr, "mtr unknown address type\n" );
if ( DisplayMode != DisplayCSV ) exit(EXIT_FAILURE);
}
}
alptr[1] = NULL;
-#else
- host = gethostbyname(Hostname);
- if (host == NULL) {
- herror("mtr gethostbyname");
- if ( DisplayMode != DisplayCSV ) exit(EXIT_FAILURE);
- else {
- names = names->next;
- continue;
- }
- }
- af = host->h_addrtype;
-#endif
if (net_open(host) != 0) {
fprintf(stderr, "mtr: Unable to start net module.\n");