Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/ifconfig print address flag bits using snprintb
details: https://anonhg.NetBSD.org/src/rev/7ade1434847c
branches: trunk
changeset: 347724:7ade1434847c
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 13 00:20:51 2016 +0000
description:
print address flag bits using snprintb
diffstat:
sbin/ifconfig/af_inet.c | 14 ++++++--------
sbin/ifconfig/af_inet6.c | 22 ++++++----------------
2 files changed, 12 insertions(+), 24 deletions(-)
diffs (78 lines):
diff -r 5d48efe9f194 -r 7ade1434847c sbin/ifconfig/af_inet.c
--- a/sbin/ifconfig/af_inet.c Tue Sep 13 00:19:28 2016 +0000
+++ b/sbin/ifconfig/af_inet.c Tue Sep 13 00:20:51 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $ */
+/* $NetBSD: af_inet.c,v 1.20 2016/09/13 00:20:51 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $");
+__RCSID("$NetBSD: af_inet.c,v 1.20 2016/09/13 00:20:51 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -149,12 +149,10 @@
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFAFLAG_IN");
} else {
- if (ifr.ifr_addrflags & IN_IFF_TENTATIVE)
- printf(" tentative");
- if (ifr.ifr_addrflags & IN_IFF_DUPLICATED)
- printf(" duplicated");
- if (ifr.ifr_addrflags & IN_IFF_DETACHED)
- printf(" detached");
+ char fbuf[1024];
+ (void)snprintb(fbuf, sizeof(fbuf), IN_IFFBITS,
+ ifr.ifr_addrflags);
+ printf(" flags %s", fbuf);
}
#endif
}
diff -r 5d48efe9f194 -r 7ade1434847c sbin/ifconfig/af_inet6.c
--- a/sbin/ifconfig/af_inet6.c Tue Sep 13 00:19:28 2016 +0000
+++ b/sbin/ifconfig/af_inet6.c Tue Sep 13 00:20:51 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $ */
+/* $NetBSD: af_inet6.c,v 1.36 2016/09/13 00:20:51 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $");
+__RCSID("$NetBSD: af_inet6.c,v 1.36 2016/09/13 00:20:51 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -325,20 +325,10 @@
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFAFLAG_IN6");
} else {
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_ANYCAST)
- printf(" anycast");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_TENTATIVE)
- printf(" tentative");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_DUPLICATED)
- printf(" duplicated");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_DETACHED)
- printf(" detached");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_DEPRECATED)
- printf(" deprecated");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_AUTOCONF)
- printf(" autoconf");
- if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_TEMPORARY)
- printf(" temporary");
+ char fbuf[1024];
+ (void)snprintb(fbuf, sizeof(fbuf), IN6_IFFBITS,
+ ifr6.ifr_ifru.ifru_flags6);
+ printf(" flags %s", fbuf);
}
if (scopeid)
Home |
Main Index |
Thread Index |
Old Index