summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/rindex.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/rindex.c')
-rw-r--r--lib/libc/string/rindex.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/libc/string/rindex.c b/lib/libc/string/rindex.c
index 1b08dd1..d0be32e 100644
--- a/lib/libc/string/rindex.c
+++ b/lib/libc/string/rindex.c
@@ -38,24 +38,27 @@ static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
__FBSDID("$FreeBSD$");
#include <stddef.h>
+
+#ifdef STRRCHR
#include <string.h>
char *
-#ifdef STRRCHR
-strrchr(p, ch)
+strrchr
#else
-rindex(p, ch)
+#include <strings.h>
+
+char *
+rindex
#endif
- const char *p;
- int ch;
+(const char *p, int ch)
{
char *save;
for (save = NULL;; ++p) {
if (*p == ch)
save = (char *)p;
- if (!*p)
- return(save);
+ if (*p == '\0')
+ return (save);
}
/* NOTREACHED */
}
OpenPOWER on IntegriCloud