diff -ur src.o/sys/compat/opensolaris/kern/opensolaris_string.c src/sys/compat/opensolaris/kern/opensolaris_string.c || exit 0 --- src.o/sys/compat/opensolaris/kern/opensolaris_string.c Fri Apr 6 01:09:06 2007 +++ src/sys/compat/opensolaris/kern/opensolaris_string.c Sat Apr 7 23:07:39 2007 @@ -32,37 +32,6 @@ (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) char * -strchr(const char *s, int c) -{ - char ch; - - ch = c; - for (;; ++s) { - if (*s == ch) - return ((char *)s); - if (*s == '\0') - return (NULL); - } - /* NOTREACHED */ -} - -char * -strrchr(const char *s, int c) -{ - char *save; - char ch; - - ch = c; - for (save = NULL;; ++s) { - if (*s == ch) - save = (char *)s; - if (*s == '\0') - return (save); - } - /* NOTREACHED */ -} - -char * strpbrk(const char *s, const char *b) { const char *p; diff -ur src.o/sys/compat/opensolaris/sys/string.h src/sys/compat/opensolaris/sys/string.h || exit 0 --- src.o/sys/compat/opensolaris/sys/string.h Fri Apr 6 01:09:06 2007 +++ src/sys/compat/opensolaris/sys/string.h Sat Apr 7 23:08:02 2007 @@ -29,8 +29,8 @@ #ifndef _OPENSOLARIS_SYS_STRING_H_ #define _OPENSOLARIS_SYS_STRING_H_ -char *strchr(const char *, int); -char *strrchr(const char *p, int c); +#include + char *strpbrk(const char *, const char *); void strident_canon(char *s, size_t n); diff -ur src.o/sys/libkern/index.c src/sys/libkern/index.c || exit 0 --- src.o/sys/libkern/index.c Wed Apr 7 20:46:10 2004 +++ src/sys/libkern/index.c Sat Apr 7 23:09:16 2007 @@ -33,6 +33,10 @@ #include #include +/* + * index() is also present as the strchr() in the kernel; it does exactly the + * same thing as it's userland equivalent. + */ char * index(p, ch) const char *p; diff -ur src.o/sys/libkern/rindex.c src/sys/libkern/rindex.c || exit 0 --- src.o/sys/libkern/rindex.c Fri Jan 7 00:24:32 2005 +++ src/sys/libkern/rindex.c Sat Apr 7 23:09:26 2007 @@ -33,6 +33,10 @@ #include #include +/* + * rindex() is also present as the strrchr() in the kernel; it does exactly the + * same thing as it's userland equivalent. + */ char * rindex(p, ch) const char *p; diff -ur src.o/sys/sys/libkern.h src/sys/sys/libkern.h || exit 0 --- src.o/sys/sys/libkern.h Thu Nov 2 16:53:26 2006 +++ src/sys/sys/libkern.h Sat Apr 7 23:13:37 2007 @@ -153,6 +153,18 @@ return (b); } +static __inline char * +strchr(const char *p, int ch) +{ + return (index(p, ch)); +} + +static __inline char * +strrchr(const char *p, int ch) +{ + return (rindex(p, ch)); +} + /* fnmatch() return values. */ #define FNM_NOMATCH 1 /* Match failed. */