aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/get_last_path_component.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 15eb85ca8..3a9b9237e 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -10,11 +10,13 @@
10 10
11const char* FAST_FUNC bb_basename(const char *name) 11const char* FAST_FUNC bb_basename(const char *name)
12{ 12{
13 const char *cp = strrchr(name, '/');
14 if (cp)
15 return cp + 1;
16#if ENABLE_PLATFORM_MINGW32 13#if ENABLE_PLATFORM_MINGW32
17 cp = strrchr(name, '\\'); 14 const char *cp;
15 for (cp = name; *cp; cp++)
16 if (*cp == '/' || *cp == '\\')
17 name = cp + 1;
18#else
19 const char *cp = strrchr(name, '/');
18 if (cp) 20 if (cp)
19 return cp + 1; 21 return cp + 1;
20#endif 22#endif