/* ============================================================================= memchr.c -- search a string for a character Version 1 -- 1987-06-12 Return the ptr in vp at which the character c appears; NULL if not found in n chars; don't stop at \0. ============================================================================= */ void *memchr(void *vp, char c, int n) { char *cp = vp; while (--n >= 0) if (*cp++ == c) return(--cp); return((void *)0); }