| 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 |
+ |
#ifdef DEBUG |
| 91 |
+ |
(*d->comout)(mybuf); /* echo my command */ |
| 92 |
+ |
(*d->comout)("\n"); |
| 93 |
+ |
#endif |
| 94 |
+ |
/* send it as reply */ |
| 95 |
+ |
strcpy(b, mybuf); |
| 96 |
+ |
d->inpready--; |
| 97 |
+ |
/* get next command */ |
| 98 |
+ |
strcpy(mybuf, cp); |
| 99 |
+ |
return(1); |
| 100 |
+ |
} |