Intercepting system messages (Was Re: talk and talkd)
Michael I. Bushnell
mike at turing.UNM.EDU
Thu Apr 21 10:46:20 AEST 1988
Sheesh. Everyone wants a means of intercepting system messages
intended for your terminal, so that emacs can deal with them
nicely. Here is a PAINFUL but workable scheme.
Set up the following:
mas sla
+-------+ +---------+ +---------+ +----------+
| | A | | A | | A | |
| Real |---->| filt |------>| |-------->| |
|login | | | | PTY | | emacs |
| tty |<----| |<------| (login) |<--------| |
| | B | | B | | B | |
+-------+ +---------+ +---------+ +----------+
| ^ ^
| | |
+----------------)------------------+
C |
|C
+---------+
| |
| talkd |
| |
| |
+---------+
The PTY is put in USER IOCTL mode (remember?). That means that
every read on the master side has an extra byte prepended. 0
means it was written normally on the slave side, anything else
is from an ioctl call the slave made. Change emacs to do this
ioctl call before every write to the terminal. Then, filt
watches for this byte. If it's zero, then the write came from a stupid
system process, and is sent to emacs on a pipe. the filt
program is started by emacs, which then changes its tty (to the pty)
and mugs utmp to fool talkd into using the new pty, and then
goes into "ioctl before each write" mode.
Channel A: Your keystrokes
Channel B: Emacs's writes, identified by the ioctl
Channel C: Stupid system program's writes, identified by the lack of ioctl
UGH! But I think it would work....
N u m q u a m G l o r i a D e o
Michael I. Bushnell
HASA - "A" division
14308 Skyline Rd NE Computer Science Dept.
Albuquerque, NM 87123 OR Farris Engineering Ctr.
OR University of New Mexico
mike at turing.unm.edu Albuquerque, NM 87131
{ucbvax,gatech}!unmvax!turing.unm.edu!mike
More information about the Comp.unix.wizards
mailing list