From: Stephen Hemminger <stephen@networkplumber•org>
To: netdev@vger•kernel.org
Cc: Stephen Hemminger <sthemmin@microsoft•com>,
Stephen Hemminger <stephen@networkplumber•org>
Subject: [PATCH v2 iproute2-next 5/5] ip: always print interface name in color
Date: Tue, 20 Feb 2018 11:24:08 -0800 [thread overview]
Message-ID: <20180220192408.19763-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20180220192408.19763-1-stephen@networkplumber.org>
From: Stephen Hemminger <sthemmin@microsoft•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@networkplumber•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
next prev parent reply other threads:[~2018-02-20 19:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 19:24 [PATCH v2 iproute2-next 0/5] bridge: json and color support Stephen Hemminger
2018-02-20 19:24 ` [PATCH v2 iproute2-next 1/5] bridge: implement json pretty print flag Stephen Hemminger
2018-02-20 19:24 ` [PATCH v2 iproute2-next 2/5] bridge: colorize output and use JSON print library Stephen Hemminger
2018-07-15 1:41 ` Roopa Prabhu
2018-08-29 1:17 ` Roopa Prabhu
2018-08-29 15:04 ` Stephen Hemminger
2018-02-20 19:24 ` [PATCH v2 iproute2-next 3/5] bridge: add json support for link command Stephen Hemminger
2018-02-20 19:24 ` [PATCH v2 iproute2-next 4/5] bridge: update man page for new color and json changes Stephen Hemminger
2018-02-20 19:24 ` Stephen Hemminger [this message]
2018-02-21 16:48 ` [PATCH v2 iproute2-next 0/5] bridge: json and color support David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180220192408.19763-6-stephen@networkplumber.org \
--to=stephen@networkplumber$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sthemmin@microsoft$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox