From 3b92b82fc65a2797189ae49f98500a537fbbfc93 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 3 Jun 2006 00:14:16 +0200 Subject: [PATCH] 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.. --- src/oping.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; -- 2.11.0