From owner-freebsd-hackers Thu Feb 6 04:16:35 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA18074 for hackers-outgoing; Thu, 6 Feb 1997 04:16:35 -0800 (PST) Received: from panda.hilink.com.au (panda.hilink.com.au [203.2.144.5]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA18027 for ; Thu, 6 Feb 1997 04:16:27 -0800 (PST) Received: (from danny@localhost) by panda.hilink.com.au (8.7.6/8.7.3) id XAA01274; Thu, 6 Feb 1997 23:16:28 +1100 (EST) Date: Thu, 6 Feb 1997 23:16:27 +1100 (EST) From: "Daniel O'Callaghan" To: freebsd-hackers@freebsd.org Subject: Audible ping response changes to ping.c Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 . 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); }