summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/tolower.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/tolower.c')
-rw-r--r--lib/libc/locale/tolower.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c
index f1d6fe0..e72a52c 100644
--- a/lib/libc/locale/tolower.c
+++ b/lib/libc/locale/tolower.c
@@ -41,18 +41,28 @@ _BSD_RUNE_T_
___tolower(c)
_BSD_RUNE_T_ c;
{
+#ifdef XPG4
int x;
_RuneRange *rr = &_CurrentRuneLocale->maplower_ext;
_RuneEntry *re = rr->ranges;
+#endif
if (c == EOF)
return(EOF);
+ if (c < 0) {
+ if (c >= -128) /* signed char */
+ return(_CurrentRuneLocale->maplower[(unsigned char)c]);
+ else
+ return(c);
+ }
+#ifdef XPG4
for (x = 0; x < rr->nranges; ++x, ++re) {
if (c < re->min)
return(c);
if (c <= re->max)
return(re->map + c - re->min);
}
+#endif
return(c);
}
OpenPOWER on IntegriCloud