From: Roger Wolff Date: Mon, 12 Apr 1999 00:00:00 +0000 (+0000) Subject: mtr v0.37 X-Git-Tag: v0.37^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b002aac936f41bed262faa26ea81b04f42df34da;p=thirdparty%2Fmtr.git mtr v0.37 - Added Bill Bogstad's "show the local host & time" patch. - Added R. Sparks' show-last-ping patch, submitted by Philip Kizer. source: ftp://ftp.bitwizard.nl/mtr/mtr-0.37.tar.gz --- diff --git a/AUTHORS b/AUTHORS index f5076ab..b3b3a67 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,12 +23,15 @@ Bertrand Leconte, Anand Kumria, Adam Kramer (l3zqc@qcunix1.acc.qc.edu), + Philip Kizer (pckizer@nostrum.com), Simon Kirby, Christophe Kalt, Steve Kann (stevek@spheara.horizonlive.com), Mircea Damian, Brian Casey, + Bill Bogstad (bogstad@pobox.com), Moritz Barsnick (barsnick@gmx.net) + R??? Sparks (rjsparks@nostrum.com) and anyone who has slipped through the cracks of my mail file. diff --git a/NEWS b/NEWS index 873e5c2..95d4e72 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ WHAT'S NEW? + v0.37 Added Bill Bogstad's "show the local host & time" patch. + Added R. Sparks' show-last-ping patch, submitted by Philip Kizer. + v0.36 Added Craigs change-the-interval-on-the-fly patch. Added Moritz Barsnick's "do something sensible if host not found" patch. diff --git a/configure.in b/configure.in index c68563d..6033665 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.36) +AM_INIT_AUTOMAKE(mtr, 0.37) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/curses.c b/curses.c index beb2620..effc12e 100644 --- a/curses.c +++ b/curses.c @@ -43,6 +43,9 @@ #include "dns.h" #endif +#include +extern LocalHostname[]; + void pwcenter(char *str) { int maxx, maxy; int cx; @@ -100,10 +103,10 @@ void mtr_curses_hosts(int startstat) { getyx(stdscr, y, x); move(y, startstat); - printw(" %3d%% %4d %4d %4d %4d %6d", + printw(" %3d%% %4d %4d %4d %4d %4d %6d", net_percent(at), net_returned(at), net_xmit(at), - net_best(at), net_avg(at), net_worst(at)); + net_last(at),net_best(at), net_avg(at), net_worst(at)); } else { @@ -224,6 +227,7 @@ void mtr_curses_redraw() { int startstat; int rowstat; int i; + time_t t; erase(); getmaxyx(stdscr, maxy, maxx); @@ -233,7 +237,11 @@ void mtr_curses_redraw() { attron(A_BOLD); move(0, 0); pwcenter("Matt's traceroute [v" VERSION "]"); - printw("\n\n"); + printw("\n"); + printw(LocalHostname); + move(1, maxx - 24); + time(&t); + printw(ctime(&t)); attroff(A_BOLD); printw("Keys: "); @@ -251,8 +259,8 @@ void mtr_curses_redraw() { startstat = maxx - 40; /* Modified by Brian Casey December 1997 bcasey@imagiware.com */ - mvprintw(rowstat - 2, startstat, " Packets Pings"); - mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Best Avg Worst"); + mvprintw(rowstat - 2, startstat, " Packets Pings"); + mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Last Best Avg Worst"); attroff(A_BOLD); move(rowstat, 0); diff --git a/mtr.c b/mtr.c index b03021f..a561fb8 100644 --- a/mtr.c +++ b/mtr.c @@ -37,6 +37,7 @@ int PrintHelp = 0; int MaxPing = 16; float WaitTime = 1.0; char *Hostname = NULL; +char LocalHostname[128]; int dns = 1; void parse_arg(int argc, char **argv) { @@ -175,6 +176,10 @@ int main(int argc, char **argv) { } if (Hostname == NULL) Hostname = "localhost"; + if(gethostname(LocalHostname, sizeof(LocalHostname))) { + strcpy(LocalHostname, "UNKNOWNHOST"); + } + if(net_preopen_result != 0) { printf("mtr: Unable to get raw socket. (Executable not suid?)\n"); exit(1); diff --git a/net.c b/net.c index 2d6137c..79bfce3 100644 --- a/net.c +++ b/net.c @@ -81,6 +81,7 @@ struct nethost { int xmit; int returned; int total; + int last; int best; int worst; int transit; @@ -235,6 +236,7 @@ void net_process_ping(int seq, uint32 addr, struct timeval now) { if(host[index].returned <= 0) { host[index].best = host[index].worst = totmsec; } + host[index].last = totmsec; if(totmsec < host[index].best) host[index].best = totmsec; if(totmsec > host[index].worst) @@ -300,6 +302,10 @@ int net_percent(int at) { return 100 - (100 * host[at].returned / (host[at].xmit - host[at].transit)); } +int net_last(int at) { + return host[at].last; +} + int net_best(int at) { return host[at].best; }