aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index a15ae68da..a313078cf 100644
--- a/utility.c
+++ b/utility.c
@@ -1675,6 +1675,23 @@ char process_escape_sequence(char **ptr)
1675} 1675}
1676#endif 1676#endif
1677 1677
1678#if defined BB_BASENAME || defined BB_LN
1679char *get_last_path_component(char *path)
1680{
1681 char *s=path+strlen(path)-1;
1682
1683 /* strip trailing slashes */
1684 while (s && *s == '/') {
1685 *s-- = '\0';
1686 }
1687
1688 /* find last component */
1689 s = strrchr(path, '/');
1690 if (s==NULL) return path;
1691 else return s+1;
1692}
1693#endif
1694
1678/* END CODE */ 1695/* END CODE */
1679/* 1696/*
1680Local Variables: 1697Local Variables: