home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!olivea!sgigate!odin!fido!fudge.asd.sgi.com!karlton
- From: karlton@fudge.asd.sgi.com (Phil Karlton)
- Newsgroups: comp.sys.sgi
- Subject: Re: DISPLAY environment variable
- Message-ID: <peqdpb8@fido.asd.sgi.com>
- Date: 5 Sep 92 01:27:14 GMT
- References: <32359@adm.brl.mil>
- Sender: news@fido.asd.sgi.com (Usenet News Admin)
- Reply-To: karlton@sgi.com
- Organization: Silicon Graphics, ASD
- Lines: 55
-
- In article <32359@adm.brl.mil>, sgi.com!pdi!shoshana@BRL.MIL (Shoshana Abrass) writes:
- Being new to X, I have a basic question:
-
- Actually, lots of folks have trouble with this.
-
- How do you propagate your DISPLAY variable so that you can display
- on your local screen even through multiple levels of rlogin?
- I've noticed that if you're sitting at host A and you rlogin
- to B, the REMOTEHOST variable (sgi only, I know) is set correctly
- and your DISPLAY is host A. But if you then rlogin to host C
- from B, the REMOTEHOST variable is B not A and the DISPLAY is :0.
-
- Here is what I do. I bury the DISPLAY environment variable into $TERM
- while logging in and then break it back apart on the remote machine. (The
- rlogin protocol just doesn't have room for more environment variables.
- Check the BUGS section of the rlogin man page.)
-
- Details:
-
- In my .login I have (among other things)
-
- if ($?TERM) then
- if ( $TERM =~ *@* ) then
- eval `echo $TERM | sed 's/\(.*\)@\(.*\)/setenv DISPLAY \2; set term=\1/'`
- endif
- endif
- if ($?DISPLAY == 0 && $?REMOTEHOST) then
- setenv DISPLAY ${REMOTEHOST}:0
- endif
-
- In /usr/local/bin/xrlogin I have the script
-
- #!/bin/csh -f
-
- if ($?DISPLAY) then
- switch ( $DISPLAY )
- case "":
- setenv DISPLAY :0
- case ":*":
- case "unix:*":
- case "localhost:*":
- setenv HOSTNAME `/usr/bsd/hostname`
- setenv YPDOMAIN `echo $HOSTNAME | sed -e 's/[^.]*\.\(.*\)/\1/'`
- if ( "$YPDOMAIN" == "$HOSTNAME" ) then
- # hostname doesn't contain domain
- setenv HOSTNAME ${HOSTNAME}.`/usr/bin/domainname`
- endif
- setenv TERM $term@${HOSTNAME}:`expr $DISPLAY : ".*:\(.*\)"`
- breaksw
- default
- setenv TERM $term@$DISPLAY
- endsw
- endif
-
- exec /usr/bsd/rlogin $*
-