Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: mkl@rob.cs.tu-bs.de (Mario Klebsch DG1AM)
Subject: Re: Any script for setting the DISPLAY variable?
Date: 6 Oct 1994 13:30:15 GMT	[thread overview]
Message-ID: <370u57$8a9@ra.ibr.cs.tu-bs.de> (raw)
In-Reply-To: 35s3f6$4es@bigdog.fred.net

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


  parent reply	other threads:[~1994-10-06 13:30 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
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 [this message]
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