First phase of porting. pterm now compiles and runs under Linux+gtk.
[u/mdw/putty] / ldisc.c
diff --git a/ldisc.c b/ldisc.c
index 492ad1e..e6a110b 100644 (file)
--- a/ldisc.c
+++ b/ldisc.c
@@ -5,7 +5,6 @@
  * depending on what's currently configured.
  */
 
-#include <windows.h>
 #include <stdio.h>
 #include <ctype.h>
 
@@ -132,6 +131,13 @@ void ldisc_send(char *buf, int len, int interactive)
                    term_buflen--;
                }
                back->special(TS_EL);
+                /*
+                 * We don't send IP, SUSP or ABORT if the user has
+                 * configured telnet specials off! This breaks
+                 * talkers otherwise.
+                 */
+                if (!cfg.telnet_keyboard)
+                    goto default_case;
                if (c == CTRL('C'))
                    back->special(TS_IP);
                if (c == CTRL('Z'))
@@ -193,7 +199,7 @@ void ldisc_send(char *buf, int len, int interactive)
                        back->send(term_buf, term_buflen);
                    if (cfg.protocol == PROT_RAW)
                        back->send("\r\n", 2);
-                   else if (cfg.protocol == PROT_TELNET)
+                   else if (cfg.protocol == PROT_TELNET && cfg.telnet_newline)
                        back->special(TS_EOL);
                    else
                        back->send("\r", 1);
@@ -204,6 +210,7 @@ void ldisc_send(char *buf, int len, int interactive)
                }
                /* FALLTHROUGH */
              default:                 /* get to this label from ^V handler */
+                default_case:
                if (term_buflen >= term_bufsiz) {
                    term_bufsiz = term_buflen + 256;
                    term_buf = saferealloc(term_buf, term_bufsiz);
@@ -229,7 +236,10 @@ void ldisc_send(char *buf, int len, int interactive)
            if (keyflag && cfg.protocol == PROT_TELNET && len == 1) {
                switch (buf[0]) {
                  case CTRL('M'):
-                   back->special(TS_EOL);
+                   if (cfg.protocol == PROT_TELNET && cfg.telnet_newline)
+                       back->special(TS_EOL);
+                   else
+                       back->send("\r", 1);
                    break;
                  case CTRL('?'):
                  case CTRL('H'):