]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
lib: Make check_enable_color() return boolean
authorPhil Sutter <phil@nwl.cc>
Fri, 17 Aug 2018 16:38:46 +0000 (18:38 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 20 Aug 2018 15:55:16 +0000 (08:55 -0700)
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
include/color.h
lib/color.c

index a22a00c2277e0f1db17d98b1adb16dd71d250502..e30f28c51c844a951bc202507a84ae0f9df80c34 100644 (file)
@@ -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, ...);
index 9c9023587748fac2744fa6760e42e87bbcfd9d45..eaf69e74d673a6e949e68c504d54777927789b79 100644 (file)
@@ -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)