xref: /csrg-svn/lib/libc/string/strchr.c (revision 34831)
124155Skre /*
234619Sbostic  * Copyright (c) 1988 Regents of the University of California.
334619Sbostic  * All rights reserved.
424155Skre  *
534619Sbostic  * Redistribution and use in source and binary forms are permitted
6*34831Sbostic  * provided that the above copyright notice and this paragraph are
7*34831Sbostic  * duplicated in all such forms and that any documentation,
8*34831Sbostic  * advertising materials, and other materials related to such
9*34831Sbostic  * distribution and use acknowledge that the software was developed
10*34831Sbostic  * by the University of California, Berkeley.  The name of the
11*34831Sbostic  * University may not be used to endorse or promote products derived
12*34831Sbostic  * from this software without specific prior written permission.
13*34831Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*34831Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*34831Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1624155Skre  */
1724155Skre 
1834619Sbostic #if defined(LIBC_SCCS) && !defined(lint)
19*34831Sbostic static char sccsid[] = "@(#)strchr.c	5.4 (Berkeley) 06/27/88";
2034619Sbostic #endif /* LIBC_SCCS and not lint */
2124155Skre 
2234619Sbostic #ifdef notdef
2334619Sbostic static char sccsid[] = "@(#)index.c	5.3 (Berkeley) 6/2/88";
2434619Sbostic #endif
2534619Sbostic 
2634619Sbostic #include <stdio.h>
2734619Sbostic 
2824155Skre char *
2934619Sbostic strchr(p, ch)
3034619Sbostic 	register char *p, ch;
3124155Skre {
3234619Sbostic 	for (;; ++p) {
3334619Sbostic 		if (*p == ch)
3434619Sbostic 			return(p);
3534619Sbostic 		if (!*p)
3634619Sbostic 			return((char *)NULL);
3734619Sbostic 	}
3834619Sbostic 	/* NOTREACHED */
3924155Skre }
40