Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

void* memccpy ( void *  dest,
const void *  src,
int  c,
size_t  n 
)

Copy memory until c is found.

Copies no more than n bytes from memory area src to memory area dest, stopping after the character c is copied and found.

Parameters:
dest pointer to destination area  
src pointer to source area
c terminating byte
n size of destination area
Returns:
Returns a pointer to the next character in dest after c, or NULL if c was not found in the first n characters of src.

Definition at line 52 of file memccpy.c.

Referenced by su_strcat_all().

{
  char *d;
  char const *s;

  if (!src || !dest)
    return dest;

  for (d = dest, s = src; n-- > 0;) {
    if (c == (*d++ = *s++))
      return d;
  }

  return NULL;
}


Generated by  Doxygen 1.6.0   Back to index