From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 2/3] bridge: use print_json for some outputs
Date: Thu, 6 Sep 2018 16:30:56 +0100 [thread overview]
Message-ID: <20180906153057.5379-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20180906153057.5379-1-stephen@networkplumber.org>
Rather than using is_json_context(), use the print_string functions
which handle both cases.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
bridge/mdb.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 9bdef0262c54..cc1b4547865c 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -131,15 +131,8 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
if (n->nlmsg_type == RTM_DELMDB)
print_bool(PRINT_ANY, "deleted", "Deleted ", true);
-
- if (is_json_context()) {
- print_int(PRINT_JSON, "index", NULL, ifindex);
- print_string(PRINT_JSON, "dev", NULL, dev);
- } else {
- fprintf(f, "%u: ", ifindex);
- color_fprintf(f, COLOR_IFNAME, "%s ", dev);
- }
-
+ print_int(PRINT_ANY, "index", "%u: ", ifindex);
+ print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "%s ", dev);
print_string(PRINT_ANY, "port", " %s ",
ll_index_to_name(e->ifindex));
--
2.17.1
next prev parent reply other threads:[~2018-09-06 20:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 15:30 [PATCH iproute2 1/3] bridge: minor change to mdb print Stephen Hemminger
2018-09-06 15:30 ` Stephen Hemminger [this message]
2018-09-06 15:30 ` [PATCH iproute2 3/3] bridge: fix vlan show formatting Stephen Hemminger
2018-09-10 11:52 ` Tobias Jungel
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=20180906153057.5379-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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