summaryrefslogtreecommitdiff
path: root/src/lib/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils.c')
-rw-r--r--src/lib/utils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/utils.c b/src/lib/utils.c
index 5744fb7c..49065138 100644
--- a/src/lib/utils.c
+++ b/src/lib/utils.c
@@ -53,3 +53,21 @@ char * strdup(const char * src)
return dst;
}
+
+char * path_strip(char * src)
+{
+ char * dst = NULL;
+
+ if (src == NULL)
+ return NULL;
+
+ dst = src + strlen(src);
+
+ while (dst > src && *dst != '/')
+ --dst;
+
+ if (*dst == '/')
+ ++dst;
+
+ return dst;
+}