xref: /csrg-svn/lib/libc/string/index.c (revision 34617)
11969Swnj /*
2*34617Sbostic  * Copyright (c) 1988 Regents of the University of California.
3*34617Sbostic  * All rights reserved.
4*34617Sbostic  *
5*34617Sbostic  * Redistribution and use in source and binary forms are permitted
6*34617Sbostic  * provided that this notice is preserved and that due credit is given
7*34617Sbostic  * to the University of California at Berkeley. The name of the University
8*34617Sbostic  * may not be used to endorse or promote products derived from this
9*34617Sbostic  * software without specific written prior permission. This software
10*34617Sbostic  * is provided ``as is'' without express or implied warranty.
111969Swnj  */
121969Swnj 
13*34617Sbostic #if defined(LIBC_SCCS) && !defined(lint)
14*34617Sbostic static char sccsid[] = "@(#)index.c	5.3 (Berkeley) 06/02/88";
15*34617Sbostic #endif /* LIBC_SCCS and not lint */
161969Swnj 
17*34617Sbostic #include <stdio.h>
18*34617Sbostic 
191969Swnj char *
20*34617Sbostic index(p, ch)
21*34617Sbostic 	register char *p, ch;
221969Swnj {
23*34617Sbostic 	for (;; ++p) {
24*34617Sbostic 		if (*p == ch)
25*34617Sbostic 			return(p);
26*34617Sbostic 		if (!*p)
27*34617Sbostic 			return((char *)NULL);
28*34617Sbostic 	}
29*34617Sbostic 	/* NOTREACHED */
301969Swnj }
31