EMILE/libunix/strdup.c
Laurent Vivier 7a9f9c00e7 add strdup()
2005-12-08 06:33:17 +00:00

21 lines
301 B
C

/*
*
* (c) 2004,2005 Laurent Vivier <LaurentVivier@wanadoo.fr>
*
*/
#include <stdlib.h>
#include <string.h>
char *strdup (__const char *__restrict __src)
{
char *__dest;
__dest = (char*)malloc(strlen(__src) + 1);
if (__dest == NULL)
return NULL;
strcpy(__dest, __src);
return __dest;
}