1 /*- 2 * Copyright (c) 1985 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)index.c 5.3 (Berkeley) 04/24/91"; 10 #endif /* not lint */ 11 12 #include <stdio.h> 13 14 /* 15 * return pointer to character c 16 * 17 * return codes: 18 * NULL - character not found 19 * pointer - pointer to character 20 */ 21 22 char * 23 index(str, c) 24 register char c, *str; 25 { 26 for (; *str != '\0'; str++) { 27 if (*str == c) 28 return str; 29 } 30 31 return NULL; 32 } 33