From 8706dedec7fbd1555df0fd72e0c65457ea039735 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 29 Oct 2005 22:11:56 +1000 Subject: [SYSTEM] Added out-of-line ctypes functions for klibc Unfortunately klibc doesn't provide out-of-line versions of ctypes functions such as isalpha. This is a nasty hack to create them. --- ChangeLog | 1 + configure.ac | 4 +-- src/system.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 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 +#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 #include + #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 -- cgit 1.4.1 ef='/src/commit/bin/downgrade.c?id=2f6cd6f79992a28b6908b03844050a0bd251b7bf&follow=1'>Pledge downgradeJune McEnroe 2021-09-24Set original socket CLOEXECJune McEnroe 2021-09-24Consume request headers using MSG_PEEKJune McEnroe 2021-09-24Set only HTTP_HOSTJune McEnroe 2021-09-23Scroll by single lines in xtermJune McEnroe 2021-09-23Hide htop "function bar"June McEnroe 2021-09-23Allow FocusEvents in xtermJune McEnroe 2021-09-23Use NI_NUMERICSERVJune McEnroe 2021-09-23Make up build away from FreeBSDJune McEnroe 2021-09-23Add quickJune McEnroe 2021-09-23Add The HobbitJune McEnroe 2021-09-22Remove PSF fontsJune McEnroe 2021-09-22Remove Linux-specific utilitiesJune McEnroe 2021-09-22Call sandbox in CGI modeJune McEnroe 2021-09-22Support HTTP PUT in upJune McEnroe 2021-09-22Remove default faviconJune McEnroe 2021-09-21Use Z_FILTERED strategyJune McEnroe 2021-09-21Recalculate various lengths only as neededJune McEnroe 2021-09-21Rewrite pngo, add explicit optionsJune McEnroe 2021-09-16Fix /* **/ comment matchingJune McEnroe 2021-09-15Remove typer, add downgrade to READMEJune McEnroe 2021-09-15Set bot mode on downgradeJune McEnroe 2021-09-15Enter capsicum in downgradeJune McEnroe 2021-09-15Factor out common parts of downgrade messagesJune McEnroe 2021-09-14Add downgrade IRC botJune McEnroe 2021-09-14Sort by title if authors matchJune McEnroe 2021-09-13Swap-remove tags as they're foundJune McEnroe 2021-09-12Replace htagml regex with strncmpJune McEnroe 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe