From: fish@daacdev1.stx.com (John Vanderpool)
Subject: Re: Any script for setting the DISPLAY variable?
Date: 5 Oct 94 18:05:20 GMT [thread overview]
Message-ID: <fish.781380320@news.gsfc.nasa.gov> (raw)
In-Reply-To: 36rv4b$fnk@info.epfl.ch
monnier@di.epfl.ch (Stefan Monnier) writes:
>In article <35s3f6$4es@bigdog.fred.net>, <mahesh@evb.com> wrote:
>> I rlogin to HP, DEC Alpha OSF1, Sun systems. I have had
>> some script in .login which would set the DISPLAY variable.
>> But it uses the 'whoami' command to find out from which
>> system I have logged in. Unfortunately the output of
>> whomai is not the same on all these systems. Was wondering
>> if you folks have some script which would set the DISPLAY
>> environment variable correctly on ALL systems.
> Stefan
>PS: ultimately, the best solution is to telnet instead of rlogin and
>hope the telnets are recent enough to include the "last" extensions:
>this allows you to pass any env var to the remote host (as is always
>done for TERM). This way, the DISPLAY var is kept correct even if you
>log from X to Y to Z (in which case the "who" thing would try to
>display on Y)
or try out this:
#!/bin/sh
#
# erlogin - extended rlogin that propogates DISPLAY environment var
#
# 24-mar-1994 jrv add support for console DISPLAYs and {} env var wrappers
# 24-feb-1994 jrv exec rlogin instead of just calling it (frees proc slot)
# 23-feb-1994 jrv add csh (C shell) support
# 15-feb-1994 jrv initial release <John_Vanderpool@gsfc.nasa.gov> (fish)
#
# NOTES:
# telnet does this for you but rlogin needs to adopt the same philosophy
#
# this relies on the simple fact that rlogin does pass the TERM env var
#
# the rlogin protocol gives you a "Terminal type too long" error after
# len($TERM) > ~50 chars, so if you have an extremely long hostname (or
# you use csh) you may have to resort to using IP numbers.
#
# recommended installation directory is /usr/local/bin/erlogin.
#
# you must have the following in any $HOME/.profile (or $HOME/.login for
# csh users) on the rlogin target (remote) host (server/rlogind) side,
# or have your sysadmin install in /etc/profile (or /etc/cshrc [or
# /etc/csh.login on some boxes] for csh).
#
# special setup for [k]sh erlogin (extended rlogin) to pass DISPLAY variable
# echo "${TERM:-}" | grep "DISPLAY=" >/dev/null 2>&1
# if [ $? = 0 ]; then
# eval "${TERM:-}"
# export TERM DISPLAY
# fi
#
# special setup for csh erlogin (extended rlogin) to pass DISPLAY variable
# echo "$TERM" | grep "DISPLAY" >&! /dev/null
# if ($status == 0) eval "$TERM"
## I wanted to extend this to pass any env vars you want but the "Terminal type
## too long" error (see above) blows that, dang!
##ENVLIST="DISPLAY" # list any additional env vars you want to pass
##
##TERM="__ERLOGIN__ TERM=$TERM; export TERM"
##
##for env in $ENVLIST
##do
## NEXT=`eval echo $"$env"`
## TERM="$TERM; $env=$NEXT; export $env"
##done
RDISPLAY=${DISPLAY:-}
case ${DISPLAY:-nodisplay} in # special handling for console
:[0-9]* | unix:[0-9]* | localhost:[0-9]* )
display=`echo ${DISPLAY:-} | cut -f2 -d: | cut -f1 -d.`
screen=`echo ${DISPLAY:-} | cut -f2 -d: | cut -f2 -d.`
if [ "${screen:-}" != "" ]; then screen=".$screen"; fi
RDISPLAY="`hostname`:${display}${screen:-}"
;;
esac
# this ASS-U-MEs $SHELL is set (correctly) and is the same on both sides
if [ "`basename ${SHELL:-}`" = "csh" ]; then
TERM="setenv TERM $TERM;setenv DISPLAY $RDISPLAY"
else # assume ksh, sh, bash style
TERM="TERM=$TERM;DISPLAY=${RDISPLAY:-}"
fi
export TERM
# intent of the following was going to allow the real rlogin to be renamed
# rlogin.real and then have erlogin installed as rlogin; however, rlogin
# apparently checks that argv[0] is "rlogin" - oh well...
##if [ -x `type rlogin.real | cut -f3 -d" "` ]; then
## exec rlogin.real $*
##else
exec rlogin $*
##fi
--
By the time we got to Woodstock, we were half a million strong,
and everywhere there was a song, and a celebration ... -joni mitchell
John R. Vanderpool <fish@daacdev1.stx.com>
next prev parent reply other threads:[~1994-10-05 18:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-22 14:13 Any script for setting the DISPLAY variable? news
1994-10-03 21:11 ` Ben Taylor
1994-10-04 16:16 ` Stefan Monnier
1994-10-05 18:05 ` John Vanderpool [this message]
1994-10-06 15:24 ` Yair Friedman
1994-10-08 14:07 ` Stefan Monnier
1994-10-05 15:49 ` Philip Shearer @ZUO-DC EBS-Team
1994-10-06 15:49 ` Sean J. Anaya
1994-10-07 15:50 ` Georges Dubus
1994-10-07 16:07 ` Q. Alex Zhao
1994-10-06 13:30 ` Mario Klebsch DG1AM
1994-10-06 18:37 ` Michael Meissner
1994-10-07 20:38 ` Greg Walker
1994-10-10 16:33 ` Mario Klebsch DG1AM
1994-10-13 14:07 ` Greg Walker
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox