Yes it can happen (it's rare, but a cause to put a simple warning), and if
it has an error the locale will be set to POSIX (default locale).

The locale LC_CTYPE, affects the behavior of regular expressions, character
classification, character conversion functions, and wide-character
functions.

Cheers.

2009/5/26 Julien Danjou <[email protected]>

> At 1243318849 time_t, Ángel Alonso wrote:
> > From 92761316de40b0cac70dd5eca34ed72d7a84e07c Mon Sep 17 00:00:00 2001
> > From: feler <[email protected]>
> > Date: Tue, 26 May 2009 22:40:20 -0700
> > Subject: [PATCH] warning_setlocale
> >
> > ---
> >  awesome.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/awesome.c b/awesome.c
> > index 321d98e..e6672e6 100644
> > --- a/awesome.c
> > +++ b/awesome.c
> > @@ -354,7 +354,8 @@ main(int argc, char **argv)
> >      }
> >
> >      /* Text won't be printed correctly otherwise */
> > -    setlocale(LC_CTYPE, "");
> > +    if(!setlocale(LC_CTYPE, ""))
> > +        fprintf(stderr, "warning: cannot set locale.\n");
>
> You should rather use warn().
> Btw, does this situation really happens and has any impact?
>
> Cheers,
> --
> Julien Danjou
> // ᐰ <[email protected]>   http://julien. <http://julien.danjou.info>
> danjou.info <http://julien.danjou.info>
> // 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
> // The more we fly, the more we climb, the more we know that heaven is a
> lie.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkobnrAACgkQpGK1HsL+5c3L5ACfX35R94hUgKlJsirqX0S/Yovt
> 0iYAoIIGN9DZQMCHyzaqMZHbj/6/N+6O
> =LbiO
> -----END PGP SIGNATURE-----
>
>

Reply via email to