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