summaryrefslogtreecommitdiff
path: root/libbb/get_last_path_component.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-05-23 00:40:54 +0200
committerDenys Vlasenko2011-05-23 00:40:54 +0200
commitb24ef035bd08919075edd79b906e18909ac44eb9 (patch)
tree78485aace67fbbf061b339b81af143b074ee4108 /libbb/get_last_path_component.c
parent7948ecb505135c811a44bc8f8e391622d893d383 (diff)
downloadbusybox-b24ef035bd08919075edd79b906e18909ac44eb9.zip
busybox-b24ef035bd08919075edd79b906e18909ac44eb9.tar.gz
find: cater for libc w/o FNM_CASEFOLD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/get_last_path_component.c')
-rw-r--r--libbb/get_last_path_component.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 72598d2..04fdf2a 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -6,8 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
#include "libbb.h"
+
+const char* FAST_FUNC bb_basename(const char *name)
+{
+ const char *cp = strrchr(name, '/');
+ if (cp)
+ return cp + 1;
+ return name;
+}
+
/*
* "/" -> "/"
* "abc" -> "abc"