strcasecmp.c 491 B

1234567891011121314151617181920212223242526
  1. /*
  2. * linux/arch/alpha/lib/strcasecmp.c
  3. */
  4. #include <linux/string.h>
  5. /* We handle nothing here except the C locale. Since this is used in
  6. only one place, on strings known to contain only 7 bit ASCII, this
  7. is ok. */
  8. int strcasecmp(const char *a, const char *b)
  9. {
  10. int ca, cb;
  11. do {
  12. ca = *a++ & 0xff;
  13. cb = *b++ & 0xff;
  14. if (ca >= 'A' && ca <= 'Z')
  15. ca += 'a' - 'A';
  16. if (cb >= 'A' && cb <= 'Z')
  17. cb += 'a' - 'A';
  18. } while (ca == cb && ca != '\0');
  19. return ca - cb;
  20. }