summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authordanny <danny@FreeBSD.org>1997-02-08 01:43:56 +0000
committerdanny <danny@FreeBSD.org>1997-02-08 01:43:56 +0000
commit3a676129b4df4e178a01f915f6fe6770f65aa508 (patch)
tree8fca7c46f7965f16fb63e155edba4535cb01dabd /sbin/ping
parent27e71d1e4801443f6b036937c234d526fe50bf97 (diff)
downloadFreeBSD-src-3a676129b4df4e178a01f915f6fe6770f65aa508.zip
FreeBSD-src-3a676129b4df4e178a01f915f6fe6770f65aa508.tar.gz
Reviewed by: Gary Jennejohn <gj@freebsd.org>
Submitted by: Bruce Murphy <packrat@iinet.net.au> Add '-a' audible flag, so terminal will beep upon receipt of a reply packet. Useful for debugging ethernet runs, among other things.
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.85
-rw-r--r--sbin/ping/ping.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8
index 538a045..1d9a493 100644
--- a/sbin/ping/ping.8
+++ b/sbin/ping/ping.8
@@ -42,7 +42,7 @@
packets to network hosts
.Sh SYNOPSIS
.Nm ping
-.Op Fl dfnqrvLRQ
+.Op Fl adfnqrvLRQ
.Op Fl c Ar count
.Op Fl i Ar wait
.Op Fl I Ar interface
@@ -70,6 +70,9 @@ and then an arbitrary number of ``pad'' bytes used to fill out the
packet.
The options are as follows:
.Bl -tag -width Ds
+.It Fl a
+Audible. Include a bell (ASCII 0x07) character in the output when any packet
+is received. This option is ignored if other format options are present.
.It Fl c Ar count
Stop after sending (and receiving)
.Ar count
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index bfbf254..589ba4b 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -109,6 +109,7 @@ int options;
#define F_NOLOOP 0x0400
#define F_MTTL 0x0800
#define F_MIF 0x1000
+#define F_AUDIBLE 0x2000
/*
* MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
@@ -185,8 +186,11 @@ main(argc, argv)
preload = 0;
datap = &outpack[8 + sizeof(struct timeval)];
- while ((ch = getopt(argc, argv, "I:LQRT:c:dfh:i:l:np:qrs:v")) != EOF)
+ while ((ch = getopt(argc, argv, "I:LQRT:c:adfh:i:l:np:qrs:v")) != EOF)
switch(ch) {
+ case 'a':
+ options |= F_AUDIBLE;
+ break;
case 'c':
npackets = atoi(optarg);
if (npackets <= 0) {
@@ -619,6 +623,8 @@ pr_pack(buf, cc, from)
(void)printf(" time=%.3f ms", triptime);
if (dupflag)
(void)printf(" (DUP!)");
+ if (options & F_AUDIBLE)
+ (void)printf("\a");
/* check the data */
cp = (u_char*)&icp->icmp_data[8];
dp = &outpack[8 + sizeof(struct timeval)];
@@ -1134,6 +1140,6 @@ fill(bp, patp)
usage()
{
(void)fprintf(stderr,
- "usage: ping [-LQRdfnqrv] [-c count] [-i wait] [-I interface]\n\t[-l preload] [-p pattern] [-s packetsize] [-T ttl] host\n");
+ "usage: ping [-LQRadfnqrv] [-c count] [-i wait] [-I interface]\n\t[-l preload] [-p pattern] [-s packetsize] [-T ttl] host\n");
exit(1);
}
OpenPOWER on IntegriCloud