| 372 |
|
|
| 373 |
|
static void |
| 374 |
|
x11_comout( /* output a string to command line */ |
| 375 |
< |
char *outp |
| 375 |
> |
const char *outp |
| 376 |
|
) |
| 377 |
|
{ |
| 378 |
|
if (comline == NULL || outp == NULL || !outp[0]) |
| 399 |
|
char *prompt |
| 400 |
|
) |
| 401 |
|
{ |
| 402 |
+ |
int n, c; |
| 403 |
+ |
|
| 404 |
|
if (prompt != NULL) { |
| 405 |
|
if (fromcombuf(inp, &x11_driver)) |
| 406 |
|
return; |
| 416 |
|
inpcheck = IC_IOCTL; |
| 417 |
|
} |
| 418 |
|
#endif |
| 419 |
< |
if (gets(inp) == NULL) { |
| 419 |
> |
n = 0; /* gets() no longer exists... */ |
| 420 |
> |
while ((c = getchar()) != EOF && c != '\n') |
| 421 |
> |
inp[n++] = c; |
| 422 |
> |
|
| 423 |
> |
if (!n & (c == EOF)) { |
| 424 |
|
strcpy(inp, "quit"); |
| 425 |
|
return; |
| 426 |
|
} |
| 427 |
< |
x11_driver.inpready -= strlen(inp) + 1; |
| 428 |
< |
if (x11_driver.inpready < 0) |
| 429 |
< |
x11_driver.inpready = 0; |
| 427 |
> |
inp[n] = '\0'; |
| 428 |
> |
x11_driver.inpready -= n + 1; |
| 429 |
> |
x11_driver.inpready *= (x11_driver.inpready > 0); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
|
| 433 |
|
static void |
| 434 |
|
std_comout( /* write out string to stdout */ |
| 435 |
< |
char *outp |
| 435 |
> |
const char *outp |
| 436 |
|
) |
| 437 |
|
{ |
| 438 |
|
fputs(outp, stdout); |