summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-24 03:10:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-24 03:10:05 +0000
commit0fa54c8c8a0d3da77d99187db461c21e9a555a10 (patch)
tree3c7d71e9586305c404b12d9b2ba278ffcca5aefa
parentb3abaf90b2af197f96c97bc5ffae2fedbe9e30d5 (diff)
make packet loss double and print using %.1lf; based on diff from jeffi@rcn.com
-rw-r--r--sbin/ping/ping.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index d2e4033a8ea..c247202c81b 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.62 2003/07/02 21:44:58 deraadt Exp $ */
+/* $OpenBSD: ping.c,v 1.63 2003/07/24 03:10:04 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: ping.c,v 1.62 2003/07/02 21:44:58 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ping.c,v 1.63 2003/07/24 03:10:04 deraadt Exp $";
#endif
#endif /* not lint */
@@ -925,8 +925,8 @@ summary(int header, int sig)
snprintf(buft, sizeof buft,
"-- somebody's duplicating packets!");
else
- snprintf(buft, sizeof buft, "%d%% packet loss",
- (int) (((ntransmitted - nreceived) * 100) /
+ snprintf(buft, sizeof buft, "%.1lf%% packet loss",
+ ((((double)ntransmitted - nreceived) * 100) /
ntransmitted));
strlcat(buf, buft, sizeof buf);
}