18 |
|
|
19 |
|
static int inp_flags; |
20 |
|
static int dpd[3]; |
21 |
– |
static int pipesiz; |
21 |
|
static FILE *dpout; |
22 |
|
|
23 |
|
|
33 |
|
sprintf(dpath, "dev/%s%s", dname, HDSUF); |
34 |
|
#endif |
35 |
|
com[0] = dpath; com[1] = froot; com[2] = NULL; |
36 |
< |
pipesiz = open_process(dpd, com); |
37 |
< |
if (pipesiz <= 0) |
36 |
> |
i = open_process(dpd, com); |
37 |
> |
if (i <= 0) |
38 |
|
error(USER, "cannot start display process"); |
39 |
|
if ((dpout = fdopen(dup(dpd[1]), "w")) == NULL) |
40 |
|
error(SYSTEM, "cannot associate FILE with display pipe"); |
60 |
|
int n; |
61 |
|
char *buf = NULL; |
62 |
|
|
63 |
< |
if (pipesiz <= 0) |
63 |
> |
if (dpout == NULL) |
64 |
|
return(-1); |
65 |
|
/* flush display output */ |
66 |
|
disp_flush(); |
108 |
|
disp_result(DS_STARTIMM, 0, NULL); |
109 |
|
bundle_set(BS_ADD, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); |
110 |
|
disp_result(DS_ENDIMM, 0, NULL); |
111 |
+ |
disp_check(0); /* hack -- delete usu. follows add */ |
112 |
+ |
break; |
113 |
+ |
case DR_ADJSET: |
114 |
+ |
if (msg.nbytes % sizeof(PACKHEAD)) |
115 |
+ |
error(INTERNAL, "bad DR_ADJSET from display process"); |
116 |
+ |
disp_result(DS_STARTIMM, 0, NULL); |
117 |
+ |
bundle_set(BS_ADJ, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); |
118 |
+ |
disp_result(DS_ENDIMM, 0, NULL); |
119 |
|
disp_flush(); |
120 |
|
break; |
121 |
|
case DR_DELSET: |
133 |
|
if (msg.nbytes) |
134 |
|
error(INTERNAL, "bad DR_SHUTDOWN from display process"); |
135 |
|
return(0); /* zero return signals shutdown */ |
136 |
+ |
case DR_NOOP: |
137 |
+ |
break; |
138 |
|
default: |
139 |
|
error(INTERNAL, "unrecognized request from display process"); |
140 |
|
} |
153 |
|
{ |
154 |
|
int rval; |
155 |
|
|
156 |
< |
if (pipesiz <= 0) |
156 |
> |
if (dpout == NULL) |
157 |
|
return(-1); |
158 |
|
disp_result(DS_SHUTDOWN, 0, NULL); |
159 |
|
fclose(dpout); |
160 |
|
dpout = NULL; |
152 |
– |
pipesiz = 0; |
161 |
|
return(close_process(dpd)); |
162 |
|
} |
163 |
|
|
168 |
|
{ |
169 |
|
MSGHEAD msg; |
170 |
|
|
171 |
+ |
if (dpout == NULL) |
172 |
+ |
return; |
173 |
|
msg.type = type; |
174 |
|
msg.nbytes = nbytes; |
175 |
|
fwrite((char *)&msg, sizeof(MSGHEAD), 1, dpout); |