3.3 Screen Management

The main screen for the server is the console screen. This screen allows the operator to issue commands directly to the OS. This is also the screen where NLM applications are loaded.

NLM applications can have zero, one, or multiple screens. These screens display on the same monitor as the console screen. The operating system switches between screens when the following happens:

NOTE:Keystrokes are accepted only on the displayed screen. An NLM that is waiting for input does not receive it until the user switches to its screen and enters the needed keystrokes.

This section describes the following features of NetWare console screens.

3.3.1 Screen Types

NetWare 5.x and 6.x servers have the following types of screens.

System Console Screen. Server console commands are entered at the command line of the System Console Screen. This screen is always present. On NetWare 5.x servers, NLM applications can write to this screen or to an application screen. On NetWare 6.x servers, NLM applications cannot write to this screen; they can write to the System Logger Screen or to their application-owned screen.

System Logger Screen. This screen is only present on NetWare 6.x servers. This screen logs all system messages as well as the output from NLM applications that write to the system console. NLM applications cannot get characters from this screen's keyboard because the screen accepts only a few commands related to scrolling and other such activities.

Debug Screen. The Debug Screen is accessed from within an assembly or C program or through a special key sequence. This screen is hidden unless the server is at a breakpoint.

Router Screen. This screen displays whenever the TRACK ON console command is executed.

Application Screens. An NLM can have zero or more application screens that are regular or pop-up. Pop-up screens, used to present instructional or error messages, are overlaid on regular screens. In some cases, an NLM might not require a screen (a library NLM, for example). An NLM might also write to the System Console Screen (NetWare 5.x), System Logger Screen (NetWare 6.x), or to the screen of another NLM (if the other NLM cooperates).

On NetWare 5.x and 6.x servers, NLM applications can receive input only from an application-owned screen.

3.3.2 Designating an Application Screen

The SCREENNAME directive is used to specify the application screen for an NLM. It is the screen that is wired to the standard consoles (stdin, stderr, and stdout) and is automatically created or assigned when the NLM is loaded.

You have the following link options.

  • Link without SCREENNAME or with SCREENNAME set to "System Console". The application can use the standard consoles, stdout and stderr, for output to either the System Console (NetWare 5.x) or the System Logger (NetWare 6.x). The application has no access to any keyboard input from stdin.

      Example: SCREENNAME "System Console"
      
  • Link with SCREENNAME set to "none". The application has no access to a screen for output or to a keyboard for input. However, the application can use OpenScreen to create an application-defined screen, but stdin, stdout, and stderr cannot be wired to this screen. The application must use the NetWare operating system screen functions for input and output to this screen.

      Example: SCREENNAME "none"
      
  • Link with SCREENNAME set to a valid string. The application has access to an application-owned screen for input and output and this screen is wired to the standard consoles (stdin, stderr, and stdout). If you add "scrollable" to the end of the name, LibC creates a scrollable screen. Scrollable screens on NetWare consume a lot of memory, so create one only if the scrollbars are needed.

      Example: SCREENNAME "My Screen"
      
  • Link with SCREENNAME set to a valid string and [scrollable]. The application has access to an application-owned screen for input and output and this screen is wired to the standard consoles (stdin, stderr, and stdout). The "scrollable" directive cause LibC to create a scrollable screen. Scrollable screens on NetWare consume a lot of memory, so create one only if the scrollbars are needed.

      Example: SCREENNAME "My Screen [scrollable]"
      

All the threads of an application share the same application screen.

If you don't use the SCREENNAME directive set to have a screen automatically created for you, you can create an application screen with NXConsoleOpen and have stdin and stdout wired to the console you open.

3.3.3 Creating Additional Screens

You can only assign one application screen at startup. However, if your application needs additional screens, you can use the OpenScreen function to create them. Screens that are created with OpenScreen can only be managed with the NetWare screen functions (see NetWare OS Screen Functions).

3.3.4 Performing Screen I/O

In LibC, some screen functions implicitly specify a target screen and some functions explicitly specify the screen:

  • When a screen is implicitly specified, the target screen is the application screen the NLM started with. All threads in a virtual machine have the same application screen.

  • When a screen is explicitly specified, the target screen can be a system screen (console or logger), the application screen, or an application-created screen.

Keyboard Input. For each screen, only one thread can wait on keyboard input from a given screen at a time. Any other thread that attempts input is blocked until the keyboard is free. You can use the following functions to retrieve unformatted keyboard input.

Type

Functions

Description

ANSI

getchar gets

Retrieves the current character or string from stdin.

ANSI-like

cgetc cgets

Retrieves the current character or string from the stdin screen. These functions cannot be redirected from the screen, even if stdin is redirected.

LibC

getkey getcharacter getstring

Retrieves the current key, character, or string from stdin.

pressanykey pressescape pressenter

Issues a prompt and then blocks until the right type of key is pressed.

NetWare OS

GetKey

PauseWithEscape

Retrieves the current key from the specified screen.

Blocks until the Escape key is retrieved.

You can use the following functions to retrieve formatted input from a screen.

Type

Functions

Description

ANSI

scanf vscanf

Retrieves the string from stdin, formatting it with either format control strings or argument lists.

ANSI-like

cscanf vcscanf

Retrieves the string from the stdin screen. The input is formatted with either format control strings or argument lists.

These functions cannot be redirected from the screen, even if stdin is redirected.

LibC

getkey getcharacter getstring

Retrieves the current key, character, or string from stdin (the application screen).

Screen Output. Any number of threads can do output to a single screen at a time. All output functions usually complete their output before an output function called from another thread is allowed to write to the screen. The exception to this is a single call to a Stream I/O function (such as printf) that causes more data to be output to the screen than can fit in a Streams buffer (the default buffer size is 512 bytes). This means that, in general, output from multiple threads is not scrambled together.

You can use the following functions to send unformatted output to the screen.

Type

Functions

Description

ANSI

putchar puts

Sends the current character or string to stdout.

ANSI-like

cputc cputs

Sends the current character or string to the stdout screen. These functions cannot be redirected from the screen, even if stdout is redirected.

LibC

putkey putcharacter putstring

Sends the current key, character, or string to stdout (the application screen).

NetWare OS

WriteScreenCharacter WriteScreenCharacterAttribute

Sends the current character to the specified screen.

You can use the following functions to send formatted output to the screen:

Type

Functions

Description

ANSI

printf vprintf

Prints the string to stdout, formatted with format control strings or argument lists.

ANSI-like

cprintf vcprintf

Sends the current string to the stdout screen. The output is formatted with either format control strings or argument lists.

These functions cannot be redirected from the screen, even if stdout is redirected

LibC

consoleprintf

Prints the string to stdout, formatted with a format control string.

NetWare OS

OutputToScreen OutputToScreenWithAttribute

Sends the formatted output to the specified screen.

3.3.5 Destroying Screens

All of the NLM screens (except the System Console or the System Logger) are destroyed when the NLM terminates. An NLM can call CloseScreen to dispose of an application-defined screen at any time. However, you should not use CloseScreen on the application screen that is automatically created as a result of specifying SCREENNAME to the linker. This screen is destroyed when the NLM terminates.

3.3.6 Screen Interfaces

LibC has four interfaces for managing console screens: