summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2009-01-24 21:47:00 +0000
committerThomas Osterried <thomas@osterried.de>2009-01-24 21:47:00 +0000
commit1f30871bcbac9178ed6453a2331ef744363ce4fe (patch)
tree527dd940bd6277c368c596ec4da31ae6596c11d7
parent2ede1a405f5bf472ba03fe4285fb0b43f5d3c137 (diff)
revised linemode
-rw-r--r--call/call.c34
1 files changed, 1 insertions, 33 deletions
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) {