Outputs attributes to the terminal.
Curses Library (libcurses.a)
#include <curses.h>
int vidattr
(chtype attr);
int vid_attr
(attr_t attr,
short color_pair_number,
void *opt);
int vidputs
(chtype attr,
int (*putfunc)(int));
int vid_puts
(attr_t attr,
short color_pair_number,
void *opt,
int (*putfunc)(int));
These subroutines output commands to a terminal that changes the terminal's attributes.
If the terminfo database indicates that the terminal in use can display characters in the rendition specified by attr, then the vadattr subroutine outputs one or more commands to request that the terminal display subsequent characters in that rendition. The subroutine outputs by calling the putchar subroutine. The vidattr subroutine neither relies on nor updates the model that Curses maintains of the prior rendition mode.
The vidputs subroutine computes the same terminal output string that vidattr does, based on attr, but the vidputs subroutine outputs by calling the user-supplied subroutine putfunc. The vid_attr and vid_puts subroutines correspond to vidattr and vidputs respectively, but take a set of arguments, one of type attr_t for the attributes, short for the color pair number and a void *, and thus support the attribute constants with the WA_prefix.
The opts argument is reserved for definition in a future edition of this document. Currently, the application must provide a null pointer as opts.
The user-supplied putfunc subroutine (which can be specified as an argument to either vidputs or vid_puts is either putchar or some other subroutine with the same prototype. Both the vidputs and the vid_puts subroutines ignore the return value of putfunc.
Item | Description |
---|---|
att | |
color_pair_number | |
*opt | |
*putfunc |
Upon successful completion, these subroutines return OK. Otherwise, they return ERR.
vidattr(A_STANDOUT);
int (*my_putc) ();
vidputs(A_STANDOUT, my_putc);