diff options
author | Paul Smith <psmith@gnu.org> | 2010-07-19 07:10:53 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2010-07-19 07:10:53 +0000 |
commit | fba20a776da6d4a36db21d9b21e9e937bef00ac3 (patch) | |
tree | 4cf2063962595ca40234d4832a00f7eeb7ebb321 /misc.c | |
parent | df2fa7c5a5726b4e0a50e0eff209a3518ab19603 (diff) | |
download | gunmake-fba20a776da6d4a36db21d9b21e9e937bef00ac3.tar.gz |
- Many fixup patches from Savannah.
- Fix the test suite on Solaris (from Boris)
- Update the manual for .ONESHELL
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -614,6 +614,34 @@ strcasecmp (const char *s1, const char *s2) } } #endif + +#if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI + +/* If we don't have strncasecmp() (from POSIX), or anything that can + substitute for it, define our own version. */ + +int +strncasecmp (const char *s1, const char *s2, int n) +{ + while (n-- > 0) + { + int c1 = (int) *(s1++); + int c2 = (int) *(s2++); + + if (isalpha (c1)) + c1 = tolower (c1); + if (isalpha (c2)) + c2 = tolower (c2); + + if (c1 != '\0' && c1 == c2) + continue; + + return (c1 - c2); + } + + return 0; +} +#endif #ifdef GETLOADAVG_PRIVILEGED |