diff options
author | sef <sef@FreeBSD.org> | 1996-10-08 02:44:26 +0000 |
---|---|---|
committer | sef <sef@FreeBSD.org> | 1996-10-08 02:44:26 +0000 |
commit | c3ba3806b824423e48af6f0ad513c4be0efd1499 (patch) | |
tree | 8040d9462a885487d34f88a1af1349740bed81c3 /contrib/traceroute | |
parent | a7a5567c4d28c051575a2ac6d6e9513c2dccf5bb (diff) | |
download | FreeBSD-src-c3ba3806b824423e48af6f0ad513c4be0efd1499.zip FreeBSD-src-c3ba3806b824423e48af6f0ad513c4be0efd1499.tar.gz |
Paul objected to my previous change. This adds the same functionality
(implemented better, admittedly) with a new option, '-S'. If the
maintainers of traceroute (Van?) add a -S option, we will then be in
conflict.
Also added a too-brief description of the option in the man page. Someone
with a better command of English than I at the moment should probably look
over it and rephrase it.
Reviewed by: pst, jkh
Diffstat (limited to 'contrib/traceroute')
-rw-r--r-- | contrib/traceroute/traceroute.8 | 6 | ||||
-rw-r--r-- | contrib/traceroute/traceroute.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/contrib/traceroute/traceroute.8 b/contrib/traceroute/traceroute.8 index 031ca47..fa3484e 100644 --- a/contrib/traceroute/traceroute.8 +++ b/contrib/traceroute/traceroute.8 @@ -13,7 +13,7 @@ .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.\" $Header: traceroute.8,v 1.7 96/09/27 20:02:41 leres Exp $ +.\" $Header: /home/ncvs/src/contrib/traceroute/traceroute.8,v 1.1.1.1 1996/09/30 19:09:55 fenner Exp $ .\" .TH TRACEROUTE 8 "27 September 1996" .UC 6 @@ -24,7 +24,7 @@ traceroute \- print the route packets take to network host .na .B traceroute [ -.B \-dnrv +.B \-Sdnrv ] [ .B \-g .I gw_host @@ -75,6 +75,8 @@ name. .PP Other options are: .TP +.B \-S +Print a summary of how many probes were not answered for each hop. .B \-g Specify a loose source route gateway (8 maximum). .TP diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index 3d37b3f..a214352 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -24,7 +24,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.2 1996/09/30 19:39:25 fenner Exp $ (LBL)"; + "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.3 1996/10/05 01:43:13 sef Exp $ (LBL)"; #endif /* @@ -313,6 +313,7 @@ main(int argc, char **argv) register int tos = 0; register int lsrr = 0; register int optlen = 0; + int sump = 0; int sockerrno; /* @@ -337,9 +338,12 @@ main(int argc, char **argv) prog = argv[0]; opterr = 0; - while ((op = getopt(argc, argv, "dnrvg:m:p:q:s:t:w:")) != EOF) + while ((op = getopt(argc, argv, "Sdnrvg:m:p:q:s:t:w:")) != EOF) switch (op) { + case 'S': + sump = 1; + break; case 'd': options |= SO_DEBUG; break; @@ -701,7 +705,9 @@ main(int argc, char **argv) } (void)fflush(stdout); } - Printf(" (%d%% loss)", (int)(((float)loss / nprobes) * 100)); + if (sump) { + Printf(" (%d%% loss)", (lost * 100) / nprobes); + } putchar('\n'); if (got_there || (unreachable > 0 && unreachable >= nprobes - 1)) |