summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--configure.ac4
-rw-r--r--src/system.c90
3 files changed, 93 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9edac6f..63dcd87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
 	* Removed standalone/csh support from test.
 	* Added dummy sysconf implementation.
 	* Include system.h for stpcpy in nodes.c.
+	* Added out-of-line ctypes functions for klibc.
 
 2005-10-26  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/configure.ac b/configure.ac
index d361369..db54332 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,8 +23,8 @@ dnl Checks for libraries.
 dnl Checks for header files.
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS(bsearch getpwnam getrlimit killpg mempcpy sigsetmask stpcpy \
-	       strchrnul strsignal strtod strtoimax strtoumax sysconf)
+AC_CHECK_FUNCS(bsearch getpwnam getrlimit isalpha killpg mempcpy sigsetmask \
+	       stpcpy strchrnul strsignal strtod strtoimax strtoumax sysconf)
 
 dnl Check for klibc signal.
 AC_CHECK_FUNC(signal)
diff --git a/src/system.c b/src/system.c
index 4c281ed..c6bc52d 100644
--- a/src/system.c
+++ b/src/system.c
@@ -26,8 +26,37 @@
  * SUCH DAMAGE.
  */
 
+#ifndef HAVE_ISALPHA
+#define isalnum _isalnum
+#define iscntrl _iscntrl
+#define islower _islower
+#define isspace _isspace
+#define isalpha _isalpha
+#define isdigit _isdigit
+#define isprint _isprint
+#define isupper _isupper
+#define isblank _isblank
+#define isgraph _isgraph
+#define ispunct _ispunct
+#define isxdigit _isxdigit
+#include <ctype.h>
+#undef isalnum
+#undef iscntrl
+#undef islower
+#undef isspace
+#undef isalpha
+#undef isdigit
+#undef isprint
+#undef isupper
+#undef isblank
+#undef isgraph
+#undef ispunct
+#undef isxdigit
+#endif
+
 #include <signal.h>
 #include <string.h>
+
 #include "error.h"
 #include "output.h"
 #include "system.h"
@@ -97,3 +126,64 @@ long sysconf(int name)
 	sh_error("no sysconf for: %d", name);
 }
 #endif
+
+#ifndef HAVE_ISALPHA
+int isalnum(int c) {
+	return _isalnum(c);
+}
+
+
+int iscntrl(int c) {
+	return _iscntrl(c);
+}
+
+
+int islower(int c) {
+	return _islower(c);
+}
+
+
+int isspace(int c) {
+	return _isspace(c);
+}
+
+
+int isalpha(int c) {
+	return _isalpha(c);
+}
+
+
+int isdigit(int c) {
+	return _isdigit(c);
+}
+
+
+int isprint(int c) {
+	return _isprint(c);
+}
+
+
+int isupper(int c) {
+	return _isupper(c);
+}
+
+
+int isblank(int c) {
+	return _isblank(c);
+}
+
+
+int isgraph(int c) {
+	return _isgraph(c);
+}
+
+
+int ispunct(int c) {
+	return _ispunct(c);
+}
+
+
+int isxdigit(int c) {
+	return _isxdigit(c);
+}
+#endif