* 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.
This commit is contained in:
Corinna Vinschen 2009-05-15 11:30:18 +00:00
parent a972ea99d5
commit 73535010d7
6 changed files with 32 additions and 4 deletions

View File

@ -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>

View File

@ -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], '\\');

View File

@ -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)
{

View File

@ -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 ();

View File

@ -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 ();

View File

@ -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)
{