Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/netstat with -inv flag, do not truncate name of the ...



details:   https://anonhg.NetBSD.org/src/rev/b3a415df3dd6
branches:  trunk
changeset: 494119:b3a415df3dd6
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Jul 02 09:07:23 2000 +0000

description:
with -inv flag, do not truncate name of the interface (like "strip0").

diffstat:

 usr.bin/netstat/if.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r e461e91721d6 -r b3a415df3dd6 usr.bin/netstat/if.c
--- a/usr.bin/netstat/if.c      Sun Jul 02 08:04:10 2000 +0000
+++ b/usr.bin/netstat/if.c      Sun Jul 02 09:07:23 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.40 2000/04/19 03:26:55 enami Exp $    */
+/*     $NetBSD: if.c,v 1.41 2000/07/02 09:07:23 itojun Exp $   */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.40 2000/04/19 03:26:55 enami Exp $");
+__RCSID("$NetBSD: if.c,v 1.41 2000/07/02 09:07:23 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -174,7 +174,11 @@
                        *cp = '\0';
                        ifaddraddr = (u_long)ifnet.if_addrlist.tqh_first;
                }
-               printf("%-5.5s %-5llu ", name,
+               if (vflag)
+                       n = strlen(name) < 5 ? 5 : strlen(name);
+               else
+                       n = 5;
+               printf("%-*.*s %-5llu ", n, n, name,
                    (unsigned long long)ifnet.if_mtu);
                if (ifaddraddr == 0) {
                        printf("%-13.13s ", "none");



Home | Main Index | Thread Index | Old Index