Skip to content

Commit

Permalink
Merge branch 'pr/6'
Browse files Browse the repository at this point in the history
  • Loading branch information
octo committed Aug 18, 2016
2 parents 6949f72 + d908d5a commit 0e8b1b2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
44 changes: 44 additions & 0 deletions src/mans/oping.pod
Expand Up @@ -238,6 +238,50 @@ remainder.

=back

=item B<-b>

Audible bell. Print a ASCII BEL character (\a or 0x07) when a packet
is received before the timeout occurs. This can be useful in order to
monitory hosts' connectivity without looking physically at the
console, for example to trace network cables (start audible beep,
disconnect cable N: if beep stops, the cable was in use) or to tell
when a host returns from a reboot.

This relies on the terminal bell to be functional. To enable the
terminal bell, use the following instructions.

=over 4

=item

the visual bell is disabled in your terminal emulator, with the +vb
commandline flag or the following in your .Xresources:

XTerm*visualBell: false

=item

the PC speaker module is loaded in your kernel:

modprobe pcspkr

=item

X11 has the terminal bell enabled:

xset b on; xset b 100

=item

and finally, if you are using PulseAudio, that the module-x11-bell
module is loaded with a pre-loaded sample defined in your pulseaudio
configuration:

load-sample-lazy x11-bell /usr/share/sounds/freedesktop/stereo/complete.oga
load-module module-x11-bell sample=x11-bell

=back

=item B<-P> I<percent>

Configures the latency percentile to report. I<percent> must be a number
Expand Down
13 changes: 12 additions & 1 deletion src/oping.c
Expand Up @@ -209,6 +209,7 @@ static int opt_show_graph = 1;
static int opt_utf8 = 0;
#endif
static char *opt_outfile = NULL;
static int opt_bell = 0;

static int host_num = 0;
static FILE *outfile = NULL;
Expand Down Expand Up @@ -652,7 +653,7 @@ static int read_options (int argc, char **argv) /* {{{ */

while (1)
{
optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:O:P:m:w:"
optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:O:P:m:w:b"
#if USE_NCURSES
"uUg:"
#endif
Expand Down Expand Up @@ -791,6 +792,9 @@ static int read_options (int argc, char **argv) /* {{{ */
opt_utf8 = 1;
break;
#endif
case 'b':
opt_bell = 1;
break;

case 'Z':
{
Expand Down Expand Up @@ -1576,6 +1580,13 @@ static void update_host_hook (pingobj_iter_t *iter, /* {{{ */
#if USE_NCURSES
}
#endif
if (opt_bell) {
#if USE_NCURSES
beep();
#else
HOST_PRINTF ("\a");
#endif
}
}
else /* if (!(latency > 0.0)) */
{
Expand Down

0 comments on commit 0e8b1b2

Please sign in to comment.