diff --git a/include/ctype.h b/include/ctype.h index b76ea42ca1e..75e7a77dbfb 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 410377b193e..7f8c44ae06b 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; }