flag fields are u_int's
[unix-history] / usr / src / lib / libc / string / rindex.c
CommitLineData
cc9bb0ce 1/*
ca063491
KB
2 * Copyright (c) 1988 Regents of the University of California.
3 * All rights reserved.
4 *
019bea33 5 * %sccs.include.redist.c%
b8f253e8 6 */
cc9bb0ce 7
ca063491 8#if defined(LIBC_SCCS) && !defined(lint)
46b5f26a 9static char sccsid[] = "@(#)rindex.c 5.9 (Berkeley) %G%";
ca063491
KB
10#endif /* LIBC_SCCS and not lint */
11
147b6c31 12#include <stddef.h>
336401ac 13#include <string.h>
cc9bb0ce
BJ
14
15char *
f93223d8
KB
16#ifdef STRRCHR
17strrchr(p, ch)
18#else
ca063491 19rindex(p, ch)
f93223d8 20#endif
46b5f26a 21 register const char *p, ch;
cc9bb0ce 22{
ca063491 23 register char *save;
cc9bb0ce 24
ca063491
KB
25 for (save = NULL;; ++p) {
26 if (*p == ch)
46b5f26a 27 save = (char *)p;
ca063491
KB
28 if (!*p)
29 return(save);
30 }
31 /* NOTREACHED */
cc9bb0ce 32}