Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-05-15 15:30:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-05-15 15:30:18 +0400
commit73535010d72d1a7d46e4f5c6c98f41fab90df489 (patch)
treec704e4155e42372132a39c6f4fbc5d4cc31afda0
parenta972ea99d54c5834eb0bd8d5e40e1045d2e21d3f (diff)
* cygpath.cc (main): Only setlocale for LC_CTYPE category. Fallback
to UTF-8 if locale is "C". * ldd.cc (main): Ditto. * mkgroup.c (main): Ditto. * mkpasswd.c (main): Ditto. * passwd.c (main): Ditto.
-rw-r--r--winsup/utils/ChangeLog9
-rw-r--r--winsup/utils/cygpath.cc5
-rw-r--r--winsup/utils/ldd.cc6
-rw-r--r--winsup/utils/mkgroup.c5
-rw-r--r--winsup/utils/mkpasswd.c5
-rw-r--r--winsup/utils/passwd.c6
6 files changed, 32 insertions, 4 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 7024e29f3..ea7fb223b 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,12 @@
+2009-05-15 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygpath.cc (main): Only setlocale for LC_CTYPE category. Fallback
+ to UTF-8 if locale is "C".
+ * ldd.cc (main): Ditto.
+ * mkgroup.c (main): Ditto.
+ * mkpasswd.c (main): Ditto.
+ * passwd.c (main): Ditto.
+
2009-05-13 Corinna Vinschen <corinna@vinschen.de>
Christopher Faylor <me+cygwin@cgf.cx>
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
index ade86f7f2..c993ccd0a 100644
--- a/winsup/utils/cygpath.cc
+++ b/winsup/utils/cygpath.cc
@@ -982,7 +982,10 @@ main (int argc, char **argv)
{
int o;
- setlocale (LC_ALL, "");
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
prog_name = strrchr (argv[0], '/');
if (!prog_name)
prog_name = strrchr (argv[0], '\\');
diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc
index 7a7e04ab9..b2d6f7b92 100644
--- a/winsup/utils/ldd.cc
+++ b/winsup/utils/ldd.cc
@@ -327,7 +327,11 @@ main (int argc, char **argv)
{
int optch;
int index;
- setlocale (LC_ALL, "");
+
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
while ((optch = getopt_long (argc, argv, "dru", longopts, &index)) != -1)
switch (optch)
{
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 74de36c21..07d15fe5f 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
+#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
@@ -749,6 +750,10 @@ main (int argc, char **argv)
if (!isatty (1))
setmode (1, O_BINARY);
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
load_dsgetdcname ();
in_domain = fetch_primary_domain ();
fetch_current_pgrp_sid ();
diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c
index 0ba88bf75..3947309dd 100644
--- a/winsup/utils/mkpasswd.c
+++ b/winsup/utils/mkpasswd.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
+#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
@@ -708,6 +709,10 @@ main (int argc, char **argv)
if (!isatty (1))
setmode (1, O_BINARY);
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
load_dsgetdcname ();
in_domain = fetch_primary_domain ();
fetch_current_user_sid ();
diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c
index 3ea91a4e5..188f39f17 100644
--- a/winsup/utils/passwd.c
+++ b/winsup/utils/passwd.c
@@ -408,8 +408,10 @@ main (int argc, char **argv)
if (c)
*c = '\0';
- setlocale (LC_ALL, "");
-
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (opt)
{