strchr.c 608 B

1234567891011121314151617181920212223242526272829303132
  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. libc_hidden_proto(Wstrchr)
  14. Wchar *Wstrchr(register const Wchar *s, Wint c)
  15. {
  16. do {
  17. if (*s == ((Wchar)c)) {
  18. return (Wchar *) s; /* silence the warning */
  19. }
  20. } while (*s++);
  21. return NULL;
  22. }
  23. libc_hidden_def(Wstrchr)
  24. #if !defined WANT_WIDE && defined __UCLIBC_SUSV3_LEGACY__
  25. strong_alias(strchr,index)
  26. #endif