ifconfig(8): Eliminate trailing whitespace on inet6 and group lines
authorAaron LI <aly@aaronly.me>
Sun, 12 Apr 2020 13:53:32 +0000 (21:53 +0800)
committerAaron LI <aly@aaronly.me>
Fri, 26 Jun 2020 14:52:59 +0000 (22:52 +0800)
Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/edcbc8f7441a32ec27fb2e57542bf291cb01029e
https://reviews.freebsd.org/D19004

sbin/ifconfig/af_inet6.c
sbin/ifconfig/ifgroup.c

index 76561e2..551748c 100644 (file)
@@ -269,41 +269,43 @@ in6_status(int s __unused, const struct rt_addrinfo * info)
        sin = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
        if (!sin)
                sin = &null_sin;
        sin = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
        if (!sin)
                sin = &null_sin;
-       printf("prefixlen %d ", prefix(&sin->sin6_addr,
+       printf("prefixlen %d", prefix(&sin->sin6_addr,
                sizeof(struct in6_addr)));
 
        if ((flags6 & IN6_IFF_ANYCAST) != 0)
                sizeof(struct in6_addr)));
 
        if ((flags6 & IN6_IFF_ANYCAST) != 0)
-               printf("anycast ");
+               printf(" anycast");
        if ((flags6 & IN6_IFF_TENTATIVE) != 0)
        if ((flags6 & IN6_IFF_TENTATIVE) != 0)
-               printf("tentative ");
+               printf(" tentative");
        if ((flags6 & IN6_IFF_DUPLICATED) != 0)
        if ((flags6 & IN6_IFF_DUPLICATED) != 0)
-               printf("duplicated ");
+               printf(" duplicated");
        if ((flags6 & IN6_IFF_DETACHED) != 0)
        if ((flags6 & IN6_IFF_DETACHED) != 0)
-               printf("detached ");
+               printf(" detached");
        if ((flags6 & IN6_IFF_DEPRECATED) != 0)
        if ((flags6 & IN6_IFF_DEPRECATED) != 0)
-               printf("deprecated ");
+               printf(" deprecated");
        if ((flags6 & IN6_IFF_AUTOCONF) != 0)
        if ((flags6 & IN6_IFF_AUTOCONF) != 0)
-               printf("autoconf ");
+               printf(" autoconf");
        if ((flags6 & IN6_IFF_TEMPORARY) != 0)
        if ((flags6 & IN6_IFF_TEMPORARY) != 0)
-               printf("temporary ");
+               printf(" temporary");
 
         if (scopeid)
 
         if (scopeid)
-               printf("scopeid 0x%x ", scopeid);
+               printf(" scopeid 0x%x", scopeid);
 
        if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
 
        if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
-               printf("pltime ");
+               printf(" pltime");
                if (lifetime.ia6t_preferred) {
                if (lifetime.ia6t_preferred) {
-                       printf("%s ", lifetime.ia6t_preferred < now.tv_sec
+                       printf(" %s", lifetime.ia6t_preferred < now.tv_sec
                                ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
                                ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
-               } else
-                       printf("infty ");
+               } else {
+                       printf(" infty");
+               }
 
 
-               printf("vltime ");
+               printf(" vltime");
                if (lifetime.ia6t_expire) {
                if (lifetime.ia6t_expire) {
-                       printf("%s ", lifetime.ia6t_expire < now.tv_sec
+                       printf(" %s", lifetime.ia6t_expire < now.tv_sec
                                ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec));
                                ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec));
-               } else
-                       printf("infty ");
+               } else {
+                       printf(" infty");
+               }
        }
 
        putchar('\n');
        }
 
        putchar('\n');
index fc3242c..6d72d7d 100644 (file)
@@ -109,9 +109,9 @@ getifgroups(int s)
                len -= sizeof(struct ifg_req);
                if (strcmp(ifg->ifgrq_group, "all") != 0) {
                        if (cnt == 0)
                len -= sizeof(struct ifg_req);
                if (strcmp(ifg->ifgrq_group, "all") != 0) {
                        if (cnt == 0)
-                               printf("\tgroups: ");
+                               printf("\tgroups:");
                        cnt++;
                        cnt++;
-                       printf("%s ", ifg->ifgrq_group);
+                       printf(" %s", ifg->ifgrq_group);
                }
        }
        if (cnt)
                }
        }
        if (cnt)