summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-23 13:42:45 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-23 13:42:45 +0000
commite306be411d1b43b701ebff14af03f98d4ab27556 (patch)
treee29ac775fcc1300d1336666a3b4824699244639f
parent70b1841fb59ddade872aafcbaff416dd4ebd9a6d (diff)
Support isblank()
-rw-r--r--include/ctype.h2
-rw-r--r--libc/misc/ctype/Makefile2
-rw-r--r--libc/misc/ctype/ctype.c18
-rw-r--r--libc/misc/ctype/ctype_C.c4
4 files changed, 23 insertions, 3 deletions
diff --git a/include/ctype.h b/include/ctype.h
index 8f1bb9d99..a7e397e3d 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -34,6 +34,7 @@ __BEGIN_DECLS
extern int isalnum(int c);
extern int isalpha(int c);
extern int isascii(int c);
+extern int isblank(int c);
extern int iscntrl(int c);
extern int isdigit(int c);
extern int isgraph(int c);
@@ -57,6 +58,7 @@ extern int toupper(int c);
#define isalnum(c) (isalpha(c) || isdigit(c))
#define isalpha(c) (isupper(c) || islower(c))
#define isascii(c) (c > 0 && c <= 0x7f)
+#define isblank(c) (c == ' ' || c == '\t')
#define iscntrl(c) ((c >= 0) && ((c <= 0x1F) || (c == 0x7f)))
#define isdigit(c) (c >= '0' && c <= '9')
#define isgraph(c) (c != ' ' && isprint(c))
diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile
index ee3bfd04e..c329c942c 100644
--- a/libc/misc/ctype/Makefile
+++ b/libc/misc/ctype/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)Rules.mak
MSRC=ctype.c
MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o isgraph.o \
islower.o isprint.o ispunct.o isspace.o isupper.o isxdigit.o \
- isxlower.o isxupper.o toascii.o tolower.o toupper.o
+ isxlower.o isxupper.o toascii.o tolower.o toupper.o isblank.o
ifeq ($(HAS_LOCALE),true)
MOBJ += ctype_C.o
diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c
index 5dc35cc72..a077dbf3c 100644
--- a/libc/misc/ctype/ctype.c
+++ b/libc/misc/ctype/ctype.c
@@ -118,6 +118,15 @@ isspace( int c )
}
#endif
+#ifdef L_isblank
+#undef isblank
+int
+isblank( int c )
+{
+ return (c == ' ' || c == '\t');
+}
+#endif
+
#ifdef L_isupper
#undef isupper
int
@@ -266,6 +275,15 @@ isspace( int c )
}
#endif
+#ifdef L_isblank
+#undef isblank
+int
+isblank( int c )
+{
+ return _UC_ISCTYPE(c, ISblank);
+}
+#endif
+
#ifdef L_isupper
#undef isupper
int
diff --git a/libc/misc/ctype/ctype_C.c b/libc/misc/ctype/ctype_C.c
index 2aa2690b6..190140752 100644
--- a/libc/misc/ctype/ctype_C.c
+++ b/libc/misc/ctype/ctype_C.c
@@ -8,7 +8,7 @@ const unsigned char _uc_ctype_b_C[LOCALE_BUF_SIZE] = {
/* 0x06, 6, 06 */ IScntrl,
/* 0x07, 7, 07 */ IScntrl,
/* 0x08, 8, 010 */ IScntrl,
- /* 0x09, 9, 011 */ IScntrl|ISspace,
+ /* 0x09, 9, 011 */ IScntrl|ISspace|ISblank,
/* 0x0a, 10, 012 */ IScntrl|ISspace,
/* 0x0b, 11, 013 */ IScntrl|ISspace,
/* 0x0c, 12, 014 */ IScntrl|ISspace,
@@ -31,7 +31,7 @@ const unsigned char _uc_ctype_b_C[LOCALE_BUF_SIZE] = {
/* 0x1d, 29, 035 */ IScntrl,
/* 0x1e, 30, 036 */ IScntrl,
/* 0x1f, 31, 037 */ IScntrl,
- /* 0x20, 32, 040 */ ISprint|ISspace,
+ /* 0x20, 32, 040 */ ISprint|ISspace|ISblank,
/* 0x21, 33, 041 */ ISprint|ISpunct,
/* 0x22, 34, 042 */ ISprint|ISpunct,
/* 0x23, 35, 043 */ ISprint|ISpunct,