]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
mtr v0.48 v0.48
authorRoger Wolff <r.e.wolff@bitwizard.nl>
Wed, 6 Mar 2002 00:00:00 +0000 (00:00 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:45:37 +0000 (20:45 +0000)
 - Draw names in red (GTK) or bold (Curses) if host doesn't respond.

source: ftp://ftp.bitwizard.nl/mtr/mtr-0.48.tar.gz

AUTHORS
ChangeLog
configure.in
curses.c
gtk.c
mtr.c
net.c
net.h

diff --git a/AUTHORS b/AUTHORS
index 2a64c98b50fa1c62cd61a26efdaff12f7a31f1f2..828446449689378a3233e5470d06966a76f66c19 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -36,6 +36,7 @@
         Steve Kann (stevek@spheara.horizonlive.com)
         Damian Gryski (dgryski@uwaterloo.ca)
         Mircea Damian
+        Cougar (cougar@random.ee)
         Brian Casey
         Andrew Brown (atatat@atatdot.net)
         Bill Bogstad (bogstad@pobox.com) 
index 0c91c59d5befdd6343f8ac7f5a829482d1ae5b6a..21df52da240a2e2dd0062530bf4bad821d641203 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2002-03-06  Cougar <cougar@random.ee>
+       + If hop doesn't respond, draw its name in red (GTK) or bold (curses)
+
 2002-02-09  bodq  <bohdan@vstu.edu.ua>
        * Added --address option to bind to given IP addess
 
@@ -8,7 +11,3 @@
        it does not work for GLIBC2 systems (e.g., RedHat 7+).
        * Fixed the subordinate CHECK_LIBS on the test for res_mkquery,
        so that they test for res_mkquery, not res_init.
-       
-         
-         
-
index f8706a528d020f1bdce5644fb1b94fea96795b69..5acab7958800ccb939d6b7f3bf981f4b1335856b 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.47)
+AM_INIT_AUTOMAKE(mtr, 0.48)
 
 AC_SUBST(GTK_OBJ)
 AC_SUBST(CURSES_OBJ)
index 0c8e2df492f8ec7ee050a106f8d5bb4aa920ea1c..91291322990fd9d2d6909a09a1903f7a042e33bb 100644 (file)
--- a/curses.c
+++ b/curses.c
@@ -109,12 +109,15 @@ void mtr_curses_hosts(int startstat) {
 
     if(addr != 0) {
       name = dns_lookup(addr);
+      if (! net_up(at))
+       attron(A_BOLD);
       if(name != NULL) {
        printw("%s", name);
       } else {
        printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
               (addr >> 8) & 0xff, addr & 0xff);
       }
+      attroff(A_BOLD);
 
       getyx(stdscr, y, x);
       move(y, startstat);
@@ -224,12 +227,15 @@ void mtr_curses_graph(int startstat, int cols) {
                        continue;
                }
 
+               if (! net_up(at))
+                       attron(A_BOLD);
                name = dns_lookup(addr);
                if (name) {
                        printw("%s", name);
                } else {
                        printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) && 0xff, (addr >> 8) & 0xff, addr & 0xff);
                }
+               attroff(A_BOLD);
 
                getyx(stdscr, y, x);
                move(y, startstat);
diff --git a/gtk.c b/gtk.c
index 1d5e8dbab7dc41b29adda3939867496f4f7dde48..a91bf338102b8fc7c357ecb54eacf4c517a6773f 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -283,6 +283,8 @@ void gtk_set_field_num(GtkCList *List, int row, int ix, char *format, int num) {
 void gtk_update_row(GtkCList *List, int row) {
   int addr;
   char str[256], *name;
+  GdkColor color;
+  GdkColormap *cmap;
 
   addr = net_addr(row);
   name = "???";
@@ -294,6 +296,18 @@ void gtk_update_row(GtkCList *List, int row) {
       name = str;
     }
   }
+
+  cmap = gtk_widget_get_colormap(ReportBody);
+  if (net_up(row)) {
+    gdk_color_black(cmap, &color);
+  } else {
+    color.red = 0xffffff;
+    color.green = 0;
+    color.blue = 0;
+  }
+  gdk_color_alloc (cmap, &color);
+  gtk_clist_set_foreground(List, row, &color);
+
   gtk_set_field(List, row, 0, name);
 
   gtk_set_field_num(List, row, 1, "%d%%", net_percent(row));
diff --git a/mtr.c b/mtr.c
index dd813327890cb399ff63eccbafd2badbefc286dd..fc5cd351f634d2cf185354597c07a5df86bbc61c 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <netinet/in.h>
 
 #include "mtr-curses.h"
 #include "getopt.h"
diff --git a/net.c b/net.c
index 7143e3f5feedef4a28e737dcd45af890c28dae49..2ab1bf473caff3f5e7a08b8783a20772320f4720 100644 (file)
--- a/net.c
+++ b/net.c
@@ -85,6 +85,8 @@ struct nethost {
   uint32 addr;
   int xmit;
   int returned;
+  int sent;
+  int up;
   long long total;
   int last;
   int best;
@@ -166,6 +168,9 @@ int new_sequence(int index) {
   memset(&sequence[seq].time, 0, sizeof(sequence[seq].time));
   
   host[index].transit = 1;
+  if (host[index].sent)
+    host[index].up = 0;
+  host[index].sent = 1;
   net_save_xmit(index);
   
   return seq;
@@ -254,6 +259,8 @@ void net_process_ping(int seq, uint32 addr, struct timeval now) {
 
   host[index].total += totusec;
   host[index].returned++;
+  host[index].sent = 0;
+  host[index].up = 1;
   host[index].transit = 0;
 
   net_save_return(index, sequence[seq].saved_seq, totusec);
@@ -359,6 +366,10 @@ int net_transit(int at) {
    return host[at].transit;
 }
 
+int net_up(int at) { 
+   return host[at].up;
+}
+
 void net_end_transit() {
   int at;
 
@@ -454,6 +465,8 @@ void net_reset() {
     host[at].xmit = 0;
     host[at].transit = 0;
     host[at].returned = 0;
+    host[at].sent = 0;
+    host[at].up = 0;
     host[at].total = 0;
     host[at].best = 0;
     host[at].worst = 0;
diff --git a/net.h b/net.h
index 12ea1ae1330484b3c5eb9b2b304e7619ec1cb084..360710835fbe63f8d17230cb7b2841b4d47eb5e0 100644 (file)
--- a/net.h
+++ b/net.h
@@ -43,6 +43,8 @@ int net_returned(int at);
 int net_xmit(int at);
 int net_transit(int at);
 
+int net_up(int at);
+
 #define SAVED_PINGS 200
 int* net_saved_pings(int at);
 void net_save_xmit(int at);