]> sourceware.org Git - newlib-cygwin.git/commitdiff
* environ.cc (environ_init): Break from locale loop after first hit.
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 25 Mar 2009 12:29:04 +0000 (12:29 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 25 Mar 2009 12:29:04 +0000 (12:29 +0000)
* fhandler_console.cc (fhandler_console::write_normal): Print a SO
sequence using always valid Unicode chars.

winsup/cygwin/ChangeLog
winsup/cygwin/environ.cc
winsup/cygwin/fhandler_console.cc

index 0464a0a813ef55e93ca050ea4c7e1acb5272b5a3..f4ad4b02cd73497cfeadf5fbc3fbf9695805a647 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-25  Corinna Vinschen  <corinna@vinschen.de>
+
+       * environ.cc (environ_init): Break from locale loop after first hit.
+       * fhandler_console.cc (fhandler_console::write_normal): Print a SO
+       sequence using always valid Unicode chars.
+
 2009-03-25  Corinna Vinschen  <corinna@vinschen.de>
 
        * strfuncs.cc (__kr_wctomb): Use codepage 51949 rather than 50949.
index 41b122b53c05be5e806fce029bf5870b7acaca9a..75e1ffb37f6a49dbd788e551af20e40dec62d3f8 100644 (file)
@@ -791,7 +791,10 @@ environ_init (char **envp, int envc)
          char *buf = (char *) alloca (i);
          GetEnvironmentVariableA (lc_arr[lc], buf, i);
          if (_setlocale_r (_GLOBAL_REENT, LC_CTYPE, buf))
-           got_lc = true;
+           {
+             got_lc = true;
+             break;
+           }
        }
     }
   /* No matching POSIX environment variable, use current codepage. */
index 68fb71ea9cca404a26a3eb7216a3551a30454551..976affcafbd22530664a4b5c9228bd1b762fa5bc 100644 (file)
@@ -1573,7 +1573,25 @@ fhandler_console::write_normal (const unsigned char *src,
          cursor_set (false, 0, y);
          break;
        case ERR:
-         /* Don't print chars marked as ERR chars. */
+         /* Don't print chars marked as ERR chars, except for a SO sequence
+            which is printed as singlebyte chars from the UTF Basic Latin
+            and Latin 1 Supplement plains. */
+         if (*found == 0x0e)
+           {
+             write_replacement_char ();
+             if (found + 1 < end)
+               {
+                 ret = __utf8_mbtowc (_REENT, NULL, (const char *) found + 1,
+                                      end - found - 1, NULL, &ps);
+                 if (ret != (size_t) -1)
+                   while (ret-- > 0)
+                     {
+                       WCHAR w = *(found + 1);
+                       WriteConsoleW (get_output_handle (), &w, 1, &done, 0);
+                       found++;
+                     }
+               }
+           }
          break;
        case TAB:
          cursor_get (&x, &y);
This page took 0.034643 seconds and 5 git commands to generate.