Path: utzoo!censor!geac!jtsv16!uunet!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!apollo!gaz
From: gaz@apollo.HP.COM (Gary Zaidenweber)
Newsgroups: comp.sys.apollo
Subject: Re: Creating a window on a remote node
Message-ID: <44ed8514.ce45@apollo.HP.COM>
Date: 9 Aug 89 15:43:00 GMT
References: <492@calmasd.Prime.COM>
Distribution: usa
Organization: Apollo Computer, Chelmsford, Mass.
Lines: 122

From article <492@calmasd.Prime.COM>, by sas@calmasd.Prime.COM (Shirley Sloper):
> 
> Messages from long ago....
>> Someone writes:
>>>From: "ANIMAL::THOMPSON" 
>>>Subject: Re: Placing a window on another node.
>>> But. back to the question at hand.
>>> [Great info on how to creat a pad on another node via send_alarm or
>>> crp/crpad]
>>>
>>>John Thompson
>>
>>Either way (send_alarm, crp/crpad, /bin/write, or /bin/wall), you can't
>>  [blah, blah, blah.....]
> 
> 
> Hello,
> 
> Does anyone remember the above discussion? (I'm sorry the references
> aren't there, this is all I can find.) I had just started reading the
> group (June?) and I believe the main discussion may have been concerning
> borrow mode.  I'm not interested in borrow mode,  what I would like is
> the "great info on how to create a pad on another node...", that the
> message refers to.  Can someone inform me how to do this?
> 
> This is the situation I am dealing with: A process on node A starts a
> process (CPS) on node B.  I want the node B process to be able to
> inform node A that it is finishing, (either from a shell script or C
> module).  Most probably, the originating process on A is no longer
> running. What I would like to do is create a window back on node A.
> 
> Thankyou, thankyou, thankyou!
> 
> 
> -- 
> Shirley A. Sloper                                sas@calmasd.prime.com
>                       ******    Calma    ****** 
>                       ** 9805 Scranton Road  ** 
>                       ** San Diego, CA 92121 **

The following module sort of emulates the system() call, creating
a window to run the shell. It runs under sr10.1+ (and maybe 10.0
I just haven't tried and don't expect to). I run in a sysV environment
but I know this works in Aegis and BSD too. I believe that it will
not run under sr9.7 without modifications.:

#include 
#include 
#include 
#include 

void psystem(string)
char    *string;

{
    pad_$window_desc_t  window;
    status_$t           st;
    char                *path;
    ios_$id_t           padin,padout,paderr;

    stream_$id_t        strv[3];
    short               strc = 3;
    pgm_$mode           mode;
    pgm_$proc           phandle;
    int                 j;

#define NARGC   3
    struct arge         nargv[NARGC];
    pgm_$arg_ptr        narg[NARGC];
    short               nargc = NARGC;   	

    name_$pname_t       pstring;
    char                *sh = "/bin/sh";

    window.top = 0;
    window.left = 0;
    window.width = 0;
    window.height = 0;
    path = "";

    pad_$create_window(path,0,pad_$transcript,(short)1,window,&padout,&st);
    if( st.all != status_$ok )
        {
        error_$print(st);
        exit(-1);
        }
    else
        paderr = padout;
    pad_$create(path,0,pad_$input,padout,pad_$bottom,0,(short)20,&padin,&st);
    if( st.all != status_$ok )
        {
        error_$print(st);
        exit(-1);
        }

    (VOID)strcpy(pstring,"sh -c ");
    (VOID)strcat(pstring,string);

    for(j=0;jchars,"sh");
    narg[0]->len = (short)strlen(narg[0]->chars);
    strcpy(narg[1]->chars,"-c");
    narg[1]->len = (short)strlen(narg[1]->chars);
    strcpy(narg[2]->chars,string);
    narg[2]->len = (short)strlen(narg[2]->chars);
    nargc = NARGC;

    strv[ios_$stdin] = padin;
    strv[ios_$stdout] = padout;
    strv[ios_$stderr] = paderr;
    mode = 0;   /* run in "default" mode */

    pgm_$invoke(sh,(short)strlen(sh),nargc,narg,strc,strv,mode,&phandle,&st);
    if( st.all != status_$ok )
        {
        error_$print (st);
        exit(-1);
        }

    exit(0);
}