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

AUTHORS
NEWS
configure.in
curses.c
mtr.c
net.c

diff --git a/AUTHORS b/AUTHORS
index f5076abbb225b5689012223ff55bbe322ab19439..b3b3a67cb4e235be42ac5d0ea87dd57c6466900a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
         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 873e5c2bba3a401930e87c31adb04f9cb0d07569..95d4e7252461924bf430ca78c8ff95554c4a4e87 100644 (file)
--- 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.
index c68563d1505a8c67a7ea1a4549b97f4b68e730f0..60336659cd7aeda7d681d380a9b7876c9a51318e 100644 (file)
@@ -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)
index beb26201380b3077769669cd61a11ab90e536d35..effc12ecfd1620c38658bd3514345f0562f315f0 100644 (file)
--- a/curses.c
+++ b/curses.c
@@ -43,6 +43,9 @@
 #include "dns.h"
 #endif
 
+#include <time.h>
+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 b03021f7af4a423f1638322f90f55a46fa9f07bf..a561fb80823a510f39dfd768111f470ab5710c8d 100644 (file)
--- 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 2d6137ce71882f2ff8f0d8c2e698ad80e4b61117..79bfce31ca2f33c2a9a1732cd6ee04333b84919f 100644 (file)
--- 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;
 }