xref: /csrg-svn/lib/libc/string/memccpy.c (revision 41958)
1*41958Sbostic /*-
2*41958Sbostic  * Copyright (c) 1990 The Regents of the University of California.
334479Sbostic  * All rights reserved.
434479Sbostic  *
5*41958Sbostic  * %sccs.include.redist.c%
624194Skre  */
724194Skre 
826525Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*41958Sbostic static char sccsid[] = "@(#)memccpy.c	5.5 (Berkeley) 05/15/90";
1034479Sbostic #endif /* LIBC_SCCS and not lint */
1124194Skre 
12*41958Sbostic #include <string.h>
13*41958Sbostic #include <sys/stdc.h>
1424194Skre 
15*41958Sbostic void *
1624194Skre memccpy(t, f, c, n)
17*41958Sbostic 	register const unsigned char *t, *f;
18*41958Sbostic 	register unsigned char c;
19*41958Sbostic 	register size_t n;
2024194Skre {
2124194Skre 	while (--n >= 0)
2224194Skre 		if ((*t++ = *f++) == c)
2324194Skre 			return (t);
2424194Skre 	return (0);
2524194Skre }
26