[comp.windows.news] Launching remote X applications

rdong@MSRI.ORG (Rui - Tao Dong) (06/25/91)

In article <1991Jun24.161957.648@ohmeda.com> paulo@ohmeda.com (Paul Ourada) writes:
>Hi again.  I'd like to thank everyone for their suggestions and tips wrt 
>launching remote X applications.  It seems, that my problem was specifically
>the LD_LIBRARY_PATH environment variable.  I will cover the entire procedure
>below for those other newcomers like myself.
>
>setenv OPENWINHOME /usr/openwin
>setenv FONTPATH $OPENWINHOME/lib/fonts
>setenv HELPPATH $OPENWINHOME/lib/help
>setenv LD_LIBRARY_PATH $OPENWINHOME/lib:/usr/lib
>setenv MANPATH $OPENWINHOME/share/man:/usr/man
>
>when you rlogin or rsh, set the DISPLAY env var thusly:
>
>setenv DISPLAY "you host name":0.0
>
>Scott Brim <swb@MITCHELL.CIT.CORNELL.EDU> gave me the following script which he calls rx:
>
>---------------------------------
>#!/bin/sh -
>
>host=$1 ; shift
>
>case $DISPLAY in
>:0|:0.0|unix:0|unix:0.0) xhost $host >/dev/null ; DISPLAY=`hostname`:0
>esac
>
>rsh -n $host "sh -c 'DISPLAY=$DISPLAY $@ >/dev/null 2>&1&'"
>
>----------------------------------
>
>I haven't tried it yet, so I can't tell you if it works, but Scott seems like a 
>nice guy...:-)  He says that his officemate has a more complicated one.
>
>
>Again, thanks to all that have replied.  It has been an uplifting experience.
>
>Paul E. Ourada
>Software Engineer
>Ohmeda Monitoring Systems
>paulo@ohmeda.com
>
>


	I wrote a shellscript, which I call xrlogin. It will set DISPLAY
for plain X and NEWSSERVER as well for xnews. You need to put the following
on top of your .login.

-------------------------------------------------

set switch=($term)

switch($#switch)
	case 3:
		setenv NEWSSERVER $switch[3]
	case 2:
		setenv DISPLAY $switch[2]
	default:	
		setenv TERM $switch[1]
endsw
unset switch

setenv OPENWINHOME /usr/openwin

if ( $?NEWSSERVER == 1 ) then

	setenv LD_LIBRARY_PATH $OPENWINHOME/lib:/usr/lib
	setenv PATH .:$HOME/bin:/usr/local/bin:/usr/ucb:$OPENWINHOME/bin:$OPENWINHOME/bin/xview:$OPENWINHOME/demo:/usr/bin/X11:/usr/bin:/bin
	setenv MANPATH $OPENWINHOME/man:/usr/local/man:/usr/man
	eval `svenv -env -csh`
else

	setenv PATH .:$HOME/bin:/usr/local/bin:/usr/ucb:/usr/bin/X11:/usr/bin:/bin:$OPENWINHOME/bin:$OPENWINHOME/bin/xview:$OPENWINHOME/demo
	setenv MANPATH /usr/local/man:/usr/man:$OPENWINHOME/man

endif

-------------------------------------------------

	The following is the script for xrlogin.
-------------------------------------------------
#!/bin/sh

case "X$DISPLAY" in
Xunix:*)
  : ${HOSTNAME=`hostname`}
  DISPLAY=`echo "$DISPLAY" | sed -e "s/^unix:/${HOSTNAME}:/"`
  ;;
X:*)
  : ${HOSTNAME=`hostname`}
  DISPLAY="$HOSTNAME$DISPLAY"
  ;;
esac

TERM=${TERM}${DISPLAY:+" $DISPLAY"}${NEWSSERVER:+" $NEWSSERVER"}; export TERM

exec rlogin "$@"

--------------------------------------------------------------

	Hope this helps.

Regards,

-------------------------------------------------------------------------
	Rui - Tao  Dong         |       (415) 237 - 7628 (H)
	Math Sci Research Inst	|       (415) 643 - 6048 (O)
	1000 Centennial Drive	|       (415) 643 - 5348 (Fax)
	Berkeley, CA 94720	|	rdong@borel.msri.org

rdong@borel.msri.org (Rui - Tao Dong) (06/25/91)

In article <1991Jun24.161957.648@ohmeda.com> paulo@ohmeda.com (Paul Ourada) writes:
>Hi again.  I'd like to thank everyone for their suggestions and tips wrt 
>launching remote X applications.  It seems, that my problem was specifically
>the LD_LIBRARY_PATH environment variable.  I will cover the entire procedure
>below for those other newcomers like myself.
>
>setenv OPENWINHOME /usr/openwin
>setenv FONTPATH $OPENWINHOME/lib/fonts
>setenv HELPPATH $OPENWINHOME/lib/help
>setenv LD_LIBRARY_PATH $OPENWINHOME/lib:/usr/lib
>setenv MANPATH $OPENWINHOME/share/man:/usr/man
>
>when you rlogin or rsh, set the DISPLAY env var thusly:
>
>setenv DISPLAY "you host name":0.0
>
>Scott Brim <swb@MITCHELL.CIT.CORNELL.EDU> gave me the following script which he calls rx:
>
>---------------------------------
>#!/bin/sh -
>
>host=$1 ; shift
>
>case $DISPLAY in
>:0|:0.0|unix:0|unix:0.0) xhost $host >/dev/null ; DISPLAY=`hostname`:0
>esac
>
>rsh -n $host "sh -c 'DISPLAY=$DISPLAY $@ >/dev/null 2>&1&'"
>
>----------------------------------
>
>I haven't tried it yet, so I can't tell you if it works, but Scott seems like a 
>nice guy...:-)  He says that his officemate has a more complicated one.
>
>
>Again, thanks to all that have replied.  It has been an uplifting experience.
>
>Paul E. Ourada
>Software Engineer
>Ohmeda Monitoring Systems
>paulo@ohmeda.com
>
>


	I wrote a shellscript, which I call xrlogin. It will set DISPLAY
for plain X and NEWSSERVER as well for xnews. You need to put the following
on top of your .login.

-------------------------------------------------

set switch=($term)

switch($#switch)
	case 3:
		setenv NEWSSERVER $switch[3]
	case 2:
		setenv DISPLAY $switch[2]
	default:	
		setenv TERM $switch[1]
endsw
unset switch

setenv OPENWINHOME /usr/openwin

if ( $?NEWSSERVER == 1 ) then

	setenv LD_LIBRARY_PATH $OPENWINHOME/lib:/usr/lib
	setenv PATH .:$HOME/bin:/usr/local/bin:/usr/ucb:$OPENWINHOME/bin:$OPENWINHOME/bin/xview:$OPENWINHOME/demo:/usr/bin/X11:/usr/bin:/bin
	setenv MANPATH $OPENWINHOME/man:/usr/local/man:/usr/man
	eval `svenv -env -csh`
else

	setenv PATH .:$HOME/bin:/usr/local/bin:/usr/ucb:/usr/bin/X11:/usr/bin:/bin:$OPENWINHOME/bin:$OPENWINHOME/bin/xview:$OPENWINHOME/demo
	setenv MANPATH /usr/local/man:/usr/man:$OPENWINHOME/man

endif

-------------------------------------------------

	The following is the script for xrlogin.
-------------------------------------------------
#!/bin/sh

case "X$DISPLAY" in
Xunix:*)
  : ${HOSTNAME=`hostname`}
  DISPLAY=`echo "$DISPLAY" | sed -e "s/^unix:/${HOSTNAME}:/"`
  ;;
X:*)
  : ${HOSTNAME=`hostname`}
  DISPLAY="$HOSTNAME$DISPLAY"
  ;;
esac

TERM=${TERM}${DISPLAY:+" $DISPLAY"}${NEWSSERVER:+" $NEWSSERVER"}; export TERM

exec rlogin "$@"

--------------------------------------------------------------

	Hope this helps.

Regards,

-------------------------------------------------------------------------
	Rui - Tao  Dong         |       (415) 237 - 7628 (H)
	Math Sci Research Inst	|       (415) 643 - 6048 (O)
	1000 Centennial Drive	|       (415) 643 - 5348 (Fax)
	Berkeley, CA 94720	|	rdong@borel.msri.org




--

Regards,

-------------------------------------------------------------------------