mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-04 21:40:34 +00:00
ip: always print interface name in color
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> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
3a1ca9a5b6
commit
4328b687b4
@ -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])
|
||||
|
@ -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))
|
||||
|
@ -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])
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user