From: david@dynamix.com (David L Jarvis)
Subject: mscreen patch
Organization:  SOFTWARE / DYNAMIX
Date: Wed, 9 Sep 92 7:23:03 EDT
X-Received: by usenet.pa.dec.com; id AA27294; Wed, 9 Sep 92 06:53:14 -0700
X-Received: by inet-gw-2.pa.dec.com; id AA20408; Wed, 9 Sep 92 06:53:12 -0700
X-Received: from dynamix.UUCP by uu3.psi.com (5.65b/4.0.071791-PSI/PSINet)id AA17947; Wed, 9 Sep 92 09:48:52 -0400
X-Received: by dynamix.com (smail2.5c)id AA12958; 9 Sep 92 07:23:03 EDT (Wed)
X-To: comp.unix.xenix.sco.usenet (comp.unix.xenix.sco)
X-Mailer: ELM [version 2.3 PL11]

Below is a technical writeup for patching the mscreen binary for 2.3.4
It was sent to me by Bela Lubkin of SCO Support.  I worked with Bela when
2.3.4 first came out to isolate this problem, but because I had an easy
workaround (similiar to the one described in the FAQ put out by Chip) I
never followed up with Bela's solution.  Recently I came to realize that I
needed a better way to fix the problem, so I'm posting this technical note
for any others who might be doing something similiar with mscreen.
Briefly, what I do is set up "phantom" users on ports that are to have
mscreens, that do nothing but execute mscreen (ie: a user named ttyi1a on
port ttyi1a, using the AUTO keyword in gettydefs).  This has the effect of
mscreen being active on any port *all the time* (and users not having to
run it themselves).  This way a ttyi1a port looks and feels just like the
console multiscreens (with a bit of other tweaking that is :-) ).
The desire to use "exec mscreen -s -n 3" in the .profile for 
these accounts is what lead me to find a better solution than 
mine and the one in the FAQ.  If anybody would like additional information
about this, please feel free to send me email.

PS:  Chip, how about putting this in the FAQ?  (since it comes direct from
SCO, and not from some magazine :-) )

> =============================================================================
> 
> The display is garbled only when I run mscreen.
> 
> RELEASE:  SCO XENIX 386 Operating System Release 2.3.4
>           SCO UNIX System V/386 Release 3.2 Operating System Version 2.0
> 
> PROBLEM:  mscreen(M) seems to work correctly, but the output of certain
>           applications is somewhat garbled, as if the terminal is losing
>           characters.
> 
> CAUSE:    The mscreen(M) program which is supplied with SCO XENIX 386
>           Operating System Release 2.3.4 and with SCO UNIX System V/386
>           Release 3.2 Operating System Version 2.0 identifies itself as
>           "mscreen rev VIII".  This version of mscreen disables the
>           "ixon" stty(C) setting of the serial port on which it is run.
>           For instance, if you are logged into tty1a and run mscreen,
>           tty1a is now set to "-ixon".  This prevents the terminal from
>           sending XON/XOFF flow control signals to the system.  Many
>           terminals cannot handle full speed input during certain
>           operations (such as clearing the screen).  If they are unable
>           to pause the system, they lose characters.
> 
>           mscreen does turn on the "ixon" setting of the pseudo-ttys
>           that it uses.  This allows the user to pause output, but
>           there is a significant amount of latency.  That is, after
>           hitting <Ctrl>-S, the system may output as much as half a
>           screen before stopping.
> 
>           The version of mscreen that is supplied with SCO XENIX 386
>           Operating System Release 2.3.2 identifies itself as "mscreen
>           rev VII".  It does not turn off "ixon".
> 
>           If "ixon" is enabled on the serial port tty, flow control
>           characters are handled quickly by the serial port driver,
>           allowing the terminal to modulate the flow of information.
>           If it is only enabled on the pseudo-ttys, the terminal can
>           still do this, but the system's response to flow control is
>           slow enough that characters will be lost unless the terminal
>           has a large input buffer.
> 
> SOLUTION: A workaround is to note the name of your serial tty.  After
>           starting mscreen and logging in, turn "ixon" back on for that
>           tty.  In the following example, the user first determines her
>           serial tty name.  She then runs mscreen, logs in, and re-enables 
> 	  "ixon" for the serial tty.
> 
>              $ tty
>              /dev/tty1a
>              $ mscreen -n 2
>              mscreen rev VIII
>              who            is Shift-F7
>              help           is Shift-F8
>              stop           is Shift-F9
>              quit           is Shift-F10
>              ttyp0          is Shift-F1
>              ttyp1          is Shift-F2
> 
>              test!login: jdoe
>              Password:
> 
>              $ stty ixon < /dev/tty1a
> 
>           A more permanent solution is to patch the mscreen(M) program.
>           To do this, take the following steps:
> 
>              1. Make a copy of the program:
> 
>                   # copy -om /usr/bin/mscreen /usr/bin/mscreen.orig
> 
>              2. Apply the patch with /etc/_fst.  There are two patches,
>                 depending on your operating system release:
> 
>                 FOR SCO XENIX 2.3.4:
> 
>                   # /etc/_fst -w /usr/bin/mscreen
>                   * 3f:1233?w 400
>                   0x3f:0x1233:    0x0=    0x400
>                   * $q
> 
>                 FOR SCO UNIX System V Release 3.2 Version 2.0:
> 
>                   # /etc/_fst -w /usr/bin/mscreen
>                   * 17:2327?w 400
>                   0x17:0x2327:    0x0=    0x400
>                   * $q
> 
>              3. If you believe that you have incorrectly applied the
>                 patch, or if the patched version of mscreen does not 
> 		seem to solve the problem, you can replace it with the
>                 original, unpatched version which was saved in step 1:
> 
>                   # copy -om /usr/bin/mscreen.orig /usr/bin/mscreen
> 
> SEE ALSO: mscreen(M), termio(M)
> 

#----------------------------------------------------------------------#
#          David L. Jarvis                 SOFTWARE  /                 #
#          david@dynamix.com                       /  DYNAMIX          #
#----------------------------------------------------------------------#
Xref: sparky comp.unix.xenix.sco:2896 comp.mail.uucp:1789