aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1998-07-15 06:45:02 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1998-07-15 06:45:02 +0000
commite345a80d5da6d1c6a2a1e010c0d9479bebf16074 (patch)
tree8b2615e9e1c8d3df851746f83faeaddf0f319a24 /sbin
parentd4d88b1e4d820028418f738dfcf0d4a626ef3297 (diff)
downloadsrc-e345a80d5da6d1c6a2a1e010c0d9479bebf16074.tar.gz
src-e345a80d5da6d1c6a2a1e010c0d9479bebf16074.zip
Correct use of .Nm. Remove unused #includes. Use warn(). cosmetic in usage()
string. Translate 0 sec 1000000 usec to 1 sec 0 usec.
Notes
Notes: svn path=/head/; revision=37671
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.826
-rw-r--r--sbin/ping/ping.c33
2 files changed, 29 insertions, 30 deletions
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8
index 76bb0908f6aa..1b3fd18f32c4 100644
--- a/sbin/ping/ping.8
+++ b/sbin/ping/ping.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
-.\" $Id: ping.8,v 1.13 1998/03/19 07:45:57 charnier Exp $
+.\" $Id: ping.8,v 1.14 1998/04/01 00:32:18 imp Exp $
.\"
.Dd March 1, 1997
.Dt PING 8
@@ -41,7 +41,7 @@
.Tn ICMP ECHO_REQUEST
packets to network hosts
.Sh SYNOPSIS
-.Nm
+.Nm ping
.Op Fl QRadfnqrv
.Op Fl c Ar count
.Op Fl i Ar wait
@@ -74,7 +74,7 @@ header, followed by a
and then an arbitrary number of
.Dq pad
bytes used to fill out the packet. The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width indent
.It Fl a
Audible. Include a bell
.Pq ASCII 0x07
@@ -122,7 +122,7 @@ This flag only applies if the ping destination is a multicast address.
If
.Ar preload
is specified,
-.Nm ping
+.Nm
sends that many packets as fast as possible before falling into its normal
mode of behavior.
Only the super-user may use this option.
@@ -190,7 +190,7 @@ e.g., after the interface was dropped by
.Xr routed 8
.Pc .
.It Fl s Ar packetsize
-Specifies the number of data bytes to be sent.
+Specify the number of data bytes to be sent.
The default is 56, which translates into 64
.Tn ICMP
data bytes when combined
@@ -271,7 +271,7 @@ to the same request.
.Pp
Damaged packets are obviously serious cause for alarm and often
indicate broken hardware somewhere in the
-.Nm ping
+.Nm
packet's path (in the network or in the hosts).
.Sh TRYING DIFFERENT DATA PATTERNS
The
@@ -326,7 +326,9 @@ uses 30,
used 15
.Pc .
.Pp
-The maximum possible value of this field is 255, and most Unix systems set
+The maximum possible value of this field is 255, and most
+.Ux
+systems set
the
.Tn TTL
field of
@@ -339,14 +341,18 @@ some hosts, but not reach them with
or
.Xr ftp 1 .
.Pp
-In normal operation ping prints the ttl value from the packet it receives.
+In normal operation
+.Nm
+prints the ttl value from the packet it receives.
When a remote system receives a ping packet, it can do one of three things
with the
.Tn TTL
field in its response:
.Bl -bullet
.It
-Not change it; this is what Berkeley Unix systems did before the
+Not change it; this is what
+.Bx
+systems did before the
.Bx 4.3 tahoe
release.
In this case the
@@ -355,7 +361,7 @@ value in the received packet will be 255 minus the
number of routers in the round-trip path.
.It
Set it to 255; this is what current
-.Tn BSD
+.Bx
systems do.
In this case the
.Tn TTL
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index a7b2ed15eae7..9407eb9b0055 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -41,17 +41,17 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
-/*
+#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
-*/
+#endif
static const char rcsid[] =
- "$Id: ping.c,v 1.37 1998/05/25 20:16:05 fenner Exp $";
+ "$Id$";
#endif /* not lint */
/*
* P I N G . C
*
- * Using the InterNet Control Message Protocol (ICMP) "ECHO" facility,
+ * Using the Internet Control Message Protocol (ICMP) "ECHO" facility,
* measure round-trip-delays and packet loss across network paths.
*
* Author -
@@ -82,7 +82,6 @@ static const char rcsid[] =
#include <unistd.h>
#include <sys/socket.h>
-#include <sys/file.h>
#include <sys/time.h>
#include <sys/uio.h>
@@ -176,7 +175,7 @@ static void pr_retip(struct ip *);
static void status(int);
static void stopit(int);
static void tvsub(struct timeval *, struct timeval *);
-static void usage(const char *) __dead2;
+static void usage(void) __dead2;
int
main(argc, argv)
@@ -314,13 +313,12 @@ main(argc, argv)
options |= F_VERBOSE;
break;
default:
-
- usage(argv[0]);
+ usage();
}
}
if (argc - optind != 1)
- usage(argv[0]);
+ usage();
target = argv[optind];
bzero((char *)&whereto, sizeof(struct sockaddr));
@@ -502,7 +500,7 @@ main(argc, argv)
timeout.tv_usec += 1000000;
timeout.tv_sec--;
}
- while (timeout.tv_usec > 1000000) {
+ while (timeout.tv_usec >= 1000000) {
timeout.tv_usec -= 1000000;
timeout.tv_sec++;
}
@@ -520,7 +518,7 @@ main(argc, argv)
if ((cc = recvmsg(s, &msg, 0)) < 0) {
if (errno == EINTR)
continue;
- perror("ping: recvmsg");
+ warn("recvmsg");
continue;
}
#ifdef SO_TIMESTAMP
@@ -1269,15 +1267,10 @@ fill(bp, patp)
}
static void
-usage(argv0)
- const char *argv0;
+usage()
{
- if (strrchr(argv0,'/'))
- argv0 = strrchr(argv0,'/') + 1;
- fprintf(stderr,
- "usage: %s [-QRadfnqrv] [-c count] [-i wait] [-l preload] "
- "[-p pattern]\n [-s packetsize] "
- "[host | [-L] [-I iface] [-T ttl] mcast-group]\n",
- argv0);
+ fprintf(stderr, "%s\n%s\n",
+"usage: ping [-QRadfnqrv] [-c count] [-i wait] [-l preload] [-p pattern]",
+" [-s packetsize] [host | [-L] [-I iface] [-T ttl] mcast-group]");
exit(EX_USAGE);
}