summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorpdw <>2002-10-24 13:42:11 +0000
committerpdw <>2002-10-24 13:42:11 +0000
commit4ef789bed10a53c5aa69d1c069a97d6c3900a80c (patch)
tree98350a572f04d2119ce072e80781e83fec8e76c2 /ui.c
parent0d9a9538ddbc207081bec7d355fedfeac2a4afd5 (diff)
downloadiftop-4ef789bed10a53c5aa69d1c069a97d6c3900a80c.zip
Added alternative resolver.
Altered display of totals.
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/ui.c b/ui.c
index 3e96122..1d22230 100644
--- a/ui.c
+++ b/ui.c
@@ -71,6 +71,8 @@ sorted_list_type screen_list;
host_pair_line totals;
int peaksent, peakrecv, peaktotal;
+int showhelphint = 0;
+
int screen_line_compare(void* a, void* b) {
int i;
host_pair_line* aa = (host_pair_line*)a;
@@ -354,10 +356,6 @@ void sprint_host(char * line, struct in_addr* addr, unsigned int port, unsigned
}
left = strlen(hostname);
- //TODO: Replace this with in-memory hash for speed.
- //sent = getservbyport(port, "tcp");
-
-
if(port != 0) {
skey.port = port;
skey.protocol = protocol;
@@ -405,37 +403,11 @@ void ui_print() {
}
- clear();
- /*
- //erase();
- move(0, 0);
- attron(A_REVERSE);
- addstr(" q ");
- attroff(A_REVERSE);
- addstr(" quit ");
- attron(A_REVERSE);
- addstr(" r ");
- attroff(A_REVERSE);
- addstr(options.dnsresolution ? " resolver off "
- : " resolver on ");
- attron(A_REVERSE);
- addstr(" b ");
- attroff(A_REVERSE);
- addstr(options.showbars ? " bars off "
- : " bars on ");
-
- attron(A_REVERSE);
- addstr(" s ");
- attroff(A_REVERSE);
- addstr(options.aggregate_src ? " show src "
- : " hide src ");
-
- attron(A_REVERSE);
- addstr(" d ");
- attroff(A_REVERSE);
- addstr(options.aggregate_dest ? " show dest "
- : " hide dest ");
- */
+ /*
+ * erase() is faster than clear(). Dunno why we switched to
+ * clear() -pdw 24/10/02
+ */
+ erase();
draw_bar_scale(&y);
@@ -461,7 +433,6 @@ void ui_print() {
sprint_host(line, &(screen_line->ap.src), screen_line->ap.src_port, screen_line->ap.protocol, L);
- //sprintf(line, "%-*s", L, hostname);
mvaddstr(y, x, line);
x += L;
@@ -483,9 +454,6 @@ void ui_print() {
y = LINES - 3;
-
- //mvaddstr(y, 0, "total: ");
- //mvaddstr(y+1, 0, " peak: ");
mvhline(y-1, 0, 0, COLS);
@@ -521,6 +489,12 @@ void ui_print() {
draw_totals(&totals);
+
+ if(showhelphint > 0) {
+ mvaddstr(0, 0, "Press h for help ");
+ clrtoeol();
+ showhelphint--;
+ }
refresh();
@@ -627,6 +601,12 @@ void ui_loop() {
case 'P':
options.paused = !options.paused;
break;
+ case ERR:
+ break;
+ default:
+ showhelphint = 2;
+ tick(1);
+ break;
}
tick(0);
}