--- ray/src/hd/rholo4.c 1997/11/10 18:07:15 3.5 +++ ray/src/hd/rholo4.c 1997/12/01 16:35:35 3.10 @@ -18,7 +18,6 @@ static char SCCSid[] = "$SunId$ SGI"; static int inp_flags; static int dpd[3]; -static int pipesiz; static FILE *dpout; @@ -34,8 +33,8 @@ char *dname; sprintf(dpath, "dev/%s%s", dname, HDSUF); #endif com[0] = dpath; com[1] = froot; com[2] = NULL; - pipesiz = open_process(dpd, com); - if (pipesiz <= 0) + i = open_process(dpd, com); + if (i <= 0) error(USER, "cannot start display process"); if ((dpout = fdopen(dup(dpd[1]), "w")) == NULL) error(SYSTEM, "cannot associate FILE with display pipe"); @@ -61,7 +60,7 @@ int block; int n; char *buf = NULL; - if (pipesiz <= 0) + if (dpout == NULL) return(-1); /* flush display output */ disp_flush(); @@ -74,8 +73,10 @@ int block; /* read message header */ n = read(dpd[0], (char *)&msg, sizeof(MSGHEAD)); if (n != sizeof(MSGHEAD)) { - if (n >= 0) + if (n >= 0) { + dpout = NULL; error(USER, "display process died"); + } if (errno != EAGAIN & errno != EINTR) goto readerr; return(2); /* acceptable failure */ @@ -109,6 +110,14 @@ int block; disp_result(DS_STARTIMM, 0, NULL); bundle_set(BS_ADD, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); disp_result(DS_ENDIMM, 0, NULL); + disp_check(0); /* hack -- delete usu. follows add */ + break; + case DR_ADJSET: + if (msg.nbytes % sizeof(PACKHEAD)) + error(INTERNAL, "bad DR_ADJSET from display process"); + disp_result(DS_STARTIMM, 0, NULL); + bundle_set(BS_ADJ, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); + disp_result(DS_ENDIMM, 0, NULL); disp_flush(); break; case DR_DELSET: @@ -126,6 +135,8 @@ int block; if (msg.nbytes) error(INTERNAL, "bad DR_SHUTDOWN from display process"); return(0); /* zero return signals shutdown */ + case DR_NOOP: + break; default: error(INTERNAL, "unrecognized request from display process"); } @@ -144,12 +155,11 @@ disp_close() /* close our display process */ { int rval; - if (pipesiz <= 0) + if (dpout == NULL) return(-1); disp_result(DS_SHUTDOWN, 0, NULL); fclose(dpout); dpout = NULL; - pipesiz = 0; return(close_process(dpd)); } @@ -160,6 +170,8 @@ char *p; { MSGHEAD msg; + if (dpout == NULL) + return; msg.type = type; msg.nbytes = nbytes; fwrite((char *)&msg, sizeof(MSGHEAD), 1, dpout);