From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103734,674f735b36ac5ffe X-Google-Attributes: gid103734,public X-Google-Thread: fee84,674f735b36ac5ffe X-Google-Attributes: gidfee84,public X-Google-Thread: 1070f0,674f735b36ac5ffe X-Google-Attributes: gid1070f0,public X-Google-ArrivalTime: 1994-10-06 00:18:34 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!haven.umd.edu!ames!newsfeed.gsfc.nasa.gov!news.gsfc.nasa.gov!fish From: fish@daacdev1.stx.com (John Vanderpool) Newsgroups: comp.windows.x,comp.sys.sun.admin,comp.unix.osf.osf1 Subject: Re: Any script for setting the DISPLAY variable? Date: 5 Oct 94 18:05:20 GMT Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Distribution: usa Message-ID: References: <35s3f6$4es@bigdog.fred.net> <36rv4b$fnk@info.epfl.ch> NNTP-Posting-Host: daacdev1.stx.com Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Xref: bga.com comp.windows.x:12267 comp.sys.sun.admin:16937 comp.unix.osf.osf1:3893 monnier@di.epfl.ch (Stefan Monnier) writes: >In article <35s3f6$4es@bigdog.fred.net>, 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 (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