netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Till Maas <opensource@till.name>
Subject: [iproute PATCH 2/2] lib: Make check_enable_color() return boolean
Date: Fri, 17 Aug 2018 18:38:46 +0200	[thread overview]
Message-ID: <20180817163846.27578-2-phil@nwl.cc> (raw)
In-Reply-To: <20180817163846.27578-1-phil@nwl.cc>

As suggested, turn return code into true/false although it's not checked
anywhere yet.

Fixes: 4d82962cccc6a ("Merge common code for conditionally colored output")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 include/color.h | 2 +-
 lib/color.c     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/color.h b/include/color.h
index a22a00c2277e0..e30f28c51c844 100644
--- a/include/color.h
+++ b/include/color.h
@@ -21,7 +21,7 @@ enum color_opt {
 };
 
 void enable_color(void);
-int check_enable_color(int color, int json);
+bool check_enable_color(int color, int json);
 bool matches_color(const char *arg, int *val);
 void set_color_palette(void);
 int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...);
diff --git a/lib/color.c b/lib/color.c
index 9c9023587748f..eaf69e74d673a 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -79,16 +79,16 @@ void enable_color(void)
 	set_color_palette();
 }
 
-int check_enable_color(int color, int json)
+bool check_enable_color(int color, int json)
 {
 	if (json || color == COLOR_OPT_NEVER)
-		return 1;
+		return false;
 
 	if (color == COLOR_OPT_ALWAYS || isatty(fileno(stdout))) {
 		enable_color();
-		return 0;
+		return true;
 	}
-	return 1;
+	return false;
 }
 
 bool matches_color(const char *arg, int *val)
-- 
2.18.0

  reply	other threads:[~2018-08-17 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16  9:37 [iproute PATCH v4] Make colored output configurable Phil Sutter
2018-08-16 13:06 ` David Ahern
2018-08-16 15:00   ` Phil Sutter
2018-08-17 16:24 ` Stephen Hemminger
2018-08-17 16:38   ` [iproute PATCH v5 1/2] " Phil Sutter
2018-08-17 16:38     ` Phil Sutter [this message]
2018-08-17 20:22     ` 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=20180817163846.27578-2-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=opensource@till.name \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).