diff options
Diffstat (limited to 'contrib/ntp/libntp/strdup.c')
-rw-r--r-- | contrib/ntp/libntp/strdup.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/ntp/libntp/strdup.c b/contrib/ntp/libntp/strdup.c new file mode 100644 index 0000000..08ffc2f --- /dev/null +++ b/contrib/ntp/libntp/strdup.c @@ -0,0 +1,20 @@ + +#define NULL 0 + +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); +} |