aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/libntp/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/libntp/strdup.c')
-rw-r--r--contrib/ntp/libntp/strdup.c20
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 000000000000..08ffc2ff031e
--- /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);
+}