summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
authorKarel Zak2019-03-08 13:15:29 +0100
committerKarel Zak2019-03-08 13:15:29 +0100
commitffe147fadde382108f6a96809cb1f222e6ae94e6 (patch)
tree97efbef9d8309c687cd11b68d1b85deb55897136 /term-utils
parentMerge branch 'patch-2' of https://github.com/MeggyCal/util-linux (diff)
parentsetterm: update comments about -ulcolor/-hbcolor syntax (diff)
downloadkernel-qcow2-util-linux-ffe147fadde382108f6a96809cb1f222e6ae94e6.tar.gz
kernel-qcow2-util-linux-ffe147fadde382108f6a96809cb1f222e6ae94e6.tar.xz
kernel-qcow2-util-linux-ffe147fadde382108f6a96809cb1f222e6ae94e6.zip
Merge branch 'setterm' of https://github.com/jwilk-forks/util-linux
* 'setterm' of https://github.com/jwilk-forks/util-linux: setterm: update comments about -ulcolor/-hbcolor syntax setterm: fix bright colors for --ulcolor/--hbcolor setterm: disallow "default" for --ulcolor/--hbcolor
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/setterm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index bb13eb3c7..d9a846ab0 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -231,11 +231,14 @@ static int parse_ulhb_color(char **av, int *oi)
color = parse_color(color_name);
if (color < 0)
color = strtos32_or_err(color_name, _("argument error"));
- if (!is_valid_color(color))
+ if (!is_valid_color(color) || color == DEFAULT)
errx(EXIT_FAILURE, "%s: %s", _("argument error"), color_name);
if (bright && (color == BLACK || color == GREY))
errx(EXIT_FAILURE, _("argument error: bright %s is not supported"), color_name);
+ if (bright)
+ color |= 8;
+
return color;
}
@@ -973,11 +976,11 @@ static void perform_sequence(struct setterm_control *ctl)
if (ctl->opt_background)
printf("\033[4%c%s", '0' + ctl->opt_ba_color, "m");
- /* -ulcolor black|red|green|yellow|blue|magenta|cyan|white|default. */
+ /* -ulcolor [bright] black|red|green|yellow|blue|magenta|cyan|white. */
if (ctl->opt_ulcolor && vc_only(ctl, "--ulcolor"))
printf("\033[1;%d]", ctl->opt_ul_color);
- /* -hbcolor black|red|green|yellow|blue|magenta|cyan|white|default. */
+ /* -hbcolor [bright] black|red|green|yellow|blue|magenta|cyan|white. */
if (ctl->opt_hbcolor)
printf("\033[2;%d]", ctl->opt_hb_color);