scr_init Subroutine
Purpose
Initializes the curses data structures from a dump file.
Library
Curses Library (libcurses.a)
Syntax
#include <curses.h>
char *Filename;
Description
The scr_init subroutine initializes the curses data structures from a dump file. You create dump files with the scr_dump subroutine. If the file's data is valid, the next screen update is based on the contents of the file rather than clearing the screen and starting from scratch. The data is invalid if the terminfo database boolean capability nrrmc is TRUE or the contents of the terminal differ from the contents of the dump file.
You can call the scr_init subroutine after the initscr subroutine to update the screen with the dump file contents. Using the keypad, meta, slk_clear, curs_set, flash, and beep subroutines do not affect the contents of the screen, but cause the terminal's modification time to change.
You can allow more than one process to share screen dumps. Both processes must be run from the same terminal. The scr_init subroutine first ensures that the process that created the dump is in sync with the current terminal data. If the modification time of the terminal is not the same as that specified in the dump file, the scr_init subroutine assumes that the screen image on the terminal has changed from that in the file, and the file's data is invalid.
If you are allowing two processes to share a screen dump, it is important to understand that one process starts up another process. The following activities happen:
- The second process creates the dump file with the scr_init subroutine.
- The second process exits without causing the terminal's time stamp to change by calling the endwin subroutine followed by the scr_dump subroutine, and then the exit subroutine.
- Control is passed back to the first process.
- The first process calls the scr_init subroutine to update the screen contents with the dump file data.
Return Values
Item | Description |
---|---|
ERR | Indicates the dump file's time stamp is old or the boolean capability nrrmc is TRUE. |
OK | Indicates that the curses data structures were successfully initialized using the contents of the dump file. |
Parameters
Item | Description |
---|---|
Filename | Points to a dump file. |