? koi8.patch
Index: ctype/ctype_cp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/ctype/ctype_cp.h,v
retrieving revision 1.3
diff -u -r1.3 ctype_cp.h
--- ctype/ctype_cp.h	21 Apr 2009 20:09:01 -0000	1.3
+++ ctype/ctype_cp.h	20 Aug 2009 19:49:12 -0000
@@ -397,6 +397,43 @@
 	_L,	_L,	_P,	_L,	_L,	_L,	_L,	_P, \
 	_L,	_L,	_L,	_L,	_L,	_L,	_P
 #define _CTYPE_CP1258_255 _L
+#define _CTYPE_CP20866_128_254 \
+   	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_S|_B,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_L,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_U,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U
+#define _CTYPE_CP20866_255 _U
+#define _CTYPE_CP21866_128_254 \
+   	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_S|_B,	_P,	_P,	_P,	_P,	_P, \
+	_P,	_P,	_P,	_L,	_L,	_P,	_L,	_L, \
+	_P,	_P,	_P,	_P,	_P,	_L,	_P,	_P, \
+	_P,	_P,	_P,	_U,	_U,	_P,	_U,	_U, \
+	_P,	_P,	_P,	_P,	_P,	_U,	_P,	_P, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U, \
+	_U,	_U,	_U,	_U,	_U,	_U,	_U
+#define _CTYPE_CP21866_255 _U
+
 
 extern int __cp_index (const char *charset_ext);
 
@@ -405,7 +442,7 @@
 #ifndef __CYGWIN__
 static _CONST
 #endif
-char __ctype_cp[22][128 + 256] = {
+char __ctype_cp[24][128 + 256] = {
   { _CTYPE_CP437_128_254,
     0,
     _CTYPE_DATA_0_127,
@@ -538,6 +575,18 @@
     _CTYPE_CP1258_128_254,
     _CTYPE_CP1258_255
   },
+  { _CTYPE_CP20866_128_254,
+    0,
+    _CTYPE_DATA_0_127,
+    _CTYPE_CP20866_128_254,
+    _CTYPE_CP20866_255
+  },
+  { _CTYPE_CP21866_128_254,
+    0,
+    _CTYPE_DATA_0_127,
+    _CTYPE_CP21866_128_254,
+    _CTYPE_CP21866_255
+  },
 };
 
 #else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */
@@ -653,6 +702,16 @@
     _CTYPE_CP1258_128_254,
     _CTYPE_CP1258_255
   },
+  { 0,
+    _CTYPE_DATA_0_127,
+    _CTYPE_CP20866_128_254,
+    _CTYPE_CP20866_255
+  },
+  { 0,
+    _CTYPE_DATA_0_127,
+    _CTYPE_CP21866_128_254,
+    _CTYPE_CP21866_255
+  },
 };
 
 #endif /* ALLOW_NEGATIVE_CTYPE_INDEX */
Index: stdlib/sb_charsets.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/sb_charsets.c,v
retrieving revision 1.1
diff -u -r1.1 sb_charsets.c
--- stdlib/sb_charsets.c	24 Mar 2009 10:13:27 -0000	1.1
+++ stdlib/sb_charsets.c	20 Aug 2009 19:49:14 -0000
@@ -203,7 +203,7 @@
    value (function __cp_index), the second index is the value of the
    incoming character - 0x80.
    Values < 0x80 don't have to be converted anyway. */
-wchar_t __cp_conv[22][0x80] = {
+wchar_t __cp_conv[24][0x80] = {
   /* CP437 */
   { 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7,
     0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5,
@@ -577,7 +577,41 @@
     0xe0, 0xe1, 0xe2, 0x103, 0xe4, 0xe5, 0xe6, 0xe7,
     0xe8, 0xe9, 0xea, 0xeb, 0x301, 0xed, 0xee, 0xef,
     0x111, 0xf1, 0x323, 0xf3, 0xf4, 0x1a1, 0xf6, 0xf7,
-    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x1b0, 0x20ab, 0xff }
+    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x1b0, 0x20ab, 0xff },
+  /* CP20866 (KOI8-R) */
+  { 0x2500,0x2502,0x250c,0x2510,0x2514,0x2518,0x251c,0x2524,
+    0x252c,0x2534,0x253c,0x2580,0x2584,0x2588,0x258c,0x2590,
+    0x2591,0x2592,0x2593,0x2320,0x25a0,0x2219,0x221a,0x2248,
+    0x2264,0x2265,0xa0,0x2321,0xb0,0xb2,0xb7,0xf7,
+    0x2550,0x2551,0x2552,0x451,0x2553,0x2554,0x2555,0x2556,
+    0x2557,0x2558,0x2559,0x255a,0x255b,0x255c,0x255d,0x255e,
+    0x255f,0x2560,0x2561,0x401,0x2562,0x2563,0x2564,0x2565,
+    0x2566,0x2567,0x2568,0x2569,0x256a,0x256b,0x256c,0xa9,
+    0x44e,0x430,0x431,0x446,0x434,0x435,0x444,0x433,
+    0x445,0x438,0x439,0x43a,0x43b,0x43c,0x43d,0x43e,
+    0x43f,0x44f,0x440,0x441,0x442,0x443,0x436,0x432,
+    0x44c,0x44b,0x437,0x448,0x44d,0x449,0x447,0x44a,
+    0x42e,0x410,0x411,0x426,0x414,0x415,0x424,0x413,
+    0x425,0x418,0x419,0x41a,0x41b,0x41c,0x41d,0x41e,
+    0x41f,0x42f,0x420,0x421,0x422,0x423,0x416,0x412,
+    0x42c,0x42b,0x417,0x428,0x42d,0x429,0x427,0x42a },
+  /* CP21866 (KOI8-U) */
+  { 0x2500,0x2502,0x250c,0x2510,0x2514,0x2518,0x251c,0x2524,
+    0x252c,0x2534,0x253c,0x2580,0x2584,0x2588,0x258c,0x2590,
+    0x2591,0x2592,0x2593,0x2320,0x25a0,0x2219,0x221a,0x2248,
+    0x2264,0x2265,0xa0,0x2321,0xb0,0xb2,0xb7,0xf7,
+    0x2550,0x2551,0x2552,0x451,0x454,0x2554,0x456,0x457,
+    0x2557,0x2558,0x2559,0x255a,0x255b,0x491,0x255d,0x255e,
+    0x255f,0x2560,0x2561,0x401,0x404,0x2563,0x406,0x407,
+    0x2566,0x2567,0x2568,0x2569,0x256a,0x490,0x256c,0xa9,
+    0x44e,0x430,0x431,0x446,0x434,0x435,0x444,0x433,
+    0x445,0x438,0x439,0x43a,0x43b,0x43c,0x43d,0x43e,
+    0x43f,0x44f,0x440,0x441,0x442,0x443,0x436,0x432,
+    0x44c,0x44b,0x437,0x448,0x44d,0x449,0x447,0x44a,
+    0x42e,0x410,0x411,0x426,0x414,0x415,0x424,0x413,
+    0x425,0x418,0x419,0x41a,0x41b,0x41c,0x41d,0x41e,
+    0x41f,0x42f,0x420,0x421,0x422,0x423,0x416,0x412,
+    0x42c,0x42b,0x417,0x428,0x42d,0x429,0x427,0x42a }
 };
 #endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
 
@@ -687,6 +721,12 @@
     case 1258:
       cp_idx = 21;
       break;
+    case 20866:
+      cp_idx = 22;
+      break;
+    case 21866:
+      cp_idx = 23;
+      break;
     default:
       cp_idx = -1;
       break;
