Path: utzoo!utgpu!watserv1!watmath!att!rutgers!usc!zaphod.mps.ohio-state.edu!mips!sgi!shinobu!odin!sgihub!dragon!sgi.com!karlton From: karlton@sgi.com (Phil Karlton) Newsgroups: comp.windows.x Subject: Re: rlogin and the DISPLAY variable Message-ID: <1990Oct17.174555.5032@relay.wpd.sgi.com> Date: 17 Oct 90 17:45:55 GMT References: <9010170525.AA09576@Larry.McRCIM.McGill.EDU> Sender: news@relay.wpd.sgi.com ( CNews Account ) Reply-To: karlton@sgi.com Organization: Silicon Graphics, System Software Division Lines: 47 In article <9010170525.AA09576@Larry.McRCIM.McGill.EDU>, mouse@LARRY.MCRCIM.MCGI LL.EDU writes: |> The solution I use is to use xrlogin instead of rlogin, and run |> xrlogind on the remote machine. |> xrlogin and xrlogind are programs I wrote. xrlogin packages $TERM and |> $DISPLAY up into a string, stuffs it into $TERM, and execs rlogin. |> xrlogind recognizes a TERM variable of the special format produced by |> xrlogin and unpacks it into setenv commands (I use a csh-based shell). I do a similar sort of thing, but don't use any extra scripts that have to be passed from machine to machine. I use a "%" character as the separator for the TERM and DISPLAY parts shoved into the TERM environment variable (the only useful one that the rlogin protocol transmits). I alias rlogin to the appropriate value at shell startup time. It does not get re-evaluated each time. There may be more efficient ways to do the parsing, but this does work. Here are some fragments from my .cshrc. ==================================================================== set machine=`/usr/bsd/hostname` set domain=`/usr/bin/domainname` if ($?prompt) then if ( $TERM =~ *\%* ) then setenv DISPLAY `echo $TERM | sed '/^.*%/s///'` set term=`echo $TERM | sed '/%.*$/s///'` endif switch ( $DISPLAY ) case "": case ":0": case ":0.0": case "unix:0": case "unix:0.0": case "localhost:0": case "localhost:0.0": alias rlogin "(setenv TERM $term%${machine}.${domain}:0 ; \ /usr/bsd/rlogin \!* )" breaksw default alias rlogin "(setenv TERM $term%$DISPLAY ; /usr/bsd/rlogin \!* )" endsw endif