blob: 22f68deaadac0a9e9fea9ecb1112911f7ccdb939 [file] [log] [blame]
/*
* memccpy.c
*
* memccpy()
*/
#include <stddef.h>
#include <string.h>
void *memccpy(void *dst, const void *src, int c, size_t n)
{
char *q = dst;
const char *p = src;
char ch;
while ( n-- ) {
*q++ = ch = *p++;
if ( ch == (char)c )
return q;
}
return NULL; /* No instance of "c" found */
}