The cast just stops gcc detecting places where the functions are
passed a 'char' variable - and will index off the array for byte values
0x80 to 0xff.
All (I hope) of the places in the netbsd sources where this was a
potential problem have had an (unsigned char) cast applied.
Christos said he'll fix any fallout I've missed.
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
The tables have been renamed to _C_ctype_, _C_tolower_, and _C_toupper_
as they are tables for the C locale. When switching to a new locale, the
pointers will be set to point to tables specific to the new locale.
in the text segment. When we implement locales, the isctype macros/functions
will reference this table (or a locale specific table) through a pointer, but
for right now, it continues to reference the _ctype_ table directly.
Standard C requires tolower to return a character that is !isupper unchanged
which was not being done with the macro. The function version does the
right thing, so the loss of the macro is no great deal.
I didn't eliminate the macros entirely, since X/Open's XPG3 requires _tolower
and _toupper with the same semantics. But, like isascii/toascii, they are
removed from the namespace if either ANSI_SOURCE or _POSIX_SOURCE is defined.