aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 2a9d4a4..a968159 100644
--- a/utils.c
+++ b/utils.c
@@ -29,6 +29,23 @@
#include "log.h"
+const char *
+strip_path(const char *path, int strip)
+{
+ char *t;
+
+ while (strip > 0) {
+ if ((t = strchr(path, '/')) == NULL) {
+ path = strchr(path, '\0');
+ break;
+ }
+ path = t;
+ strip--;
+ }
+
+ return path;
+}
+
int
starts_with(const char *str, const char *prefix)
{