summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.89
-rw-r--r--sbin/ping/ping.c8
2 files changed, 12 insertions, 5 deletions
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8
index 2d8110d..ef133e8 100644
--- a/sbin/ping/ping.8
+++ b/sbin/ping/ping.8
@@ -32,7 +32,7 @@
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd March 1, 1997
+.Dd September 25, 2001
.Dt PING 8
.Os
.Sh NAME
@@ -81,11 +81,14 @@ bytes used to fill out the packet. The options are as follows:
.Bl -tag -width indent
.It Fl A
Audible.
-Include a bell
+Output a bell
.Tn ( ASCII
0x07)
-character in the output when no packet is received before the next packet
+character when no packet is received before the next packet
is transmitted.
+To cater for round-trip times that are longer than the interval
+between transmissions, further missing packets cause a bell only
+if the maximum number of unreceived packets has increased.
.It Fl a
Audible.
Include a bell
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 5840b8f..0c6b3cb 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -163,6 +163,7 @@ long npackets; /* max packets to transmit */
long nreceived; /* # of packets we got back */
long nrepeats; /* number of duplicates */
long ntransmitted; /* sequence # for outbound packets = #sent */
+long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
int interval = 1000; /* interval between packets, ms */
/* timing */
@@ -706,8 +707,11 @@ main(argc, argv)
}
(void)gettimeofday(&last, NULL);
- if (ntransmitted != nreceived+1 && options & F_MISSED)
- (void)write(STDOUT_FILENO, &BBELL, 1);
+ if (ntransmitted - nreceived - 1 > nmissedmax) {
+ nmissedmax = ntransmitted - nreceived - 1;
+ if (options & F_MISSED)
+ (void)write(STDOUT_FILENO, &BBELL, 1);
+ }
}
}
finish();
OpenPOWER on IntegriCloud