strcasecmp.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * strcasecmp for uClibc
  3. * Copyright (C) 2002 by Brian Stafford <brian@stafford.uklinux.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU Library General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  13. * for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this program; if not, write to the Free Software Foundation,
  17. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <string.h>
  20. #include <ctype.h>
  21. int strcasecmp (const char *a, const char *b)
  22. {
  23. register int n;
  24. while (*a == *b || (n = tolower (*a) - tolower (*b)) == 0)
  25. {
  26. if (*a == '\0')
  27. return 0;
  28. a++, b++;
  29. }
  30. return n;
  31. }