Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Nov 2001 16:49:33 +0200
From:      Peter Pentchev <roam@ringlet.net>
To:        Giorgos Keramidas <charon@labs.gr>
Cc:        Dag-Erling Smorgrav <des@ofug.org>, Joe Abley <jabley@automagic.org>, arch@FreeBSD.ORG
Subject:   Re: POSIX character class support for 1Tawk
Message-ID:  <20011103164933.E3551@straylight.oblivion.bg>
In-Reply-To: <20011103143515.D4464@hades.hell.gr>; from charon@labs.gr on Sat, Nov 03, 2001 at 02:35:15PM %2B0000
References:  <xzpu1wca91d.fsf@flood.ping.uio.no> <20011102233831.L25226@buffoon.automagic.org> <xzphesca0xv.fsf@flood.ping.uio.no> <20011103012226.Q25226@buffoon.automagic.org> <xzpvggse5j4.fsf@flood.ping.uio.no> <20011103145608.B76275@straylight.oblivion.bg> <20011103143515.D4464@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 03, 2001 at 02:35:15PM +0000, Giorgos Keramidas wrote:
> On Sat, Nov 03, 2001 at 02:56:08PM +0200, Peter Pentchev wrote:
> > On Sat, Nov 03, 2001 at 07:23:59AM +0100, Dag-Erling Smorgrav wrote:
> > > Joe Abley <jabley@automagic.org> writes:
> > > > Our isalpha() and friends are locale-sensitive, I think.
> > > 
> > > Only if the caller has previously called setlocale().
> > 
> > So what's the problem in calling setlocale(LC_ALL, "")
> > early in main() or something, as so many other utilities in
> > our base system already do?
> 
> Unfortunately enough, it's not that simple.  You'd have to check for
> all the possible LC_xxx environment variables.  The small program
> below shows what can happen if you use setlocale() with NULL instead
> of the correct value.
[snip]
>     $ env LC_LANG=el_GR LC_ALL=el_GR.ISO8859-7 ./blah
>     Using NULL: false
>     Using getenv(): true
> 
> In the second case, of having the proper locale setup in the
> environment, only when getenv() is used to retrieve the proper value
> for setlocale() the GREEK_ALPHA character is recognized from isalpha() :/

Well, I implicitly assumed that LC_ALL was set, as by the FreeBSD sample
'russian' login.conf entry: it defines the 'lang' attribute, which
sets LANG, which setlocale(3) interprets as an LC_ALL setting.

G'luck,
Peter

-- 
Nostalgia ain't what it used to be.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011103164933.E3551>