141958Sbostic /*- 241958Sbostic * Copyright (c) 1990 The Regents of the University of California. 334479Sbostic * All rights reserved. 434479Sbostic * 541958Sbostic * %sccs.include.redist.c% 624194Skre */ 724194Skre 826525Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*46144Sbostic static char sccsid[] = "@(#)memccpy.c 5.7 (Berkeley) 01/26/91"; 1034479Sbostic #endif /* LIBC_SCCS and not lint */ 1124194Skre 12*46144Sbostic #include <sys/cdefs.h> 1341958Sbostic #include <string.h> 1424194Skre 1541958Sbostic void * 1624194Skre memccpy(t, f, c, n) 1742447Sbostic void *t; 1842447Sbostic const void *f; 1942447Sbostic int c; 2041958Sbostic register size_t n; 2124194Skre { 2242447Sbostic 2342447Sbostic if (n) { 2442447Sbostic register unsigned char *t; 2542447Sbostic register const unsigned char *f; 2642447Sbostic register unsigned char ch = c; 2742447Sbostic 2842447Sbostic do { 2942447Sbostic if ((*t++ = *f++) == c) 3042447Sbostic return (t); 3142447Sbostic } while (--n != 0); 3242447Sbostic } 3324194Skre return (0); 3424194Skre } 35