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.6 (Berkeley) 06/23/90"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <string.h> 13 #include <stddef.h> 14 15 char * 16 #ifdef STRCHR 17 strchr(p, ch) 18 #else 19 index(p, ch) 20 #endif 21 register char *p, ch; 22 { 23 for (;; ++p) { 24 if (*p == ch) 25 return(p); 26 if (!*p) 27 return((char *)NULL); 28 } 29 /* NOTREACHED */ 30 } 31