X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d90f09f3abebfe6f7cfc94a4ceea3c08b2d44649..c9def1b8e8960113ab4fd91d0b69d5b422cf339f:/ldisc.c diff --git a/ldisc.c b/ldisc.c index dda7cc36..819360d4 100644 --- a/ldisc.c +++ b/ldisc.c @@ -9,13 +9,8 @@ */ static void c_write (char *buf, int len) { - while (len--) { - int new_head = (inbuf_head + 1) & INBUF_MASK; - if (new_head != inbuf_reap) { - inbuf[inbuf_head] = *buf++; - inbuf_head = new_head; - } - } + while (len--) + c_write1(*buf++); } static char *term_buf = NULL; @@ -34,8 +29,7 @@ static int plen(unsigned char c) { static void pwrite(unsigned char c) { if ((c >= 32 && c <= 126) || (c >= 160)) { - char cc = (char)c; - c_write(&cc, 1); + c_write1(c); } else if (c < 128) { char cc[2]; cc[1] = (c == 127 ? '?' : c + 0x40); @@ -123,7 +117,8 @@ static void term_send(char *buf, int len) { } break; case CTRL('M'): /* send with newline */ - back->send(term_buf, term_buflen); + if (term_buflen > 0) + back->send(term_buf, term_buflen); if (cfg.protocol == PROT_RAW) back->send("\r\n", 2); else @@ -153,7 +148,8 @@ static void simple_send(char *buf, int len) { term_buflen--; } } - back->send(buf, len); + if (len > 0) + back->send(buf, len); } Ldisc ldisc_term = { term_send };