summaryrefslogtreecommitdiff
path: root/sys/libkern/index.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1999-11-21 04:26:48 +0000
committerPeter Wemm <peter@FreeBSD.org>1999-11-21 04:26:48 +0000
commit95dc37f68d1fedfe9337dae87159a3baa015e292 (patch)
tree408c546667ad68d073b739a9fae743a2cc3c218a /sys/libkern/index.c
parent75099bed2f0fdb0295ab681224020ffff8068ea3 (diff)
Notes
Diffstat (limited to 'sys/libkern/index.c')
-rw-r--r--sys/libkern/index.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/libkern/index.c b/sys/libkern/index.c
index 63512232fa2f..b22341cd2253 100644
--- a/sys/libkern/index.c
+++ b/sys/libkern/index.c
@@ -33,21 +33,33 @@
* $FreeBSD$
*/
-#include <string.h>
+#include <sys/param.h>
+#include <sys/libkern.h>
char *
-#ifdef STRCHR
-strchr(p, ch)
-#else
index(p, ch)
-#endif
- register const char *p, ch;
+ char *p;
+ int ch;
{
for (;; ++p) {
if (*p == ch)
- return((char *)p);
+ return(p);
if (!*p)
- return((char *)NULL);
+ return(NULL);
+ }
+ /* NOTREACHED */
+}
+
+const char *
+c_index(p, ch)
+ const char *p;
+ int ch;
+{
+ for (;; ++p) {
+ if (*p == ch)
+ return(p);
+ if (!*p)
+ return(NULL);
}
/* NOTREACHED */
}