diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-12-02 09:01:21 +0000 |
---|---|---|
committer | <> | 2014-12-04 16:11:25 +0000 |
commit | bdab5265fcbf3f472545073a23f8999749a9f2b9 (patch) | |
tree | c6018dd03dea906f8f1fb5f105f05b71a7dc250a /libntp/strdup.c | |
download | ntp-dev-4.2.7p482.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
Diffstat (limited to 'libntp/strdup.c')
-rw-r--r-- | libntp/strdup.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libntp/strdup.c b/libntp/strdup.c new file mode 100644 index 0000000..f7565a2 --- /dev/null +++ b/libntp/strdup.c @@ -0,0 +1,30 @@ +#include <config.h> + +#include <string.h> +#include "ntp_malloc.h" + +#ifndef HAVE_STRDUP + +char *strdup(const char *s); + +char * +strdup( + const char *s + ) +{ + size_t octets; + char * cp; + + if (s) { + octets = 1 + strlen(s); + cp = malloc(octets); + if (NULL != cp) + memcpy(cp, s, octets); + else + cp = NULL; + + return(cp); +} +#else +int strdup_c_nonempty_compilation_unit; +#endif |