summaryrefslogtreecommitdiffstats
path: root/libntp/strdup.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2008-08-17 17:37:33 +0000
committerroberto <roberto@FreeBSD.org>2008-08-17 17:37:33 +0000
commit4ded1c1fa0bc21c61f91a2dbe864835986745121 (patch)
tree16d100fbc9dae63888d48b464e471ba0e5065193 /libntp/strdup.c
parent8b5a86d4fda08a9c68231415812edcb26be52f79 (diff)
downloadFreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.zip
FreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.tar.gz
Flatten the dist and various 4.n.n trees in preparation of future ntp imports.
Diffstat (limited to 'libntp/strdup.c')
-rw-r--r--libntp/strdup.c28
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
OpenPOWER on IntegriCloud