git: ae9c0ba8ef2f - main - netstat(8): for -W, use IFNAMSIZ

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 16 May 2024 17:11:23 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae9c0ba8ef2f540f9030909cf07e3c59f876fd23

commit ae9c0ba8ef2f540f9030909cf07e3c59f876fd23
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-05-14 23:40:32 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-16 17:07:34 +0000

    netstat(8): for -W, use IFNAMSIZ
    
    If -W is specified, use IFNAMSIZ as the width of the Netif column,
    instead of the default 12.
    
    Reviewed by: imp,zlei,Mina Galić
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1223
---
 usr.bin/netstat/nhops.c | 2 +-
 usr.bin/netstat/route.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/netstat/nhops.c b/usr.bin/netstat/nhops.c
index 1db3c2d37167..1a5d8eee74b1 100644
--- a/usr.bin/netstat/nhops.c
+++ b/usr.bin/netstat/nhops.c
@@ -64,7 +64,7 @@
 #include "common.h"
 
 /* column widths; each followed by one space */
-#define WID_IF_DEFAULT		12	/* width of netif column */
+#define WID_IF_DEFAULT		(Wflag ? IFNAMSIZ : 12)	/* width of netif column */
 #ifndef INET6
 #define	WID_DST_DEFAULT(af) 	18	/* width of destination column */
 #define	WID_GW_DEFAULT(af)	18	/* width of gateway column */
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 93e882052de2..482fb07ff950 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -184,7 +184,7 @@ pr_family(int af1)
 }
 
 /* column widths; each followed by one space */
-#define WID_IF_DEFAULT		12	/* width of netif column */
+#define WID_IF_DEFAULT		(Wflag ? IFNAMSIZ : 12)	/* width of netif column */
 #ifndef INET6
 #define	WID_DST_DEFAULT(af) 	18	/* width of destination column */
 #define	WID_GW_DEFAULT(af)	18	/* width of gateway column */