61 |
|
buf[i] = '\0'; |
62 |
|
(*s_put)("\n"); |
63 |
|
} |
64 |
+ |
|
65 |
+ |
|
66 |
+ |
#include "driver.h" |
67 |
+ |
|
68 |
+ |
static char mybuf[512]; |
69 |
+ |
|
70 |
+ |
|
71 |
+ |
char * |
72 |
+ |
getcombuf(d) /* return buffer for my command */ |
73 |
+ |
struct driver *d; |
74 |
+ |
{ |
75 |
+ |
d->inpready++; |
76 |
+ |
return(mybuf+strlen(mybuf)); |
77 |
+ |
} |
78 |
+ |
|
79 |
+ |
|
80 |
+ |
fromcombuf(b, d) /* get command from my buffer */ |
81 |
+ |
char *b; |
82 |
+ |
struct driver *d; |
83 |
+ |
{ |
84 |
+ |
register char *cp; |
85 |
+ |
/* get next command */ |
86 |
+ |
for (cp = mybuf; *cp != '\n'; cp++) |
87 |
+ |
if (!*cp) |
88 |
+ |
return(0); |
89 |
+ |
*cp++ = '\0'; |
90 |
+ |
(*d->comout)(mybuf); /* echo my command */ |
91 |
+ |
(*d->comout)("\n"); |
92 |
+ |
/* send it as reply */ |
93 |
+ |
strcpy(b, mybuf); |
94 |
+ |
d->inpready--; |
95 |
+ |
/* get next command */ |
96 |
+ |
strcpy(mybuf, cp); |
97 |
+ |
return(1); |
98 |
+ |
} |