setscreenmode

Sets the mode of the application screen as long as the application screen is not identical to the System Console or System Logger screen.

Library:LibC
Classification:Novell
Service:Screen Support

Syntax

  #include <screen.h> 
   
  int setscreenmode (
     unsigned long   mode);
  

Parameters

mode

(IN) Specifies the mode to assign to the screen.

Flag

Value

Description

SCR_NO_MODE

0x00000000

Assigns no mode to the screen. The screen is not terminated when the NLM exits. This mode cannot be OR'd with the SCR_COLOR_ATTR flag. They must be set separately.

SCR_AUTOCLOSE_ON_EXIT

0x00000001

Causes the screen to close when the NLM that created it exits. This is the default mode. This mode can be OR'd with the SCR_COLOR_ATTR flag.

SCR_COLOR_ATTRS

0x00000002

On NetWare 6.0 SP2 or later, enables color printing on the screen.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

23

ENO_SCRNS

Screen I/O is being attempted when no screen is available.

105

ENOCONTEXT

No thread context is present.

Remarks

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.

See Also

getscreenmode

Example

  #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.