SUMMARY: Comments about previouse summary setenv DISPLAY

From: David Harel (hareldv@netvision.net.il)
Date: Tue Jul 23 1996 - 10:32:17 CDT


Hi managers,

quite along time ago I posted a summary about how to setenv DISPLAY
when rsh on the .cshrc file.

in my summary I mentiond the solution I liked best since it looked very
simple and most efficient. It was:

> set RHOST=`last -1 | awk ' { print $3 } '|sed -e "s/\..*//" `
> setenv DISPLAY ${RHOST}:0.0

A few comments I recived and the practice I had caused me to change my
mind.

Aggelos P. Varvitsiotis <avarvit@cc.ece.ntua.gr> made it very clear. He
wrote:

> Beware: if anyone logs in right after you, your DISPLAY will be
> set to point to his originating machine...

I didn't have problems at first but I have noticed that after I
loged in to a remote machine setting env DISPLAY to my original
machine, which was fine, and then someone else have logedin to the
remote machine too he, added an entry to utmpx, and the last -1
returned the new user's record. So the rest of the shells I have opened
got their DISPLAY wrong.

So with a sorrow I had to put a more complex part to the .cshrc file as
I recived from hxktb0@svho1ds_1.supervalu.com (Kris Briscoe)

> This is how I do it for my systems and it works great.
>
> # SESSION_SVR must be checked to see if we are on a xterm. If on an
> # xterm then we don't want to change our display.
>
> if [[ -z $SESSION_SVR ]]
> then
> PORT=$(tty|sed s^/dev/^^)
> REMOTE_SYSTEM=$(who|grep $PORT|awk '{print $6}'|sed
> 's^(^^'|sed 's^)^^')
> # /* If not remote the set display to localhost /*
> if [[ $REMOTE_SYSTEM == "" ]]
> then
> REMOTE_SYSTEM=$HOST
> fi
>
> DISPLAY=$REMOTE_SYSTEM\:0
> fi

Of course it's for bourne shell and should be translated to csh script.

Thanks again for the help

-- 
Harel
---
Hareldv@netvision.net.il

\||/ (`') _____||_____ (_____ _____) | | / \ | /\ | _/ | | \_ /___/ \___\



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:05 CDT