Back to index

nagios-plugins  1.4.16
strndup.c File Reference
#include <config.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.


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

Function Documentation

char* strndup ( char const s,
size_t  n 

Definition at line 27 of file strndup.c.

  size_t len = strnlen (s, n);
  char *new = malloc (len + 1);

  if (new == NULL)
    return NULL;

  new[len] = '\0';
  return memcpy (new, s, len);

Here is the call graph for this function:

Here is the caller graph for this function: