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 <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2021-09-20 13:19:03 +02:00 committed by Carles Cufí
parent 69311ccc3d
commit 38f6fd05bf

View file

@ -69,6 +69,11 @@ static inline int isalnum(int chr)
return (int)(isalpha(chr) || isdigit(chr));
}
static inline int iscntrl(int c)
{
return (int)((((unsigned int)c) <= 31U) || (((unsigned int)c) == 127U));
}
#ifdef __cplusplus
}
#endif