Back to index

cell-binutils  2.17cvs20070401
Functions
strndup.c File Reference
#include "ansidecl.h"
#include <stddef.h>

Go to the source code of this file.

Functions

size_t strlen (const char *)
PTR malloc (size_t)
PTR memcpy (PTR, const PTR, size_t)
char * strndup (const char *s, size_t n)

Function Documentation

PTR malloc ( size_t  )
PTR memcpy ( PTR  ,
const PTR  ,
size_t   
)

Definition at line 21 of file memcpy.c.

{
    bcopy(in, out, length);
    return out;
}

Here is the call graph for this function:

size_t strlen ( const char *  )
char* strndup ( const char *  s,
size_t  n 
)

Definition at line 41 of file strndup.c.

{
  char *result;
  size_t len = strlen (s);

  if (n < len)
    len = n;

  result = (char *) malloc (len + 1);
  if (!result)
    return 0;

  result[len] = '\0';
  return (char *) memcpy (result, s, len);
}

Here is the call graph for this function: