From 807b5f2f3530824257ec0e2a25be2ab3cb3d4105 Mon Sep 17 00:00:00 2001 From: zeusk Date: Mon, 12 Nov 2012 17:50:41 +0530 Subject: [libc] Add implementation for isgraph and iscntrl --- lib/libc/ctype.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/libc/ctype.c') diff --git a/lib/libc/ctype.c b/lib/libc/ctype.c index 845440e9..06f12557 100644 --- a/lib/libc/ctype.c +++ b/lib/libc/ctype.c @@ -24,8 +24,6 @@ #if 0 /* XXX unimplemented for now */ -int iscntrl(int c); -int isgraph(int c); int ispunct(int c); #endif @@ -69,6 +67,16 @@ int isxdigit(int c) return isdigit(c) || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F')); } +int isgraph(int c) +{ + return ((c > ' ') && (c < 0x7f)); +} + +int iscntrl(int c) +{ + return ((c < ' ') || (c == 0x7f)); +} + int isprint(int c) { return ((c >= 0x20) && (c < 0x7f)); -- cgit v1.2.3