Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3.  
  4. void *
  5. memccpy(void *t, const void *f, int c, size_t n)
  6. {
  7.   c &= 0xff;
  8.   if (n)
  9.   {
  10.     unsigned char *tt = (unsigned char *)t;
  11.     const unsigned char *ff = (const unsigned char *)f;
  12.  
  13.     do {
  14.       if ((*tt++ = *ff++) == c)
  15.         return tt;
  16.     } while (--n != 0);
  17.   }
  18.   return 0;
  19. }
  20.