Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig Don't divide flags output



details:   https://anonhg.NetBSD.org/src/rev/32f986b62fc6
branches:  trunk
changeset: 339576:32f986b62fc6
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 29 07:42:27 2015 +0000

description:
Don't divide flags output

If there are many enabled flags, ifconfig divides flags output into
multiple formatted strings due to snprintb_m, e.g.,
  wm0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX>wm0: flags=8b43<MULTICAST> mtu 1500

This behavior is probably unexpected. The change always outputs enabled
flags at once like this:
  wm0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500

diffstat:

 sbin/ifconfig/ifconfig.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (33 lines):

diff -r d9a7cbce5541 -r 32f986b62fc6 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Wed Jul 29 06:10:09 2015 +0000
+++ b/sbin/ifconfig/ifconfig.c  Wed Jul 29 07:42:27 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.234 2015/04/22 17:42:22 roy Exp $       */
+/*     $NetBSD: ifconfig.c,v 1.235 2015/07/29 07:42:27 ozaki-r Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.234 2015/04/22 17:42:22 roy Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.235 2015/07/29 07:42:27 ozaki-r Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1261,12 +1261,8 @@
        if ((ifname = getifinfo(env, oenv, &flags)) == NULL)
                err(EXIT_FAILURE, "%s: getifinfo", __func__);
 
-       (void)snprintb_m(fbuf, sizeof(fbuf), IFFBITS, flags, MAX_PRINT_LEN);
-       bp = fbuf;
-       while (*bp != '\0') {
-               printf("%s: flags=%s", ifname, &bp[2]);
-               bp += strlen(bp) + 1;
-       }
+       (void)snprintb(fbuf, sizeof(fbuf), IFFBITS, flags);
+       printf("%s: flags=%s", ifname, fbuf);
 
        estrlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
        if (prog_ioctl(s, SIOCGIFMETRIC, &ifr) == -1)



Home | Main Index | Thread Index | Old Index