Files
codezero/libs/c/src/strdup.c
Bahadir Balban e2b791a3d8 Initial commit
2008-01-13 13:53:52 +00:00

16 lines
200 B
C

#define _USE_XOPEN
#include <string.h>
#include <stdlib.h>
char *
strdup(const char *s)
{
int len = strlen(s);
char *d;
d = malloc(len);
if (d == NULL)
return NULL;
strcpy(d, s);
return d;
}