diff options
Diffstat (limited to 'libntp/strdup.c')
-rw-r--r-- | libntp/strdup.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libntp/strdup.c b/libntp/strdup.c new file mode 100644 index 0000000..2e26ba7 --- /dev/null +++ b/libntp/strdup.c @@ -0,0 +1,28 @@ +#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 |