strdupcat master
strdupcat

file:b/strdupcat.c (new)
--- /dev/null
+++ b/strdupcat.c
@@ -1,1 +1,43 @@
+/*
+** strdupcat.c - Concatenates 2 strings i a new one
+**
+** (C) 2013 - Frank Villaro-Dixon <Frank@Villaro-Dixon.eu>
+*/
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+char *
+strdupcat(char *str, char *str2);
+
+char *
+strdupcat(char *str, char *str2)
+{
+	char *ret;
+	size_t len;
+
+	if(str && *str)
+		len = strlen(str);
+	else
+		return strdup(str2);
+
+	if(str2 && *str2)
+		len += strlen(str2);
+	else
+		return strdup(str);
+
+	len += 1;
+
+	if((ret = calloc(len, sizeof(*ret))) == NULL)
+		return NULL;
+
+	strcpy(ret, str);
+	strcat(ret, str2);
+
+	return ret;
+}
+
+
+