xref: /csrg-svn/lib/libc/string/index.c (revision 42147)
1*42147Sbostic /*-
2*42147Sbostic  * Copyright (c) 1990 The Regents of the University of California.
334617Sbostic  * All rights reserved.
434617Sbostic  *
5*42147Sbostic  * %sccs.include.redist.c%
61969Swnj  */
71969Swnj 
834617Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*42147Sbostic static char sccsid[] = "@(#)index.c	5.5 (Berkeley) 05/16/90";
1034617Sbostic #endif /* LIBC_SCCS and not lint */
111969Swnj 
12*42147Sbostic #include <string.h>
13*42147Sbostic #include <stddef.h>
1434617Sbostic 
151969Swnj char *
1634617Sbostic index(p, ch)
1734617Sbostic 	register char *p, ch;
181969Swnj {
1934617Sbostic 	for (;; ++p) {
2034617Sbostic 		if (*p == ch)
2134617Sbostic 			return(p);
2234617Sbostic 		if (!*p)
2334617Sbostic 			return((char *)NULL);
2434617Sbostic 	}
2534617Sbostic 	/* NOTREACHED */
261969Swnj }
27