* Any script for setting the DISPLAY variable?
@ 1994-09-22 14:13 news
1994-10-03 21:11 ` Ben Taylor
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: news @ 1994-09-22 14:13 UTC (permalink / raw)
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.
thanks
--
B.G. Mahesh | Email: mahesh@evb.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: Ben Taylor @ 1994-10-03 21:11 UTC (permalink / raw)
news@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.
Perhaps what you should do is look at which type of machine you're
on and then do your determination of where you came from.
something like [in /bin/sh, as opposed to csh ]
OS=`uname`
if [ ${OS} = "SunOS" ]; then
case `uname -r` in
4*) blah-blah-blah;;
5*) blah-blah-blah;;
esac
else
# do whatever else you need to figure what system you're on
fi
: thanks
: --
: B.G. Mahesh | Email: mahesh@evb.com
Ben Taylor
Smoke N' Mirrors, Inc.
bent@snm.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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-05 15:49 ` Philip Shearer @ZUO-DC EBS-Team
1994-10-06 13:30 ` Mario Klebsch DG1AM
3 siblings, 2 replies; 15+ messages in thread
From: Stefan Monnier @ 1994-10-04 16:16 UTC (permalink / raw)
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.
Well, GNU who is the same no matter the platform, so you can choose
GNU who instead of the standard one. Or you can choose a clever
extracting function (that works with all the different format used by
the different whos). But of course, the best suggestion I have is to
switch to tcsh-6.05 which has a REMOTE env var which does exactly what
you want !
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)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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 15:49 ` Philip Shearer @ZUO-DC EBS-Team
1994-10-06 15:49 ` Sean J. Anaya
1994-10-06 13:30 ` Mario Klebsch DG1AM
3 siblings, 1 reply; 15+ messages in thread
From: Philip Shearer @ZUO-DC EBS-Team @ 1994-10-05 15:49 UTC (permalink / raw)
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. 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.
:
How about this c source, it works under OSF, (and ultrix if the host
name is under 16 chars long):
----------------------X cut X---------------------------------
#include <stdio.h>
#include <utmp.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#define FILE_NAME "/usr/adm/wtmp"
struct utmp utmp_s;
int main(argc, argv)
int argc;
char *argv[] ;
{
int fd ;
char *tty_name;
char host_name[128] = "" ;
if ( argc != 2 )
{
fprintf(stderr,"usage: %s `tty`\n",argv[0]);
return 1 ;
}
tty_name=argv[1];
if ( (fd=open(FILE_NAME,O_RDONLY )) < 0 )
{
perror("opening:%s",FILE_NAME);
return 1 ;
}
while( read(fd,&utmp_s,sizeof(utmp_s)) == sizeof(utmp_s))
{
if( strlen(utmp_s.ut_line) && strstr(tty_name, utmp_s.ut_line))
strcpy(host_name,utmp_s.ut_host);
}
if(strlen(host_name ))
printf("%s\n",host_name);
else
printf("\n");
close(fd);
return 0 ;
}
----------------------X cut X---------------------------------
--
Regards Philip Shearer
Disclaimer: Please note that the above is a personal view and should
not be construed as an official comment from DEC.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-04 16:16 ` Stefan Monnier
@ 1994-10-05 18:05 ` John Vanderpool
1994-10-06 15:24 ` Yair Friedman
1 sibling, 0 replies; 15+ messages in thread
From: John Vanderpool @ 1994-10-05 18:05 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-09-22 14:13 Any script for setting the DISPLAY variable? news
` (2 preceding siblings ...)
1994-10-05 15:49 ` Philip Shearer @ZUO-DC EBS-Team
@ 1994-10-06 13:30 ` Mario Klebsch DG1AM
1994-10-06 18:37 ` Michael Meissner
1994-10-07 20:38 ` Greg Walker
3 siblings, 2 replies; 15+ messages in thread
From: Mario Klebsch DG1AM @ 1994-10-06 13:30 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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
1 sibling, 1 reply; 15+ messages in thread
From: Yair Friedman @ 1994-10-06 15:24 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4465 bytes --]
>>>>> In article <36rv4b$fnk@info.epfl.ch>, monnier@di.epfl.ch (Stefan Monnier) writes:
SM> 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.
SM> Well, GNU who is the same no matter the platform, so you can choose
SM> GNU who instead of the standard one. Or you can choose a clever
SM> extracting function (that works with all the different format used by
SM> the different whos). But of course, the best suggestion I have is to
SM> switch to tcsh-6.05 which has a REMOTE env var which does exactly what
SM> you want !
SM> Stefan
SM> PS: ultimately, the best solution is to telnet instead of rlogin and
SM> hope the telnets are recent enough to include the "last" extensions:
SM> this allows you to pass any env var to the remote host (as is always
SM> done for TERM). This way, the DISPLAY var is kept correct even if you
SM> log from X to Y to Z (in which case the "who" thing would try to
SM> display on Y)
IMHO The best way is to pass the DISPLAY in an rsh, so you don't need
to keep any in.rlogin tenet processes so you can just open an xterm
Here is what I use
In my Wm I have :
"sun" !"remst sun exec xterm -name sun -display `xdisplay`&"
the xdisplay and remst scripts are givn below:
Yair.
xdisplay:
#!/bin/csh -f
set host = `echo $DISPLAY | sed 's/:.*//'`
set screen = `echo $DISPLAY | sed 's/.*://'`
if ($host == unix | $host == "") then
echo `hostname`\:$screen
else
echo $DISPLAY
endif
remst:
#!/bin/sh
# start up xterm (or any other X command) on the specified host
# Usage: xon host �arguments� �command�
case $# in
0)
echo "Usage: $0 <hostname> �-user user� �-name window-name� �-debug�"
echo "�-screen screen-number� �command ...�"
exit 1
;;
esac
target=$1
shift
label=$target
resource=xterm-$label
rcmd="rsh $target"
case $DISPLAY in
unix:*)
DISPLAY=`echo $DISPLAY | sed 's/unix//'`
;;
esac
case $DISPLAY in
:*)
fullname=`hostname|gawk '{if(index($1, ".")) print $1;else{h=$1;getline<"/etc/resolv.conf";print h "." $2;}}'`
hostname=`echo $fullname | sed 's/\..*$//'`
if � $hostname = $target -o $fullname = $target �; then
DISPLAY=$DISPLAY
rcmd="sh -c"
else
DISPLAY=$fullname$DISPLAY
fi
;;
esac
username=
xauth=
case x$XUSERFILESEARCHPATH in
x)
xpath='HOME=${HOME-`pwd`} '
;;
*)
xpath='HOME=${HOME-`pwd`} XUSERFILESEARCHPATH=${XUSERFILESEARCHPATH-"'"$XUSERFILESEARCHPATH"'"} '
;;
esac
redirect=" < /dev/null > /dev/null 2>&1 &"
command=
ls=-ls
continue=:
while $continue; do
case $1 in
-user)
shift
username="-l $1"
label="$target $1"
rcmd="rsh $target $username"
shift
case x$XAUTHORITY in
x)
XAUTHORITY="$HOME/.Xauthority"
;;
esac
case x$XUSERFILESEARCHPATH in
x)
;;
*)
xpath="XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH "
;;
esac
;;
-access)
shift
xhost +$target
;;
-name)
shift
label="$1"
resource="$1"
shift
;;
-nols)
shift
ls=
;;
-debug)
shift
redirect=
;;
-screen)
shift
DISPLAY=`echo $DISPLAY | sed 's/:\\(�0-9��0-9�*\\)\\.�0-9�/:\1/'`.$1
shift
;;
*)
continue=false
;;
esac
done
case x$XAUTHORITY in
x)
;;
x*)
xauth="XAUTHORITY=$XAUTHORITY "
;;
esac
vars="$xpath$xauth"DISPLAY="$DISPLAY"
case $# in
0)
$rcmd 'sh -c '"'$vars"' xterm '$ls' -name "'"$resource"'" -T "'"$label"'" -n "'"$label"'" '"$redirect'"
;;
*)
$rcmd 'sh -c '"'$vars"' '"$*$redirect'"
;;
esac
--
----------------------------------------------------------------------------
Yair I. Friedman yair@cs.huji.ac.il yair@HUJICS.BITNET
A human being should be able to change a diaper, plan an invasion, butcher a
hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate,
act alone, solve equations, analyze a new problem, pitch manure, program a
computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects. -- Robert A. Heinlein
----------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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
0 siblings, 1 reply; 15+ messages in thread
From: Sean J. Anaya @ 1994-10-06 15:49 UTC (permalink / raw)
This should work:
#Set the default X server.
#if ($?DISPLAY == 0) then
# if ($?REMOTEHOST) then
# setenv DISPLAY ${REMOTEHOST}:0.0
# else
# setenv DISPLAY :0.0
# endif
#endif
--
******************************************************************************
Sean J. Anaya PO Box 30001-0001, DEPT 3ARP
System Administrator Las Cruces, NM 88003-0001
Visioneering Research Laboratory Tel: (505) 646-8067
E-Mail: sanaya@vrl.nmsu.edu Fax: (505) 646-8071
WWW http://vitoria.nmsu.edu/
"Hope is the thing with feathers
That perches in the soul
And sings the tune--without the words
And never stops at all...."
--Emily Dickinson
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-06 13:30 ` Mario Klebsch DG1AM
@ 1994-10-06 18:37 ` Michael Meissner
1994-10-07 20:38 ` Greg Walker
1 sibling, 0 replies; 15+ messages in thread
From: Michael Meissner @ 1994-10-06 18:37 UTC (permalink / raw)
In article <370u57$8a9@ra.ibr.cs.tu-bs.de> mkl@rob.cs.tu-bs.de (Mario Klebsch DG1AM) writes:
| 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.
If your systems are using a modern version of telnet, telnet will pass the
DISPLAY variable through, modifing :<whatever> to <hostname>:<whatever>.
Note, if you are crossing domain's, most versions of telnet will not fully
qualify the domain name (ie, call gethostbyname after getting the hostname with
gethostname). I fixed this for the OSF/1 1.3 reference source that shipped
this last June. When/if it will show up in DEC's OSF/1, I haven't the
foggiest.
--
Michael Meissner email: meissner@osf.org phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
Old hackers never die, their bugs just increase.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-06 15:49 ` Sean J. Anaya
@ 1994-10-07 15:50 ` Georges Dubus
1994-10-07 16:07 ` Q. Alex Zhao
0 siblings, 1 reply; 15+ messages in thread
From: Georges Dubus @ 1994-10-07 15:50 UTC (permalink / raw)
Sean J. Anaya (sanaya@vrl.nmsu.edu) wrote:
: This should work:
: #Set the default X server.
: #if ($?DISPLAY == 0) then
: # if ($?REMOTEHOST) then
: # setenv DISPLAY ${REMOTEHOST}:0.0
: # else
: # setenv DISPLAY :0.0
: # endif
: #endif
: --
: *****************************************************************************
: Sean J. Anaya PO Box 30001-0001, DEPT 3ARP
: System Administrator Las Cruces, NM 88003-0001
: Visioneering Research Laboratory Tel: (505) 646-8067
: E-Mail: sanaya@vrl.nmsu.edu Fax: (505) 646-8071
: WWW http://vitoria.nmsu.edu/
: "Hope is the thing with feathers
: That perches in the soul
: And sings the tune--without the words
: And never stops at all...."
: --Emily Dickinson
--
On most of Unix systems the command (shell script) named "xon" can be used
for this purpose:
This command is provided with X11 distrib
on DEC OSF/1 --> /usr/bin/X11/xon
#!/bin/sh
#
# *****************************************************************
# * *
# * Copyright (c) Digital Equipment Corporation, 1991, 1994 *
# * *
# * All Rights Reserved. Unpublished rights reserved under *
# * the copyright laws of the United States. *
# * *
# * The software contained on this media is proprietary to *
# * and embodies the confidential technology of Digital *
# * Equipment Corporation. Possession, use, duplication or *
# * dissemination of the software and media is authorized only *
# * pursuant to a valid written license from Digital Equipment *
# * Corporation. *
# * *
# * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
# * by the U.S. Government is subject to restrictions as set *
# * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
# * or in FAR 52.227-19, as applicable. *
# * *
# *****************************************************************
#
# HISTORY
#
# start up xterm (or any other X command) on the specified host
# Usage: xon host [arguments] [command]
case $# in
0)
echo "Usage: $0 <hostname> [-user user] [-name window-name] [-debug]"
echo "[-screen screen-number] [command ...]"
exit 1
;;
esac
target=$1
shift
label=$target
resource=xterm-$label
rcmd="rsh $target"
case $DISPLAY in
unix:*)
DISPLAY=`echo $DISPLAY | sed 's/unix//'`
;;
local:*)
DISPLAY=`echo $DISPLAY | sed 's/local//'`
;;
esac
case $DISPLAY in
:*)
fullname=`hostname`
hostname=`echo $fullname | sed 's/\..*$//'`
if [ $hostname = $target -o $fullname = $target ]; then
DISPLAY=$DISPLAY
rcmd="sh -c"
else
DISPLAY=$fullname$DISPLAY
fi
;;
esac
username=
xauth=
case x$XUSERFILESEARCHPATH in
x)
xpath='HOME=${HOME-`pwd`} '
;;
*)
xpath='HOME=${HOME-`pwd`} XUSERFILESEARCHPATH=${XUSERFILESEARCHPATH-"'"$XUSERFILESEARCHPATH"'"} '
;;
esac
redirect=" < /dev/null > /dev/null 2>&1 &"
command=
ls=-ls
continue=:
while $continue; do
case $1 in
-user)
shift
username="-l $1"
label="$target $1"
rcmd="rsh $target $username"
shift
case x$XAUTHORITY in
x)
XAUTHORITY="$HOME/.Xauthority"
;;
esac
case x$XUSERFILESEARCHPATH in
x)
;;
*)
xpath="XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH "
;;
esac
;;
-access)
shift
xhost +$target
;;
-name)
shift
label="$1"
resource="$1"
shift
;;
-nols)
shift
ls=
;;
-debug)
shift
redirect=
;;
-screen)
shift
DISPLAY=`echo $DISPLAY | sed 's/:\\([0-9][0-9]*\\)\\.[0-9]/:\1/'`.$1
shift
;;
*)
continue=false
;;
esac
done
case x$XAUTHORITY in
x)
;;
x*)
xauth="XAUTHORITY=$XAUTHORITY "
;;
esac
vars="$xpath$xauth"DISPLAY="$DISPLAY"
case $# in
0)
$rcmd 'sh -c '"'$vars"' xterm '$ls' -name "'"$resource"'" -T "'"$label"'" -n "'"$label"'" '"$redirect'"
;;
*)
$rcmd 'sh -c '"'$vars"' '"$*$redirect'"
;;
esac
Hope this help you
------------------------------------------------------------------------------
Georges DUBUS
Centre Interuniversitaire de Traitement de l'Information
Universite des Sciences et Technologies de LILLE
Domaine Universitaire Scientifique
Batiment M4
59655 Villeneuve d'Ascq cedex
Tel: ++33 20 43 45 55
Fax: ++33 20 43 66 25
Email: Georges.Dubus@univ-lille1.fr
-------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-07 15:50 ` Georges Dubus
@ 1994-10-07 16:07 ` Q. Alex Zhao
0 siblings, 0 replies; 15+ messages in thread
From: Q. Alex Zhao @ 1994-10-07 16:07 UTC (permalink / raw)
Sean J. Anaya (sanaya@vrl.nmsu.edu) wrote:
] This should work:
] #Set the default X server.
] #if ($?DISPLAY == 0) then
] # if ($?REMOTEHOST) then
] # setenv DISPLAY ${REMOTEHOST}:0.0
] # else
] # setenv DISPLAY :0.0
] # endif
] #endif
The above approach will work on SGI IRIX and Solaris 2.x etc.
machines, but not on Solaris 1.
In article <373qnd$id@netserver.univ-lille1.fr>, dubus@omega.univ-lille1.fr (Georges Dubus) writes:
] On most of Unix systems the command (shell script) named "xon" can be used
] for this purpose:
] This command is provided with X11 distrib
"xon" will NOT work if the "hostname" command on your machine doesn't
give the full host name (such as that on SunOS 4.1.3), and the remote
host which you are trying to connect is outside your domain or doesn't
recognize the host name unless it's a full name... And "xon" has only
one way of dealing with auth, which is not to deal with it -- turn
"xhost" on.
"xrsh" (could be found on "ftp.x.org") provides a lot of options
besides correctly setting up the $DISPLAY variable and passing auth
keys.
--
= Q. Alex Zhao ~{0"UT~} ! Graphics, Visualization & Usability Center
Email: azhao@cc.gatech.edu ! College of Computing
FAX: 404-853-9378 ! Georgia Institute of Technology
Lab: 404-894-9636 ! Atlanta, Georgia 30332-0280
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
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
1 sibling, 1 reply; 15+ messages in thread
From: Greg Walker @ 1994-10-07 20:38 UTC (permalink / raw)
In article <370u57$8a9@ra.ibr.cs.tu-bs.de>,
Mario Klebsch DG1AM <mkl@rob.cs.tu-bs.de> wrote:
>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.
And just how would it do this? X clients can only find out the
address of the server they are to query by examining the DISPLAY
variable. It seems to me that you propose a circular solution.
Besides, there are many xrsh scripts out there that are extremely
portable and can be installed on all your systems. Then it's just
a simple "xrsh hostname xterm". Look for it with archie.
--
_ gwa1@bluecross.on.ca | "But there's one thing I must say
_| |_ Greg Walker | Before they lock me up again:
|_ _| Technical Specialist | `You'd be safer at the back!'"
|_| Ontario Blue Cross | -Thomas Dolby, "Hyperactive"
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-06 15:24 ` Yair Friedman
@ 1994-10-08 14:07 ` Stefan Monnier
0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 1994-10-08 14:07 UTC (permalink / raw)
In article <YAIR.94Oct6172421@mangal.cs.huji.ac.il>,
Yair Friedman <yair@cs.huji.ac.il> wrote:
> IMHO The best way is to pass the DISPLAY in an rsh, so you don't need
> to keep any in.rlogin tenet processes so you can just open an xterm
Well, I personnally prefer running a telnet session in a local xterm
than a remote xterm. This way, the communication cost is a bit
smaller, and all the xterms are run on the same machine.
Of course, it does have shortcomings...
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-07 20:38 ` Greg Walker
@ 1994-10-10 16:33 ` Mario Klebsch DG1AM
1994-10-13 14:07 ` Greg Walker
0 siblings, 1 reply; 15+ messages in thread
From: Mario Klebsch DG1AM @ 1994-10-10 16:33 UTC (permalink / raw)
Hello!
gwa1@bluecross.on.ca (Greg Walker) writes:
>In article <370u57$8a9@ra.ibr.cs.tu-bs.de>,
>Mario Klebsch DG1AM <mkl@rob.cs.tu-bs.de> wrote:
>>
>>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.
>And just how would it do this? X clients can only find out the
>address of the server they are to query by examining the DISPLAY
>variable. It seems to me that you propose a circular solution.
There are lots of programs out there to figure out, what TERM you are
using, by sending a query string and processing the answer. I use
termset (found on ftp.tu-bs.de). There could be a feature in xterm, to
query a correct, canonified DISPLAY name from xterm. The termset can
query the DISPLAY after recognising, it is dealing with xterm.
>Besides, there are many xrsh scripts out there that are extremely
>portable and can be installed on all your systems. Then it's just
>a simple "xrsh hostname xterm". Look for it with archie.
I prefer to run xterm on my local host with -e rlogin remotehost as
option. This should result in less network traffic. And since all
xterms are running on my local host, they should share their code and
startup time should be less.
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Any script for setting the DISPLAY variable?
1994-10-10 16:33 ` Mario Klebsch DG1AM
@ 1994-10-13 14:07 ` Greg Walker
0 siblings, 0 replies; 15+ messages in thread
From: Greg Walker @ 1994-10-13 14:07 UTC (permalink / raw)
In article <37bqd0$7mp@ra.ibr.cs.tu-bs.de>,
Mario Klebsch DG1AM <mkl@rob.cs.tu-bs.de> wrote:
[discussion of xrsh vs. xterm propagating DISPLAY deleted]
>I prefer to run xterm on my local host with -e rlogin remotehost as
>option. This should result in less network traffic. And since all
>xterms are running on my local host, they should share their code and
>startup time should be less.
That's true if you're using a workstation. My environment consists
entirely of Sun and HP servers in the back room with Intel-based PCs
running eXceed (an X server) on the desktops--essentially X terminals.
I prefer to use the remote window manager (olvwm) rather than the
local one provided by Hummingbird, (eXceed's ISV), which is a simple
version of mwm.
In this case, the window manager and all of the X clients run remotely
anyway, so the network traffic issue is moot, (unless somebody can show
me that rlogin uses less traffic/resources than rsh). Thus, I prefer
using James Dempsey's <jdd@bbn.com> xrsh version 5.8, which supports
all the X auth protocols, and also allows me to propogate any environment
variables I like, (e.g. DISPLAY, OPENWINHOME, LD_LIBRARY_PATH, etc.). It
also comes with an xrlogin program for convenience.
To each their own, eh?
--
_ gwa1@bluecross.on.ca | "But there's one thing I must say
_| |_ Greg Walker | Before they lock me up again:
|_ _| Technical Specialist | `You'd be safer at the back!'"
|_| Ontario Blue Cross | -Thomas Dolby, "Hyperactive"
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~1994-10-13 14:07 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox