summaryrefslogtreecommitdiff
path: root/src/wctype/towlower.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wctype/towlower.c')
-rw-r--r--src/wctype/towlower.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/wctype/towlower.c b/src/wctype/towlower.c
new file mode 100644
index 00000000..8e5254d8
--- /dev/null
+++ b/src/wctype/towlower.c
@@ -0,0 +1,33 @@
+#include <wctype.h>
+#include "wchar.h"
+#include "stdlib.h"
+#include "nonstd/assert.h"
+
+/** convert a wide uppercase letter to lowercase **/
+wint_t towlower(wint_t wc)
+{
+ ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
+
+ if (!iswupper(wc)) {
+ return wc;
+ }
+
+ wctrans_t trans = wctrans("tolower");
+ return towctrans(wc, trans);
+}
+
+/***
+The fn(towlower) function converts a wide uppercase letter to its equivalent
+lowercase letter in the current locale.
+***/
+
+/* RETURN(arg(c)): arg(wc) was not a wide uppercase letter or it has no equivalent lowercase letter */
+/* RETURN: arg(wc) converted to lowercase */
+
+/* UNSPECIFIED: - */
+/* IMPLEMENTATION: - */
+/* LOCALE: LC_CTYPE */
+
+/*
+STDC(199409)
+*/