From marc@ns.destek.net Fri May 21 04:13:06 1999
Return-Path: <marc@ns.destek.net>
Received: from ns.destek.net (ns.Destek.Net [192.156.97.193])
	by hub.freebsd.org (Postfix) with ESMTP id DE09D14E67
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 May 1999 04:13:05 -0700 (PDT)
	(envelope-from marc@ns.destek.net)
Received: (from marc@localhost)
	by ns.destek.net (8.9.3/8.9.1a) id HAA23277;
	Fri, 21 May 1999 07:13:04 -0400 (EDT)
Message-Id: <199905211113.HAA23277@ns.destek.net>
Date: Fri, 21 May 1999 07:13:04 -0400 (EDT)
From: marc@destek.net
Sender: marc@ns.destek.net
Reply-To: marc@destek.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: Enhancement, ping(8)
X-Send-Pr-Version: 3.2

>Number:         11818
>Category:       bin
>Synopsis:       Added a feature to ping(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 21 04:20:00 PDT 1999
>Closed-Date:    Thu May 24 02:17:55 PDT 2001
>Last-Modified:  Thu May 24 02:18:07 PDT 2001
>Originator:     Marc Evans
>Release:        FreeBSD 2.2.8-STABLE i386
>Organization:
The Destek Group, Inc.
>Environment:

	Any platform that uses FreeBSD derived ping(8) sources.

>Description:

	I have added a feature to ping(8) which is effectively the inverse
	of the -a option. I use the -A flag on the command line. Both the
	man page and the source code have been updated in the attached patch.

>How-To-Repeat:

	Patch the sources using the attached patch. Compile, install and then
	run "ping -A {addr/name}".

>Fix:
	
*** ping.c	Thu May 20 17:15:47 1999
--- ping.c.old	Thu Feb 25 10:50:37 1999
***************
*** 124,130 ****
  #define	F_MTTL		0x0800
  #define	F_MIF		0x1000
  #define	F_AUDIBLE	0x2000
- #define	F_MISSED	0x4000
  
  /*
   * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
--- 124,129 ----
***************
*** 140,146 ****
  int s;				/* socket file descriptor */
  u_char outpack[MAXPACKET];
  char BSPACE = '\b';		/* characters written for flood */
- char BBELL = '\a';		/* characters written for MISSED and AUDIBLE */
  char DOT = '.';
  char *hostname;
  int ident;			/* process id to identify our packets */
--- 139,144 ----
***************
*** 219,229 ****
  	preload = 0;
  
  	datap = &outpack[8 + PHDR_LEN];
! 	while ((ch = getopt(argc, argv, "AI:LQRT:c:adfi:l:np:qrs:v")) != -1) {
  		switch(ch) {
- 		case 'A':
- 			options |= F_MISSED;
- 			break;
  		case 'a':
  			options |= F_AUDIBLE;
  			break;
--- 217,224 ----
  	preload = 0;
  
  	datap = &outpack[8 + PHDR_LEN];
! 	while ((ch = getopt(argc, argv, "I:LQRT:c:adfi:l:np:qrs:v")) != -1) {
  		switch(ch) {
  		case 'a':
  			options |= F_AUDIBLE;
  			break;
***************
*** 558,566 ****
  					intvl.tv_sec = MAXWAIT;
  			}
  			(void)gettimeofday(&last, NULL);
- 
- 			if (ntransmitted != nreceived+1 && options & F_MISSED)
- 				(void)write(STDOUT_FILENO, &BBELL, 1);
  		}
  	}
  	finish();
--- 553,558 ----
***************
*** 721,727 ****
  			if (dupflag)
  				(void)printf(" (DUP!)");
  			if (options & F_AUDIBLE)
! 				(void)write(STDOUT_FILENO, &BBELL, 1);
  			/* check the data */
  			cp = (u_char*)&icp->icmp_data[PHDR_LEN];
  			dp = &outpack[8 + PHDR_LEN];
--- 713,719 ----
  			if (dupflag)
  				(void)printf(" (DUP!)");
  			if (options & F_AUDIBLE)
! 				(void)printf("\a");
  			/* check the data */
  			cp = (u_char*)&icp->icmp_data[PHDR_LEN];
  			dp = &outpack[8 + PHDR_LEN];
*** ping.8	Thu May 20 17:20:20 1999
--- ping.8.old	Thu May 20 17:17:17 1999
***************
*** 42,48 ****
  packets to network hosts
  .Sh SYNOPSIS
  .Nm ping
! .Op Fl AQRadfnqrv
  .Op Fl c Ar count
  .Op Fl i Ar wait
  .Op Fl l Ar preload
--- 42,48 ----
  packets to network hosts
  .Sh SYNOPSIS
  .Nm ping
! .Op Fl QRadfnqrv
  .Op Fl c Ar count
  .Op Fl i Ar wait
  .Op Fl l Ar preload
***************
*** 75,87 ****
  .Dq pad
  bytes used to fill out the packet.  The options are as follows:
  .Bl -tag -width indent
- .It Fl A
- Audible missed packet. Include a bell
- .Pq ASCII 0x07
- character in the output when any packet is not received before the next packet
- is transmitted.
  .It Fl a
! Audible received packet. Include a bell
  .Pq ASCII 0x07
  character in the output when any packet is received. This option is ignored
  if other format options are present.
--- 75,82 ----
  .Dq pad
  bytes used to fill out the packet.  The options are as follows:
  .Bl -tag -width indent
  .It Fl a
! Audible. Include a bell
  .Pq ASCII 0x07
  character in the output when any packet is received. This option is ignored
  if other format options are present.


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Thu May 24 02:17:55 PDT 2001 
State-Changed-Why:  
Committed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=11818 
>Unformatted:
