summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/toupper.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-11-03 08:59:02 +0000
committerache <ache@FreeBSD.org>1995-11-03 08:59:02 +0000
commit94bfe4fc2daad94a8db6f6357509d07c43ba23e7 (patch)
treea19d0b48f043559abd58365a4b3393bbc6da9c5c /lib/libc/locale/toupper.c
parent5f00167641d57332e1952cd7ec49cfc0aa9444d9 (diff)
downloadFreeBSD-src-94bfe4fc2daad94a8db6f6357509d07c43ba23e7.zip
FreeBSD-src-94bfe4fc2daad94a8db6f6357509d07c43ba23e7.tar.gz
Move more stuff out to XPG4
Handle negative chars inside runetype/tolower/toupper
Diffstat (limited to 'lib/libc/locale/toupper.c')
-rw-r--r--lib/libc/locale/toupper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c
index 1e5aa40..08be64b 100644
--- a/lib/libc/locale/toupper.c
+++ b/lib/libc/locale/toupper.c
@@ -41,18 +41,28 @@ _BSD_RUNE_T_
___toupper(c)
_BSD_RUNE_T_ c;
{
+#ifdef XPG4
int x;
_RuneRange *rr = &_CurrentRuneLocale->mapupper_ext;
_RuneEntry *re = rr->ranges;
+#endif
if (c == EOF)
return(EOF);
+ if (c < 0) {
+ if (c >= -128) /* signed char */
+ return(_CurrentRuneLocale->mapupper[(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