- 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
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.
AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.40)
+AM_INIT_AUTOMAKE(mtr, 0.41)
AC_SUBST(GTK_OBJ)
AC_SUBST(CURSES_OBJ)
char *Hostname = NULL;
char LocalHostname[128];
int dns = 1;
-int packetsize = 64;
+int packetsize = MINPACKET;
void parse_arg(int argc, char **argv) {
int opt;
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]);
}
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";
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);
}
}
}
- 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);
}
}