Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 May 1999 17:35:11 -0400
From:      Marc Evans <marc@destek.net>
To:        freebsd-bugs@freebsd.org
Subject:   ENHANCEMENT - ping(8) utility
Message-ID:  <199905202135.RAA15873@synergy.destek.net>

next in thread | raw e-mail | index | archive | help
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6594.927236098.1@synergy.destek.net>

Hello -

Attached are some context diffs for the ping(8) utility. What I have added is the
command line option -A which when used will inject an audiable bell for each packet
that is not recieved before the next packet is sent. In essence, the inverse of the
-a option.

These were generated against FreeBSD 2.2.8-stable.

- Marc


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6594.927236098.2@synergy.destek.net>

*** 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.

------- =_aaaaaaaaaa0--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905202135.RAA15873>