Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2011 16:33:08 +0000 (UTC)
From:      Maksim Yevmenkin <emax@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220845 - stable/8/usr.sbin/bluetooth/l2ping
Message-ID:  <201104191633.p3JGX8m0014098@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emax
Date: Tue Apr 19 16:33:08 2011
New Revision: 220845
URL: http://svn.freebsd.org/changeset/base/220845

Log:
  MFC r220116
  
  Do not use word 'flood' as it not entirely correct. Use better 'no delay'
  description. While here, replace atoi(3) with strtol(3).
  
  Submitted by:	arundel

Modified:
  stable/8/usr.sbin/bluetooth/l2ping/l2ping.8
  stable/8/usr.sbin/bluetooth/l2ping/l2ping.c
Directory Properties:
  stable/8/usr.sbin/bluetooth/l2ping/   (props changed)

Modified: stable/8/usr.sbin/bluetooth/l2ping/l2ping.8
==============================================================================
--- stable/8/usr.sbin/bluetooth/l2ping/l2ping.8	Tue Apr 19 16:30:17 2011	(r220844)
+++ stable/8/usr.sbin/bluetooth/l2ping/l2ping.8	Tue Apr 19 16:33:08 2011	(r220845)
@@ -25,7 +25,7 @@
 .\" $Id: l2ping.8,v 1.3 2003/05/21 01:00:19 max Exp $
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2002
+.Dd March 29, 2011
 .Dt L2PING 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Op Fl fhn
 .Fl a Ar remote
 .Op Fl c Ar count
-.Op Fl i Ar delay
+.Op Fl i Ar wait
 .Op Fl S Ar source
 .Op Fl s Ar size
 .Sh DESCRIPTION
@@ -63,8 +63,7 @@ If this option is not specified,
 .Nm
 will operate until interrupted.
 .It Fl f
-.Dq Flood
-ping, i.e., no delay between packets.
+Don't wait between sending each packet.
 .It Fl h
 Display usage message and exit.
 .It Fl i Ar wait
@@ -109,7 +108,7 @@ Some implementations may not like large 
 .Xr ng_l2cap 4 ,
 .Xr l2control 8
 .Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq emax@FreeBSD.org
 .Sh BUGS
 Could collect more statistic.
 Could check for duplicated, corrupted and lost packets.

Modified: stable/8/usr.sbin/bluetooth/l2ping/l2ping.c
==============================================================================
--- stable/8/usr.sbin/bluetooth/l2ping/l2ping.c	Tue Apr 19 16:30:17 2011	(r220844)
+++ stable/8/usr.sbin/bluetooth/l2ping/l2ping.c	Tue Apr 19 16:33:08 2011	(r220845)
@@ -37,6 +37,7 @@
 #include <bluetooth.h>
 #include <err.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -60,11 +61,11 @@ int
 main(int argc, char *argv[])
 {
 	bdaddr_t		 src, dst;
-	struct hostent		*he = NULL;
-	uint8_t			*echo_data = NULL;
+	struct hostent		*he;
+	uint8_t			*echo_data;
 	struct sockaddr_l2cap	 sa;
 	int32_t			 n, s, count, wait, flood, echo_size, numeric;
-	char			*rname = NULL;
+	char			*endp, *rname;
 
 	/* Set defaults */
 	memcpy(&src, NG_HCI_BDADDR_ANY, sizeof(src));
@@ -100,8 +101,8 @@ main(int argc, char *argv[])
 			break;
 
 		case 'c':
-			count = atoi(optarg);
-			if (count <= 0)
+			count = strtol(optarg, &endp, 10);
+			if (count <= 0 || *endp != '\0')
 				usage();
 			break;
 
@@ -110,8 +111,8 @@ main(int argc, char *argv[])
 			break;
 
 		case 'i':
-			wait = atoi(optarg);
-			if (wait <= 0)
+			wait = strtol(optarg, &endp, 10);
+			if (wait <= 0 || *endp != '\0')
 				usage();
 			break;
 
@@ -129,9 +130,10 @@ main(int argc, char *argv[])
 			break;
 
 		case 's':
-			echo_size = atoi(optarg);
-			if (echo_size < sizeof(int32_t) ||
-			    echo_size > NG_L2CAP_MAX_ECHO_SIZE)
+                        echo_size = strtol(optarg, &endp, 10);
+                        if (echo_size < sizeof(int32_t) ||
+			    echo_size > NG_L2CAP_MAX_ECHO_SIZE ||
+			    *endp != '\0')
 				usage();
 			break;
 
@@ -272,12 +274,12 @@ tv2msec(struct timeval const *tvp)
 static void
 usage(void)
 {
-	fprintf(stderr, "Usage: l2ping -a bd_addr " \
-		"[-S bd_addr -c count -i wait -n -s size -h]\n");
+	fprintf(stderr, "Usage: l2ping [-fhn] -a remote " \
+		"[-c count] [-i wait] [-S source] [-s size]\n");
 	fprintf(stderr, "Where:\n");
 	fprintf(stderr, "  -a remote  Specify remote device to ping\n");
 	fprintf(stderr, "  -c count   Number of packets to send\n");
-	fprintf(stderr, "  -f         No delay (sort of flood)\n");
+	fprintf(stderr, "  -f         No delay between packets\n");
 	fprintf(stderr, "  -h         Display this message\n");
 	fprintf(stderr, "  -i wait    Delay between packets (sec)\n");
 	fprintf(stderr, "  -n         Numeric output only\n");



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