strcasecmp.c 712 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * linux/arch/xtensa/lib/strcasecmp.c
  3. *
  4. * This file is subject to the terms and conditions of the GNU General
  5. * Public License. See the file "COPYING" in the main directory of
  6. * this archive for more details.
  7. *
  8. * Copyright (C) 2002 Tensilica Inc.
  9. */
  10. #include <linux/string.h>
  11. /* We handle nothing here except the C locale. Since this is used in
  12. only one place, on strings known to contain only 7 bit ASCII, this
  13. is ok. */
  14. int strcasecmp(const char *a, const char *b)
  15. {
  16. int ca, cb;
  17. do {
  18. ca = *a++ & 0xff;
  19. cb = *b++ & 0xff;
  20. if (ca >= 'A' && ca <= 'Z')
  21. ca += 'a' - 'A';
  22. if (cb >= 'A' && cb <= 'Z')
  23. cb += 'a' - 'A';
  24. } while (ca == cb && ca != '\0');
  25. return ca - cb;
  26. }