31 #if defined(LIBC_SCCS) && !defined(lint) 32 static char sccsid[] =
"@(#)strdup.c 8.1 (Berkeley) 6/4/93";
34 #include <sys/cdefs.h> 35 __FBSDID(
"$FreeBSD: src/lib/libc/string/strdup.c,v 1.6 2009/02/03 17:58:20 danger Exp $");
48 size_t len =
strlen(str) + 1;
char * strdup(const char *str)
Duplicate the passed in string str.
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
void * malloc(size_t size)
Allocates size bytes of uninitialized storage.
void * memcpy(void *__restrict dest, const void *__restrict src, size_t n)
Copies n characters from the object pointed to by src to the object pointed to by dest.