diff options
author | Karel Zak | 2015-02-25 10:06:40 +0100 |
---|---|---|
committer | Karel Zak | 2015-02-25 10:06:40 +0100 |
commit | 81f55ab9043cfa26851a9dbeb356e5dc7f791a45 (patch) | |
tree | 8285ac67d464ad46ad4c8e8e44fe49ad11ce9f14 /lib/colors.c | |
parent | logger: move /dev/log to pathnames.h (diff) | |
download | kernel-qcow2-util-linux-81f55ab9043cfa26851a9dbeb356e5dc7f791a45.tar.gz kernel-qcow2-util-linux-81f55ab9043cfa26851a9dbeb356e5dc7f791a45.tar.xz kernel-qcow2-util-linux-81f55ab9043cfa26851a9dbeb356e5dc7f791a45.zip |
build-sys: add --disable-colors-default
The current util-linux is to have enabled colorized outputs by
default, this default behavior is possible to change by new configure
option --disable-colors-default.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/colors.c')
-rw-r--r-- | lib/colors.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/colors.c b/lib/colors.c index 6f79ac4a8..2e5af48d9 100644 --- a/lib/colors.c +++ b/lib/colors.c @@ -19,6 +19,15 @@ #include "debug.h" /* + * Default behavior, maybe be override by terminal-colors.d/{enable,disable}. + */ +#ifdef USE_COLORS_BY_DEFAULT +# define UL_COLORMODE_DEFAULT UL_COLORMODE_AUTO /* check isatty() */ +#else +# define UL_COLORMODE_DEFAULT UL_COLORMODE_NEVER /* no colors by default */ +#endif + +/* * terminal-colors.d debug stuff */ UL_DEBUG_DEFINE_MASK(termcolors); @@ -678,7 +687,7 @@ int colors_init(int mode, const char *name) if (mode == UL_COLORMODE_UNDEF && (atty = isatty(STDOUT_FILENO))) { int rc = colors_read_configuration(cc); if (rc) - cc->mode = UL_COLORMODE_AUTO; + cc->mode = UL_COLORMODE_DEFAULT; else { /* evaluate scores */ @@ -686,7 +695,7 @@ int colors_init(int mode, const char *name) cc->scores[UL_COLORFILE_ENABLE]) cc->mode = UL_COLORMODE_NEVER; else - cc->mode = UL_COLORMODE_AUTO; + cc->mode = UL_COLORMODE_DEFAULT; atexit(colors_deinit); } |