X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fget_last_path_component.c;h=04fdf2a3e5700bc24184ed2fc0e9e47962988712;hb=8172d054db64bc80a355db111b484719930045bc;hp=72598d22e6bd37780aeb948a5822556420ffa790;hpb=0ef64bdb40c54681e8dd5ab8df42ac88e4ab1d4a;p=oweals%2Fbusybox.git 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 @@ * * 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"