strchr.c 576 B

12345678910111213141516171819202122232425262728293031
  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 Wstrchr wcschr
  10. #else
  11. # define Wstrchr strchr
  12. #endif
  13. Wchar *Wstrchr(register const Wchar *s, Wint c)
  14. {
  15. do {
  16. if (*s == ((Wchar)c)) {
  17. return (Wchar *) s; /* silence the warning */
  18. }
  19. } while (*s++);
  20. return NULL;
  21. }
  22. #ifndef WANT_WIDE
  23. libc_hidden_def(strchr)
  24. # ifdef __UCLIBC_SUSV3_LEGACY__
  25. weak_alias(strchr,index)
  26. # endif
  27. #endif