1 /* 2 Copyright (c) 2002 Jeff Johnston <jjohnstn@redhat.com> 3 */ 4 #ifndef _REENT_ONLY 5 6 #include <stdlib.h> 7 #include <string.h> 8 9 char * strdup(const char * str)10strdup (const char *str) 11 { 12 size_t len = strlen (str) + 1; 13 char *copy = malloc (len); 14 if (copy) 15 { 16 memcpy (copy, str, len); 17 } 18 return copy; 19 } 20 21 #endif /* !_REENT_ONLY */ 22