projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce a sane interface function, from_backend(), for backends to
[u/mdw/putty]
/
ldisc.c
diff --git
a/ldisc.c
b/ldisc.c
index
dda7cc3
..
10576d2
100644
(file)
--- a/
ldisc.c
+++ b/
ldisc.c
@@
-1,4
+1,11
@@
#include <windows.h>
#include <windows.h>
+#ifndef AUTO_WINSOCK
+#ifdef WINSOCK_TWO
+#include <winsock2.h>
+#else
+#include <winsock.h>
+#endif
+#endif
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
@@
-9,13
+16,11
@@
*/
static void c_write (char *buf, int len) {
*/
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;
- }
- }
+ from_backend(0, buf, len);
+}
+
+static void c_write1 (char c) {
+ c_write(&c, 1);
}
static char *term_buf = NULL;
}
static char *term_buf = NULL;
@@
-34,8
+39,7
@@
static int plen(unsigned char c) {
static void pwrite(unsigned char c) {
if ((c >= 32 && c <= 126) ||
(c >= 160)) {
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);
} else if (c < 128) {
char cc[2];
cc[1] = (c == 127 ? '?' : c + 0x40);
@@
-123,7
+127,8
@@
static void term_send(char *buf, int len) {
}
break;
case CTRL('M'): /* send with newline */
}
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
if (cfg.protocol == PROT_RAW)
back->send("\r\n", 2);
else
@@
-153,7
+158,8
@@
static void simple_send(char *buf, int len) {
term_buflen--;
}
}
term_buflen--;
}
}
- back->send(buf, len);
+ if (len > 0)
+ back->send(buf, len);
}
Ldisc ldisc_term = { term_send };
}
Ldisc ldisc_term = { term_send };