1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00
freebsd/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