Sets the mode of the application screen as long as the application screen is not identical to the System Console or System Logger screen.
#include <screen.h> int setscreenmode ( unsigned long mode);
(IN) Specifies the mode to assign to the screen.
If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:
After the mode is set to color, the following flags from screen.h can be used with the printf family of functions to specify the color.
COLOR_STR_BLACK
COLOR_STR_MAROONCOLOR_STR_GREEN
COLOR_STR_OLIVE
COLOR_STR_NAVY
COLOR_STR_PURPLE
COLOR_STR_TEAL
COLOR_STR_SILVER
COLOR_STR_GREY
COLOR_STR_RED
COLOR_STR_LIME
COLOR_STR_YELLOW
COLOR_STR_BLUE
COLOR_STR_MAGENTACOLOR_STR_CYAN
COLOR_STR_WHITE
COLOR_STR_NORMAL
When using colors, be aware of the following:
The COLOR_STR_NORMAL flag doesn’t return the pen color to what it was before the last change, but only to the dim white or silver color that is the “normal” color, which an uncolored NLM uses to print to the screen.
Color is stateful per thread. Once you set a pen color for a thread, the pen color the thread last wrote in is the color that it starts writing in next time.
#include <stdio.h> #include <screen.h> setscreenmode(SCR_COLOR_ATTRS) void print_something( void ) { char *format = "This is a" COLOR_STR_RED " %s" COLOR_STR_NORMAL "."; printf(format, "test"); . . .
This prints the following, with test printed in red:
This is a test.