diff --git a/include/ctype.h b/include/ctype.h index b76ea42ca1..3beff884c6 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -143,7 +143,7 @@ int isgraph(int c); #ifdef __cplusplus static inline int iscntrl(int c) { - return !isprint(c); + return c < 0x20 || c == 0x7f; } #else int iscntrl(int c); diff --git a/libs/libc/ctype/lib_iscntrl.c b/libs/libc/ctype/lib_iscntrl.c index 410377b193..697b3d4829 100644 --- a/libs/libc/ctype/lib_iscntrl.c +++ b/libs/libc/ctype/lib_iscntrl.c @@ -30,5 +30,5 @@ int iscntrl(int c) { - return !isprint(c); + return c < 0x20 || c == 0x7f; }