diff options
Diffstat (limited to 'mdk-stage1/dietlibc/lib/strncasecmp.c')
-rw-r--r-- | mdk-stage1/dietlibc/lib/strncasecmp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mdk-stage1/dietlibc/lib/strncasecmp.c b/mdk-stage1/dietlibc/lib/strncasecmp.c new file mode 100644 index 000000000..8a5445e53 --- /dev/null +++ b/mdk-stage1/dietlibc/lib/strncasecmp.c @@ -0,0 +1,18 @@ +#include <ctype.h> +#include <sys/types.h> +#include <string.h> + +int strncasecmp(const char *s, const char *t, size_t n) { + register char x; + register const char* u=s+n; + for (;;) { + x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; +#ifndef WANT_SMALL_STRING_ROUTINES + x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; + x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; + x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; +#endif + } + return ((int)(unsigned int)(unsigned char) x) + - ((int)(unsigned int)(unsigned char) *t); +} |