strrchr.c 619 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include "_string.h"
  8. #ifdef WANT_WIDE
  9. # define Wstrrchr wcsrchr
  10. #else
  11. # define Wstrrchr strrchr
  12. #endif
  13. Wchar *Wstrrchr(register const Wchar *s, Wint c)
  14. {
  15. register const Wchar *p;
  16. p = NULL;
  17. do {
  18. if (*s == (Wchar) c) {
  19. p = s;
  20. }
  21. } while (*s++);
  22. return (Wchar *) p; /* silence the warning */
  23. }
  24. #ifndef WANT_WIDE
  25. libc_hidden_weak(strrchr)
  26. # ifdef __UCLIBC_SUSV3_LEGACY__
  27. weak_alias(strrchr,rindex)
  28. # endif
  29. #endif