From: Roger Wolff Date: Thu, 24 Jan 2002 00:00:00 +0000 (+0000) Subject: mtr v0.45 X-Git-Tag: v0.45^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0513847160be0d8b5509aaa2a1680902ec90f332;p=thirdparty%2Fmtr.git mtr v0.45 - People are pressuring me to release new versions with their changes. That's fine. Now this version just adds dynamic switching between numeric / dns names, and some minor stuff I forgot. This release serves as a code-sync-release. New version with even more new stuff in about two weeks! I'm afraid I don't know how to fix the MaxOS-X compilation problems in the source. Help wanted... source: ftp://ftp.bitwizard.nl/mtr/mtr-0.45.tar.gz --- diff --git a/AUTHORS b/AUTHORS index a85495c..f03cc5b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,6 +35,9 @@ Moritz Barsnick (barsnick@gmx.net) Robert Sparks (rjsparks@nostrum.com) David Stone (stone@AsIf.com) + Greg Stark (gsstark@mit.edu) + Andrew Brown (codewarrior@daemon.org ?) + Marc Bejarano (marc.bejarano@openwave.com) and anyone who has slipped through the cracks of my mail file. diff --git a/NEWS b/NEWS index 6d3e0b0..f18afb9 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,16 @@ WHAT'S NEW? + v0.45 People are pressuring me to release new versions with their + changes. That's fine. Now this version just adds dynamic + switching between numeric / dns names, and some minor + stuff I forgot. This release serves as a code-sycn-release. + new version with even more new stuff in about two weeks! + I'm afraid I don't know how to fix the MaxOS-X compilation + problems in the source. Help wanted... + v0.44 David Stone adds the "last" column to the gtk version. - v0.43 Compile fixes. + v0.43 Compile fixes. v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack. Made report mode report the newly added extra resolution. diff --git a/configure.in b/configure.in index 707ebd6..1682e99 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.44) +AM_INIT_AUTOMAKE(mtr, 0.45) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/curses.c b/curses.c index c914305..0c8e2df 100644 --- a/curses.c +++ b/curses.c @@ -48,7 +48,7 @@ #endif #ifndef getmaxyx -# define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1) +# define getmaxyx(win,y,x) ((y) = (win)->_maxy + 1, (x) = (win)->_maxx + 1) #endif #include "mtr-curses.h" @@ -88,6 +88,8 @@ int mtr_curses_keyaction() { return ActionReset; if (tolower(c) == 'd') return ActionDisplay; + if (tolower(c) == 'n') + return ActionDNS; return 0; } @@ -180,13 +182,13 @@ void mtr_print_scaled(int ms) { printw(">"); } -void mtr_fill_graph(int at) { +void mtr_fill_graph(int at, int cols) { int* saved; int i; int val; saved = net_saved_pings(at); - for (i = 0; i < SAVED_PINGS; i++) { + for (i = SAVED_PINGS-cols; i < SAVED_PINGS; i++) { if (saved[i] == -2) { printw(" "); } else if (saved[i] == -1) { @@ -207,12 +209,12 @@ void mtr_fill_graph(int at) { } } -void mtr_curses_graph(int startstat) { +void mtr_curses_graph(int startstat, int cols) { int max, at, addr, y, x; char* name; - char blocks[50]; max = net_max(); + for (at = 0; at < max; at++) { printw("%2d. ", at+1); @@ -233,7 +235,7 @@ void mtr_curses_graph(int startstat) { move(y, startstat); printw(" "); - mtr_fill_graph(at); + mtr_fill_graph(at, cols); printw("\n"); } } @@ -283,15 +285,18 @@ void mtr_curses_redraw() { mtr_curses_hosts(startstat); } else { /* David Sward, Jan 1999 */ - startstat = maxx - 52; - - mvprintw(rowstat - 1, startstat, " Last 50 pings"); + char msg[80]; + int max_cols = maxx<=SAVED_PINGS+30 ? maxx-30 : SAVED_PINGS; + startstat = 28; + sprintf(msg, " Last %3d pings", max_cols); + mvprintw(rowstat - 1, startstat, msg); + attroff(A_BOLD); move(rowstat, 0); mtr_gen_scale(); - mtr_curses_graph(startstat); + mtr_curses_graph(startstat, max_cols); printw("\n"); attron(A_BOLD); diff --git a/display.h b/display.h index 33f6bcf..99131d9 100644 --- a/display.h +++ b/display.h @@ -18,7 +18,7 @@ */ enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear, - ActionPause, ActionResume }; + ActionPause, ActionResume, ActionDNS }; enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit, DisplayRaw }; /* Prototypes for display.c */ @@ -33,3 +33,5 @@ void display_loop(); void display_clear(); extern int display_mode; +extern int use_dns; +extern int dns; diff --git a/dns.c b/dns.c index 5eec339..b93fa0d 100644 --- a/dns.c +++ b/dns.c @@ -1189,11 +1189,12 @@ char *dns_lookup2(ip_t ip){ return NULL; } +int use_dns = 1; char *dns_lookup(ip_t ip){ char *t; if (!dns) return strlongip (ip); t = dns_lookup2 (ip); - return t?t:strlongip(ip); + return (t&&use_dns)?t:strlongip(ip); } diff --git a/net.c b/net.c index 496be26..7143e3f 100644 --- a/net.c +++ b/net.c @@ -91,6 +91,7 @@ struct nethost { int worst; int transit; int saved[SAVED_PINGS]; + int saved_seq_offset; }; struct sequence { @@ -459,6 +460,7 @@ void net_reset() { for (i=0; i SAVED_PINGS) { + return; } host[at].saved[idx] = ms; } diff --git a/net.h b/net.h index 041e22d..12ea1ae 100644 --- a/net.h +++ b/net.h @@ -43,7 +43,7 @@ int net_returned(int at); int net_xmit(int at); int net_transit(int at); -#define SAVED_PINGS 50 +#define SAVED_PINGS 200 int* net_saved_pings(int at); void net_save_xmit(int at); void net_save_return(int at, int seq, int ms); diff --git a/select.c b/select.c index 797372b..4b5e5a7 100644 --- a/select.c +++ b/select.c @@ -150,6 +150,11 @@ void select_loop() { if (action == ActionResume) paused=0; + if (action == ActionDNS && dns) { + use_dns = !use_dns; + display_clear(); + } + anyset = 1; }