From 19b9484c8aacfc15de864facc797228eed333882 Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Fri, 9 Mar 2007 13:06:46 +0000 Subject: [PATCH] Mostly cosmetic, with a few documentation bugs --- SRC/configure-common.ac | 2 +- SRC/configure.ac | 6 +++--- SRC/echoping.1.in | 4 ++-- SRC/echoping.c | 8 +++++++- SRC/plugins/dns/dns.c | 6 +++--- SRC/plugins/dns/echoping_dns.1 | 1 + SRC/plugins/postgresql/echoping_postgresql.1 | 4 ++-- SRC/plugins/whois/echoping_whois.1 | 9 +++++---- SRC/util.c | 20 +++++++++++++++----- 9 files changed, 39 insertions(+), 21 deletions(-) diff --git a/SRC/configure-common.ac b/SRC/configure-common.ac index afa7777..76aac0b 100644 --- a/SRC/configure-common.ac +++ b/SRC/configure-common.ac @@ -1,5 +1,5 @@ dnl $Id$ -AC_INIT(echoping, 6.0-BETA) +AC_INIT(echoping, 6.0-BETA, bortz@users.sourceforge.net) AC_CANONICAL_HOST AC_PROG_CC(cc gcc) AC_LIBTOOL_DLOPEN diff --git a/SRC/configure.ac b/SRC/configure.ac index 93fe94f..25599b6 100644 --- a/SRC/configure.ac +++ b/SRC/configure.ac @@ -195,7 +195,7 @@ AC_TRY_COMPILE( #include ], [int foobar = SOL_TCP;], - [AC_DEFINE(TCP_INFO,,[TCP info from socket]) + [AC_DEFINE(HAVE_TCP_INFO,,[TCP info from socket]) ac_have_tcp_info="yes"], ac_have_tcp_info=no) AC_MSG_RESULT($ac_have_tcp_info) @@ -203,7 +203,7 @@ AC_ARG_ENABLE(tcp_info, [ --enable-tcp-info TCP info from socket], [if test "$enableval" = "yes"; then if test $ac_have_tcp_info = "yes"; then - AC_DEFINE(TCP_INFO,,[TCP info from socket]) + AC_DEFINE(HAVE_TCP_INFO,,[TCP info from socket]) TCP_INFO=1 else AC_MSG_WARN([No TCP info support on this system, request ignored]) @@ -211,7 +211,7 @@ AC_ARG_ENABLE(tcp_info, fi], dnl Default: enable it if supported if test $ac_have_tcp_info = "yes"; then - AC_DEFINE(TCP_INFO,,[TCP info]) + AC_DEFINE(HAVE_TCP_INFO,,[TCP info]) TCP_INFO=1 fi) diff --git a/SRC/echoping.1.in b/SRC/echoping.1.in index 36fcefb..8967811 100644 --- a/SRC/echoping.1.in +++ b/SRC/echoping.1.in @@ -158,8 +158,8 @@ indicate the whole URL. .IP echoping\ \-h\ http://www.example.com/\ cache.example.com:3128 Tests the remote Web proxy-cache and asks a Web page. Note that you must indicate the whole URL. -.IP echoping\ -n\ 3\ -m\ whois\ foobar.example.com\ -r\ tao.example.org -Loads the whois plugin and query the host foobar.example.com. "-r +.IP echoping\ -n\ 3\ -m\ whois\ foobar.example.com\ -d\ tao.example.org +Loads the whois plugin and query the host foobar.example.com. "-d tao.example.org" are options specific to the whois plugin. .IP echoping\ -u\ \-P\ 0xa0\ foobar.example.com Sends several UDP Echo packets with an IP Precedence of 5. diff --git a/SRC/echoping.c b/SRC/echoping.c index c8b7dff..94eece8 100644 --- a/SRC/echoping.c +++ b/SRC/echoping.c @@ -392,6 +392,12 @@ main(argc, argv) progname); exit(1); } + if (n_stddev && number <= 2) { + (void) fprintf(stderr, + "%s: Average and standard deviation are meaningless since you perform only two or less iteration(s).\n", + progname); + exit(1); + } #if ! (defined(OPENSSL) || defined(GNUTLS)) if (ssl) { (void) fprintf(stderr, @@ -690,7 +696,7 @@ main(argc, argv) if (smtp) { sendline = "QUIT\r\n"; /* Surprises some SMTP servers which log a * frightening NOQUEUE. Anyone knows better? - * * See bug #1512776 */ + * * * * See bug #1512776 */ } else #endif #ifdef ICP diff --git a/SRC/plugins/dns/dns.c b/SRC/plugins/dns/dns.c index 7ad0855..78df2ae 100644 --- a/SRC/plugins/dns/dns.c +++ b/SRC/plugins/dns/dns.c @@ -78,10 +78,10 @@ init(const int argc, const char **argv) {"type", 't', POPT_ARG_STRING, &type_name, 0, "Type of resources queried (A, MX, SOA, etc)", "type"}, - {"tcp", NULL, POPT_ARG_NONE, &use_tcp, 0, + {"tcp", (char) NULL, POPT_ARG_NONE, &use_tcp, 0, "Use TCP for the request (virtual circuit)", "tcp"}, - {"no-recurse", NULL, POPT_ARG_NONE, &no_recurse, 0, + {"no-recurse", (char) NULL, POPT_ARG_NONE, &no_recurse, 0, "Do not ask recursion", "no-recurse"}, POPT_AUTOHELP POPT_TABLEEND @@ -148,11 +148,11 @@ start(struct addrinfo *res) (void) memcpy((void *) &name_server_sockaddr_in, &name_server_sockaddr, sizeof(struct sockaddr)); } else if (name_server_sockaddr.sa_family == AF_INET6) { +#ifdef HAVE_RES_EXT /* TODO: the code for IPv6 servers is hopelessly broken. Start again */ fprintf(stderr, "WARNING: IPv6 nameservers not really supported yet (experts may apply). Falling back to IPv4 and the default server. You may use -4, too\n"); -#ifdef HAVE_RES_EXT /* Converts a generic sockaddr to an IPv6 sockaddr_in6 */ (void) memcpy((void *) &name_server_sockaddr_in6, &name_server_sockaddr, sizeof(struct sockaddr)); diff --git a/SRC/plugins/dns/echoping_dns.1 b/SRC/plugins/dns/echoping_dns.1 index ab1e224..e5a7820 100644 --- a/SRC/plugins/dns/echoping_dns.1 +++ b/SRC/plugins/dns/echoping_dns.1 @@ -32,6 +32,7 @@ echoping_dns \- echoping plugin which queries a DNS server dns is an echoping plugin, fo testing the performances of DNS (RFC 1034 and 1035) servers. .SH ARGUMENTS +.TP .B request A domain name .SH OPTIONS diff --git a/SRC/plugins/postgresql/echoping_postgresql.1 b/SRC/plugins/postgresql/echoping_postgresql.1 index b117c5f..ed92425 100644 --- a/SRC/plugins/postgresql/echoping_postgresql.1 +++ b/SRC/plugins/postgresql/echoping_postgresql.1 @@ -33,14 +33,14 @@ echoping_postgresql \- echoping plugin which connects to a PostgreSQL RDBMS serv .\" respectively. postgresql is an echoping plugin to connect to PostgreSQL RDBMS servers. .SH ARGUMENTS -.B [request] +.B [SQL-request] The request to the PostgreSQL server (in SQL). Only SELECT are supported. The default is 'SELECT now()'. .TP .SH OPTIONS .TP .B \-c, \-\-conninfo -Connection information for the Postgresql server. Something like 'host=foo dbname=bar' +Connection information for the Postgresql server. Something like 'dbname=bar' .TP .B \-r, \-\-readall Read all the data sent by the Postgresql server diff --git a/SRC/plugins/whois/echoping_whois.1 b/SRC/plugins/whois/echoping_whois.1 index e93ef31..7b69d6b 100644 --- a/SRC/plugins/whois/echoping_whois.1 +++ b/SRC/plugins/whois/echoping_whois.1 @@ -22,8 +22,8 @@ echoping_whois \- echoping plugin which connects to a whois server .RI [echoping\ options] .RI -m\ whois .B hostname -.RI -r\ request -.RI -d +.RI [-d] +.RI request .SH DESCRIPTION .PP .\" TeX users may be more comfortable with the \fB\fP and @@ -31,10 +31,11 @@ echoping_whois \- echoping plugin which connects to a whois server .\" respectively. whois is an echoping plugin to connect to whois/nicname servers (see RFC 3912). -.SH OPTIONS +.SH ARGUMENTS .TP -.B \-r, \-\-request +.B request The request to the whois server (typically a domain name) +.SH OPTIONS .TP .B \-d, \-\-dump Dumps the result of the request diff --git a/SRC/util.c b/SRC/util.c index 3236b3b..7f151c3 100644 --- a/SRC/util.c +++ b/SRC/util.c @@ -101,15 +101,21 @@ tvstddev(out, number, average, results) struct result *results; { int i; - struct timeval result, avg, var = null_timeval; + struct timeval result = null_timeval; + struct timeval avg = null_timeval; +#ifdef DEBUG + struct timeval var = null_timeval; +#endif struct timeval large, small; double d_offset, d_square, d_variance = 0; *out = null_timeval; for (i = 0; i < number; i++) { if (results[i].valid == 1) { result = results[i].timevalue; - /* printf ("value is %f (average is %f)\n", tv2double - * (result), tv2double (average)); */ +#ifdef DEBUG + printf("DEBUG: Value is %f (average is %f)\n", tv2double + (result), tv2double(average)); +#endif avg = average; if (tvcmp(&result, &avg) == -1) { small = result; @@ -119,11 +125,15 @@ tvstddev(out, number, average, results) small = avg; } tvsub(&large, &small); - /* printf ("abs offset is %f\n", tv2double (large)); */ +#ifdef DEBUG + printf("abs offset is %f\n", tv2double(large)); +#endif d_offset = tv2double(large); d_square = d_offset * d_offset; d_variance += d_square; - /* printf ("variance is now %f\n", tv2double (var)); */ +#ifdef DEBUG + printf("variance is now %f\n", tv2double(var)); +#endif } } result = double2tv(sqrt(d_variance / (double) number));