From 0cae59787ab65707fb826628dd2e07e4fc8802ba Mon Sep 17 00:00:00 2001 From: Roger Wolff Date: Sat, 3 May 2003 00:00:00 +0000 Subject: [PATCH] mtr v0.54 - Added "scrolling" patch from Roland Illig, to allow scrolling in text mode. I've always wanted this...... source: ftp://ftp.bitwizard.nl/mtr/mtr-0.54.tar.gz --- AUTHORS | 1 + NEWS | 4 ++++ configure.in | 2 +- curses.c | 13 +++++++++---- display.h | 3 ++- select.c | 10 ++++++++++ 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index 746b50d..ff20499 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,6 +37,7 @@ Christophe Kalt Steve Kann (stevek@spheara.horizonlive.com) Brett Johnson (brett@jdacareers.com) + Roland Illig (roland.illig@gmx.de) Damian Gryski (dgryski@uwaterloo.ca) Mircea Damian Cougar (cougar@random.ee) diff --git a/NEWS b/NEWS index 20d194d..66ac13e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ WHAT'S NEW? + v0.54 Added "scrolling" patch from Roland Illig, to allow + scrolling in text mode. I've always wanted this...... + + v0.53 Added fix for raw mode. v0.52 Mostly cleanups from Brett Johnson on MacOS X. It may clean up some compilation problems on MacOS X as well. diff --git a/configure.in b/configure.in index 260b347..08f5499 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.53) +AM_INIT_AUTOMAKE(mtr, 0.54) AC_SUBST(GTK_OBJ) AC_SUBST(CURSES_OBJ) diff --git a/curses.c b/curses.c index ab6cc39..d9bd20d 100644 --- a/curses.c +++ b/curses.c @@ -61,6 +61,7 @@ #include extern char LocalHostname[]; + void pwcenter(char *str) { int maxx, maxy; int cx; @@ -73,7 +74,7 @@ void pwcenter(char *str) { } int mtr_curses_keyaction() { - char c = getch(); + int c = getch(); if(tolower(c) == 'q') return ActionQuit; @@ -91,6 +92,10 @@ int mtr_curses_keyaction() { return ActionDisplay; if (tolower(c) == 'n') return ActionDNS; + if (c == '+') + return ActionScrollDown; + if (c == '-') + return ActionScrollUp; return 0; } @@ -104,7 +109,7 @@ void mtr_curses_hosts(int startstat) { max = net_max(); - for(at = 0; at < max; at++) { + for(at = display_offset; at < max; at++) { printw("%2d. ", at + 1); addr = net_addr(at); @@ -154,7 +159,7 @@ void mtr_gen_scale(void) { scale[i] = 0; } max = net_max(); - for (at = 0; at < max; at++) { + for (at = display_offset; at < max; at++) { saved = net_saved_pings(at); for (i = 0; i < SAVED_PINGS; i++) { if (saved[i] < 0) continue; @@ -218,7 +223,7 @@ void mtr_curses_graph(int startstat, int cols) { max = net_max(); - for (at = 0; at < max; at++) { + for (at = display_offset; at < max; at++) { printw("%2d. ", at+1); addr = net_addr(at); diff --git a/display.h b/display.h index 99131d9..0c4bdd6 100644 --- a/display.h +++ b/display.h @@ -18,7 +18,7 @@ */ enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear, - ActionPause, ActionResume, ActionDNS }; + ActionPause, ActionResume, ActionDNS, ActionScrollDown, ActionScrollUp }; enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit, DisplayRaw }; /* Prototypes for display.c */ @@ -35,3 +35,4 @@ void display_clear(); extern int display_mode; extern int use_dns; extern int dns; +extern int display_offset; /* only used in text mode */ diff --git a/select.c b/select.c index 04dad82..1ce0d86 100644 --- a/select.c +++ b/select.c @@ -39,6 +39,7 @@ extern float WaitTime; double dnsinterval; static struct timeval intervaltime; +int display_offset = 0; void select_loop() { @@ -164,6 +165,15 @@ void select_loop() { display_clear(); } + if (action == ActionScrollDown) { + display_offset += 5; + } else if (action == ActionScrollUp) { + display_offset -= 5; + if (display_offset < 0) { + display_offset = 0; + } + } + anyset = 1; } -- 2.47.2