1 /* vi: set sw=4 ts=4: */
3 * bb_get_last_path_component implementation for busybox
5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
17 char* FAST_FUNC bb_get_last_path_component_nostrip(const char *path)
19 char *slash = strrchr(path, '/');
21 if (!slash || (slash == path && !slash[1]))
31 * "abc/def/" -> "def" !!
33 char* FAST_FUNC bb_get_last_path_component_strip(char *path)
35 char *slash = last_char_is(path, '/');
38 while (*slash == '/' && slash != path)
41 return bb_get_last_path_component_nostrip(path);