c760b85021e4bd5a79fb972547b1ca46be9143a2
[reactos.git] / lib / string / memccpy.c
1 /*
2  * $Id$
3  */
4
5 #include <string.h>
6
7
8 void *
9 _memccpy (void *to, const void *from,int c,size_t count)
10 {
11   char t;
12   size_t i;
13   char *dst=(char*)to;
14   const char *src=(const char*)from;
15
16   for ( i = 0; i < count; i++ )
17   {
18     dst[i] = t = src[i];
19     if ( t == '\0' )
20       break;
21     if ( t == c )
22       return &dst[i+1];
23   }
24   return NULL; /* didn't copy c */
25 }