freebsd-dev/contrib/ntp/libntp/strdup.c

29 lines
406 B
C
Raw Normal View History

2002-10-29 19:58:12 +00:00
#include "ntp_malloc.h"
#if !HAVE_STRDUP
2001-08-29 14:35:15 +00:00
#define NULL 0
2002-10-29 19:58:12 +00:00
char *strdup(const char *s);
2001-08-29 14:35:15 +00:00
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);
}
2002-10-29 19:58:12 +00:00
#else
int strdup_bs;
#endif