]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
mtr v0.45 v0.45
authorRoger Wolff <r.e.wolff@bitwizard.nl>
Thu, 24 Jan 2002 00:00:00 +0000 (00:00 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:45:37 +0000 (20:45 +0000)
 - 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

AUTHORS
NEWS
configure.in
curses.c
display.h
dns.c
net.c
net.h
select.c

diff --git a/AUTHORS b/AUTHORS
index a85495c93bc6279aaba6a77c494a02498784da61..f03cc5b74d960754640bbe25c1ccbfc76c6b632f 100644 (file)
--- 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 6d3e0b086084c9e368637f9a165b1feee3216a4a..f18afb979311d6df3469aa96487c3a4089d35b47 100644 (file)
--- 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. 
index 707ebd6679196336c8bd9b665082519be45090b8..1682e996d334849a71898b02e3dad1c8b4eaa81e 100644 (file)
@@ -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)
index c9143050812a689428311970079130d2e626d4fa..0c8e2df492f8ec7ee050a106f8d5bb4aa920ea1c 100644 (file)
--- 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);
index 33f6bcf57594e9fc65f55d3405f0dec877d2adfd..99131d9fffc4923547a36b7fc95e7c2c7a22f09f 100644 (file)
--- 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 5eec33944c02a8cf5eef790edca53bc47aa555a7..b93fa0dd53125e1f916f5922f13d84e238313eac 100644 (file)
--- 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 496be26a3b7420c83b28ddce77395c92a60467d1..7143e3f5feedef4a28e737dcd45af890c28dae49 100644 (file)
--- 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; i++) {
       host[at].saved[i] = -2;  /* unsent */
     }
+    host[at].saved_seq_offset = -SAVED_PINGS+2;
   }
   
   for(at = 0; at < MaxSequence; at++) {
@@ -482,18 +484,27 @@ int* net_saved_pings(int at) {
        return host[at].saved;
 }
 
+void net_save_increment() 
+{
+  int at;
+  for (at = 0; at < MaxHost; at++) {
+    memmove(host[at].saved, host[at].saved+1, (SAVED_PINGS-1)*sizeof(int));
+    host[at].saved[SAVED_PINGS-1] = -2;
+    host[at].saved_seq_offset += 1;
+  }
+}
+
 void net_save_xmit(int at) {
-       int tmp[SAVED_PINGS];
-       memcpy(tmp, &host[at].saved[1], (SAVED_PINGS-1)*sizeof(int));
-       memcpy(host[at].saved, tmp, (SAVED_PINGS-1)*sizeof(int));
-       host[at].saved[SAVED_PINGS-1] = -1;
+  if (host[at].saved[SAVED_PINGS-1] != -2) 
+    net_save_increment();
+  host[at].saved[SAVED_PINGS-1] = -1;
 }
 
 void net_save_return(int at, int seq, int ms) {
        int idx;
-       idx = SAVED_PINGS - (host[at].xmit - seq) - 1;
-       if (idx < 0) {
-               return;
+       idx = seq - host[at].saved_seq_offset;
+       if (idx < 0 || idx > SAVED_PINGS) {
+         return;
        }
        host[at].saved[idx] = ms;
 }
diff --git a/net.h b/net.h
index 041e22d50d5a7f6bfa7dfef635f1ab46ba03023d..12ea1ae1330484b3c5eb9b2b304e7619ec1cb084 100644 (file)
--- 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);
index 797372b6da4a9c87c567a314ee05a3bab06faf29..4b5e5a71876ceb1faeb5fa62cd545a338989b1bf 100644 (file)
--- 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;
     }