strdup.c revision 106163
1106163Sroberto#include "ntp_malloc.h" 282498Sroberto 3106163Sroberto#if !HAVE_STRDUP 4106163Sroberto 582498Sroberto#define NULL 0 682498Sroberto 7106163Srobertochar *strdup(const char *s); 8106163Sroberto 982498Srobertochar * 1082498Srobertostrdup( 1182498Sroberto const char *s 1282498Sroberto ) 1382498Sroberto{ 1482498Sroberto char *cp; 1582498Sroberto 1682498Sroberto if (s) { 1782498Sroberto cp = (char *) malloc((unsigned) (strlen(s)+1)); 1882498Sroberto if (cp) { 1982498Sroberto (void) strcpy(cp, s); 2082498Sroberto } 2182498Sroberto } else { 2282498Sroberto cp = (char *) NULL; 2382498Sroberto } 2482498Sroberto return(cp); 2582498Sroberto} 26106163Sroberto#else 27106163Srobertoint strdup_bs; 28106163Sroberto#endif 29