strdup - duplicate a string
The strdup() function shall return a pointer to a new string, which is a duplicate of the string pointed to by s1. The returned pointer can be passed to free(). A null pointer is returned if the new string cannot be created.
The strdup() function shall return a pointer to a new string on success. Otherwise, it shall return a null pointer and set errno to indicate the error.
The strdup() function may fail if:
- Storage space available is insufficient.
free() , malloc() , the Base Definitions volume of IEEE Std 1003.1-2001, <string.h>
First released in Issue 4, Version 2.
Moved from X/OPEN UNIX extension to BASE.