strncasecmp.c 492 B

1234567891011121314151617181920212223
  1. /* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
  2. * This file is part of the Linux-8086 C library and is distributed
  3. * under the GNU Library General Public License.
  4. */
  5. #include <string.h>
  6. #include <ctype.h>
  7. int strncasecmp (const char *a, const char *b, size_t len)
  8. {
  9. register int n;
  10. if (len < 1)
  11. return 0;
  12. while (*a == *b || (n = tolower (*a) - tolower (*b)) == 0)
  13. {
  14. if (*a == '\0' || --len < 1)
  15. return 0;
  16. a++, b++;
  17. }
  18. return n;
  19. }