System Administration Guide
Appendix B, Using the system console and non-graphical displays

Advanced mscreen configuration

Advanced mscreen configuration

Many users find mscreen satisfactory as provided. For advanced mscreen users, or anyone interested in learning more about both mscreen and the operating system, here are some ``tuning'' tips for using and extending mscreen. 

In addition to invoking mscreen automatically, the script in Example B-1, ``.login script'' allows three full-featured mscreens on a Wyse 60 and adds a number of convenience features for the mscreen user. Example B-2, ``.profile script'' presents the same material for the Bourne and Korn shell .profile file. These examples are designed to be added to the end of your .login or .profile file, and replace any existing tset material. 

Example B-1 .login script

   # Example material for the end of a C-Shell .login file.
   # If logging in via pseudo-tty, suppress terminal initialization.
   set ttyname=`tty`

# Set init to null, initially. set init = ""

 set noglob

# Reset init to the value "-I" when logging in on a pseudo-tty to # suppress the tset terminal initializations string.

 if ( `expr $ttyname : "/dev/ttyp"` > 0 ) set init = "-I" set term = (`tset -m ansi:ansi -m wy60:wy60 -m:\?wy60 -r -S -Q $init`) setenv TERM $term unset noglob term # Put WYSE 60 in ECON-80 mode during initial log in process. if ( "$init" != "-I" && "$TERM" == "wy60" ) /bin/echo "\033eG\c"

# Set the prompt to indicate the tty number of the current # mscreen and command. set prompt = "`expr $ttyname : '/dev/\(.*\)'` \!% " 

# Release the local variables used. unset ttyname init

# Run mscreen and logout if the 'stop' key (defined as S-F9 in # the default /etc/mscreencap for wy60) is pressed. This string # is described in the mscreen (M) manual pages.  mscreen -n 3 if($status == 0) logout

Example B-2 .profile script

   # Example material for the end of a Bourne shell .profile file.


if [ `expr $ttyname : "/dev/ttyp"` -gt "0" ] ; then init="-I" fi eval `tset -m ansi:ansi -m wy60:wy60 -m :\?wy60 -r -s -Q $init` export PATH

if [ "$init" = "-I" -a "$TERM" = "wy60" ] ; then /bin/echo "\033eG\c" fi

PS1="`expr $ttyname : '/dev/\(.*\)'` $ "

unset ttyname init

mscreen -n 3 if [ "$?" = "0" ] ; then exit fi

Many termcap entries (including wy60) clear the screen buffers (which mscreen uses to store the contents of multiple screens) as part of the initialization string. In Example B-1, ``.login script'' and Example B-2, ``.profile script'', tset(C) sends the initialization string only during the first login procedure. When logging in on pseudo-ttys, tset is invoked with the -I flag. This is done by adding the init variable to the tset line. The first time tset is run, init has a value equal to ``'', adding nothing to the tset command. When it is run subsequently, init has a value of ``-I'', adding the option to tset.

Following the tset command, the string ``\033eG\c'' is echoed during first login procedure. This escape sequence changes the ``COLUMNS'' setting in the Wyse 60 to ECON-80 mode. The combination of these settings frees up just enough screen memory to use three screens. As an extra convenience, the user's prompt is set to display the current slave pseudo-tty number, allowing the user to keep track of which screen is in use. 

If you do not use a Wyse 60 terminal, you can still set your prompt to indicate the current screen, and invoke mscreen automatically while checking for the shell return code, as illustrated in Example B-1, ``.login script'' and Example B-2, ``.profile script''.