--- ray/src/hd/rholo4.c 1999/08/05 13:51:21 3.27 +++ ray/src/hd/rholo4.c 2003/06/27 06:53:22 3.31 @@ -1,15 +1,14 @@ -/* Copyright (c) 1999 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: rholo4.c,v 3.31 2003/06/27 06:53:22 greg Exp $"; #endif - /* * Holodeck display process communication */ #include "rholo.h" #include "rhdisp.h" +#include "rtprocess.h" + #include #ifndef HDSUF @@ -24,7 +23,7 @@ static char SCCSid[] = "$SunId$ SGI"; #endif static int inp_flags; -static int dpd[3]; +static SUBPROC dpd; static FILE *dpout; @@ -35,9 +34,9 @@ char *dname; int i, n, len; if (!strcmp(dname, SLAVENAME)) { - dpd[0] = 0; /* read from stdin */ + dpd.r = 0; /* read from stdin */ dpout = stdout; /* write to stdout */ - dpd[2] = -1; /* we're the slave process */ + dpd.running = 0; /* we're the slave procees */ } else { /* get full display program name */ #ifdef DEVPATH @@ -55,17 +54,17 @@ char *dname; cmd[0] = buf; cmd[1] = froot; cmd[2] = fd1; cmd[3] = fd0; cmd[4] = NULL; - i = open_process(dpd, cmd); + i = open_process(&dpd, cmd); if (i <= 0) error(USER, "cannot start display process"); - if ((dpout = fdopen(dpd[1], "w")) == NULL) + if ((dpout = fdopen(dpd.w, "w")) == NULL) error(SYSTEM, "problem opening display pipe"); /* close dup'ed stdin and stdout */ if (readinp) close(atoi(fd0)); close(atoi(fd1)); } - dpd[1] = -1; /* causes ignored error in close_process() */ + dpd.w = -1; /* causes ignored error in close_process() */ inp_flags = 0; /* check if outside */ if (vdef(OBSTRUCTIONS) && vbool(OBSTRUCTIONS)) @@ -77,7 +76,7 @@ char *dname; } /* write out hologram grids & octrees */ for (i = 0; hdlist[i] != NULL; i++) { - bcopy((char *)hdlist[i], buf, sizeof(HDGRID)); + bcopy((void *)hdlist[i], buf, sizeof(HDGRID)); len = sizeof(HDGRID); n = vdef(GEOMETRY); sfn = i= 0) { dpout = NULL; @@ -135,9 +134,9 @@ int block; buf = (char *)malloc(msg.nbytes); if (buf == NULL) error(SYSTEM, "out of memory in disp_check"); - if (inp_flags != 0 && fcntl(dpd[0], F_SETFL, inp_flags=0) < 0) + if (inp_flags != 0 && fcntl(dpd.r, F_SETFL, inp_flags=0) < 0) goto fcntlerr; - if (readbuf(dpd[0], buf, msg.nbytes) != msg.nbytes) + if (readbuf(dpd.r, buf, msg.nbytes) != msg.nbytes) goto readerr; } switch (msg.type) { /* take appropriate action */ @@ -253,7 +252,8 @@ disp_close() /* close our display process */ disp_result(DS_SHUTDOWN, 0, NULL); fclose(dpout); dpout = NULL; - return(dpd[2]<0 ? 0 : close_process(dpd)); + return(dpd.running ? close_process(&dpd) : 0); + }