]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
feat(curses): show host and protocol in title 576/head
authorDarafei Praliaskouski <me@komzpa.net>
Sat, 9 May 2026 09:40:26 +0000 (13:40 +0400)
committerDarafei Praliaskouski <me@komzpa.net>
Mon, 25 May 2026 11:42:53 +0000 (15:42 +0400)
ui/curses.c

index 77b33b2ddb7a82dc0913dd8cf2d26b76b0fe8c0b..16c2cce3f962dc974cd999769cb1133e8cd25ced 100644 (file)
@@ -115,6 +115,26 @@ static void pwcenter(
 }
 
 
+static const char *probe_protocol_name(
+    int protocol)
+{
+    switch (protocol) {
+    case IPPROTO_ICMP:
+        return "ICMP";
+    case IPPROTO_UDP:
+        return "UDP";
+    case IPPROTO_TCP:
+        return "TCP";
+#ifdef HAS_SCTP
+    case IPPROTO_SCTP:
+        return "SCTP";
+#endif
+    default:
+        return "unknown";
+    }
+}
+
+
 int mtr_curses_keyaction(
     struct mtr_ctl *ctl)
 {
@@ -894,8 +914,9 @@ void mtr_curses_redraw(
 
     move(0, 0);
     attron(A_BOLD);
-    snprintf(buf, sizeof(buf), "%s%s%s", "My traceroute  [v",
-             PACKAGE_VERSION, "]");
+    snprintf(buf, sizeof(buf), "My traceroute on %s  [v%s] %s",
+             ctl->LocalHostname, PACKAGE_VERSION,
+             probe_protocol_name(ctl->mtrtype));
     pwcenter(buf);
     attroff(A_BOLD);