As far as I know, EXIT_FAILURE is only portable when used as-is, i.e. without
adding anything to it. Especially with "EXIT_FAILURE == -1" we might run into
trouble. I think it's more convenient to just use the number of failed hosts
rather than 1+<num> (on Linux).
zero means that the exit status will only be zero if I<all> replies for I<all>
hosts have been received.
zero means that the exit status will only be zero if I<all> replies for I<all>
hosts have been received.
+The exit status will indicate the number of hosts with more than I<percent>
+packets lost, up to a number of 255 failing hosts.
+
#endif
} /* }}} void update_host_hook */
#endif
} /* }}} void update_host_hook */
-/* Returns the number of hosts which failed to return more than the
- fraction opt_exit_status_threshold of pings */
+/* Prints statistics for each host, cleans up the contexts and 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;
static int post_loop_hook (pingobj_t *ping) /* {{{ */
{
pingobj_iter_t *iter;
opt_count--;
} /* while (opt_count != 0) */
opt_count--;
} /* while (opt_count != 0) */
+ /* Returns the number of failed hosts according to -Z. */
status = post_loop_hook (ping);
ping_destroy (ping);
status = post_loop_hook (ping);
ping_destroy (ping);
- if (status)
- return (EXIT_FAILURE + status);
+ if (status == 0)
+ exit (EXIT_SUCCESS);
+ {
+ if (status > 255)
+ status = 255;
+ exit (status);
+ }
} /* }}} int main */
/* vim: set fdm=marker : */
} /* }}} int main */
/* vim: set fdm=marker : */