diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-09-28 10:43:49 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-09-28 10:43:49 +0000 |
commit | d856640e1c8dc008113a6865826d9459710f9857 (patch) | |
tree | 0c0e5251a4d9fd1ac161c42d6f4baa75e6665321 /winsup/cygwin/environ.cc | |
parent | a58d484bcfa8a8581fda771e2f60aa0307534590 (diff) | |
download | newlib-d856640e1c8dc008113a6865826d9459710f9857.zip newlib-d856640e1c8dc008113a6865826d9459710f9857.tar.gz newlib-d856640e1c8dc008113a6865826d9459710f9857.tar.bz2 |
* cygheap.cc (cygheap_init): Default locale.charset to "UTF-8".
* dcrt0.cc (dll_crt0_1): Call setlocale (LC_CTYPE, "") here, just
before resetting application locale to "C".
* environ.cc (environ_init): Drop code setting locale here.
* syscalls.cc (check_codepage): Break out check for required codepage
from internal_setlocale.
(internal_setlocale): Just convert CWD and $PATH from old charset to
new charset and set internal charset.
(setlocale): Change accordingly. Don't require LC_ALL or LC_CTYPE to
store old locale value. Always call internal_setlocale if charset
changed due to locale environment changes.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r-- | winsup/cygwin/environ.cc | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index d4e003f..bc11303 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -732,7 +732,6 @@ environ_init (char **envp, int envc) static char NO_COPY cygterm[] = "TERM=cygwin"; myfault efault; tmp_pathbuf tp; - static const char *lc_arr[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL }; if (efault.faulted ()) api_fatal ("internal error reading the windows environment - too many environment variables?"); @@ -777,22 +776,6 @@ environ_init (char **envp, int envc) /* Allocate space for environment + trailing NULL + CYGWIN env. */ lastenviron = envp = (char **) malloc ((4 + (envc = 100)) * sizeof (char *)); - /* We need the locale variables' content before we can loop through - the whole environment, so that the wide-char to multibyte conversion - can be done according to the $LC_ALL/$LC_CTYPE/$LANG/current_codepage - setting, as well as the uppercasing according to the "upcaseenv" - setting. Note that we have to reset the LC_CTYPE setting to "C" - before calling main() for POSIX compatibility. */ - for (int lc = 0; lc_arr[lc]; ++lc) - { - if ((i = GetEnvironmentVariableA (lc_arr[lc], NULL, 0))) - { - char *buf = (char *) alloca (i); - GetEnvironmentVariableA (lc_arr[lc], buf, i); - if (setlocale (LC_CTYPE, buf)) - break; - } - } /* We also need the CYGWIN variable early to know the value of the CYGWIN=upcaseenv setting for the below loop. */ if ((i = GetEnvironmentVariableA ("CYGWIN", NULL, 0))) |