From 1f30871bcbac9178ed6453a2331ef744363ce4fe Mon Sep 17 00:00:00 2001 From: Thomas Osterried Date: Sat, 24 Jan 2009 21:47:00 +0000 Subject: revised linemode --- call/call.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'call/call.c') diff --git a/call/call.c b/call/call.c index a098562..a735628 100644 --- a/call/call.c +++ b/call/call.c @@ -1583,18 +1583,12 @@ int cmd_call(char *call[], int mode) break; } if (FD_ISSET(fd, &sock_read)) { - static int last_line_was_cr = 1; - int this_line_has_cr = 0; - char buf2[MAX_BUFLEN]; - int buf2_len = 0L; - int i; /* bytes = read(fd, buf, 511); */ bytes = read(fd, buf, sizeof(buf)); if (bytes == 0) { /* read EOF on stdin */ /* cause program to terminate */ flags &= ~FLAG_RECONNECT; - last_line_was_cr = 1; break; } if (bytes == -1) { @@ -1610,35 +1604,16 @@ int cmd_call(char *call[], int mode) ab_down(mode, swin, &wintab, buf, &bytes, &gp); if (bytes == 0) { - last_line_was_cr = 1; continue; } } - -next_read_line_from_fd: - this_line_has_cr = 0; - for (i = 1; i <= bytes; i++) { - if (buf[i-1] == '\r') { - if ((buf2_len = bytes-i) > 0) { - memcpy(buf2, buf+i, buf2_len); - bytes = i; - } - this_line_has_cr = 1; - break; - } - } do { /* imagine one line ("bar go_7+") was split into * two packets: 1. "...foo\nbar" 2. " go_7+. ..." * then searche_key_words misinterprets " go_7+. " * as start of a line. */ - if (last_line_was_cr && this_line_has_cr) { - com_num = searche_key_words(buf, &bytes, parms, &parmsbytes, restbuf, &restbytes); - } else { - com_num = -1; - } - last_line_was_cr = this_line_has_cr; + com_num = searche_key_words(buf, &bytes, parms, &parmsbytes, restbuf, &restbytes); if (bytes != 0) { convert_cr_lf(buf, bytes); if (!sevenplus) { @@ -1748,13 +1723,6 @@ next_read_line_from_fd: bytes = restbytes; } while (restbytes != 0); - if (buf2_len > 0) { - memcpy(buf, buf2, buf2_len); - bytes = buf2_len; - buf2_len = 0; - goto next_read_line_from_fd; - } - } if (FD_ISSET(STDIN_FILENO, &sock_read)) { if ((mode & RAWMODE) == RAWMODE) { -- cgit v1.2.3