aboutsummaryrefslogtreecommitdiffstats
path: root/support.c
diff options
context:
space:
mode:
Diffstat (limited to 'support.c')
-rw-r--r--support.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/support.c b/support.c
index 28297e418..d7c196a94 100644
--- a/support.c
+++ b/support.c
@@ -68,6 +68,34 @@ lowerstr(char *str)
return str;
}
+
+char *
+concat_path(char *p1, char *p2)
+{
+ size_t size;
+ char *path;
+ char append_slash = 0;
+
+ size = strlen(p1);
+ if( size==0 || p1[size-1]!='/' )
+ {
+ size++;
+ append_slash = 1;
+ }
+ size += strlen(p2);
+ size++;
+
+ path = calloc(size, sizeof(char));
+ strncpy(path, p1, size);
+ if( append_slash )
+ strncat(path, "/", size);
+ strncat(path, p2, size);
+
+ return path;
+}
+
+
+
#ifndef HAVE_BASENAME
char *
basename(char *path)