Remove bogus timeout code in Receive().
Don't read(fd, buffer, 0) and think ppp has closed the connection when `buffer' is full, instead, flush most of buffer to the terminal and read() for a reasonable length. This fixes "show route" when there's more than 2k of routing output.
This commit is contained in:
parent
9a39d72670
commit
fcabffd883
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32020
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: pppctl.c,v 1.14 1997/12/21 12:11:13 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -99,12 +99,7 @@ Receive(int fd, int display)
|
||||
}
|
||||
len += Result;
|
||||
Buffer[len] = '\0';
|
||||
if (TimedOut) {
|
||||
if (display & REC_VERBOSE)
|
||||
write(1,Buffer,len);
|
||||
Result = -1;
|
||||
break;
|
||||
} else if (len > 2 && !strcmp(Buffer+len-2, "> ")) {
|
||||
if (len > 2 && !strcmp(Buffer+len-2, "> ")) {
|
||||
prompt = strrchr(Buffer, '\n');
|
||||
if (display & (REC_SHOW|REC_VERBOSE)) {
|
||||
if (display & REC_VERBOSE)
|
||||
@ -138,6 +133,17 @@ Receive(int fd, int display)
|
||||
Result = 0;
|
||||
break;
|
||||
}
|
||||
if (len == sizeof Buffer - 1) {
|
||||
int flush;
|
||||
if ((last = strrchr(Buffer, '\n')) == NULL)
|
||||
/* Yeuch - this is one mother of a line ! */
|
||||
flush = sizeof Buffer / 2;
|
||||
else
|
||||
flush = last - Buffer + 1;
|
||||
write(1, Buffer, flush);
|
||||
strcpy(Buffer, Buffer + flush);
|
||||
len -= flush;
|
||||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
|
Loading…
Reference in New Issue
Block a user