Hi Stefan,

Stefan Sperling wrote on Tue, Dec 09, 2014 at 04:48:58PM +0100:
> On Tue, Dec 09, 2014 at 08:32:23AM -0700, Ingo Schwarze wrote:

>> CVSROOT:     /cvs
>> Module name: src
>> Changes by:  schwa...@cvs.openbsd.org        2014/12/09 08:32:23
>> 
>> Modified files:
>>      lib/libc/locale: setlocale.3 
>> 
>> Log message:
>> LC_CTYPE has no effect on ctype(3), but on wctype(3); ok jmc@

> That doesn't sound right. Try this program:
> 
> #include <ctype.h>
> #include <locale.h>
> #include <stdio.h>
> 
> int main()
> {
>       int c = 0xC4; /* A umlaut in latin1 */
> 
>       setlocale(LC_CTYPE, "C");
>       printf("%c is %sprintable\n", c, isprint(c) ? "" : "not ");
>       setlocale(LC_CTYPE, "en_US.ISO8859-1");
>       printf("%c is %sprintable\n", c, isprint(c) ? "" : "not ");
>       return 0;
> }

I stand corrected.

I knew the table in gen/ctype_.c, but missed the fact that
__install_currentrunelocale_ctype() in runeglue.c can actually
replace it with something else, taken from /usr/share/locale/*/LC_CTYPE
by _xpg4_setrunelocale() in setrunelocale.c.  Crazy stuff.

So, like this?
  Ingo


Index: setlocale.3
===================================================================
RCS file: /cvs/src/lib/libc/locale/setlocale.3,v
retrieving revision 1.16
diff -u -r1.16 setlocale.3
--- setlocale.3 9 Dec 2014 15:32:23 -0000       1.16
+++ setlocale.3 9 Dec 2014 16:46:51 -0000
@@ -74,9 +74,12 @@
 and
 .Fn strxfrm .
 .It Dv LC_CTYPE
-Set a locale for the
-.Xr wctype 3
-functions.
+Set a locale for
+.Xr isalnum 3
+and the related functions defined in
+.In ctype.h ,
+as well as for
+.Xr iswctype 3 .
 This controls recognition of upper and lower case,
 alphabetic or non-alphabetic characters, and so on.
 The real work is done by the

Reply via email to