summaryrefslogtreecommitdiff
path: root/libc/string/strchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/strchr.c')
-rw-r--r--libc/string/strchr.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/libc/string/strchr.c b/libc/string/strchr.c
index a58e1f56d..478e4967c 100644
--- a/libc/string/strchr.c
+++ b/libc/string/strchr.c
@@ -1,16 +1,33 @@
/*
+ * Copyright (C) 2002 Manuel Novoa III
* Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define L_strchr
-#define Wstrchr __strchr
+#include "_string.h"
-#include "wstring.c"
+#ifdef WANT_WIDE
+# define __Wstrchr __wcschr
+# define Wstrchr wcschr
+#else
+# define __Wstrchr __strchr
+# define Wstrchr strchr
+#endif
-strong_alias(__strchr, strchr)
+Wchar attribute_hidden *__Wstrchr(register const Wchar *s, Wint c)
+{
+ do {
+ if (*s == ((Wchar)c)) {
+ return (Wchar *) s; /* silence the warning */
+ }
+ } while (*s++);
-weak_alias(strchr, index)
+ return NULL;
+}
-#undef L_strchr
+strong_alias(__strchr,strchr)
+
+#ifndef WANT_WIDE
+strong_alias(__strchr,index)
+#endif