Skip to content

Commit 38f6fd0

Browse files
committed
libc: minimal: Add an implementation of iscntrl()
Implement the iscntrl() function, which returns whether a character is a control one or not. Ref: https://en.cppreference.com/w/c/string/byte/iscntrl Signed-off-by: Carles Cufi <[email protected]>
1 parent 69311cc commit 38f6fd0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/libc/minimal/include/ctype.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ static inline int isalnum(int chr)
6969
return (int)(isalpha(chr) || isdigit(chr));
7070
}
7171

72+
static inline int iscntrl(int c)
73+
{
74+
return (int)((((unsigned int)c) <= 31U) || (((unsigned int)c) == 127U));
75+
}
76+
7277
#ifdef __cplusplus
7378
}
7479
#endif

0 commit comments

Comments
 (0)