[Iftop-users] [PATCH v2] Fix minor ui annoyance when ligatures are suported.

Ariel Popper a at arielp.com
Fri Sep 25 01:41:08 BST 2020


When `iftop` is run under a terminal/font combination that supports
ligatures, the "<=" characters form a single, stacked "less than or equal to"
glyph rather than an arrow pointing left. This patch replaces "<=" with "<-"
along with some others in order to remain visually consistant.
---

I'm not sure if anyone cares about this but me, but thought I might
share it with whoever wants it. Anyhow, this is a more complete patch 
than the last one. 

 iftop.8 |  6 +++---
 tui.c   |  4 ++--
 ui.c    | 10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/iftop.8 b/iftop.8
index 6bc38a7..298d636 100644
--- a/iftop.8
+++ b/iftop.8
@@ -116,12 +116,12 @@ visual indication of traffic.
 
 The main part of the display lists, for each pair of hosts, the rate at which
 data has been sent and received over the preceding 2, 10 and 40 second
-intervals. The direction of data flow is indicated by arrows, <= and =>. For
+intervals. The direction of data flow is indicated by arrows, <- and ->. For
 instance,
 .nf
 
-foo.example.com  =>  bar.example.com      1Kb  500b   100b
-                 <=                       2Mb    2Mb    2Mb
+foo.example.com  ->  bar.example.com      1Kb  500b   100b
+                 <-                       2Mb    2Mb    2Mb
 
 .fi
 shows, on the first line, traffic from \fBfoo.example.com\fP to
diff --git a/tui.c b/tui.c
index af10a2f..d9b26b6 100644
--- a/tui.c
+++ b/tui.c
@@ -85,7 +85,7 @@ void tui_print() {
     sprint_host(host2, screen_line->ap.af, &(screen_line->ap.dst6), screen_line->ap.dst_port, screen_line->ap.protocol, PRINT_WIDTH, options.aggregate_dest);
 
     /* Send rate per connection */
-    printf("%4d %s%s", l, host1, " =>");
+    printf("%4d %s%s", l, host1, " ->");
     for(j = 0; j < HISTORY_DIVISIONS; j++) {
       readable_size(screen_line->sent[j], buf0_10, 10, 1024, options.bandwidth_unit);
       printf(" %10s", buf0_10);
@@ -95,7 +95,7 @@ void tui_print() {
     printf(" %10s\n", buf0_10);
 
     /* Receive rate per connection */
-    printf("     %s%s", host2, " <=");
+    printf("     %s%s", host2, " <-");
     for(j = 0; j < HISTORY_DIVISIONS; j++) {
       readable_size(screen_line->recv[j], buf0_10, 10, 1024, options.bandwidth_unit);
       printf(" %10s", buf0_10);
diff --git a/ui.c b/ui.c
index abaadd2..242bd6e 100644
--- a/ui.c
+++ b/ui.c
@@ -330,17 +330,17 @@ void ui_print() {
 
                 switch(options.linedisplay) {
                   case OPTION_LINEDISPLAY_TWO_LINE:
-                    mvaddstr(y, x, " => ");
-                    mvaddstr(y+1, x, " <= ");
+                    mvaddstr(y, x, " -> ");
+                    mvaddstr(y+1, x, " <- ");
                     break;
                   case OPTION_LINEDISPLAY_ONE_LINE_BOTH:
-                    mvaddstr(y, x, "<=> ");
+                    mvaddstr(y, x, "<-> ");
                     break;
                   case OPTION_LINEDISPLAY_ONE_LINE_SENT:
-                    mvaddstr(y, x, " => ");
+                    mvaddstr(y, x, " -> ");
                     break;
                   case OPTION_LINEDISPLAY_ONE_LINE_RECV:
-                    mvaddstr(y, x, " <= ");
+                    mvaddstr(y, x, " <- ");
                     break;
                 }
 
-- 
2.28.0




More information about the iftop-users mailing list