diff options
Diffstat (limited to 'src/user/lib/libc/std/ctype.c')
-rw-r--r-- | src/user/lib/libc/std/ctype.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/user/lib/libc/std/ctype.c b/src/user/lib/libc/std/ctype.c new file mode 100644 index 0000000..f0e7750 --- /dev/null +++ b/src/user/lib/libc/std/ctype.c @@ -0,0 +1,28 @@ +#include <ctype.h> + + +int isalpha(int c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); +} + +int isdigit(int c) { + return (c >= '0' && c <= '9'); +} + +int isalnum(int c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); +} + +int tolower(int c) { + if (c >= 'A' && c <= 'Z') { + return c + ('a' - 'A'); + } + return c; +} + +int toupper(int c) { + if (c >= 'a' && c <= 'z') { + return c - ('a' - 'A'); + } + return c; +} |