author | Florian Forster <ff@octo.it> | |
Thu, 25 Sep 2014 00:10:54 +0000 (17:10 -0700) | ||
committer | Florian Forster <ff@octo.it> | |
Thu, 25 Sep 2014 00:10:54 +0000 (17:10 -0700) |
Conflicts:
src/mans/oping.pod
src/oping.c
src/mans/oping.pod
src/oping.c
1 | 2 | |||
---|---|---|---|---|
src/mans/oping.pod | patch | | diff1 | | diff2 | | blob | history |
src/oping.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc src/mans/oping.pod
index aedb728edde782e7e9e6f8ad890a0b766aa6d68d,8b8c644cfad164b9f4b7001ec099ed4e05e6bd9a..b6ce0b2b7f35d12355cf4dbc1e222ab15ecbaec7
--- 1/src/mans/oping.pod
--- 2/src/mans/oping.pod
+++ b/src/mans/oping.pod
I<Type of Service> (ToS) aliases were used to specify the bits of outgoing
packets.
+=item B<-u>|B<-U>
+
+I<noping only> B<-u> forces UTF-8 output, B<-U> disables UTF-8 output. If
+neither is given, the codeset is automatically determined from the locale.
+
+ =item B<-Z> I<percent>
+
+ If any hosts have a drop rate higher than I<percent>, where I<percent> is a
+ number between zero and 100 inclusively, exit with a non-zero exit status.
+ Since it is not possible to have a higher drop rate than 100%, passing this
+ limit will effectively disable the feature (the default). Setting the option to
+ 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.
+
=back
=head1 COLORS
diff --cc src/oping.c
index b3beeb09d52b363fca4727d88bbb29dc76d4d3d7,762a3ea9f1eb65b732dd32235edf6a1551c005fe..6a82c59c186c498059a8b13790f34e440b1f178f
--- 1/src/oping.c
--- 2/src/oping.c
+++ b/src/oping.c
static int opt_count = -1;
static int opt_send_ttl = 64;
static uint8_t opt_send_qos = 0;
+ static double opt_exit_status_threshold = 1.0;
+#if USE_NCURSES
+static int opt_utf8 = 0;
+#endif
static int host_num = 0;
" -I srcaddr source address\n"
" -D device outgoing interface name\n"
" -f filename filename to read hosts from\n"
+#if USE_NCURSES
+ " -u / -U force / disable UTF-8 output\n"
+#endif
+ " -Z percent Exit with non-zero exit status if more than this percentage of\n"
+ " probes timed out. (default: never)\n"
"\noping "PACKAGE_VERSION", http://verplant.org/liboping/\n"
"by Florian octo Forster <octo@verplant.org>\n"
while (1)
{
- optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:"
- optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:");
++ optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:"
+#if USE_NCURSES
+ "uU"
+#endif
+ );
if (optchar == -1)
break;
set_opt_send_qos (optarg);
break;
+#if USE_NCURSES
+ case 'u':
+ opt_utf8 = 2;
+ break;
+ case 'U':
+ opt_utf8 = 1;
+ break;
+#endif
+
+ case 'Z':
+ {
+ char *endptr = NULL;
+ double tmp;
+
+ errno = 0;
+ tmp = strtod (optarg, &endptr);
+ 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
+ opt_exit_status_threshold = tmp / 100.0;
+
+ break;
+ }
+
case 'h':
usage_exit (argv[0], 0);
break;