Mercurial > emacs
comparison src/callproc.c @ 11780:6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 09 May 1995 05:35:45 +0000 |
parents | ff4be652af46 |
children | f442c22815b8 |
comparison
equal
deleted
inserted
replaced
11779:6234b3610a6f | 11780:6ae23eecab6a |
---|---|
495 { | 495 { |
496 register int nread; | 496 register int nread; |
497 int first = 1; | 497 int first = 1; |
498 int total_read = 0; | 498 int total_read = 0; |
499 | 499 |
500 while ((nread = read (fd[0], bufptr, bufsize)) != 0) | 500 while (1) |
501 { | 501 { |
502 if (nread < 0) | 502 /* Repeatedly read until we've filled as much as possible |
503 of the buffer size we have. But don't read | |
504 less than 1024--save that for the next bufferfull. */ | |
505 | |
506 nread = 0; | |
507 while (nread < bufsize - 1024) | |
503 { | 508 { |
504 #if defined (__osf__) && defined (__alpha) | 509 int this_read |
505 continue; /* Work around bug in DEC OSF/1 V3.0. */ | 510 = read (fd[0], bufptr + nread, bufsize - nread); |
506 #else | 511 |
507 break; | 512 if (this_read < 0) |
508 #endif | 513 goto give_up; |
514 | |
515 if (this_read == 0) | |
516 goto give_up_1; | |
517 | |
518 nread += this_read; | |
509 } | 519 } |
520 | |
521 give_up_1: | |
522 | |
523 /* Now NREAD is the total amount of data in the buffer. */ | |
524 if (nread == 0) | |
525 break; | |
526 | |
510 immediate_quit = 0; | 527 immediate_quit = 0; |
511 total_read += nread; | 528 total_read += nread; |
512 | 529 |
513 if (!NILP (buffer)) | 530 if (!NILP (buffer)) |
514 insert (bufptr, nread); | 531 insert (bufptr, nread); |
529 redisplay_preserve_echo_area (); | 546 redisplay_preserve_echo_area (); |
530 } | 547 } |
531 immediate_quit = 1; | 548 immediate_quit = 1; |
532 QUIT; | 549 QUIT; |
533 } | 550 } |
551 give_up: ; | |
534 } | 552 } |
535 | 553 |
536 /* Wait for it to terminate, unless it already has. */ | 554 /* Wait for it to terminate, unless it already has. */ |
537 wait_for_termination (pid); | 555 wait_for_termination (pid); |
538 | 556 |