freebsd-nq/contrib/ntp/libntp/strdup.c
2002-10-29 19:58:12 +00:00

29 lines
406 B
C

#include "ntp_malloc.h"
#if !HAVE_STRDUP
#define NULL 0
char *strdup(const char *s);
char *
strdup(
const char *s
)
{
char *cp;
if (s) {
cp = (char *) malloc((unsigned) (strlen(s)+1));
if (cp) {
(void) strcpy(cp, s);
}
} else {
cp = (char *) NULL;
}
return(cp);
}
#else
int strdup_bs;
#endif