summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64dd469)
raw | patch | inline | side by side (parent: 64dd469)
author | Barak A. Pearlmutter <barak+git@cs.nuim.ie> | |
Tue, 6 Sep 2011 07:03:59 +0000 (08:03 +0100) | ||
committer | Florian Forster <ff@octo.it> | |
Wed, 7 Sep 2011 00:15:24 +0000 (20:15 -0400) |
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 09167882b46837cd361f6ec71d6b55c567936e3f..37f5fa91bc27c3e658ce06fd6b399c9f58ea9f8e 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
set_opt_send_qos (optarg);
break;
- case 'Z':
+ case 'Z':
{
char *endptr = NULL;
double tmp;
errno = 0;
tmp = strtod (optarg, &endptr);
- if ((errno != 0) || (endptr == NULL) || (*endptr != 0))
- fprintf (stderr, "The \"-Z\" option requires a numeric argument.\n");
- else if ((tmp >= 0.0) && (tmp <= 100.0))
- opt_exit_status_threshold = tmp / 100.0;
+ if ((errno != 0) || (endptr == NULL) || (*endptr != 0) || (tmp < 0.0) || (tmp > 100.0))
+ {
+ fprintf (stderr, "Ignoring invalid -Z argument: %s\n", optarg);
+ fprintf (stderr, "The \"-Z\" option requires a numeric argument between 0 and 100.\n");
+ }
else
- fprintf (stderr, "The argument of the \"-Z\" option must be between 0 and 100.\n");
+ opt_exit_status_threshold = tmp / 100.0;
break;
}
average = context_get_average (ctx);
deviation = context_get_stddev (ctx);
-
+
mvwprintw (ctx->window, /* y = */ 2, /* x = */ 2,
"rtt min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms",
ctx->latency_min,
#endif
} /* }}} void update_host_hook */
-/* returns the number of significant failures: sum over hosts of
- unreturned packets exceeding 50% of the number sent, rounding up. */
+/* Returns the number of hosts which failed to return more than the
+ fraction opt_exit_status_threshold of pings */
static int post_loop_hook (pingobj_t *ping) /* {{{ */
{
pingobj_iter_t *iter;
- /* failures to report: sum over hosts of number of failed
- returns above 50% */
int failure_count = 0;
#if USE_NCURSES
ping_destroy (ping);
if (status)
- return (EXIT_FAILURE + status);
+ return (EXIT_FAILURE + status);
else
- return (EXIT_SUCCESS);
+ return (EXIT_SUCCESS);
} /* }}} int main */
/* vim: set fdm=marker : */