xref: /csrg-svn/lib/libc/string/memccpy.c (revision 34479)
124194Skre /*
224194Skre  * Copyright (c) 1985 Regents of the University of California.
3*34479Sbostic  * All rights reserved.
4*34479Sbostic  *
5*34479Sbostic  * Redistribution and use in source and binary forms are permitted
6*34479Sbostic  * provided that this notice is preserved and that due credit is given
7*34479Sbostic  * to the University of California at Berkeley. The name of the University
8*34479Sbostic  * may not be used to endorse or promote products derived from this
9*34479Sbostic  * software without specific written prior permission. This software
10*34479Sbostic  * is provided ``as is'' without express or implied warranty.
1124194Skre  */
1224194Skre 
1326525Sdonn #if defined(LIBC_SCCS) && !defined(lint)
14*34479Sbostic static char sccsid[] = "@(#)memccpy.c	5.3 (Berkeley) 05/25/88";
15*34479Sbostic #endif /* LIBC_SCCS and not lint */
1624194Skre 
1724194Skre 
1824194Skre char *
1924194Skre memccpy(t, f, c, n)
2024194Skre 	register char *t, *f;
2124194Skre 	register c, n;
2224194Skre {
2324194Skre 	while (--n >= 0)
2424194Skre 		if ((*t++ = *f++) == c)
2524194Skre 			return (t);
2624194Skre 	return (0);
2724194Skre }
28