[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180220192408.19763-6-stephen@networkplumber.org>
Date: Tue, 20 Feb 2018 11:24:08 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <sthemmin@...rosoft.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH v2 iproute2-next 5/5] ip: always print interface name in color
From: Stephen Hemminger <sthemmin@...rosoft.com>
Even in brief mode the interface name should be printed
in color if desired. This makes output consistent across
regular and brief mode.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
bridge/link.c | 2 +-
include/utils.h | 2 +-
ip/ipaddress.c | 4 ++--
lib/utils.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index e7ad5c61fa1e..69c08ec77797 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -210,7 +210,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
print_bool(PRINT_ANY, "deleted", "Deleted ", true);
print_int(PRINT_ANY, "ifindex", "%d: ", ifi->ifi_index);
- m_flag = print_name_and_link("%s: ", COLOR_IFNAME, name, tb);
+ m_flag = print_name_and_link("%s: ", name, tb);
print_link_flags(fp, ifi->ifi_flags, m_flag);
if (tb[IFLA_MTU])
diff --git a/include/utils.h b/include/utils.h
index 75ddb4aec3fc..6bc77e74e51d 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -251,7 +251,7 @@ void print_escape_buf(const __u8 *buf, size_t len, const char *escape);
int print_timestamp(FILE *fp);
void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);
-unsigned int print_name_and_link(const char *fmt, enum color_attr color,
+unsigned int print_name_and_link(const char *fmt,
const char *name, struct rtattr *tb[]);
#define BIT(nr) (1UL << (nr))
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1380453984d5..9b3c1bc4555d 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -758,7 +758,7 @@ static int print_linkinfo_brief(FILE *fp, const char *name,
{
unsigned int m_flag = 0;
- m_flag = print_name_and_link("%-16s ", COLOR_NONE, name, tb);
+ m_flag = print_name_and_link("%-16s ", name, tb);
if (tb[IFLA_OPERSTATE])
print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
@@ -871,7 +871,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
print_int(PRINT_ANY, "ifindex", "%d: ", ifi->ifi_index);
- m_flag = print_name_and_link("%s: ", COLOR_IFNAME, name, tb);
+ m_flag = print_name_and_link("%s: ", name, tb);
print_link_flags(fp, ifi->ifi_flags, m_flag);
if (tb[IFLA_MTU])
diff --git a/lib/utils.c b/lib/utils.c
index 61af123e9922..24aeddd8e2f1 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1262,7 +1262,7 @@ int print_timestamp(FILE *fp)
return 0;
}
-unsigned int print_name_and_link(const char *fmt, enum color_attr color,
+unsigned int print_name_and_link(const char *fmt,
const char *name, struct rtattr *tb[])
{
const char *link = NULL;
@@ -1305,7 +1305,7 @@ unsigned int print_name_and_link(const char *fmt, enum color_attr color,
}
}
- print_color_string(PRINT_ANY, color, "ifname", fmt, name);
+ print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", fmt, name);
return m_flag;
}
--
2.16.1
Powered by blists - more mailing lists