summaryrefslogtreecommitdiff
path: root/compat/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/strdup.c')
-rw-r--r--compat/strdup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/compat/strdup.c b/compat/strdup.c
new file mode 100644
index 0000000..e2933a8
--- /dev/null
+++ b/compat/strdup.c
@@ -0,0 +1,19 @@
+/*
+ * Platforms without strdup ?!?!?!
+ */
+
+static char *
+strdup( char const *s )
+{
+ char *cp;
+
+ if (s == NULL)
+ return NULL;
+
+ cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup");
+
+ if (cp != NULL)
+ (void) strcpy(cp, s);
+
+ return cp;
+}