X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Foping.c;h=bac45f05ad784fe67057e4aac4a2462d9def900b;hb=6dd28d58d7a15aede4512185e987b5453a7e6249;hp=3e114f574acfbacae5026a258ba2f17d91aaa014;hpb=48acd61a5c6257cae2df205467caa0a91c2b0d1c;p=liboping.git diff --git a/src/oping.c b/src/oping.c index 3e114f5..bac45f0 100644 --- a/src/oping.c +++ b/src/oping.c @@ -82,11 +82,17 @@ /* http://newsgroups.derkeiler.com/Archive/Rec/rec.games.roguelike.development/2010-09/msg00050.html */ # define _X_OPEN_SOURCE_EXTENDED -# if HAVE_NCURSESW_NCURSES_H -# include -# elif HAVE_NCURSES_H +#if defined HAVE_NCURSESW_CURSES_H +# include +#elif defined HAVE_NCURSESW_H +# include +#elif defined HAVE_NCURSES_CURSES_H +# include +#elif defined HAVE_NCURSES_H # include -# endif +#else +# error "SysV or X/Open-compatible Curses header file required" +#endif # define OPING_GREEN 1 # define OPING_YELLOW 2 @@ -209,6 +215,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 +659,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 +761,7 @@ static int read_options (int argc, char **argv) /* {{{ */ free (opt_outfile); opt_outfile = strdup (optarg); } + break; case 'P': { @@ -790,6 +798,9 @@ static int read_options (int argc, char **argv) /* {{{ */ opt_utf8 = 1; break; #endif + case 'b': + opt_bell = 1; + break; case 'Z': { @@ -1575,6 +1586,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)) */ {