diff options
| author | Robert Drehmel <robert@FreeBSD.org> | 2002-08-30 19:42:07 +0000 |
|---|---|---|
| committer | Robert Drehmel <robert@FreeBSD.org> | 2002-08-30 19:42:07 +0000 |
| commit | 425289a9db71798c280b36e39f1a29d79dfd8ed3 (patch) | |
| tree | 73cc35c843328d5541c417f0803442e2f6f05d29 /lib/libc/string/index.c | |
| parent | 554331bbb9fe7d143663402be8c0a7bd3e7a35cc (diff) | |
Notes
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 */ } |
