1 /* strdup() replacement (from stdwin, if you must know) */ 2 3 char * strdup(const char * str)4 strdup(const char *str) 5 { 6 if (str != NULL) { 7 char *copy = malloc(strlen(str) + 1); 8 if (copy != NULL) 9 return strcpy(copy, str); 10 } 11 return NULL; 12 } 13