summaryrefslogtreecommitdiffstats
path: root/src/include/ctype.h
blob: a79395d2a3bd61066c975c7478a0493a53ff7e8b (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
#ifndef _CTYPE_H
#define _CTYPE_H

/** @file
 *
 * Character types
 */

#define isdigit(c)	((c & 0x04) != 0)
#define islower(c)	((c & 0x02) != 0)
//#define isspace(c)	((c & 0x20) != 0)
#define isupper(c)	((c & 0x01) != 0)

static inline unsigned char tolower(unsigned char c)
{
	if (isupper(c))
		c -= 'A'-'a';
	return c;
}

static inline unsigned char toupper(unsigned char c)
{
	if (islower(c))
		c -= 'a'-'A';
	return c;
}

#endif /* _CTYPE_H */