[comp.windows.news] A tidbit, how to do a rsh from NeWS

hugh@hoptoad.uucp (Hugh Daniel) (12/02/89)

  Here is a piece of NeWS postscript code that I use for starting unix 
processes.  This sets the NEWSSERVER and the DISPLAY varaibles that
NeWS and X programs look at to find the display you are sitting at. 
  This is usefull in that any command (NeWS or X) typed in the terminal
will be able to find the disyplay you are at.

                ||ugh Daniel
hugh@toad.com                   Grasshopper  Group,  +1 415/668-5998
hugh@xanadu.com			1996 Hayes St. San Francisco CA94117


        % I use this for all commands going to unix.  The /dev/null stuff
        % at the end of the csh line frees up both ends of the rsh, thus
        % freeing two processes.
        % Some SystemV's dont set the HOST variable, so we trash it so that
        % your (possibly superuser) X windows dont come up on on the target
        % machine.
        % To do I/O redirection use a subshell ()
        % Beware, your command is interped by the local shell first...
        % I need a better sh/ksh line.
        % Replaceing rsh with something better is a great need.
        % Example: (/usr/NeWS/bin/gterm)(localhost) rshcommand
/rshcommand  {  %  command'string host'string => -
        (HOST)(*nO=bLuDy+host|thanks!att$$) ?getenv
        (%:0) sprintf exch (NEWSSERVER) getenv exch
        % csh users...
        (/usr/ucb/rsh -n % 'setenv NEWSSERVER "%"; setenv DISPLAY %; exec' % '>\& /dev/null < /dev/null')
        % sh users... This leaves a in.rsh arround.
        %(/usr/ucb/rsh -n % 'NEWSSERVER="%" DISPLAY=%' exec % )
        sprintf forkunix
} def

/termwindowto { % host'string ->
        (/usr/NeWS/bin/gterm -bg -ls -t psterm-fast) exch rshcommand
} def