[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 6291 - trunk/subversion/libsvn_subr

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-06-19 05:38:23 CEST

philip@tigris.org wrote:

>Author: philip
>Date: Wed Jun 18 15:23:23 2003
>New Revision: 6291
>
>Modified:
> trunk/subversion/libsvn_subr/cmdline.c
>Log:
>* subversion/libsvn_subr/cmdline.c (svn_cmdline_init): Produce a more
> verbose error message when setting the locale fails.
>
I'd just like to point out that this change is very Unix-specific (and
not ISO-C compliant, btw). Windows doesn't define any of these
environment variables. Of course, the chance that the setlocale call
would fail on Windows is fairly remote.

>Modified: trunk/subversion/libsvn_subr/cmdline.c
>==============================================================================
>--- trunk/subversion/libsvn_subr/cmdline.c (original)
>+++ trunk/subversion/libsvn_subr/cmdline.c Wed Jun 18 15:23:23 2003
>@@ -71,9 +71,29 @@
> if (!setlocale(LC_CTYPE, ""))
> {
> if (error_stream)
>- fprintf(error_stream,
>- "%s: error: cannot set the locale\n",
>- progname);
>+ {
>+ const char *env_vars[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL };
>+ const char **env_var = &env_vars[0], *env_val = NULL;
>+ while (*env_var)
>+ {
>+ env_val = getenv(*env_var);
>+ if (env_val && env_val[0])
>+ break;
>+ ++env_var;
>+ }
>+
>+ if (!*env_var)
>+ {
>+ /* Unlikely. Can setlocale fail if no env vars are set? */
>+ --env_var;
>+ env_val = "not set";
>+ }
>+
>+ fprintf(error_stream,
>+ "%s: error: cannot set LC_CTYPE locale\n"
>+ "%s: error: environment variable %s is %s\n",
>+ progname, progname, *env_var, env_val);
>+ }
> return EXIT_FAILURE;
> }
>
>

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 19 05:39:15 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.