summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index cde01f4..7dea6aa 100644
--- a/src/util.c
+++ b/src/util.c
@@ -108,3 +108,31 @@ sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, cons
{
qsort_r(base, nmemb, size, compar, compard);
}
+
+char *
+sat_dupjoin(const char *str1, const char *str2, const char *str3)
+{
+ int l1, l2, l3;
+ char *s, *str;
+ l1 = str1 ? strlen(str1) : 0;
+ l2 = str2 ? strlen(str2) : 0;
+ l3 = str3 ? strlen(str3) : 0;
+ s = str = sat_malloc(l1 + l2 + l3 + 1);
+ if (l1)
+ {
+ strcpy(s, str1);
+ s += l1;
+ }
+ if (l2)
+ {
+ strcpy(s, str2);
+ s += l2;
+ }
+ if (l3)
+ {
+ strcpy(s, str3);
+ s += l3;
+ }
+ *s = 0;
+ return str;
+}