xref: /original-bsd/lib/libc/string/index.c (revision 2ad443ff)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)index.c	5.5 (Berkeley) 05/16/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <string.h>
13 #include <stddef.h>
14 
15 char *
16 index(p, ch)
17 	register char *p, ch;
18 {
19 	for (;; ++p) {
20 		if (*p == ch)
21 			return(p);
22 		if (!*p)
23 			return((char *)NULL);
24 	}
25 	/* NOTREACHED */
26 }
27