summaryrefslogtreecommitdiff
path: root/src/user/lib/libc/std/ctype.c
blob: 13f2ab0bb7e1fb42c5afeeae6b831deefed7afce (plain) (blame)
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
#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') {
		c += ('a' - 'A');
	}
	return c;
}

int toupper(int c) {
	if (c >= 'a' && c <= 'z') {
		 c -= ('a' - 'A');
	}
	return c;
}