--- src/usr.bin/whois/whois.c 2005/01/09 13:30:06 1.6 +++ src/usr.bin/whois/whois.c 2005/02/17 11:53:33 1.7 @@ -82,7 +82,7 @@ const char *ip_whois[] = { LNICHOST, RNI const char *port = DEFAULT_PORT; static char *choose_server(const char *); -static struct addrinfo *gethostinfo(char const *host, int exit_on_error); +static struct addrinfo *gethostinfo(const char *host, int exit_on_error); static void s_asprintf(char **ret, const char *format, ...); static void usage(void); static void whois(const char *, const char *, int); @@ -220,7 +220,7 @@ choose_server(const char *domain) } static struct addrinfo * -gethostinfo(char const *host, int exit_on_error) +gethostinfo(const char *host, int exit_on_error) { struct addrinfo hints, *res; int error; @@ -231,7 +231,10 @@ gethostinfo(char const *host, int exit_o hints.ai_socktype = SOCK_STREAM; error = getaddrinfo(host, port, &hints, &res); if (error) { - warnx("%s: %s", host, gai_strerror(error)); + if (error == EAI_SERVICE) + warnx("bad port: %s", port); + else + warnx("%s: %s", host, gai_strerror(error)); if (exit_on_error) exit(EX_NOHOST); return (NULL);