From: Darafei Praliaskouski Date: Sat, 9 May 2026 09:40:26 +0000 (+0400) Subject: feat(curses): show host and protocol in title X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12f593b0878947b3dcdff99a44db5ed9274e97a3;p=thirdparty%2Fmtr.git feat(curses): show host and protocol in title --- diff --git a/ui/curses.c b/ui/curses.c index 77b33b2..16c2cce 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -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);