Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!ge-dab!tardis!barry From: barry@tardis.DAB.GE.COM (Barry Fishman) Newsgroups: comp.windows.x Subject: Re: A "fix" for wall. Summary: Patch to remove host field from utmp entry for local xterms Keywords: X11 xterm wall Message-ID: <1937@ge-dab.GE.COM> Date: 2 Apr 89 02:22:33 GMT References: <8903300011.AA29356@Larry.McRCIM.McGill.EDU> Sender: news@ge-dab.GE.COM Reply-To: barry@tardis.dab.ge.com (Barry Fishman) Organization: GE Simulation & Control Systems Dept., Daytona Beach, FL Lines: 53 Phil Dykstra in <8903290045.aa18749@SPARK.BRL.MIL> noted: > 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. [Followed by a contributed nonuser() macro] Creating a utmp entry with a blank host field seems to work well in our mixed computer environment. Sun console windows still get console messages from wall anyway. However, I did not find a reference to nonuser() in xterm/main.c so I assume a direct patch to main.c is needed. We have been using the following patch based on a previously posted patch to X10R4 (unfortunately I can not find the original) since X11R1. This change can not handle the recent use of ":0.0" style display references or hosts with names beginning with "unix", but I would rather present something that I have been using without problems for a long time, than something put together just before posting. The '(strncmp("unix" ...) != 0)' should probably be replaced with Phil's '(!nonuser())' to give a cleaner solution. *** clients/xterm/main.c- Sat Jan 7 13:37:16 1989 --- clients/xterm/main.c Fri Jan 13 21:11:20 1989 *************** *** 1735,1743 **** sizeof(utmp.ut_line)); (void) strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name)); ! (void) strncpy(utmp.ut_host, XDisplayString (screen->display), sizeof(utmp.ut_host)); time(&utmp.ut_time); lseek(i, (long)(tslot * sizeof(struct utmp)), 0); write(i, (char *)&utmp, sizeof(struct utmp)); --- 1739,1752 ---- sizeof(utmp.ut_line)); (void) strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name)); ! if (strncmp("unix", ! XDisplayString (screen->display), 4) != 0) ! { ! (void) strncpy(utmp.ut_host, XDisplayString (screen->display), sizeof(utmp.ut_host)); + } time(&utmp.ut_time); lseek(i, (long)(tslot * sizeof(struct utmp)), 0); write(i, (char *)&utmp, sizeof(struct utmp));