[comp.windows.x] Setting display name for X windows server

minich@d.cs.okstate.edu (MINICH ROBERT JOHN) (09/13/90)

Please reply via e-mail to minich@d.cs.okstate.edu

  Someone please relieve some frustrtation and help me get an IBM RT running X
windows to let another machine throw up a window or two. The RT like to put
"unix:0" in the DISPLAY enviornment variable but nothing on the local can find
that. (Not too suprising!) Now, I can't find where/how to tell the RT to use
something like the machine name for DISPLAY. Ideally, it would be
"f.cs.okstate.edu:0" but I can't find any clue in the x manuals from IBM as to
how to do this. (Nor in the Sequent manuals, but I don't think they have x
capability on their console...) 
-- 
|_    /| | Robert Minich            |"If, one day, all arguments were
|\'o.O'  | Oklahoma State University|suddenly resolved, a new topic
|=(___)= | minich@a.cs.okstate.edu  |would soon arise on which to
|   U    | - Ackphtth               |to disagree." "No it wouldn't."

meyer@planck.uucp (Bob Meyer) (09/14/90)

In article <1990Sep12.220114.11571@d.cs.okstate.edu> minich@d.cs.okstate.edu (MINICH ROBERT JOHN) writes:
>Please reply via e-mail to minich@d.cs.okstate.edu
>
>  Someone please relieve some frustrtation and help me get an IBM RT running X
>windows to let another machine throw up a window or two. The RT like to put
>"unix:0" in the DISPLAY enviornment variable but nothing on the local can find
>that. (Not too suprising!) Now, I can't find where/how to tell the RT to use
>something like the machine name for DISPLAY. Ideally, it would be
>"f.cs.okstate.edu:0" but I can't find any clue in the x manuals from IBM as to
>how to do this. (Nor in the Sequent manuals, but I don't think they have x
>capability on their console...) 

The way that I fixed this is to put lines like:

XDISPLAY=$HOST:0
export XDISPLAY

into my '.xinitrc' file before it provokes 'mwm'.  I then put the argument:
'-display $XDISPLAY' into every window manager command that tries to
run a remote application.

The alternative is to use the 'rcmd' shell script that was posted some
time ago.  It seems to realize that 'unix:0' won't cut it for a remote
application.  'rcmd' also performs the 'rsh' in such a way as not to
generate a 'stopped: tty output' message.

I haven't even considered trying to run 'mwm' on an X-terminal because
of this problem.  Imagine a situation where you fire up mwm on the
Xterminal, then start provoking process after process trying to figure
out why they won't run, much to the dismay of the poor guy sitting at
the machine's console :-).

BTW, 'rcmd' also takes care of the 'xhost <remotehost>' for you if you
are running from the console display (or actually, any server that is
running on the machine as opposed to an X-terminal where the server is
actually executing in the terminal).
-- 
   Thinking quickly, the IBM System Jock   # Bob Meyer
uttered an incantation in EBCDIC and made  # Calspan Advanced Tech. Center
the sign of the Terminated Fork.           # meyer%planck.uucp@acsu.buffalo.edu
   The UNIX Guru only smiled and trapped him in a recursive SED script.

sarima@tdatirv.UUCP (Stanley Friesen) (09/20/90)

In article <1990Sep14.033455.11976@planck.uucp> meyer@planck.uucp (Bob Meyer) writes:
>
>The alternative is to use the 'rcmd' shell script that was posted some
>time ago.  It seems to realize that 'unix:0' won't cut it for a remote
>application.  'rcmd' also performs the 'rsh' in such a way as not to
>generate a 'stopped: tty output' message.
>
Hmm, sounds interesting - could it be reposted, or mailed to me.  I seem
to have missed it.
L
I
N
E

C
N
T
-----------------------
uunet!tdatirv!sarima			(Stanley Friesen)

spencer@eecs.umich.edu (Spencer W. Thomas) (09/20/90)

Try this one.  I call it xrsh.  Martin Friedmann did most of the hard
work on it.

---------------- cut here ---------------
#! /bin/sh
#
# Usage:
# 	xrsh [-l user] machine cmd [ args... ]
#
# Runs 'cmd args...' on 'machine' (optionally as 'user').
# If 'machine' is the local host (and -l user is not given), then the
# 'cmd' is run directly, instead of using rsh.
# Tries to make sure no extraneous rsh, rshd, or sh processes are left.
# Runs an 'xhost' first to allow access (rsh-ing it to the DISPLAY
# machine if necessary.
# The 'cmd' must support a -display argument.
#
# Set environment variable XDEBUG to see error messages generated by 'cmd'.

# Parse off rsh initial args
fullclientmach=${1-"noclientspecified"}
if test x$fullclientmach != xnoclientspecified ; then
        shift
fi

while true; do
    case $1 in 
	-l)	lflag="-l $2" ; shift ;;
	*)	break ;;
    esac
    shift
done

# Client program name defaults to xterm
clientprog=${1-"noclientspecified"}
if test x$clientprog != xnoclientspecified ; then
        shift
else
	clientprog = xterm
fi

args=$*

#figure out where we are running now and where the server is running
fullhere=${FULLHOST-`hostname`}
display=${DISPLAY=$fullhere:0}

oldIFS=$IFS
IFS="$oldIFS."
set - $fullhere
here=$1

IFS="$oldIFS:"
set - $display
if test $# = 2 ; then
	displaynum=$2
	fullservermach=$1
else
	displaynum=$1
	fullservermach=$fullhere
        display=$fullhere:$displaynum
fi
IFS=$oldIFS

#Check if $DISPLAY was unix:0 localhost:0 or just :0 
case x$fullservermach in
    xunix | x | xlocalhost)
        display=$fullhere:$displaynum
        fullservermach=$fullhere
    ;;
esac

if test x$fullclientmach = xnoclientspecified ; then
        fullclientmach=$fullservermach
fi

IFS="$OLDifs."
set - $fullclientmach
clientmach=$1
IFS=$oldIFS

debugcsh=${XDEBUG-">& /dev/null &"}
debugsh=${XDEBUG-">/dev/null 2>&1 &"}

# try to run xhost on remote host cuz server is not here
case $fullservermach in
    $fullhere)
	case $fullclientmach in
	    $fullhere) ;;
	    *) eval xhost $fullclientmach $debugsh ;;
	esac
	;;
    *)
        rsh $fullservermach -n \
                "setenv DISPLAY $display ; xhost $fullclientmach"\
		$debugcsh
        sleep 1
	;;
esac

# run the rsh
if test $clientmach != $here -o x"$lflag" != x ; then
	# And start the client
	rsh $fullclientmach -n $lflag "$clientprog -display $display $args $debugcsh"
else
	eval "exec $clientprog -display $DISPLAY $args $debugsh"
fi
---------------- cut here -----------------
--
=Spencer W. Thomas 		EECS Dept, U of Michigan, Ann Arbor, MI 48109
spencer@eecs.umich.edu		313-936-2616 (8-6 E[SD]T M-F)