summaryrefslogtreecommitdiff
path: root/compat/strdup.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2012-08-11 16:45:31 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-10-18 12:43:06 +0000
commit7c432b265ed7ca5f8304938db73912df8ce35032 (patch)
treec95de7bee7b742ed92b9924d904adca706e48d80 /compat/strdup.c
downloadautogen-master.tar.gz
Imported from /srv/lorry/lorry-area/autogen/autogen-5.16.2.tar.gz.HEADautogen-5.16.2master
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;
+}