d6b0035a32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "strdup.h" #include <string.h> #include <stdlib.h> char *strdup(const char *s ) { char *p; if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL ) return( NULL ); strcpy( p, s ); return( p ); }