diff --git a/libc/ctype.cpp b/libc/ctype.cpp index db096439..67744fa4 100644 --- a/libc/ctype.cpp +++ b/libc/ctype.cpp @@ -64,3 +64,17 @@ int isxdigit(int c) { return isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); } + +int toupper(int c) +{ + if (!islower(c)) + return c; + return 'A' + (c - 'a'); +} + +int tolower(int c) +{ + if (!isupper(c)) + return c; + return 'a' + (c - 'A'); +} diff --git a/libc/include/ctype.h b/libc/include/ctype.h index d2672fae..e569165c 100644 --- a/libc/include/ctype.h +++ b/libc/include/ctype.h @@ -18,4 +18,7 @@ int isspace(int); int isupper(int); int isxdigit(int); +int toupper(int); +int tolower(int); + __END_DECLS \ No newline at end of file