| 10 |
|
* 10/5/88 |
| 11 |
|
*/ |
| 12 |
|
|
| 13 |
< |
#include <stdio.h> |
| 13 |
> |
#include "standard.h" |
| 14 |
|
|
| 15 |
|
#include <signal.h> |
| 16 |
|
|
| 39 |
|
|
| 40 |
|
struct driver comm_driver, comm_default = { |
| 41 |
|
comm_close, comm_clear, comm_paintr, comm_getcur, |
| 42 |
< |
comm_comout, comm_comin, |
| 43 |
< |
MAXRES, MAXRES, 0 |
| 42 |
> |
comm_comout, comm_comin |
| 43 |
|
}; |
| 44 |
|
|
| 45 |
|
FILE *devin, *devout; |
| 80 |
|
goto syserr; |
| 81 |
|
if ((devin = fdopen(p2[0], "r")) == NULL) |
| 82 |
|
goto syserr; |
| 83 |
< |
bcopy(&comm_default, &comm_driver, sizeof(comm_driver)); |
| 83 |
> |
copystruct(&comm_driver, &comm_default); |
| 84 |
|
/* verify & get resolution */ |
| 85 |
|
putw(COM_SENDM, devout); |
| 86 |
|
fflush(devout); |
| 87 |
|
if (getw(devin) != COM_RECVM) |
| 88 |
|
return(NULL); |
| 89 |
+ |
fread((char *)&comm_driver.pixaspect, |
| 90 |
+ |
sizeof(comm_driver.pixaspect), 1, devin); |
| 91 |
|
comm_driver.xsiz = getw(devin); |
| 92 |
|
comm_driver.ysiz = getw(devin); |
| 93 |
|
/* input handling */ |
| 124 |
|
int xres, yres; |
| 125 |
|
{ |
| 126 |
|
putc(COM_CLEAR, devout); |
| 127 |
< |
fwrite(&xres, sizeof(xres), 1, devout); |
| 128 |
< |
fwrite(&yres, sizeof(yres), 1, devout); |
| 127 |
> |
putw(xres, devout); |
| 128 |
> |
putw(yres, devout); |
| 129 |
|
fflush(devout); |
| 130 |
|
} |
| 131 |
|
|
| 139 |
|
static long lastflush = 0; /* ray count at last flush */ |
| 140 |
|
|
| 141 |
|
putc(COM_PAINTR, devout); |
| 142 |
< |
fwrite(col, sizeof(COLOR), 1, devout); |
| 143 |
< |
fwrite(&xmin, sizeof(xmin), 1, devout); |
| 144 |
< |
fwrite(&ymin, sizeof(ymin), 1, devout); |
| 145 |
< |
fwrite(&xmax, sizeof(xmax), 1, devout); |
| 146 |
< |
fwrite(&ymax, sizeof(ymax), 1, devout); |
| 142 |
> |
fwrite((char *)col, sizeof(COLOR), 1, devout); |
| 143 |
> |
putw(xmin, devout); |
| 144 |
> |
putw(ymin, devout); |
| 145 |
> |
putw(xmax, devout); |
| 146 |
> |
putw(ymax, devout); |
| 147 |
|
if (nrays - lastflush >= WFLUSH) { |
| 148 |
|
fflush(devout); |
| 149 |
|
lastflush = nrays; |
| 162 |
|
if (getc(devin) != COM_GETCUR) |
| 163 |
|
reply_error("getcur"); |
| 164 |
|
c = getc(devin); |
| 165 |
< |
fread(xp, sizeof(*xp), 1, devin); |
| 166 |
< |
fread(yp, sizeof(*yp), 1, devin); |
| 165 |
> |
*xp = getw(devin); |
| 166 |
> |
*yp = getw(devin); |
| 167 |
|
return(c); |
| 168 |
|
} |
| 169 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
static |
| 182 |
< |
comm_comin(buf) /* read string from command line */ |
| 182 |
> |
comm_comin(buf, prompt) /* read string from command line */ |
| 183 |
|
char *buf; |
| 184 |
+ |
char *prompt; |
| 185 |
|
{ |
| 186 |
|
putc(COM_COMIN, devout); |
| 187 |
+ |
if (prompt == NULL) |
| 188 |
+ |
putc(0, devout); |
| 189 |
+ |
else { |
| 190 |
+ |
putc(1, devout); |
| 191 |
+ |
myputs(prompt, devout); |
| 192 |
+ |
} |
| 193 |
|
fflush(devout); |
| 194 |
|
if (getc(devin) != COM_COMIN) |
| 195 |
|
reply_error("comin"); |