diff --git a/src/oping.c b/src/oping.c
index 94515c2c2005fe7300ebd2e57cb920d5da7fec99..f2e48a6c28b1b49359eeeff1ae689c9ae05339ff 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
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;
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
free (opt_outfile);
opt_outfile = strdup (optarg);
}
+ break;
case 'P':
{
opt_utf8 = 1;
break;
#endif
+ case 'b':
+ opt_bell = 1;
+ break;
case 'Z':
{
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);
}
#if USE_NCURSES
}
#endif
+ if (opt_bell) {
+#if USE_NCURSES
+ beep();
+#else
+ HOST_PRINTF ("\a");
+#endif
+ }
}
else /* if (!(latency > 0.0)) */
{
if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
{
- double t = ((double) ts.tv_sec) + (((double) ts.tv_nsec) / 1000000.0);
+ double t = ((double) ts.tv_sec) + (((double) ts.tv_nsec) / 1000000000.0);
if ((sequence % 32) == 0)
fprintf (outfile, "#time,host,latency[ms]\n");
- fprintf (outfile, "%.3f \"%s\" %.2f\n", t, context->host, latency);
+ fprintf (outfile, "%.3f,\"%s\",%.2f\n", t, context->host, latency);
}
}