Not enough arguments for capability `setaf` in OpenBSD
0
votes
2
answers
162
views
I want to change the text colour in a shell. I can use
tput
to get the correct escape codes. For example,
echo "$(tput setaf 5)My text$(tput sgr0)"
outputs My text
in a pink-ish tone.
This works fine on Linux, macOS, FreeBSD, NetBSD, and Solaris. On OpenBSD 7.2, however, I get the following error:
tput: not enough arguments (3) for capability `setaf'
According to [the OpenBSD docs of tput
](https://man.openbsd.org/tput) , the attribute should be defined in terminfo
or termcap
. I don't see setaf
defined in [the docs for termcap
](https://man.openbsd.org/termcap.5) , so I assume tput
interprets setaf
as defined in [the docs for terminfo
](https://man.openbsd.org/terminfo.5) . According to those docs:
> To change the current foreground or background color on a Tektronix-type terminal, use **setaf** (set ANSI foreground) and **setab** (set ANSI background) or **setf** (set foreground) and **setb** (set background). These take one parameter, the color number.
This conflicts what I've been told by the error message. On the other hand, I can use tput setaf 5 0 0
and, regardless of the last two parameters, the foreground colour is changed to pink-ish.
Why does tput
require three parameters on OpenBSD, and what do those extra two parameters mean?
Asked by FWDekker
(101 rep)
Feb 17, 2023, 06:13 PM
Last activity: Feb 18, 2023, 03:35 PM
Last activity: Feb 18, 2023, 03:35 PM