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: 1070f0,674f735b36ac5ffe X-Google-Attributes: gid1070f0,public X-Google-Thread: fee84,674f735b36ac5ffe X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-10-06 20:07:49 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.dell.com!tadpole.com!uunet!zib-berlin.de!gs.dfn.de!tubsibr!mkl From: mkl@rob.cs.tu-bs.de (Mario Klebsch DG1AM) Newsgroups: comp.windows.x,comp.sys.sun.admin,comp.unix.osf.osf1 Subject: Re: Any script for setting the DISPLAY variable? Date: 6 Oct 1994 13:30:15 GMT Organization: TU Braunschweig, Informatik (Bueltenweg), Germany Distribution: usa Message-ID: <370u57$8a9@ra.ibr.cs.tu-bs.de> References: <35s3f6$4es@bigdog.fred.net> NNTP-Posting-Host: whoopi.rob.cs.tu-bs.de Xref: bga.com comp.windows.x:12308 comp.sys.sun.admin:17002 comp.unix.osf.osf1:3913 Hello! news@bigdog.fred.net writes: >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. It does not lead to a correct DISPLAY variable when you just figure out, from which host you logged in. The IMHO most easy way would be, if xterm had a query for the DISPLAY. But it does not. So option number two is to pass DISPLAY trough rlogin. This can be done by the following scripts. Someone told me, to pass the XAUTHORITY cookies as well, but I don't need it, because I share my home directory on all systems. ---- xlogin #!/bin/sh # # Aufruf wie "rlogin". # # Remote einloggen unter X-Windows: Die DISPLAY-Variable wird # huckepack in der TERM-Variablen mituebergeben. In der ".profile"- # oder ".login"-Datei der Shell, die auf dem entfernten Rechner # gestartet wird, muss die DISPLAY-Variable dann aus der # TERM-Variablen extrahiert werden, und die TERM-Variable muss von # ihrem Rucksack wieder befreit werden. Templates fuer die # entsprechenden Shellscripts sind ebenfalls vorhanden. # PATH=/bin:/usr/ucb for parameter in $* ;do lastparameter=$parameter ;done case "$DISPLAY" in :*) display=`uname -n`:`echo $DISPLAY|awk -F: "{print \\\$2}"` ;; unix:*) display=`uname -n`:`echo $DISPLAY|awk -F: "{print \\\$2}"` ;; localhost:*) display=`uname -n`:`echo $DISPLAY|awk -F: "{print \\\$2}"` ;; *) display=$DISPLAY ;; esac TERM=${TERM}:$display export TERM exec rlogin $* ---- displayset #!/bin/sh # Gegenstueck zu xlogin: # # Dieses shell-Skript zerfleddert die von xlogin erzeugte TERM variable # wieder zu einer TERM und einder DISPLAY Variablen auseinander. # Der Output von diesem Skript ist eine [-kz(ba)]sh oder csh # Kommandozeile. Fuer die csh Version muss ein Parameter `-csh` ueber- # geben werden. Der Aufruf sieht das folgendermassen aus: # # eval `/usr/local/bin/displayset` # # oder # # eval `/usr/local/bin/displayset -csh` # case $TERM in *:*:*) if [ $# -eq 1 -a "$1" = "-csh" ]; then echo $TERM | awk -F: "{printf \"setenv TERM %s;setenv DISPLAY %s:%s\\n\",\$1,\$2,\$3}" else echo $TERM | awk -F: "{printf \"TERM=%s;DISPLAY=%s:%s;export TERM DISPLAY\\n\",\$1,\$2,\$3}" fi ;; esac ---- I am sorry, the comments are in german, but here is a short introduction: To log into another system, use xlogin. I uses the same parameters as rlogin, they are all passed to rlogin. It tries to create a DISPLAY variable for your display, to be used on the net. This DISPLAY is appended to TERM, which is passed through rlogin. Of course, you can create an alias for this called rlogin or name this script rlogin in /usr/local/bin, but I prefer a different name for it (see Problems:). In your .cshrc or .profile, you ave to add a line like eval `displayset` or eval `displayset -csh` Displayset creates on stdout commands to set TERM and DISPLAY. -csh is used to produce csh syntax. Eval executes thes commands in the current shell. Problems: When doing xlogin to an account, that does not do eval `displayset`, the TERM environment variable is garbage. When TERM contains an ":", you are blown. On BSD systems, you probably will have to replace "uname -n" by "hostname". eval `displayset` has to be executed in your .login or .profile, befor any other modifications to TERM are made. I hope, this helps. Mario -- Mario Klebsch, DG1AM, mkl@rob.cs.tu-bs.de +49 531 / 391 - 7457 Institut fuer Robotik und Prozessinformatik der TU Braunschweig Hamburger Strasse 267, 38114 Braunschweig, Germany