summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 77773bf5..a925be36 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -167,6 +167,28 @@ int rmrf(const char *path)
}
}
+/** Parse the basename of a program from a path.
+* Grabbed from the uClibc source.
+* @param path path to parse basename from
+*
+* @return everything following the final '/'
+*/
+char *mbasename(const char *path)
+{
+ const char *s;
+ const char *p;
+
+ p = s = path;
+
+ while (*s) {
+ if (*s++ == '/') {
+ p = s;
+ }
+ }
+
+ return (char *)p;
+}
+
/* output a string, but wrap words properly with a specified indentation
*/
void indentprint(const char *str, int indent)