home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / sgi / 13325 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  2.1 KB

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!olivea!sgigate!odin!fido!fudge.asd.sgi.com!karlton
  2. From: karlton@fudge.asd.sgi.com (Phil Karlton)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: DISPLAY environment variable
  5. Message-ID: <peqdpb8@fido.asd.sgi.com>
  6. Date: 5 Sep 92 01:27:14 GMT
  7. References: <32359@adm.brl.mil>
  8. Sender: news@fido.asd.sgi.com (Usenet News Admin)
  9. Reply-To: karlton@sgi.com
  10. Organization: Silicon Graphics, ASD
  11. Lines: 55
  12.  
  13. In article <32359@adm.brl.mil>, sgi.com!pdi!shoshana@BRL.MIL (Shoshana Abrass) writes:
  14.       Being new to X, I have a basic question:
  15.  
  16. Actually, lots of folks have trouble with this.
  17.     
  18.       How do you propagate your DISPLAY variable so that you can display 
  19.       on your local screen even through multiple levels of rlogin? 
  20.       I've noticed that if you're sitting at host A and you rlogin 
  21.       to B, the REMOTEHOST variable (sgi only, I know) is set correctly 
  22.       and your DISPLAY is host A. But if you then rlogin to host C 
  23.       from B, the REMOTEHOST variable is B not A and the DISPLAY is :0.
  24.     
  25. Here is what I do. I bury the DISPLAY environment variable into $TERM
  26. while logging in and then break it back apart on the remote machine. (The
  27. rlogin protocol just doesn't have room for more environment variables.
  28. Check the BUGS section of the rlogin man page.)
  29.  
  30. Details:
  31.  
  32. In my .login I have (among other things)
  33.  
  34. if ($?TERM) then
  35.   if ( $TERM =~ *@* ) then
  36.     eval `echo $TERM | sed 's/\(.*\)@\(.*\)/setenv DISPLAY \2; set term=\1/'`
  37.   endif
  38. endif
  39. if ($?DISPLAY == 0 && $?REMOTEHOST) then
  40.     setenv DISPLAY ${REMOTEHOST}:0
  41. endif
  42.  
  43. In /usr/local/bin/xrlogin I have the script
  44.  
  45. #!/bin/csh -f
  46.  
  47. if ($?DISPLAY) then
  48.     switch ( $DISPLAY )
  49.       case "":
  50.     setenv DISPLAY :0
  51.       case ":*":
  52.       case "unix:*":
  53.       case "localhost:*":
  54.     setenv HOSTNAME `/usr/bsd/hostname`
  55.     setenv YPDOMAIN `echo $HOSTNAME | sed -e 's/[^.]*\.\(.*\)/\1/'`
  56.     if ( "$YPDOMAIN" == "$HOSTNAME" ) then
  57.         # hostname doesn't contain domain
  58.         setenv HOSTNAME ${HOSTNAME}.`/usr/bin/domainname`
  59.     endif
  60.      setenv TERM $term@${HOSTNAME}:`expr $DISPLAY : ".*:\(.*\)"`
  61.      breaksw
  62.     default
  63.      setenv TERM $term@$DISPLAY
  64.     endsw
  65. endif
  66.  
  67. exec /usr/bsd/rlogin $*
  68.