mirror of
https://github.com/traviscross/mtr.git
synced 2024-09-21 18:37:10 +00:00
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
This commit is contained in:
parent
63663ec2ce
commit
0513847160
3
AUTHORS
3
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.
|
||||
|
||||
|
10
NEWS
10
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.
|
||||
|
@ -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)
|
||||
|
25
curses.c
25
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);
|
||||
|
@ -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;
|
||||
|
3
dns.c
3
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);
|
||||
}
|
||||
|
25
net.c
25
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;
|
||||
}
|
||||
|
2
net.h
2
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);
|
||||
|
Loading…
Reference in New Issue
Block a user