X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/68a49acbf3f96fbbbc385620655dcb577e62c328..56e5b2db28757ed9b09f15c66e5b13eae241d4e6:/telnet.c diff --git a/telnet.c b/telnet.c index 18c7d0e4..7e612cf6 100644 --- a/telnet.c +++ b/telnet.c @@ -226,9 +226,14 @@ static void c_write1(Telnet telnet, int c) static void log_option(Telnet telnet, char *sender, int cmd, int option) { char buf[50]; + /* + * The strange-looking "" below is there to avoid a + * trigraph - a double question mark followed by > maps to a + * closing brace character! + */ sprintf(buf, "%s:\t%s %s", sender, (cmd == WILL ? "WILL" : cmd == WONT ? "WONT" : - cmd == DO ? "DO" : cmd == DONT ? "DONT" : ""), + cmd == DO ? "DO" : cmd == DONT ? "DONT" : ""), telopt(option)); logevent(telnet->frontend, buf); } @@ -737,7 +742,7 @@ static int telnet_send(void *handle, char *buf, int len) while (p < buf + len) { char *q = p; - while (iswritable((unsigned char) *p) && p < buf + len) + while (p < buf + len && iswritable((unsigned char) *p)) p++; telnet->bufsize = sk_write(telnet->s, q, p - q);