Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!dcc1!douglas From: douglas@dcc1.UUCP (Douglas B. Jones) Newsgroups: net.wanted.sources,net.unix,net.unix-wizards Subject: new version of popen(3) Message-ID: <201@dcc1.UUCP> Date: Fri, 4-Apr-86 20:04:41 EST Article-I.D.: dcc1.201 Posted: Fri Apr 4 20:04:41 1986 Date-Received: Sat, 5-Apr-86 13:02:59 EST Distribution: net Organization: DeKalb Community College, Clarkston GA Lines: 79 Xref: watmath net.wanted.sources:2107 net.unix:7544 net.unix-wizards:17463 Hi, In the routine popen(3), a program can open either a read pipe or a write pipe to a sub-process (usually a program, like more). Does any one have a similar routine that will allow a person to have a read/write pipe to a sub-process. The routine might have the following format: FILE *wfp, /* stdin to child */ *rfp, /* stdout from child */ *refp; /* stderr from child */ int p, popen2(); void pclose2(); if ((p = popen2("program",wfp,rfp,refp)) < 0) { fprintf(stderr,"Can't open pipe to program\n"); exit(1); } At this point : p : index so that pclose2() would know which child to close wfp : how I write to the childs' stdin, rfp : the stdout from the child to me, rwfp: the stderr from the chid to me. The pclose2() routine would be called: (void)pclose2(p); /* p being the return from popen2() */ This would be a very helpful program. I imagine it would have to deal with sockets(). What would be really nice, is if two version of this popen2() could be written. One to allow the calling program to work with a child process on the local system, and secondly to allow it (the calling program) to work with a child process on another system (in the local network). Maybe : popen2() for local (with pclose2()) and npopen2() for remote (withe npclose2()). Npopen2() might have a calling format like : /* other vars. stated above */ char *network = "dcc2"; /* name of our other system */ int npopen2(); void npclose2(); if ((p = npopen2("program",wfp,rfp,refp,network)) < 0) { fprintf(stderr,"Can't open net pipe to program\n"); exit(1); } /* do what ever, ie: write UNIX documentation or crash the system */ (void)npclose2(p); Thanks in advance, Douglas p.s.: Apart from sending this to net.wanted.sources, I am also sending this to net.unix and net.unix-wizards to reach a larger group of people. Response might best go to net.sources. I will be happy to handle responses directly and then post them to net.sources. -- ---------------------------------------------------------------------- Douglas Jones TSG, DeKalb College douglas@dcc1 gatech!dcc1!douglas { calls us each hour } akgua!dcc1!douglas { calls us about twice a day } akgua!gatech!dcc1!douglas { akgua and gatech communicate a lot } ----------------------------------------------------------------------