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.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index d91d1d43..0377bf79 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -157,25 +157,17 @@ 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 *mbasename(const char *path)
{
- const char *s;
- const char *p;
-
- p = s = path;
-
- while (*s) {
- if (*s++ == '/') {
- p = s;
- }
+ const char *last = strrchr(path, '/');
+ if(last) {
+ return(last + 1);
}
-
- return (char *)p;
+ return(path);
}
/** Parse the dirname of a program from a path.