Audible ping response changes to ping.c

[ Available lists | Index of freebsd-hackers | Month of Feb 1997 | Week of 6 Feb 1997 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Daniel O'Callaghan <danny@panda.hilink.com.au>
Date
6 Feb 1997 04:16:35
Subject
Audible ping response changes to ping.c
Message-ID
Pine.BSF.3.91.970206231125.427D-100000@panda.hilink.com.au


[ Hide this part ]
 
The changes to ping.c below are essentially cosmetic, to add
the ability to create an audible reponse to pings, useful for debugging
broken ethernets, among other things. Submitted by Bruce Murphy
<packrat@iinet.net.au>. Are there any objections to this being committed
to -current, and the equivalent to RELENG_2_2?

Danny

*** ping.c.orig Tue Feb 4 13:29:47 1997
--- ping.c Tue Feb 4 14:45:59 1997
***************
*** 109,114 ****
--- 109,115 ----
#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,192 ****
preload = 0;

datap = &outpack[8 + sizeof(struct timeval)];
! while ((ch = getopt(argc, argv, "I:LQRT:c:dfh:i:l:np:qrs:v")) != EOF)
switch(ch) {
case 'c':
npackets = atoi(optarg);
if (npackets <= 0) {
--- 186,196 ----
preload = 0;

datap = &outpack[8 + sizeof(struct timeval)];
! 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,624 ****
--- 623,630 ----
(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,1139 ****
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");
exit(1);
}
--- 1140,1145 ----
usage()
{
(void)fprintf(stderr,
! "usage: ping [-LQRadfnqrv] [-c count] [-i wait] [-I interface]\n\t[-l preload] [-p pattern] [-s packetsize] [-T ttl] host\n");
exit(1);
}




Elapsed time: 0.216 seconds