summaryrefslogtreecommitdiff
path: root/src/user/lib/ctype.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/ctype.c')
-rw-r--r--src/user/lib/ctype.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/user/lib/ctype.c b/src/user/lib/ctype.c
new file mode 100644
index 0000000..b702703
--- /dev/null
+++ b/src/user/lib/ctype.c
@@ -0,0 +1,31 @@
+#include <ctype.h>
+
+int isalpha(int c) {
+ return islower(c) || isupper(c);
+}
+
+int isalnum(int c) {
+ return isalpha(c) || isdigit(c);
+}
+
+int isdigit(int c) {
+ return '0' <= c && c <= '9';
+}
+
+int islower(int c) {
+ return 'a' <= c && c <= 'z';
+}
+
+int isspace(int c) {
+ return c == ' '
+ || c == '\f'
+ || c == '\n'
+ || c == '\r'
+ || c == '\t'
+ || c == '\v';
+}
+
+int isupper(int c) {
+ return 'A' <= c && c <= 'Z';
+}
+