strncasecmp.c 483 B

12345678910111213141516171819202122232425262728
  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
  8. strncasecmp(s, d, l)
  9. char *s;
  10. char *d;
  11. size_t l;
  12. {
  13. while(l>0)
  14. {
  15. if( *s != *d )
  16. {
  17. if( tolower(*s) != tolower(*d) )
  18. return *s - *d;
  19. }
  20. else
  21. if( *s == '\0' ) return 0;
  22. s++; d++; l--;
  23. }
  24. return 0;
  25. }