[fa.info-mac] ^S/^Q in Emacs over rlogin

info-mac@uw-beaver (info-mac) (09/14/84)

From: sun!l5!gnu@Berkeley (John Gilmore)
I don't know why this discussion is in info-mac but here is the "real"
answer.  The problem is that ^S and ^Q are locally processed rather
than processed by the remote end of an rlogin.  The remote end of the
rlogin tells the local end whether to process flow control locally,
or to pass things transparently.  It relies on the "packet" facility of
the pseudo-tty driver to do this.  The bug is in the pty driver; it's
supposed to tell the "master" end whenever the "slave" end does an
IOCTL that turns flow control off or on.  It does this correctly for
setting the start and stop characters to things other then ^S/^Q, but
when you go into raw mode it still claims that flow control is in
effect.  We fixed this bug here a long time ago but it probably never
made it into Berkeley 4.2.  The fix is in sys/tty_pty.c:

480c480,481
< 	{ int stop = (tp->t_stopc == ('s'&037) && tp->t_startc == ('q'&037));
---
> 	{ int stop = ((tp->t_flags & RAW) == 0 &&
> 	    tp->t_stopc == ('s'&037) && tp->t_startc == ('q'&037));
483c484
< 			pti->pt_send &= TIOCPKT_NOSTOP;
---
> 			pti->pt_send &= ~TIOCPKT_NOSTOP;

{Your mileage && line numbers may vary.}

The kludge posted by John Foderaro (jkf@ucbmike.berkeley.arpa) will
also work, if you don't have kernel sources.  It causes Emacs to set
the start and stop characters to -1, which causes the pty driver to
tell the remote rlogin to tell the local rlogin to stop handling flow
control.  Of course, you have to save the old ones, and restore them
later, ...

The REAL trick is to get rlogin to pass 8-bit input for Emacs, so you
can use the Meta key, while still responding to flow control when not
in Emacs [raw mode].  I have a hacked rlogin that switches to raw mode
when flow control is not needed, and it seems to work.  Mail to me if
you want the changes.