Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!BRL.MIL!phil From: phil@BRL.MIL (Phil Dykstra) Newsgroups: comp.windows.x Subject: A "fix" for wall. Message-ID: <8903290045.aa18749@SPARK.BRL.MIL> Date: 29 Mar 89 05:45:56 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 37 Has anyone else out there been traumatized by wall and shutdown messages while running X? On my Sun workstation, whenever a remote shutdown would occur (resulting in an rwall) the shutdown message would show up simultaneously in every X window that I had open. The console window would get two copies, and any rlogins may get a remote copy as well. Every one of these messages had three ^G beeps, etc. The end result was that the workstation would explode for 10 seconds or more util things got back under control. Here's a "fix" in case anyone else was bothered by this. If you look in Sun's /usr/include/utmp.h you find a define for nonuser() used to determine if a pty entry in utmp corresponded to a "real" user or not (i.e. someone who should get a wall message). If the host field is non-zero it assumes an rlogin and writes to that window. SunView doesn't write in the host field for local windows so this works fine there. X puts the display name in that field, and thus get a copy of the message. I put the following special version of nonuser() in the top of wall.c: /* * We define our own version of "nonuser" (in /usr/include/utmp.h) * to exclude non-console X windows. */ #undef nonuser #define nonuser(ut) (((ut).ut_host[0] == 0 \ || strcmp((ut).ut_host, ":0.0") == 0 \ || strcmp((ut).ut_host, "unix:0.0") == 0) && \ strncmp((ut).ut_line, "tty", 3) == 0 && ((ut).ut_line[3] == 'p' \ || (ut).ut_line[3] == 'q' || (ut).ut_line[3] == 'r')) You now only get a single copy of a wall message, and only to the console window. This helps a lot. Sorry, I can't help folks without source code to wall (those folks could resort to "xterm -ut" I suppose). - Phil uunet!brl!phil