28 |
|
#define vfork fork |
29 |
|
#endif |
30 |
|
|
31 |
< |
extern char *getpath(), *getenv(); |
32 |
< |
|
33 |
< |
int onsigio(); |
34 |
< |
|
35 |
< |
int comm_close(), comm_clear(), comm_paintr(), comm_errout(), |
31 |
> |
static int comm_close(), comm_clear(), comm_paintr(), comm_errout(), |
32 |
|
comm_getcur(), comm_comout(), comm_comin(), comm_flush(); |
33 |
|
|
34 |
|
struct driver comm_driver = { |
49 |
|
int p1[2], p2[2]; |
50 |
|
char pin[16], pout[16]; |
51 |
|
/* find driver program */ |
52 |
< |
if ((devname = getpath(dname, DEVPATH, 1)) == NULL) { |
52 |
> |
if ((devname = getpath(dname, DEVPATH, X_OK)) == NULL) { |
53 |
|
stderr_v(dname); |
54 |
|
stderr_v(": not found\n"); |
55 |
|
return(NULL); |
80 |
|
if (getw(devin) != COM_RECVM) |
81 |
|
return(NULL); |
82 |
|
/* get driver parameters */ |
83 |
< |
comm_flush(); |
83 |
> |
getstate(); |
84 |
|
/* set error vectors */ |
85 |
|
cmdvec = comm_comout; |
86 |
|
if (wrnvec != NULL) |
139 |
|
fflush(devout); |
140 |
|
if (getc(devin) != COM_FLUSH) |
141 |
|
reply_error("flush"); |
142 |
< |
fread((char *)&comm_driver.pixaspect, |
147 |
< |
sizeof(comm_driver.pixaspect), 1, devin); |
148 |
< |
comm_driver.xsiz = getw(devin); |
149 |
< |
comm_driver.ysiz = getw(devin); |
150 |
< |
comm_driver.inpready = getw(devin); |
142 |
> |
getstate(); |
143 |
|
} |
144 |
|
|
145 |
|
|
166 |
|
{ |
167 |
|
putc(COM_COMOUT, devout); |
168 |
|
myputs(str, devout); |
169 |
+ |
if (str[strlen(str)-1] == '\n') |
170 |
+ |
fflush(devout); |
171 |
|
} |
172 |
|
|
173 |
|
|
187 |
|
if (getc(devin) != COM_COMIN) |
188 |
|
reply_error("comin"); |
189 |
|
mygets(buf, devin); |
190 |
< |
comm_driver.inpready = getw(devin); |
190 |
> |
getstate(); |
191 |
|
} |
192 |
|
|
193 |
|
|
232 |
|
stderr_v(routine); |
233 |
|
stderr_v(": driver reply error\n"); |
234 |
|
quit(1); |
235 |
+ |
} |
236 |
+ |
|
237 |
+ |
|
238 |
+ |
static |
239 |
+ |
getstate() /* get driver state variables */ |
240 |
+ |
{ |
241 |
+ |
fread((char *)&comm_driver.pixaspect, |
242 |
+ |
sizeof(comm_driver.pixaspect), 1, devin); |
243 |
+ |
comm_driver.xsiz = getw(devin); |
244 |
+ |
comm_driver.ysiz = getw(devin); |
245 |
+ |
comm_driver.inpready = getw(devin); |
246 |
|
} |