The dynamic screen utility, or dscreen command, is a utility that allows a single physical terminal to be connected to several virtual terminal sessions (screens) at one time. It is mainly intended for use with terminals that have two or more pages of screen memory (for example, the IBM 3151 Models 310 or 410 display with the Cartridge for Expansion). With such terminals, switching between virtual screens also switches between physical terminal screen pages allowing each virtual screen's image to be saved and restored. On terminals without multiple pages of screen memory, dscreen can still be used to switch among virtual screen sessions although the appearance of the screen will not be maintained.
Note: For full support of dscreen, the terminal must be able to switch internal screen pages on command and must remember the cursor position for each page. While dscreen will work on both smart and dumb terminals, screen images are not saved during screen changes on dumb terminals.
The dscreen terminal configuration information file (or dsinfo file) is used to define a different set of keys to be used with dscreen. This might be done, for example, when the originally defined dscreen keys conflict with a software application in use on the system.
The dsinfo file terminal type assumes a single page of screen memory therefore, if a terminal supports additional pages of screen memory the dsinfo file must be customized to use the appropriate sequence for page memory control. Consult the appropriate terminal reference guide for the specific control sequence.
The default dsinfo file is /usr/lbin/tty/dsinfo. Use the -i flag to specify a different dsinfo file. This remainder of this section will refer to the default file. However, the same information applies to any customized dsinfo file you create.
For more information concerning the dsinfo file, refer to "Dynamic Screen Assignment".
When dscreen is run, it starts a virtual screen. Some of the keys on the terminal keyboard will not be passed through to the virtual screen; instead, dscreen will intercept these keys and perform certain actions when they are pressed. The actions include:
Select | Selects a specified screen |
Block | Blocks all input and output. |
New | Starts a new screen session. |
End | Ends dscreen. |
Quit | Quits dscreen. |
Previous | Switches to previous screen. |
List | Lists the dscreen assigned keys and their actions. |
The function of each key is dependent on the terminal and the terminal description in the /usr/lbin/tty/dsinfo file.
When a new virtual screen is created, it is assigned a select key. Pressing the select key causes the following actions:
Once all of the select keys defined in the dsinfo file have virtual screens assigned to them, no more screens may be created. Individual screen sessions end when the original shell process exits. This frees the associated select key for use with another virtual screen. The dscreen utility is ended when there are no more active screens.
Block keys are used to stop output in a fashion similar to Ctrl-S key when using IXON flow control. The purpose of these keys is to allow for transparently setting up terminal sessions on two computers using a terminal that has two serial ports.
Pressing a new screen key creates a new logical screen and assigns it to one of the select keys. Each new screen requires:
If any of these are not available, the new screen operation will fail with a message indicating the reason for the failure.
Pressing an end key will cause the following to occur:
Pressing a quit key will perform the same actions but will exit with status of 1.
Pressing a previous key will switch the terminal to the screen that was last displayed.
Notes:
- Do not switch screens when the current screen is being written to; an escape sequence may be truncated and leave the terminal in an unknown state.
- Some terminal displays may save the cursor position for individual screens but may not save other states such as insert mode, inverse video, etc. If this is the case, users should avoid these modes while switching screens.
Pressing a list key will display a list of keys and their actions on the terminal display. Only those keys recognized by dscreen will be shown. When a new screen is created using dscreen, the message Press KEY for help , where KEY is the name of the list key displayed on the terminal. Note that the message is displayed only if there is a list key defined.
The terminal description entry in the /usr/lbin/tty/dsinfo file will have the same number of screen selection keys as the terminal has physical screen pages. If more screen selection keys are defined than the number of physical screen pages, dscreen will dynamically assign physical screen pages to virtual screens.
When a virtual screen is selected that does not have an associated page of screen memory, dscreen assigns the least recently used physical screen to the virtual screen. Depending on the specifications maintained in the /usr/lbin/tty/dsinfo description file, an indication that the physical screen is connected to a different virtual screen may be noticeable; for example, the screen is cleared.
The dsinfo file is a database of terminal descriptions used by the dscreen multiple screen utility. The file contains the following information:
The terminal type entries in the default dsinfo file resemble the following 3151 ASCII terminal values:
# The Cartridge for Expansion (pn: 64F9314) needed for this entry ibm3151|3151|IBM 3151, dsks=\E!a^M|Shift-F1|, # Selects first screen dsks=\E!b^M|Shift-F2|, # Selects second screen dsks=\E!c^M|Shift-F3|, # Selects third screen dsks=\E!d^M|Shift-F4|, # Selects fourth screen dskc=\E!e^M|Shift-F5|, # Creates a new screen dske=\E!f^M|Shift-F6|\E pA\EH\EJ, # Go to screen 1 and end dskl=\E!g^M|Shift-F7|, # Lists function keys (help) dskp=\E!h^M|Shift-F8|, # Go to previous screen dskq=\E!i^M|Shift-F9|\E pA\EH\EJ, # Go to screen 1 and quit dsp=\E pA|\EH\EJ, # Terminal sequence for screen 1 dsp=\E pB|\EH\EJ, # Terminal sequence for screen 2 dsp=\E pC|\EH\EJ, # Terminal sequence for screen 3 dsp=\E pD|\EH\EJ, # Terminal sequence for screen 4 dst=10, # Allow 1 second timeout buffer
Entries in the dsinfo file consist of comma-separated fields. The first field is a list of alternate names for the terminal, each name is separated by a pipe ( | ) character. Any text preceded by a pound (#) character is regarded as a comment and ignored by dscreen. The remaining fields are strings describing the capabilities of the terminal to the dscreen utility. Within these strings, the following escape codes are recognized:
Escape Sequence | Description |
\E,\e | escape character |
\n,\l | newline (or linefeed) character |
\r | carriage return |
\t | tab character |
\b | backspace character |
\f | formfeed character |
\s | space character |
\nnn | character with octal value nnn |
^x | Ctrl-x for any appropriate x value |
Any other character preceded by a backslash will yield the character itself. The strings are entered as type=string, where type is the type of string as listed below, and string is the string value.
It is important that the entry fields in the dsinfo file be separated by commas. If a comma is omitted or truncated from the end of a dsinfo file entry, the file will become unreadable by the dscreen utility and an error will be returned to the display.
The string types are as follows:
The following example /usr/lbin/tty/dsinfo entry is for a Wyse-60 with three screen sessions:
wy60|wyse60|wyse model 60, dsks=^A`^M|Shift-F1|, dsks=^Aa^M|Shift-F2|, dsks=^Ab^M|Shift-F3|, dskc=\200|Ctrl-F1|, dske=\201|Ctrl-F2|\Ew0\E+, dskl=\202|Ctrl-F3|, dsp=\Ew0|\E+, dsp=\Ew1|\E+, dsp=\Ew2|\E+,
Each time a physical screen is used for a new screen, the sequence Esc + will be sent to the terminal, which will clear the screen.
This example is for a Wyse-60 with three screen sessions, but one of the screens is on a second computer communicating through the second serial port on the terminal:
wy60-1|wyse60-1|wyse model 60 - first serial port dsks=^A`^M|Shift-F1|, dsks=^Aa^M|Shift-F2|, dsks=^Ab^M|Shift-F3|\Ed#^Ab\r^T\Ee9, dskc=\200|Ctrl-F1|, dske=\201|Ctrl-F2|\Ed#\201^T\Ew0\E+, dskl=\202|Ctrl-F3|, dsp=\Ew0|\E+,dsp=\Ew1|\E+, wy60-2|wyse60-2|wyse model 60 - second serial port dsks=^A`^M|Shift-F1|\Ed#^A`\r^T\Ee8, dsks=^Aa^M|Shift-F2|\Ed#^Aa\r^T\Ee8, dsks=^Ab^M|Shift-F3|, dskc=\200|Ctrl-F1|, dske=\201|Ctrl-F2|\Ed#\201^T\Ew0\E+, dskl=\202|Ctrl-F3|, dsp=\Ew2|\E+,
dscreen must be run on both computers, with terminal type wy60-1 on the first computer and terminal type wy60-2 on the second computer (using the -t option to dscreen). The wy60-1 entry will be examined first.
The first two key entries are unchanged from the original wy60 entry. The third key, however, has type dskb, which means block both input and output. When this key is pressed, the sequence:
Esc d # Ctrl-A b CR Ctrl-T Esc e 9
is sent to the terminal; after this output is blocked and dscreen continues scanning input for key sequences but discards all other input.
The sequence Esc d # puts the terminal in transparent print mode, which echoes all characters up to a Ctrl-T out through the other serial port.
The characters Ctrl-A b CR are sent out the other serial port, informing the dscreen process on the other computer that it should activate the window associated with the Shift-F3 key.
The Ctrl-T key sequence exits the transparent print mode. The Esc 9 key sequence causes the terminal to switch to the other AUX serial port for data communications.
At this point, the other computer takes over, sends an Esc w 2 to switch to the third physical screen, and then resumes normal communication.
The wy60-2 entry follows the same general pattern for keys Shift-F1 and Shift-F2:
The end key, Ctrl-F2, works the same for both computers; it sends the end key sequence to the other computer through the transparent print mechanism, switches the terminal to window 0, clears the screen, then exits.