Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!hp4nl!dnlunx!freyr!bjl From: bjl@freyr.pttrnl.nl (Ben Lippolt) Newsgroups: comp.windows.x Subject: Re: Setting up DISPLAY environment variable Message-ID: Date: 11 Jul 90 18:35:05 GMT References: <143@percival.albany.edu> Sender: news@dnlunx.pttrnl.nl Reply-To: BJ_Lippolt@pttrnl.nl Lines: 57 narten@percival.albany.edu (Thomas Narten) writes: >Setting DISPLAY in either .cshrc or .login is asking for trouble. Not always (see below). >First, you only want to set DISPLAY to be the name of where >your X server is running. The best place to set it is in your >.xinitrc file, which is executed only when you start up the X server. This won't work if you use an X-terminal. [example xrsh deleted] Another approach is the following: (this is part of my .cshrc) || #!/bin/csh || # PASS ON the DISPLAY environment variable || # (containing the machine name) in case of rlogin || # but ONLY IF IT HAS BEEN SET ALREADY (by xinit or something alike) || || if ( $TERM =~ xterm%* ) then # XTERM emulator has been started || setenv DISPLAY `echo $TERM | sed '/xterm%/s///'` || set term = xterm || endif || || if ( $TERM == 'xterm' ) then || if ( $?DISPLAY ) then || switch( $DISPLAY ) || case "unix:0": || case "unix:0.0": || case "local:0.0": || alias rlogin "(set term=xterm%`hostname`:0;/usr/ucb/rlogin \!*)" || alias su "(set term = xterm%`hostname`:0; /usr/bin/su \!*)" || breaksw || default: || alias rlogin "(set term=xterm%${DISPLAY}; /usr/ucb/rlogin \!*)" || alias su "(set term=xterm%${DISPLAY}; /usr/bin/su \|*)" || endsw || endif || endif (The trick is that the environment variable $TERM is not altered during a rlogin, so you use it to pass information across rlogins). This has the advantage that you can run it from X-terminals and it also works fine with rlogin. In combination with xrsh it should work in all conceivable situations. >-- >Thomas Narten >narten@cs.albany.edu PS. I didn't invent this. I just copied it from someone else, who copied it from someone else, who copied it ... Ben J. Lippolt --- PTT Research, Dr. Neher Laboratories [ E-mail : BJ_Lippolt@pttrnl.nl ] P.O. Box 421, 2260 AK Leidschendam, [ BITnet : LIPPOLT@HLSDNL5 ] The Netherlands. Tel: +31 70 3325439 [ UUCP : hp4nl!dnlunx!bjl ]