summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dae22bf)
raw | patch | inline | side by side (parent: dae22bf)
author | octo <octo> | |
Fri, 12 May 2006 15:51:27 +0000 (15:51 +0000) | ||
committer | octo <octo> | |
Fri, 12 May 2006 15:51:27 +0000 (15:51 +0000) |
Allow non-root users to get syntax information.
Use correct computation of standard deviation.
Use correct computation of standard deviation.
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 5f0940df20bb566c04bde4ffd2982719820bbb72..37f64b27a76831980bb60ddb48e2fc4b8c95301e 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
while (1)
{
- optchar = getopt (argc, argv, "46c:i:");
+ optchar = getopt (argc, argv, "46c:hi:");
if (optchar == -1)
break;
}
break;
+ case 'h':
default:
usage_exit (argv[0]);
}
int optind;
int i;
+ optind = read_options (argc, argv);
+
+ if (optind >= argc)
+ usage_exit (argv[0]);
+
if (geteuid () != 0)
{
fprintf (stderr, "Need superuser privileges to open a RAW socket. Sorry.\n");
return (1);
}
- optind = read_options (argc, argv);
-
- if (optind >= argc)
- usage_exit (argv[0]);
-
if ((ping = ping_construct ()) == NULL)
{
fprintf (stderr, "ping_construct failed\n");
num_total = (double) context->req_rcvd;
average = context->latency_total / num_total;
- deviation = sqrt ((context->latency_total_square / num_total) - (average * average));
+ deviation = sqrt (context->latency_total_square - (num_total * average * average));
printf ("rtt min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms\n",
context->latency_min,