1 #include <u.h> 2 #include <libc.h> 3 4 void* memccpy(void * a1,void * a2,int c,ulong n)5 memccpy(void *a1, void *a2, int c, ulong n) 6 { 7 uchar *s1, *s2; 8 9 s1 = a1; 10 s2 = a2; 11 c &= 0xFF; 12 while(n > 0) { 13 if((*s1++ = *s2++) == c) 14 return s1; 15 n--; 16 } 17 return 0; 18 } 19