diff options
author | brian <brian@cvs.openbsd.org> | 1997-12-27 13:44:16 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1997-12-27 13:44:16 +0000 |
commit | a572d36d1ef4f38506baacb05686c8e7db9fd534 (patch) | |
tree | f505e6aadeba285ec19d7c5d827d2a43daefa501 /usr.sbin/pppctl | |
parent | 66c3c876f67b3ba9cca0c48f6281209d94bc59d4 (diff) |
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.
Diffstat (limited to 'usr.sbin/pppctl')
-rw-r--r-- | usr.sbin/pppctl/pppctl.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/pppctl/pppctl.c b/usr.sbin/pppctl/pppctl.c index a9f9c2c9272..c1bba75352e 100644 --- a/usr.sbin/pppctl/pppctl.c +++ b/usr.sbin/pppctl/pppctl.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pppctl.c,v 1.5 1997/12/21 14:27:23 brian Exp $ + * $Id: pppctl.c,v 1.6 1997/12/27 13:44:15 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; |