Fix the `SERIOUS NETWORK INTERNAL ERROR' oversight in winnet.c. See
[u/mdw/putty] / unicode.c
index 60dc065..76ffa4c 100644 (file)
--- a/unicode.c
+++ b/unicode.c
@@ -8,10 +8,6 @@
 #include "putty.h"
 #include "misc.h"
 
-void init_ucs_tables(void);
-void lpage_send(int codepage, char *buf, int len);
-void luni_send(wchar_t * widebuf, int len);
-
 static void get_unitab(int codepage, wchar_t * unitab, int ftype);
 
 /* Character conversion arrays; they are usually taken from windows,
@@ -249,8 +245,6 @@ static struct cp_list_item cp_list[] = {
     {"Win1257 (Baltic)", 1257},
     {"Win1258 (Vietnamese)", 1258},
 
-    {"Win1258 (Vietnamese)", 1258},
-
     {"CP437", 437},
     {"CP819", 28591},
     {"CP878", 20866},
@@ -441,14 +435,14 @@ static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr)
     }
 }
 
-void lpage_send(int codepage, char *buf, int len)
+void lpage_send(int codepage, char *buf, int len, int interactive)
 {
     static wchar_t *widebuffer = 0;
     static int widesize = 0;
     int wclen;
 
     if (codepage < 0) {
-       ldisc_send(buf, len);
+       ldisc_send(buf, len, interactive);
        return;
     }
 
@@ -460,10 +454,10 @@ void lpage_send(int codepage, char *buf, int len)
 
     wclen =
        MultiByteToWideChar(codepage, 0, buf, len, widebuffer, widesize);
-    luni_send(widebuffer, wclen);
+    luni_send(widebuffer, wclen, interactive);
 }
 
-void luni_send(wchar_t * widebuf, int len)
+void luni_send(wchar_t * widebuf, int len, int interactive)
 {
     static char *linebuffer = 0;
     static int linesize = 0;
@@ -521,7 +515,7 @@ void luni_send(wchar_t * widebuf, int len)
        }
     }
     if (p > linebuffer)
-       ldisc_send(linebuffer, p - linebuffer);
+       ldisc_send(linebuffer, p - linebuffer, interactive);
 }
 
 wchar_t xlat_uskbd2cyrllic(int ch)
@@ -967,6 +961,8 @@ int decode_codepage(char *cp_name)
                    codepage = cpi->codepage;
                    if (codepage == CP_UTF8)
                        goto break_break;
+                   if (codepage == -1)
+                       return codepage;
                    if (codepage == 0) {
                        codepage = 65536 + (cpi - cp_list);
                        goto break_break;