"bATALOW gRIGORIJ" <[EMAIL PROTECTED]> writes:

>   Hi!
>   How to implement locale settings in dosemu-1.0.2?

There should be no breakage from past versions...
 
>   I have ru_RU.KOI8-R locale. In Xwindows I can view
>  russian text with modified vga.pcf but can't write
>  something. When I switch to russian with Ctrl-Shift
>  there is just no simbols appears.
>   In dosemu-1.0.1 I used program keyrus.com for
>  switching (with other buttons than Ctrl-Shift) but
>  now it doesn't work.

I have other reports that keyrus.com continues to work.

>   Also console seems not to supporting locale.
        >  It doesn't show russian nor allow to put it in.

For $_console = (1) $_graphics=(1) this should work exactly as
with normal dos.

For terminals support was just added in the development version.
dosemu-1.1.2.7 supports this but doesn't have support for koi8-r

The attached file add basic support for displaying russian in terminals.
comment out $_term_char_set
Set 
$_internal_char_set="cp866"
$_external_char_set="koi8-r-safe" (which should work on all terminals)
$_external_char_set="koi8-r" (This gives garbage on some terminals)

diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/ChangeLog dosemu-1.1.2.7.eb2/ChangeLog
--- dosemu-1.1.2.7/ChangeLog    Sun Jan 13 22:20:00 2002
+++ dosemu-1.1.2.7.eb2/ChangeLog        Sun Jan 20 14:51:35 2002
@@ -1,3 +1,13 @@
+2002-01-20  Eric W. Biederman  <[EMAIL PROTECTED]>
+       eb2 
+       - Add cp858 support cp850 + EURO
+       - Add koi8-r support for the russion hackers
+       - Fix comment in keyb_raw.c
+       - keymaps.c Corrected $_layout="auto" rename this to $_layout="kernel"
+       - terminal.c Improve handling of charcter sets that use 0x80 - 0x9f
+       eb1
+       - Fix incorrect initial numlock state with new keyboard code
+
 2002/01/12 ver 1.1.2.7 unofficial pre-release
        From Stas
        - set VIP on pic_request() to activate the int ASAP.
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/extra_charsets/cp858.c 
dosemu-1.1.2.7.eb2/src/plugin/extra_charsets/cp858.c
--- dosemu-1.1.2.7/src/plugin/extra_charsets/cp858.c    Wed Dec 31 17:00:00 1969
+++ dosemu-1.1.2.7.eb2/src/plugin/extra_charsets/cp858.c        Sat Jan 19 17:58:49 
+2002
@@ -0,0 +1,46 @@
+#include "translate.h"
+
+static const t_unicode cp858_c1_chars[] = {
+0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, /* 0x80-0x87 */
+0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, /* 0x88-0x8F */
+0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, /* 0x90-0x97 */
+0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192, /* 0x98-0x9F */
+};
+struct char_set cp858_c1 = {
+       1,
+       CHARS(cp858_c1_chars),
+       0, "", 0, 32,
+};
+
+static const t_unicode cp858_g1_chars[] = {
+0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, /* 0xA0-0xA7 */
+0x00bf, 0x00ae, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, /* 0xA8-0xAF */
+0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00c1, 0x00c2, 0x00c0, /* 0xB0-0xB7 */
+0x00a9, 0x2563, 0x2551, 0x2557, 0x255d, 0x00a2, 0x00a5, 0x2510, /* 0xB8-0xBF */
+0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x00e3, 0x00c3, /* 0xC0-0xC7 */
+0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4, /* 0xC8-0xCF */
+0x00f0, 0x00d0, 0x00ca, 0x00cb, 0x00c8, 0x20AC, 0x00cd, 0x00ce, /* 0xD0-0xD7 */
+0x00cf, 0x2518, 0x250c, 0x2588, 0x2584, 0x00a6, 0x00cc, 0x2580, /* 0xD8-0xDF */
+0x00d3, 0x00df, 0x00d4, 0x00d2, 0x00f5, 0x00d5, 0x00b5, 0x00fe, /* 0xE0-0xE7 */
+0x00de, 0x00da, 0x00db, 0x00d9, 0x00fd, 0x00dd, 0x00af, 0x00b4, /* 0xE8-0xEF */
+0x00ad, 0x00b1, 0x2017, 0x00be, 0x00b6, 0x00a7, 0x00f7, 0x00b8, /* 0xF0-0xF7 */
+0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0, /* 0xF8-0xFF */
+};
+struct char_set cp858_g1 = {
+       1,
+       CHARS(cp858_g1_chars),
+       0, "", 0, 96,
+};
+
+struct char_set cp858 = {
+       .c0 = &ibm_ascii_c0,
+       .g0 = &ibm_ascii_g0,
+       .c1 = &cp858_c1,
+       .g1 = &cp858_g1,
+       .names = { "cp858", 0 },
+};
+
+CONSTRUCTOR(static void init(void))
+{
+       register_charset(&cp858);
+}
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/extra_charsets/koi8-r.c 
dosemu-1.1.2.7.eb2/src/plugin/extra_charsets/koi8-r.c
--- dosemu-1.1.2.7/src/plugin/extra_charsets/koi8-r.c   Wed Dec 31 17:00:00 1969
+++ dosemu-1.1.2.7.eb2/src/plugin/extra_charsets/koi8-r.c       Sat Jan 19 19:27:58 
+2002
@@ -0,0 +1,56 @@
+#include "translate.h"
+
+static const t_unicode koi8_r_c1_chars[] = {
+0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, /* 0x80-0x87 */
+0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, /* 0x88-0x8F */
+0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, /* 0x90-0x97 */
+0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, /* 0x98-0x9F */
+};
+struct char_set koi8_r_c1 = {
+       1,
+       CHARS(koi8_r_c1_chars),
+       0, "", 0, 32,
+};
+
+
+static const t_unicode koi8_r_g1_chars[] = {
+0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, /* 0xA0-0xA7 */
+0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E,        /* 0xA8-0xAF */
+0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,        /* 0xB0-0xB7 */
+0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9,        /* 0xB8-0xBF */
+0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,        /* 0xC0-0xC7 */
+0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,        /* 0xC8-0xCF */
+0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,        /* 0xD0-0xD7 */
+0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,        /* 0xD8-0xDF */
+0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,        /* 0xE0-0xE7 */
+0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,        /* 0xE8-0xEF */
+0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,        /* 0xF0-0xF7 */
+0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A,        /* 0xF8-0xFF */
+};
+struct char_set koi8_r_g1 = {
+       1,
+       CHARS(koi8_r_g1_chars),
+       0, "", 1, 96, 
+};
+
+struct char_set koi8_r = {
+       .c0 = &ascii_c0,
+       .g0 = &ascii_g0,
+       .c1 = &koi8_r_c1,
+       .g1 = &koi8_r_g1,
+       .names = { "koi8-r", 0 },
+};
+
+struct char_set koi8_r_safe = {
+       .c0 = &ascii_c0,
+       .g0 = &ascii_g0,
+       .c1 = &ascii_c1,
+       .g1 = &koi8_r_g1,
+       .names = { "koi8-r-safe", 0 },
+};
+
+CONSTRUCTOR(static void init(void))
+{
+       register_charset(&koi8_r);
+       register_charset(&koi8_r_safe);
+}
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/kbd_unicode/keyb_clients.c 
dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keyb_clients.c
--- dosemu-1.1.2.7/src/plugin/kbd_unicode/keyb_clients.c        Sun Jan 13 22:20:01 
2002
+++ dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keyb_clients.c    Sun Jan 13 22:25:19 
+2002
@@ -116,7 +116,7 @@
  *
  * DANG_END_FUNCTION
  */
-int keyb_client_init()
+int keyb_client_init(void)
 {
        int i;
        int ok;
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/kbd_unicode/keyb_raw.c 
dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keyb_raw.c
--- dosemu-1.1.2.7/src/plugin/kbd_unicode/keyb_raw.c    Sun Jan 13 22:20:01 2002
+++ dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keyb_raw.c        Sat Jan 19 13:13:14 
+2002
@@ -141,7 +141,7 @@
  * 
  * DANG_END_FUNCTION
  */
-int raw_keyboard_init(void)
+static int raw_keyboard_init(void)
 {
   k_printf("KBD(raw): raw_keyboard_init()\n");
    
@@ -183,6 +183,20 @@
   return TRUE;
 }
 
+/*
+ * DANG_BEGIN_FUNCTION raw_keyboard_reset
+ * 
+ * Reset the keyboard shiftstate to match the keyboard LED's
+ * 
+ * DANG_END_FUNCTION
+ */
+static void raw_keyboard_reset(void)
+{
+  /* initialise the server's shift state to the current keyboard state */ 
+  set_shiftstate(get_kbd_flags());
+       
+}
+
 /* something like this oughta be defined in linux/kd.h but isn't... */
 /* reset LEDs to normal mode, reflecting keyboard state */
 #define LED_NORMAL 0x08
@@ -226,7 +240,7 @@
    "raw",                      /* name */
    raw_keyboard_probe,        /* probe */
    raw_keyboard_init,          /* init */
-   NULL,                       /* reset */
+   raw_keyboard_reset,         /* reset */
    raw_keyboard_close,         /* close */
    do_raw_getkeys,             /* run */
    set_kbd_leds,                      /* set_leds */
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/kbd_unicode/keymaps.c 
dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keymaps.c
--- dosemu-1.1.2.7/src/plugin/kbd_unicode/keymaps.c     Sun Jan 13 22:20:01 2002
+++ dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/keymaps.c Sun Jan 20 14:42:49 2002
@@ -23,7 +23,6 @@
 static int is_a_console(int);
 static int open_a_console(char *);
 static int getfd(void);
-static char *dosemu_val(unsigned, t_keysym *);
 static int read_kbd_table(struct keytable_entry *);
 
 
@@ -1908,7 +1907,7 @@
   {"cz-qwertz", KEYB_CZ_QWERTZ, 0, CT(key_map_cz_qwertz), CT(num_table_comma),
     key_map_cz_qwertz, shift_map_cz_qwertz, alt_map_cz_qwertz,
     num_table_comma,},                                       
-  {"keyb-user", KEYB_USER, 0, CT(key_map_user), CT(num_table_comma),
+  {"keyb-user", KEYB_USER, 0, CT(key_map_user), CT(num_table_dot),
     key_map_user, shift_map_user, alt_map_user,
     num_table_dot,},
   {0},
@@ -1952,14 +1951,32 @@
   return -1;
 }
 
+static char* pretty_keysym(t_keysym d)
+{
+       static char b[100];
+       char *s = b;
+
+       if(d < 0x20 || d == 0x7f || d >= 0x80) {
+               sprintf(b, "0x%02x", d);
+       }
+       else if (d >= 0x80) {
+               sprintf(b, "0x%04x", d);
+       }
+       else {
+               sprintf(b, "'%c' ", (char) d);
+       }
+       
+       if(d == '\'') s = "'\\''";
+       if(d == KEY_VOID) s = " -- ";
+       
+       return s;
+}
 /*
  * Try to translate a keycode to a DOSEMU keycode...
  */
 
-static char *dosemu_val(unsigned k, t_keysym *dv)
+static t_keysym dosemu_val(unsigned k)
 {
-       static char b[100];
-       char *s = b;
        unsigned t = KTYP(k), v = KVAL(k);
        t_keysym d;
        
@@ -2022,16 +2039,16 @@
                
        case KT_PAD:
                switch(k) {
-               case K_P0:      d = KEY_PAD_0; break;
-               case K_P1:      d = KEY_PAD_1; break;
-               case K_P2:      d = KEY_PAD_2; break;
-               case K_P3:      d = KEY_PAD_3; break;
-               case K_P4:      d = KEY_PAD_4; break;
-               case K_P5:      d = KEY_PAD_5; break;
-               case K_P6:      d = KEY_PAD_6; break;
-               case K_P7:      d = KEY_PAD_7; break;
-               case K_P8:      d = KEY_PAD_8; break;
-               case K_P9:      d = KEY_PAD_9; break;
+               case K_P0:      d = KEY_PAD_INS; break;
+               case K_P1:      d = KEY_PAD_END; break;
+               case K_P2:      d = KEY_PAD_DOWN; break;
+               case K_P3:      d = KEY_PAD_PGDN; break;
+               case K_P4:      d = KEY_PAD_LEFT; break;
+               case K_P5:      d = KEY_PAD_CENTER; break;
+               case K_P6:      d = KEY_PAD_RIGHT; break;
+               case K_P7:      d = KEY_PAD_HOME; break;
+               case K_P8:      d = KEY_PAD_UP; break;
+               case K_P9:      d = KEY_PAD_PGUP; break;
                case K_PPLUS:   d = KEY_PAD_PLUS; break;
                case K_PMINUS:  d = KEY_PAD_MINUS; break;
                case K_PSTAR:   d = KEY_PAD_AST; break;
@@ -2044,6 +2061,17 @@
                break;
                
        case KT_SHIFT:
+               switch(k) {
+               case K_SHIFT:   d = KEY_L_SHIFT; break;
+               case K_SHIFTL:  d = KEY_L_SHIFT; break;
+               case K_SHIFTR:  d = KEY_R_SHIFT; break;
+               case K_CTRL:    d = KEY_L_CTRL; break;
+               case K_CTRLL:   d = KEY_L_CTRL; break;
+               case K_CTRLR:   d = KEY_R_CTRL; break;
+               case K_ALT:     d = KEY_L_ALT; break;
+               case K_ALTGR:   d = KEY_MODE_SWITCH; break;
+               }
+               break;
        case KT_META:
                d = KEY_VOID;
                break;
@@ -2062,25 +2090,8 @@
        default:
                break;
        }
-
-       if(dv) *dv = d;
-
-       sprintf(b, "%04x", k);
-       
-       if(d < 0x20 || d == 0x7f || d >= 0x80) {
-               sprintf(b, "0x%02x", d);
-       }
-       else if (d >= 0x80) {
-               sprintf(b, "0x%04x", d);
-       }
-       else {
-               sprintf(b, "'%c' ", (char) d);
-       }
        
-       if(d == '\'') s = "'\\''";
-       if(d == KEY_VOID) s = " -- ";
-       
-       return s;
+       return d;
 }
 
 
@@ -2205,9 +2216,8 @@
 static int read_kbd_table(struct keytable_entry *kt)
 {
        int fd, i, j = -1;
-       t_keysym k;
        struct kbentry ke;
-       unsigned v, vs, va, vc;
+       int altgr_present;
        
        fd = getfd();
        if(fd < 0) {
@@ -2215,7 +2225,10 @@
                return 1;
        }
        
+       altgr_present = 0;
        for(i = 0; i < sizeof(dosemu_to_kernel)/sizeof(dosemu_to_kernel[0]); i++) {
+               unsigned vp, vs, va, vc;
+               t_keysym kp, ks, ka, kc;
                int kernel, dosemu;
                kernel = dosemu_to_kernel[i].kernel;
                dosemu = dosemu_to_kernel[i].dosemu;
@@ -2223,7 +2236,7 @@
                
                ke.kb_table = 0;
                if ((j = ioctl(fd, KDGKBENT, (unsigned long) &ke))) break;
-               v = ke.kb_value;
+               vp = ke.kb_value;
                
                ke.kb_table = 1 << KG_SHIFT;
                if ((j = ioctl(fd, KDGKBENT, (unsigned long) &ke))) break;
@@ -2237,22 +2250,44 @@
                if ((j = ioctl(fd, KDGKBENT, (unsigned long) &ke))) break;
                vc = ke.kb_value;
                
-               if(va == v) va = 0;
-               
-               dosemu_val(v, &k); kt->key_map[dosemu] = k;
-               dosemu_val(vs, &k); kt->shift_map[dosemu] = k;
-               dosemu_val(va, &k); kt->alt_map[dosemu] = k;
-               dosemu_val(vc, &k); kt->ctrl_map[dosemu] = k;
-               
+               kp = dosemu_val(vp);
+               ks = dosemu_val(vs);
+               ka = dosemu_val(va);
+               kc = dosemu_val(vc);
+               if ((kp == KEY_MODE_SWITCH) || (ks == KEY_MODE_SWITCH) ||
+                       (ka == KEY_MODE_SWITCH) || (kc == KEY_MODE_SWITCH)) {
+                       printf("mode_switch\n");
+                       altgr_present = 1;
+               }
+               if (ka == kp) {
+                       ka = U_VOID;
+               }
+               /* Only allow control characters in the ctrl plane */
+               if ((kc > 0x1f) && (kc != 0x7f)) {
+                       kc = U_VOID;
+               }
+               /* As a special case filter [ctrl][tab] */
+               if ((dosemu = NUM_TAB) && (kc == 0x09)) {
+                       kc = U_VOID;
+               }
+               kt->key_map[dosemu]   = kp;
+               kt->shift_map[dosemu] = ks;
+               kt->alt_map[dosemu]   = ka;
+               kt->ctrl_map[dosemu]  = kc;
 #if 0
-               printf("%3d: %04x %04x %04x %04x   ", i, v, vs, va, vc);
-               
-               printf("%s ", dosemu_val(v, &k));
-               printf("%s ", dosemu_val(vs, &k));
-               printf("%s\n", dosemu_val(va, &k));
-               printf("%s\n", dosemu_val(vc, &k));
+               printf("%02x: ", dosemu);
+               printf("p: %04x->%-6s ", vp, pretty_keysym(kp));
+               printf("s: %04x->%-6s ", vs, pretty_keysym(ks));
+               printf("a: %04x->%-6s ", va, pretty_keysym(ka));
+               printf("c: %04x->%-6s ", vc, pretty_keysym(kc));
+               printf("\n");
 #endif
        }
+       if (!altgr_present) {
+               for(i = 0; i < sizeof(kt->alt_map)/sizeof(kt->alt_map[0]); i++) {
+                       kt->alt_map = U_VOID;
+               }
+       }
 
        /* look for numpad ',' or '.' */
        ke.kb_index = 83;
@@ -2287,7 +2322,7 @@
          shift_alt_map[NUM_KEY_NUMS],
          ctrl_alt_map[NUM_KEY_NUMS];
   struct keytable_entry *kt;
-  int idx;
+  int i, idx;
 
   idx = sizeof keytable_list / sizeof *keytable_list - 2;
 
@@ -2308,40 +2343,27 @@
   kt->shift_alt_map = shift_alt_map;
   kt->ctrl_alt_map = ctrl_alt_map;
 
-  memcpy(num_map, num_table_comma, sizeof num_map);
+  /* Initialize everything to unknown */
+  for(i = 0; i < NUM_KEY_NUMS; i++) {
+    plain_map[i] = U_VOID;
+    shift_map[i] = U_VOID;
+    alt_map[i] = U_VOID;
+    ctrl_map[i] = U_VOID;
+    shift_alt_map[i] = U_VOID;
+    ctrl_alt_map[i] = U_VOID;
+  }
+  /* Copy in the us keymap for a default */
+  memcpy(plain_map, key_map_us, sizeof(plain_map));
+  memcpy(shift_map, shift_map_us, sizeof(shift_map));
+  memcpy(alt_map, alt_map_us, sizeof(alt_map));
+  memcpy(num_map, num_table_dot, sizeof(num_map));
+  memcpy(ctrl_map, ctrl_map_us, sizeof(ctrl_map));
 
+  /* Now copy parameters for the linux kernel keymap */
   if(read_kbd_table(kt)) {
     k_printf("setup_default_keytable: failed\n");
     return -1;
   }
-
-#if 0
-  {
-    int i;
-
-    kt = keytable_list;
-    i = 0; while(kt->name) {
-      printf(
-        "%2d: name \"%s\", keyboard %d, flags 0x%x, sizemap %d, sizepad %d\n",
-        i, kt->name, kt->keyboard, kt->flags, kt->sizemap, kt->sizepad
-      );
-      i++, kt++;
-    }
-  }
-#endif
-
-#if 0
-  {
-    int i;
-
-    kt = keytable_list + KEYB_DE;
-    for(i = 0; i < kt->sizemap; i++) {
-      printf("%3d: %04x %04x %04x\n",
-        i, kt->key_map[i], kt->shift_map[i], kt->alt_map[i]
-      );
-    }
-  }
-#endif
 
   return KEYB_AUTO;
 }
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/kbd_unicode/serv_xlat.c 
dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/serv_xlat.c
--- dosemu-1.1.2.7/src/plugin/kbd_unicode/serv_xlat.c   Sun Jan 13 22:20:01 2002
+++ dosemu-1.1.2.7.eb2/src/plugin/kbd_unicode/serv_xlat.c       Sun Jan 20 14:33:58 
+2002
@@ -729,11 +729,11 @@
 {
        memset(state, 0, sizeof(*state));
        state->rules = rules;
-/* for now, we just assume that NumLock=on, Caps=off, Scroll=off. If the raw frontend
+/* for now, we just assume that NumLock=off, Caps=off, Scroll=off. If the raw frontend
  * is running, it'll tell us the actual shiftstate later, otherwise we'll have to
  * live with this.
  */
-       state->shiftstate = NUM_LOCK;
+       state->shiftstate = 0;
        state->alt_num_buffer = 0;
        state->accent = KEY_VOID;
        state->raw_state.rawprefix = 0;
diff -uNrX dosemu-ignore-files dosemu-1.1.2.7/src/plugin/term/terminal.c 
dosemu-1.1.2.7.eb2/src/plugin/term/terminal.c
--- dosemu-1.1.2.7/src/plugin/term/terminal.c   Sun Jan 13 22:20:02 2002
+++ dosemu-1.1.2.7.eb2/src/plugin/term/terminal.c       Sun Jan 20 13:12:49 2002
@@ -116,7 +116,9 @@
        struct char_set_state term_state;
        struct char_set_state display_state;
        int i;
-   
+
+       /* Initial don't allow the high control characters. */
+       SLsmg_Display_Eight_Bit = 0xA0;
        /* Build the translate tables */
        v_printf("mapping internal characters to terminal characters:\n");
        for(i= 0; i <= 0xff; i++) {
@@ -132,47 +134,29 @@
                result = unicode_to_charset(&term_state, uni, The_Charset + i, 1);
                v_printf("mapping: %c -> %04x -> %c\n", i, uni, The_Charset[i]);
 
+               /* If we have any non control charcters in 0x80 - 0x9f
+                * set up  the slang code up so we can send them. 
+                */
+               if ((The_Charset[i] >= 0x80) && ((The_Charset[i] <= 0x9F)) &&
+                       (((uni >= 0x20) && (uni < 0x80)) || (uni > 0x9f))) {
+                       /* Allow us to use chars 0x80 to 0x9F */
+                       SLsmg_Display_Eight_Bit = 0x80;
+               }
+
                cleanup_charset_state(&term_state);
                cleanup_charset_state(&display_state);
        }
-
-       /* Now see if we have any non control charcters in 0x80 - 0x9f
-        * if so set the slang code up so we can send them. 
+       /* Slang should filter out the control sequences for us... 
+        * So don't worry about characters 0x00 - 0x1f && 0x80 - 0x9f
         */
-       for(i = 0xa0; i < 0x9f; i++) {
-               int c = The_Charset[i];
-               if (    ((c <= 0x00) || (c >= 0x20)) &&
-                       ((c <= 0x80) || (c >= 0xA0))) {
-                       Use_IBM_Codes = 1;
-                       break;
-               }
-       }
-       
-       if (!Use_IBM_Codes) {
-               /* The fact is that this code is used to talk to a terminal.  Control 
-                * sequences 0x00-0x1f and 0x80-0x9F are reserved for the terminal.  
Here I fixup 
-                * the character set map to reflect this fact (only if not ibmpc 
codes).
-                */
-               for (i = 0; i < 256; i++) {
-                       if ((The_Charset[i] & 0x7F) < 32) {
-                               The_Charset[i] |= 32;
-                       }
-               }
-               /* Don't allow slang to use 8 bit control characters */
-               SLsmg_Display_Eight_Bit = 0xA0;
-       }
-       else /* USE_IBM_CODES */
-       {
+       if (trconfig.output_charset == lookup_charset("cp437")) {
+               Use_IBM_Codes = 1;
+               /* Should we be testing TERM here??? */
                /* The following turns on the IBM character set mode of virtual console
                 * The same code is echoed twice, then just in case the escape code
                 * not recognized and was printed, erase it with spaces.
                 */
-#if 0
-               SLtt_write_string ("\n\033(B\033(B\r         \r");
-#endif
                SLtt_write_string ("\033(U\033(U\r        \r");
-               /* Allow us to use chars 0x80 to 0x9F */
-               SLsmg_Display_Eight_Bit = 0x80;
        }
 }
 


Eric
  • ... "Баталов Григорий"
    • ... Eric W. Biederman
      • ... Grigory Batalov
        • ... Sergey Suleymanov
          • ... "Баталов Григорий"
        • ... Eric W. Biederman
          • ... Sergey Suleymanov
            • ... Eric W. Biederman
              • ... Sergey Suleymanov
          • ... Grigory Batalov

Reply via email to