diff options
Diffstat (limited to 'lib/libc/string/index.c')
| -rw-r--r-- | lib/libc/string/index.c | 20 | 
1 files changed, 12 insertions, 8 deletions
| diff --git a/lib/libc/string/index.c b/lib/libc/string/index.c index 7eaf3d71de86..c81f95b0989b 100644 --- a/lib/libc/string/index.c +++ b/lib/libc/string/index.c @@ -37,22 +37,26 @@ static char sccsid[] = "@(#)index.c	8.1 (Berkeley) 6/4/93";  #include <sys/cdefs.h>  __FBSDID("$FreeBSD$"); -#include <string.h>  #include <stddef.h> -char *  #ifdef STRCHR -strchr(p, ch) +#include <string.h> + +char * +strchr  #else -index(p, ch) +#include <strings.h> + +char * +index  #endif -	const char *p, ch; +(const char *p, int ch)  {  	for (;; ++p) {  		if (*p == ch) -			return((char *)p); -		if (!*p) -			return((char *)NULL); +			return ((char *)p); +		if (*p == '\0') +			return (NULL);  	}  	/* NOTREACHED */  } | 
