aboutsummaryrefslogtreecommitdiff
path: root/libbb/get_last_path_component.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 15:21:20 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 15:21:20 +0000
commit0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2 (patch)
tree6709ddd6071a9c238ba69233540bbcfe560c6a44 /libbb/get_last_path_component.c
parent67758035a4fe040c6ac69b39d61bcd6bddd7b827 (diff)
parent56a3b82e9692a25ef9c9269e88feac0d579ce8e8 (diff)
downloadbusybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.gz
busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.bz2
busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.zip
Merge commit '56a3b82e9692a25ef9c9269e88feac0d579ce8e8' into merge
Conflicts: coreutils/ls.c include/platform.h libbb/bb_basename.c
Diffstat (limited to 'libbb/get_last_path_component.c')
-rw-r--r--libbb/get_last_path_component.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 72598d22e..db4be68ad 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -6,8 +6,21 @@
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
11const char* FAST_FUNC bb_basename(const char *name)
12{
13 const char *cp = strrchr(name, '/');
14 if (cp)
15 return cp + 1;
16#if ENABLE_PLATFORM_MINGW32
17 cp = strrchr(name, '\\');
18 if (cp)
19 return cp + 1;
20#endif
21 return name;
22}
23
11/* 24/*
12 * "/" -> "/" 25 * "/" -> "/"
13 * "abc" -> "abc" 26 * "abc" -> "abc"