/* startchild name: procedure name (either in search path or full path specified) cin: file which will be child's stdin cout: file which will be child's stdout */ #include #include #if SOL || HP #include #include #endif startchild(name,cin,cout) char *name; FILE **cin, **cout; { static int pipeto[2],pipefrom[2]; int i,numfds,childpid; char *args[20]; #if SOL || HP struct rlimit rlp; #endif if (pipe(pipeto) || pipe(pipefrom) <0) { perror("no pipes"); exit(1); } switch(childpid = fork()) { case -1: perror("bad fork"); exit(1); case 0: /* fprintf(stderr,"got here after fork\n"); fprintf(stderr,"%s\n",name); */ dup2(pipeto[0],0); dup2(pipefrom[1],1); #if SOL || HP getrlimit(RLIMIT_NOFILE,&rlp); numfds=rlp.rlim_cur; #else numfds = getdtablesize(); #endif for (i=3; i