| 39 |
|
r_getcur, r_comout, r_comin |
| 40 |
|
}; |
| 41 |
|
|
| 42 |
– |
char mybuf[512] = ""; |
| 42 |
|
|
| 44 |
– |
char *mybufp(); |
| 45 |
– |
|
| 46 |
– |
|
| 43 |
|
main(argc, argv) /* set up communications and main loop */ |
| 44 |
|
int argc; |
| 45 |
|
char *argv[]; |
| 64 |
|
putw(COM_RECVM, devout); /* verify initialization */ |
| 65 |
|
putw(dev->xsiz, devout); |
| 66 |
|
putw(dev->ysiz, devout); |
| 67 |
+ |
fwrite(dev->pixaspect, sizeof(dev->pixaspect), 1, devout); |
| 68 |
|
fflush(devout); |
| 69 |
|
/* loop on requests */ |
| 70 |
|
while ((com = getc(devin)) != EOF) { |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
|
| 186 |
– |
r_mycomin() /* get command from my buffer */ |
| 187 |
– |
{ |
| 188 |
– |
register char *cp; |
| 189 |
– |
/* get next command */ |
| 190 |
– |
for (cp = mybuf; *cp != '\n'; cp++) |
| 191 |
– |
; |
| 192 |
– |
*cp++ = '\0'; |
| 193 |
– |
(*dev->comout)(mybuf); /* echo my command */ |
| 194 |
– |
/* send it as reply */ |
| 195 |
– |
putc(COM_COMIN, devout); |
| 196 |
– |
myputs(mybuf, devout); |
| 197 |
– |
fflush(devout); |
| 198 |
– |
/* get next command */ |
| 199 |
– |
(*dev->comout)("\n"); |
| 200 |
– |
strcpy(mybuf, cp); |
| 201 |
– |
if (mybuf[0]) |
| 202 |
– |
kill(getppid(), SIGIO); /* signal more */ |
| 203 |
– |
else |
| 204 |
– |
dev_func[COM_COMIN] = r_comin; /* else reset */ |
| 205 |
– |
} |
| 206 |
– |
|
| 207 |
– |
|
| 183 |
|
stderr_v(s) /* put string to stderr */ |
| 184 |
|
register char *s; |
| 185 |
|
{ |
| 194 |
|
fflush(stderr); |
| 195 |
|
inline = 0; |
| 196 |
|
} |
| 222 |
– |
} |
| 223 |
– |
|
| 224 |
– |
|
| 225 |
– |
char * |
| 226 |
– |
mybufp() /* return buffer for my command */ |
| 227 |
– |
{ |
| 228 |
– |
if (dev_func[COM_COMIN] != r_mycomin) { |
| 229 |
– |
dev_func[COM_COMIN] = r_mycomin; |
| 230 |
– |
kill(getppid(), SIGIO); |
| 231 |
– |
} |
| 232 |
– |
return(mybuf+strlen(mybuf)); |
| 233 |
– |
} |
| 234 |
– |
|
| 235 |
– |
|
| 236 |
– |
repaint(xmin, ymin, xmax, ymax) /* repaint section of display */ |
| 237 |
– |
int xmin, ymin, xmax, ymax; |
| 238 |
– |
{ |
| 239 |
– |
sprintf(mybufp(), "repaint %d %d %d %d\n", |
| 240 |
– |
xmin, ymin, xmax, ymax); |
| 197 |
|
} |