From: Florian Forster Date: Fri, 2 Jun 2006 22:14:16 +0000 (+0200) Subject: oping: Improved the error message is a destination cannot be resolved. X-Git-Tag: liboping-0.2.2~2 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=3b92b82fc65a2797189ae49f98500a537fbbfc93;p=liboping.git oping: Improved the error message is a destination cannot be resolved. Also no further error is printed if the command exits due to no resolvable hosts: People will notice that condition.. --- diff --git a/src/oping.c b/src/oping.c index 50c051b..52f12c6 100644 --- a/src/oping.c +++ b/src/oping.c @@ -298,7 +298,9 @@ int main (int argc, char **argv) { if (ping_host_add (ping, argv[i]) < 0) { - fprintf (stderr, "ping_host_add (%s) failed\n", argv[i]); + const char *errmsg = ping_get_error (ping); + + fprintf (stderr, "Adding host `%s' failed: %s\n", argv[i], errmsg); continue; } } @@ -331,10 +333,7 @@ int main (int argc, char **argv) } if (i == 0) - { - fprintf (stderr, "No valid hosts left.\n"); exit (1); - } memset (&sigint_action, '\0', sizeof (sigint_action)); sigint_action.sa_handler = sigint_handler;