diff options
Diffstat (limited to 'src/ctype/tolower.c')
-rw-r--r-- | src/ctype/tolower.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ctype/tolower.c b/src/ctype/tolower.c new file mode 100644 index 00000000..b684eb7a --- /dev/null +++ b/src/ctype/tolower.c @@ -0,0 +1,29 @@ +#include <ctype.h> +#include "limits.h" +#include "nonstd/assert.h" +#include "nonstd/ctype.h" +#include "nonstd/internal.h" + +/** convert an uppercase letter to lowercase **/ +int tolower(int c) +{ + unsigned char *map = __libc(TOLOWER); + + ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF); + /* + RETURN_SUCCESS(ARGUMENT(c) converted to lowercase); + RETURN_FAILURE(ARGUMENT(c), ARGUMENT(c) was not an uppercase letter or it has no equivalent lowercase letter); + */ + + return map[c]; +} + +/*** +converts an uppercase letter to its equivalent lowercase letter in the current +locale. +***/ + +/* +LC_CTYPE +STDC(1) +*/ |