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[] = "@(#)memccpy.c 5.5 (Berkeley) 05/15/90"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <string.h> 13 #include <sys/stdc.h> 14 15 void * 16 memccpy(t, f, c, n) 17 register const unsigned char *t, *f; 18 register unsigned char c; 19 register size_t n; 20 { 21 while (--n >= 0) 22 if ((*t++ = *f++) == c) 23 return (t); 24 return (0); 25 } 26