diff options
Diffstat (limited to 'libbb/get_last_path_component.c')
-rw-r--r-- | libbb/get_last_path_component.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c index 72598d22e..04fdf2a3e 100644 --- a/libbb/get_last_path_component.c +++ b/libbb/get_last_path_component.c | |||
@@ -6,8 +6,16 @@ | |||
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
8 | */ | 8 | */ |
9 | |||
10 | #include "libbb.h" | 9 | #include "libbb.h" |
10 | |||
11 | const char* FAST_FUNC bb_basename(const char *name) | ||
12 | { | ||
13 | const char *cp = strrchr(name, '/'); | ||
14 | if (cp) | ||
15 | return cp + 1; | ||
16 | return name; | ||
17 | } | ||
18 | |||
11 | /* | 19 | /* |
12 | * "/" -> "/" | 20 | * "/" -> "/" |
13 | * "abc" -> "abc" | 21 | * "abc" -> "abc" |