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