Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: dubus@omega.univ-lille1.fr (Georges Dubus)
Subject: Re: Any script for setting the DISPLAY variable?
Date: 7 Oct 1994 15:50:05 GMT	[thread overview]
Message-ID: <373qnd$id@netserver.univ-lille1.fr> (raw)
In-Reply-To: SANAYA.94Oct6094930@calypso.vrl.nmsu.edu

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
-------------------------------------------------------------------------------


  reply	other threads:[~1994-10-07 15:50 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 [this message]
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