Logo Search packages:      
Sourcecode: xbuffy version File versions  Download package

strdup.c


/* strdup.c - a stupid homebrew strdup() */

#include <stdio.h>
#include <strings.h>
#include <malloc.h>

char *strdup(char *s1)
{
      char *s2;

      if (s1 == NULL)
      {
            return (NULL);
      }
      if ((s2 = (char *) malloc(strlen(s1) + 1)) != NULL)
      {
            strcpy(s2, s1);
            return (s2);
      }
      return (NULL);
}

Generated by  Doxygen 1.6.0   Back to index