EMILE/libunix/strdup.c

21 lines
297 B
C
Raw Normal View History

2005-12-08 06:33:17 +00:00
/*
*
* (c) 2004,2005 Laurent Vivier <Laurent@lvivier.info>
2005-12-08 06:33:17 +00:00
*
*/
#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;
}