summaryrefslogtreecommitdiff
path: root/src/user/lib/ctype.c
blob: b702703e21a0222df2fc1d4c959c1b94b8594e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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';
}