Browse Source

configure.h: HAVE_ISBLANK

This isn't on RHEL4, for example: isascii() and isblank() are not in
C89.
Rusty Russell 15 years ago
parent
commit
082d651ffd
5 changed files with 12 additions and 0 deletions
  1. 2 0
      ccan/str/debug.c
  2. 4 0
      ccan/str/str.h
  3. 2 0
      ccan/str/str_debug.h
  4. 1 0
      config.h
  5. 3 0
      tools/configurator/configurator.c

+ 2 - 0
ccan/str/debug.c

@@ -24,11 +24,13 @@ int str_isascii(int i)
 	return isascii(i);
 }
 
+#if HAVE_ISBLANK
 int str_isblank(int i)
 {
 	assert(i >= -1 && i < 256);
 	return isblank(i);
 }
+#endif
 
 int str_iscntrl(int i)
 {

+ 4 - 0
ccan/str/str.h

@@ -91,10 +91,12 @@ static inline bool cisascii(char c)
 {
 	return isascii((unsigned char)c);
 }
+#if HAVE_ISBLANK
 static inline bool cisblank(char c)
 {
 	return isblank((unsigned char)c);
 }
+#endif
 static inline bool ciscntrl(char c)
 {
 	return iscntrl((unsigned char)c);
@@ -166,7 +168,9 @@ static inline bool cisxdigit(char c)
 #define isalnum(i) str_isalnum(str_check_arg_(i))
 #define isalpha(i) str_isalpha(str_check_arg_(i))
 #define isascii(i) str_isascii(str_check_arg_(i))
+#if HAVE_ISBLANK
 #define isblank(i) str_isblank(str_check_arg_(i))
+#endif
 #define iscntrl(i) str_iscntrl(str_check_arg_(i))
 #define isdigit(i) str_isdigit(str_check_arg_(i))
 #define isgraph(i) str_isgraph(str_check_arg_(i))

+ 2 - 0
ccan/str/str_debug.h

@@ -8,7 +8,9 @@
 int str_isalnum(int i);
 int str_isalpha(int i);
 int str_isascii(int i);
+#if HAVE_ISBLANK
 int str_isblank(int i);
+#endif
 int str_iscntrl(int i);
 int str_isdigit(int i);
 int str_isgraph(int i);

+ 1 - 0
config.h

@@ -31,6 +31,7 @@
 #define HAVE_FOR_LOOP_DECLARATION 0
 #define HAVE_FLEXIBLE_ARRAY_MEMBER 1
 #define HAVE_GETPAGESIZE 1
+#define HAVE_ISBLANK 1
 #define HAVE_LITTLE_ENDIAN 1
 #define HAVE_MEMMEM 1
 #define HAVE_MMAP 1

+ 3 - 0
tools/configurator/configurator.c

@@ -102,6 +102,9 @@ static struct test tests[] = {
 	{ "HAVE_GETPAGESIZE", DEFINES_FUNC, NULL,
 	  "#include <unistd.h>\n"
 	  "static int func(void) { return getpagesize(); }" },
+	{ "HAVE_ISBLANK", DEFINES_FUNC, NULL,
+	  "#include <ctype.h>\n"
+	  "static int func(void) { return isblank(' '); }" },
 	{ "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,
 	  "union { int i; char c[sizeof(int)]; } u;\n"
 	  "u.i = 0x01020304;\n"