Xref: utzoo comp.emacs:3269 comp.unix.wizards:7923 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hc!beta!unm-la!unmvax!turing.UNM.EDU!mike From: mike@turing.UNM.EDU (Michael I. Bushnell) Newsgroups: comp.emacs,comp.unix.wizards Subject: Re: Intercepting system messages (Was Re: talk and talkd) Message-ID: <976@unmvax.unm.edu> Date: 21 Apr 88 00:46:20 GMT References: <233@jim.odr.oz> <969@unmvax.unm.edu> <10397@sunybcs.UUCP> Sender: news@unmvax.unm.edu Reply-To: mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque Lines: 56 Keywords: talk talkd 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@turing.unm.edu Albuquerque, NM 87131 {ucbvax,gatech}!unmvax!turing.unm.edu!mike