X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Foping.c;h=f2e48a6c28b1b49359eeeff1ae689c9ae05339ff;hb=de2e53623737bbd78a7e14a8a8e016fbc5f2e397;hp=3e114f574acfbacae5026a258ba2f17d91aaa014;hpb=48acd61a5c6257cae2df205467caa0a91c2b0d1c;p=liboping.git diff --git a/src/oping.c b/src/oping.c index 3e114f5..f2e48a6 100644 --- a/src/oping.c +++ b/src/oping.c @@ -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; @@ -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 @@ -754,6 +755,7 @@ static int read_options (int argc, char **argv) /* {{{ */ free (opt_outfile); opt_outfile = strdup (optarg); } + break; case 'P': { @@ -790,6 +792,9 @@ static int read_options (int argc, char **argv) /* {{{ */ opt_utf8 = 1; break; #endif + case 'b': + opt_bell = 1; + break; case 'Z': { @@ -1355,10 +1360,11 @@ static int pre_loop_hook (pingobj_t *ping) /* {{{ */ if (has_colors () == TRUE) { start_color (); - init_pair (OPING_GREEN, COLOR_GREEN, /* default = */ 0); - init_pair (OPING_YELLOW, COLOR_YELLOW, /* default = */ 0); - init_pair (OPING_RED, COLOR_RED, /* default = */ 0); - init_pair (OPING_GREEN_HIST, COLOR_GREEN, COLOR_BLACK); + use_default_colors (); + init_pair (OPING_GREEN, COLOR_GREEN, /* default = */ -1); + init_pair (OPING_YELLOW, COLOR_YELLOW, /* default = */ -1); + init_pair (OPING_RED, COLOR_RED, /* default = */ -1); + init_pair (OPING_GREEN_HIST, COLOR_GREEN, -1); init_pair (OPING_YELLOW_HIST, COLOR_YELLOW, COLOR_GREEN); init_pair (OPING_RED_HIST, COLOR_RED, COLOR_YELLOW); } @@ -1575,6 +1581,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)) */ {