meta: move photon/libc to root
This commit is contained in:
46
libc/ctype/ctype.c
Normal file
46
libc/ctype/ctype.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
static unsigned int random_seed = 53455346;
|
||||
|
||||
int isupper(int c) { return (c >= 65 && c <= 90); }
|
||||
|
||||
int islower(int c) { return (c >= 97 && c <= 122); }
|
||||
|
||||
int toupper(int c) {
|
||||
if (!islower(c)) {
|
||||
return c;
|
||||
}
|
||||
|
||||
return c - 32;
|
||||
}
|
||||
|
||||
int tolower(int c) {
|
||||
if (!isupper(c)) {
|
||||
return c;
|
||||
}
|
||||
|
||||
return c + 32;
|
||||
}
|
||||
|
||||
int isdigit(int c) { return (c >= 48 && c <= 57); }
|
||||
|
||||
int isalpha(int c) { return (c >= 65 && c <= 90) || (c >= 97 && c <= 122); }
|
||||
|
||||
int isalnum(int c) { return isalpha(c) | isdigit(c); }
|
||||
|
||||
int iscntrl(int c) { return (c <= 31) || (c == 127); }
|
||||
|
||||
int isprint(int c) { return (c >= 32 && c <= 126) || (c >= 128 && c <= 254); }
|
||||
|
||||
int isgraph(int c) { return isprint(c) && c != 32; }
|
||||
|
||||
int ispunct(int c) { return isgraph(c) && !isalnum(c); }
|
||||
|
||||
int isspace(int c) {
|
||||
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\v') ||
|
||||
(c == '\f') || (c == '\r');
|
||||
}
|
||||
|
||||
int isxdigit(int c) {
|
||||
return isdigit(c) || (c >= 65 && c <= 70) || (c >= 97 && c <= 102);
|
||||
}
|
||||
Reference in New Issue
Block a user