Subject: Re: isprint()
To: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
From: Erik Bertelsen <email@example.com>
Date: 08/19/1996 07:48:55
On Sun, 18 Aug 1996, der Mouse wrote:
.. > Ideally, the kernel would inherit this change; the behavior of stty
.. > lcase will be wrong otherwise, I [believe].
.. How _could_ the kernel know what some user process thinks constitutes
.. uppercase or lowercase? And even if you grant that, arguendo, which
.. process's idea of "printable" should it use?
Why is this related to the kernel? In many case we are talking about
user land code when discussing isprint and friends, e.g. elm as mentioned
in a recent message -- well after re-reading the text quoted above, maybe
I understand anyhow: the problem is that stty interacts with the tty
driver within the kernel.
Well, back to user land code:
In fact the C standard specifies which functions are locale depend, e.g.
most isxxxx functions. According to POSIX.1 locale settings may be
imported via environment variables.
My suggestion is to do as suggested in the recent <cdefs.h>-related PR:
let the appropriate isxxxx functions and other locale dependent functions
actually follow their locale. This will allow programs calling setlocale()
appropriately to have their locale controlled by the user at start-up
time instead of at compile time.
A slight problem is that the C standard specifies that any program not
calling setlocale() shall work with the minimal C locale, but calling
setlocale() with an empty locale name will use a system global default
locale (which should be settable at boot time).