strrchr.c 647 B

1234567891011121314151617181920212223242526272829303132333435
  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. libc_hidden_proto(strrchr)
  12. # define Wstrrchr strrchr
  13. #endif
  14. Wchar *Wstrrchr(register const Wchar *s, Wint c)
  15. {
  16. register const Wchar *p;
  17. p = NULL;
  18. do {
  19. if (*s == (Wchar) c) {
  20. p = s;
  21. }
  22. } while (*s++);
  23. return (Wchar *) p; /* silence the warning */
  24. }
  25. #ifndef WANT_WIDE
  26. libc_hidden_def(strrchr)
  27. # ifdef __UCLIBC_SUSV3_LEGACY__
  28. strong_alias(strrchr,rindex)
  29. # endif
  30. #endif