From: Roger Wolff Date: Thu, 19 Aug 1999 00:00:00 +0000 (+0000) Subject: mtr v0.41 X-Git-Tag: v0.41^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8962b8b28cfc18ab3b6dfdb715d5cfeda1ca5e4;p=thirdparty%2Fmtr.git mtr v0.41 - Added afr's patch to allow disabling of gtk without Robn's hack. - Made report mode report the newly added extra resolution. source: ftp://ftp.bitwizard.nl/mtr/mtr-0.41.tar.gz --- diff --git a/NEWS b/NEWS index a555962..4f083f7 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ WHAT'S NEW? + v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack. + Made report mode report the newly added extra resolution. + v0.40 Fixed some problems with HPUX and SunOS. Included Olav Kvittem's patch to do packetsize option. Made the timekeeping in micro seconds. diff --git a/configure.in b/configure.in index b4ec4e6..840d3df 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.40) +AM_INIT_AUTOMAKE(mtr, 0.41) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/mtr.c b/mtr.c index 10df43e..8234b1b 100644 --- a/mtr.c +++ b/mtr.c @@ -45,7 +45,7 @@ float WaitTime = 1.0; char *Hostname = NULL; char LocalHostname[128]; int dns = 1; -int packetsize = 64; +int packetsize = MINPACKET; void parse_arg(int argc, char **argv) { int opt; @@ -116,10 +116,13 @@ void parse_arg(int argc, char **argv) { if(DisplayMode == DisplayReport) Interactive = 0; - if(optind != argc - 1) + if(optind > argc - 1) return; - Hostname = argv[optind]; + Hostname = argv[optind++]; + + if (argc > optind) + packetsize = atoi(argv[optind]); } @@ -181,7 +184,8 @@ int main(int argc, char **argv) { printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n" "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n" "\t\t[--raw] [--split] [--no-dns]\n" /* BL */ - "\t\t[--interval=SECONDS] HOSTNAME\n", argv[0]); + "\t\t[--psize=bytes/-p=bytes]\n" /* ok */ + "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]); exit(0); } if (Hostname == NULL) Hostname = "localhost"; diff --git a/report.c b/report.c index b6953a9..96c1f31 100644 --- a/report.c +++ b/report.c @@ -31,7 +31,7 @@ extern int dns; void report_open() { - printf("%-40s LOSS RCVD SENT BEST AVG WORST\n", "HOST"); + printf("%-38s LOSS RCVD SENT BEST AVG WORST\n", "HOST"); fflush(stdout); } @@ -62,10 +62,20 @@ void report_close() { } } - printf("%-40s%5d%%%6d%5d%6d%6d%6d\n", name, + /* Coding tip: + + NEVER EVER use a format like "%6d%6d%6d". This will nicely + format your three numbers in 18 spaces just like " %5d %5d %5d" + and save you three bytes of static string space. However, when + the numbers suddenly become a bit larger than you expected + you'll end up with unexpected results: just one huge number + instead of three separate numbers. This especially matters if + the reader of the info is a program and not human. */ + + printf("%-38s %4d%% %5d %4d %7.2f %7.2f %7.2f\n", name, net_percent(at), net_returned(at), net_xmit(at), - net_best(at)/1000, net_avg(at)/1000, net_worst(at)/1000); + net_best(at)/1000.0, net_avg(at)/1000.0, net_worst(at)/1000.0); } }