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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c
new file mode 100644
index 0000000..995cdce
--- /dev/null
+++ b/lib/libc/locale/tolower.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <rune.h>
+
+_BSD_RUNE_T_
+___tolower(c)
+ _BSD_RUNE_T_ c;
+{
+ int x;
+ _RuneRange *rr = &_CurrentRuneLocale->maplower_ext;
+ _RuneEntry *re = rr->ranges;
+
+ if (c == EOF)
+ return(EOF);
+ for (x = 0; x < rr->nranges; ++x, ++re) {
+ if (c < re->min)
+ return(c);
+ if (c <= re->max)
+ return(re->map + c - re->min);
+ }
+ return(c);
+}
+
+
OpenPOWER on IntegriCloud