| 1 |
< |
/* Copyright (c) 1987 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 68 |
|
static char mybuf[512]; |
| 69 |
|
|
| 70 |
|
|
| 71 |
< |
char * |
| 72 |
< |
getcombuf(d) /* return buffer for my command */ |
| 73 |
< |
struct driver *d; |
| 71 |
> |
tocombuf(b, d) /* add command(s) to my buffer */ |
| 72 |
> |
register char *b; |
| 73 |
> |
register struct driver *d; |
| 74 |
|
{ |
| 75 |
< |
d->inpready++; |
| 76 |
< |
return(mybuf+strlen(mybuf)); |
| 75 |
> |
register char *cp; |
| 76 |
> |
char *comstart; |
| 77 |
> |
|
| 78 |
> |
for (cp = mybuf; *cp; cp++) |
| 79 |
> |
; |
| 80 |
> |
comstart = cp; |
| 81 |
> |
while (*cp++ = *b) |
| 82 |
> |
if (cp >= mybuf+sizeof(mybuf)) { |
| 83 |
> |
*comstart = '\0'; |
| 84 |
> |
return; /* what should I do about this? */ |
| 85 |
> |
} else if (*b++ == '\n') { |
| 86 |
> |
d->inpready++; |
| 87 |
> |
comstart = cp; |
| 88 |
> |
} |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
|
| 106 |
|
/* send it as reply */ |
| 107 |
|
strcpy(b, mybuf); |
| 108 |
|
d->inpready--; |
| 109 |
< |
/* get next command */ |
| 109 |
> |
/* advance commands */ |
| 110 |
|
strcpy(mybuf, cp); |
| 111 |
|
return(1); |
| 112 |
|
} |